Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/igr/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
json.dumps(
{
# Logistics
"run_time_info": "T",
"run_time_info": "F",
# Computational Domain Parameters
"x_domain%beg": -math.pi * L,
"x_domain%end": math.pi * L,
Expand Down
2 changes: 1 addition & 1 deletion src/common/m_checker_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ contains
#:if not MFC_CASE_OPTIMIZATION
@:PROHIBIT(num_fluids > 3, "num_fluids <= 3 for AMDFLang when Case optimization is off")
@:PROHIBIT((bubbles_euler .or. bubbles_lagrange) .and. nb > 3, "nb <= 3 for AMDFLang when Case optimization is off")
@:PROHIBIT(chemistry .and. num_species /= 10, "num_species = 10 for AMDFLang when Case optimization is off")
@:PROHIBIT(chemistry .and. num_species > 10, "num_species > 10 for AMDFLang when Case optimization is off")
#:endif

end subroutine s_check_amd
Expand Down
40 changes: 8 additions & 32 deletions src/common/m_chemistry.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ module m_chemistry

implicit none

#:if USING_AMD
real(wp) :: molecular_weights_nonparameter(10) = (/2.016, 1.008, 15.999, 31.998, 17.007, 18.015, 33.006, 34.014, 39.95, &
& 28.014/)
$:GPU_DECLARE(create='[molecular_weights_nonparameter]')
#:endif

type(int_bounds_info) :: isc1, isc2, isc3
$:GPU_DECLARE(create='[isc1, isc2, isc3]')
integer, dimension(3) :: offsets
Expand Down Expand Up @@ -144,12 +138,7 @@ contains

$:GPU_LOOP(parallelism='[seq]')
do eqn = eqn_idx%species%beg, eqn_idx%species%end
#:if USING_AMD
omega_m = molecular_weights_nonparameter(eqn - eqn_idx%species%beg + 1)*omega(eqn &
& - eqn_idx%species%beg + 1)
#:else
omega_m = molecular_weights(eqn - eqn_idx%species%beg + 1)*omega(eqn - eqn_idx%species%beg + 1)
#:endif
omega_m = molecular_weights(eqn - eqn_idx%species%beg + 1)*omega(eqn - eqn_idx%species%beg + 1)
rhs_vf(eqn)%sf(x, y, z) = rhs_vf(eqn)%sf(x, y, z) + omega_m
end do
end do
Expand Down Expand Up @@ -260,17 +249,10 @@ contains
! Calculate species properties and gradients
$:GPU_LOOP(parallelism='[seq]')
do i = eqn_idx%species%beg, eqn_idx%species%end
#:if USING_AMD
h_l(i - eqn_idx%species%beg + 1) = h_l(i - eqn_idx%species%beg + 1) &
& *gas_constant*T_L/molecular_weights_nonparameter(i - eqn_idx%species%beg + 1)
h_r(i - eqn_idx%species%beg + 1) = h_r(i - eqn_idx%species%beg + 1) &
& *gas_constant*T_R/molecular_weights_nonparameter(i - eqn_idx%species%beg + 1)
#:else
h_l(i - eqn_idx%species%beg + 1) = h_l(i - eqn_idx%species%beg + 1) &
& *gas_constant*T_L/molecular_weights(i - eqn_idx%species%beg + 1)
h_r(i - eqn_idx%species%beg + 1) = h_r(i - eqn_idx%species%beg + 1) &
& *gas_constant*T_R/molecular_weights(i - eqn_idx%species%beg + 1)
#:endif
h_l(i - eqn_idx%species%beg + 1) = h_l(i - eqn_idx%species%beg + 1) &
& *gas_constant*T_L/molecular_weights(i - eqn_idx%species%beg + 1)
h_r(i - eqn_idx%species%beg + 1) = h_r(i - eqn_idx%species%beg + 1) &
& *gas_constant*T_R/molecular_weights(i - eqn_idx%species%beg + 1)
Xs_cell(i - eqn_idx%species%beg + 1) = 0.5_wp*(Xs_L(i - eqn_idx%species%beg + 1) + Xs_R(i &
& - eqn_idx%species%beg + 1))
h_k(i - eqn_idx%species%beg + 1) = 0.5_wp*(h_l(i - eqn_idx%species%beg + 1) + h_r(i &
Expand All @@ -295,15 +277,9 @@ contains

$:GPU_LOOP(parallelism='[seq]')
do eqn = eqn_idx%species%beg, eqn_idx%species%end
#:if USING_AMD
Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn &
& - eqn_idx%species%beg + 1)*molecular_weights_nonparameter(eqn &
& - eqn_idx%species%beg + 1)/MW_cell*dXk_dxi(eqn - eqn_idx%species%beg + 1)
#:else
Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn &
& - eqn_idx%species%beg + 1)*molecular_weights(eqn - eqn_idx%species%beg + 1) &
& /MW_cell*dXk_dxi(eqn - eqn_idx%species%beg + 1)
#:endif
Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn &
& - eqn_idx%species%beg + 1)*molecular_weights(eqn - eqn_idx%species%beg + 1) &
& /MW_cell*dXk_dxi(eqn - eqn_idx%species%beg + 1)
rho_Vic = rho_Vic + Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1)
Mass_Diffu_Energy = Mass_Diffu_Energy + h_k(eqn - eqn_idx%species%beg + 1)*Mass_Diffu_Flux(eqn &
& - eqn_idx%species%beg + 1)
Expand Down
55 changes: 16 additions & 39 deletions src/simulation/include/inline_riemann.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,51 +33,28 @@
eps = 0.001_wp
call get_species_enthalpies_rt(T_L, h_iL)
call get_species_enthalpies_rt(T_R, h_iR)
#:if USING_AMD
h_iL = h_iL*gas_constant/molecular_weights_nonparameter*T_L
h_iR = h_iR*gas_constant/molecular_weights_nonparameter*T_R
#:else
h_iL = h_iL*gas_constant/molecular_weights*T_L
h_iR = h_iR*gas_constant/molecular_weights*T_R
#:endif
h_iL = h_iL*gas_constant/molecular_weights*T_L
h_iR = h_iR*gas_constant/molecular_weights*T_R
call get_species_specific_heats_r(T_L, Cp_iL)
call get_species_specific_heats_r(T_R, Cp_iR)

