Cantera  3.1.0a1
Loading...
Searching...
No Matches
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
9
10namespace 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
26void WallBase::setArea(double a) {
27 m_area = a;
28}
29
30double Wall::velocity() const {
31 if (m_vf) {
32 return m_vf->eval(m_time);
33 }
34 return 0.;
35}
36
37double Wall::vdot(double t)
38{
39 warn_deprecated("Wall::vdot", "To be removed; replaceable by 'expansionRate'.");
40 if (!ready()) {
41 throw CanteraError("Wall::vdot",
42 "Wall is not ready; some parameters have not been set.");
43 }
44 double rate = m_k * m_area * (m_left->pressure() - m_right->pressure());
45
46 if (m_vf) {
47 rate += m_area * m_vf->eval(t);
48 }
49 return rate;
50}
51
53{
54 if (!ready()) {
55 throw CanteraError("Wall::expansionRate",
56 "Wall is not ready; some parameters have not been set.");
57 }
58 double rate = m_k * m_area * (m_left->pressure() - m_right->pressure());
59
60 if (m_vf) {
61 rate += m_area * m_vf->eval(m_time);
62 }
63 return rate;
64}
65
66double Wall::heatFlux() const {
67 if (m_qf) {
68 return m_qf->eval(m_time);
69 }
70 return 0.;
71}
72
73double Wall::Q(double t)
74{
75 warn_deprecated("Wall::Q", "To be removed; replaceable by 'heatRate'.");
76 if (!ready()) {
77 throw CanteraError("Wall::Q",
78 "Wall is not ready; some parameters have not been set.");
79 }
80 double q1 = (m_area * m_rrth) *
81 (m_left->temperature() - m_right->temperature());
82 if (m_emiss > 0.0) {
83 double tl = m_left->temperature();
84 double tr = m_right->temperature();
85 q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
86 }
87
88 if (m_qf) {
89 q1 += m_area * m_qf->eval(t);
90 }
91 return q1;
92}
93
95{
96 if (!ready()) {
97 throw CanteraError("Wall::heatRate",
98 "Wall is not ready; some parameters have not been set.");
99 }
100 double q1 = (m_area * m_rrth) *
101 (m_left->temperature() - m_right->temperature());
102 if (m_emiss > 0.0) {
103 double tl = m_left->temperature();
104 double tr = m_right->temperature();
105 q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
106 }
107
108 if (m_qf) {
109 q1 += m_area * m_qf->eval(m_time);
110 }
111 return q1;
112}
113
114}
Header file for base class WallBase.
Base class for exceptions thrown by Cantera classes.
virtual double eval(double t) const
Evaluate the function.
Definition Func1.cpp:28
Base class for stirred reactors.
Definition ReactorBase.h:51
double pressure() const
Returns the current pressure (Pa) of the reactor.
void addWall(WallBase &w, int lr)
Insert a Wall between this reactor and another reactor.
double temperature() const
Returns the current temperature (K) of the reactor's contents.
bool install(ReactorBase &leftReactor, ReactorBase &rightReactor)
Install the wall between two reactors or reservoirs.
Definition Wall.cpp:13
virtual bool ready()
True if the wall is correctly configured and ready to use.
Definition Wall.h:96
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:66
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:94
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:73
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:52
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.