Cantera
Install
User Guide
Examples
Reference
Develop
Community
4.0.0a2
Toggle main menu visibility
Loading...
Searching...
No Matches
Interface.cpp
Go to the documentation of this file.
1
//! @file Interface.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/Interface.h
"
7
#include "
cantera/thermo/ThermoFactory.h
"
8
#include "
cantera/kinetics/KineticsFactory.h
"
9
10
namespace
Cantera
11
{
12
13
void
Interface::setThermo
(shared_ptr<ThermoPhase>
thermo
) {
14
Solution::setThermo
(
thermo
);
15
auto
surf = std::dynamic_pointer_cast<SurfPhase>(
thermo
);
16
if
(!surf) {
17
throw
CanteraError
(
"Interface::setThermo"
,
18
"Thermo object of type '{}' does not descend from SurfPhase."
,
19
thermo
->type());
20
}
21
m_surf
= surf;
22
}
23
24
void
Interface::setKinetics
(shared_ptr<Kinetics>
kinetics
) {
25
Solution::setKinetics
(
kinetics
);
26
auto
surfkin = std::dynamic_pointer_cast<InterfaceKinetics>(
kinetics
);
27
if
(!surfkin) {
28
throw
CanteraError
(
"Interface::setKinetics"
,
29
"Kinetics object of type '{}' does not descend from InterfaceKinetics."
,
30
kinetics
->kineticsType());
31
}
32
m_surfkin
= surfkin;
33
}
34
35
shared_ptr<Interface>
newInterface
(
const
string
& infile,
36
const
string
& name,
const
vector<string>& adjacent)
37
{
38
auto
sol =
newSolution
(infile, name,
"default"
, adjacent);
39
auto
iface = std::dynamic_pointer_cast<Interface>(sol);
40
if
(!iface) {
41
auto
rootNode =
AnyMap::fromYamlFile
(infile);
42
AnyMap
& phaseNode = rootNode[
"phases"
].getMapWhere(
"name"
, name);
43
throw
InputFileError
(
"newInterface"
, phaseNode,
44
"Phase definition does not define a surface phase"
);
45
}
46
return
iface;
47
}
48
49
shared_ptr<Interface>
newInterface
(
const
string
& infile,
50
const
string
& name,
const
vector<shared_ptr<Solution>>& adjacent)
51
{
52
auto
rootNode =
AnyMap::fromYamlFile
(infile);
53
AnyMap
& phaseNode = rootNode[
"phases"
].getMapWhere(
"name"
, name);
54
return
newInterface
(phaseNode, rootNode, adjacent);
55
}
56
57
shared_ptr<Interface>
newInterface
(
AnyMap
& phaseNode,
const
AnyMap
& rootNode,
58
const
vector<shared_ptr<Solution>>& adjacent)
59
{
60
auto
sol =
newSolution
(phaseNode, rootNode,
"default"
, adjacent);
61
auto
iface = std::dynamic_pointer_cast<Interface>(sol);
62
if
(!iface) {
63
throw
InputFileError
(
"newInterface"
, phaseNode,
64
"Phase definition does not define a surface phase"
);
65
}
66
return
iface;
67
}
68
69
}
// end namespace Cantera
Interface.h
KineticsFactory.h
ThermoFactory.h
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition
AnyMap.h:431
Cantera::AnyMap::fromYamlFile
static AnyMap fromYamlFile(const string &name, const string &parent_name="")
Create an AnyMap from a YAML file.
Definition
AnyMap.cpp:1841
Cantera::CanteraError
Base class for exceptions thrown by Cantera classes.
Definition
ctexceptions.h:66
Cantera::InputFileError
Error thrown for problems processing information contained in an AnyMap or AnyValue.
Definition
AnyMap.h:749
Cantera::Interface::m_surfkin
shared_ptr< InterfaceKinetics > m_surfkin
Kinetics manager.
Definition
Interface.h:55
Cantera::Interface::setThermo
void setThermo(shared_ptr< ThermoPhase > thermo) override
Set the reacting phase thermo object.
Definition
Interface.cpp:13
Cantera::Interface::kinetics
shared_ptr< InterfaceKinetics > kinetics()
Get the surface phase Kinetics object.
Definition
Interface.h:49
Cantera::Interface::thermo
shared_ptr< SurfPhase > thermo()
Get the surface phase thermo object.
Definition
Interface.h:44
Cantera::Interface::setKinetics
void setKinetics(shared_ptr< Kinetics > kinetics) override
Set the Kinetics object.
Definition
Interface.cpp:24
Cantera::Interface::m_surf
shared_ptr< SurfPhase > m_surf
Surface phase ThermoPhase manager.
Definition
Interface.h:54
Cantera::Solution::setThermo
virtual void setThermo(shared_ptr< ThermoPhase > thermo)
Set the ThermoPhase object.
Definition
Solution.cpp:84
Cantera::Solution::setKinetics
virtual void setKinetics(shared_ptr< Kinetics > kinetics)
Set the Kinetics object.
Definition
Solution.cpp:92
Cantera::newSolution
shared_ptr< Solution > newSolution(const string &infile, const string &name, const string &transport, const vector< shared_ptr< Solution > > &adjacent)
Create and initialize a new Solution manager from an input file.
Definition
Solution.cpp:242
Cantera::newInterface
shared_ptr< Interface > newInterface(const string &infile, const string &name, const vector< string > &adjacent)
Create and initialize a new Interface from an input file.
Definition
Interface.cpp:35
Cantera
Namespace for the Cantera kernel.
Definition
AnyMap.cpp:595
src
base
Interface.cpp
Generated by
1.17.0