| Cantera 3.0.0

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
6#include "cantera/base/stringUtils.h"
7#include "cantera/numerics/Func1.h"
8#include "cantera/zeroD/Wall.h"
9
10 namespace Cantera
11{
12
13 bool WallBase::install(ReactorBase& rleft, ReactorBase& rright)
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",
40 "To be removed after Cantera 3.0; replaceable by 'expansionRate'.");
41 double rate = m_k * m_area * (m_left->pressure() - m_right->pressure());
42
43 if (m_vf) {
44 rate += m_area * m_vf->eval(t);
45 }
46 return rate;
47}
48
49 double Wall::expansionRate()
50{
51 double rate = m_k * m_area * (m_left->pressure() - m_right->pressure());
52
53 if (m_vf) {
54 rate += m_area * m_vf->eval(m_time);
55 }
56 return rate;
57}
58
59 double Wall::heatFlux() const {
60 if (m_qf) {
61 return m_qf->eval(m_time);
62 }
63 return 0.;
64}
65
66 double Wall::Q(double t)
67{
68 warn_deprecated("Wall::Q",
69 "To be removed after Cantera 3.0; replaceable by 'heatRate'.");
70 double q1 = (m_area * m_rrth) *
71 (m_left->temperature() - m_right->temperature());
72 if (m_emiss > 0.0) {
73 double tl = m_left->temperature();
74 double tr = m_right->temperature();
75 q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
76 }
77
78 if (m_qf) {
79 q1 += m_area * m_qf->eval(t);
80 }
81 return q1;
82}
83
84 double Wall::heatRate()
85{
86 double q1 = (m_area * m_rrth) *
87 (m_left->temperature() - m_right->temperature());
88 if (m_emiss > 0.0) {
89 double tl = m_left->temperature();
90 double tr = m_right->temperature();
91 q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
92 }
93
94 if (m_qf) {
95 q1 += m_area * m_qf->eval(m_time);
96 }
97 return q1;
98}
99
100}
Func1.h
Wall.h
Header file for base class WallBase.
Cantera::Func1::eval
virtual double eval(double t) const
Evaluate the function.
Definition Func1.cpp:61
Cantera::ReactorBase
Base class for stirred reactors.
Definition ReactorBase.h:50
Cantera::ReactorBase::pressure
double pressure() const
Returns the current pressure (Pa) of the reactor.
Definition ReactorBase.h:224
Cantera::ReactorBase::addWall
void addWall(WallBase &w, int lr)
Insert a Wall between this reactor and another reactor.
Definition ReactorBase.cpp:51
Cantera::ReactorBase::temperature
double temperature() const
Returns the current temperature (K) of the reactor's contents.
Definition ReactorBase.h:209
Cantera::WallBase::install
bool install(ReactorBase &leftReactor, ReactorBase &rightReactor)
Install the wall between two reactors or reservoirs.
Definition Wall.cpp:13
Cantera::WallBase::m_time
double m_time
current reactor network time
Definition Wall.h:123
Cantera::WallBase::setArea
virtual void setArea(double a)
Set the area [m^2].
Definition Wall.cpp:26
Cantera::Wall::m_vf
Func1 * m_vf
Velocity function.
Definition Wall.h:270
Cantera::Wall::heatFlux
double heatFlux() const
Heat flux function evaluated at current reactor network time.
Definition Wall.cpp:59
Cantera::Wall::vdot
double vdot(double t) override
Rate of volume change (m^3/s) for the adjacent reactors.
Definition Wall.cpp:37
Cantera::Wall::heatRate
double heatRate() override
Heat flow rate through the wall (W).
Definition Wall.cpp:84
Cantera::Wall::m_rrth
double m_rrth
heat transfer coefficient
Definition Wall.h:264
Cantera::Wall::m_qf
Func1 * m_qf
Heat flux function.
Definition Wall.h:273
Cantera::Wall::m_k
double m_k
expansion rate coefficient
Definition Wall.h:261
Cantera::Wall::Q
double Q(double t) override
Heat flow rate through the wall (W).
Definition Wall.cpp:66
Cantera::Wall::velocity
double velocity() const
Wall velocity at current reactor network time.
Definition Wall.cpp:30
Cantera::Wall::expansionRate
double expansionRate() override
Rate of volume change (m^3/s) for the adjacent reactors.
Definition Wall.cpp:49
Cantera::Wall::m_emiss
double m_emiss
emissivity
Definition Wall.h:267
Cantera::StefanBoltz
const double StefanBoltz
Stefan-Boltzmann constant [W/m2/K4].
Definition ct_defs.h:128
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::warn_deprecated
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
stringUtils.h
Contains declarations for string manipulation functions within Cantera.