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