@@ -31,11 +31,11 @@ module m_cbc
3131 use m_compute_cbc
3232
3333 use m_thermochem, only: &
34- get_mixture_energy_mass,get_mixture_specific_heat_cv_mass, &
35- get_mixture_specific_heat_cp_mass,gas_constant, &
36- get_mixture_molecular_weight,get_species_enthalpies_rt, &
37- molecular_weights, get_species_specific_heats_r, &
38- get_mole_fractions,get_species_specific_heats_r
34+ get_mixture_energy_mass, get_mixture_specific_heat_cv_mass, &
35+ get_mixture_specific_heat_cp_mass, gas_constant, &
36+ get_mixture_molecular_weight, get_species_enthalpies_rt, &
37+ molecular_weights, get_species_specific_heats_r, &
38+ get_mole_fractions, get_species_specific_heats_r
3939
4040 implicit none
4141
@@ -134,7 +134,7 @@ contains
134134
135135 if (chemistry) then
136136 flux_cbc_index = sys_size
137- else
137+ else
138138 flux_cbc_index = adv_idx%end
139139 end if
140140 !$acc update device(flux_cbc_index)
@@ -670,7 +670,6 @@ contains
670670 real(wp) :: Cv, Cp, e_mix, Mw, R_gas
671671 real(wp), dimension(num_species) :: Ys, h_k, dYs_dt, dYs_ds, Xs, Gamma_i, Cp_i
672672
673-
674673 real(wp) :: vel_K_sum, vel_dv_dt_sum
675674
676675 integer :: i, j, k, r, q !< Generic loop iterators
@@ -818,7 +817,7 @@ contains
818817 if (chemistry) then
819818 !$acc loop seq
820819 do i = chemxb, chemxe
821- Ys(i - chemxb + 1) = q_prim_rs${XYZ}$_vf(0, k, r, i)
820+ Ys(i - chemxb + 1) = q_prim_rs${XYZ}$_vf(0, k, r, i)
822821 end do
823822
824823 call get_mixture_molecular_weight(Ys, Mw)
@@ -836,7 +835,6 @@ contains
836835 else if (chem_params%gamma_method == 2) then
837836 !> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats.
838837 call get_mixture_specific_heat_cv_mass(T, Ys, Cv)
839- call get_mixture_specific_heat_cp_mass(T, Ys, Cp)
840838 gamma = 1.0_wp/(Cp/Cv - 1.0_wp)
841839 end if
842840 else
@@ -866,10 +864,12 @@ contains
866864 dadv_ds(i) = 0._wp
867865 end do
868866
869- !$acc loop seq
870- do i=1, num_species
871- dYs_ds(i) = 0._wp
872- end do
867+ if (chemistry) then
868+ !$acc loop seq
869+ do i = 1, num_species
870+ dYs_ds(i) = 0._wp
871+ end do
872+ end if
873873
874874 !$acc loop seq
875875 do j = 0, buff_size
@@ -899,12 +899,12 @@ contains
899899
900900 if (chemistry) then
901901 !$acc loop seq
902- do i= 1, num_species
902+ do i = 1, num_species
903903 dYs_ds(i) = q_prim_rs${XYZ}$_vf(j, k, r, chemxb - 1 + i)* &
904- fd_coef_${XYZ}$ (j, cbc_loc) + &
905- dYs_ds(i)
904+ fd_coef_${XYZ}$ (j, cbc_loc) + &
905+ dYs_ds(i)
906906 end do
907- end if
907+ end if
908908 end do
909909
910910 ! First-Order Temporal Derivatives of Primitive Variables
@@ -919,7 +919,7 @@ contains
919919 call s_compute_slip_wall_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
920920 else if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_NR_SUB_BUFFER) .or. &
921921 (cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_NR_SUB_BUFFER)) then
922- call s_compute_nonreflecting_subsonic_buffer_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
922+ call s_compute_nonreflecting_subsonic_buffer_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds, dYs_ds )
923923 else if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_NR_SUB_INFLOW) .or. &
924924 (cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_NR_SUB_INFLOW)) then
925925 call s_compute_nonreflecting_subsonic_inflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
@@ -1051,19 +1051,19 @@ contains
10511051 sum_Enthalpies = 0._wp
10521052 !$acc loop seq
10531053 do i = 1, num_species
1054- h_k(i) = h_k(i)*gas_constant/molecular_weights(i)*T
1055- sum_Enthalpies = sum_Enthalpies+ (rho*h_k(i) - pres*Mw/molecular_weights(i)*Cp/R_gas)*dYs_dt(i)
1054+ h_k(i) = h_k(i)*gas_constant/molecular_weights(i)*T
1055+ sum_Enthalpies = sum_Enthalpies + (rho*h_k(i) - pres*Mw/molecular_weights(i)*Cp/R_gas)*dYs_dt(i)
10561056 end do
10571057 flux_rs${XYZ}$_vf_l(-1, k, r, E_idx) = flux_rs${XYZ}$_vf_l(0, k, r, E_idx) &
1058- + ds(0)*((E/rho + pres/rho)*drho_dt + rho*vel_dv_dt_sum + Cp*T*L(2)/(c*c) + sum_Enthalpies)
1058+ + ds(0)*((E/rho + pres/rho)*drho_dt + rho*vel_dv_dt_sum + Cp*T*L(2)/(c*c) + sum_Enthalpies)
10591059 !$acc loop seq
1060- do i=1, num_species
1061- flux_rs${XYZ}$_vf_l(-1, k, r, i - 1 + chemxb) = flux_rs${XYZ}$_vf_l(0, k, r, chemxb + i - 1) &
1062- + ds(0)*(drho_dt*Ys(i) + rho*dYs_dt(i))
1060+ do i = 1, num_species
1061+ flux_rs${XYZ}$_vf_l(-1, k, r, i - 1 + chemxb) = flux_rs${XYZ}$_vf_l(0, k, r, chemxb + i - 1) &
1062+ + ds(0)*(drho_dt*Ys(i) + rho*dYs_dt(i))
10631063 end do
10641064 else
10651065 flux_rs${XYZ}$_vf_l(-1, k, r, E_idx) = flux_rs${XYZ}$_vf_l(0, k, r, E_idx) &
1066- + ds(0)*(pres*dgamma_dt &
1066+ + ds(0)*(pres*dgamma_dt &
10671067 + gamma*dpres_dt &
10681068 + dpi_inf_dt &
10691069 + dqv_dt &
0 commit comments