Cantera 2.6.0

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#include "cantera/thermo/SurfPhase.h"
10
11 namespace Cantera
12{
13
14WallBase::WallBase() : m_left(0), m_right(0), m_surf(2), m_area(1.0) {}
15
16 bool WallBase::install(ReactorBase& rleft, ReactorBase& rright)
17{
18 // check if wall is already installed
19 if (m_left || m_right) {
20 return false;
21 }
22 m_left = &rleft;
23 m_right = &rright;
24 m_left->addWall(*this, 0);
25 m_right->addWall(*this, 1);
26 m_surf[0].setReactor(&rleft);
27 m_surf[1].setReactor(&rright);
28 return true;
29}
30
31 void WallBase::setArea(double a) {
32 m_area = a;
33 m_surf[0].setArea(a);
34 m_surf[1].setArea(a);
35}
36
37Wall::Wall() : WallBase(), m_k(0.0), m_rrth(0.0), m_emiss(0.0), m_vf(0), m_qf(0) {}
38
39 double Wall::vdot(double t)
40{
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::Q(double t)
50{
51 double q1 = (m_area * m_rrth) *
52 (m_left->temperature() - m_right->temperature());
53 if (m_emiss > 0.0) {
54 double tl = m_left->temperature();
55 double tr = m_right->temperature();
56 q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
57 }
58
59 if (m_qf) {
60 q1 += m_area * m_qf->eval(t);
61 }
62 return q1;
63}
64
65}
Func1.h
SurfPhase.h
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
Wall.h
Header file for base class WallBase.
Cantera::Func1::eval
virtual doublereal eval(doublereal t) const
Evaluate the function.
Definition: Func1.cpp:60
Cantera::ReactorBase
Base class for stirred reactors.
Definition: ReactorBase.h:49
Cantera::ReactorBase::pressure
doublereal pressure() const
Returns the current pressure (Pa) of the reactor.
Definition: ReactorBase.h:228
Cantera::ReactorBase::addWall
void addWall(WallBase &w, int lr)
Insert a Wall between this reactor and another reactor.
Definition: ReactorBase.cpp:58
Cantera::ReactorBase::temperature
doublereal temperature() const
Returns the current temperature (K) of the reactor's contents.
Definition: ReactorBase.h:213
Cantera::WallBase
Base class for 'walls' (walls, pistons, etc.) connecting reactors.
Definition: Wall.h:25
Cantera::Wall::m_vf
Func1 * m_vf
Velocity function.
Definition: Wall.h:198
Cantera::Wall::m_rrth
double m_rrth
heat transfer coefficient
Definition: Wall.h:192
Cantera::Wall::m_qf
Func1 * m_qf
Heat flux function.
Definition: Wall.h:201
Cantera::Wall::m_k
double m_k
expansion rate coefficient
Definition: Wall.h:189
Cantera::Wall::m_emiss
double m_emiss
emissivity
Definition: Wall.h:195
Cantera::Wall::Q
virtual double Q(double t)
Heat flow rate through the wall (W).
Definition: Wall.cpp:49
Cantera::Wall::vdot
virtual double vdot(double t)
Rate of volume change (m^3/s) for the adjacent reactors.
Definition: Wall.cpp:39
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::StefanBoltz
const double StefanBoltz
Stefan-Boltzmann constant [W/m2/K4].
Definition: ct_defs.h:125
stringUtils.h
Contains declarations for string manipulation functions within Cantera.