Skip to content

Commit

Permalink
update tchem_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jcurtis2 committed May 15, 2024
1 parent c25674a commit 15e8fb4
Showing 1 changed file with 46 additions and 5 deletions.
51 changes: 46 additions & 5 deletions src/tchem_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,45 @@ end subroutine pmc_tchem_interface_solve

subroutine tchem_initialize(config_filename, gas_data, gas_state, aero_data)

use iso_c_binding

character(len=*), intent(in) :: config_filename
type(gas_data_t), intent(inout) :: gas_data
type(gas_state_t), intent(inout) :: gas_state
type(aero_data_t), intent(inout) :: aero_data
integer(c_int) :: nSpec
integer :: i, j

integer :: nSpec

nSpec = 0
character(len=5) :: name
character(kind=c_char), dimension(5) :: name_data
real(kind=c_double), dimension(:), allocatable :: array

! initialize the model
call initialize(trim(config_filename))

print*, 'in partmc', nSpec, trim(config_filename)

! feedback to PartMC
! what we need:
! - number of gas species
! - name of gas species to set gas_data
! - set the size of gas_state
nSpec = TChem_getNumberOfSpecies()
call ensure_string_array_size(gas_data%name, nSpec)

call gas_state_set_size(gas_state, nSpec)

! name of gas species
!do i = 1,nSpec
! gas_data%name(i) = "H2O"
!end do

print*, 'in partmc', nSpec, trim(config_filename), gas_data_n_spec(gas_data)

allocate(array(nSpec))
array = 0.0d0
call TChem_getStateVector(array)
print*, 'in partmc'
print*, array
gas_state%mix_rat = array
end subroutine

subroutine tchem_cleanup()
Expand All @@ -60,5 +86,20 @@ subroutine tchem_cleanup()

end subroutine

subroutine tchem_to_partmc()

! Get gas array

end subroutine

subroutine tchem_from_partmc(gas_state, gas_data)

type(gas_data_t), intent(in) :: gas_data
! FIXME: Fix intent later
type(gas_state_t), intent(inout) :: gas_state

gas_state%mix_rat = 0.0d0
end subroutine

#endif
end module pmc_tchem_interface

0 comments on commit 15e8fb4

Please sign in to comment.