Skip to content

Commit 3ba0419

Browse files
author
Spencer Bryngelson
committed
Merge origin/master: remove molecular_weights_nonparameter AMD workaround
2 parents acdc241 + 45cd6bb commit 3ba0419

17 files changed

Lines changed: 83 additions & 227 deletions

File tree

.coderabbit.yaml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
11
# Spencer H. Bryngelson (sbryngelson) is the
22
# default owner of all files in the repository.
33
* @sbryngelson
4-
5-
# @core-devs
6-
src/ @MFlowCode/core-devs
7-
docs/ @MFlowCode/core-devs
8-
toolchain/ @MFlowCode/core-devs
9-
tests/ @MFlowCode/core-devs
10-
benchmarks/ @MFlowCode/core-devs
11-
mfc.sh @MFlowCode/core-devs
12-
CMakeLists.txt @MFlowCode/core-devs
13-
14-
# @physics-devs
15-
src/ @MFlowCode/physics-devs

benchmarks/igr/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
json.dumps(
5050
{
5151
# Logistics
52-
"run_time_info": "T",
52+
"run_time_info": "F",
5353
# Computational Domain Parameters
5454
"x_domain%beg": -math.pi * L,
5555
"x_domain%end": math.pi * L,

mfc.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,12 @@ if [ $code -ne 0 ]; then
102102
error "main.py finished with a $code exit code."
103103
fi
104104

105-
# Deactivate the Python virtualenv in case the user "source"'d this script
106-
log "(venv) Exiting the$MAGENTA Python$COLOR_RESET virtual environment."
107-
deactivate
105+
# Deactivate the Python virtualenv in case the user "source"'d this script.
106+
# In prebuilt/spack mode the venv was never created, so there's nothing to deactivate.
107+
if type deactivate > /dev/null 2>&1; then
108+
log "(venv) Exiting the$MAGENTA Python$COLOR_RESET virtual environment."
109+
deactivate
110+
fi
108111

109112
# Exit with proper exit code
110113
exit $code

src/common/m_checker_common.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ contains
5454
#:if not MFC_CASE_OPTIMIZATION
5555
@:PROHIBIT(num_fluids > 3, "num_fluids <= 3 for AMDFLang when Case optimization is off")
5656
@:PROHIBIT((bubbles_euler .or. bubbles_lagrange) .and. nb > 3, "nb <= 3 for AMDFLang when Case optimization is off")
57-
@:PROHIBIT(chemistry .and. num_species /= 10, "num_species = 10 for AMDFLang when Case optimization is off")
57+
@:PROHIBIT(chemistry .and. num_species > 10, "num_species > 10 for AMDFLang when Case optimization is off")
5858
#:endif
5959

6060
end subroutine s_check_amd

src/common/m_chemistry.fpp

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ module m_chemistry
1818

1919
implicit none
2020

21-
#:if USING_AMD
22-
real(wp) :: molecular_weights_nonparameter(10) = (/2.016, 1.008, 15.999, 31.998, 17.007, 18.015, 33.006, 34.014, 39.95, &
23-
& 28.014/)
24-
$:GPU_DECLARE(create='[molecular_weights_nonparameter]')
25-
#:endif
26-
2721
type(int_bounds_info) :: isc1, isc2, isc3
2822
$:GPU_DECLARE(create='[isc1, isc2, isc3]')
2923
integer, dimension(3) :: offsets
@@ -145,12 +139,7 @@ contains
145139

146140
$:GPU_LOOP(parallelism='[seq]')
147141
do eqn = eqn_idx%species%beg, eqn_idx%species%end
148-
#:if USING_AMD
149-
omega_m = molecular_weights_nonparameter(eqn - eqn_idx%species%beg + 1)*omega(eqn &
150-
& - eqn_idx%species%beg + 1)
151-
#:else
152-
omega_m = molecular_weights(eqn - eqn_idx%species%beg + 1)*omega(eqn - eqn_idx%species%beg + 1)
153-
#:endif
142+
omega_m = molecular_weights(eqn - eqn_idx%species%beg + 1)*omega(eqn - eqn_idx%species%beg + 1)
154143
rhs_vf(eqn)%sf(cx, cy, cz) = rhs_vf(eqn)%sf(cx, cy, cz) + omega_m
155144
end do
156145
end do
@@ -262,17 +251,10 @@ contains
262251
! Calculate species properties and gradients
263252
$:GPU_LOOP(parallelism='[seq]')
264253
do i = eqn_idx%species%beg, eqn_idx%species%end
265-
#:if USING_AMD
266-
h_l(i - eqn_idx%species%beg + 1) = h_l(i - eqn_idx%species%beg + 1) &
267-
& *gas_constant*T_L/molecular_weights_nonparameter(i - eqn_idx%species%beg + 1)
268-
h_r(i - eqn_idx%species%beg + 1) = h_r(i - eqn_idx%species%beg + 1) &
269-
& *gas_constant*T_R/molecular_weights_nonparameter(i - eqn_idx%species%beg + 1)
270-
#:else
271-
h_l(i - eqn_idx%species%beg + 1) = h_l(i - eqn_idx%species%beg + 1) &
272-
& *gas_constant*T_L/molecular_weights(i - eqn_idx%species%beg + 1)
273-
h_r(i - eqn_idx%species%beg + 1) = h_r(i - eqn_idx%species%beg + 1) &
274-
& *gas_constant*T_R/molecular_weights(i - eqn_idx%species%beg + 1)
275-
#:endif
254+
h_l(i - eqn_idx%species%beg + 1) = h_l(i - eqn_idx%species%beg + 1) &
255+
& *gas_constant*T_L/molecular_weights(i - eqn_idx%species%beg + 1)
256+
h_r(i - eqn_idx%species%beg + 1) = h_r(i - eqn_idx%species%beg + 1) &
257+
& *gas_constant*T_R/molecular_weights(i - eqn_idx%species%beg + 1)
276258
Xs_cell(i - eqn_idx%species%beg + 1) = 0.5_wp*(Xs_L(i - eqn_idx%species%beg + 1) + Xs_R(i &
277259
& - eqn_idx%species%beg + 1))
278260
h_k(i - eqn_idx%species%beg + 1) = 0.5_wp*(h_l(i - eqn_idx%species%beg + 1) + h_r(i &
@@ -297,15 +279,9 @@ contains
297279

298280
$:GPU_LOOP(parallelism='[seq]')
299281
do eqn = eqn_idx%species%beg, eqn_idx%species%end
300-
#:if USING_AMD
301-
Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn &
302-
& - eqn_idx%species%beg + 1)*molecular_weights_nonparameter(eqn &
303-
& - eqn_idx%species%beg + 1)/MW_cell*dXk_dxi(eqn - eqn_idx%species%beg + 1)
304-
#:else
305-
Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn &
306-
& - eqn_idx%species%beg + 1)*molecular_weights(eqn - eqn_idx%species%beg + 1) &
307-
& /MW_cell*dXk_dxi(eqn - eqn_idx%species%beg + 1)
308-
#:endif
282+
Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn &
283+
& - eqn_idx%species%beg + 1)*molecular_weights(eqn - eqn_idx%species%beg + 1) &
284+
& /MW_cell*dXk_dxi(eqn - eqn_idx%species%beg + 1)
309285
rho_Vic = rho_Vic + Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1)
310286
Mass_Diffu_Energy = Mass_Diffu_Energy + h_k(eqn - eqn_idx%species%beg + 1)*Mass_Diffu_Flux(eqn &
311287
& - eqn_idx%species%beg + 1)

