Clarify nomenclature for Solution::setTransportModel

This commit is contained in:
Ingmar Schoegl
2022-07-30 10:48:11 -05:00
committed by Bryan Weber
parent 905709ce42
commit 9af42f701e
7 changed files with 16 additions and 11 deletions

View File

@@ -49,7 +49,8 @@ public:
//! Set the Transport object by name
//! @param model name of transport model
virtual void setTransport(const std::string& model);
//! @since New in Cantera 3.0
void setTransportModel(const std::string& model);
//! Accessor for the ThermoPhase pointer
shared_ptr<ThermoPhase> thermo() {

View File

@@ -46,7 +46,7 @@ cdef extern from "cantera/base/Solution.h" namespace "Cantera":
void setKinetics(shared_ptr[CxxKinetics])
shared_ptr[CxxTransport] transport()
void setTransport(shared_ptr[CxxTransport])
void setTransport(const string&) except +translate_exception
void setTransportModel(const string&) except +translate_exception
CxxAnyMap parameters(cbool) except +translate_exception
size_t nAdjacent()
shared_ptr[CxxSolution] adjacent(size_t)

View File

@@ -48,7 +48,7 @@ cdef class _SolutionBase:
cxx_soln.get().setSource(stringify("none"))
cxx_soln.get().setThermo(newThermo(stringify("none")))
cxx_soln.get().setKinetics(newKinetics(stringify("none")))
cxx_soln.get().setTransport(stringify("none"))
cxx_soln.get().setTransportModel(stringify("none"))
_assign_Solution(self, cxx_soln, True)
self._selected_species = np.ndarray(0, dtype=np.uint64)
@@ -206,7 +206,7 @@ cdef class _SolutionBase:
# Transport
if not isinstance(self, Transport):
soln.get().setTransport(stringify("none"))
soln.get().setTransportModel(stringify("none"))
_assign_Solution(self, soln, reset_adjacent)
@@ -244,7 +244,7 @@ cdef class _SolutionBase:
self.kinetics.resizeReactions()
if isinstance(self, Transport):
self.base.setTransport(stringify(transport))
self.base.setTransportModel(stringify(transport))
self.transport = self.base.transport().get()
property input_data:

View File

@@ -96,7 +96,7 @@ void demoprog()
// create a transport manager for the gas that computes
// mixture-averaged properties
sol->setTransport("mixture-averaged");
sol->setTransportModel("mixture-averaged");
auto tr = sol->transport();
// print the viscosity, thermal conductivity, and diffusion

View File

@@ -84,7 +84,7 @@ void transport_example()
write_csv("transport_mix.csv", labels, output);
// Switch transport manager to multicomponent properties
sol->setTransport("multicomponent");
sol->setTransportModel("multicomponent");
// Get multicomponent properties at several temperatures
for (int i = 0; i < ntemps; i++) {

View File

@@ -51,7 +51,11 @@ void Solution::setTransport(shared_ptr<Transport> transport) {
m_transport = transport;
}
void Solution::setTransport(const std::string& model) {
void Solution::setTransportModel(const std::string& model) {
if (!m_thermo) {
throw CanteraError("Solution::setTransportModel",
"Unable to set Transport model without valid ThermoPhase object.");
}
if (model == "") {
setTransport(shared_ptr<Transport>(
newDefaultTransportMgr(m_thermo.get())));
@@ -268,7 +272,7 @@ shared_ptr<Solution> newSolution(const AnyMap& phaseNode,
sol->setKinetics(newKinetics(phases, phaseNode, rootNode));
// set transport model by name
sol->setTransport(transport);
sol->setTransportModel(transport);
// save root-level information (YAML header)
AnyMap header;

View File

@@ -180,11 +180,11 @@ void StFlow::resetBadValues(double* xg)
void StFlow::setTransportModel(const std::string& trans)
{
if (!m_sol) {
throw CanteraError("StFlow::setTransport",
throw CanteraError("StFlow::setTransportModel",
"Unable to set Transport manager by name as object was not initialized\n"
"from a Solution manager: set Transport object directly instead.");
}
m_sol->setTransport(trans);
m_sol->setTransportModel(trans);
m_trans_shared = m_sol->transport();
m_trans = m_trans_shared.get();
setTransport(*m_trans);