h_avg_2 = (sqrt(rho_L)*h_iL + sqrt(rho_R)*h_iR)/(sqrt(rho_L) + sqrt(rho_R))
Yi_avg = (sqrt(rho_L)*Ys_L + sqrt(rho_R)*Ys_R)/(sqrt(rho_L) + sqrt(rho_R))
T_avg = (sqrt(rho_L)*T_L + sqrt(rho_R)*T_R)/(sqrt(rho_L) + sqrt(rho_R))
#:if USING_AMD
if (abs(T_L - T_R) < eps) then
! Case when T_L and T_R are very close
Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights_nonparameter(:))
Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights_nonparameter(:) &
& - gas_constant/molecular_weights_nonparameter(:)))
else
! Normal calculation when T_L and T_R are sufficiently different
Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T_R - T_L))
Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T_R - T_L) - gas_constant/molecular_weights_nonparameter(:)))
end if
gamma_avg = Cp_avg/Cv_avg

Phi_avg(:) = (gamma_avg - 1._wp)*(vel_avg_rms/2.0_wp - h_avg_2(:)) &
& + gamma_avg*gas_constant/molecular_weights_nonparameter(:)*T_avg
c_sum_Yi_Phi = sum(Yi_avg(:)*Phi_avg(:))
#:else
if (abs(T_L - T_R) < eps) then
! Case when T_L and T_R are very close
Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:))
Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:) &
& - gas_constant/molecular_weights(:)))
else
! Normal calculation when T_L and T_R are sufficiently different
Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T_R - T_L))
Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T_R - T_L) - gas_constant/molecular_weights(:)))
end if
gamma_avg = Cp_avg/Cv_avg

Phi_avg(:) = (gamma_avg - 1._wp)*(vel_avg_rms/2.0_wp - h_avg_2(:)) + gamma_avg*gas_constant/molecular_weights(:)*T_avg
c_sum_Yi_Phi = sum(Yi_avg(:)*Phi_avg(:))
#:endif
if (abs(T_L - T_R) < eps) then
! Case when T_L and T_R are very close
Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:))
Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:) &
& - gas_constant/molecular_weights(:)))
else
! Normal calculation when T_L and T_R are sufficiently different
Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T_R - T_L))
Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T_R - T_L) - gas_constant/molecular_weights(:)))
end if
gamma_avg = Cp_avg/Cv_avg