src/simulation/include/inline_riemann.fpp

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -33,51 +33,28 @@
3333
eps = 0.001_wp
3434
call get_species_enthalpies_rt(T%L, h_iL)
3535
call get_species_enthalpies_rt(T%R, h_iR)
36-
#:if USING_AMD
37-
h_iL = h_iL*gas_constant/molecular_weights_nonparameter*T%L
38-
h_iR = h_iR*gas_constant/molecular_weights_nonparameter*T%R
39-
#:else
40-
h_iL = h_iL*gas_constant/molecular_weights*T%L
41-
h_iR = h_iR*gas_constant/molecular_weights*T%R
42-
#:endif
36+
h_iL = h_iL*gas_constant/molecular_weights*T%L
37+
h_iR = h_iR*gas_constant/molecular_weights*T%R
4338
call get_species_specific_heats_r(T%L, Cp_iL)
4439
call get_species_specific_heats_r(T%R, Cp_iR)
4540

4641
h_avg_2 = (sqrt(rho%L)*h_iL + sqrt(rho%R)*h_iR)/(sqrt(rho%L) + sqrt(rho%R))
4742
Yi_avg = (sqrt(rho%L)*Ys_L + sqrt(rho%R)*Ys_R)/(sqrt(rho%L) + sqrt(rho%R))
4843
T_avg = (sqrt(rho%L)*T%L + sqrt(rho%R)*T%R)/(sqrt(rho%L) + sqrt(rho%R))
49-
#:if USING_AMD
50-
if (abs(T%L - T%R) < eps) then
51-
! Case when T%L and T%R are very close
52-
Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights_nonparameter(:))
53-
Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights_nonparameter(:) &
54-
& - gas_constant/molecular_weights_nonparameter(:)))
55-
else
56-
! Normal calculation when T%L and T%R are sufficiently different
57-
Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T%R - T%L))
58-
Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T%R - T%L) - gas_constant/molecular_weights_nonparameter(:)))
59-
end if
60-
gamma_avg = Cp_avg/Cv_avg
61-
62-
Phi_avg(:) = (gamma_avg - 1._wp)*(vel_avg_rms/2.0_wp - h_avg_2(:)) &
63-
& + gamma_avg*gas_constant/molecular_weights_nonparameter(:)*T_avg
64-
c_sum_Yi_Phi = sum(Yi_avg(:)*Phi_avg(:))
65-
#:else
66-
if (abs(T%L - T%R) < eps) then
67-
! Case when T%L and T%R are very close
68-
Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:))
69-
Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:) &
70-
& - gas_constant/molecular_weights(:)))
71-
else
72-
! Normal calculation when T%L and T%R are sufficiently different
73-
Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T%R - T%L))
74-
Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T%R - T%L) - gas_constant/molecular_weights(:)))
75-
end if
76-
gamma_avg = Cp_avg/Cv_avg
77-
78-
Phi_avg(:) = (gamma_avg - 1._wp)*(vel_avg_rms/2.0_wp - h_avg_2(:)) + gamma_avg*gas_constant/molecular_weights(:)*T_avg
79-
c_sum_Yi_Phi = sum(Yi_avg(:)*Phi_avg(:))
80-
#:endif
44+
if (abs(T%L - T%R) < eps) then
45+
! Case when T%L and T%R are very close
46+
Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:))
47+
Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:) &
48+
& - gas_constant/molecular_weights(:)))
49+
else
50+
! Normal calculation when T%L and T%R are sufficiently different
51+
Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T%R - T%L))
52+
Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T%R - T%L) - gas_constant/molecular_weights(:)))
53+
end if
54+
gamma_avg = Cp_avg/Cv_avg
55+
56+
Phi_avg(:) = (gamma_avg - 1._wp)*(vel_avg_rms/2.0_wp - h_avg_2(:)) + gamma_avg*gas_constant/molecular_weights(:)*T_avg
57+
c_sum_Yi_Phi = sum(Yi_avg(:)*Phi_avg(:))
8158
end if
8259
#:enddef roe_avg
8360

