-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
q_T_sf: Chemistry Temperature Optimization
- Loading branch information
1 parent
f624480
commit d550592
Showing
36 changed files
with
1,294 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
!!> | ||
!! @file m_chemistry.f90 | ||
!! @brief Contains module m_chemistry | ||
!! @author Henry Le Berre <hberre3@gatech.edu> | ||
|
||
#:include 'macros.fpp' | ||
#:include 'case.fpp' | ||
|
||
module m_chemistry | ||
|
||
use m_thermochem, only: & | ||
num_species, mol_weights, get_temperature, get_net_production_rates | ||
|
||
use m_global_parameters | ||
|
||
implicit none | ||
|
||
contains | ||
|
||
subroutine s_compute_q_T_sf(q_T_sf, q_cons_vf, bounds) | ||
|
||
! Initialize the temperature field at the start of the simulation to | ||
! reasonable values. Temperature is computed the regular way using the | ||
! conservative variables. | ||
|
||
type(scalar_field), intent(inout) :: q_T_sf | ||
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf | ||
type(int_bounds_info), dimension(1:3), intent(in) :: bounds | ||
|
||
integer :: x, y, z, eqn | ||
real(wp) :: energy, mean_molecular_weight | ||
real(wp), dimension(num_species) :: Ys | ||
|
||
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 eqn = chemxb, chemxe | ||
Ys(eqn - chemxb + 1) = & | ||
q_cons_vf(eqn)%sf(x, y, z)/q_cons_vf(contxb)%sf(x, y, z) | ||
end do | ||
|
||
! e = E - 1/2*|u|^2 | ||
! cons. E_idx = \rho E | ||
! cons. contxb = \rho (1-fluid model) | ||
! cons. momxb + i = \rho u_i | ||
energy = q_cons_vf(E_idx)%sf(x, y, z)/q_cons_vf(contxb)%sf(x, y, z) | ||
!$acc loop seq | ||
do eqn = momxb, momxe | ||
energy = energy - & | ||
0.5_wp*(q_cons_vf(eqn)%sf(x, y, z)/q_cons_vf(contxb)%sf(x, y, z))**2._wp | ||
end do | ||
|
||
call get_temperature(energy, dflt_T_guess, Ys, .true., q_T_sf%sf(x, y, z)) | ||
end do | ||
end do | ||
end do | ||
|
||
end subroutine s_compute_q_T_sf | ||
|
||
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 | ||
type(scalar_field), intent(inout) :: q_T_sf | ||
type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_qp, q_prim_qp | ||
type(int_bounds_info), dimension(1:3), intent(in) :: bounds | ||
|
||
integer :: x, y, z | ||
integer :: eqn | ||
real(wp) :: T | ||
real(wp) :: rho, omega_m | ||
real(wp), dimension(num_species) :: Ys | ||
real(wp), dimension(num_species) :: omega | ||
|
||
!$acc parallel loop collapse(3) gang vector default(present) & | ||
!$acc private(Ys, omega) | ||
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 eqn = chemxb, chemxe | ||
Ys(eqn - chemxb + 1) = q_prim_qp(eqn)%sf(x, y, z) | ||
end do | ||
|
||
rho = q_cons_qp(contxe)%sf(x, y, z) | ||
T = q_T_sf%sf(x, y, z) | ||
|
||
call get_net_production_rates(rho, T, Ys, omega) | ||
|
||
!$acc loop seq | ||
do eqn = chemxb, chemxe | ||
|
||
omega_m = mol_weights(eqn - chemxb + 1)*omega(eqn - chemxb + 1) | ||
|
||
rhs_vf(eqn)%sf(x, y, z) = rhs_vf(eqn)%sf(x, y, z) + omega_m | ||
|
||
end do | ||
|
||
end do | ||
end do | ||
end do | ||
|
||
end subroutine s_compute_chemistry_reaction_flux | ||
|
||
end module m_chemistry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.