Loading [MathJax]/jax/output/HTML-CSS/config.js
Cantera  3.2.0a1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
13WallBase::WallBase(shared_ptr<ReactorBase> r0, shared_ptr<ReactorBase> r1,
14 const string& name) : ConnectorNode(r0, r1, name)
15{
16 if (!m_nodes.first || !m_nodes.second) {
17 warn_deprecated("FlowDevice::FlowDevice",
18 "After Cantera 3.2, Reactors must be provided to a FlowDevice "
19 "constructor.");
20 return;
21 }
22 m_left = r0.get();
23 m_right = r1.get();
24 m_left->addWall(*this, 0);
25 m_right->addWall(*this, 1);
26}
27
28bool WallBase::install(ReactorBase& rleft, ReactorBase& rright)
29{
30 warn_deprecated("WallBase::install",
31 "To be removed after Cantera 3.2. Reactors should be provided to constructor "
32 "instead.");
33 // check if wall is already installed
34 if (m_left || m_right) {
35 return false;
36 }
37 m_left = &rleft;
38 m_right = &rright;
39 m_left->addWall(*this, 0);
40 m_right->addWall(*this, 1);
41 return true;
42}
43
44void WallBase::setArea(double a) {
45 m_area = a;
46}
47
48double Wall::velocity() const {
49 if (m_vf) {
50 return m_vf->eval(m_time);
51 }
52 return 0.;
53}
54
55double Wall::expansionRate()
56{
57 if (!ready()) {
58 throw CanteraError("Wall::expansionRate",
59 "Wall is not ready; some parameters have not been set.");
60 }
61 double rate = m_k * m_area * (m_left->pressure() - m_right->pressure());
62
63 if (m_vf) {
64 rate += m_area * m_vf->eval(m_time);
65 }
66 return rate;
67}
68
69double Wall::heatFlux() const {
70 if (m_qf) {
71 return m_qf->eval(m_time);
72 }
73 return 0.;
74}
75
76double Wall::heatRate()
77{
78 if (!ready()) {
79 throw CanteraError("Wall::heatRate",
80 "Wall is not ready; some parameters have not been set.");
81 }
82 double q1 = (m_area * m_rrth) *
83 (m_left->temperature() - m_right->temperature());
84 if (m_emiss > 0.0) {
85 double tl = m_left->temperature();
86 double tr = m_right->temperature();
87 q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
88 }
89
90 if (m_qf) {
91 q1 += m_area * m_qf->eval(m_time);
92 }
93 return q1;
94}
95
96}
Header file for base class WallBase.
Base class for exceptions thrown by Cantera classes.
Base class for stirred reactors.
Definition ReactorBase.h:49
void addWall(WallBase &w, int lr)
Insert a Wall between this reactor and another reactor.
const double StefanBoltz
Stefan-Boltzmann constant [W/m2/K4].
Definition ct_defs.h:128
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
Definition AnyMap.cpp:1997
Contains declarations for string manipulation functions within Cantera.