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