Skip to content

Commit

Permalink
Merge pull request #188 from ggange/mppPython
Browse files Browse the repository at this point in the history
added multiple T setState + bug fixed Tv
  • Loading branch information
jbscoggi committed Feb 15, 2022
2 parents d06aca0 + 71fa076 commit 947dec3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
14 changes: 13 additions & 1 deletion interface/python/src/pyMixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,25 @@ void py_export_Mixture(py::module &m) {
"the mixture."
"The input variables depend on the type of StateModel being used.")

.def("setState",
[](Mutation::Mixture &self,
std::vector<double> rho_i,
std::vector<double> T,
const int vars)
{
self.setState(rho_i.data(),T.data(),vars);
},
"Sets the state of the mixture using the StateModel belonging to "
"the mixture."
"The input variables depend on the type of StateModel being used.")

.def("T", &Mutation::Mixture::T,
"Returns the mixture translational temperature.")

.def("Tr", &Mutation::Mixture::Tr,
"Returns the mixture rotational temperature.")

.def("Tv", &Mutation::Mixture::Tr,
.def("Tv", &Mutation::Mixture::Tv,
"Returns the mixture vibrational temperature.")

.def("Te", &Mutation::Mixture::Te,
Expand Down
17 changes: 17 additions & 0 deletions tests/python/test_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
import mutationpp as mpp
import pytest

#Equilibrium Mixture
mixture = mpp.Mixture("air_11")
mixture.equilibrate(300., 1000.)

# MultiTemperature Mixture
myMixtureOptions = mpp.MixtureOptions("air_5")
myMixtureOptions.setStateModel("ChemNonEqTTv")
mixtureNonEq = mpp.Mixture(myMixtureOptions)
rhoi = [1.0]*5
T = [10000., 300.]
mixtureNonEq.setState(rhoi, T, 1)

# def test_averageDiffusionCoeffs():
# Todo: write proper test
Expand Down Expand Up @@ -239,7 +247,16 @@ def test_soretThermalConductivity():

def test_T():
assert mixture.T() == 300.
assert mixtureNonEq.T() == 10000.

def test_Tr():
assert mixtureNonEq.Tr() == 10000.

def test_Tv():
assert mixtureNonEq.Tv() == 300.

def test_Te():
assert mixtureNonEq.Te() == 300.

# def test_thermalDiffusionRatios():
# Todo: write proper test
Expand Down

0 comments on commit 947dec3

Please sign in to comment.