Phi_avg(:) = (gamma_avg - 1._wp)*(vel_avg_rms/2.0_wp - h_avg_2(:)) + gamma_avg*gas_constant/molecular_weights(:)*T_avg
c_sum_Yi_Phi = sum(Yi_avg(:)*Phi_avg(:))
end if
#:enddef roe_avg

Expand Down
14 changes: 2 additions & 12 deletions src/simulation/m_cbc.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ module m_cbc
& gas_constant, get_mixture_molecular_weight, get_species_enthalpies_rt, molecular_weights, get_species_specific_heats_r, &
& get_mole_fractions, get_species_specific_heats_r

#:if USING_AMD
use m_chemistry, only: molecular_weights_nonparameter
#:endif

implicit none

private; public :: s_initialize_cbc_module, s_cbc, s_finalize_cbc_module
Expand Down Expand Up @@ -871,14 +867,8 @@ contains
sum_Enthalpies = 0._wp
$:GPU_LOOP(parallelism='[seq]')
do i = 1, num_species
#:if USING_AMD
h_k(i) = h_k(i)*gas_constant/molecular_weights_nonparameter(i)*T
sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights_nonparameter(i) &
& *Cp/R_gas)*dYs_dt(i)
#:else
h_k(i) = h_k(i)*gas_constant/molecular_weights(i)*T
sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights(i)*Cp/R_gas)*dYs_dt(i)
#:endif
h_k(i) = h_k(i)*gas_constant/molecular_weights(i)*T
sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights(i)*Cp/R_gas)*dYs_dt(i)
end do
flux_rs${XYZ}$_vf_l(-1, k, r, eqn_idx%E) = flux_rs${XYZ}$_vf_l(0, k, r, &
& eqn_idx%E) + ds(0)*((E/rho + pres/rho)*drho_dt + rho*vel_dv_dt_sum + Cp*T*L(2) &
Expand Down
31 changes: 6 additions & 25 deletions src/simulation/m_riemann_solvers.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ module m_riemann_solvers
use m_thermochem, only: gas_constant, get_mixture_molecular_weight, get_mixture_specific_heat_cv_mass, &
& get_mixture_energy_mass, get_species_specific_heats_r, get_species_enthalpies_rt, get_mixture_specific_heat_cp_mass

#:if USING_AMD
use m_chemistry, only: molecular_weights_nonparameter
#:endif

implicit none

private; public :: s_initialize_riemann_solvers_module, s_riemann_solver, s_hll_riemann_solver, s_hllc_riemann_solver, &
Expand Down Expand Up @@ -339,13 +335,8 @@ contains

call get_mixture_molecular_weight(Ys_L, MW_L)
call get_mixture_molecular_weight(Ys_R, MW_R)
#:if USING_AMD
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights_nonparameter(:)
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights_nonparameter(:)
#:else
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)
#:endif
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)

R_gas_L = gas_constant/MW_L
R_gas_R = gas_constant/MW_R
Expand Down Expand Up @@ -1029,13 +1020,8 @@ contains
call get_mixture_molecular_weight(Ys_L, MW_L)
call get_mixture_molecular_weight(Ys_R, MW_R)

#:if USING_AMD
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights_nonparameter(:)
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights_nonparameter(:)
#:else
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)
#:endif
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)

R_gas_L = gas_constant/MW_L
R_gas_R = gas_constant/MW_R
Expand Down Expand Up @@ -2930,13 +2916,8 @@ contains
call get_mixture_molecular_weight(Ys_L, MW_L)
call get_mixture_molecular_weight(Ys_R, MW_R)

#:if USING_AMD
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights_nonparameter(:)
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights_nonparameter(:)
#:else
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)
#:endif
Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:)
Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:)

R_gas_L = gas_constant/MW_L
R_gas_R = gas_constant/MW_R
Expand Down
8 changes: 0 additions & 8 deletions src/simulation/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,14 +1094,6 @@ contains
#:if not MFC_CASE_OPTIMIZATION
$:GPU_UPDATE(device='[igr, nb, igr_order]')
#:endif
#:if USING_AMD
block
use m_thermochem, only: molecular_weights
use m_chemistry, only: molecular_weights_nonparameter
molecular_weights_nonparameter(:) = molecular_weights(:)
$:GPU_UPDATE(device='[molecular_weights_nonparameter]')
end block
#:endif

end subroutine s_initialize_gpu_vars

Expand Down
Loading