22 const int cFlowType = 50;
23 const int cConnectorType = 100;
24 const int cSurfType = 102;
25 const int cInletType = 104;
26 const int cSymmType = 105;
27 const int cOutletType = 106;
28 const int cEmptyType = 107;
29 const int cOutletResType = 108;
30 const int cPorousType = 109;
49 doublereal time = 0.0) :
61 m_refiner(0), m_bw(-1) {
86 return (m_type >= cConnectorType);
108 void setBandwidth(
int bw = -1) {
140 virtual void setInitialState(doublereal* xlocal = 0) {}
141 virtual void setState(
size_t point,
const doublereal* state, doublereal* x) {}
148 virtual void resize(
size_t nv,
size_t np) {
151 if (nv != m_nv || !m_refiner) {
154 m_refiner =
new Refiner(*
this);
157 m_td.resize(m_nv, 1);
158 m_name.resize(m_nv,
"");
159 m_max.resize(m_nv, 0.0);
160 m_min.resize(m_nv, 0.0);
161 m_rtol_ss.resize(m_nv, 1.0e-8);
162 m_atol_ss.resize(m_nv, 1.0e-15);
163 m_rtol_ts.resize(m_nv, 1.0e-8);
164 m_atol_ts.resize(m_nv, 1.0e-15);
167 m_slast.resize(m_nv * m_points, 0.0);
185 throw IndexError(
"checkComponentIndex",
"points", n, m_nv-1);
207 throw IndexError(
"checkPointIndex",
"points", n, m_points-1);
222 if (m_name[n] !=
"") {
225 return "component " +
int2str(n);
229 void setComponentName(
size_t n, std::string name) {
233 void setComponentType(
size_t n,
int ctype) {
242 for (
size_t n = 0; n < nc; n++) {
248 "no component named "+name);
255 size_t nu,
const doublereal* upper) {
256 if (nl < m_nv || nu < m_nv)
258 "wrong array size for solution bounds. "
259 "Size should be at least "+
int2str(m_nv));
260 std::copy(upper, upper + m_nv, m_max.begin());
261 std::copy(lower, lower + m_nv, m_min.begin());
264 void setBounds(
size_t n, doublereal lower, doublereal upper) {
271 size_t na,
const doublereal*
atol,
int ts = 0);
280 void setTolerancesTS(doublereal
rtol, doublereal
atol);
282 void setTolerancesSS(doublereal
rtol, doublereal
atol);
286 return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]);
291 return (m_rdt == 0.0 ? m_atol_ss[n] : m_atol_ts[n]);
311 std::copy(x0 +
loc(), x0 +
loc() + size(), m_slast.begin());
325 return (m_rdt == 0.0);
330 return (m_rdt != 0.0);
345 void evalss(doublereal* x, doublereal* r, integer* mask) {
356 virtual void eval(
size_t j, doublereal* x, doublereal* r,
357 integer* mask, doublereal rdt=0.0);
359 virtual doublereal residual(doublereal* x,
size_t n,
size_t j) {
360 throw CanteraError(
"Domain1D::residual",
"residual function must be overloaded in derived class "+
id());
363 int timeDerivativeFlag(
size_t n) {
366 void setAlgebraic(
size_t n) {
375 doublereal time()
const {
378 void incrementTime(doublereal dt) {
381 size_t index(
size_t n,
size_t j)
const {
384 doublereal value(
const doublereal* x,
size_t n,
size_t j)
const {
385 return x[index(n,j)];
388 virtual void setJac(MultiJac* jac) {}
402 throw CanteraError(
"Domain1D::save",
"base class method called");
405 size_t size()
const {
406 return m_nv*m_points;
438 virtual size_t loc(
size_t j = 0)
const {
455 return m_jstart + m_points - 1;
501 return m_slast[m_nv*j + n];
511 std::string id()
const {
515 return std::string(
"domain ") +
int2str(m_index);
525 const std::string& desc() {
529 virtual void getTransientMask(integer* mask) {}
531 virtual void showSolution_s(std::ostream& s,
const doublereal* x) {}
534 virtual void restore(
const XML_Node& dom, doublereal* soln) {}
536 doublereal z(
size_t jlocal)
const {
539 doublereal zmin()
const {
542 doublereal zmax()
const {
543 return m_z[m_points - 1];
547 void setProfile(std::string name, doublereal* values, doublereal* soln) {
548 for (
size_t n = 0; n < m_nv; n++) {
550 for (
size_t j = 0; j < m_points; j++) {
551 soln[index(n, j) +
m_iloc] = values[j];
556 throw CanteraError(
"Domain1D::setProfile",
557 "unknown component: "+name);
566 doublereal grid(
size_t point) {
570 virtual void setupGrid(
size_t n,
const doublereal* z);
572 void setGrid(
size_t n,
const doublereal* z);
639 std::vector<std::string> m_name;