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 real(wp), allocatable, dimension(:,:) :: interpolated_boundary_v !< Interpolated boundary vertices
517 integer :: boundary_edge_count !< Number of boundary edges
518 integer :: total_vertices !< Total vertex count
519 integer :: interpolate !< Interpolation flag
520
521 ! GPU-friendly flattened arrays
522 integer :: ntrs !< Copy of model%ntrs
523 real(wp), allocatable, dimension(:,:,:) :: trs_v !< Triangle vertices (3, 3, ntrs)
524 real(wp), allocatable, dimension(:,:) :: trs_n !< Triangle normals (3, ntrs)
525 end type t_model_array
526
527 !> Derived type adding initial condition (ic) patch parameters as attributes NOTE: The requirements for the specification of the
528 !! above parameters are strongly dependent on both the choice of the multicomponent flow model as well as the choice of the
529 !! patch geometry.
531
532 integer :: geometry !< Type of geometry for the patch
533 real(wp) :: x_centroid, y_centroid, z_centroid !< Geometric center coordinates of the patch
534 real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
535 real(wp) :: radius !< Dimensions of the patch. radius.
536 real(wp), dimension(3) :: radii !< Elliptical/ellipsoidal patch radii in x, y, z
537 real(wp) :: epsilon, beta !< The isentropic vortex parameters for the amplitude of the disturbance and domain of influence.
538 real(wp), dimension(2:9) :: a !< Used by hardcoded IC and as temporary variables.
539 logical :: non_axis_sym
540
541 ! Geometry 13 (2D modal Fourier): fourier_cos(n), fourier_sin(n) for mode n
542 real(wp), dimension(1:max_2d_fourier_modes) :: fourier_cos, fourier_sin
543 logical :: modal_clip_r_to_min !< When true, clip boundary radius: R(theta) = max(R(theta), modal_r_min) (Non-exp form only)
544 real(wp) :: modal_r_min !< Minimum boundary radius when modal_clip_r_to_min is true (Non-exp form only)
545 logical :: modal_use_exp_form !< When true, boundary = radius*exp(Fourier series)
546 ! Geometry 14 (3D spherical harmonic): sph_har_coeff(l,m) for real Y_lm
547 real(wp), dimension(0:max_sph_harm_degree,-max_sph_harm_degree:max_sph_harm_degree) :: sph_har_coeff
548 real(wp), dimension(3) :: normal !< Patch orientation normal vector (x, y, z)
549 logical, dimension(0:num_patches_max - 1) :: alter_patch !< Overwrite permissions for preceding patches
550 logical :: smoothen !< Whether patch boundaries are smoothed across cells
551 integer :: smooth_patch_id !< Identity (id) of the patch with which current patch is to get smoothed
552 real(wp) :: smooth_coeff !< Smoothing stencil size coefficient
553 real(wp), dimension(num_fluids_max) :: alpha_rho
554 real(wp) :: rho
555 real(wp), dimension(3) :: vel
556 real(wp) :: pres
557 real(wp), dimension(num_fluids_max) :: alpha
558 real(wp) :: gamma
559 real(wp) :: pi_inf
560 real(wp) :: cv
561 real(wp) :: qv
562 real(wp) :: qvp !< Reference entropy per unit mass (SGEOS)
563 real(wp) :: bx, by, bz !< Magnetic field components; B%x is not used for 1D
564 real(wp), dimension(6) :: tau_e !< Elastic stresses added to primitive variables if hypoelasticity = True
565 real(wp) :: r0 !< Bubble size
566 real(wp) :: v0 !< Bubble velocity
567 real(wp) :: p0 !< Bubble size
568 real(wp) :: m0 !< Bubble velocity
569 integer :: hcid !< Hardcoded initial condition ID
570 real(wp) :: cf_val !< Color function value
571 real(wp) :: y(1:num_species) !< Species mass fractions
572
573 ! STL or OBJ model input parameter
574 character(LEN=pathlen_max) :: model_filepath !< Path the STL file relative to case_dir.
575 real(wp), dimension(1:3) :: model_translate !< Translation of the STL object.
576 real(wp), dimension(1:3) :: model_scale !< Scale factor for the STL object.
577 !> Angle to rotate the STL object along each cartesian coordinate axis, in radians.
578 real(wp), dimension(1:3) :: model_rotate
579 integer :: model_spc !< Number of samples per cell to use when discretizing the STL object.
580 real(wp) :: model_threshold !< Threshold to turn on smoothen STL patch.
581 end type ic_patch_parameters
582
584
585 integer :: geometry !< Type of geometry for the patch
586 real(wp) :: x_centroid, y_centroid, z_centroid !< Geometric center coordinates of the patch
587 !> Centroid locations of intermediate steps in the time_stepper module
588 real(wp) :: step_x_centroid, step_y_centroid, step_z_centroid
589 real(wp), dimension(1:3) :: centroid_offset !< offset of center of mass from computed cell center for odd-shaped IBs
590 real(wp), dimension(1:3) :: angles
591 real(wp), dimension(1:3) :: step_angles
592 !> matrix that converts from IB reference frame to fluid reference frame
593 real(wp), dimension(1:3,1:3) :: rotation_matrix
594 !> matrix that converts from fluid reference frame to IB reference frame
595 real(wp), dimension(1:3,1:3) :: rotation_matrix_inverse
596 real(wp) :: c, p, t, m
597 real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
598 real(wp) :: radius !< Dimensions of the patch. radius.
599 real(wp) :: theta
600 logical :: slip
601
602 ! STL or OBJ model input parameter
603 character(LEN=pathlen_max) :: model_filepath !< Path the STL file relative to case_dir.
604 real(wp), dimension(1:3) :: model_translate !< Translation of the STL object.
605 real(wp), dimension(1:3) :: model_scale !< Scale factor for the STL object.
606 !> Angle to rotate the STL object along each cartesian coordinate axis, in radians.
607 real(wp), dimension(1:3) :: model_rotate
608 integer :: model_spc !< Number of samples per cell to use when discretizing the STL object.
609 real(wp) :: model_threshold !< Threshold to turn on smoothen STL patch. Patch conditions for moving imersed boundaries
610 integer :: moving_ibm !< 0 for no moving, 1 for moving, 2 for moving on forced path
611 real(wp) :: mass, moment !< mass and moment of inertia of object used to compute forces in 2-way coupling
612 real(wp), dimension(1:3) :: force, torque !< vectors for the computed force and torque values applied to an IB
613 real(wp), dimension(1:3) :: vel
614 real(wp), dimension(1:3) :: step_vel !< velocity array used to store intermediate steps in the time_stepper module
615 real(wp), dimension(1:3) :: angular_vel
616 real(wp), dimension(1:3) :: step_angular_vel !< velocity array used to store intermediate steps in the time_stepper module
617 end type ib_patch_parameters
618
619 !> Derived type annexing the physical parameters (PP) of the fluids. These include the specific heat ratio function and liquid
620 !! stiffness function.
622 real(wp) :: gamma !< Sp. heat ratio
623 real(wp) :: pi_inf !< Liquid stiffness
624 real(wp), dimension(2) :: re !< Reynolds number
625 real(wp) :: cv !< heat capacity
626 real(wp) :: qv !< reference energy per unit mass for SGEOS, q (see Le Metayer (2004))
627 real(wp) :: qvp !< reference entropy per unit mass for SGEOS, q' (see Le Metayer (2004))
628 real(wp) :: g
629 end type physical_parameters
630
631 !> Derived type annexing the physical parameters required for sub-grid bubble models
633 real(wp) :: r0ref !< reference bubble radius
634 real(wp) :: p0ref !< reference pressure
635 real(wp) :: rho0ref !< reference density
636 real(wp) :: t0ref !< reference temperature
637 real(wp) :: ss !< surface tension between host and gas (bubble)
638 real(wp) :: pv !< vapor pressure of host
639 real(wp) :: vd !< vapor diffusivity in gas (bubble)
640 real(wp) :: mu_l !< viscosity of host in liquid state
641 real(wp) :: mu_v !< viscosity of host in vapor state
642 real(wp) :: mu_g !< viscosity of gas (bubble)
643 real(wp) :: gam_v !< specific heat ratio of host in vapor state
644 real(wp) :: gam_g !< specific heat ratio of gas (bubble)
645 real(wp) :: m_v !< Molecular weight of host
646 real(wp) :: m_g !< Molecular weight of gas (bubble)
647 real(wp) :: k_v !< thermal conductivity of host in vapor state
648 real(wp) :: k_g !< thermal conductivity of gas (bubble)
649 real(wp) :: cp_v !< specific heat capacity in constant pressure of host in vapor state
650 real(wp) :: cp_g !< specific heat capacity in constant pressure of gas (bubble)
651 real(wp) :: r_v !< gas constant of host in vapor state
652 real(wp) :: r_g !< gas constant of gas (bubble)
654
656 integer, dimension(2) :: view
657 type(vec3_dt), allocatable, dimension(:) :: var
658 end type mpi_io_airfoil_ib_var
659
660 !> Derived type annexing integral regions
662 real(wp) :: xmin !< Min. boundary first coordinate direction
663 real(wp) :: xmax !< Max. boundary first coordinate direction
664 real(wp) :: ymin !< Min. boundary second coordinate direction
665 real(wp) :: ymax !< Max. boundary second coordinate direction
666 real(wp) :: zmin !< Min. boundary third coordinate direction
667 real(wp) :: zmax !< Max. boundary third coordinate direction
668 end type integral_parameters
669
670 !> Acoustic source parameters
672 integer :: pulse !< Type of pulse
673 integer :: support !< Type of support
674 logical :: dipole !< Whether the source is a dipole or monopole
675 real(wp), dimension(3) :: loc !< Physical location of acoustic source
676 real(wp) :: mag !< Acoustic pulse magnitude
677 real(wp) :: length !< Length of planar source (2D/3D)
678 real(wp) :: height !< Height of planar source (3D)
679 real(wp) :: wavelength !< Wave length of pulse
680 real(wp) :: frequency !< Frequency of pulse
681 real(wp) :: gauss_sigma_dist !< sigma of Gaussian pulse multiplied by speed of sound
682 real(wp) :: gauss_sigma_time !< sigma of Gaussian pulse
683 real(wp) :: npulse !< Number of cycles of pulse
684 real(wp) :: dir !< Direction of pulse
685 real(wp) :: delay !< Time-delay of pulse start
686 real(wp) :: foc_length !< Focal length of transducer
687 real(wp) :: aperture !< Aperture diameter of transducer
688 real(wp) :: element_spacing_angle !< Spacing between aperture elements in 2D acoustic array
689 !> Ratio of aperture element diameter to side length of polygon connecting their centers, in 3D acoustic array
690 real(wp) :: element_polygon_ratio
691 real(wp) :: rotate_angle !< Angle of rotation of the entire circular 3D acoustic array
692 real(wp) :: bb_bandwidth !< Bandwidth of each frequency in broadband wave
693 real(wp) :: bb_lowest_freq !< The lower frequency bound of broadband wave
694 integer :: num_elements !< Number of elements in the acoustic array
695 integer :: element_on !< Element in the acoustic array to turn on
696 integer :: bb_num_freq !< Number of frequencies in the broadband wave
697 end type acoustic_parameters
698
699 !> Acoustic source source_spatial pre-calculated values
701 integer, pointer, dimension(:,:) :: coord => null() !< List of grid points indices with non-zero source_spatial values
702 real(wp), pointer, dimension(:) :: val => null() !< List of non-zero source_spatial values
703 real(wp), pointer, dimension(:) :: angle => null() !< List of angles with x-axis for mom source term vector
704 real(wp), pointer, dimension(:,:) :: xyz_to_r_ratios => null() !< List of [xyz]/r for mom source term vector
705 end type source_spatial_type
706
707 !> Ghost Point for Immersed Boundaries
709 integer, dimension(3) :: loc !< Physical location of the ghost point
710 real(wp), dimension(3) :: ip_loc !< Physical location of the image point
711 integer, dimension(3) :: ip_grid !< Top left grid point of IP
712 real(wp), dimension(2, 2, 2) :: interp_coeffs !< Interpolation Coefficients of image point
713 integer :: ib_patch_id !< ID of the IB Patch the ghost point is part of
714 real(wp) :: levelset
715 real(wp), dimension(1:3) :: levelset_norm
716 logical :: slip
717 integer, dimension(3) :: db
718 integer :: x_periodicity, y_periodicity, z_periodicity
719 end type ghost_point
720
721 !> Species parameters
723 character(LEN=name_len) :: name !< Name of species
724 end type species_parameters
725
726 !> Chemistry parameters
728 character(LEN=name_len) :: cantera_file !< Path to Cantera file
729 logical :: diffusion
730 logical :: reactions
731
732 !> Method of determining gamma.
733 !> gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97.
734 !> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats.
735 integer :: gamma_method
736 integer :: transport_model
737 end type chemistry_parameters
738
739 !> Lagrangian bubble parameters
741
742 integer :: solver_approach !< 1: One-way coupling, 2: two-way coupling
743 integer :: cluster_type !< Cluster model to find p_inf
744 logical :: pressure_corrector !< Cell pressure correction term
745 integer :: smooth_type !< Smoothing function. 1: Gaussian, 2:Delta 3x3
746 logical :: heattransfer_model !< Activate HEAT transfer model at the bubble-liquid interface
747 logical :: masstransfer_model !< Activate MASS transfer model at the bubble-liquid interface
748 logical :: write_bubbles !< Write files to track the bubble evolution each time step
749 logical :: write_bubbles_stats !< Write the maximum and minimum radius of each bubble
750 integer :: nbubs_glb !< Global number of bubbles
751 real(wp) :: epsilonb !< Standard deviation scaling for the gaussian function
752 real(wp) :: charwidth !< Domain virtual depth (z direction, for 2D simulations)
753 real(wp) :: valmaxvoid !< Maximum void fraction permitted
755
756 !> Max and min number of cells in a direction of each combination of x-,y-, and z-
758 integer :: mn_max, np_max, mp_max, mnp_max
759 integer :: mn_min, np_min, mp_min, mnp_min
760 end type cell_num_bounds
761
763 logical, dimension(3) :: perturb_vel
764 real(wp), dimension(3) :: perturb_vel_freq
765 real(wp), dimension(3) :: perturb_vel_scale
766 real(wp), dimension(3, 3) :: perturb_vel_offset
767 logical, dimension(1:num_fluids_max) :: perturb_dens
768 real(wp), dimension(1:num_fluids_max) :: perturb_dens_freq
769 real(wp), dimension(1:num_fluids_max) :: perturb_dens_scale
770 real(wp), dimension(1:num_fluids_max,3) :: perturb_dens_offset
771 end type simplex_noise_params
772end module m_derived_types
integer, intent(in) l
Compile-time constant parameters: default values, tolerances, and physical constants.
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.
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).