diff --git a/CMakeLists.txt b/CMakeLists.txt index e31bf08..e776e65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION "3.14") -project(EQUILIBRATE LANGUAGES Fortran C VERSION "0.1.3") +project(EQUILIBRATE LANGUAGES Fortran C VERSION "0.1.4") set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/modules") include(cmake/CPM.cmake) diff --git a/equilibrate/cython/ChemEquiAnalysis_pxd.pxd b/equilibrate/cython/ChemEquiAnalysis_pxd.pxd index f443aa9..ee9053a 100644 --- a/equilibrate/cython/ChemEquiAnalysis_pxd.pxd +++ b/equilibrate/cython/ChemEquiAnalysis_pxd.pxd @@ -63,6 +63,8 @@ cdef extern void chemequianalysis_molfracs_atoms_condensate_get(ChemEquiAnalysis cdef extern void chemequianalysis_molfracs_species_condensate_get_size(ChemEquiAnalysis *ptr, int *dim1) cdef extern void chemequianalysis_molfracs_species_condensate_get(ChemEquiAnalysis *ptr, int *dim1, double *arr) +cdef extern void chemequianalysis_mubar_get(ChemEquiAnalysis *ptr, double *val) + cdef extern void chemequianalysis_verbose_get(ChemEquiAnalysis *ptr, cbool *val) cdef extern void chemequianalysis_verbose_set(ChemEquiAnalysis *ptr, cbool *val) diff --git a/equilibrate/cython/_equilibrate.pyx b/equilibrate/cython/_equilibrate.pyx index 72e1b79..4a0259d 100644 --- a/equilibrate/cython/_equilibrate.pyx +++ b/equilibrate/cython/_equilibrate.pyx @@ -292,6 +292,13 @@ cdef class ChemEquiAnalysis: cea_pxd.chemequianalysis_molfracs_species_condensate_get(self._ptr, &dim1, arr.data) return arr + property mubar: + "float. Mean molecular weight (g/mol)." + def __get__(self): + cdef double val + cea_pxd.chemequianalysis_mubar_get(self._ptr, &val) + return val + property verbose: "bool. Determines amount of printing." def __get__(self): diff --git a/equilibrate/fortran/equilibrate_c_api.f90 b/equilibrate/fortran/equilibrate_c_api.f90 index 30008aa..19333f6 100644 --- a/equilibrate/fortran/equilibrate_c_api.f90 +++ b/equilibrate/fortran/equilibrate_c_api.f90 @@ -441,6 +441,15 @@ subroutine chemequianalysis_molfracs_species_condensate_get(ptr, dim1, arr) bind arr = cea%molfracs_species_condensate end subroutine + subroutine chemequianalysis_mubar_get(ptr, val) bind(c) + use equilibrate, only: ChemEquiAnalysis + type(c_ptr), value, intent(in) :: ptr + real(c_double), intent(out) :: val + type(ChemEquiAnalysis), pointer :: cea + call c_f_pointer(ptr, cea) + val = cea%mubar + end subroutine + subroutine chemequianalysis_verbose_get(ptr, val) bind(c) use equilibrate, only: ChemEquiAnalysis type(c_ptr), value, intent(in) :: ptr diff --git a/src/equilibrate.f90 b/src/equilibrate.f90 index fe9bc54..18a2849 100644 --- a/src/equilibrate.f90 +++ b/src/equilibrate.f90 @@ -33,7 +33,9 @@ module equilibrate !! phase (size(condensate_names)) ! A few undocumented outputs. - real(dp) :: nabla_ad, gamma2, MMW, rho, c_pe + real(dp) :: nabla_ad, gamma2, rho, c_pe + + real(dp) :: mubar !! Mean molecular weight logical :: verbose = .false. !! Determines amount of printing. real(dp) :: mass_tol = 1.0e-2_dp !! Degree to which mass will be balanced. @@ -245,7 +247,7 @@ function solve(self, P, T, molfracs_atoms, molfracs_species, err) result(converg molfracs_reactants=self%molfracs_species, & massfracs_reactants=self%massfracs_species, & temp=T, press=P_bars, & - nabla_ad=self%nabla_ad, gamma2=self%gamma2, MMW=self%MMW, rho=self%rho, c_pe=self%c_pe) + nabla_ad=self%nabla_ad, gamma2=self%gamma2, MMW=self%mubar, rho=self%rho, c_pe=self%c_pe) if (self%dat%error) then err = trim(self%dat%err_msg) return