diff --git a/samples/f90/demo.f90 b/samples/f90/demo.f90 index 3da759a3754..4857f6a8f5e 100644 --- a/samples/f90/demo.f90 +++ b/samples/f90/demo.f90 @@ -32,6 +32,8 @@ program main ! 'h2o2.yaml', located in the Cantera data directory gas = importPhase('h2o2.yaml','ohmech') + gas2 = newSolution('h2o2.yaml','ohmech') + t = 1200.0 ! K p = 101325.0 ! Pa diff --git a/src/fortran/cantera.f90 b/src/fortran/cantera.f90 index dbf066422f5..5cfb59c2872 100644 --- a/src/fortran/cantera.f90 +++ b/src/fortran/cantera.f90 @@ -197,6 +197,10 @@ MODULE CANTERA MODULE PROCEDURE ctthermo_gibbs_mole END INTERFACE gibbs_mole + INTERFACE newSolution + MODULE PROCEDURE ctfunc_newSolution + END INTERFACE newSolution + INTERFACE importPhase MODULE PROCEDURE ctfunc_importPhase END INTERFACE importPhase diff --git a/src/fortran/cantera_funcs.f90 b/src/fortran/cantera_funcs.f90 index 5b0d1b897e7..1174b6dee74 100644 --- a/src/fortran/cantera_funcs.f90 +++ b/src/fortran/cantera_funcs.f90 @@ -9,6 +9,26 @@ module cantera_funcs contains + type(phase_t) function ctfunc_newSolution(filename, phn, trn) + implicit none + character*(*), intent(in) :: filename + character*(*), intent(in), optional :: phn + character*(*), intent(in), optional :: trn + type(phase_t) :: self + if (present(trn)) then + self%soln_id = soln_newsolution(filename, phn, trn) + else if (present(phn)) then + self%soln_id = soln_newsolution(filename, phn, 'default') + else + self%soln_id = soln_newsolution(filename, '', 'default') + end if + self%thermo_id = soln_thermo(self%soln_id) + self%kin_id = soln_kinetics(self%soln_id) + self%tran_id = soln_transport(self%soln_id) + self%err = 0 + ctfunc_newSolution = self + end function ctfunc_newSolution + type(phase_t) function ctfunc_importPhase(src, id, loglevel) implicit none character*(*), intent(in) :: src diff --git a/src/fortran/cantera_thermo.f90 b/src/fortran/cantera_thermo.f90 index 53f4d61c577..80d8fd76766 100644 --- a/src/fortran/cantera_thermo.f90 +++ b/src/fortran/cantera_thermo.f90 @@ -6,6 +6,7 @@ module cantera_thermo use fct type phase_t + integer :: soln_id integer :: thermo_id integer :: kin_id integer :: tran_id @@ -56,6 +57,7 @@ type(phase_t) function ctthermo_newFromFile(filename, id) self%err = 0 self%kin_id = -1 self%tran_id = -1 + self%soln_id = -1 ctthermo_newFromFile = self end function ctthermo_newFromFile