17from dataclasses
import dataclass
21initial_condition = CFUNCTYPE(
None, POINTER(c_char_p), c_int)
23preprocess = CFUNCTYPE(
None, c_double, c_int)
25compute = CFUNCTYPE(
None, c_double, c_int)
27dirichlet_condition = CFUNCTYPE(
None, POINTER(c_int), c_int, c_double, c_int)
29material_properties = CFUNCTYPE(
None, POINTER(c_char_p), c_int, c_double, c_int)
31source_term = CFUNCTYPE(
None, POINTER(c_char_p), c_int, c_double, c_int)
86 POINTER(POINTER(c_longlong)),
87 POINTER(POINTER(c_double)),
88 POINTER(POINTER(c_double)),
89 POINTER(POINTER(c_double))]
93 POINTER(POINTER(c_longlong)),
94 POINTER(POINTER(c_double)),
95 POINTER(POINTER(c_double)),
96 POINTER(POINTER(c_double)),
102 POINTER(POINTER(c_double)),
103 POINTER(POINTER(c_double)),
104 POINTER(POINTER(c_double)),
105 POINTER(POINTER(c_double)),
106 POINTER(POINTER(c_double)),
107 POINTER(POINTER(c_double)),
108 POINTER(POINTER(c_double)),
109 POINTER(POINTER(c_double)),
110 POINTER(POINTER(c_double)),
111 POINTER(POINTER(c_double))]
116 POINTER(POINTER(c_double)),
117 POINTER(POINTER(c_double)),
118 POINTER(POINTER(c_double)),
119 POINTER(POINTER(c_double)),
120 POINTER(POINTER(c_double)),
121 POINTER(POINTER(c_double)),
122 POINTER(POINTER(c_double)),
123 POINTER(POINTER(c_double)),
124 POINTER(POINTER(c_double)),
125 POINTER(POINTER(c_double))]
129 POINTER(POINTER(c_double)),
130 POINTER(POINTER(c_double)),
131 POINTER(POINTER(c_double)),
132 POINTER(POINTER(c_double)),
133 POINTER(POINTER(c_double)),
134 POINTER(POINTER(c_double)),
135 POINTER(POINTER(c_double)),
136 POINTER(POINTER(c_double)),
137 POINTER(POINTER(c_double)),
138 POINTER(POINTER(c_double)),
139 POINTER(POINTER(c_double)),
140 POINTER(POINTER(c_double)),
141 POINTER(POINTER(c_double)),
142 POINTER(POINTER(c_double)),
143 POINTER(POINTER(c_double)),
144 POINTER(POINTER(c_double)),
145 POINTER(POINTER(c_double)),
146 POINTER(POINTER(c_double)),
147 POINTER(POINTER(c_double)),
148 POINTER(POINTER(c_double)),
149 POINTER(POINTER(c_double)),
150 POINTER(POINTER(c_double)),
151 POINTER(POINTER(c_double)),
152 POINTER(POINTER(c_double)),
153 POINTER(POINTER(c_double)),
154 POINTER(POINTER(c_double)),
155 POINTER(POINTER(c_double)),
156 POINTER(POINTER(c_double)),
157 POINTER(POINTER(c_double)),
158 POINTER(POINTER(c_double)),
159 POINTER(POINTER(c_double))]
183 """ Defines a Neko mapping of the degrees of freedom """
192 """ Defines a Neko space. """
207 """ Defines a Neko field. """
214 """ Defines Neko coefficients. """
248 """ Initialise Neko. """
252 """ Finalize Neko. """
256 """ Initialise Neko device layer. """
260 """ Finalize Neko device lyaer. """
264 """ Display job information. """
268 """ Initialise a neko registry. """
272 """ Destroy a neko registry. """
275def case_init(case_json,
276 cb_initial_condition = initial_condition(0),
282 """Initialise a Neko case
284 A case is created based on a JSON file and a couple of (optional)
299 user_setup(case_descr, cb_initial_condition, cb_preprocess,
300 cb_compute, cb_dirichlet_condition, cb_material_properties,
307def case_free(case_descr):
308 """ Destroy a Neko case. """
312 """ Retrive the current time of a case. """
316def end_time(case_descr):
317 """ Retrive the end time of a case. """
321def tstep(case_descr):
322 """ Retrive the current time-step of a case. """
327 """ Check if a case has reached its end time. """
331def solve(case_descr):
332 """ Solve a Neko case. """
336 """ Compute a time-step for a Neko case. """
340 """ Retrive a Neko field as a `neko_field_t`. """
351def field_order(name):
352 """ Retrive the order of a Neko field. """
356def field_nelements(name):
357 """ Retrive the number of elements in a Neko field. """
362 """ Retrive the total number of degrees of freedom of a Neko field. """
366def field_dofmap(name):
367 """ Retrive a dofmap of a Neko field as a `neko_dofmap_t`. """
369 dof_ptr = POINTER(c_longlong)()
370 x_ptr = POINTER(c_double)()
371 y_ptr = POINTER(c_double)()
372 z_ptr = POINTER(c_double)()
374 byref(x_ptr), byref(y_ptr), byref(z_ptr))
376 dofmap =
wrap_dofmap(dof_ptr, x_ptr, y_ptr, z_ptr, size)
380def case_fluid_dofmap(case_descr):
381 """ Retrive a dofmap of a Neko case's fluid solver as a `neko_dofmap_t`. """
383 dof_ptr = POINTER(c_longlong)()
384 x_ptr = POINTER(c_double)()
385 y_ptr = POINTER(c_double)()
386 z_ptr = POINTER(c_double)()
388 byref(x_ptr), byref(y_ptr), byref(z_ptr),
409def field_space(name):
410 """ Retrive a space of a Neko field as a `neko_space_t`. """
412 zg = POINTER(c_double)()
413 dr_inv = POINTER(c_double)()
414 ds_inv = POINTER(c_double)()
415 dt_inv = POINTER(c_double)()
416 wx = POINTER(c_double)()
417 wy = POINTER(c_double)()
418 wz = POINTER(c_double)()
419 dx = POINTER(c_double)()
420 dy = POINTER(c_double)()
421 dz = POINTER(c_double)()
423 byref(dr_inv), byref(ds_inv), byref(dt_inv),
424 byref(wx), byref(wy), byref(wz),
425 byref(dx), byref(dy), byref(dz))
428 dr_inv, ds_inv, dt_inv,
429 wx, wy, wz, dx, dy, dz)
433def case_fluid_space(case_descr):
434 """ Retrive a space of a Neko case's fluid solver as a `neko_space_t`. """
436 zg = POINTER(c_double)()
437 dr_inv = POINTER(c_double)()
438 ds_inv = POINTER(c_double)()
439 dt_inv = POINTER(c_double)()
440 wx = POINTER(c_double)()
441 wy = POINTER(c_double)()
442 wz = POINTER(c_double)()
443 dx = POINTER(c_double)()
444 dy = POINTER(c_double)()
445 dz = POINTER(c_double)()
447 byref(dr_inv), byref(ds_inv), byref(dt_inv),
448 byref(wx), byref(wy), byref(wz),
449 byref(dx), byref(dy), byref(dz))
452 dr_inv, ds_inv, dt_inv,
453 wx, wy, wz, dx, dy, dz)
457def wrap_space(lx, zg, dr_inv, ds_inv, dt_inv, wx, wy, wz, dx, dy, dz):
484def case_fluid_coef(case_descr):
485 """ Retrive coefficients of a Neko case's fluid solver as a `neko_coef_t`. """
486 G11_ptr = POINTER(c_double)()
487 G22_ptr = POINTER(c_double)()
488 G33_ptr = POINTER(c_double)()
489 G12_ptr = POINTER(c_double)()
490 G13_ptr = POINTER(c_double)()
491 G23_ptr = POINTER(c_double)()
492 mult_ptr = POINTER(c_double)()
493 dxdr_ptr = POINTER(c_double)()
494 dydr_ptr = POINTER(c_double)()
495 dzdr_ptr = POINTER(c_double)()
496 dxds_ptr = POINTER(c_double)()
497 dyds_ptr = POINTER(c_double)()
498 dzds_ptr = POINTER(c_double)()
499 dxdt_ptr = POINTER(c_double)()
500 dydt_ptr = POINTER(c_double)()
501 dzdt_ptr = POINTER(c_double)()
502 drdx_ptr = POINTER(c_double)()
503 drdy_ptr = POINTER(c_double)()
504 drdz_ptr = POINTER(c_double)()
505 dsdx_ptr = POINTER(c_double)()
506 dsdy_ptr = POINTER(c_double)()
507 dsdz_ptr = POINTER(c_double)()
508 dtdx_ptr = POINTER(c_double)()
509 dtdy_ptr = POINTER(c_double)()
510 dtdz_ptr = POINTER(c_double)()
511 jac_ptr = POINTER(c_double)()
512 B_ptr = POINTER(c_double)()
513 area_ptr = POINTER(c_double)()
514 nx_ptr = POINTER(c_double)()
515 ny_ptr = POINTER(c_double)()
516 nz_ptr = POINTER(c_double)()
551 dm = case_fluid_dofmap(case_descr)
620def user_setup(case_descr, cb_initial_condition, cb_preprocess, cb_compute,
621 cb_dirichlet_condition, cb_material_properties, cb_source_term):
622 """ Setup user-provided callbacks. """
624 cb_initial_condition,
627 cb_dirichlet_condition,
628 cb_material_properties,
634def callback_field(name):
635 """ Retrive a callback's Neko field as a `neko_field_t`. """
646def callback_field_name(index, name):
647 """ Check the name of a field at a certain index in the callback's field list. """
648 field_index = c_int(index)
650 return same_field > 0
652def bc_mask(msk, msk_size):
662 return cast(create_string_buffer(
s.encode()),c_char_p)
__global__ void ale_add_kinematics_kernel(const int n, T *__restrict__ wx, T *__restrict__ wy, T *__restrict__ wz, const T *__restrict__ x_ref, const T *__restrict__ y_ref, const T *__restrict__ z_ref, const T *__restrict__ phi, const T *__restrict__ x, const T *__restrict__ y, const T *__restrict__ z, const kinematics_params_t kin_params)
user_setup(case_descr, cb_initial_condition, cb_preprocess, cb_compute, cb_dirichlet_condition, cb_material_properties, cb_source_term)
wrap_dofmap(dof_ptr, x_ptr, y_ptr, z_ptr, size)
wrap_space(lx, zg, dr_inv, ds_inv, dt_inv, wx, wy, wz, dx, dy, dz)
python_dict_to_fortran(d)
Implements the source_term_t type and a wrapper source_term_wrapper_t.