Neko 1.99.5
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
neko_api.f90
Go to the documentation of this file.
1! Copyright (c) 2022-2026, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
35 use neko
38 use, intrinsic :: iso_c_binding
39 implicit none
40 private
41
42contains
43
45 subroutine neko_api_init() bind(c, name="neko_init")
46
47 call neko_init()
48
49 end subroutine neko_api_init
50
52 subroutine neko_api_finalize() bind(c, name="neko_finalize")
53
54 call neko_finalize()
55
56 end subroutine neko_api_finalize
57
59 subroutine neko_api_device_init() bind(c, name="neko_device_init")
60
61 call device_init
62
63 end subroutine neko_api_device_init
64
66 subroutine neko_api_device_finalize() bind(c, name="neko_device_finalize")
67
68 call device_finalize
69
70 end subroutine neko_api_device_finalize
71
73 subroutine neko_api_job_info() bind(c, name="neko_job_info")
74 logical :: initialized
75
76 call mpi_initialized(initialized)
77
78 if (.not.initialized) then
79 call neko_warning('Neko has not been initialised')
80 else
81 call neko_job_info()
82 call neko_log%newline()
83 end if
84
85 end subroutine neko_api_job_info
86
88 subroutine neko_api_registry_init() bind(c, name="neko_registry_init")
89
90 call neko_registry%init()
91 call neko_const_registry%init()
92
93 end subroutine neko_api_registry_init
94
96 subroutine neko_api_registry_free() bind(c, name="neko_registry_free")
97
98 call neko_registry%free()
99
100 end subroutine neko_api_registry_free
101
104 bind(c, name="neko_scratch_registry_init")
105
106 call neko_scratch_registry%init()
107
108 end subroutine neko_api_scratch_registry_init
109
112 bind(c, name="neko_scratch_registry_free")
113
114 call neko_scratch_registry%free()
115
116 end subroutine neko_api_scratch_registry_free
117
120 subroutine neko_api_case_allocate(case_iptr) &
121 bind(c, name="neko_case_allocate")
122 integer(c_intptr_t), intent(inout) :: case_iptr
123 type(case_t), pointer :: C
124 type(c_ptr) :: cp
125
126 allocate(c)
127 cp = c_loc(c)
128 case_iptr = transfer(cp, 0_c_intptr_t)
129
130 end subroutine neko_api_case_allocate
131
135 subroutine neko_api_case_init(case_json, case_len, case_iptr) &
136 bind(c, name="neko_case_init")
137 type(c_ptr), intent(in) :: case_json
138 integer(c_int), value :: case_len
139 integer(c_intptr_t), intent(inout) :: case_iptr
140 type(json_file) :: json_case
141 type(case_t), pointer :: C
142 type(c_ptr) :: cp
143
144 ! Check if the case has already been allocated
145 ! e.g. if a user callback has been injected
146 cp = transfer(case_iptr, c_null_ptr)
147 if (c_associated(cp)) then
148 call c_f_pointer(cp, c)
149 else
150 allocate(c)
151 cp = c_loc(c)
152 case_iptr = transfer(cp, 0_c_intptr_t)
153 end if
154
155 ! Convert passed in serialised JSON object into a Fortran
156 ! character string and create a json_file object
157 if (c_associated(case_json)) then
158 block
159 character(kind=c_char,len=case_len+1),pointer :: s
160 character(len=:), allocatable :: fcase_json
161 call c_f_pointer(case_json, s)
162 fcase_json = s(1:case_len)
163 call json_case%load_from_string(fcase_json)
164 deallocate(fcase_json)
165 nullify(s)
166 end block
167 end if
168
169 !
170 ! Create case
171 !
172 call c%init(json_case)
173
174 !
175 ! Create simulation components
176 !
177 call neko_simcomps%init(c)
178
179 end subroutine neko_api_case_init
180
181
184 subroutine neko_api_case_free(case_iptr) bind(c, name="neko_case_free")
185 integer(c_intptr_t), intent(inout) :: case_iptr
186 type(case_t), pointer :: C
187 type(c_ptr) :: cp
188
189 cp = transfer(case_iptr, c_null_ptr)
190 if (c_associated(cp)) then
191 call c_f_pointer(cp, c)
192 call c%free()
193 else
194 call neko_error('Invalid Neko case')
195 end if
196
197 end subroutine neko_api_case_free
198
202 function neko_api_case_time(case_iptr) result(time) &
203 bind(c, name="neko_case_time")
204 integer(c_intptr_t), intent(inout) :: case_iptr
205 real(kind=c_rp) :: time
206 type(case_t), pointer :: c
207 type(c_ptr) :: cptr
208
209 cptr = transfer(case_iptr, c_null_ptr)
210 if (c_associated(cptr)) then
211 call c_f_pointer(cptr, c)
212 time = c%time%t
213 else
214 call neko_error('Invalid Neko case')
215 end if
216
217 end function neko_api_case_time
218
222 function neko_api_case_end_time(case_iptr) result(end_time) &
223 bind(c, name="neko_case_end_time")
224 integer(c_intptr_t), intent(inout) :: case_iptr
225 real(kind=c_rp) :: end_time
226 type(case_t), pointer :: c
227 type(c_ptr) :: cptr
228
229 cptr = transfer(case_iptr, c_null_ptr)
230 if (c_associated(cptr)) then
231 call c_f_pointer(cptr, c)
232 end_time = c%time%end_time
233 else
234 call neko_error('Invalid Neko case')
235 end if
236
237 end function neko_api_case_end_time
238
242 function neko_api_case_tstep(case_iptr) result(tstep) &
243 bind(c, name="neko_case_tstep")
244 integer(c_intptr_t), intent(inout) :: case_iptr
245 type(case_t), pointer :: c
246 type(c_ptr) :: cptr
247 integer(c_int) :: tstep
248
249 cptr = transfer(case_iptr, c_null_ptr)
250 if (c_associated(cptr)) then
251 call c_f_pointer(cptr, c)
252 tstep = c%time%tstep
253 else
254 call neko_error('Invalid Neko case')
255 end if
256
257 end function neko_api_case_tstep
258
261 subroutine neko_api_solve(case_iptr) bind(c, name="neko_solve")
262 integer(c_intptr_t), intent(inout) :: case_iptr
263 type(case_t), pointer :: C
264 type(c_ptr) :: cp
265
266 cp = transfer(case_iptr, c_null_ptr)
267 if (c_associated(cp)) then
268 call c_f_pointer(cp, c)
269 call neko_solve(c)
270 else
271 call neko_error('Invalid Neko case')
272 end if
273
274 end subroutine neko_api_solve
275
278 subroutine neko_api_step(case_iptr) &
279 bind(c, name="neko_step")
281 integer(c_intptr_t), intent(inout) :: case_iptr
282 type(case_t), pointer :: C
283 type(c_ptr) :: cptr
284 type(json_file) :: dt_params
285 type(time_step_controller_t), save, allocatable :: dt_controller
286 real(kind=dp), save :: step_loop_start = 0.0_dp
287
288 cptr = transfer(case_iptr, c_null_ptr)
289 if (c_associated(cptr)) then
290 call c_f_pointer(cptr, c)
291
292 if (.not. allocated(dt_controller)) then
293 allocate(dt_controller)
294 call json_get(c%params, 'case.time', dt_params)
295 call dt_controller%init(dt_params)
296 end if
297
298 if (c%time%tstep .eq. 0) then
299 call simulation_init(c, dt_controller)
300
301 step_loop_start = mpi_wtime()
302 end if
303
304 if (.not. c%time%is_done()) then
305 call simulation_step(c, dt_controller, step_loop_start)
306 end if
307
308 if (c%time%is_done()) then
309 call simulation_finalize(c)
310 if (allocated(dt_controller)) then
311 deallocate(dt_controller)
312 end if
313 end if
314
315 else
316 call neko_error('Invalid Neko case')
317 end if
318
319 end subroutine neko_api_step
320
325 subroutine neko_api_output_ctrl_execute(case_iptr, force_output) &
326 bind(c, name="neko_output_ctrl_execute")
327 integer(c_intptr_t), intent(inout) :: case_iptr
328 logical(kind=c_bool), value :: force_output
329 logical :: f_force_output
330 type(case_t), pointer :: C
331 type(c_ptr) :: cp
332 type(time_state_t) :: f_time
333
334 cp = transfer(case_iptr, c_null_ptr)
335 if (c_associated(cp)) then
336 call c_f_pointer(cp, c)
337 else
338 call neko_error('Invalid Neko case')
339 end if
340
341 f_force_output = transfer(force_output, f_force_output)
342 call c%output_controller%execute(c%time, f_force_output)
343
344 end subroutine neko_api_output_ctrl_execute
345
348 function neko_api_field(field_name) result(field_ptr) &
349 bind(c, name='neko_field')
350 character(kind=c_char), dimension(*), intent(in) :: field_name
351 character(len=8192) :: name
352 type(field_t), pointer :: field
353 type(c_ptr) :: field_ptr
354 integer :: len
355
356 len = 0
357 do
358 if (field_name(len+1) .eq. c_null_char) exit
359 len = len + 1
360 name(len:len) = field_name(len)
361 end do
362
363 field => neko_registry%get_field(trim(name(1:len)))
364
365 field_ptr = c_loc(field%x)
366
367 end function neko_api_field
368
371 function neko_api_field_order(field_name) result(field_lx) &
372 bind(c, name='neko_field_order')
373 character(kind=c_char), dimension(*), intent(in) :: field_name
374 character(len=8192) :: name
375 type(field_t), pointer :: field
376 integer(c_int) :: field_lx
377 integer :: len
378
379 len = 0
380 do
381 if (field_name(len+1) .eq. c_null_char) exit
382 len = len + 1
383 name(len:len) = field_name(len)
384 end do
385
386 field => neko_registry%get_field(trim(name(1:len)))
387
388 field_lx = field%Xh%lx
389
390 end function neko_api_field_order
391
394 function neko_api_field_nelements(field_name) result(field_nelv) &
395 bind(c, name='neko_field_nelements')
396 character(kind=c_char), dimension(*), intent(in) :: field_name
397 character(len=8192) :: name
398 type(field_t), pointer :: field
399 integer(c_int) :: field_nelv
400 integer :: len
401
402 len = 0
403 do
404 if (field_name(len+1) .eq. c_null_char) exit
405 len = len + 1
406 name(len:len) = field_name(len)
407 end do
408
409 field => neko_registry%get_field(trim(name(1:len)))
410
411 field_nelv = field%msh%nelv
412
413 end function neko_api_field_nelements
414
417 function neko_api_field_size(field_name) result(field_size) &
418 bind(c, name='neko_field_size')
419 character(kind=c_char), dimension(*), intent(in) :: field_name
420 character(len=8192) :: name
421 type(field_t), pointer :: field
422 integer(c_int) :: field_size
423 integer :: len
424
425 len = 0
426 do
427 if (field_name(len+1) .eq. c_null_char) exit
428 len = len + 1
429 name(len:len) = field_name(len)
430 end do
431
432 field => neko_registry%get_field(trim(name(1:len)))
433
434 field_size = field%dof%size()
435
436 end function neko_api_field_size
437
444 subroutine neko_api_field_dofmap(field_name, dof_ptr, x_ptr, y_ptr, z_ptr) &
445 bind(c, name='neko_field_dofmap')
446 character(kind=c_char), dimension(*), intent(in) :: field_name
447 type(c_ptr), intent(inout) :: dof_ptr, x_ptr, y_ptr, z_ptr
448 character(len=8192) :: name
449 type(field_t), pointer :: field
450 integer :: len
451
452 len = 0
453 do
454 if (field_name(len+1) .eq. c_null_char) exit
455 len = len + 1
456 name(len:len) = field_name(len)
457 end do
458
459 field => neko_registry%get_field(trim(name(1:len)))
460 call neko_api_wrap_dofmap(field%dof, dof_ptr, x_ptr, y_ptr, z_ptr)
461
462 end subroutine neko_api_field_dofmap
463
471 subroutine neko_api_case_fluid_dofmap(case_iptr, dof_ptr, &
472 x_ptr, y_ptr, z_ptr, size) bind(c, name='neko_case_fluid_dofmap')
473 integer(c_intptr_t), intent(inout) :: case_iptr
474 type(case_t), pointer :: C
475 type(c_ptr) :: cptr
476 type(c_ptr), intent(inout) :: dof_ptr, x_ptr, y_ptr, z_ptr
477 integer, intent(inout) :: size
478
479 cptr = transfer(case_iptr, c_null_ptr)
480 if (c_associated(cptr)) then
481 call c_f_pointer(cptr, c)
482 call neko_api_wrap_dofmap(c%fluid%dm_Xh, dof_ptr, x_ptr, y_ptr, z_ptr)
483 size = c%fluid%dm_Xh%size()
484 else
485 call neko_error('Invalid Neko case')
486 end if
487
488 end subroutine neko_api_case_fluid_dofmap
489
491 subroutine neko_api_wrap_dofmap(dm, dof_ptr, x_ptr, y_ptr, z_ptr)
492 type(dofmap_t), target, intent(in) :: dm
493 type(c_ptr), intent(inout) :: dof_ptr, x_ptr, y_ptr, z_ptr
494
495 dof_ptr = c_loc(dm%dof)
496 x_ptr = c_loc(dm%x)
497 y_ptr = c_loc(dm%y)
498 z_ptr = c_loc(dm%z)
499
500 end subroutine neko_api_wrap_dofmap
501
515 subroutine neko_api_field_space(field_name, lx, zg, &
516 dr_inv, ds_inv, dt_inv, wx, wy, wz, dx, dy, dz) &
517 bind(c, name='neko_field_space')
518 character(kind=c_char), dimension(*), intent(in) :: field_name
519 integer, intent(inout) :: lx
520 type(c_ptr), intent(inout) :: zg, dr_inv, ds_inv, dt_inv
521 type(c_ptr), intent(inout) :: wx, wy, wz, dx, dy, dz
522 character(len=8192) :: name
523 type(field_t), pointer :: field
524 integer :: len
525
526 len = 0
527 do
528 if (field_name(len+1) .eq. c_null_char) exit
529 len = len + 1
530 name(len:len) = field_name(len)
531 end do
532
533 field => neko_registry%get_field(trim(name(1:len)))
534 call neko_api_wrap_space(field%Xh, lx, zg, dr_inv, ds_inv, dt_inv, &
535 wx, wy, wz, dx, dy, dz)
536
537 end subroutine neko_api_field_space
538
552 subroutine neko_api_case_fluid_space(case_iptr, lx, zg, &
553 dr_inv, ds_inv, dt_inv, wx, wy, wz, dx, dy, dz) &
554 bind(c, name='neko_case_fluid_space')
555 integer(c_intptr_t), intent(inout) :: case_iptr
556 type(case_t), pointer :: C
557 type(c_ptr) :: cptr
558 integer, intent(inout) :: lx
559 type(c_ptr), intent(inout) :: zg, dr_inv, ds_inv, dt_inv
560 type(c_ptr), intent(inout) :: wx, wy, wz, dx, dy, dz
561
562
563 cptr = transfer(case_iptr, c_null_ptr)
564 if (c_associated(cptr)) then
565 call c_f_pointer(cptr, c)
566 call neko_api_wrap_space(c%fluid%Xh, lx, zg, dr_inv, ds_inv, dt_inv, &
567 wx, wy, wz, dx, dy, dz)
568 else
569 call neko_error('Invalid Neko case')
570 end if
571
572 end subroutine neko_api_case_fluid_space
573
575 subroutine neko_api_wrap_space(Xh, lx, zg, dr_inv, ds_inv, dt_inv, &
576 wx, wy, wz, dx, dy, dz)
577 type(space_t), target, intent(in) :: Xh
578 integer, intent(inout) :: lx
579 type(c_ptr), intent(inout) :: zg, dr_inv, ds_inv, dt_inv
580 type(c_ptr), intent(inout) :: wx, wy, wz, dx, dy, dz
581
582 lx = xh%lx
583 zg = c_loc(xh%zg)
584 dr_inv = c_loc(xh%dr_inv)
585 ds_inv = c_loc(xh%ds_inv)
586 dt_inv = c_loc(xh%dt_inv)
587 wx = c_loc(xh%wx)
588 wy = c_loc(xh%wy)
589 wz = c_loc(xh%wz)
590 dx = c_loc(xh%dx)
591 dy = c_loc(xh%dy)
592 dz = c_loc(xh%dz)
593
594 end subroutine neko_api_wrap_space
595
598 subroutine neko_api_case_fluid_coef(case_iptr, G11, G22, G33, G12, G13, G23, &
599 mult, dxdr, dydr, dzdr, dxds, dyds, dzds, dxdt, dydt, dzdt, &
600 drdx, drdy, drdz, dsdx, dsdy, dsdz, dtdx, dtdy, dtdz, &
601 jac, B, area, nx, ny, nz) bind(c, name='neko_case_fluid_coef')
602 integer(c_intptr_t), intent(inout) :: case_iptr
603 type(case_t), pointer :: C
604 type(c_ptr) :: cptr
605 type(c_ptr), intent(inout) :: G11, G22, G33, G12, G13, G23
606 type(c_ptr), intent(inout) :: mult
607 type(c_ptr), intent(inout) :: dxdr, dydr, dzdr
608 type(c_ptr), intent(inout) :: dxds, dyds, dzds
609 type(c_ptr), intent(inout) :: dxdt, dydt, dzdt
610 type(c_ptr), intent(inout) :: drdx, drdy, drdz
611 type(c_ptr), intent(inout) :: dsdx, dsdy, dsdz
612 type(c_ptr), intent(inout) :: dtdx, dtdy, dtdz
613 type(c_ptr), intent(inout) :: jac, B, area, nx, ny, nz
614
615
616 cptr = transfer(case_iptr, c_null_ptr)
617 if (c_associated(cptr)) then
618 call c_f_pointer(cptr, c)
619 g11 = c_loc(c%fluid%c_Xh%G11)
620 g22 = c_loc(c%fluid%c_Xh%G22)
621 g33 = c_loc(c%fluid%c_Xh%G33)
622 g12 = c_loc(c%fluid%c_Xh%G12)
623 g13 = c_loc(c%fluid%c_Xh%G13)
624 g23 = c_loc(c%fluid%c_Xh%G23)
625 mult = c_loc(c%fluid%c_Xh%mult)
626 dxdr = c_loc(c%fluid%c_Xh%dxdr)
627 dydr = c_loc(c%fluid%c_Xh%dydr)
628 dzdr = c_loc(c%fluid%c_Xh%dzdr)
629 dxds = c_loc(c%fluid%c_Xh%dxds)
630 dyds = c_loc(c%fluid%c_Xh%dyds)
631 dzds = c_loc(c%fluid%c_Xh%dzds)
632 dxdt = c_loc(c%fluid%c_Xh%dxdt)
633 dydt = c_loc(c%fluid%c_Xh%dydt)
634 dzdt = c_loc(c%fluid%c_Xh%dzdt)
635 drdx = c_loc(c%fluid%c_Xh%drdx)
636 drdy = c_loc(c%fluid%c_Xh%drdy)
637 drdz = c_loc(c%fluid%c_Xh%drdz)
638 dsdx = c_loc(c%fluid%c_Xh%dsdx)
639 dsdy = c_loc(c%fluid%c_Xh%dsdy)
640 dsdz = c_loc(c%fluid%c_Xh%dsdz)
641 dtdx = c_loc(c%fluid%c_Xh%dtdx)
642 dtdy = c_loc(c%fluid%c_Xh%dtdy)
643 dtdz = c_loc(c%fluid%c_Xh%dtdz)
644 jac = c_loc(c%fluid%c_Xh%jac)
645 b = c_loc(c%fluid%c_Xh%B)
646 area = c_loc(c%fluid%c_Xh%area)
647 nx = c_loc(c%fluid%c_Xh%nx)
648 ny = c_loc(c%fluid%c_Xh%ny)
649 nz = c_loc(c%fluid%c_Xh%nz)
650 else
651 call neko_error('Invalid Neko case')
652 end if
653
654 end subroutine neko_api_case_fluid_coef
655
664 subroutine neko_api_user_setup(case_iptr, initial_cb, preprocess_cb, &
665 compute_cb, dirichlet_cb, material_cb, source_cb) &
666 bind(c, name='neko_user_setup')
667 integer(c_intptr_t), intent(inout) :: case_iptr
668 type(c_funptr), value :: initial_cb, preprocess_cb, compute_cb
669 type(c_funptr), value :: dirichlet_cb, material_cb, source_cb
670 type(case_t), pointer :: C
671 type(c_ptr) :: cptr
672
673 cptr = transfer(case_iptr, c_null_ptr)
674 if (c_associated(cptr)) then
675 call c_f_pointer(cptr, c)
676 call neko_api_user_cb_register(c%user, initial_cb, preprocess_cb, &
677 compute_cb, dirichlet_cb, material_cb, source_cb)
678 else
679 call neko_error('Invalid Neko case')
680 end if
681
682 end subroutine neko_api_user_setup
683
686 function neko_api_user_cb_field_by_name(field_name) result(field_ptr) &
687 bind(c, name='neko_cb_field_by_name')
688 character(kind=c_char), dimension(*), intent(in) :: field_name
689 character(len=8192) :: name
690 type(field_t), pointer :: field
691 type(c_ptr) :: field_ptr
692 integer :: len
693
694 len = 0
695 do
696 if (field_name(len+1) .eq. c_null_char) exit
697 len = len + 1
698 name(len:len) = field_name(len)
699 end do
700
701 field => neko_api_user_cb_get_field(trim(name(1:len)))
702
703 field_ptr = c_loc(field%x)
704
706
710 result(field_ptr) bind(c, name='neko_cb_field_by_index')
711 integer, intent(in) :: field_idx
712 type(field_t), pointer :: field
713 type(c_ptr) :: field_ptr
714
715 field => neko_api_user_cb_get_field(field_idx)
716
717 field_ptr = c_loc(field%x)
718
720
724 function neko_api_user_cb_field_name_at_index(field_idx, field_name) &
725 result(same_name) bind(c, name='neko_cb_field_name_at_index')
726 integer, intent(in) :: field_idx
727 character(kind=c_char), dimension(*), intent(in) :: field_name
728 character(len=8192) :: name
729 type(field_t), pointer :: f1, f2
730 type(c_ptr) :: field_ptr
731 integer :: len
732 logical(c_bool) :: same_name
733
734 len = 0
735 do
736 if (field_name(len+1) .eq. c_null_char) exit
737 len = len + 1
738 name(len:len) = field_name(len)
739 end do
740
741 f1 => neko_api_user_cb_get_field(field_idx)
742 f2 => neko_api_user_cb_get_field(trim(name(1:len)))
743
744 same_name = trim(f1%name) .eq. trim(f2%name)
745
746 nullify(f1, f2)
747
749
750
751end module neko_api
Defines a field.
Definition field.f90:34
Neko API user callbacks.
subroutine, public neko_api_user_cb_register(user, initial_cb, preprocess_cb, compute_cb, dirichlet_cb, material_cb, source_cb)
Register callbacks.
Neko C API.
Definition neko_api.f90:34
subroutine neko_api_wrap_dofmap(dm, dof_ptr, x_ptr, y_ptr, z_ptr)
Helper function to assign pointers to a dofmap's data.
Definition neko_api.f90:492
subroutine neko_api_finalize()
Finalize Neko.
Definition neko_api.f90:53
subroutine neko_api_wrap_space(xh, lx, zg, dr_inv, ds_inv, dt_inv, wx, wy, wz, dx, dy, dz)
Helper function to assign pointers to a space's data.
Definition neko_api.f90:577
subroutine neko_api_user_setup(case_iptr, initial_cb, preprocess_cb, compute_cb, dirichlet_cb, material_cb, source_cb)
Setup user-provided callbacks.
Definition neko_api.f90:667
subroutine neko_api_step(case_iptr)
Compute a time-step for a neko case.
Definition neko_api.f90:280
integer(c_int) function neko_api_field_nelements(field_name)
Retrive the number of elements in a field.
Definition neko_api.f90:396
subroutine neko_api_device_finalize()
Finalize Neko device layer.
Definition neko_api.f90:67
subroutine neko_api_job_info()
Display job information.
Definition neko_api.f90:74
subroutine neko_api_registry_init()
Initialise a Neko field registry.
Definition neko_api.f90:89
subroutine neko_api_field_space(field_name, lx, zg, dr_inv, ds_inv, dt_inv, wx, wy, wz, dx, dy, dz)
Retrive the space associated with a field.
Definition neko_api.f90:518
subroutine neko_api_case_free(case_iptr)
Destroy a Neko case.
Definition neko_api.f90:185
subroutine neko_api_case_allocate(case_iptr)
Allocate memory for a Neko case.
Definition neko_api.f90:122
subroutine neko_api_output_ctrl_execute(case_iptr, force_output)
Execute the Case's output controller.
Definition neko_api.f90:327
subroutine neko_api_case_init(case_json, case_len, case_iptr)
Initalise a Neko case.
Definition neko_api.f90:137
subroutine neko_api_field_dofmap(field_name, dof_ptr, x_ptr, y_ptr, z_ptr)
Retrive the dofmap associated with a field.
Definition neko_api.f90:446
subroutine neko_api_case_fluid_space(case_iptr, lx, zg, dr_inv, ds_inv, dt_inv, wx, wy, wz, dx, dy, dz)
Retrive the space associated with a case's fluid solver.
Definition neko_api.f90:555
real(kind=c_rp) function neko_api_case_end_time(case_iptr)
Retrive the end time of a case.
Definition neko_api.f90:224
type(c_ptr) function neko_api_user_cb_field_by_index(field_idx)
Retrive a pointer to a user callback field.
Definition neko_api.f90:711
logical(c_bool) function neko_api_user_cb_field_name_at_index(field_idx, field_name)
Check if the user callback field at a given index has a given name.
Definition neko_api.f90:726
subroutine neko_api_scratch_registry_init()
Initialise a Neko scratch registry.
Definition neko_api.f90:105
type(c_ptr) function neko_api_field(field_name)
Retrive a pointer to a flow field.
Definition neko_api.f90:350
integer(c_int) function neko_api_field_size(field_name)
Retrive the total number of degrees of freedom of a field.
Definition neko_api.f90:419
subroutine neko_api_scratch_registry_free()
Destroy a Neko scratch registry.
Definition neko_api.f90:113
subroutine neko_api_solve(case_iptr)
Solve a neko case.
Definition neko_api.f90:262
subroutine neko_api_case_fluid_coef(case_iptr, g11, g22, g33, g12, g13, g23, mult, dxdr, dydr, dzdr, dxds, dyds, dzds, dxdt, dydt, dzdt, drdx, drdy, drdz, dsdx, dsdy, dsdz, dtdx, dtdy, dtdz, jac, b, area, nx, ny, nz)
Retrive the coefficient associated with a case's fluid solver.
Definition neko_api.f90:602
subroutine neko_api_registry_free()
Destroy a Neko field registry.
Definition neko_api.f90:97
type(c_ptr) function neko_api_user_cb_field_by_name(field_name)
Retrive a pointer to a user callback field.
Definition neko_api.f90:688
subroutine neko_api_case_fluid_dofmap(case_iptr, dof_ptr, x_ptr, y_ptr, z_ptr, size)
Retrive the dofmap associated with a case's fluid solver.
Definition neko_api.f90:473
integer(c_int) function neko_api_field_order(field_name)
Retrive the order of a field.
Definition neko_api.f90:373
subroutine neko_api_device_init()
Initialise Neko device layer.
Definition neko_api.f90:60
real(kind=c_rp) function neko_api_case_time(case_iptr)
Retrive the current time of a case.
Definition neko_api.f90:204
integer(c_int) function neko_api_case_tstep(case_iptr)
Retrive the time-step of a case.
Definition neko_api.f90:244
subroutine neko_api_init()
Initialise Neko.
Definition neko_api.f90:46
Master module.
Definition neko.f90:34
Implements type time_step_controller.
void neko_finalize()
void neko_init()
void neko_job_info()
void neko_solve(int **case_iptr)