[Transport] Make WaterTransport constructible using newTransportMgr
This makes it possible to specify the WaterTransport model in XML input files, and to use the model from Python and Matlab. Resolves #289
This commit is contained in:
parent
d9f9f69fc3
commit
b0deb41708
5 changed files with 12 additions and 8 deletions
|
|
@ -81,11 +81,9 @@ public:
|
|||
*/
|
||||
virtual doublereal thermalConductivity();
|
||||
|
||||
private:
|
||||
//! Routine to do some common initializations at the start of using
|
||||
//! this routine.
|
||||
void initTP();
|
||||
virtual void init(thermo_t* thermo, int mode=0, int log_level=0);
|
||||
|
||||
private:
|
||||
//! Pointer to the WaterPropsIAPWS object, which does the actual calculations
|
||||
//! for the real equation of state
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "cantera/transport/MixTransport.h"
|
||||
#include "cantera/transport/UnityLewisTransport.h"
|
||||
#include "cantera/transport/IonGasTransport.h"
|
||||
#include "cantera/transport/WaterTransport.h"
|
||||
#include "cantera/transport/SolidTransport.h"
|
||||
#include "cantera/transport/DustyGasTransport.h"
|
||||
#include "cantera/transport/SimpleTransport.h"
|
||||
|
|
@ -52,6 +53,7 @@ TransportFactory::TransportFactory()
|
|||
reg("Mix", []() { return new MixTransport(); });
|
||||
reg("Multi", []() { return new MultiTransport(); });
|
||||
reg("Ion", []() { return new IonGasTransport(); });
|
||||
reg("Water", []() { return new WaterTransport(); });
|
||||
m_synonyms["CK_Mix"] = "Mix";
|
||||
m_synonyms["CK_Multi"] = "Multi";
|
||||
reg("HighP", []() { return new HighPressureGasTransport(); });
|
||||
|
|
|
|||
|
|
@ -16,11 +16,14 @@ namespace Cantera
|
|||
WaterTransport::WaterTransport(thermo_t* thermo, int ndim) :
|
||||
Transport(thermo, ndim)
|
||||
{
|
||||
initTP();
|
||||
if (thermo) {
|
||||
init(thermo);
|
||||
}
|
||||
}
|
||||
|
||||
void WaterTransport::initTP()
|
||||
void WaterTransport::init(thermo_t* thermo, int mode, int log_level)
|
||||
{
|
||||
m_thermo = thermo;
|
||||
// The expectation is that we have a VPStandardStateTP derived object
|
||||
VPStandardStateTP* vpthermo = dynamic_cast<VPStandardStateTP*>(m_thermo);
|
||||
if (!vpthermo) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
</state>
|
||||
<thermo model="PureLiquidWater"/>
|
||||
<kinetics model="none"/>
|
||||
<transport model="Water"/>
|
||||
</phase>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include "cantera/thermo/ThermoFactory.h"
|
||||
#include "cantera/transport/WaterTransport.h"
|
||||
#include "cantera/transport/TransportFactory.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ int main()
|
|||
double lambda;
|
||||
ThermoPhase* w = newPhase("liquid-water.xml");
|
||||
|
||||
WaterTransport* wtTran = new WaterTransport(w, 3);
|
||||
Transport* wtTran = newDefaultTransportMgr(w);
|
||||
printf("------------------------------------------------------------------------------------\n");
|
||||
printf(" T(C) MPa Phase Visc Visc(paper) lambda lambda(paper)\n");
|
||||
printf(" 10-6 kg/m/s 10-3 W/m/s \n");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue