| Cantera 3.0.0

Loading...
Searching...
No Matches
DomainFactory.cpp
Go to the documentation of this file.
1//! @file DomainFactory.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/oneD/DomainFactory.h"
7#include "cantera/oneD/Boundary1D.h"
8#include "cantera/oneD/StFlow.h"
9#include "cantera/oneD/IonFlow.h"
10#include "cantera/transport/Transport.h"
11
12 namespace Cantera
13{
14
15DomainFactory* DomainFactory::s_factory = 0;
16std::mutex DomainFactory::domain_mutex;
17
18 DomainFactory::DomainFactory()
19{
20 reg("inlet", [](shared_ptr<Solution> solution, const string& id) {
21 return new Inlet1D(solution, id);
22 });
23 reg("empty", [](shared_ptr<Solution> solution, const string& id) {
24 return new Empty1D(solution, id);
25 });
26 reg("symmetry-plane", [](shared_ptr<Solution> solution, const string& id) {
27 return new Symm1D(solution, id);
28 });
29 reg("outlet", [](shared_ptr<Solution> solution, const string& id) {
30 return new Outlet1D(solution, id);
31 });
32 reg("outlet-reservoir", [](shared_ptr<Solution> solution, const string& id) {
33 return new OutletRes1D(solution, id);
34 });
35 reg("surface", [](shared_ptr<Solution> solution, const string& id) {
36 return new Surf1D(solution, id);
37 });
38 reg("reacting-surface", [](shared_ptr<Solution> solution, const string& id) {
39 return new ReactingSurf1D(solution, id);
40 });
41 reg("gas-flow", [](shared_ptr<Solution> solution, const string& id) {
42 return new StFlow(solution, id);
43 });
44 reg("ion-flow", [](shared_ptr<Solution> solution, const string& id) {
45 return new IonFlow(solution, id);
46 });
47 reg("free-flow", [](shared_ptr<Solution> solution, const string& id) {
48 StFlow* ret;
49 if (solution->transport()->transportModel() == "ionized-gas") {
50 ret = new IonFlow(solution, id);
51 } else {
52 ret = new StFlow(solution, id);
53 }
54 ret->setFreeFlow();
55 return ret;
56 });
57 reg("axisymmetric-flow", [](shared_ptr<Solution> solution, const string& id) {
58 StFlow* ret;
59 if (solution->transport()->transportModel() == "ionized-gas") {
60 ret = new IonFlow(solution, id);
61 } else {
62 ret = new StFlow(solution, id);
63 }
64 ret->setAxisymmetricFlow();
65 return ret;
66 });
67 reg("unstrained-flow", [](shared_ptr<Solution> solution, const string& id) {
68 StFlow* ret;
69 if (solution->transport()->transportModel() == "ionized-gas") {
70 ret = new IonFlow(solution, id);
71 } else {
72 ret = new StFlow(solution, id);
73 }
74 ret->setUnstrainedFlow();
75 return ret;
76 });
77}
78
79 DomainFactory* DomainFactory::factory()
80{
81 std::unique_lock<std::mutex> lock(domain_mutex);
82 if (!s_factory) {
83 s_factory = new DomainFactory;
84 }
85 return s_factory;
86}
87
88 void DomainFactory::deleteFactory()
89{
90 std::unique_lock<std::mutex> lock(domain_mutex);
91 delete s_factory;
92 s_factory = 0;
93}
94
95}
Boundary1D.h
Boundary objects for one-dimensional simulations.
DomainFactory.h
IonFlow.h
StFlow.h
Transport.h
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
Cantera::DomainFactory
Factory class to create domain objects.
Definition DomainFactory.h:23
Cantera::DomainFactory::domain_mutex
static std::mutex domain_mutex
Mutex for use when calling the factory.
Definition DomainFactory.h:42
Cantera::DomainFactory::DomainFactory
DomainFactory()
default constructor, which is defined as private
Definition DomainFactory.cpp:18
Cantera::DomainFactory::deleteFactory
void deleteFactory() override
Virtual abstract function that deletes the factory.
Definition DomainFactory.cpp:88
Cantera::DomainFactory::s_factory
static DomainFactory * s_factory
Pointer to the single instance of the factory.
Definition DomainFactory.h:36
Cantera::DomainFactory::factory
static DomainFactory * factory()
Return a pointer to the factory.
Definition DomainFactory.cpp:79
Cantera::Empty1D
A terminator that does nothing.
Definition Boundary1D.h:184
Cantera::Factory< Domain1D, shared_ptr< Solution >, const string & >::reg
void reg(const string &name, function< Domain1D *(Args...)> f)
Register a new object construction function.
Definition FactoryBase.h:80
Cantera::Inlet1D
An inlet.
Definition Boundary1D.h:139
Cantera::IonFlow
This class models the ion transportation in a flame.
Definition IonFlow.h:29
Cantera::Outlet1D
An outlet.
Definition Boundary1D.h:241
Cantera::OutletRes1D
An outlet with specified composition.
Definition Boundary1D.h:269
Cantera::ReactingSurf1D
A reacting surface.
Definition Boundary1D.h:340
Cantera::StFlow
This class represents 1D flow domains that satisfy the one-dimensional similarity solution for chemic...
Definition StFlow.h:45
Cantera::StFlow::setUnstrainedFlow
void setUnstrainedFlow()
Set flow configuration for burner-stabilized flames, using specified inlet mass fluxes.
Definition StFlow.h:199
Cantera::StFlow::setFreeFlow
void setFreeFlow()
Set flow configuration for freely-propagating flames, using an internal point with a fixed temperatur...
Definition StFlow.h:181
Cantera::StFlow::setAxisymmetricFlow
void setAxisymmetricFlow()
Set flow configuration for axisymmetric counterflow flames, using specified inlet mass fluxes.
Definition StFlow.h:190
Cantera::Surf1D
A non-reacting surface.
Definition Boundary1D.h:309
Cantera::Symm1D
A symmetry plane.
Definition Boundary1D.h:213
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564