Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added multiple T setState + bug fixed Tv #188

Merged
merged 2 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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