Skip to content

Commit 1fa8b01

Browse files
Merge branch 'master' into debug-airfoil-sign-error
2 parents 418efe8 + ab146e9 commit 1fa8b01

11 files changed

Lines changed: 41 additions & 198 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

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ exit 0
643643
target_compile_options(${a_target} PRIVATE -fopenmp)
644644
target_link_options(${a_target} PRIVATE -fopenmp)
645645
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
646-
target_compile_options(${a_target} PRIVATE -fopenmp --offload-arch=gfx90a -fopenmp-target-fast -fopenmp-assume-threads-oversubscription -fopenmp-assume-teams-oversubscription)
646+
target_compile_options(${a_target} PRIVATE -fopenmp --offload-arch=gfx90a -O3 -fopenmp-assume-threads-oversubscription -fopenmp-assume-teams-oversubscription)
647647
target_link_options(${a_target} PRIVATE -fopenmp --offload-arch=gfx90a -flto-partitions=${MFC_BUILD_JOBS})
648648
endif()
649649
endif()

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+
# Guard against the case where no venv was activated (e.g. system Python).
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
@@ -144,12 +138,7 @@ contains
144138

145139
$:GPU_LOOP(parallelism='[seq]')
146140
do eqn = eqn_idx%species%beg, eqn_idx%species%end
147-
#:if USING_AMD
148-
omega_m = molecular_weights_nonparameter(eqn - eqn_idx%species%beg + 1)*omega(eqn &
149-
& - eqn_idx%species%beg + 1)
150-
#:else
151-
omega_m = molecular_weights(eqn - eqn_idx%species%beg + 1)*omega(eqn - eqn_idx%species%beg + 1)
152-
#:endif
141+
omega_m = molecular_weights(eqn - eqn_idx%species%beg + 1)*omega(eqn - eqn_idx%species%beg + 1)
153142
rhs_vf(eqn)%sf(x, y, z) = rhs_vf(eqn)%sf(x, y, z) + omega_m
154143
end do
155144
end do
@@ -260,17 +249,10 @@ contains
260249
! Calculate species properties and gradients
261250
$:GPU_LOOP(parallelism='[seq]')
262251
do i = eqn_idx%species%beg, eqn_idx%species%end
263-
#:if USING_AMD
264-
h_l(i - eqn_idx%species%beg + 1) = h_l(i - eqn_idx%species%beg + 1) &
265-
& *gas_constant*T_L/molecular_weights_nonparameter(i - eqn_idx%species%beg + 1)
266-
h_r(i - eqn_idx%species%beg + 1) = h_r(i - eqn_idx%species%beg + 1) &
267-
& *gas_constant*T_R/molecular_weights_nonparameter(i - eqn_idx%species%beg + 1)
268-
#:else
269-
h_l(i - eqn_idx%species%beg + 1) = h_l(i - eqn_idx%species%beg + 1) &
270-
& *gas_constant*T_L/molecular_weights(i - eqn_idx%species%beg + 1)
271-
h_r(i - eqn_idx%species%beg + 1) = h_r(i - eqn_idx%species%beg + 1) &
272-
& *gas_constant*T_R/molecular_weights(i - eqn_idx%species%beg + 1)
273-
#:endif
252+
h_l(i - eqn_idx%species%beg + 1) = h_l(i - eqn_idx%species%beg + 1) &
253+
& *gas_constant*T_L/molecular_weights(i - eqn_idx%species%beg + 1)
254+
h_r(i - eqn_idx%species%beg + 1) = h_r(i - eqn_idx%species%beg + 1) &
255+
& *gas_constant*T_R/molecular_weights(i - eqn_idx%species%beg + 1)
274256
Xs_cell(i - eqn_idx%species%beg + 1) = 0.5_wp*(Xs_L(i - eqn_idx%species%beg + 1) + Xs_R(i &
275257
& - eqn_idx%species%beg + 1))
276258
h_k(i - eqn_idx%species%beg + 1) = 0.5_wp*(h_l(i - eqn_idx%species%beg + 1) + h_r(i &
@@ -295,15 +277,9 @@ contains
295277

296278
$:GPU_LOOP(parallelism='[seq]')
297279
do eqn = eqn_idx%species%beg, eqn_idx%species%end
298-
#:if USING_AMD
299-
Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn &
300-
& - eqn_idx%species%beg + 1)*molecular_weights_nonparameter(eqn &
301-
& - eqn_idx%species%beg + 1)/MW_cell*dXk_dxi(eqn - eqn_idx%species%beg + 1)
302-
#:else
303-
Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn &
304-
& - eqn_idx%species%beg + 1)*molecular_weights(eqn - eqn_idx%species%beg + 1) &
305-
& /MW_cell*dXk_dxi(eqn - eqn_idx%species%beg + 1)
306-
#:endif
280+
Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn &
281+
& - eqn_idx%species%beg + 1)*molecular_weights(eqn - eqn_idx%species%beg + 1) &
282+
& /MW_cell*dXk_dxi(eqn - eqn_idx%species%beg + 1)
307283
rho_Vic = rho_Vic + Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1)
308284
Mass_Diffu_Energy = Mass_Diffu_Energy + h_k(eqn - eqn_idx%species%beg + 1)*Mass_Diffu_Flux(eqn &
309285
& - 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_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
@@ -871,14 +867,8 @@ contains
871867
sum_Enthalpies = 0._wp
872868
$:GPU_LOOP(parallelism='[seq]')
873869
do i = 1, num_species
874-
#:if USING_AMD
875-
h_k(i) = h_k(i)*gas_constant/molecular_weights_nonparameter(i)*T
876-
sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights_nonparameter(i) &
877-
& *Cp/R_gas)*dYs_dt(i)
878-
#:else
879-
h_k(i) = h_k(i)*gas_constant/molecular_weights(i)*T
880-
sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights(i)*Cp/R_gas)*dYs_dt(i)
881-
#:endif
870+
h_k(i) = h_k(i)*gas_constant/molecular_weights(i)*T
871+
sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights(i)*Cp/R_gas)*dYs_dt(i)
882872
end do
883873
flux_rs${XYZ}$_vf_l(-1, k, r, eqn_idx%E) = flux_rs${XYZ}$_vf_l(0, k, r, &
884874
& eqn_idx%E) + ds(0)*((E/rho + pres/rho)*drho_dt + rho*vel_dv_dt_sum + Cp*T*L(2) &

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, &
@@ -339,13 +335,8 @@ contains
339335

340336
call get_mixture_molecular_weight(Ys_L, MW_L)
341337
call get_mixture_molecular_weight(Ys_R, MW_R)
342-
#:if USING_AMD
343-
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights_nonparameter(:)
344-
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights_nonparameter(:)
345-
#:else
346-
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
347-
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)
348-
#:endif
338+
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
339+
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)
349340

350341
R_gas_L = gas_constant/MW_L
351342
R_gas_R = gas_constant/MW_R
@@ -1029,13 +1020,8 @@ contains
10291020
call get_mixture_molecular_weight(Ys_L, MW_L)
10301021
call get_mixture_molecular_weight(Ys_R, MW_R)
10311022

1032-
#:if USING_AMD
1033-
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights_nonparameter(:)
1034-
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights_nonparameter(:)
1035-
#:else
1036-
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
1037-
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)
1038-
#:endif
1023+
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
1024+
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)
10391025

10401026
R_gas_L = gas_constant/MW_L
10411027
R_gas_R = gas_constant/MW_R
@@ -2930,13 +2916,8 @@ contains
29302916
call get_mixture_molecular_weight(Ys_L, MW_L)
29312917
call get_mixture_molecular_weight(Ys_R, MW_R)
29322918

2933-
#:if USING_AMD
2934-
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights_nonparameter(:)
2935-
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights_nonparameter(:)
2936-
#:else
2937-
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
2938-
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)
2939-
#:endif
2919+
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
2920+
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)
29402921

29412922
R_gas_L = gas_constant/MW_L
29422923
R_gas_R = gas_constant/MW_R

0 commit comments

Comments
 (0)