Skip to content

Commit b6bf034

Browse files
committed
Refactor variable conversion into common code
1 parent aaecc47 commit b6bf034

15 files changed

Lines changed: 198 additions & 217 deletions

src/common/m_global_parameters_common.fpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,29 @@ module m_global_parameters_common
6464
integer, dimension(3, 2) :: shear_BC_flip_indices !< Shear stress BC reflection indices (1:3, 1:shear_BC_flip_num)
6565
!> @}
6666

67+
!> @name Material properties derived from fluid_pp
68+
!> @{ One declaration is shared by all executables and initialized by m_variables_conversion after the case parameters have been
69+
!! read.
70+
real(wp), allocatable, dimension(:) :: gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps
71+
$:GPU_DECLARE(create='[gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps]')
72+
!> @}
73+
74+
!> @name Fluids participating in shear and bulk viscosity
75+
!> @{
76+
integer, dimension(2) :: Re_size = 0
77+
integer :: Re_size_max = 0
78+
integer, allocatable, dimension(:,:) :: Re_idx
79+
$:GPU_DECLARE(create='[Re_size, Re_size_max, Re_idx]')
80+
!> @}
81+
82+
!> @name Working-direction index mapping
83+
!> @{
84+
integer, dimension(3) :: dir_idx
85+
real(wp), dimension(3) :: dir_flg
86+
integer, dimension(3) :: dir_idx_tau
87+
$:GPU_DECLARE(create='[dir_idx, dir_flg, dir_idx_tau]')
88+
!> @}
89+
6790
#ifdef MFC_SIMULATION
6891
$:GPU_DECLARE(create='[sys_size, eqn_idx, b_size, tensor_size]')
6992
$:GPU_DECLARE(create='[shear_num, shear_indices, shear_BC_flip_num, shear_BC_flip_indices]')
@@ -434,6 +457,8 @@ contains
434457
igr_order = dflt_int
435458
mhd = .false.
436459
relativity = .false.
460+
viscous = .false.
461+
riemann_solver = dflt_int
437462
#:endif
438463

439464
! Tait EOS
@@ -464,6 +489,12 @@ contains
464489
down_sample = .false.
465490
fft_wrt = .false.
466491

492+
! Mixture conversion and sound-speed behavior
493+
avg_state = dflt_int
494+
alt_soundspeed = .false.
495+
mixture_err = .false.
496+
sigR = dflt_real
497+
467498
end subroutine s_assign_common_defaults
468499

469500
end module m_global_parameters_common

src/common/m_variables_conversion.fpp

Lines changed: 106 additions & 162 deletions
Large diffs are not rendered by default.

src/post_process/m_global_parameters.fpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,6 @@ contains
190190
t_save = dflt_real
191191
t_stop = dflt_real
192192

193-
! Simulation algorithm parameters (post-specific)
194-
mixture_err = .false.
195-
alt_soundspeed = .false.
196-
197193
bc_io = .false.
198194
num_bc_patches = dflt_int
199195

@@ -298,11 +294,9 @@ contains
298294
schlieren_alpha = dflt_real
299295

300296
fd_order = dflt_int
301-
avg_state = dflt_int
302297

303298
! Bubble modeling (post-specific)
304299
nb = dflt_int
305-
sigR = dflt_real
306300

307301
! Output partial domain (post-specific)
308302
output_partial_domain = .false.

src/post_process/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ contains
781781
call s_initialize_mpi_common_module()
782782
end if
783783
call s_initialize_boundary_common_module()
784-
call s_initialize_variables_conversion_module()
784+
call s_initialize_variables_conversion_module(store_mixture_fields=.true., lagrange_beta_index=beta_idx)
785785
call s_initialize_data_input_module()
786786
call s_initialize_derived_variables_module()
787787
call s_initialize_data_output_module()

src/pre_process/m_global_parameters.fpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ contains
184184
pre_stress = .false.
185185

186186
precision = 2
187-
viscous = .false.
188187
mixlayer_vel_profile = .false.
189188
mixlayer_vel_coef = 1._wp
190189
mixlayer_perturb = .false.
@@ -318,7 +317,6 @@ contains
318317
Web = dflt_real
319318

320319
nmom = 1
321-
sigR = dflt_real
322320
sigV = dflt_real
323321
rhoRV = 0._wp
324322
dist_type = dflt_int

src/simulation/m_bubbles_EL.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ contains
659659
660660
! Obtain liquid density and computing speed of sound from pinf
661661
call s_compute_species_fraction(q_prim_vf, cell(1), cell(2), cell(3), myalpha_rho, myalpha)
662-
call s_convert_species_to_mixture_variables_acc(myRho, gamma, pi_inf, qv, myalpha, myalpha_rho, Re)
662+
call s_convert_species_to_mixture_variables_kernel(myRho, gamma, pi_inf, qv, myalpha, myalpha_rho, Re)
663663
call s_compute_cson_from_pinf(q_prim_vf, myPinf, cell, myRho, gamma, pi_inf, myCson)
664664
665665
! Adaptive time stepping

