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 !> Grid the initial condition patches are evaluated on
627 integer :: m, n, p !< Last cell index in each direction
628 real(wp), allocatable, dimension(:) :: x_cc, y_cc, z_cc !< Cell centers, from index 0
629 real(wp) :: dx_min, dy_min, dz_min !< Smallest cell widths
630 logical :: hardcoded = .false. !< The pre_process grid that hard-coded patches (hcid) assume
631 end type ic_grid
632
633 !> Defines parameters for a Model Patch
635 character(LEN=pathlen_max) :: filepath !< Path the STL file relative to case_dir.
636 real(wp), dimension(1:3) :: translate !< Translation of the STL object.
637 real(wp), dimension(1:3) :: scale !< Scale factor for the STL object.
638 real(wp), dimension(1:3) :: rotate !< Angle to rotate the STL object along each cartesian coordinate axis, in radians.
639 integer :: spc !< Number of samples per cell to use when discretizing the STL object.
640 real(wp) :: threshold !< Threshold to turn on smoothen STL patch.
641 end type ic_model_parameters
642
644 real(wp), dimension(1:3,1:3) :: v !< Vertices of the triangle
645 real(wp), dimension(1:3) :: n !< Normal vector
646 end type t_triangle
647
648 type :: t_bbox
649 real(wp), dimension(1:3) :: min !< Minimum coordinates
650 real(wp), dimension(1:3) :: max !< Maximum coordinates
651 end type t_bbox
652
653 type :: t_model
654 integer :: ntrs !< Number of triangles
655 type(t_triangle), allocatable :: trs(:) !< Triangles
656 end type t_model
657
659 ! Original CPU-side fields (unchanged)
660 type(t_model), allocatable :: model !< STL/OBJ geometry model
661 real(wp), allocatable, dimension(:,:,:) :: boundary_v !< Boundary vertices
662 integer :: boundary_edge_count !< Number of boundary edges
663
664 ! GPU-friendly flattened arrays
665 integer :: ntrs !< Copy of model%ntrs
666 real(wp), allocatable, dimension(:,:,:) :: trs_v !< Triangle vertices (3, 3, ntrs)
667 real(wp), allocatable, dimension(:,:) :: trs_n !< Triangle normals (3, ntrs)
668 end type t_model_array
669
670 !> Derived type adding initial condition (ic) patch parameters as attributes NOTE: The requirements for the specification of the
671 !! above parameters are strongly dependent on both the choice of the multicomponent flow model as well as the choice of the
672 !! patch geometry.
674
675 integer :: geometry !< Type of geometry for the patch
676 real(wp) :: x_centroid, y_centroid, z_centroid !< Geometric center coordinates of the patch
677 real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
678 real(wp) :: radius !< Dimensions of the patch. radius.
679 real(wp), dimension(3) :: radii !< Elliptical/ellipsoidal patch radii in x, y, z
680 real(wp) :: epsilon, beta !< The isentropic vortex parameters for the amplitude of the disturbance and domain of influence.
681 real(wp), dimension(2:9) :: a !< Used by hardcoded IC and as temporary variables.
682 logical :: non_axis_sym
683
684 ! Geometry 13 (2D modal Fourier): fourier_cos(n), fourier_sin(n) for mode n
685 real(wp), dimension(1:max_2d_fourier_modes) :: fourier_cos, fourier_sin
686 !> When true, clip boundary radius: R(theta) = max(R(theta), modal_r_min) (Non-exp form only)
687 logical :: modal_clip_r_to_min
688 real(wp) :: modal_r_min !< Minimum boundary radius when modal_clip_r_to_min is true (Non-exp form only)
689 logical :: modal_use_exp_form !< When true, boundary = radius*exp(Fourier series)
690 ! Geometry 14 (3D spherical harmonic): sph_har_coeff(l,m) for real Y_lm
691 real(wp), dimension(0:max_sph_harm_degree,-max_sph_harm_degree:max_sph_harm_degree) :: sph_har_coeff
692 real(wp), dimension(3) :: normal !< Patch orientation normal vector (x, y, z)
693 logical, dimension(0:num_patches_max - 1) :: alter_patch !< Overwrite permissions for preceding patches
694 logical :: smoothen !< Whether patch boundaries are smoothed across cells
695 integer :: smooth_patch_id !< Identity (id) of the patch with which current patch is to get smoothed
696 real(wp) :: smooth_coeff !< Smoothing stencil size coefficient
697 real(wp), dimension(num_fluids_max) :: alpha_rho
698 real(wp) :: rho
699 real(wp), dimension(3) :: vel
700 real(wp) :: pres
701 real(wp), dimension(num_fluids_max) :: alpha
702 real(wp) :: gamma
703 real(wp) :: pi_inf
704 real(wp) :: cv
705 real(wp) :: qv
706 real(wp) :: qvp !< Reference entropy per unit mass (SGEOS)
707 real(wp) :: bx, by, bz !< Magnetic field components; B%x is not used for 1D
708 real(wp), dimension(6) :: tau_e !< Elastic stresses added to primitive variables if hypoelasticity = True
709 real(wp) :: r0 !< Bubble size
710 real(wp) :: v0 !< Bubble velocity
711 real(wp) :: p0 !< Bubble size
712 real(wp) :: m0 !< Bubble velocity
713 integer :: hcid !< Hardcoded initial condition ID
714 real(wp) :: cf_val !< Color function value
715 real(wp) :: y(1:num_species) !< Species mass fractions
716
717 ! STL/OBJ model patch: index into the shared stl_models(:) table
718 integer :: model_id !< index into stl_models(:) for STL/OBJ geometry patches
719 end type ic_patch_parameters
720
721 !> User-input parameters for a NACA 4-digit airfoil (namelist-safe: scalars only)
723 real(wp) :: c = dflt_real !< chord length
724 real(wp) :: p = dflt_real !< maximum camber position (fraction of chord)
725 real(wp) :: t = dflt_real !< maximum thickness (fraction of chord)
726 real(wp) :: m = dflt_real !< maximum camber (fraction of chord)
727 end type ib_airfoil_parameters
728
729 !> Computed surface grid for a NACA airfoil (simulation-only, not in namelist)
731 integer :: np = 0 !< number of surface grid points per surface
732 real(wp), allocatable :: upper(:,:,:) !< upper segments (1:Np-1, vertex 1/vertex 2/normal, x/y), as STL boundary_v
733 real(wp), allocatable :: lower(:,:,:) !< lower segments (1:Np-1, vertex 1/vertex 2/normal, x/y), as STL boundary_v
734 end type ib_airfoil_grid
735
736 !> User-input parameters for an STL/OBJ immersed boundary model (namelist-safe: scalars + fixed arrays)
738 character(LEN=pathlen_max) :: model_filepath !< Path to the STL file relative to case_dir.
739 real(wp), dimension(1:3) :: model_translate !< Translation of the STL object.
740 real(wp), dimension(1:3) :: model_scale !< Scale factor for the STL object.
741 real(wp) :: model_threshold !< Threshold to turn on smooth STL patch.
742 end type ib_stl_parameters
743
745 integer :: geometry !< Type of geometry for the patch
746 integer :: gbl_patch_id
747 integer :: owner_rank !< MPI rank whose subdomain holds the centroid; the only rank that sums this IB's force
748 real(wp) :: x_centroid, y_centroid, z_centroid !< Geometric center coordinates of the patch
749
750 !> Centroid locations of intermediate steps in the time_stepper module
751 real(wp) :: step_x_centroid, step_y_centroid, step_z_centroid
752 real(wp), dimension(1:3) :: centroid_offset !< offset of center of mass from computed cell center for odd-shaped IBs
753 real(wp), dimension(1:3) :: angles
754 real(wp), dimension(1:3) :: step_angles
755 !> matrix that converts from IB reference frame to fluid reference frame
756 real(wp), dimension(1:3,1:3) :: rotation_matrix
757 !> matrix that converts from fluid reference frame to IB reference frame
758 real(wp), dimension(1:3,1:3) :: rotation_matrix_inverse
759 integer :: airfoil_id !< index into ib_airfoil(:) for airfoil geometry patches
760 integer :: model_id !< index into stl_models(:) for STL/OBJ geometry patches
761 real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
762 real(wp) :: radius !< Dimensions of the patch. radius.
763 logical :: slip
764
765 ! Thermal immersed-boundary condition
766 ! 0 = zero-normal-gradient temperature
767 ! 1 = prescribed wall temperature (Twall)
768 ! 2 = reacting surface energy balance
769 ! 3 = lumped solid: Twall evolves with the body's heat balance
770 integer :: thermal_bc
771 real(wp) :: twall
772 real(wp) :: thermal_layer !< Initial conductive-layer thickness around a thermal_bc = 1 or 3 IB [m]; 0 = none
773 real(wp) :: rho_solid, cp_solid !< Solid density [kg/m^3] and heat capacity [J/kg/K] (thermal_bc = 3)
774 real(wp) :: emissivity, t_rad !< Surface emissivity and radiative surroundings temperature [K] (thermal_bc = 3)
775 real(wp) :: heat_power !< Heat supplied to the body, e.g. Joule heating [W; W/m per unit depth in 2D]
776 logical :: wall_column !< Sub-grid wall-normal conduction column per first-layer ghost (m_ib_wall_column)
777 real(wp) :: wall_column_len !< Column length [m]; 0 = 0.15 radius
778
779 ! Heterogeneous surface reaction 0 = none 1 = enabled
780 integer :: surface_reaction
781 integer :: moving_ibm !< 0 for no moving, 1 for moving, 2 for moving on forced path
782 real(wp) :: v_blow !< Wall-normal surface blowing speed (burning/transpiring IB surface); 0 = impermeable
783 integer :: inj_species !< Injected species index at a blowing surface (chemistry); 0 = mirror ambient
784 real(wp) :: burn_rate_exp !< Pressure exponent n in v_blow*(p/p_ref)^n (Vieille's law); 0 = constant blowing
785 real(wp) :: burn_rate_pref !< Reference pressure p_ref for the pressure-coupled burn rate; 0 = coupling off
786 real(wp) :: mass, moment !< mass and moment of inertia of object used to compute forces in 2-way coupling
787 real(wp), dimension(1:3) :: force, torque !< vectors for the computed force and torque values applied to an IB
788 !> Last step's gasification rate and face mass out [kg/s], and fluid heat in [W] (ib_heat_wrt; per unit depth in 2D)
789 real(wp) :: mdot, mdot_face, qdot
790 !> ib_mass_relax bank: set from a restart, advanced by the owner rank, moved with the body at a handoff
791 real(wp) :: mass_bank
792 real(wp), dimension(1:3) :: vel
793 real(wp), dimension(1:3) :: step_vel !< velocity array used to store intermediate steps in the time_stepper module
794 real(wp), dimension(1:3) :: angular_vel
795 real(wp), dimension(1:3) :: step_angular_vel !< velocity array used to store intermediate steps in the time_stepper module
796 !> (vel - step_vel)/dt and its angular counterpart over the first stage; feed the ghost pressure
797 real(wp), dimension(1:3) :: accel, angular_accel
798 !> Prescribed kinematics (moving_ibm = 1 only): 0 = off; 1 = hinged flapping, roll about the lab x axis through the hinge
799 !! and pitch about the body spanwise (y) axis through the hinge, R = Rx(phi) Ry(theta)
800 integer :: kin_model
801 real(wp), dimension(1:3) :: kin_hinge !< hinge point
802 real(wp), dimension(1:3) :: kin_offset !< body-frame vector from the hinge to the patch centroid
803 real(wp) :: kin_phi0, kin_theta0, kin_theta_mean !< roll amplitude, pitch amplitude, mean pitch (rad)
804 real(wp) :: kin_freq, kin_phase, kin_t0, kin_ramp !< frequency, pitch phase lead (rad), onset time, ramp duration
805 real(wp) :: kin_pitch_rate, kin_smooth !< kin_model = 2: nominal pitch rate (rad/time) and Eldredge smoothing parameter a
806 end type ib_patch_parameters
807
809 real(wp) :: x_centroid, y_centroid, z_centroid !< Center of the particle bed region
810 real(wp) :: length_x, length_y, length_z !< Dimensions of the particle bed region
811 integer :: num_particles !< Number of particles to generate
812 real(wp) :: radius !< Particle radius
813 real(wp) :: mass !< Particle mass
814 real(wp) :: min_spacing !< Minimum surface-to-surface gap (particle centers are 2*radius + min_spacing apart)
815 real(wp) :: shell_inner_radius !< Inner radius for shell packing
816 real(wp) :: shell_outer_radius !< Outer radius for shell packing
817 integer :: moving_ibm !< Motion flag: 0=static, 1=moving (forces), 2=forced path
818 integer :: seed !< Random seed for reproducible placement
819 integer :: cloud_geometry !< Cloud region geometry: 1=box, 2=hemisphere shell
820 integer :: shell_axis !< Axis the hemisphere shell opens toward: 1=x, 2=y, 3=z (2D ignores 3)
821 integer :: packing_method !< Packing algorithm: 1=rejection sampling, 2=lattice
822 integer :: periodic !< Periodic overlap flag for box rejection packing: 0=off, 1=on
824
825 !> Derived type annexing the physical parameters (PP) of the fluids. These include the specific heat ratio function and liquid
826 !! stiffness function.
828 real(wp) :: gamma !< Sp. heat ratio
829 real(wp) :: pi_inf !< Liquid stiffness
830 real(wp), dimension(2) :: re !< Reynolds number
831 real(wp) :: k_therm !< Thermal conductivity (name avoids %K, the Herschel-Bulkley index)
832 real(wp) :: cv !< heat capacity
833 real(wp) :: qv !< reference energy per unit mass for SGEOS, q (see Le Metayer (2004))
834 real(wp) :: qvp !< reference entropy per unit mass for SGEOS, q' (see Le Metayer (2004))
835 real(wp) :: g
836 integer :: eos !< Equation of state selector (eos_* in m_constants)
837 real(wp) :: mg_rho0 !< Mie-Gruneisen reference density
838 real(wp) :: mg_c0 !< Mie-Gruneisen bulk sound speed at mg_rho0
839 real(wp) :: mg_s !< Mie-Gruneisen linear Hugoniot slope, u_s = c0 + s u_p
840 real(wp) :: mg_gruneisen !< Gruneisen coefficient Gamma_G (not the shear modulus G)
841 real(wp) :: mg_gruneisen_a !< d(Gamma_G)/d(mu): Gamma_G = Gamma_0 + a mu, zero keeps it constant
842 real(wp) :: mg_t0 !< temperature at the reference density (for T output)
843 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
844 real(wp) :: jwl_a !< JWL A
845 real(wp) :: jwl_b !< JWL B
846 real(wp) :: jwl_r1 !< JWL R1
847 real(wp) :: jwl_r2 !< JWL R2
848 real(wp) :: jwl_omega !< JWL omega (its Gruneisen coefficient)
849 real(wp) :: jwl_rho0 !< JWL reference density
850 real(wp) :: jwl_t0 !< temperature at the reference density (for T output)
851 real(wp) :: vinet_k0 !< Vinet bulk modulus at rho0
852 real(wp) :: vinet_k0p !< Vinet pressure derivative of the bulk modulus
853 real(wp) :: vinet_rho0 !< Vinet reference density
854 real(wp) :: vinet_gruneisen !< Gruneisen coefficient at rho0
855 real(wp) :: vinet_gruneisen_a !< d(Gamma_G)/d(mu)
856 real(wp) :: vinet_t0 !< temperature at the reference density (for T output)
857 logical :: non_newtonian !< Enable Herschel-Bulkley non-Newtonian viscosity
858 real(wp) :: k !< HB consistency index
859 real(wp) :: nn !< HB flow behavior index
860 real(wp) :: tau0 !< HB yield stress (0 => power-law)
861 real(wp) :: hb_m !< Papanastasiou regularization parameter
862 real(wp) :: mu_min !< Lower viscosity clamp (inactive sentinel = dflt_real)
863 real(wp) :: mu_max !< Upper viscosity clamp (required when non_newtonian)
864 real(wp) :: mu_bulk !< Bulk viscosity for NN (inactive sentinel = dflt_real)
865 end type physical_parameters
866
867 !> Derived type annexing the physical parameters required for sub-grid bubble models
869 real(wp) :: r0ref !< reference bubble radius
870 real(wp) :: p0ref !< reference pressure
871 real(wp) :: rho0ref !< reference density
872 real(wp) :: t0ref !< reference temperature
873 real(wp) :: ss !< surface tension between host and gas (bubble)
874 real(wp) :: pv !< vapor pressure of host
875 real(wp) :: vd !< vapor diffusivity in gas (bubble)
876 real(wp) :: mu_l !< viscosity of host in liquid state
877 real(wp) :: mu_v !< viscosity of host in vapor state
878 real(wp) :: mu_g !< viscosity of gas (bubble)
879 real(wp) :: gam_v !< specific heat ratio of host in vapor state
880 real(wp) :: gam_g !< specific heat ratio of gas (bubble)
881 real(wp) :: m_v !< Molecular weight of host
882 real(wp) :: m_g !< Molecular weight of gas (bubble)
883 real(wp) :: k_v !< thermal conductivity of host in vapor state
884 real(wp) :: k_g !< thermal conductivity of gas (bubble)
885 real(wp) :: cp_v !< specific heat capacity in constant pressure of host in vapor state
886 real(wp) :: cp_g !< specific heat capacity in constant pressure of gas (bubble)
887 real(wp) :: r_v !< gas constant of host in vapor state
888 real(wp) :: r_g !< gas constant of gas (bubble)
890
891 !> Physical parameters for Lagrangian solid particles
893 real(wp) :: rho0ref_particle !< Reference particle density
895
897 integer, dimension(2) :: view
898 type(vec3_dt), allocatable, dimension(:) :: var
899 end type mpi_io_airfoil_ib_var
900
901 !> Parameters for body force with spatial support
903 real(wp) :: amp
904 real(wp) :: x_centroid
905 real(wp) :: y_centroid
906 real(wp) :: conv_vel
907 real(wp) :: sigma
908 real(wp), dimension(8) :: freq
909 real(wp), dimension(8) :: phase
910 end type spbf_parameters
911
912 !> Acoustic source parameters
914 integer :: pulse !< Type of pulse
915 integer :: support !< Type of support
916 logical :: dipole !< Whether the source is a dipole or monopole
917 real(wp), dimension(3) :: loc !< Physical location of acoustic source
918 real(wp) :: mag !< Acoustic pulse magnitude
919 real(wp) :: length !< Length of planar source (2D/3D)
920 real(wp) :: height !< Height of planar source (3D)
921 real(wp) :: wavelength !< Wave length of pulse
922 real(wp) :: frequency !< Frequency of pulse
923 real(wp) :: gauss_sigma_dist !< sigma of Gaussian pulse multiplied by speed of sound
924 real(wp) :: gauss_sigma_time !< sigma of Gaussian pulse
925 real(wp) :: npulse !< Number of cycles of pulse
926 real(wp) :: dir !< Direction of pulse
927 real(wp) :: delay !< Time-delay of pulse start
928 real(wp) :: foc_length !< Focal length of transducer
929 real(wp) :: aperture !< Aperture diameter of transducer
930 real(wp) :: element_spacing_angle !< Spacing between aperture elements in 2D acoustic array
931 !> Ratio of aperture element diameter to side length of polygon connecting their centers, in 3D acoustic array
932 real(wp) :: element_polygon_ratio
933 real(wp) :: rotate_angle !< Angle of rotation of the entire circular 3D acoustic array
934 real(wp) :: bb_bandwidth !< Bandwidth of each frequency in broadband wave
935 real(wp) :: bb_lowest_freq !< The lower frequency bound of broadband wave
936 integer :: num_elements !< Number of elements in the acoustic array
937 integer :: element_on !< Element in the acoustic array to turn on
938 integer :: bb_num_freq !< Number of frequencies in the broadband wave
939 end type acoustic_parameters
940
941 !> Acoustic source source_spatial pre-calculated values
943 integer, pointer, dimension(:,:) :: coord => null() !< List of grid points indices with non-zero source_spatial values
944 real(wp), pointer, dimension(:) :: val => null() !< List of non-zero source_spatial values
945 real(wp), pointer, dimension(:) :: angle => null() !< List of angles with x-axis for mom source term vector
946 real(wp), pointer, dimension(:,:) :: xyz_to_r_ratios => null() !< List of [xyz]/r for mom source term vector
947 end type source_spatial_type
948
949 !> Ghost Point for Immersed Boundaries
951 integer, dimension(3) :: loc !< Physical location of the ghost point
952 real(wp), dimension(3) :: ip_loc !< Physical location of the image point
953 real(wp) :: ip_dist !< Distance from the boundary intercept to the image point
954 integer, dimension(3) :: ip_grid !< Top left grid point of IP
955 integer, dimension(3) :: ip_stencil !< Lower corner of the interpolation stencil (ib_ip_width cells wide)
956 real(wp), dimension(3, 3, 3) :: interp_coeffs !< Interpolation coefficients of the image point, from ip_stencil
957 logical :: interp_valid !< .false. if every image point stencil cell lies inside an IB
958 real(wp) :: t_cond !< Temperature the wall conduction sees (chemistry); T_cond_unset = none
959 real(wp) :: t_save !< The ghost's own temperature while T_cond stands in for it
960 integer :: ib_patch_id !< ID of the IB Patch the ghost point is part of
961 real(wp) :: levelset
962 real(wp), dimension(1:3) :: levelset_norm
963 logical :: slip
964 integer, dimension(3) :: db
965 integer :: x_periodicity, y_periodicity, z_periodicity
966 end type ghost_point
967
968 !> Species parameters
970 character(LEN=name_len) :: name !< Name of species
971 end type species_parameters
972
973 !> Chemistry parameters
975 character(LEN=name_len) :: cantera_file !< Path to Cantera file
976 logical :: diffusion
977 logical :: reactions
978
979 !> Method of determining gamma.
980 !> gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97.
981 !> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats.
982 integer :: gamma_method
983 integer :: transport_model
984 !> reaction_substeps > 0 integrates the reaction source with operator splitting: after the
985 !> flow update, each cell's constant-(rho,e) reactor ODE is advanced with this many alpha-QSS
986 !> sub-steps. Stabilizes stiff mechanisms (e.g. methane). 0 = off (reaction source is added to
987 !> the RHS and integrated by the flow time stepper, the default behavior).
988 integer :: reaction_substeps
989 !> adap_substeps = T: adapt the alpha-QSS sub-step count per rank each step from a local
990 !> stiffness estimate, ranging in [reaction_substeps (floor), reaction_substeps_max (ceiling)].
991 !> Zero MPI: each rank sizes its own work from its own cells. Default F = fixed reaction_substeps.
992 logical :: adap_substeps
993 integer :: reaction_substeps_max
994 !> Limit dt by the mixture's local viscous, thermal and species diffusivities rather than fluid_pp%Re.
995 logical :: transport_dt
996 end type chemistry_parameters
997
998 !> Condensed-phase reactive-burn (programmed pressure detonation) parameters. The rate is
999 !> dlambda/dt = k (1 - lambda) ((p - pign)/pref)^n, optionally scaled by exp(-ta/T) when ta > 0.
1001 real(wp) :: k !< Rate coefficient [1/s]
1002 real(wp) :: pign !< Ignition pressure threshold [Pa]
1003 real(wp) :: pref !< Reference pressure for the pressure drive [Pa]
1004 real(wp) :: n !< Pressure-drive exponent
1005 real(wp) :: ta !< Activation temperature [K] (0 = pure pressure-driven; > 0 adds exp(-ta/T))
1006 integer :: substeps !< Operator-split sub-steps per time step (0 = source added to the flow RHS)
1008
1009 !> Coefficients of one fluid's equation of state, resolved once at init. Held as a record per fluid rather than as parallel
1010 !! arrays: every read wants several of these for a single fluid, so one base address serves them all, where fifteen arrays cost
1011 !! fifteen live descriptors in the Riemann kernels.
1013 real(wp) :: rho0, t0 !< Reference density [kg/m^3] and temperature [K]
1014 real(wp) :: gruneisen0, gruneisen_a !< Gruneisen closure Gamma_G = Gamma_0 + a mu
1015 real(wp) :: c0, s, s2, s3 !< Mie-Gruneisen Hugoniot u_s = c0 + s u_p + s2 u_p^2 + s3 u_p^3
1016 real(wp) :: mu_max !< Compression at which a cubic Hugoniot fit turns over
1017 real(wp) :: a, b, r1, r2 !< JWL principal isentrope p = A exp(-R1 V) + B exp(-R2 V)
1018 real(wp) :: k0, k0p !< Vinet bulk modulus and its pressure derivative
1019 end type eos_coefficients
1020
1021 !> Lagrangian bubble parameters
1023
1024 integer :: coupling !< coupling_one_way or coupling_two_way
1025 integer :: cluster_type !< Cluster model to find p_inf
1026 logical :: pressure_corrector !< Cell pressure correction term
1027 integer :: smooth_type !< Smoothing function. 1: Gaussian, 2:Delta 3x3
1028 logical :: heattransfer_model !< Activate HEAT transfer model at the bubble-liquid interface
1029 logical :: masstransfer_model !< Activate MASS transfer model at the bubble-liquid interface
1030 logical :: write_void_evol !< Write files to track evolution of void fraction at each time step
1031 logical :: write_bubbles !< Write files to track the bubble evolution each time step
1032 logical :: write_bubbles_stats !< Write the maximum and minimum radius of each bubble
1033 integer :: nbubs_glb !< Global number of bubbles
1034 integer :: vel_model !< Particle velocity model
1035 integer :: drag_model !< Particle drag model
1036 logical :: pressure_force !< Include pressure force translational motion
1037 logical :: gravity_force !< Include gravity force in translational motion
1038 logical :: kahan_summation !< Use Kahan summation for void fraction accumulation (improves precision)
1039 character(LEN=pathlen_max) :: input_path !< Path to lag_bubbles.dat
1040 real(wp) :: epsilonb !< Standard deviation scaling for the gaussian function
1041 real(wp) :: charwidth !< Domain virtual depth (z direction, for 2D simulations)
1042 integer :: charnz !< Number of grid cells in characteristic depth
1043 real(wp) :: valmaxvoid !< Maximum void fraction permitted
1045
1047
1048 integer :: coupling !< coupling_one_way or coupling_two_way
1049 logical :: write_void_evol !< Write files to track evolution of void fraction at each time step
1050 logical :: write_particles !< Write files to track the particle evolution each time step
1051 integer :: nparticles_glb !< Global number of particles
1052 integer :: vel_model !< Particle motion. 0: fixed in space, 1: tracer, 2: Newton's second law
1053 integer :: qs_force !< Quasi-steady drag. 0: off, 1: Gidaspow, 2: Parmar, 3: Osnes
1054 logical :: qs_fluct_force !< Quasi-steady fluctuation force
1055 logical :: pressure_gradient_force !< Pressure gradient force
1056 integer :: added_mass_force !< Particle added mass model
1057 real(wp), dimension(num_fluids_max) :: mu_ref !< Sutherland reference viscosity per fluid
1058 real(wp), dimension(num_fluids_max) :: suth !< Sutherland constant per fluid
1059 integer :: interpolation_order !< Fluid-to-Particle barycentric interpolation order
1060 character(LEN=pathlen_max) :: input_path !< Path to the particle input file
1061 real(wp) :: charwidth !< Domain virtual depth (z direction, for 2D simulations)
1062 real(wp) :: valmaxvoid !< Maximum void fraction permitted
1064
1065 !> Max and min number of cells in a direction of each combination of x-,y-, and z-
1067 integer :: mn_max, np_max, mp_max, mnp_max
1068 integer :: mn_min, np_min, mp_min, mnp_min
1069 end type cell_num_bounds
1070
1072 logical, dimension(3) :: perturb_vel
1073 real(wp), dimension(3) :: perturb_vel_freq
1074 real(wp), dimension(3) :: perturb_vel_scale
1075 real(wp), dimension(3, 3) :: perturb_vel_offset
1076 logical, dimension(1:num_fluids_max) :: perturb_dens
1077 real(wp), dimension(1:num_fluids_max) :: perturb_dens_freq
1078 real(wp), dimension(1:num_fluids_max) :: perturb_dens_scale
1079 real(wp), dimension(1:num_fluids_max,3) :: perturb_dens_offset
1080 end type simplex_noise_params
1081
1082 !> An index-space rectangle in global cell indices. In v1, one t_box = one rank's subdomain. Flat leaf: no allocatable/pointer
1083 !! components, host-only, never namelist/broadcast.
1085 integer :: lo(3) !< global low cell index per axis (x,y,z)
1086 integer :: hi(3) !< global high cell index per axis
1087 end type t_box
1088end 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,...
Grid the initial condition patches are evaluated on.
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).