Cantera  3.1.0a1
Wall.cpp
Go to the documentation of this file.
1 //! @file Wall.cpp
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at https://cantera.org/license.txt for license and copyright information.
5 
8 #include "cantera/zeroD/Wall.h"
9 
10 namespace Cantera
11 {
12 
14 {
15  // check if wall is already installed
16  if (m_left || m_right) {
17  return false;
18  }
19  m_left = &rleft;
20  m_right = &rright;
21  m_left->addWall(*this, 0);
22  m_right->addWall(*this, 1);
23  return true;
24 }
25 
26 void WallBase::setArea(double a) {
27  m_area = a;
28 }
29 
30 double Wall::velocity() const {
31  if (m_vf) {
32  return m_vf->eval(m_time);
33  }
34  return 0.;
35 }
36 
37 double Wall::vdot(double t)
38 {
39  warn_deprecated("Wall::vdot", "To be removed; replaceable by 'expansionRate'.");
40  double rate = m_k * m_area * (m_left->pressure() - m_right->pressure());
41 
42  if (m_vf) {
43  rate += m_area * m_vf->eval(t);
44  }
45  return rate;
46 }
47 
49 {
50  double rate = m_k * m_area * (m_left->pressure() - m_right->pressure());
51 
52  if (m_vf) {
53  rate += m_area * m_vf->eval(m_time);
54  }
55  return rate;
56 }
57 
58 double Wall::heatFlux() const {
59  if (m_qf) {
60  return m_qf->eval(m_time);
61  }
62  return 0.;
63 }
64 
65 double Wall::Q(double t)
66 {
67  warn_deprecated("Wall::Q", "To be removed; replaceable by 'heatRate'.");
68  double q1 = (m_area * m_rrth) *
69  (m_left->temperature() - m_right->temperature());
70  if (m_emiss > 0.0) {
71  double tl = m_left->temperature();
72  double tr = m_right->temperature();
73  q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
74  }
75 
76  if (m_qf) {
77  q1 += m_area * m_qf->eval(t);
78  }
79  return q1;
80 }
81 
83 {
84  double q1 = (m_area * m_rrth) *
85  (m_left->temperature() - m_right->temperature());
86  if (m_emiss > 0.0) {
87  double tl = m_left->temperature();
88  double tr = m_right->temperature();
89  q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
90  }
91 
92  if (m_qf) {
93  q1 += m_area * m_qf->eval(m_time);
94  }
95  return q1;
96 }
97 
98 }
Header file for base class WallBase.
virtual double eval(double t) const
Evaluate the function.
Definition: Func1.cpp:28
Base class for stirred reactors.
Definition: ReactorBase.h:50
double pressure() const
Returns the current pressure (Pa) of the reactor.
Definition: ReactorBase.h:224
void addWall(WallBase &w, int lr)
Insert a Wall between this reactor and another reactor.
Definition: ReactorBase.cpp:51
double temperature() const
Returns the current temperature (K) of the reactor's contents.
Definition: ReactorBase.h:209
bool install(ReactorBase &leftReactor, ReactorBase &rightReactor)
Install the wall between two reactors or reservoirs.
Definition: Wall.cpp:13
double m_time
current reactor network time
Definition: Wall.h:123
virtual void setArea(double a)
Set the area [m^2].
Definition: Wall.cpp:26
Func1 * m_vf
Velocity function.
Definition: Wall.h:270
double heatFlux() const
Heat flux function evaluated at current reactor network time.
Definition: Wall.cpp:58
double vdot(double t) override
Rate of volume change (m^3/s) for the adjacent reactors.
Definition: Wall.cpp:37
double heatRate() override
Heat flow rate through the wall (W).
Definition: Wall.cpp:82
double m_rrth
heat transfer coefficient
Definition: Wall.h:264
Func1 * m_qf
Heat flux function.
Definition: Wall.h:273
double m_k
expansion rate coefficient
Definition: Wall.h:261
double Q(double t) override
Heat flow rate through the wall (W).
Definition: Wall.cpp:65
double velocity() const
Wall velocity at current reactor network time.
Definition: Wall.cpp:30
double expansionRate() override
Rate of volume change (m^3/s) for the adjacent reactors.
Definition: Wall.cpp:48
double m_emiss
emissivity
Definition: Wall.h:267
const double StefanBoltz
Stefan-Boltzmann constant [W/m2/K4].
Definition: ct_defs.h:128
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
Definition: AnyMap.cpp:1926
Contains declarations for string manipulation functions within Cantera.