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
29 changes: 28 additions & 1 deletion src/common/m_chemistry.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
module m_chemistry

use m_thermochem, only: &
num_species, molecular_weights, get_temperature, get_net_production_rates
num_species, molecular_weights, get_temperature, get_net_production_rates, &
gas_constant, get_mixture_molecular_weight

use m_global_parameters

Expand Down Expand Up @@ -58,6 +59,32 @@

end subroutine s_compute_q_T_sf

subroutine s_compute_T_from_primitives(q_T_sf, q_prim_vf, bounds)

type(scalar_field), intent(inout) :: q_T_sf
type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf
type(int_bounds_info), dimension(1:3), intent(in) :: bounds

integer :: x, y, z, i
real(wp), dimension(num_species) :: Ys
real(wp) :: mix_mol_weight

do z = bounds(3)%beg, bounds(3)%end
do y = bounds(2)%beg, bounds(2)%end
do x = bounds(1)%beg, bounds(1)%end
!$acc loop seq
do i = chemxb, chemxe
Ys(i - chemxb + 1) = q_prim_vf(i)%sf(x, y, z)

Check warning on line 77 in src/common/m_chemistry.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_chemistry.fpp#L77

Added line #L77 was not covered by tests
end do

call get_mixture_molecular_weight(Ys, mix_mol_weight)
q_T_sf%sf(x, y, z) = q_prim_vf(E_idx)%sf(x, y, z)*mix_mol_weight/(gas_constant*q_prim_vf(1)%sf(x, y, z))

Check warning on line 81 in src/common/m_chemistry.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_chemistry.fpp#L81

Added line #L81 was not covered by tests
end do
end do
end do

end subroutine s_compute_T_from_primitives

subroutine s_compute_chemistry_reaction_flux(rhs_vf, q_cons_qp, q_T_sf, q_prim_qp, bounds)

type(scalar_field), dimension(sys_size), intent(inout) :: rhs_vf
Expand Down
5 changes: 1 addition & 4 deletions src/pre_process/m_initial_condition.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ contains
!! primitive variables are converted to conservative ones.
subroutine s_generate_initial_condition

! First, compute the temperature field from the conservative variables.
if (chemistry) call s_compute_q_T_sf(q_T_sf, q_cons_vf, idwint)

! Converting the conservative variables to the primitive ones given
! preexisting initial condition data files were read in on start-up
if (old_ic) then
Expand All @@ -198,7 +195,7 @@ contains
! Converting the primitive variables to the conservative ones
call s_convert_primitive_to_conservative_variables(q_prim_vf, q_cons_vf)

if (chemistry) call s_compute_q_T_sf(q_T_sf, q_cons_vf, idwint)
if (chemistry) call s_compute_T_from_primitives(q_T_sf, q_prim_vf, idwint)

if (qbmm .and. .not. polytropic) then
!Initialize pb and mv
Expand Down
Loading