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# 12 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
20# 1 "/home/runner/work/MFC/MFC/src/common/include/defaults/thermochem.fpp" 1
21! Default for Fypp runs outside the toolchain (e.g. documentation). Searched last, so the
22! build/include/<target>/thermochem.fpp the toolchain writes from m_thermochem takes precedence.
23# 4 "/home/runner/work/MFC/MFC/src/common/include/defaults/thermochem.fpp"
24# 5 "/home/runner/work/MFC/MFC/src/common/include/defaults/thermochem.fpp"
25# 13 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 2
26
27# 16 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
28# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
29
30# 24 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
31
32# 53 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
33
34# 65 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
35
36# 75 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
37
38# 105 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
39
40# 117 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
41
42# 127 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
43
44# 174 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
45! New line at end of file is required for FYPP
46# 2 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
47# 1 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp" 1
48# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
49# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
50# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
51# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
52# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
53# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
54
55# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
56# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
57# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
58
59# 12 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
60# 1 "/home/runner/work/MFC/MFC/src/common/include/defaults/thermochem.fpp" 1
61! Default for Fypp runs outside the toolchain (e.g. documentation). Searched last, so the
62! build/include/<target>/thermochem.fpp the toolchain writes from m_thermochem takes precedence.
63# 4 "/home/runner/work/MFC/MFC/src/common/include/defaults/thermochem.fpp"
64# 5 "/home/runner/work/MFC/MFC/src/common/include/defaults/thermochem.fpp"
65# 13 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 2
66
67# 16 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
68# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
69
70# 24 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
71
72# 53 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
73
74# 65 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
75
76# 75 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
77
78# 105 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
79
80# 117 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
81
82# 127 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
83
84# 174 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
85! New line at end of file is required for FYPP
86# 2 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp" 2
87
88# 4 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
89# 5 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
90# 6 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
91# 7 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
92# 8 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
93
94# 20 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
95
96# 49 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
97
98# 54 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
99
100# 59 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
101
102# 64 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
103
104# 69 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
105
106# 74 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
107
108# 87 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
109
110# 101 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
111
112# 106 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
113
114# 111 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
115
116# 116 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
117
118# 121 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
119
120# 126 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
121
122# 131 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
123
124# 136 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
125
126# 141 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
127
128# 171 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
129
130# 231 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
131
132# 245 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
133
134# 270 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
135
136# 281 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
137
138# 283 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
139# 294 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
140
141# 343 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
142
143# 353 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
144
145# 363 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
146
147# 372 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
148
149# 389 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
150
151# 399 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
152
153# 406 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
154
155# 412 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
156
157# 418 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
158
159# 424 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
160
161# 430 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
162
163# 436 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
164! New line at end of file is required for FYPP
165# 3 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
166# 1 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp" 1
167# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
168# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
169# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
170# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
171# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
172# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
173
174# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
175# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
176# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
177
178# 12 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
179# 1 "/home/runner/work/MFC/MFC/src/common/include/defaults/thermochem.fpp" 1
180! Default for Fypp runs outside the toolchain (e.g. documentation). Searched last, so the
181! build/include/<target>/thermochem.fpp the toolchain writes from m_thermochem takes precedence.
182# 4 "/home/runner/work/MFC/MFC/src/common/include/defaults/thermochem.fpp"
183# 5 "/home/runner/work/MFC/MFC/src/common/include/defaults/thermochem.fpp"
184# 13 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 2
185
186# 16 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
187# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
188
189# 24 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
190
191# 53 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
192
193# 65 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
194
195# 75 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
196
197# 105 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
198
199# 117 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
200
201# 127 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
202
203# 174 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
204! New line at end of file is required for FYPP
205# 2 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp" 2
206
207# 7 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
208
209# 17 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
210
211# 22 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
212
213# 27 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
214
215# 32 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
216
217# 37 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
218
219# 42 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
220
221# 47 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
222
223# 52 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
224
225# 57 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
226
227# 62 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
228
229# 73 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
230
231# 78 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
232
233# 83 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
234
235# 88 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
236
237# 103 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
238
239# 131 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
240
241# 161 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
242
243# 176 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
244
245# 194 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
246
247# 216 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
248
249# 245 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
250
251# 260 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
252
253# 270 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
254
255# 279 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
256
257# 295 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
258
259# 305 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
260
261# 312 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
262! New line at end of file is required for FYPP
263# 4 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
264
265! GPU parallel region (scalar reductions, maxval/minval)
266# 23 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
267
268! GPU parallel loop over threads (most common GPU macro)
269# 44 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
270
271! Required closing for GPU_PARALLEL_LOOP
272# 56 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
273
274! Mark routine for device compilation
275# 113 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
276
277! Declare device-resident data
278# 131 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
279
280! Inner loop within a GPU parallel region
281# 146 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
282
283! Scoped GPU data region
284# 165 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
285
286! Host code with device pointers (for MPI with GPU buffers)
287# 191 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
288
289! Allocate device memory (unscoped)
290# 205 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
291
292! Free device memory
293# 217 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
294
295! Atomic operation on device
296# 229 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
297
298! End atomic capture block
299# 240 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
300
301! Copy data between host and device
302# 252 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
303
304! Synchronization barrier
305# 264 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
306
307! Import GPU library module (openacc or omp_lib)
308# 273 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
309
310! Emit code only for AMD compiler
311# 280 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
312
313! Emit code for non-Cray compilers
314# 287 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
315
316! Emit code only for Cray compiler
317# 294 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
318
319! Cray compiler directive, emitted from Fypp so the formatter cannot turn it into a comment
320# 301 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
321
322! Emit code for non-NVIDIA compilers
323# 308 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
324
325# 310 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
326# 311 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
327! New line at end of file is required for FYPP
328# 2 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp" 2
329
330# 14 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
331
332! Caution: This macro requires the use of a binding script to set CUDA_VISIBLE_DEVICES, such that we have one GPU device per MPI
333! rank. That's because for both cudaMemAdvise (preferred location) and cudaMemPrefetchAsync we use location = device_id = 0. For an
334! example see misc/nvidia_uvm/bind.sh.
335# 52 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
336
337! Allocate and create GPU device memory
338# 72 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
339
340! Free GPU device memory and deallocate
341# 80 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
342
343! Cray-specific GPU pointer setup for vector fields
344# 104 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
345
346! Cray-specific GPU pointer setup for scalar fields
347# 120 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
348
349! Cray-specific GPU pointer teardown for scalar fields - exact inverse of ACC_SETUP_SFs. Removes the
350! present-table entries ACC_SETUP_SFs added (the scalar_field descriptor and its %sf copyin). REQUIRED when
351! an ACC_SETUP'd field is freed MID-RUN (e.g. AMR slot free on regrid/restart): Cray 'exit data delete'
352! decrements the reference counter, so the lone @:DEALLOCATE(arg%sf) only undoes the @:ALLOCATE create ref
353! and leaves the descriptor + the ACC_SETUP %sf copyin dangling. Call BEFORE @:DEALLOCATE(arg%sf).
354# 140 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
355
356! Cray-specific GPU pointer setup for acoustic source spatials
357# 165 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
358
359! Whether stress index idx is a shear component. Spelled out because NVHPC 26.9 at -O2 vectorizes any(idx == shear_indices)
360! inside a loop to always true, which doubled the normal-stress elastic energy.
361# 171 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
362
363# 177 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
364
365# 184 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
366! New line at end of file is required for FYPP
367# 6 "/home/runner/work/MFC/MFC/src/common/m_derived_types.fpp" 2
368
369!> @brief Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures
371
372 use m_constants
374 use m_thermochem, only: num_species
375
376 implicit none
377
378 !> Derived type adding the field position (fp) as an attribute
380 real(stp), allocatable, dimension(:,:,:) :: fp !< Field position
381 end type field_position
382
383 !> Derived type annexing a scalar field (SF)
385 real(stp), pointer, dimension(:,:,:) :: sf => null()
386 end type scalar_field
387
388 !> Derived type for bubble variables pb and mv at quadrature nodes (qbmm)
390 real(stp), pointer, dimension(:,:,:,:,:) :: sf => null()
391 end type pres_field
392
393 !> Derived type annexing an integer scalar field (SF)
395#ifdef MFC_MIXED_PRECISION
396 integer(kind=1), pointer, dimension(:,:,:) :: sf => null()
397#else
398 integer, pointer, dimension(:,:,:) :: sf => null()
399#endif
400 end type integer_field
401
402 !> Derived type for levelset
404 real(stp), pointer, dimension(:,:,:,:) :: sf => null()
405 end type levelset_field
406
407 !> Derived type for levelset norm
409 real(stp), pointer, dimension(:,:,:,:,:) :: sf => null()
410 end type levelset_norm_field
411
413 integer, allocatable, dimension(:) :: view
414 type(scalar_field), allocatable, dimension(:) :: var
415 end type mpi_io_var
416
418 integer :: view
419 type(integer_field) :: var
420 end type mpi_io_ib_var
421
423 integer :: view
424 type(levelset_field) :: var
425 end type mpi_io_levelset_var
426
431
432 !> Derived type annexing a vector field (VF)
434 type(scalar_field), allocatable, dimension(:) :: vf !< Vector field
435 end type vector_field
436
437 !> Generic 3-component vector (e.g., spatial coordinates or field components) Named _dt (derived types: x,y,z) to differentiate
438 !! from t_vec3 (3-component vector)
439 type vec3_dt ! dt for derived types
440 real(wp) :: x
441 real(wp) :: y
442 real(wp) :: z
443 end type vec3_dt
444
445 !> Left and right Riemann states
447 real(wp) :: l
448 real(wp) :: r
449 end type riemann_states
450
451 !> Left and right Riemann states for 3-component vectors
453 real(wp) :: l(3)
454 real(wp) :: r(3)
455 end type riemann_states_vec3
456
457 !> Lightweight beg/end pair for equation index ranges (no BC payload).
459 integer :: beg
460 integer :: end
461 end type idx_bounds_info
462
463 !> Integer bounds for variables
465 integer :: beg
466 integer :: end
467 real(wp) :: vb1
468 real(wp) :: vb2
469 real(wp) :: vb3
470 real(wp) :: ve1
471 real(wp) :: ve2
472 real(wp) :: ve3
473 real(wp) :: pres_in, pres_out
474 real(wp), dimension(3) :: vel_in, vel_out
475 real(wp), dimension(num_fluids_max) :: alpha_rho_in, alpha_in
476 logical :: grcbc_in, grcbc_out, grcbc_vel_out
477 !> Smooth start-up of a GRCBC inflow: the inflow velocity is scaled by f(t) = vel_in_frac0 + (1 - vel_in_frac0) (1 + tanh(6
478 !! (t - t0)/tau - 3))/2, so it leaves vel_in_frac0 of its final value at t0 and reaches it after vel_in_ramp. Inactive when
479 !! the ramp duration is zero.
480 real(wp) :: vel_in_ramp, vel_in_t0, vel_in_frac0
481 logical :: isothermal_in, isothermal_out
482 real(wp) :: twall_in, twall_out
483 end type int_bounds_info
484
485 !> Groups the x, y, z boundary condition begin/end codes for passing as a single argument.
487 type(int_bounds_info) :: x, y, z
488 end type bc_xyz_info
489
490 !> QBMM moment index mappings - separate from bub beg/end so eqn_idx contains no allocatables.
492 integer, dimension(:), allocatable :: rs !< R moment indices per bubble bin
493 integer, dimension(:), allocatable :: vs !< V moment indices per bubble bin
494 integer, dimension(:), allocatable :: ps !< Pressure moment indices per bubble bin
495 integer, dimension(:), allocatable :: ms !< Mass moment indices per bubble bin
496 integer, dimension(:,:), allocatable :: moms !< Moment indices for qbmm
497 integer, dimension(:,:,:), allocatable :: fullmom !< Full moment indices for qbmm
498 end type qbmm_idx_info
499
500 !> All conserved-variable equation indices, computed at startup from model_eqns and enabled features.
501 !> Range indices (beg/end) use int_bounds_info; scalar indices are plain integers (0 = inactive).
502 !> Contains no allocatable members - safe for GPU_DECLARE as a single struct.
504 type(idx_bounds_info) :: cont !< Partial densities (continuity equations)
505 type(idx_bounds_info) :: mom !< Momentum components
506 type(idx_bounds_info) :: adv !< Volume fractions (advection equations)
507 type(idx_bounds_info) :: bub !< Bubble equation range (beg/end only)
508 type(idx_bounds_info) :: stress !< Stress tensor components
509 type(idx_bounds_info) :: b !< Magnetic field components
510 type(idx_bounds_info) :: int_en !< Internal energy equations
511 type(idx_bounds_info) :: species !< Chemistry species equations
512 integer :: e !< Energy/pressure equation
513 integer :: n !< Number density equation
514 integer :: alf !< Void fraction (scalar, model_eqns=4)
515 integer :: gamma !< Specific heat ratio function (model_eqns=1)
516 integer :: pi_inf !< Liquid stiffness function (model_eqns=1)
517 integer :: c !< Color function equation
518 integer :: damage !< Damage variable equation
519 integer :: psi !< Psi variable equation
520 end type eqn_idx_info
521
522 !> Indices of the projected Lagrangian particle fields (q_particles); vector ranges span num_dims
524 integer :: alphaf !< Fluid volume fraction
525 type(idx_bounds_info) :: alpha_p_up !< Particle volume fraction times velocity, alpha_p u_p
526 type(idx_bounds_info) :: alpha_p_up_squared !< alpha_p u_p^2
527 type(idx_bounds_info) :: sm !< Momentum sources (two-way coupling)
528 integer :: se !< Energy source (two-way coupling)
529 integer :: num !< Number of fields for the coupling mode
530 end type part_q_idx_info
531
532 !> Indices of the projected Lagrangian bubble fields (q_beta); absent fields are 0
534 integer :: alphaf !< Void fraction beta while smearing, then the liquid volume fraction 1 - beta
535 integer :: dbetadt !< Time derivative of the void fraction
536 integer :: src_tmp !< Scratch for the pressure gradient and p u_l in the source terms
537 integer :: dsrc_tmp !< Scratch for the derivative of p u_l (two-way coupling)
538 integer :: beta_dbetadt !< Smeared V_b dV_b/dt, not the product of the alphaf and dbetadt fields (cluster_type >= 4)
539 integer :: num !< Number of fields
540 end type bub_q_idx_info
541
542 !> Indices of the cell fields used for the Lagrangian particle forces and sources (field_vars)
544 type(idx_bounds_info) :: dp !< Pressure gradient
545 type(idx_bounds_info) :: drho !< Density gradient
546 type(idx_bounds_info) :: du !< Velocity gradient; du_i/dx_j at du%beg + num_dims*(i - 1) + j - 1
547 type(idx_bounds_info) :: dalphaf !< Fluid volume fraction gradient
548 type(idx_bounds_info) :: dalpha_p_up !< Gradient of alpha_p u_p
549 integer :: src_tmp !< Scratch for p u_l in the pressure source terms
550 integer :: dsrc_tmp !< Scratch for the derivatives in the pressure source terms
551 integer :: num !< Number of fields
552 end type part_field_idx_info
553
554 !> Initial-condition state assembled by pre_process: working primitive and
555 !> conservative fields, temperature, boundary-condition types, and the
556 !> patch-identity bookkeeping array.
558 type(scalar_field), allocatable, dimension(:) :: q_prim_vf !< Primitive variables
559 type(scalar_field), allocatable, dimension(:) :: q_cons_vf !< Conservative variables
560 type(scalar_field) :: q_t_sf !< Temperature field
561 type(integer_field), allocatable, dimension(:,:) :: bc_type !< Boundary-condition type fields
562#ifdef MFC_MIXED_PRECISION
563 integer(kind=1), allocatable, dimension(:,:,:) :: patch_id_fp !< Patch identities bookkeeping
564#else
565 integer, allocatable, dimension(:,:,:) :: patch_id_fp !< Patch identities bookkeeping
566#endif
567 end type ic_context
568
569 !> Finite-difference state for post_process: density gradient magnitude for
570 !> numerical Schlieren and centered FD coefficients in x-, y-, and z-directions.
572 real(wp), allocatable, dimension(:,:,:) :: gm_rho_sf !< Density gradient magnitude for numerical Schlieren
573 real(wp), allocatable, dimension(:,:) :: fd_coeff_x !< FD coefficients in the x-direction
574 real(wp), allocatable, dimension(:,:) :: fd_coeff_y !< FD coefficients in the y-direction
575 real(wp), allocatable, dimension(:,:) :: fd_coeff_z !< FD coefficients in the z-direction
576 end type fd_context
577
578 !> Output workspace for post_process: flow variable buffers, VisIt extents/offsets,
579 !> directory paths, Silo/Binary file handles, and variable count.
581 ! Flow variable storage; q_root_sf gathers to rank 0 in 1D parallel runs
582 real(wp), allocatable, dimension(:,:,:) :: q_sf !< Working flow variable field (public)
583 real(wp), allocatable, dimension(:,:,:) :: q_root_sf !< Gathered 1D flow variable field (rank 0 only)
584 real(wp), allocatable, dimension(:,:,:) :: cyl_q_sf !< Cylindrical-geometry reordered field
585 ! Single precision storage for flow variables
586 real(sp), allocatable, dimension(:,:,:) :: q_sf_s !< Single-precision working field (public)
587 real(sp), allocatable, dimension(:,:,:) :: q_root_sf_s !< Single-precision gathered 1D field
588 real(sp), allocatable, dimension(:,:,:) :: cyl_q_sf_s !< Single-precision cylindrical reordered field
589 ! Spatial and data extents for VisIt visualization (Silo only)
590 real(wp), allocatable, dimension(:,:) :: spatial_extents !< Spatial extents per process
591 real(wp), allocatable, dimension(:,:) :: data_extents !< Data extents per process
592 ! Ghost zone layer sizes (lo/hi) for subdomain connectivity in VisIt (Silo only)
593 integer, allocatable, dimension(:) :: lo_offset !< Ghost zone lo sizes per active direction
594 integer, allocatable, dimension(:) :: hi_offset !< Ghost zone hi sizes per active direction
595 ! Cell-boundary count per active coordinate direction (Silo only)
596 integer, allocatable, dimension(:) :: dims !< Cell-boundary counts per active direction
597 ! Formatted database directory paths
598 character(LEN=path_len + name_len) :: dbdir !< Base database directory
599 character(LEN=path_len + 2*name_len) :: proc_rank_dir !< Per-rank subdirectory
600 character(LEN=path_len + 2*name_len) :: rootdir !< Root subdirectory
601 ! Formatted database file handles
602 integer :: dbroot !< Master/root file handle
603 integer :: dbfile !< Slave/local file handle
604 integer :: optlist !< Silo options list handle (per-call scratch)
605 ! Variable count for Binary format
606 integer :: dbvars !< Total flow variables to write
607 end type output_context
608
610 integer :: geometry
611 integer :: type
612 integer :: dir
613 integer :: loc
614 real(wp), dimension(3) :: centroid
615 real(wp), dimension(3) :: length
616 real(wp) :: radius
617 end type bc_patch_parameters
618
619 !> Derived type adding beginning (beg) and end bounds info as attributes
621 real(wp) :: beg
622 real(wp) :: end
623 end type bounds_info
624
625 !> Defines parameters for a Model Patch
627 character(LEN=pathlen_max) :: filepath !< Path the STL file relative to case_dir.
628 real(wp), dimension(1:3) :: translate !< Translation of the STL object.
629 real(wp), dimension(1:3) :: scale !< Scale factor for the STL object.
630 real(wp), dimension(1:3) :: rotate !< Angle to rotate the STL object along each cartesian coordinate axis, in radians.
631 integer :: spc !< Number of samples per cell to use when discretizing the STL object.
632 real(wp) :: threshold !< Threshold to turn on smoothen STL patch.
633 end type ic_model_parameters
634
636 real(wp), dimension(1:3,1:3) :: v !< Vertices of the triangle
637 real(wp), dimension(1:3) :: n !< Normal vector
638 end type t_triangle
639
640 type :: t_bbox
641 real(wp), dimension(1:3) :: min !< Minimum coordinates
642 real(wp), dimension(1:3) :: max !< Maximum coordinates
643 end type t_bbox
644
645 type :: t_model
646 integer :: ntrs !< Number of triangles
647 type(t_triangle), allocatable :: trs(:) !< Triangles
648 end type t_model
649
651 ! Original CPU-side fields (unchanged)
652 type(t_model), allocatable :: model !< STL/OBJ geometry model
653 real(wp), allocatable, dimension(:,:,:) :: boundary_v !< Boundary vertices
654 integer :: boundary_edge_count !< Number of boundary edges
655
656 ! GPU-friendly flattened arrays
657 integer :: ntrs !< Copy of model%ntrs
658 real(wp), allocatable, dimension(:,:,:) :: trs_v !< Triangle vertices (3, 3, ntrs)
659 real(wp), allocatable, dimension(:,:) :: trs_n !< Triangle normals (3, ntrs)
660 end type t_model_array
661
662 !> Derived type adding initial condition (ic) patch parameters as attributes NOTE: The requirements for the specification of the
663 !! above parameters are strongly dependent on both the choice of the multicomponent flow model as well as the choice of the
664 !! patch geometry.
666
667 integer :: geometry !< Type of geometry for the patch
668 real(wp) :: x_centroid, y_centroid, z_centroid !< Geometric center coordinates of the patch
669 real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
670 real(wp) :: radius !< Dimensions of the patch. radius.
671 real(wp), dimension(3) :: radii !< Elliptical/ellipsoidal patch radii in x, y, z
672 real(wp) :: epsilon, beta !< The isentropic vortex parameters for the amplitude of the disturbance and domain of influence.
673 real(wp), dimension(2:9) :: a !< Used by hardcoded IC and as temporary variables.
674 logical :: non_axis_sym
675
676 ! Geometry 13 (2D modal Fourier): fourier_cos(n), fourier_sin(n) for mode n
677 real(wp), dimension(1:max_2d_fourier_modes) :: fourier_cos, fourier_sin
678 !> When true, clip boundary radius: R(theta) = max(R(theta), modal_r_min) (Non-exp form only)
679 logical :: modal_clip_r_to_min
680 real(wp) :: modal_r_min !< Minimum boundary radius when modal_clip_r_to_min is true (Non-exp form only)
681 logical :: modal_use_exp_form !< When true, boundary = radius*exp(Fourier series)
682 ! Geometry 14 (3D spherical harmonic): sph_har_coeff(l,m) for real Y_lm
683 real(wp), dimension(0:max_sph_harm_degree,-max_sph_harm_degree:max_sph_harm_degree) :: sph_har_coeff
684 real(wp), dimension(3) :: normal !< Patch orientation normal vector (x, y, z)
685 logical, dimension(0:num_patches_max - 1) :: alter_patch !< Overwrite permissions for preceding patches
686 logical :: smoothen !< Whether patch boundaries are smoothed across cells
687 integer :: smooth_patch_id !< Identity (id) of the patch with which current patch is to get smoothed
688 real(wp) :: smooth_coeff !< Smoothing stencil size coefficient
689 real(wp), dimension(num_fluids_max) :: alpha_rho
690 real(wp) :: rho
691 real(wp), dimension(3) :: vel
692 real(wp) :: pres
693 real(wp), dimension(num_fluids_max) :: alpha
694 real(wp) :: gamma
695 real(wp) :: pi_inf
696 real(wp) :: cv
697 real(wp) :: qv
698 real(wp) :: qvp !< Reference entropy per unit mass (SGEOS)
699 real(wp) :: bx, by, bz !< Magnetic field components; B%x is not used for 1D
700 real(wp), dimension(6) :: tau_e !< Elastic stresses added to primitive variables if hypoelasticity = True
701 real(wp) :: r0 !< Bubble size
702 real(wp) :: v0 !< Bubble velocity
703 real(wp) :: p0 !< Bubble size
704 real(wp) :: m0 !< Bubble velocity
705 integer :: hcid !< Hardcoded initial condition ID
706 real(wp) :: cf_val !< Color function value
707 real(wp) :: y(1:num_species) !< Species mass fractions
708
709 ! STL/OBJ model patch: index into the shared stl_models(:) table
710 integer :: model_id !< index into stl_models(:) for STL/OBJ geometry patches
711 end type ic_patch_parameters
712
713 !> User-input parameters for a NACA 4-digit airfoil (namelist-safe: scalars only)
715 real(wp) :: c = dflt_real !< chord length
716 real(wp) :: p = dflt_real !< maximum camber position (fraction of chord)
717 real(wp) :: t = dflt_real !< maximum thickness (fraction of chord)
718 real(wp) :: m = dflt_real !< maximum camber (fraction of chord)
719 end type ib_airfoil_parameters
720
721 !> Computed surface grid for a NACA airfoil (simulation-only, not in namelist)
723 integer :: np = 0 !< number of surface grid points per surface
724 real(wp), allocatable :: upper(:,:,:) !< upper segments (1:Np-1, vertex 1/vertex 2/normal, x/y), as STL boundary_v
725 real(wp), allocatable :: lower(:,:,:) !< lower segments (1:Np-1, vertex 1/vertex 2/normal, x/y), as STL boundary_v
726 end type ib_airfoil_grid
727
728 !> User-input parameters for an STL/OBJ immersed boundary model (namelist-safe: scalars + fixed arrays)
730 character(LEN=pathlen_max) :: model_filepath !< Path to the STL file relative to case_dir.
731 real(wp), dimension(1:3) :: model_translate !< Translation of the STL object.
732 real(wp), dimension(1:3) :: model_scale !< Scale factor for the STL object.
733 real(wp) :: model_threshold !< Threshold to turn on smooth STL patch.
734 end type ib_stl_parameters
735
737 integer :: geometry !< Type of geometry for the patch
738 integer :: gbl_patch_id
739 integer :: owner_rank !< MPI rank whose subdomain holds the centroid; the only rank that sums this IB's force
740 real(wp) :: x_centroid, y_centroid, z_centroid !< Geometric center coordinates of the patch
741
742 !> Centroid locations of intermediate steps in the time_stepper module
743 real(wp) :: step_x_centroid, step_y_centroid, step_z_centroid
744 real(wp), dimension(1:3) :: centroid_offset !< offset of center of mass from computed cell center for odd-shaped IBs
745 real(wp), dimension(1:3) :: angles
746 real(wp), dimension(1:3) :: step_angles
747 !> matrix that converts from IB reference frame to fluid reference frame
748 real(wp), dimension(1:3,1:3) :: rotation_matrix
749 !> matrix that converts from fluid reference frame to IB reference frame
750 real(wp), dimension(1:3,1:3) :: rotation_matrix_inverse
751 integer :: airfoil_id !< index into ib_airfoil(:) for airfoil geometry patches
752 integer :: model_id !< index into stl_models(:) for STL/OBJ geometry patches
753 real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
754 real(wp) :: radius !< Dimensions of the patch. radius.
755 logical :: slip
756
757 ! Thermal immersed-boundary condition
758 ! 0 = zero-normal-gradient temperature
759 ! 1 = prescribed wall temperature (Twall)
760 ! 2 = reacting surface energy balance
761 ! 3 = lumped solid: Twall evolves with the body's heat balance
762 integer :: thermal_bc
763 real(wp) :: twall
764 real(wp) :: thermal_layer !< Initial conductive-layer thickness around a thermal_bc = 1 or 3 IB [m]; 0 = none
765 real(wp) :: rho_solid, cp_solid !< Solid density [kg/m^3] and heat capacity [J/kg/K] (thermal_bc = 3)
766 real(wp) :: emissivity, t_rad !< Surface emissivity and radiative surroundings temperature [K] (thermal_bc = 3)
767 real(wp) :: heat_power !< Heat supplied to the body, e.g. Joule heating [W; W/m per unit depth in 2D]
768
769 ! Heterogeneous surface reaction 0 = none 1 = enabled
770 integer :: surface_reaction
771 integer :: moving_ibm !< 0 for no moving, 1 for moving, 2 for moving on forced path
772 real(wp) :: v_blow !< Wall-normal surface blowing speed (burning/transpiring IB surface); 0 = impermeable
773 integer :: inj_species !< Injected species index at a blowing surface (chemistry); 0 = mirror ambient
774 real(wp) :: burn_rate_exp !< Pressure exponent n in v_blow*(p/p_ref)^n (Vieille's law); 0 = constant blowing
775 real(wp) :: burn_rate_pref !< Reference pressure p_ref for the pressure-coupled burn rate; 0 = coupling off
776 real(wp) :: mass, moment !< mass and moment of inertia of object used to compute forces in 2-way coupling
777 real(wp), dimension(1:3) :: force, torque !< vectors for the computed force and torque values applied to an IB
778 !> Last step's gasification rate and face mass out [kg/s], and fluid heat in [W] (ib_heat_wrt; per unit depth in 2D)
779 real(wp) :: mdot, mdot_face, qdot
780 real(wp), dimension(1:3) :: vel
781 real(wp), dimension(1:3) :: step_vel !< velocity array used to store intermediate steps in the time_stepper module
782 real(wp), dimension(1:3) :: angular_vel
783 real(wp), dimension(1:3) :: step_angular_vel !< velocity array used to store intermediate steps in the time_stepper module
784 !> (vel - step_vel)/dt and its angular counterpart over the first stage; feed the ghost pressure
785 real(wp), dimension(1:3) :: accel, angular_accel
786 !> Prescribed kinematics (moving_ibm = 1 only): 0 = off; 1 = hinged flapping, roll about the lab x axis through the hinge
787 !! and pitch about the body spanwise (y) axis through the hinge, R = Rx(phi) Ry(theta)
788 integer :: kin_model
789 real(wp), dimension(1:3) :: kin_hinge !< hinge point
790 real(wp), dimension(1:3) :: kin_offset !< body-frame vector from the hinge to the patch centroid
791 real(wp) :: kin_phi0, kin_theta0, kin_theta_mean !< roll amplitude, pitch amplitude, mean pitch (rad)
792 real(wp) :: kin_freq, kin_phase, kin_t0, kin_ramp !< frequency, pitch phase lead (rad), onset time, ramp duration
793 real(wp) :: kin_pitch_rate, kin_smooth !< kin_model = 2: nominal pitch rate (rad/time) and Eldredge smoothing parameter a
794 end type ib_patch_parameters
795
797 real(wp) :: x_centroid, y_centroid, z_centroid !< Center of the particle bed region
798 real(wp) :: length_x, length_y, length_z !< Dimensions of the particle bed region
799 integer :: num_particles !< Number of particles to generate
800 real(wp) :: radius !< Particle radius
801 real(wp) :: mass !< Particle mass
802 real(wp) :: min_spacing !< Minimum surface-to-surface gap (particle centers are 2*radius + min_spacing apart)
803 real(wp) :: shell_inner_radius !< Inner radius for shell packing
804 real(wp) :: shell_outer_radius !< Outer radius for shell packing
805 integer :: moving_ibm !< Motion flag: 0=static, 1=moving (forces), 2=forced path
806 integer :: seed !< Random seed for reproducible placement
807 integer :: cloud_geometry !< Cloud region geometry: 1=box, 2=hemisphere shell
808 integer :: shell_axis !< Axis the hemisphere shell opens toward: 1=x, 2=y, 3=z (2D ignores 3)
809 integer :: packing_method !< Packing algorithm: 1=rejection sampling, 2=lattice
810 integer :: periodic !< Periodic overlap flag for box rejection packing: 0=off, 1=on
812
813 !> Derived type annexing the physical parameters (PP) of the fluids. These include the specific heat ratio function and liquid
814 !! stiffness function.
816 real(wp) :: gamma !< Sp. heat ratio
817 real(wp) :: pi_inf !< Liquid stiffness
818 real(wp), dimension(2) :: re !< Reynolds number
819 real(wp) :: k_therm !< Thermal conductivity (name avoids %K, the Herschel-Bulkley index)
820 real(wp) :: cv !< heat capacity
821 real(wp) :: qv !< reference energy per unit mass for SGEOS, q (see Le Metayer (2004))
822 real(wp) :: qvp !< reference entropy per unit mass for SGEOS, q' (see Le Metayer (2004))
823 real(wp) :: g
824 integer :: eos !< Equation of state selector (eos_* in m_constants)
825 real(wp) :: mg_rho0 !< Mie-Gruneisen reference density
826 real(wp) :: mg_c0 !< Mie-Gruneisen bulk sound speed at mg_rho0
827 real(wp) :: mg_s !< Mie-Gruneisen linear Hugoniot slope, u_s = c0 + s u_p
828 real(wp) :: mg_gruneisen !< Gruneisen coefficient Gamma_G (not the shear modulus G)
829 real(wp) :: mg_gruneisen_a !< d(Gamma_G)/d(mu): Gamma_G = Gamma_0 + a mu, zero keeps it constant
830 real(wp) :: mg_t0 !< temperature at the reference density (for T output)
831 real(wp) :: mg_s2, mg_s3 !< u_s = c0 + s u_p + s2 u_p^2 + s3 u_p^3; zero keeps the fit linear
832 real(wp) :: jwl_a !< JWL A
833 real(wp) :: jwl_b !< JWL B
834 real(wp) :: jwl_r1 !< JWL R1
835 real(wp) :: jwl_r2 !< JWL R2
836 real(wp) :: jwl_omega !< JWL omega (its Gruneisen coefficient)
837 real(wp) :: jwl_rho0 !< JWL reference density
838 real(wp) :: jwl_t0 !< temperature at the reference density (for T output)
839 real(wp) :: vinet_k0 !< Vinet bulk modulus at rho0
840 real(wp) :: vinet_k0p !< Vinet pressure derivative of the bulk modulus
841 real(wp) :: vinet_rho0 !< Vinet reference density
842 real(wp) :: vinet_gruneisen !< Gruneisen coefficient at rho0
843 real(wp) :: vinet_gruneisen_a !< d(Gamma_G)/d(mu)
844 real(wp) :: vinet_t0 !< temperature at the reference density (for T output)
845 logical :: non_newtonian !< Enable Herschel-Bulkley non-Newtonian viscosity
846 real(wp) :: k !< HB consistency index
847 real(wp) :: nn !< HB flow behavior index
848 real(wp) :: tau0 !< HB yield stress (0 => power-law)
849 real(wp) :: hb_m !< Papanastasiou regularization parameter
850 real(wp) :: mu_min !< Lower viscosity clamp (inactive sentinel = dflt_real)
851 real(wp) :: mu_max !< Upper viscosity clamp (required when non_newtonian)
852 real(wp) :: mu_bulk !< Bulk viscosity for NN (inactive sentinel = dflt_real)
853 end type physical_parameters
854
855 !> Derived type annexing the physical parameters required for sub-grid bubble models
857 real(wp) :: r0ref !< reference bubble radius
858 real(wp) :: p0ref !< reference pressure
859 real(wp) :: rho0ref !< reference density
860 real(wp) :: t0ref !< reference temperature
861 real(wp) :: ss !< surface tension between host and gas (bubble)
862 real(wp) :: pv !< vapor pressure of host
863 real(wp) :: vd !< vapor diffusivity in gas (bubble)
864 real(wp) :: mu_l !< viscosity of host in liquid state
865 real(wp) :: mu_v !< viscosity of host in vapor state
866 real(wp) :: mu_g !< viscosity of gas (bubble)
867 real(wp) :: gam_v !< specific heat ratio of host in vapor state
868 real(wp) :: gam_g !< specific heat ratio of gas (bubble)
869 real(wp) :: m_v !< Molecular weight of host
870 real(wp) :: m_g !< Molecular weight of gas (bubble)
871 real(wp) :: k_v !< thermal conductivity of host in vapor state
872 real(wp) :: k_g !< thermal conductivity of gas (bubble)
873 real(wp) :: cp_v !< specific heat capacity in constant pressure of host in vapor state
874 real(wp) :: cp_g !< specific heat capacity in constant pressure of gas (bubble)
875 real(wp) :: r_v !< gas constant of host in vapor state
876 real(wp) :: r_g !< gas constant of gas (bubble)
878
879 !> Physical parameters for Lagrangian solid particles
881 real(wp) :: rho0ref_particle !< Reference particle density
883
885 integer, dimension(2) :: view
886 type(vec3_dt), allocatable, dimension(:) :: var
887 end type mpi_io_airfoil_ib_var
888
889 !> Parameters for body force with spatial support
891 real(wp) :: amp
892 real(wp) :: x_centroid
893 real(wp) :: y_centroid
894 real(wp) :: conv_vel
895 real(wp) :: sigma
896 real(wp), dimension(8) :: freq
897 real(wp), dimension(8) :: phase
898 end type spbf_parameters
899
900 !> Acoustic source parameters
902 integer :: pulse !< Type of pulse
903 integer :: support !< Type of support
904 logical :: dipole !< Whether the source is a dipole or monopole
905 real(wp), dimension(3) :: loc !< Physical location of acoustic source
906 real(wp) :: mag !< Acoustic pulse magnitude
907 real(wp) :: length !< Length of planar source (2D/3D)
908 real(wp) :: height !< Height of planar source (3D)
909 real(wp) :: wavelength !< Wave length of pulse
910 real(wp) :: frequency !< Frequency of pulse
911 real(wp) :: gauss_sigma_dist !< sigma of Gaussian pulse multiplied by speed of sound
912 real(wp) :: gauss_sigma_time !< sigma of Gaussian pulse
913 real(wp) :: npulse !< Number of cycles of pulse
914 real(wp) :: dir !< Direction of pulse
915 real(wp) :: delay !< Time-delay of pulse start
916 real(wp) :: foc_length !< Focal length of transducer
917 real(wp) :: aperture !< Aperture diameter of transducer
918 real(wp) :: element_spacing_angle !< Spacing between aperture elements in 2D acoustic array
919 !> Ratio of aperture element diameter to side length of polygon connecting their centers, in 3D acoustic array
920 real(wp) :: element_polygon_ratio
921 real(wp) :: rotate_angle !< Angle of rotation of the entire circular 3D acoustic array
922 real(wp) :: bb_bandwidth !< Bandwidth of each frequency in broadband wave
923 real(wp) :: bb_lowest_freq !< The lower frequency bound of broadband wave
924 integer :: num_elements !< Number of elements in the acoustic array
925 integer :: element_on !< Element in the acoustic array to turn on
926 integer :: bb_num_freq !< Number of frequencies in the broadband wave
927 end type acoustic_parameters
928
929 !> Acoustic source source_spatial pre-calculated values
931 integer, pointer, dimension(:,:) :: coord => null() !< List of grid points indices with non-zero source_spatial values
932 real(wp), pointer, dimension(:) :: val => null() !< List of non-zero source_spatial values
933 real(wp), pointer, dimension(:) :: angle => null() !< List of angles with x-axis for mom source term vector
934 real(wp), pointer, dimension(:,:) :: xyz_to_r_ratios => null() !< List of [xyz]/r for mom source term vector
935 end type source_spatial_type
936
937 !> Ghost Point for Immersed Boundaries
939 integer, dimension(3) :: loc !< Physical location of the ghost point
940 real(wp), dimension(3) :: ip_loc !< Physical location of the image point
941 real(wp) :: ip_dist !< Distance from the boundary intercept to the image point
942 integer, dimension(3) :: ip_grid !< Top left grid point of IP
943 integer, dimension(3) :: ip_stencil !< Lower corner of the interpolation stencil (ib_ip_width cells wide)
944 real(wp), dimension(3, 3, 3) :: interp_coeffs !< Interpolation coefficients of the image point, from ip_stencil
945 logical :: interp_valid !< .false. if every image point stencil cell lies inside an IB
946 integer :: ib_patch_id !< ID of the IB Patch the ghost point is part of
947 real(wp) :: levelset
948 real(wp), dimension(1:3) :: levelset_norm
949 logical :: slip
950 integer, dimension(3) :: db
951 integer :: x_periodicity, y_periodicity, z_periodicity
952 end type ghost_point
953
954 !> Species parameters
956 character(LEN=name_len) :: name !< Name of species
957 end type species_parameters
958
959 !> Chemistry parameters
961 character(LEN=name_len) :: cantera_file !< Path to Cantera file
962 logical :: diffusion
963 logical :: reactions
964
965 !> Method of determining gamma.
966 !> gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97.
967 !> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats.
968 integer :: gamma_method
969 integer :: transport_model
970 !> reaction_substeps > 0 integrates the reaction source with operator splitting: after the
971 !> flow update, each cell's constant-(rho,e) reactor ODE is advanced with this many alpha-QSS
972 !> sub-steps. Stabilizes stiff mechanisms (e.g. methane). 0 = off (reaction source is added to
973 !> the RHS and integrated by the flow time stepper, the default behavior).
974 integer :: reaction_substeps
975 !> adap_substeps = T: adapt the alpha-QSS sub-step count per rank each step from a local
976 !> stiffness estimate, ranging in [reaction_substeps (floor), reaction_substeps_max (ceiling)].
977 !> Zero MPI: each rank sizes its own work from its own cells. Default F = fixed reaction_substeps.
978 logical :: adap_substeps
979 integer :: reaction_substeps_max
980 !> Limit dt by the mixture's local viscous, thermal and species diffusivities rather than fluid_pp%Re.
981 logical :: transport_dt
982 end type chemistry_parameters
983
984 !> Condensed-phase reactive-burn (programmed pressure detonation) parameters. The rate is
985 !> dlambda/dt = k (1 - lambda) ((p - pign)/pref)^n, optionally scaled by exp(-ta/T) when ta > 0.
987 real(wp) :: k !< Rate coefficient [1/s]
988 real(wp) :: pign !< Ignition pressure threshold [Pa]
989 real(wp) :: pref !< Reference pressure for the pressure drive [Pa]
990 real(wp) :: n !< Pressure-drive exponent
991 real(wp) :: ta !< Activation temperature [K] (0 = pure pressure-driven; > 0 adds exp(-ta/T))
992 integer :: substeps !< Operator-split sub-steps per time step (0 = source added to the flow RHS)
994
995 !> Coefficients of one fluid's equation of state, resolved once at init. Held as a record per fluid rather than as parallel
996 !! arrays: every read wants several of these for a single fluid, so one base address serves them all, where fifteen arrays cost
997 !! fifteen live descriptors in the Riemann kernels.
999 real(wp) :: rho0, t0 !< Reference density [kg/m^3] and temperature [K]
1000 real(wp) :: gruneisen0, gruneisen_a !< Gruneisen closure Gamma_G = Gamma_0 + a mu
1001 real(wp) :: c0, s, s2, s3 !< Mie-Gruneisen Hugoniot u_s = c0 + s u_p + s2 u_p^2 + s3 u_p^3
1002 real(wp) :: mu_max !< Compression at which a cubic Hugoniot fit turns over
1003 real(wp) :: a, b, r1, r2 !< JWL principal isentrope p = A exp(-R1 V) + B exp(-R2 V)
1004 real(wp) :: k0, k0p !< Vinet bulk modulus and its pressure derivative
1005 end type eos_coefficients
1006
1007 !> Lagrangian bubble parameters
1009
1010 integer :: coupling !< coupling_one_way or coupling_two_way
1011 integer :: cluster_type !< Cluster model to find p_inf
1012 logical :: pressure_corrector !< Cell pressure correction term
1013 integer :: smooth_type !< Smoothing function. 1: Gaussian, 2:Delta 3x3
1014 logical :: heattransfer_model !< Activate HEAT transfer model at the bubble-liquid interface
1015 logical :: masstransfer_model !< Activate MASS transfer model at the bubble-liquid interface
1016 logical :: write_void_evol !< Write files to track evolution of void fraction at each time step
1017 logical :: write_bubbles !< Write files to track the bubble evolution each time step
1018 logical :: write_bubbles_stats !< Write the maximum and minimum radius of each bubble
1019 integer :: nbubs_glb !< Global number of bubbles
1020 integer :: vel_model !< Particle velocity model
1021 integer :: drag_model !< Particle drag model
1022 logical :: pressure_force !< Include pressure force translational motion
1023 logical :: gravity_force !< Include gravity force in translational motion
1024 logical :: kahan_summation !< Use Kahan summation for void fraction accumulation (improves precision)
1025 character(LEN=pathlen_max) :: input_path !< Path to lag_bubbles.dat
1026 real(wp) :: epsilonb !< Standard deviation scaling for the gaussian function
1027 real(wp) :: charwidth !< Domain virtual depth (z direction, for 2D simulations)
1028 integer :: charnz !< Number of grid cells in characteristic depth
1029 real(wp) :: valmaxvoid !< Maximum void fraction permitted
1031
1033
1034 integer :: coupling !< coupling_one_way or coupling_two_way
1035 logical :: write_void_evol !< Write files to track evolution of void fraction at each time step
1036 logical :: write_particles !< Write files to track the particle evolution each time step
1037 integer :: nparticles_glb !< Global number of particles
1038 integer :: vel_model !< Particle motion. 0: fixed in space, 1: tracer, 2: Newton's second law
1039 integer :: qs_force !< Quasi-steady drag. 0: off, 1: Gidaspow, 2: Parmar, 3: Osnes
1040 logical :: qs_fluct_force !< Quasi-steady fluctuation force
1041 logical :: pressure_gradient_force !< Pressure gradient force
1042 integer :: added_mass_force !< Particle added mass model
1043 real(wp), dimension(num_fluids_max) :: mu_ref !< Sutherland reference viscosity per fluid
1044 real(wp), dimension(num_fluids_max) :: suth !< Sutherland constant per fluid
1045 integer :: interpolation_order !< Fluid-to-Particle barycentric interpolation order
1046 character(LEN=pathlen_max) :: input_path !< Path to the particle input file
1047 real(wp) :: charwidth !< Domain virtual depth (z direction, for 2D simulations)
1048 real(wp) :: valmaxvoid !< Maximum void fraction permitted
1050
1051 !> Max and min number of cells in a direction of each combination of x-,y-, and z-
1053 integer :: mn_max, np_max, mp_max, mnp_max
1054 integer :: mn_min, np_min, mp_min, mnp_min
1055 end type cell_num_bounds
1056
1058 logical, dimension(3) :: perturb_vel
1059 real(wp), dimension(3) :: perturb_vel_freq
1060 real(wp), dimension(3) :: perturb_vel_scale
1061 real(wp), dimension(3, 3) :: perturb_vel_offset
1062 logical, dimension(1:num_fluids_max) :: perturb_dens
1063 real(wp), dimension(1:num_fluids_max) :: perturb_dens_freq
1064 real(wp), dimension(1:num_fluids_max) :: perturb_dens_scale
1065 real(wp), dimension(1:num_fluids_max,3) :: perturb_dens_offset
1066 end type simplex_noise_params
1067
1068 !> An index-space rectangle in global cell indices. In v1, one t_box = one rank's subdomain. Flat leaf: no allocatable/pointer
1069 !! components, host-only, never namelist/broadcast.
1071 integer :: lo(3) !< global low cell index per axis (x,y,z)
1072 integer :: hi(3) !< global high cell index per axis
1073 end type t_box
1074end 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
integer, parameter dp
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.
Indices of the projected Lagrangian bubble fields (q_beta); absent fields are 0.
Max and min number of cells in a direction of each combination of x-,y-, and z-.
Coefficients of one fluid's equation of state, resolved once at init. Held as a record per fluid rath...
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 for levelset norm.
Output workspace for post_process: flow variable buffers, VisIt extents/offsets, directory paths,...
Indices of the cell fields used for the Lagrangian particle forces and sources (field_vars).
Indices of the projected Lagrangian particle fields (q_particles); vector ranges span num_dims.
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.
Condensed-phase reactive-burn (programmed pressure detonation) parameters. The rate is dlambda/dt = k...
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.
Parameters for body force with spatial support.
Derived type annexing the physical parameters required for sub-grid bubble models.
Physical parameters for Lagrangian solid particles.
An index-space rectangle in global cell indices. In v1, one t_box = one rank's subdomain....
Generic 3-component vector (e.g., spatial coordinates or field components) Named _dt (derived types: ...
Derived type annexing a vector field (VF).