src/simulation/m_cbc.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ contains
624624
adv_local(i) = q_prim_rs${XYZ}$_vf(0, k, r, eqn_idx%E + i)
625625
end do
626626
627-
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv, adv_local, alpha_rho, Re_cbc)
627+
call s_convert_species_to_mixture_variables_kernel(rho, gamma, pi_inf, qv, adv_local, alpha_rho, Re_cbc)
628628
629629
$:GPU_LOOP(parallelism='[seq]')
630630
do i = 1, eqn_idx%cont%end

src/simulation/m_global_parameters.fpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,6 @@ module m_global_parameters
150150
type(int_bounds_info) :: idwbuff(1:3)
151151
$:GPU_DECLARE(create='[idwbuff]')
152152

153-
!> @name The number of fluids, along with their identifying indexes, respectively, for which viscous effects, e.g. the shear
154-
!! and/or the volume Reynolds (Re) numbers, will be non-negligible.
155-
!> @{
156-
integer, dimension(2) :: Re_size
157-
integer :: Re_size_max
158-
integer, allocatable, dimension(:,:) :: Re_idx
159-
!> @}
160-
161-
$:GPU_DECLARE(create='[Re_size, Re_size_max, Re_idx]')
162-
163153
!> @name Herschel-Bulkley non-Newtonian viscosity: per-fluid flags and parameter arrays.
164154
!> @{
165155
logical :: any_non_newtonian !< .true. if any fluid is non-Newtonian
@@ -178,17 +168,6 @@ module m_global_parameters
178168

179169
$:GPU_DECLARE(create='[wa_flg]')
180170

181-
!> @name The coordinate direction indexes and flags (flg), respectively, for which the configurations will be determined with
182-
!! respect to a working direction and that will be used to isolate the contributions, in that direction, in the dimensionally
183-
!! split system of equations.
184-
!> @{
185-
integer, dimension(3) :: dir_idx
186-
real(wp), dimension(3) :: dir_flg
187-
integer, dimension(3) :: dir_idx_tau !< used for hypoelasticity=true
188-
!> @}
189-
190-
$:GPU_DECLARE(create='[dir_idx, dir_flg, dir_idx_tau]')
191-
192171
integer :: buff_size !< Number of ghost cells for boundary condition storage
193172
$:GPU_DECLARE(create='[buff_size]')
194173

@@ -280,9 +259,6 @@ module m_global_parameters
280259
!> @{
281260
!> @}
282261

283-
real(wp), allocatable, dimension(:) :: gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps
284-
$:GPU_DECLARE(create='[gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps]')
285-
286262
real(wp) :: mytime !< Current simulation time
287263
real(wp) :: finaltime !< Final simulation time
288264
type(pres_field), allocatable, dimension(:) :: pb_ts
@@ -378,13 +354,9 @@ contains
378354
mp_weno = .false.
379355
weno_avg = .false.
380356
weno_Re_flux = .false.
381-
riemann_solver = dflt_int
382357
low_Mach = 0
383358
wave_speeds = dflt_int
384-
avg_state = dflt_int
385-
alt_soundspeed = .false.
386359
null_weights = .false.
387-
mixture_err = .false.
388360
precision = 2
389361
palpha_eps = dflt_real
390362
ptgalpha_eps = dflt_real
@@ -407,7 +379,6 @@ contains
407379
wenoz_q = dflt_real
408380
igr_order = dflt_int
409381
igr_pres_lim = .false.
410-
viscous = .false.
411382
igr_iter_solver = 1
412383
#:endif
413384

src/simulation/m_hyperelastic.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ contains
101101
call s_compute_species_fraction(q_cons_vf, j, k, l, alpha_rho_k, alpha_k)
102102

103103
! If in simulation, use acc mixture subroutines
104-
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv, alpha_k, alpha_rho_k, Re, G_local, &
104+
call s_convert_species_to_mixture_variables_kernel(rho, gamma, pi_inf, qv, alpha_k, alpha_rho_k, Re, G_local, &
105105
& Gs_hyper)
106106
rho = max(rho, sgm_eps)
107107
G_local = max(G_local, sgm_eps)

src/simulation/m_ibm.fpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,10 @@ contains
296296
if (model_eqns /= model_eqns_4eq) then
297297
! If in simulation, use acc mixture subroutines
298298
if (elasticity) then
299-
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv_K, alpha_IP, alpha_rho_IP, Re_K, &
300-
& G_K, Gs)
299+
call s_convert_species_to_mixture_variables_kernel(rho, gamma, pi_inf, qv_K, alpha_IP, alpha_rho_IP, &
300+
& Re_K, G_K, Gs)
301301
else
302-
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv_K, alpha_IP, alpha_rho_IP, Re_K)
302+
call s_convert_species_to_mixture_variables_kernel(rho, gamma, pi_inf, qv_K, alpha_IP, alpha_rho_IP, Re_K)
303303
end if
304304
end if
305305

0 commit comments

Comments
 (0)