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