mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[oneD] Rename StFlow to Flow1D
This commit is contained in:
committed by
Ray Speth
parent
b36d15636f
commit
0827444065
@@ -7,7 +7,7 @@ solution to reduce the three-dimensional governing equations to a single dimensi
|
||||
## Axisymmetric Stagnation Flow
|
||||
|
||||
The governing equations for a steady axisymmetric stagnation flow follow those derived
|
||||
in Section 7.2 of {cite:t}`kee2017` and are implemented by class {ct}`StFlow`.
|
||||
in Section 7.2 of {cite:t}`kee2017` and are implemented by class {ct}`Flow1D`.
|
||||
|
||||
*Continuity*:
|
||||
|
||||
@@ -99,7 +99,7 @@ $$
|
||||
where $D_{ki}$ is the multicomponent diffusion coefficient and $D_k^T$ is the Soret
|
||||
diffusion coefficient. Inclusion of the Soret calculation must be explicitly enabled
|
||||
when setting up the simulation, on top of specifying a multicomponent transport model,
|
||||
for example by using the {ct}`StFlow::enableSoret` method (C++) or setting the
|
||||
for example by using the {ct}`Flow1D::enableSoret` method (C++) or setting the
|
||||
{py:attr}`~cantera.FlameBase.soret_enabled` property (Python).
|
||||
|
||||
## Boundary Conditions
|
||||
@@ -295,4 +295,4 @@ $$
|
||||
|
||||
$$
|
||||
\dot{m}_\t{in,right} = - \rho(z_{\t{in,right}}) U_o(z_{\t{in,right}})
|
||||
$$
|
||||
$$
|
||||
|
||||
@@ -59,14 +59,14 @@ extern "C" {
|
||||
|
||||
CANTERA_CAPI int inlet_setSpreadRate(int i, double v);
|
||||
|
||||
CANTERA_CAPI int stflow_new(int iph, int ikin, int itr, int itype);
|
||||
CANTERA_CAPI int stflow_setTransport(int i, int itr);
|
||||
CANTERA_CAPI int stflow_enableSoret(int i, int iSoret);
|
||||
CANTERA_CAPI int stflow_setPressure(int i, double p);
|
||||
CANTERA_CAPI double stflow_pressure(int i);
|
||||
CANTERA_CAPI int stflow_setFixedTempProfile(int i, size_t n, const double* pos,
|
||||
CANTERA_CAPI int flow1D_new(int iph, int ikin, int itr, int itype);
|
||||
CANTERA_CAPI int flow1D_setTransport(int i, int itr);
|
||||
CANTERA_CAPI int flow1D_enableSoret(int i, int iSoret);
|
||||
CANTERA_CAPI int flow1D_setPressure(int i, double p);
|
||||
CANTERA_CAPI double flow1D_pressure(int i);
|
||||
CANTERA_CAPI int flow1D_setFixedTempProfile(int i, size_t n, const double* pos,
|
||||
size_t m, const double* temp);
|
||||
CANTERA_CAPI int stflow_solveEnergyEqn(int i, int flag);
|
||||
CANTERA_CAPI int flow1D_solveEnergyEqn(int i, int flag);
|
||||
|
||||
CANTERA_CAPI int sim1D_new(size_t nd, const int* domains);
|
||||
CANTERA_CAPI int sim1D_del(int i);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "Domain1D.h"
|
||||
#include "cantera/thermo/SurfPhase.h"
|
||||
#include "cantera/kinetics/InterfaceKinetics.h"
|
||||
#include "StFlow.h"
|
||||
#include "Flow1D.h"
|
||||
|
||||
namespace Cantera
|
||||
{
|
||||
@@ -109,8 +109,8 @@ public:
|
||||
protected:
|
||||
void _init(size_t n);
|
||||
|
||||
StFlow* m_flow_left = nullptr;
|
||||
StFlow* m_flow_right = nullptr;
|
||||
Flow1D* m_flow_left = nullptr;
|
||||
Flow1D* m_flow_right = nullptr;
|
||||
size_t m_ilr = 0;
|
||||
size_t m_left_nv = 0;
|
||||
size_t m_right_nv = 0;
|
||||
@@ -176,7 +176,7 @@ protected:
|
||||
size_t m_nsp = 0;
|
||||
vector<double> m_yin;
|
||||
string m_xstr;
|
||||
StFlow* m_flow = nullptr;
|
||||
Flow1D* m_flow = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -293,7 +293,7 @@ protected:
|
||||
size_t m_nsp = 0;
|
||||
vector<double> m_yres;
|
||||
string m_xstr;
|
||||
StFlow* m_flow = nullptr;
|
||||
Flow1D* m_flow = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! @file StFlow.h
|
||||
//! @file Flow1D.h
|
||||
|
||||
// This file is part of Cantera. See License.txt in the top-level directory or
|
||||
// at https://cantera.org/license.txt for license and copyright information.
|
||||
|
||||
#ifndef CT_STFLOW_H
|
||||
#define CT_STFLOW_H
|
||||
#ifndef CT_FLOW1D_H
|
||||
#define CT_FLOW1D_H
|
||||
|
||||
#include "Domain1D.h"
|
||||
#include "cantera/base/Array.h"
|
||||
@@ -42,7 +42,7 @@ class Transport;
|
||||
* similarity solution for chemically-reacting, axisymmetric flows.
|
||||
* @ingroup flowGroup
|
||||
*/
|
||||
class StFlow : public Domain1D
|
||||
class Flow1D : public Domain1D
|
||||
{
|
||||
public:
|
||||
//--------------------------------
|
||||
@@ -54,19 +54,19 @@ public:
|
||||
//! to evaluate all thermodynamic, kinetic, and transport properties.
|
||||
//! @param nsp Number of species.
|
||||
//! @param points Initial number of grid points
|
||||
StFlow(ThermoPhase* ph = 0, size_t nsp = 1, size_t points = 1);
|
||||
Flow1D(ThermoPhase* ph = 0, size_t nsp = 1, size_t points = 1);
|
||||
|
||||
//! Delegating constructor
|
||||
StFlow(shared_ptr<ThermoPhase> th, size_t nsp = 1, size_t points = 1);
|
||||
Flow1D(shared_ptr<ThermoPhase> th, size_t nsp = 1, size_t points = 1);
|
||||
|
||||
//! Create a new flow domain.
|
||||
//! @param sol Solution object used to evaluate all thermodynamic, kinetic, and
|
||||
//! transport properties
|
||||
//! @param id name of flow domain
|
||||
//! @param points initial number of grid points
|
||||
StFlow(shared_ptr<Solution> sol, const string& id="", size_t points=1);
|
||||
Flow1D(shared_ptr<Solution> sol, const string& id="", size_t points=1);
|
||||
|
||||
~StFlow();
|
||||
~Flow1D();
|
||||
|
||||
string domainType() const override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef CT_IONFLOW_H
|
||||
#define CT_IONFLOW_H
|
||||
|
||||
#include "cantera/oneD/StFlow.h"
|
||||
#include "cantera/oneD/Flow1D.h"
|
||||
|
||||
namespace Cantera
|
||||
{
|
||||
@@ -25,7 +25,7 @@ namespace Cantera
|
||||
*
|
||||
* @ingroup flowGroup
|
||||
*/
|
||||
class IonFlow : public StFlow
|
||||
class IonFlow : public Flow1D
|
||||
{
|
||||
public:
|
||||
IonFlow(ThermoPhase* ph = 0, size_t nsp = 1, size_t points = 1);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "oneD/Sim1D.h"
|
||||
#include "oneD/Domain1D.h"
|
||||
#include "oneD/Boundary1D.h"
|
||||
#include "oneD/StFlow.h"
|
||||
#include "oneD/Flow1D.h"
|
||||
#include "oneD/refine.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -64,8 +64,8 @@ cdef extern from "cantera/oneD/Boundary1D.h":
|
||||
cbool coverageEnabled()
|
||||
|
||||
|
||||
cdef extern from "cantera/oneD/StFlow.h":
|
||||
cdef cppclass CxxStFlow "Cantera::StFlow" (CxxDomain1D):
|
||||
cdef extern from "cantera/oneD/Flow1D.h":
|
||||
cdef cppclass CxxFlow1D "Cantera::Flow1D" (CxxDomain1D):
|
||||
void setTransportModel(const string&) except +translate_exception
|
||||
string type()
|
||||
string transportModel()
|
||||
@@ -173,7 +173,7 @@ cdef class ReactingSurface1D(Boundary1D):
|
||||
cdef public Kinetics surface
|
||||
|
||||
cdef class FlowBase(Domain1D):
|
||||
cdef CxxStFlow* flow
|
||||
cdef CxxFlow1D* flow
|
||||
|
||||
cdef class Sim1D:
|
||||
cdef CxxSim1D* sim
|
||||
|
||||
@@ -449,7 +449,7 @@ cdef class FlowBase(Domain1D):
|
||||
self._domain = CxxNewDomain1D(
|
||||
stringify(self._domain_type), phase._base, stringify(name))
|
||||
self.domain = self._domain.get()
|
||||
self.flow = <CxxStFlow*>self.domain
|
||||
self.flow = <CxxFlow1D*>self.domain
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@@ -108,12 +108,12 @@ classdef Domain1D < handle
|
||||
|
||||
function set.energyEnabled(d, flag)
|
||||
d.energyEnabled = flag;
|
||||
ctFunc('stflow_solveEnergyEqn', d.domainID, int8(flag));
|
||||
ctFunc('flow1D_solveEnergyEqn', d.domainID, int8(flag));
|
||||
end
|
||||
|
||||
function set.soretEnabled(d, flag)
|
||||
d.soretEnabled = flag;
|
||||
ctFunc('stflow_enableSoret', d.domainID, int8(flag));
|
||||
ctFunc('flow1D_enableSoret', d.domainID, int8(flag));
|
||||
end
|
||||
|
||||
%% Domain Get Methods
|
||||
@@ -359,7 +359,7 @@ classdef Domain1D < handle
|
||||
end
|
||||
|
||||
function set.transport(d, itr)
|
||||
ctFunc('stflow_setTransport', d.domainID, itr);
|
||||
ctFunc('flow1D_setTransport', d.domainID, itr);
|
||||
end
|
||||
|
||||
function setupGrid(d, grid)
|
||||
|
||||
@@ -31,11 +31,11 @@ classdef Flow1D < Domain1D
|
||||
%% Flow1D Class Methods
|
||||
|
||||
function pressure = get.P(d)
|
||||
pressure = ctFunc('stflow_pressure', d.domainID);
|
||||
pressure = ctFunc('flow1D_pressure', d.domainID);
|
||||
end
|
||||
|
||||
function set.P(d, p)
|
||||
ctFunc('stflow_setPressure', d.domainID, p);
|
||||
ctFunc('flow1D_setPressure', d.domainID, p);
|
||||
end
|
||||
|
||||
function setFixedTempProfile(d, profile)
|
||||
@@ -57,11 +57,11 @@ classdef Flow1D < Domain1D
|
||||
|
||||
if sz(1) == 2
|
||||
l = length(profile(1, :));
|
||||
ctFunc('stflow_setFixedTempProfile', d.domainID, ...
|
||||
ctFunc('flow1D_setFixedTempProfile', d.domainID, ...
|
||||
l, profile(1, :), l, profile(2, :));
|
||||
elseif sz(2) == 2
|
||||
l = length(profile(:, 1));
|
||||
ctFunc('stflow_setFixedTempProfile', d.domainID, ...
|
||||
ctFunc('flow1D_setFixedTempProfile', d.domainID, ...
|
||||
l, profile(:, 1), l, profile(:, 2));
|
||||
else
|
||||
error('Wrong temperature profile array shape.');
|
||||
@@ -71,4 +71,4 @@ classdef Flow1D < Domain1D
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* flamespeed [equivalence_ratio] [refine_grid] [loglevel]
|
||||
*
|
||||
* Requires: cantera >= 3.0
|
||||
* Requires: cantera >= 3.1
|
||||
*
|
||||
* .. tags:: C++, combustion, 1D flow, premixed flame, flame speed, saving output
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ int flamespeed(double phi, bool refine_grid, int loglevel)
|
||||
|
||||
//-------- step 1: create the flow -------------
|
||||
|
||||
auto flow = newDomain<StFlow>("gas-flow", sol, "flow");
|
||||
auto flow = newDomain<Flow1D>("gas-flow", sol, "flow");
|
||||
flow->setFreeFlow();
|
||||
|
||||
// create an initial grid
|
||||
|
||||
@@ -400,11 +400,11 @@ extern "C" {
|
||||
|
||||
//------------------ stagnation flow domains --------------------
|
||||
|
||||
int stflow_new(int iph, int ikin, int itr, int itype)
|
||||
int flow1D_new(int iph, int ikin, int itr, int itype)
|
||||
{
|
||||
try {
|
||||
auto ph = ThermoCabinet::at(iph);
|
||||
auto x = make_shared<StFlow>(ph, ph->nSpecies(), 2);
|
||||
auto x = make_shared<Flow1D>(ph, ph->nSpecies(), 2);
|
||||
if (itype == 1) {
|
||||
x->setAxisymmetricFlow();
|
||||
} else if (itype == 2) {
|
||||
@@ -420,47 +420,47 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_setTransport(int i, int itr)
|
||||
int flow1D_setTransport(int i, int itr)
|
||||
{
|
||||
try {
|
||||
DomainCabinet::get<StFlow>(i).setTransport(TransportCabinet::at(itr));
|
||||
DomainCabinet::get<Flow1D>(i).setTransport(TransportCabinet::at(itr));
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_enableSoret(int i, int iSoret)
|
||||
int flow1D_enableSoret(int i, int iSoret)
|
||||
{
|
||||
try {
|
||||
bool withSoret = (iSoret > 0);
|
||||
DomainCabinet::get<StFlow>(i).enableSoret(withSoret);
|
||||
DomainCabinet::get<Flow1D>(i).enableSoret(withSoret);
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_setPressure(int i, double p)
|
||||
int flow1D_setPressure(int i, double p)
|
||||
{
|
||||
try {
|
||||
DomainCabinet::get<StFlow>(i).setPressure(p);
|
||||
DomainCabinet::get<Flow1D>(i).setPressure(p);
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
double stflow_pressure(int i)
|
||||
double flow1D_pressure(int i)
|
||||
{
|
||||
try {
|
||||
return DomainCabinet::get<StFlow>(i).pressure();
|
||||
return DomainCabinet::get<Flow1D>(i).pressure();
|
||||
} catch (...) {
|
||||
return handleAllExceptions(DERR, DERR);
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_setFixedTempProfile(int i, size_t n, const double* pos,
|
||||
int flow1D_setFixedTempProfile(int i, size_t n, const double* pos,
|
||||
size_t m, const double* temp)
|
||||
{
|
||||
try {
|
||||
@@ -469,20 +469,20 @@ extern "C" {
|
||||
vpos[j] = pos[j];
|
||||
vtemp[j] = temp[j];
|
||||
}
|
||||
DomainCabinet::get<StFlow>(i).setFixedTempProfile(vpos, vtemp);
|
||||
DomainCabinet::get<Flow1D>(i).setFixedTempProfile(vpos, vtemp);
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_solveEnergyEqn(int i, int flag)
|
||||
int flow1D_solveEnergyEqn(int i, int flag)
|
||||
{
|
||||
try {
|
||||
if (flag > 0) {
|
||||
DomainCabinet::get<StFlow>(i).solveEnergyEqn(npos);
|
||||
DomainCabinet::get<Flow1D>(i).solveEnergyEqn(npos);
|
||||
} else {
|
||||
DomainCabinet::get<StFlow>(i).fixTemperature(npos);
|
||||
DomainCabinet::get<Flow1D>(i).fixTemperature(npos);
|
||||
}
|
||||
return 0;
|
||||
} catch (...) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "cantera/base/SolutionArray.h"
|
||||
#include "cantera/oneD/Boundary1D.h"
|
||||
#include "cantera/oneD/OneDim.h"
|
||||
#include "cantera/oneD/StFlow.h"
|
||||
#include "cantera/oneD/Flow1D.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -42,7 +42,7 @@ void Boundary1D::_init(size_t n)
|
||||
}
|
||||
m_left_loc = container().start(m_index-1);
|
||||
m_left_points = r.nPoints();
|
||||
m_flow_left = dynamic_cast<StFlow*>(&r);
|
||||
m_flow_left = dynamic_cast<Flow1D*>(&r);
|
||||
if (m_flow_left != nullptr) {
|
||||
m_phase_left = &m_flow_left->phase();
|
||||
}
|
||||
@@ -64,7 +64,7 @@ void Boundary1D::_init(size_t n)
|
||||
m_right_nsp = 0;
|
||||
}
|
||||
m_right_loc = container().start(m_index+1);
|
||||
m_flow_right = dynamic_cast<StFlow*>(&r);
|
||||
m_flow_right = dynamic_cast<Flow1D*>(&r);
|
||||
if (m_flow_right != nullptr) {
|
||||
m_phase_right = &m_flow_right->phase();
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void Inlet1D::eval(size_t jg, double* xg, double* rg,
|
||||
// When using two-point control, the mass flow rate at the left inlet is
|
||||
// not specified. Instead, the mass flow rate is dictated by the
|
||||
// velocity at the left inlet, which comes from the U variable. The
|
||||
// default boundary condition specified in the StFlow.cpp file already
|
||||
// default boundary condition specified in the Flow1D.cpp file already
|
||||
// handles this case. We only need to update the stored value of m_mdot
|
||||
// so that other equations that use the quantity are consistent.
|
||||
m_mdot = m_flow->density(0)*xb[c_offset_U];
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "cantera/oneD/DomainFactory.h"
|
||||
#include "cantera/oneD/Boundary1D.h"
|
||||
#include "cantera/oneD/StFlow.h"
|
||||
#include "cantera/oneD/Flow1D.h"
|
||||
#include "cantera/oneD/IonFlow.h"
|
||||
#include "cantera/transport/Transport.h"
|
||||
|
||||
@@ -39,37 +39,37 @@ DomainFactory::DomainFactory()
|
||||
return new ReactingSurf1D(solution, id);
|
||||
});
|
||||
reg("gas-flow", [](shared_ptr<Solution> solution, const string& id) {
|
||||
return new StFlow(solution, id);
|
||||
return new Flow1D(solution, id);
|
||||
});
|
||||
reg("ion-flow", [](shared_ptr<Solution> solution, const string& id) {
|
||||
return new IonFlow(solution, id);
|
||||
});
|
||||
reg("free-flow", [](shared_ptr<Solution> solution, const string& id) {
|
||||
StFlow* ret;
|
||||
Flow1D* ret;
|
||||
if (solution->transport()->transportModel() == "ionized-gas") {
|
||||
ret = new IonFlow(solution, id);
|
||||
} else {
|
||||
ret = new StFlow(solution, id);
|
||||
ret = new Flow1D(solution, id);
|
||||
}
|
||||
ret->setFreeFlow();
|
||||
return ret;
|
||||
});
|
||||
reg("axisymmetric-flow", [](shared_ptr<Solution> solution, const string& id) {
|
||||
StFlow* ret;
|
||||
Flow1D* ret;
|
||||
if (solution->transport()->transportModel() == "ionized-gas") {
|
||||
ret = new IonFlow(solution, id);
|
||||
} else {
|
||||
ret = new StFlow(solution, id);
|
||||
ret = new Flow1D(solution, id);
|
||||
}
|
||||
ret->setAxisymmetricFlow();
|
||||
return ret;
|
||||
});
|
||||
reg("unstrained-flow", [](shared_ptr<Solution> solution, const string& id) {
|
||||
StFlow* ret;
|
||||
Flow1D* ret;
|
||||
if (solution->transport()->transportModel() == "ionized-gas") {
|
||||
ret = new IonFlow(solution, id);
|
||||
} else {
|
||||
ret = new StFlow(solution, id);
|
||||
ret = new Flow1D(solution, id);
|
||||
}
|
||||
ret->setUnstrainedFlow();
|
||||
return ret;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! @file StFlow.cpp
|
||||
//! @file Flow1D.cpp
|
||||
|
||||
// This file is part of Cantera. See License.txt in the top-level directory or
|
||||
// at https://cantera.org/license.txt for license and copyright information.
|
||||
|
||||
#include "cantera/base/SolutionArray.h"
|
||||
#include "cantera/oneD/StFlow.h"
|
||||
#include "cantera/oneD/Flow1D.h"
|
||||
#include "cantera/oneD/refine.h"
|
||||
#include "cantera/transport/Transport.h"
|
||||
#include "cantera/transport/TransportFactory.h"
|
||||
@@ -16,7 +16,7 @@ using namespace std;
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
StFlow::StFlow(ThermoPhase* ph, size_t nsp, size_t points) :
|
||||
Flow1D::Flow1D(ThermoPhase* ph, size_t nsp, size_t points) :
|
||||
Domain1D(nsp+c_offset_Y, points),
|
||||
m_nsp(nsp)
|
||||
{
|
||||
@@ -90,23 +90,23 @@ StFlow::StFlow(ThermoPhase* ph, size_t nsp, size_t points) :
|
||||
m_kRadiating[1] = m_thermo->speciesIndex("H2O");
|
||||
}
|
||||
|
||||
StFlow::StFlow(shared_ptr<ThermoPhase> th, size_t nsp, size_t points)
|
||||
: StFlow(th.get(), nsp, points)
|
||||
Flow1D::Flow1D(shared_ptr<ThermoPhase> th, size_t nsp, size_t points)
|
||||
: Flow1D(th.get(), nsp, points)
|
||||
{
|
||||
auto sol = Solution::create();
|
||||
sol->setThermo(th);
|
||||
setSolution(sol);
|
||||
}
|
||||
|
||||
StFlow::StFlow(shared_ptr<Solution> sol, const string& id, size_t points)
|
||||
: StFlow(sol->thermo().get(), sol->thermo()->nSpecies(), points)
|
||||
Flow1D::Flow1D(shared_ptr<Solution> sol, const string& id, size_t points)
|
||||
: Flow1D(sol->thermo().get(), sol->thermo()->nSpecies(), points)
|
||||
{
|
||||
setSolution(sol);
|
||||
m_id = id;
|
||||
m_kin = m_solution->kinetics().get();
|
||||
m_trans = m_solution->transport().get();
|
||||
if (m_trans->transportModel() == "none") {
|
||||
throw CanteraError("StFlow::StFlow",
|
||||
throw CanteraError("Flow1D::Flow1D",
|
||||
"An appropriate transport model\nshould be set when instantiating the "
|
||||
"Solution ('gas') object.");
|
||||
}
|
||||
@@ -116,14 +116,14 @@ StFlow::StFlow(shared_ptr<Solution> sol, const string& id, size_t points)
|
||||
});
|
||||
}
|
||||
|
||||
StFlow::~StFlow()
|
||||
Flow1D::~Flow1D()
|
||||
{
|
||||
if (m_solution) {
|
||||
m_solution->removeChangedCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
string StFlow::domainType() const {
|
||||
string Flow1D::domainType() const {
|
||||
if (m_isFree) {
|
||||
return "free-flow";
|
||||
}
|
||||
@@ -133,20 +133,20 @@ string StFlow::domainType() const {
|
||||
return "unstrained-flow";
|
||||
}
|
||||
|
||||
void StFlow::setKinetics(shared_ptr<Kinetics> kin)
|
||||
void Flow1D::setKinetics(shared_ptr<Kinetics> kin)
|
||||
{
|
||||
m_kin = kin.get();
|
||||
m_solution->setKinetics(kin);
|
||||
}
|
||||
|
||||
void StFlow::setTransport(shared_ptr<Transport> trans)
|
||||
void Flow1D::setTransport(shared_ptr<Transport> trans)
|
||||
{
|
||||
if (!trans) {
|
||||
throw CanteraError("StFlow::setTransport", "Unable to set empty transport.");
|
||||
throw CanteraError("Flow1D::setTransport", "Unable to set empty transport.");
|
||||
}
|
||||
m_trans = trans.get();
|
||||
if (m_trans->transportModel() == "none") {
|
||||
throw CanteraError("StFlow::setTransport", "Invalid Transport model 'none'.");
|
||||
throw CanteraError("Flow1D::setTransport", "Invalid Transport model 'none'.");
|
||||
}
|
||||
m_do_multicomponent = (m_trans->transportModel() == "multicomponent" ||
|
||||
m_trans->transportModel() == "multicomponent-CK");
|
||||
@@ -159,7 +159,7 @@ void StFlow::setTransport(shared_ptr<Transport> trans)
|
||||
m_solution->setTransport(trans);
|
||||
}
|
||||
|
||||
void StFlow::resize(size_t ncomponents, size_t points)
|
||||
void Flow1D::resize(size_t ncomponents, size_t points)
|
||||
{
|
||||
Domain1D::resize(ncomponents, points);
|
||||
m_rho.resize(m_points, 0.0);
|
||||
@@ -185,14 +185,14 @@ void StFlow::resize(size_t ncomponents, size_t points)
|
||||
m_z.resize(m_points);
|
||||
}
|
||||
|
||||
void StFlow::setupGrid(size_t n, const double* z)
|
||||
void Flow1D::setupGrid(size_t n, const double* z)
|
||||
{
|
||||
resize(m_nv, n);
|
||||
|
||||
m_z[0] = z[0];
|
||||
for (size_t j = 1; j < m_points; j++) {
|
||||
if (z[j] <= z[j-1]) {
|
||||
throw CanteraError("StFlow::setupGrid",
|
||||
throw CanteraError("Flow1D::setupGrid",
|
||||
"grid points must be monotonically increasing");
|
||||
}
|
||||
m_z[j] = z[j];
|
||||
@@ -200,7 +200,7 @@ void StFlow::setupGrid(size_t n, const double* z)
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::resetBadValues(double* xg)
|
||||
void Flow1D::resetBadValues(double* xg)
|
||||
{
|
||||
double* x = xg + loc();
|
||||
for (size_t j = 0; j < m_points; j++) {
|
||||
@@ -210,26 +210,26 @@ void StFlow::resetBadValues(double* xg)
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::setTransportModel(const string& trans)
|
||||
void Flow1D::setTransportModel(const string& trans)
|
||||
{
|
||||
m_solution->setTransportModel(trans);
|
||||
}
|
||||
|
||||
string StFlow::transportModel() const {
|
||||
string Flow1D::transportModel() const {
|
||||
return m_trans->transportModel();
|
||||
}
|
||||
|
||||
void StFlow::setFluxGradientBasis(ThermoBasis fluxGradientBasis) {
|
||||
void Flow1D::setFluxGradientBasis(ThermoBasis fluxGradientBasis) {
|
||||
m_fluxGradientBasis = fluxGradientBasis;
|
||||
if (transportModel() != "mixture-averaged-CK" &&
|
||||
transportModel() != "mixture-averaged") {
|
||||
warn_user("StFlow::setFluxGradientBasis",
|
||||
warn_user("Flow1D::setFluxGradientBasis",
|
||||
"Setting fluxGradientBasis only affects "
|
||||
"the mixture-averaged diffusion model.");
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::_getInitialSoln(double* x)
|
||||
void Flow1D::_getInitialSoln(double* x)
|
||||
{
|
||||
for (size_t j = 0; j < m_points; j++) {
|
||||
T(x,j) = m_thermo->temperature();
|
||||
@@ -238,7 +238,7 @@ void StFlow::_getInitialSoln(double* x)
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::setGas(const double* x, size_t j)
|
||||
void Flow1D::setGas(const double* x, size_t j)
|
||||
{
|
||||
m_thermo->setTemperature(T(x,j));
|
||||
const double* yy = x + m_nv*j + c_offset_Y;
|
||||
@@ -246,7 +246,7 @@ void StFlow::setGas(const double* x, size_t j)
|
||||
m_thermo->setPressure(m_press);
|
||||
}
|
||||
|
||||
void StFlow::setGasAtMidpoint(const double* x, size_t j)
|
||||
void Flow1D::setGasAtMidpoint(const double* x, size_t j)
|
||||
{
|
||||
m_thermo->setTemperature(0.5*(T(x,j)+T(x,j+1)));
|
||||
const double* yyj = x + m_nv*j + c_offset_Y;
|
||||
@@ -258,10 +258,10 @@ void StFlow::setGasAtMidpoint(const double* x, size_t j)
|
||||
m_thermo->setPressure(m_press);
|
||||
}
|
||||
|
||||
void StFlow::_finalize(const double* x)
|
||||
void Flow1D::_finalize(const double* x)
|
||||
{
|
||||
if (!m_do_multicomponent && m_do_soret) {
|
||||
throw CanteraError("StFlow::_finalize",
|
||||
throw CanteraError("Flow1D::_finalize",
|
||||
"Thermal diffusion (the Soret effect) is enabled, and requires "
|
||||
"using a multicomponent transport model.");
|
||||
}
|
||||
@@ -305,7 +305,7 @@ void StFlow::_finalize(const double* x)
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::eval(size_t jGlobal, double* xGlobal, double* rsdGlobal,
|
||||
void Flow1D::eval(size_t jGlobal, double* xGlobal, double* rsdGlobal,
|
||||
integer* diagGlobal, double rdt)
|
||||
{
|
||||
// If evaluating a Jacobian, and the global point is outside the domain of
|
||||
@@ -344,7 +344,7 @@ void StFlow::eval(size_t jGlobal, double* xGlobal, double* rsdGlobal,
|
||||
evalSpecies(x, rsd, diag, rdt, jmin, jmax);
|
||||
}
|
||||
|
||||
void StFlow::updateProperties(size_t jg, double* x, size_t jmin, size_t jmax)
|
||||
void Flow1D::updateProperties(size_t jg, double* x, size_t jmin, size_t jmax)
|
||||
{
|
||||
// properties are computed for grid points from j0 to j1
|
||||
size_t j0 = std::max<size_t>(jmin, 1) - 1;
|
||||
@@ -368,7 +368,7 @@ void StFlow::updateProperties(size_t jg, double* x, size_t jmin, size_t jmax)
|
||||
updateDiffFluxes(x, j0, j1);
|
||||
}
|
||||
|
||||
void StFlow::computeRadiation(double* x, size_t jmin, size_t jmax)
|
||||
void Flow1D::computeRadiation(double* x, size_t jmin, size_t jmax)
|
||||
{
|
||||
// Variable definitions for the Planck absorption coefficient and the
|
||||
// radiation calculation:
|
||||
@@ -415,7 +415,7 @@ void StFlow::computeRadiation(double* x, size_t jmin, size_t jmax)
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::evalContinuity(double* x, double* rsd, int* diag,
|
||||
void Flow1D::evalContinuity(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax)
|
||||
{
|
||||
// The left boundary has the same form for all cases.
|
||||
@@ -474,7 +474,7 @@ void StFlow::evalContinuity(double* x, double* rsd, int* diag,
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::evalMomentum(double* x, double* rsd, int* diag,
|
||||
void Flow1D::evalMomentum(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax)
|
||||
{
|
||||
if (!m_usesLambda) { //disable this equation
|
||||
@@ -506,7 +506,7 @@ void StFlow::evalMomentum(double* x, double* rsd, int* diag,
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::evalLambda(double* x, double* rsd, int* diag,
|
||||
void Flow1D::evalLambda(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax)
|
||||
{
|
||||
if (!m_usesLambda) { // disable this equation
|
||||
@@ -549,7 +549,7 @@ void StFlow::evalLambda(double* x, double* rsd, int* diag,
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::evalEnergy(double* x, double* rsd, int* diag,
|
||||
void Flow1D::evalEnergy(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax)
|
||||
{
|
||||
if (jmin == 0) { // left boundary
|
||||
@@ -587,7 +587,7 @@ void StFlow::evalEnergy(double* x, double* rsd, int* diag,
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::evalUo(double* x, double* rsd, int* diag,
|
||||
void Flow1D::evalUo(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax)
|
||||
{
|
||||
if (!m_twoPointControl) { // disable this equation
|
||||
@@ -629,7 +629,7 @@ void StFlow::evalUo(double* x, double* rsd, int* diag,
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::evalSpecies(double* x, double* rsd, int* diag,
|
||||
void Flow1D::evalSpecies(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax)
|
||||
{
|
||||
if (jmin == 0) { // left boundary
|
||||
@@ -668,7 +668,7 @@ void StFlow::evalSpecies(double* x, double* rsd, int* diag,
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::evalElectricField(double* x, double* rsd, int* diag,
|
||||
void Flow1D::evalElectricField(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax)
|
||||
{
|
||||
for (size_t j = jmin; j <= jmax; j++) {
|
||||
@@ -677,7 +677,7 @@ void StFlow::evalElectricField(double* x, double* rsd, int* diag,
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::updateTransport(double* x, size_t j0, size_t j1)
|
||||
void Flow1D::updateTransport(double* x, size_t j0, size_t j1)
|
||||
{
|
||||
if (m_do_multicomponent) {
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
@@ -725,7 +725,7 @@ void StFlow::updateTransport(double* x, size_t j0, size_t j1)
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::show(const double* x)
|
||||
void Flow1D::show(const double* x)
|
||||
{
|
||||
writelog(" Pressure: {:10.4g} Pa\n", m_press);
|
||||
|
||||
@@ -742,7 +742,7 @@ void StFlow::show(const double* x)
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::updateDiffFluxes(const double* x, size_t j0, size_t j1)
|
||||
void Flow1D::updateDiffFluxes(const double* x, size_t j0, size_t j1)
|
||||
{
|
||||
if (m_do_multicomponent) {
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
@@ -788,7 +788,7 @@ void StFlow::updateDiffFluxes(const double* x, size_t j0, size_t j1)
|
||||
}
|
||||
}
|
||||
|
||||
string StFlow::componentName(size_t n) const
|
||||
string Flow1D::componentName(size_t n) const
|
||||
{
|
||||
switch (n) {
|
||||
case c_offset_U:
|
||||
@@ -812,7 +812,7 @@ string StFlow::componentName(size_t n) const
|
||||
}
|
||||
}
|
||||
|
||||
size_t StFlow::componentIndex(const string& name) const
|
||||
size_t Flow1D::componentIndex(const string& name) const
|
||||
{
|
||||
if (name=="velocity") {
|
||||
return c_offset_U;
|
||||
@@ -832,12 +832,12 @@ size_t StFlow::componentIndex(const string& name) const
|
||||
return n;
|
||||
}
|
||||
}
|
||||
throw CanteraError("StFlow1D::componentIndex",
|
||||
throw CanteraError("Flow1D1D::componentIndex",
|
||||
"no component named " + name);
|
||||
}
|
||||
}
|
||||
|
||||
bool StFlow::componentActive(size_t n) const
|
||||
bool Flow1D::componentActive(size_t n) const
|
||||
{
|
||||
switch (n) {
|
||||
case c_offset_V: // spread_rate
|
||||
@@ -853,7 +853,7 @@ bool StFlow::componentActive(size_t n) const
|
||||
}
|
||||
}
|
||||
|
||||
AnyMap StFlow::getMeta() const
|
||||
AnyMap Flow1D::getMeta() const
|
||||
{
|
||||
AnyMap state = Domain1D::getMeta();
|
||||
state["transport-model"] = m_trans->transportModel();
|
||||
@@ -913,7 +913,7 @@ AnyMap StFlow::getMeta() const
|
||||
return state;
|
||||
}
|
||||
|
||||
shared_ptr<SolutionArray> StFlow::asArray(const double* soln) const
|
||||
shared_ptr<SolutionArray> Flow1D::asArray(const double* soln) const
|
||||
{
|
||||
auto arr = SolutionArray::create(
|
||||
m_solution, static_cast<int>(nPoints()), getMeta());
|
||||
@@ -947,7 +947,7 @@ shared_ptr<SolutionArray> StFlow::asArray(const double* soln) const
|
||||
return arr;
|
||||
}
|
||||
|
||||
void StFlow::fromArray(SolutionArray& arr, double* soln)
|
||||
void Flow1D::fromArray(SolutionArray& arr, double* soln)
|
||||
{
|
||||
Domain1D::setMeta(arr.meta());
|
||||
arr.setLoc(0);
|
||||
@@ -968,7 +968,7 @@ void StFlow::fromArray(SolutionArray& arr, double* soln)
|
||||
soln[index(i,j)] = data[j];
|
||||
}
|
||||
} else {
|
||||
warn_user("StFlow::fromArray", "Saved state does not contain values for "
|
||||
warn_user("Flow1D::fromArray", "Saved state does not contain values for "
|
||||
"component '{}' in domain '{}'.", name, id());
|
||||
}
|
||||
}
|
||||
@@ -977,7 +977,7 @@ void StFlow::fromArray(SolutionArray& arr, double* soln)
|
||||
setMeta(arr.meta());
|
||||
}
|
||||
|
||||
void StFlow::setMeta(const AnyMap& state)
|
||||
void Flow1D::setMeta(const AnyMap& state)
|
||||
{
|
||||
if (state.hasKey("energy-enabled")) {
|
||||
const AnyValue& ee = state["energy-enabled"];
|
||||
@@ -1047,13 +1047,13 @@ void StFlow::setMeta(const AnyMap& state)
|
||||
m_tLeft = cm["left-temperature"].asDouble();
|
||||
m_tRight = cm["right-temperature"].asDouble();
|
||||
} else {
|
||||
warn_user("StFlow::setMeta", "Unknown continuation method '{}'.",
|
||||
warn_user("Flow1D::setMeta", "Unknown continuation method '{}'.",
|
||||
cm["type"].asString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::solveEnergyEqn(size_t j)
|
||||
void Flow1D::solveEnergyEqn(size_t j)
|
||||
{
|
||||
bool changed = false;
|
||||
if (j == npos) {
|
||||
@@ -1077,43 +1077,43 @@ void StFlow::solveEnergyEqn(size_t j)
|
||||
}
|
||||
}
|
||||
|
||||
size_t StFlow::getSolvingStage() const
|
||||
size_t Flow1D::getSolvingStage() const
|
||||
{
|
||||
throw NotImplementedError("StFlow::getSolvingStage",
|
||||
throw NotImplementedError("Flow1D::getSolvingStage",
|
||||
"Not used by '{}' objects.", type());
|
||||
}
|
||||
|
||||
void StFlow::setSolvingStage(const size_t stage)
|
||||
void Flow1D::setSolvingStage(const size_t stage)
|
||||
{
|
||||
throw NotImplementedError("StFlow::setSolvingStage",
|
||||
throw NotImplementedError("Flow1D::setSolvingStage",
|
||||
"Not used by '{}' objects.", type());
|
||||
}
|
||||
|
||||
void StFlow::solveElectricField(size_t j)
|
||||
void Flow1D::solveElectricField(size_t j)
|
||||
{
|
||||
throw NotImplementedError("StFlow::solveElectricField",
|
||||
throw NotImplementedError("Flow1D::solveElectricField",
|
||||
"Not used by '{}' objects.", type());
|
||||
}
|
||||
|
||||
void StFlow::fixElectricField(size_t j)
|
||||
void Flow1D::fixElectricField(size_t j)
|
||||
{
|
||||
throw NotImplementedError("StFlow::fixElectricField",
|
||||
throw NotImplementedError("Flow1D::fixElectricField",
|
||||
"Not used by '{}' objects.", type());
|
||||
}
|
||||
|
||||
bool StFlow::doElectricField(size_t j) const
|
||||
bool Flow1D::doElectricField(size_t j) const
|
||||
{
|
||||
throw NotImplementedError("StFlow::doElectricField",
|
||||
throw NotImplementedError("Flow1D::doElectricField",
|
||||
"Not used by '{}' objects.", type());
|
||||
}
|
||||
|
||||
void StFlow::setBoundaryEmissivities(double e_left, double e_right)
|
||||
void Flow1D::setBoundaryEmissivities(double e_left, double e_right)
|
||||
{
|
||||
if (e_left < 0 || e_left > 1) {
|
||||
throw CanteraError("StFlow::setBoundaryEmissivities",
|
||||
throw CanteraError("Flow1D::setBoundaryEmissivities",
|
||||
"The left boundary emissivity must be between 0.0 and 1.0!");
|
||||
} else if (e_right < 0 || e_right > 1) {
|
||||
throw CanteraError("StFlow::setBoundaryEmissivities",
|
||||
throw CanteraError("Flow1D::setBoundaryEmissivities",
|
||||
"The right boundary emissivity must be between 0.0 and 1.0!");
|
||||
} else {
|
||||
m_epsilon_left = e_left;
|
||||
@@ -1121,7 +1121,7 @@ void StFlow::setBoundaryEmissivities(double e_left, double e_right)
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::fixTemperature(size_t j)
|
||||
void Flow1D::fixTemperature(size_t j)
|
||||
{
|
||||
bool changed = false;
|
||||
if (j == npos) {
|
||||
@@ -1145,7 +1145,7 @@ void StFlow::fixTemperature(size_t j)
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::grad_hk(const double* x, size_t j)
|
||||
void Flow1D::grad_hk(const double* x, size_t j)
|
||||
{
|
||||
for(size_t k = 0; k < m_nsp; k++) {
|
||||
if (u(x, j) > 0.0) {
|
||||
@@ -1158,122 +1158,122 @@ void StFlow::grad_hk(const double* x, size_t j)
|
||||
}
|
||||
|
||||
// Two-point control functions
|
||||
double StFlow::leftControlPointTemperature() const
|
||||
double Flow1D::leftControlPointTemperature() const
|
||||
{
|
||||
if (m_twoPointControl) {
|
||||
if (m_zLeft != Undef) {
|
||||
return m_tLeft;
|
||||
} else {
|
||||
throw CanteraError("StFlow::leftControlPointTemperature",
|
||||
throw CanteraError("Flow1D::leftControlPointTemperature",
|
||||
"Invalid operation: left control point location is not set");
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("StFlow::leftControlPointTemperature",
|
||||
throw CanteraError("Flow1D::leftControlPointTemperature",
|
||||
"Invalid operation: two-point control is not enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
double StFlow::leftControlPointCoordinate() const
|
||||
double Flow1D::leftControlPointCoordinate() const
|
||||
{
|
||||
if (m_twoPointControl) {
|
||||
if (m_zLeft != Undef) {
|
||||
return m_zLeft;
|
||||
} else {
|
||||
throw CanteraError("StFlow::leftControlPointCoordinate",
|
||||
throw CanteraError("Flow1D::leftControlPointCoordinate",
|
||||
"Invalid operation: left control point location is not set");
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("StFlow::leftControlPointCoordinate",
|
||||
throw CanteraError("Flow1D::leftControlPointCoordinate",
|
||||
"Invalid operation: two-point control is not enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::setLeftControlPointTemperature(double temperature)
|
||||
void Flow1D::setLeftControlPointTemperature(double temperature)
|
||||
{
|
||||
if (m_twoPointControl) {
|
||||
if (m_zLeft != Undef) {
|
||||
m_tLeft = temperature;
|
||||
} else {
|
||||
throw CanteraError("StFlow::setLeftControlPointTemperature",
|
||||
throw CanteraError("Flow1D::setLeftControlPointTemperature",
|
||||
"Invalid operation: left control point location is not set");
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("StFlow::setLeftControlPointTemperature",
|
||||
throw CanteraError("Flow1D::setLeftControlPointTemperature",
|
||||
"Invalid operation: two-point control is not enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::setLeftControlPointCoordinate(double z_left)
|
||||
void Flow1D::setLeftControlPointCoordinate(double z_left)
|
||||
{
|
||||
if (m_twoPointControl) {
|
||||
m_zLeft = z_left;
|
||||
} else {
|
||||
throw CanteraError("StFlow::setLeftControlPointCoordinate",
|
||||
throw CanteraError("Flow1D::setLeftControlPointCoordinate",
|
||||
"Invalid operation: two-point control is not enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
double StFlow::rightControlPointTemperature() const
|
||||
double Flow1D::rightControlPointTemperature() const
|
||||
{
|
||||
if (m_twoPointControl) {
|
||||
if (m_zRight != Undef) {
|
||||
return m_tRight;
|
||||
} else {
|
||||
throw CanteraError("StFlow::rightControlPointTemperature",
|
||||
throw CanteraError("Flow1D::rightControlPointTemperature",
|
||||
"Invalid operation: right control point location is not set");
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("StFlow::rightControlPointTemperature",
|
||||
throw CanteraError("Flow1D::rightControlPointTemperature",
|
||||
"Invalid operation: two-point control is not enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
double StFlow::rightControlPointCoordinate() const
|
||||
double Flow1D::rightControlPointCoordinate() const
|
||||
{
|
||||
if (m_twoPointControl) {
|
||||
if (m_zRight != Undef) {
|
||||
return m_zRight;
|
||||
} else {
|
||||
throw CanteraError("StFlow::rightControlPointCoordinate",
|
||||
throw CanteraError("Flow1D::rightControlPointCoordinate",
|
||||
"Invalid operation: right control point location is not set");
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("StFlow::rightControlPointCoordinate",
|
||||
throw CanteraError("Flow1D::rightControlPointCoordinate",
|
||||
"Invalid operation: two-point control is not enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::setRightControlPointTemperature(double temperature)
|
||||
void Flow1D::setRightControlPointTemperature(double temperature)
|
||||
{
|
||||
if (m_twoPointControl) {
|
||||
if (m_zRight != Undef) {
|
||||
m_tRight = temperature;
|
||||
} else {
|
||||
throw CanteraError("StFlow::setRightControlPointTemperature",
|
||||
throw CanteraError("Flow1D::setRightControlPointTemperature",
|
||||
"Invalid operation: right control point location is not set");
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("StFlow::setRightControlPointTemperature",
|
||||
throw CanteraError("Flow1D::setRightControlPointTemperature",
|
||||
"Invalid operation: two-point control is not enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::setRightControlPointCoordinate(double z_right)
|
||||
void Flow1D::setRightControlPointCoordinate(double z_right)
|
||||
{
|
||||
if (m_twoPointControl) {
|
||||
m_zRight = z_right;
|
||||
} else {
|
||||
throw CanteraError("StFlow::setRightControlPointCoordinate",
|
||||
throw CanteraError("Flow1D::setRightControlPointCoordinate",
|
||||
"Invalid operation: two-point control is not enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
void StFlow::enableTwoPointControl(bool twoPointControl)
|
||||
void Flow1D::enableTwoPointControl(bool twoPointControl)
|
||||
{
|
||||
if (isStrained()) {
|
||||
m_twoPointControl = twoPointControl;
|
||||
} else {
|
||||
throw CanteraError("StFlow::enableTwoPointControl",
|
||||
throw CanteraError("Flow1D::enableTwoPointControl",
|
||||
"Invalid operation: two-point control can only be used"
|
||||
"with axisymmetric flames.");
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
// at https://cantera.org/license.txt for license and copyright information.
|
||||
|
||||
#include "cantera/oneD/IonFlow.h"
|
||||
#include "cantera/oneD/StFlow.h"
|
||||
#include "cantera/oneD/Flow1D.h"
|
||||
#include "cantera/oneD/refine.h"
|
||||
#include "cantera/transport/Transport.h"
|
||||
#include "cantera/numerics/funcs.h"
|
||||
@@ -16,7 +16,7 @@ namespace Cantera
|
||||
{
|
||||
|
||||
IonFlow::IonFlow(ThermoPhase* ph, size_t nsp, size_t points) :
|
||||
StFlow(ph, nsp, points)
|
||||
Flow1D(ph, nsp, points)
|
||||
{
|
||||
// make a local copy of species charge
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
@@ -82,7 +82,7 @@ string IonFlow::domainType() const {
|
||||
}
|
||||
|
||||
void IonFlow::resize(size_t components, size_t points){
|
||||
StFlow::resize(components, points);
|
||||
Flow1D::resize(components, points);
|
||||
m_mobility.resize(m_nsp*m_points);
|
||||
m_do_species.resize(m_nsp,true);
|
||||
m_do_electric_field.resize(m_points,false);
|
||||
@@ -93,13 +93,13 @@ bool IonFlow::componentActive(size_t n) const
|
||||
if (n == c_offset_E) {
|
||||
return true;
|
||||
} else {
|
||||
return StFlow::componentActive(n);
|
||||
return Flow1D::componentActive(n);
|
||||
}
|
||||
}
|
||||
|
||||
void IonFlow::updateTransport(double* x, size_t j0, size_t j1)
|
||||
{
|
||||
StFlow::updateTransport(x,j0,j1);
|
||||
Flow1D::updateTransport(x,j0,j1);
|
||||
for (size_t j = j0; j < j1; j++) {
|
||||
setGasAtMidpoint(x,j);
|
||||
m_trans->getMobilities(&m_mobility[j*m_nsp]);
|
||||
@@ -202,7 +202,7 @@ void IonFlow::setSolvingStage(const size_t stage)
|
||||
void IonFlow::evalElectricField(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax)
|
||||
{
|
||||
StFlow::evalElectricField(x, rsd, diag, rdt, jmin, jmax);
|
||||
Flow1D::evalElectricField(x, rsd, diag, rdt, jmin, jmax);
|
||||
if (m_stage != 2) {
|
||||
return;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ void IonFlow::evalElectricField(double* x, double* rsd, int* diag,
|
||||
void IonFlow::evalSpecies(double* x, double* rsd, int* diag,
|
||||
double rdt, size_t jmin, size_t jmax)
|
||||
{
|
||||
StFlow::evalSpecies(x, rsd, diag, rdt, jmin, jmax);
|
||||
Flow1D::evalSpecies(x, rsd, diag, rdt, jmin, jmax);
|
||||
if (m_stage != 2) {
|
||||
return;
|
||||
}
|
||||
@@ -311,7 +311,7 @@ void IonFlow::setElectronTransport(vector<double>& tfix, vector<double>& diff_e,
|
||||
|
||||
void IonFlow::_finalize(const double* x)
|
||||
{
|
||||
StFlow::_finalize(x);
|
||||
Flow1D::_finalize(x);
|
||||
|
||||
bool p = m_do_electric_field[0];
|
||||
if (p) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "cantera/oneD/Sim1D.h"
|
||||
#include "cantera/oneD/MultiJac.h"
|
||||
#include "cantera/oneD/StFlow.h"
|
||||
#include "cantera/oneD/Flow1D.h"
|
||||
#include "cantera/oneD/MultiNewton.h"
|
||||
#include "cantera/oneD/refine.h"
|
||||
#include "cantera/numerics/funcs.h"
|
||||
@@ -622,7 +622,7 @@ int Sim1D::setFixedTemperature(double t)
|
||||
size_t mfixed = npos;
|
||||
|
||||
// loop over current grid to determine where new point is needed
|
||||
StFlow* d_free = dynamic_cast<StFlow*>(&domain(n));
|
||||
Flow1D* d_free = dynamic_cast<Flow1D*>(&domain(n));
|
||||
size_t npnow = d.nPoints();
|
||||
size_t nstart = znew.size();
|
||||
if (d_free && d_free->isFree()) {
|
||||
@@ -702,7 +702,7 @@ double Sim1D::fixedTemperature()
|
||||
{
|
||||
double t_fixed = std::numeric_limits<double>::quiet_NaN();
|
||||
for (size_t n = 0; n < nDomains(); n++) {
|
||||
StFlow* d = dynamic_cast<StFlow*>(&domain(n));
|
||||
Flow1D* d = dynamic_cast<Flow1D*>(&domain(n));
|
||||
if (d && d->isFree() && d->m_tfixed > 0) {
|
||||
t_fixed = d->m_tfixed;
|
||||
break;
|
||||
@@ -715,7 +715,7 @@ double Sim1D::fixedTemperatureLocation()
|
||||
{
|
||||
double z_fixed = std::numeric_limits<double>::quiet_NaN();
|
||||
for (size_t n = 0; n < nDomains(); n++) {
|
||||
StFlow* d = dynamic_cast<StFlow*>(&domain(n));
|
||||
Flow1D* d = dynamic_cast<Flow1D*>(&domain(n));
|
||||
if (d && d->isFree() && d->m_tfixed > 0) {
|
||||
z_fixed = d->m_zfixed;
|
||||
break;
|
||||
@@ -735,7 +735,7 @@ void Sim1D::setLeftControlPoint(double temperature)
|
||||
continue;
|
||||
}
|
||||
|
||||
StFlow& d_axis = dynamic_cast<StFlow&>(domain(n));
|
||||
Flow1D& d_axis = dynamic_cast<Flow1D&>(domain(n));
|
||||
size_t np = d_axis.nPoints();
|
||||
|
||||
// Skip if two-point control is not enabled
|
||||
@@ -786,7 +786,7 @@ void Sim1D::setRightControlPoint(double temperature)
|
||||
continue;
|
||||
}
|
||||
|
||||
StFlow& d_axis = dynamic_cast<StFlow&>(domain(n));
|
||||
Flow1D& d_axis = dynamic_cast<Flow1D&>(domain(n));
|
||||
size_t np = d_axis.nPoints();
|
||||
|
||||
// Skip if two-point control is not enabled
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// at https://cantera.org/license.txt for license and copyright information.
|
||||
|
||||
#include "cantera/oneD/refine.h"
|
||||
#include "cantera/oneD/StFlow.h"
|
||||
#include "cantera/oneD/Flow1D.h"
|
||||
#include "cantera/base/global.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -144,7 +144,7 @@ int Refiner::analyze(size_t n, const double* z, const double* x)
|
||||
}
|
||||
}
|
||||
|
||||
StFlow* fflame = dynamic_cast<StFlow*>(m_domain);
|
||||
Flow1D* fflame = dynamic_cast<Flow1D*>(m_domain);
|
||||
|
||||
// Refine based on properties of the grid itself
|
||||
for (size_t j = 1; j < n-1; j++) {
|
||||
|
||||
@@ -26,7 +26,7 @@ TEST(ctonedim, freeflow)
|
||||
int flow = domain_new("free-flow", sol, "flow");
|
||||
ASSERT_GE(flow, 0);
|
||||
domain_setID(flow, "flow");
|
||||
ASSERT_NEAR(stflow_pressure(flow), P, 1e-5);
|
||||
ASSERT_NEAR(flow1D_pressure(flow), P, 1e-5);
|
||||
|
||||
int buflen = domain_type3(flow, 0, 0);
|
||||
char* buf = new char[buflen];
|
||||
@@ -56,10 +56,10 @@ TEST(ctonedim, freeflow_from_parts)
|
||||
thermo_setPressure(ph, P);
|
||||
|
||||
int itype = 2; // free flow
|
||||
int flow = stflow_new(ph, kin, tr, itype);
|
||||
int flow = flow1D_new(ph, kin, tr, itype);
|
||||
ASSERT_GE(flow, 0);
|
||||
domain_setID(flow, "flow");
|
||||
ASSERT_NEAR(stflow_pressure(flow), P, 1e-5);
|
||||
ASSERT_NEAR(flow1D_pressure(flow), P, 1e-5);
|
||||
|
||||
int buflen = domain_type3(flow, 0, 0);
|
||||
char* buf = new char[buflen];
|
||||
@@ -124,7 +124,7 @@ TEST(ctonedim, catcomb_stack)
|
||||
|
||||
// flow
|
||||
int itype = 1; // free flow
|
||||
int flow = stflow_new(gas, gas_kin, trans, itype);
|
||||
int flow = flow1D_new(gas, gas_kin, trans, itype);
|
||||
domain_setID(flow, "flow");
|
||||
|
||||
// reacting surface
|
||||
@@ -173,7 +173,7 @@ TEST(ctonedim, freeflame_from_parts)
|
||||
|
||||
// flow
|
||||
int itype = 2; // free flow
|
||||
int flow = stflow_new(ph, kin, tr, itype);
|
||||
int flow = flow1D_new(ph, kin, tr, itype);
|
||||
domain_setID(flow, "flow");
|
||||
|
||||
// grid
|
||||
@@ -232,7 +232,7 @@ TEST(ctonedim, freeflame_from_parts)
|
||||
sim1D_setFixedTemperature(flame, 0.85 * T + .15 * Tad);
|
||||
|
||||
// solve and save
|
||||
stflow_solveEnergyEqn(flow, 1);
|
||||
flow1D_solveEnergyEqn(flow, 1);
|
||||
bool refine_grid = false;
|
||||
int loglevel = 0;
|
||||
sim1D_solve(flame, loglevel, refine_grid);
|
||||
|
||||
@@ -35,7 +35,7 @@ TEST(onedim, freeflame)
|
||||
double Tad = gas->temperature();
|
||||
|
||||
// flow
|
||||
auto flow = newDomain<StFlow>("free-flow", sol, "flow");
|
||||
auto flow = newDomain<Flow1D>("free-flow", sol, "flow");
|
||||
|
||||
// grid
|
||||
int nz = 21;
|
||||
@@ -106,11 +106,11 @@ TEST(onedim, flame_types)
|
||||
{
|
||||
auto sol = newSolution("h2o2.yaml", "ohmech", "mixture-averaged");
|
||||
|
||||
auto free = newDomain<StFlow>("free-flow", sol, "flow");
|
||||
auto free = newDomain<Flow1D>("free-flow", sol, "flow");
|
||||
ASSERT_EQ(free->type(), "free-flow");
|
||||
auto symm = newDomain<StFlow>("axisymmetric-flow", sol, "flow");
|
||||
auto symm = newDomain<Flow1D>("axisymmetric-flow", sol, "flow");
|
||||
ASSERT_EQ(symm->type(), "axisymmetric-flow");
|
||||
auto burner = newDomain<StFlow>("unstrained-flow", sol, "flow");
|
||||
auto burner = newDomain<Flow1D>("unstrained-flow", sol, "flow");
|
||||
ASSERT_EQ(burner->type(), "unstrained-flow");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user