Cantera  3.3.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
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 throw CanteraError("WallBase::WallBase",
18 "Reactors must be provided to WallBase constructor.");
19 }
20 m_left = r0.get();
21 m_right = r1.get();
22 m_left->addWall(*this, 0);
23 m_right->addWall(*this, 1);
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::expansionRate()
38{
39 if (!ready()) {
40 throw CanteraError("Wall::expansionRate",
41 "Wall is not ready; some parameters have not been set.");
42 }
43 double rate = m_k * m_area * (m_left->pressure() - m_right->pressure());
44
45 if (m_vf) {
46 rate += m_area * m_vf->eval(m_time);
47 }
48 return rate;
49}
50
51double Wall::heatFlux() const {
52 if (m_qf) {
53 return m_qf->eval(m_time);
54 }
55 return 0.;
56}
57
58double Wall::heatRate()
59{
60 if (!ready()) {
61 throw CanteraError("Wall::heatRate",
62 "Wall is not ready; some parameters have not been set.");
63 }
64 double q1 = (m_area * m_rrth) *
65 (m_left->temperature() - m_right->temperature());
66 if (m_emiss > 0.0) {
67 double tl = m_left->temperature();
68 double tr = m_right->temperature();
69 q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
70 }
71
72 if (m_qf) {
73 q1 += m_area * m_qf->eval(m_time);
74 }
75 return q1;
76}
77
78}
Header file for base class WallBase.
Base class for exceptions thrown by Cantera classes.
const double StefanBoltz
Stefan-Boltzmann constant [W/m2/K4].
Definition ct_defs.h:128
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
Contains declarations for string manipulation functions within Cantera.