MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_derived_types.fpp.f90
Go to the documentation of this file.
1# 1 "/home/runner/work/MFC/MFC/src/common/m_derived_types.fpp"
2!>
3!! @file
4!! @brief Contains module m_derived_types
5
6# 1 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp" 1
7# 1 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 1
8# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
9# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
10# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
11# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
12# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
13# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
14
15# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
16# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
17# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
18
19# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
20
21# 46 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
22
23# 58 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
24
25# 68 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
26
27# 98 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
28
29# 110 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
30
31# 120 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
32
33# 145 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
34! New line at end of file is required for FYPP
35# 2 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
36# 1 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp" 1
37# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
38# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
39# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
40# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
41# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
42# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
43
44# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
45# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
46# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
47
48# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
49
50# 46 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
51
52# 58 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
53
54# 68 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
55
56# 98 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
57
58# 110 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
59
60# 120 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
61
62# 145 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
63! New line at end of file is required for FYPP
64# 2 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp" 2
65
66# 4 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
67# 5 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
68# 6 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
69# 7 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
70# 8 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
71
72# 20 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
73
74# 43 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
75
76# 48 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
77
78# 53 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
79
80# 58 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
81
82# 63 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
83
84# 68 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
85
86# 76 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
87
88# 81 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
89
90# 86 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
91
92# 91 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
93
94# 96 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
95
96# 101 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
97
98# 106 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
99
100# 111 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
101
102# 116 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
103
104# 121 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
105
106# 151 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
107
108# 192 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
109
110# 206 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
111
112# 231 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
113
114# 242 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
115
116# 244 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
117# 255 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
118
119# 284 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
120
121# 294 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
122
123# 304 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
124
125# 313 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
126
127# 330 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
128
129# 340 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
130
131# 347 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
132
133# 353 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
134
135# 359 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
136
137# 365 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
138
139# 371 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
140
141# 377 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
142! New line at end of file is required for FYPP
143# 3 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
144# 1 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp" 1
145# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
146# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
147# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
148# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
149# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
150# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
151
152# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
153# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
154# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
155
156# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
157
158# 46 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
159
160# 58 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
161
162# 68 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
163
164# 98 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
165
166# 110 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
167
168# 120 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
169
170# 145 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
171! New line at end of file is required for FYPP
172# 2 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp" 2
173
174# 7 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
175
176# 17 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
177
178# 22 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
179
180# 27 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
181
182# 32 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
183
184# 37 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
185
186# 42 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
187
188# 47 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
189
190# 52 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
191
192# 57 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
193
194# 62 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
195
196# 73 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
197
198# 78 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
199
200# 83 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
201
202# 88 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
203
204# 103 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
205
206# 131 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
207
208# 160 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
209
210# 175 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
211
212# 193 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
213
214# 215 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
215
216# 244 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
217
218# 259 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
219
220# 269 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
221
222# 278 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
223
224# 294 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
225
226# 304 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
227
228# 311 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
229! New line at end of file is required for FYPP
230# 4 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
231
232! GPU parallel region (scalar reductions, maxval/minval)
233# 23 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
234
235! GPU parallel loop over threads (most common GPU macro)
236# 43 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
237
238! Required closing for GPU_PARALLEL_LOOP
239# 55 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
240
241! Mark routine for device compilation
242# 112 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
243
244! Declare device-resident data
245# 130 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
246
247! Inner loop within a GPU parallel region
248# 145 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
249
250! Scoped GPU data region
251# 164 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
252
253! Host code with device pointers (for MPI with GPU buffers)
254# 193 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
255
256! Allocate device memory (unscoped)
257# 207 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
258
259! Free device memory
260# 219 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
261
262! Atomic operation on device
263# 231 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
264
265! End atomic capture block
266# 242 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
267
268! Copy data between host and device
269# 254 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
270
271! Synchronization barrier
272# 266 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
273
274! Import GPU library module (openacc or omp_lib)
275# 275 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
276
277! Emit code only for AMD compiler
278# 282 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
279
280! Emit code for non-Cray compilers
281# 289 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
282
283! Emit code only for Cray compiler
284# 296 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
285
286! Emit code for non-NVIDIA compilers
287# 303 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
288
289# 305 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
290# 306 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
291! New line at end of file is required for FYPP
292# 2 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp" 2
293
294# 14 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
295
296! Caution: This macro requires the use of a binding script to set CUDA_VISIBLE_DEVICES, such that we have one GPU device per MPI
297! rank. That's because for both cudaMemAdvise (preferred location) and cudaMemPrefetchAsync we use location = device_id = 0. For an
298! example see misc/nvidia_uvm/bind.sh. NVIDIA unified memory page placement hint
299# 57 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
300
301! Allocate and create GPU device memory
302# 77 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
303
304! Free GPU device memory and deallocate
305# 85 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
306
307! Cray-specific GPU pointer setup for vector fields
308# 109 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
309
310! Cray-specific GPU pointer setup for scalar fields
311# 125 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
312
313! Cray-specific GPU pointer setup for acoustic source spatials
314# 150 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
315
316# 156 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
317
318# 163 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
319! New line at end of file is required for FYPP
320# 6 "/home/runner/work/MFC/MFC/src/common/m_derived_types.fpp" 2
321
322!> @brief Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures
324
325 use m_constants
327 use m_thermochem, only: num_species
328
329 implicit none
330
331 !> Derived type adding the field position (fp) as an attribute
333 real(stp), allocatable, dimension(:,:,:) :: fp !< Field position
334 end type field_position
335
336 !> Derived type annexing a scalar field (SF)
338 real(stp), pointer, dimension(:,:,:) :: sf => null()
339 end type scalar_field
340
341 !> Derived type for bubble variables pb and mv at quadrature nodes (qbmm)
343 real(stp), pointer, dimension(:,:,:,:,:) :: sf => null()
344 end type pres_field
345
346 !> Derived type annexing an integer scalar field (SF)
348#ifdef MFC_MIXED_PRECISION
349 integer(kind=1), pointer, dimension(:,:,:) :: sf => null()
350#else
351 integer, pointer, dimension(:,:,:) :: sf => null()
352#endif
353 end type integer_field
354
355 !> Derived type for levelset
357 real(stp), pointer, dimension(:,:,:,:) :: sf => null()
358 end type levelset_field
359
360 !> Derived type for levelset norm
362 real(stp), pointer, dimension(:,:,:,:,:) :: sf => null()
363 end type levelset_norm_field
364
366 integer, allocatable, dimension(:) :: view
367 type(scalar_field), allocatable, dimension(:) :: var
368 end type mpi_io_var
369
371 integer :: view
372 type(integer_field) :: var
373 end type mpi_io_ib_var
374
376 integer :: view
377 type(levelset_field) :: var
378 end type mpi_io_levelset_var
379
384
385 !> Derived type annexing a vector field (VF)
387 type(scalar_field), allocatable, dimension(:) :: vf !< Vector field
388 end type vector_field
389
390 !> Generic 3-component vector (e.g., spatial coordinates or field components) Named _dt (derived types: x,y,z) to differentiate
391 !! from t_vec3 (3-component vector)
392 type vec3_dt ! dt for derived types
393 real(wp) :: x
394 real(wp) :: y
395 real(wp) :: z
396 end type vec3_dt
397
398 !> Left and right Riemann states
400 real(wp) :: l
401 real(wp) :: r
402 end type riemann_states
403
404 !> Left and right Riemann states for 3-component vectors
406 real(wp) :: l(3)
407 real(wp) :: r(3)
408 end type riemann_states_vec3
409
410 !> Lightweight beg/end pair for equation index ranges (no BC payload).
412 integer :: beg
413 integer :: end
414 end type idx_bounds_info
415
416 !> Integer bounds for variables
418 integer :: beg
419 integer :: end
420 real(wp) :: vb1
421 real(wp) :: vb2
422 real(wp) :: vb3
423 real(wp) :: ve1
424 real(wp) :: ve2
425 real(wp) :: ve3
426 real(wp) :: pres_in, pres_out
427 real(wp), dimension(3) :: vel_in, vel_out
428 real(wp), dimension(num_fluids_max) :: alpha_rho_in, alpha_in
429 logical :: grcbc_in, grcbc_out, grcbc_vel_out
430 logical :: isothermal_in, isothermal_out
431 real(wp) :: twall_in, twall_out
432 end type int_bounds_info
433
434 !> Groups the x, y, z boundary condition begin/end codes for passing as a single argument.
436 type(int_bounds_info) :: x, y, z
437 end type bc_xyz_info
438
439 !> QBMM moment index mappings - separate from bub beg/end so eqn_idx contains no allocatables.
441 integer, dimension(:), allocatable :: rs !< R moment indices per bubble bin
442 integer, dimension(:), allocatable :: vs !< V moment indices per bubble bin
443 integer, dimension(:), allocatable :: ps !< Pressure moment indices per bubble bin
444 integer, dimension(:), allocatable :: ms !< Mass moment indices per bubble bin
445 integer, dimension(:,:), allocatable :: moms !< Moment indices for qbmm
446 integer, dimension(:,:,:), allocatable :: fullmom !< Full moment indices for qbmm
447 end type qbmm_idx_info
448
449 !> All conserved-variable equation indices, computed at startup from model_eqns and enabled features.
450 !> Range indices (beg/end) use int_bounds_info; scalar indices are plain integers (0 = inactive).
451 !> Contains no allocatable members - safe for GPU_DECLARE as a single struct.
453 type(idx_bounds_info) :: cont !< Partial densities (continuity equations)
454 type(idx_bounds_info) :: mom !< Momentum components
455 type(idx_bounds_info) :: adv !< Volume fractions (advection equations)
456 type(idx_bounds_info) :: bub !< Bubble equation range (beg/end only)
457 type(idx_bounds_info) :: stress !< Stress tensor components
458 type(idx_bounds_info) :: xi !< Reference map equations
459 type(idx_bounds_info) :: b !< Magnetic field components
460 type(idx_bounds_info) :: int_en !< Internal energy equations
461 type(idx_bounds_info) :: species !< Chemistry species equations
462 integer :: e !< Energy/pressure equation
463 integer :: n !< Number density equation
464 integer :: alf !< Void fraction (scalar, model_eqns=4)
465 integer :: gamma !< Specific heat ratio function (model_eqns=1)
466 integer :: pi_inf !< Liquid stiffness function (model_eqns=1)
467 integer :: c !< Color function equation
468 integer :: damage !< Damage variable equation
469 integer :: psi !< Psi variable equation
470 end type eqn_idx_info
471
472 !> Initial-condition state assembled by pre_process: working primitive and
473 !> conservative fields, temperature, boundary-condition types, and the
474 !> patch-identity bookkeeping array.
476 type(scalar_field), allocatable, dimension(:) :: q_prim_vf !< Primitive variables
477 type(scalar_field), allocatable, dimension(:) :: q_cons_vf !< Conservative variables
478 type(scalar_field) :: q_t_sf !< Temperature field
479 type(integer_field), allocatable, dimension(:,:) :: bc_type !< Boundary-condition type fields
480#ifdef MFC_MIXED_PRECISION
481 integer(kind=1), allocatable, dimension(:,:,:) :: patch_id_fp !< Patch identities bookkeeping
482#else
483 integer, allocatable, dimension(:,:,:) :: patch_id_fp !< Patch identities bookkeeping
484#endif
485 end type ic_context
486
487 !> Finite-difference state for post_process: density gradient magnitude for
488 !> numerical Schlieren and centered FD coefficients in x-, y-, and z-directions.
490 real(wp), allocatable, dimension(:,:,:) :: gm_rho_sf !< Density gradient magnitude for numerical Schlieren
491 real(wp), allocatable, dimension(:,:) :: fd_coeff_x !< FD coefficients in the x-direction
492 real(wp), allocatable, dimension(:,:) :: fd_coeff_y !< FD coefficients in the y-direction
493 real(wp), allocatable, dimension(:,:) :: fd_coeff_z !< FD coefficients in the z-direction
494 end type fd_context
495
496 !> Output workspace for post_process: flow variable buffers, VisIt extents/offsets,
497 !> directory paths, Silo/Binary file handles, and variable count.
499 ! Flow variable storage; q_root_sf gathers to rank 0 in 1D parallel runs
500 real(wp), allocatable, dimension(:,:,:) :: q_sf !< Working flow variable field (public)
501 real(wp), allocatable, dimension(:,:,:) :: q_root_sf !< Gathered 1D flow variable field (rank 0 only)
502 real(wp), allocatable, dimension(:,:,:) :: cyl_q_sf !< Cylindrical-geometry reordered field
503 ! Single precision storage for flow variables
504 real(sp), allocatable, dimension(:,:,:) :: q_sf_s !< Single-precision working field (public)
505 real(sp), allocatable, dimension(:,:,:) :: q_root_sf_s !< Single-precision gathered 1D field
506 real(sp), allocatable, dimension(:,:,:) :: cyl_q_sf_s !< Single-precision cylindrical reordered field
507 ! Spatial and data extents for VisIt visualization (Silo only)
508 real(wp), allocatable, dimension(:,:) :: spatial_extents !< Spatial extents per process
509 real(wp), allocatable, dimension(:,:) :: data_extents !< Data extents per process
510 ! Ghost zone layer sizes (lo/hi) for subdomain connectivity in VisIt (Silo only)
511 integer, allocatable, dimension(:) :: lo_offset !< Ghost zone lo sizes per active direction
512 integer, allocatable, dimension(:) :: hi_offset !< Ghost zone hi sizes per active direction
513 ! Cell-boundary count per active coordinate direction (Silo only)
514 integer, allocatable, dimension(:) :: dims !< Cell-boundary counts per active direction
515 ! Formatted database directory paths
516 character(LEN=path_len + name_len) :: dbdir !< Base database directory
517 character(LEN=path_len + 2*name_len) :: proc_rank_dir !< Per-rank subdirectory
518 character(LEN=path_len + 2*name_len) :: rootdir !< Root subdirectory
519 ! Formatted database file handles
520 integer :: dbroot !< Master/root file handle
521 integer :: dbfile !< Slave/local file handle
522 integer :: optlist !< Silo options list handle (per-call scratch)
523 ! Variable count for Binary format
524 integer :: dbvars !< Total flow variables to write
525 end type output_context
526
528 integer :: geometry
529 integer :: type
530 integer :: dir
531 integer :: loc
532 real(wp), dimension(3) :: centroid
533 real(wp), dimension(3) :: length
534 real(wp) :: radius
535 end type bc_patch_parameters
536
537 !> Derived type adding beginning (beg) and end bounds info as attributes
539 real(wp) :: beg
540 real(wp) :: end
541 end type bounds_info
542
543 !> Defines parameters for a Model Patch
545 character(LEN=pathlen_max) :: filepath !< Path the STL file relative to case_dir.
546 real(wp), dimension(1:3) :: translate !< Translation of the STL object.
547 real(wp), dimension(1:3) :: scale !< Scale factor for the STL object.
548 real(wp), dimension(1:3) :: rotate !< Angle to rotate the STL object along each cartesian coordinate axis, in radians.
549 integer :: spc !< Number of samples per cell to use when discretizing the STL object.
550 real(wp) :: threshold !< Threshold to turn on smoothen STL patch.
551 end type ic_model_parameters
552
554 real(wp), dimension(1:3,1:3) :: v !< Vertices of the triangle
555 real(wp), dimension(1:3) :: n !< Normal vector
556 end type t_triangle
557
558 type :: t_bbox
559 real(wp), dimension(1:3) :: min !< Minimum coordinates
560 real(wp), dimension(1:3) :: max !< Maximum coordinates
561 end type t_bbox
562
563 type :: t_model
564 integer :: ntrs !< Number of triangles
565 type(t_triangle), allocatable :: trs(:) !< Triangles
566 end type t_model
567
569 ! Original CPU-side fields (unchanged)
570 type(t_model), allocatable :: model !< STL/OBJ geometry model
571 real(wp), allocatable, dimension(:,:,:) :: boundary_v !< Boundary vertices
572 integer :: boundary_edge_count !< Number of boundary edges
573
574 ! GPU-friendly flattened arrays
575 integer :: ntrs !< Copy of model%ntrs
576 real(wp), allocatable, dimension(:,:,:) :: trs_v !< Triangle vertices (3, 3, ntrs)
577 real(wp), allocatable, dimension(:,:) :: trs_n !< Triangle normals (3, ntrs)
578 end type t_model_array
579
580 !> Derived type adding initial condition (ic) patch parameters as attributes NOTE: The requirements for the specification of the
581 !! above parameters are strongly dependent on both the choice of the multicomponent flow model as well as the choice of the
582 !! patch geometry.
584
585 integer :: geometry !< Type of geometry for the patch
586 real(wp) :: x_centroid, y_centroid, z_centroid !< Geometric center coordinates of the patch
587 real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
588 real(wp) :: radius !< Dimensions of the patch. radius.
589 real(wp), dimension(3) :: radii !< Elliptical/ellipsoidal patch radii in x, y, z
590 real(wp) :: epsilon, beta !< The isentropic vortex parameters for the amplitude of the disturbance and domain of influence.
591 real(wp), dimension(2:9) :: a !< Used by hardcoded IC and as temporary variables.
592 logical :: non_axis_sym
593
594 ! Geometry 13 (2D modal Fourier): fourier_cos(n), fourier_sin(n) for mode n
595 real(wp), dimension(1:max_2d_fourier_modes) :: fourier_cos, fourier_sin
596 !> When true, clip boundary radius: R(theta) = max(R(theta), modal_r_min) (Non-exp form only)
597 logical :: modal_clip_r_to_min
598 real(wp) :: modal_r_min !< Minimum boundary radius when modal_clip_r_to_min is true (Non-exp form only)
599 logical :: modal_use_exp_form !< When true, boundary = radius*exp(Fourier series)
600 ! Geometry 14 (3D spherical harmonic): sph_har_coeff(l,m) for real Y_lm
601 real(wp), dimension(0:max_sph_harm_degree,-max_sph_harm_degree:max_sph_harm_degree) :: sph_har_coeff
602 real(wp), dimension(3) :: normal !< Patch orientation normal vector (x, y, z)
603 logical, dimension(0:num_patches_max - 1) :: alter_patch !< Overwrite permissions for preceding patches
604 logical :: smoothen !< Whether patch boundaries are smoothed across cells
605 integer :: smooth_patch_id !< Identity (id) of the patch with which current patch is to get smoothed
606 real(wp) :: smooth_coeff !< Smoothing stencil size coefficient
607 real(wp), dimension(num_fluids_max) :: alpha_rho
608 real(wp) :: rho
609 real(wp), dimension(3) :: vel
610 real(wp) :: pres
611 real(wp), dimension(num_fluids_max) :: alpha
612 real(wp) :: gamma
613 real(wp) :: pi_inf
614 real(wp) :: cv
615 real(wp) :: qv
616 real(wp) :: qvp !< Reference entropy per unit mass (SGEOS)
617 real(wp) :: bx, by, bz !< Magnetic field components; B%x is not used for 1D
618 real(wp), dimension(6) :: tau_e !< Elastic stresses added to primitive variables if hypoelasticity = True
619 real(wp) :: r0 !< Bubble size
620 real(wp) :: v0 !< Bubble velocity
621 real(wp) :: p0 !< Bubble size
622 real(wp) :: m0 !< Bubble velocity
623 integer :: hcid !< Hardcoded initial condition ID
624 real(wp) :: cf_val !< Color function value
625 real(wp) :: y(1:num_species) !< Species mass fractions
626
627 ! STL/OBJ model patch: index into the shared stl_models(:) table
628 integer :: model_id !< index into stl_models(:) for STL/OBJ geometry patches
629 end type ic_patch_parameters
630
631 !> User-input parameters for a NACA 4-digit airfoil (namelist-safe: scalars only)
633 real(wp) :: c = dflt_real !< chord length
634 real(wp) :: p = dflt_real !< maximum camber position (fraction of chord)
635 real(wp) :: t = dflt_real !< maximum thickness (fraction of chord)
636 real(wp) :: m = dflt_real !< maximum camber (fraction of chord)
637 end type ib_airfoil_parameters
638
639 !> Computed surface grid for a NACA airfoil (simulation-only, not in namelist)
641 integer :: np = 0 !< number of surface grid points per surface
642 type(vec3_dt), allocatable :: upper(:) !< upper surface grid points (1:Np)
643 type(vec3_dt), allocatable :: lower(:) !< lower surface grid points (1:Np)
644 end type ib_airfoil_grid
645
646 !> User-input parameters for an STL/OBJ immersed boundary model (namelist-safe: scalars + fixed arrays)
648 character(LEN=pathlen_max) :: model_filepath !< Path to the STL file relative to case_dir.
649 real(wp), dimension(1:3) :: model_translate !< Translation of the STL object.
650 real(wp), dimension(1:3) :: model_scale !< Scale factor for the STL object.
651 real(wp) :: model_threshold !< Threshold to turn on smooth STL patch.
652 end type ib_stl_parameters
653
655 integer :: geometry !< Type of geometry for the patch
656 integer :: gbl_patch_id
657 real(wp) :: x_centroid, y_centroid, z_centroid !< Geometric center coordinates of the patch
658
659 !> Centroid locations of intermediate steps in the time_stepper module
660 real(wp) :: step_x_centroid, step_y_centroid, step_z_centroid
661 real(wp), dimension(1:3) :: centroid_offset !< offset of center of mass from computed cell center for odd-shaped IBs
662 real(wp), dimension(1:3) :: angles
663 real(wp), dimension(1:3) :: step_angles
664 !> matrix that converts from IB reference frame to fluid reference frame
665 real(wp), dimension(1:3,1:3) :: rotation_matrix
666 !> matrix that converts from fluid reference frame to IB reference frame
667 real(wp), dimension(1:3,1:3) :: rotation_matrix_inverse
668 integer :: airfoil_id !< index into ib_airfoil(:) for airfoil geometry patches
669 integer :: model_id !< index into stl_models(:) for STL/OBJ geometry patches
670 real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
671 real(wp) :: radius !< Dimensions of the patch. radius.
672 logical :: slip
673 integer :: moving_ibm !< 0 for no moving, 1 for moving, 2 for moving on forced path
674 real(wp) :: mass, moment !< mass and moment of inertia of object used to compute forces in 2-way coupling
675 real(wp), dimension(1:3) :: force, torque !< vectors for the computed force and torque values applied to an IB
676 real(wp), dimension(1:3) :: vel
677 real(wp), dimension(1:3) :: step_vel !< velocity array used to store intermediate steps in the time_stepper module
678 real(wp), dimension(1:3) :: angular_vel
679 real(wp), dimension(1:3) :: step_angular_vel !< velocity array used to store intermediate steps in the time_stepper module
680 end type ib_patch_parameters
681
683 real(wp) :: x_centroid, y_centroid, z_centroid !< Center of the particle bed region
684 real(wp) :: length_x, length_y, length_z !< Dimensions of the particle bed region
685 integer :: num_particles !< Number of particles to generate
686 real(wp) :: radius !< Particle radius
687 real(wp) :: mass !< Particle mass
688 real(wp) :: min_spacing !< Minimum surface-to-surface gap (particle centers are 2*radius + min_spacing apart)
689 integer :: moving_ibm !< Motion flag: 0=static, 1=moving (forces), 2=forced path
690 integer :: seed !< Random seed for reproducible placement
691 integer :: packing_method !< Packing algorithm: 1=rejection sampling, 2=lattice
693
694 !> Derived type annexing the physical parameters (PP) of the fluids. These include the specific heat ratio function and liquid
695 !! stiffness function.
697 real(wp) :: gamma !< Sp. heat ratio
698 real(wp) :: pi_inf !< Liquid stiffness
699 real(wp), dimension(2) :: re !< Reynolds number
700 real(wp) :: cv !< heat capacity
701 real(wp) :: qv !< reference energy per unit mass for SGEOS, q (see Le Metayer (2004))
702 real(wp) :: qvp !< reference entropy per unit mass for SGEOS, q' (see Le Metayer (2004))
703 real(wp) :: g
704 logical :: non_newtonian !< Enable Herschel-Bulkley non-Newtonian viscosity
705 real(wp) :: k !< HB consistency index
706 real(wp) :: nn !< HB flow behavior index
707 real(wp) :: tau0 !< HB yield stress (0 => power-law)
708 real(wp) :: hb_m !< Papanastasiou regularization parameter
709 real(wp) :: mu_min !< Lower viscosity clamp (inactive sentinel = dflt_real)
710 real(wp) :: mu_max !< Upper viscosity clamp (required when non_newtonian)
711 real(wp) :: mu_bulk !< Bulk viscosity for NN (inactive sentinel = dflt_real)
712 end type physical_parameters
713
714 !> Derived type annexing the physical parameters required for sub-grid bubble models
716 real(wp) :: r0ref !< reference bubble radius
717 real(wp) :: p0ref !< reference pressure
718 real(wp) :: rho0ref !< reference density
719 real(wp) :: t0ref !< reference temperature
720 real(wp) :: ss !< surface tension between host and gas (bubble)
721 real(wp) :: pv !< vapor pressure of host
722 real(wp) :: vd !< vapor diffusivity in gas (bubble)
723 real(wp) :: mu_l !< viscosity of host in liquid state
724 real(wp) :: mu_v !< viscosity of host in vapor state
725 real(wp) :: mu_g !< viscosity of gas (bubble)
726 real(wp) :: gam_v !< specific heat ratio of host in vapor state
727 real(wp) :: gam_g !< specific heat ratio of gas (bubble)
728 real(wp) :: m_v !< Molecular weight of host
729 real(wp) :: m_g !< Molecular weight of gas (bubble)
730 real(wp) :: k_v !< thermal conductivity of host in vapor state
731 real(wp) :: k_g !< thermal conductivity of gas (bubble)
732 real(wp) :: cp_v !< specific heat capacity in constant pressure of host in vapor state
733 real(wp) :: cp_g !< specific heat capacity in constant pressure of gas (bubble)
734 real(wp) :: r_v !< gas constant of host in vapor state
735 real(wp) :: r_g !< gas constant of gas (bubble)
737
739 integer, dimension(2) :: view
740 type(vec3_dt), allocatable, dimension(:) :: var
741 end type mpi_io_airfoil_ib_var
742
743 !> Derived type annexing integral regions
745 real(wp) :: xmin !< Min. boundary first coordinate direction
746 real(wp) :: xmax !< Max. boundary first coordinate direction
747 real(wp) :: ymin !< Min. boundary second coordinate direction
748 real(wp) :: ymax !< Max. boundary second coordinate direction
749 real(wp) :: zmin !< Min. boundary third coordinate direction
750 real(wp) :: zmax !< Max. boundary third coordinate direction
751 end type integral_parameters
752
753 !> Acoustic source parameters
755 integer :: pulse !< Type of pulse
756 integer :: support !< Type of support
757 logical :: dipole !< Whether the source is a dipole or monopole
758 real(wp), dimension(3) :: loc !< Physical location of acoustic source
759 real(wp) :: mag !< Acoustic pulse magnitude
760 real(wp) :: length !< Length of planar source (2D/3D)
761 real(wp) :: height !< Height of planar source (3D)
762 real(wp) :: wavelength !< Wave length of pulse
763 real(wp) :: frequency !< Frequency of pulse
764 real(wp) :: gauss_sigma_dist !< sigma of Gaussian pulse multiplied by speed of sound
765 real(wp) :: gauss_sigma_time !< sigma of Gaussian pulse
766 real(wp) :: npulse !< Number of cycles of pulse
767 real(wp) :: dir !< Direction of pulse
768 real(wp) :: delay !< Time-delay of pulse start
769 real(wp) :: foc_length !< Focal length of transducer
770 real(wp) :: aperture !< Aperture diameter of transducer
771 real(wp) :: element_spacing_angle !< Spacing between aperture elements in 2D acoustic array
772 !> Ratio of aperture element diameter to side length of polygon connecting their centers, in 3D acoustic array
773 real(wp) :: element_polygon_ratio
774 real(wp) :: rotate_angle !< Angle of rotation of the entire circular 3D acoustic array
775 real(wp) :: bb_bandwidth !< Bandwidth of each frequency in broadband wave
776 real(wp) :: bb_lowest_freq !< The lower frequency bound of broadband wave
777 integer :: num_elements !< Number of elements in the acoustic array
778 integer :: element_on !< Element in the acoustic array to turn on
779 integer :: bb_num_freq !< Number of frequencies in the broadband wave
780 end type acoustic_parameters
781
782 !> Acoustic source source_spatial pre-calculated values
784 integer, pointer, dimension(:,:) :: coord => null() !< List of grid points indices with non-zero source_spatial values
785 real(wp), pointer, dimension(:) :: val => null() !< List of non-zero source_spatial values
786 real(wp), pointer, dimension(:) :: angle => null() !< List of angles with x-axis for mom source term vector
787 real(wp), pointer, dimension(:,:) :: xyz_to_r_ratios => null() !< List of [xyz]/r for mom source term vector
788 end type source_spatial_type
789
790 !> Ghost Point for Immersed Boundaries
792 integer, dimension(3) :: loc !< Physical location of the ghost point
793 real(wp), dimension(3) :: ip_loc !< Physical location of the image point
794 integer, dimension(3) :: ip_grid !< Top left grid point of IP
795 real(wp), dimension(2, 2, 2) :: interp_coeffs !< Interpolation Coefficients of image point
796 integer :: ib_patch_id !< ID of the IB Patch the ghost point is part of
797 real(wp) :: levelset
798 real(wp), dimension(1:3) :: levelset_norm
799 logical :: slip
800 integer, dimension(3) :: db
801 integer :: x_periodicity, y_periodicity, z_periodicity
802 end type ghost_point
803
804 !> Species parameters
806 character(LEN=name_len) :: name !< Name of species
807 end type species_parameters
808
809 !> Chemistry parameters
811 character(LEN=name_len) :: cantera_file !< Path to Cantera file
812 logical :: diffusion
813 logical :: reactions
814
815 !> Method of determining gamma.
816 !> gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97.
817 !> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats.
818 integer :: gamma_method
819 integer :: transport_model
820 end type chemistry_parameters
821
822 !> Lagrangian bubble parameters
824
825 integer :: solver_approach !< 1: One-way coupling, 2: two-way coupling
826 integer :: cluster_type !< Cluster model to find p_inf
827 logical :: pressure_corrector !< Cell pressure correction term
828 integer :: smooth_type !< Smoothing function. 1: Gaussian, 2:Delta 3x3
829 logical :: heattransfer_model !< Activate HEAT transfer model at the bubble-liquid interface
830 logical :: masstransfer_model !< Activate MASS transfer model at the bubble-liquid interface
831 logical :: write_bubbles !< Write files to track the bubble evolution each time step
832 logical :: write_bubbles_stats !< Write the maximum and minimum radius of each bubble
833 integer :: nbubs_glb !< Global number of bubbles
834 real(wp) :: epsilonb !< Standard deviation scaling for the gaussian function
835 real(wp) :: charwidth !< Domain virtual depth (z direction, for 2D simulations)
836 real(wp) :: valmaxvoid !< Maximum void fraction permitted
838
839 !> Max and min number of cells in a direction of each combination of x-,y-, and z-
841 integer :: mn_max, np_max, mp_max, mnp_max
842 integer :: mn_min, np_min, mp_min, mnp_min
843 end type cell_num_bounds
844
846 logical, dimension(3) :: perturb_vel
847 real(wp), dimension(3) :: perturb_vel_freq
848 real(wp), dimension(3) :: perturb_vel_scale
849 real(wp), dimension(3, 3) :: perturb_vel_offset
850 logical, dimension(1:num_fluids_max) :: perturb_dens
851 real(wp), dimension(1:num_fluids_max) :: perturb_dens_freq
852 real(wp), dimension(1:num_fluids_max) :: perturb_dens_scale
853 real(wp), dimension(1:num_fluids_max,3) :: perturb_dens_offset
854 end type simplex_noise_params
855end module m_derived_types
type(scalar_field), dimension(sys_size), intent(inout) q_cons_vf
integer, intent(in) k
integer, intent(in) l
Compile-time constant parameters: default values, tolerances, and physical constants.
real(wp), parameter dflt_real
Default real value.
Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures.
Working-precision kind selection (half/single/double) and corresponding MPI datatype parameters.
integer, parameter sp
integer, parameter wp
Change to single_precision if needed.
integer, parameter stp
Groups the x, y, z boundary condition begin/end codes for passing as a single argument.
Derived type adding beginning (beg) and end bounds info as attributes.
Max and min number of cells in a direction of each combination of x-,y-, and z-.
All conserved-variable equation indices, computed at startup from model_eqns and enabled features....
Finite-difference state for post_process: density gradient magnitude for numerical Schlieren and cent...
Derived type adding the field position (fp) as an attribute.
Ghost Point for Immersed Boundaries.
Computed surface grid for a NACA airfoil (simulation-only, not in namelist).
User-input parameters for a NACA 4-digit airfoil (namelist-safe: scalars only).
User-input parameters for an STL/OBJ immersed boundary model (namelist-safe: scalars + fixed arrays).
Initial-condition state assembled by pre_process: working primitive and conservative fields,...
Defines parameters for a Model Patch.
Derived type adding initial condition (ic) patch parameters as attributes NOTE: The requirements for ...
Lightweight beg/end pair for equation index ranges (no BC payload).
Integer bounds for variables.
Derived type annexing an integer scalar field (SF).
Derived type annexing integral regions.
Derived type for levelset norm.
Output workspace for post_process: flow variable buffers, VisIt extents/offsets, directory paths,...
Derived type annexing the physical parameters (PP) of the fluids. These include the specific heat rat...
Derived type for bubble variables pb and mv at quadrature nodes (qbmm).
QBMM moment index mappings - separate from bub beg/end so eqn_idx contains no allocatables.
Left and right Riemann states for 3-component vectors.
Left and right Riemann states.
Derived type annexing a scalar field (SF).
Acoustic source source_spatial pre-calculated values.
Derived type annexing the physical parameters required for sub-grid bubble models.
Generic 3-component vector (e.g., spatial coordinates or field components) Named _dt (derived types: ...
Derived type annexing a vector field (VF).