src/simulation/m_body_forces.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#:include 'macros.fpp'
66

7-
!> @brief Computes gravitational and user-defined body force source terms for the momentum equations
7+
!> @brief Computes gravitational and body force source terms for the momentum equations
88
module m_body_forces
99

1010
use m_derived_types

src/simulation/m_cbc.fpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ module m_cbc
1616
& gas_constant, get_mixture_molecular_weight, get_species_enthalpies_rt, molecular_weights, get_species_specific_heats_r, &
1717
& get_mole_fractions, get_species_specific_heats_r
1818

19-
#:if USING_AMD
20-
use m_chemistry, only: molecular_weights_nonparameter
21-
#:endif
22-
2319
implicit none
2420

2521
private; public :: s_initialize_cbc_module, s_cbc, s_finalize_cbc_module
@@ -837,14 +833,8 @@ contains
837833
sum_Enthalpies = 0._wp
838834
$:GPU_LOOP(parallelism='[seq]')
839835
do i = 1, num_species
840-
#:if USING_AMD
841-
h_k(i) = h_k(i)*gas_constant/molecular_weights_nonparameter(i)*T
842-
sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights_nonparameter(i) &
843-
& *Cp/R_gas)*dYs_dt(i)
844-
#:else
845-
h_k(i) = h_k(i)*gas_constant/molecular_weights(i)*T
846-
sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights(i)*Cp/R_gas)*dYs_dt(i)
847-
#:endif
836+
h_k(i) = h_k(i)*gas_constant/molecular_weights(i)*T
837+
sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights(i)*Cp/R_gas)*dYs_dt(i)
848838
end do
849839
flux_rs%${XYZ}$(-1, k, r, eqn_idx%E) = flux_rs%${XYZ}$(0, k, r, &
850840
& eqn_idx%E) + ds(0)*((E/rho + pres/rho)*drho_dt + rho*vel_dv_dt_sum + Cp*T*L(2)/(c*c) &

src/simulation/m_riemann_solvers.fpp

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ module m_riemann_solvers
2222
use m_thermochem, only: gas_constant, get_mixture_molecular_weight, get_mixture_specific_heat_cv_mass, &
2323
& get_mixture_energy_mass, get_species_specific_heats_r, get_species_enthalpies_rt, get_mixture_specific_heat_cp_mass
2424

25-
#:if USING_AMD
26-
use m_chemistry, only: molecular_weights_nonparameter
27-
#:endif
28-
2925
implicit none
3026

3127
private; public :: s_initialize_riemann_solvers_module, s_riemann_solver, s_hll_riemann_solver, s_hllc_riemann_solver, &
@@ -319,13 +315,8 @@ contains
319315

320316
call get_mixture_molecular_weight(Ys_L, MW%L)
321317
call get_mixture_molecular_weight(Ys_R, MW%R)
322-
#:if USING_AMD
323-
Xs_L(:) = Ys_L(:)*MW%L/molecular_weights_nonparameter(:)
324-
Xs_R(:) = Ys_R(:)*MW%R/molecular_weights_nonparameter(:)
325-
#:else
326-
Xs_L(:) = Ys_L(:)*MW%L/molecular_weights(:)
327-
Xs_R(:) = Ys_R(:)*MW%R/molecular_weights(:)
328-
#:endif
318+
Xs_L(:) = Ys_L(:)*MW%L/molecular_weights(:)
319+
Xs_R(:) = Ys_R(:)*MW%R/molecular_weights(:)
329320

330321
R_gas%L = gas_constant/MW%L
331322
R_gas%R = gas_constant/MW%R
@@ -993,13 +984,8 @@ contains
993984
call get_mixture_molecular_weight(Ys_L, MW%L)
994985
call get_mixture_molecular_weight(Ys_R, MW%R)
995986

996-
#:if USING_AMD
997-
Xs_L(:) = Ys_L(:)*MW%L/molecular_weights_nonparameter(:)
998-
Xs_R(:) = Ys_R(:)*MW%R/molecular_weights_nonparameter(:)
999-
#:else
1000-
Xs_L(:) = Ys_L(:)*MW%L/molecular_weights(:)
1001-
Xs_R(:) = Ys_R(:)*MW%R/molecular_weights(:)
1002-
#:endif
987+
Xs_L(:) = Ys_L(:)*MW%L/molecular_weights(:)
988+
Xs_R(:) = Ys_R(:)*MW%R/molecular_weights(:)
1003989

1004990
R_gas%L = gas_constant/MW%L
1005991
R_gas%R = gas_constant/MW%R
@@ -2861,13 +2847,8 @@ contains
28612847
call get_mixture_molecular_weight(Ys_L, MW%L)
28622848
call get_mixture_molecular_weight(Ys_R, MW%R)
28632849

2864-
#:if USING_AMD
2865-
Xs_L(:) = Ys_L(:)*MW%L/molecular_weights_nonparameter(:)
2866-
Xs_R(:) = Ys_R(:)*MW%R/molecular_weights_nonparameter(:)
2867-
#:else
2868-
Xs_L(:) = Ys_L(:)*MW%L/molecular_weights(:)
2869-
Xs_R(:) = Ys_R(:)*MW%R/molecular_weights(:)
2870-
#:endif
2850+
Xs_L(:) = Ys_L(:)*MW%L/molecular_weights(:)
2851+
Xs_R(:) = Ys_R(:)*MW%R/molecular_weights(:)
28712852

28722853
R_gas%L = gas_constant/MW%L
28732854
R_gas%R = gas_constant/MW%R

0 commit comments

Comments
 (0)