Cantera  3.1.0a1
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 
8 #include "cantera/oneD/StFlow.h"
9 #include "cantera/oneD/IonFlow.h"
11 
12 namespace Cantera
13 {
14 
15 DomainFactory* DomainFactory::s_factory = 0;
17 
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 
80 {
81  std::unique_lock<std::mutex> lock(domain_mutex);
82  if (!s_factory) {
84  }
85  return s_factory;
86 }
87 
89 {
90  std::unique_lock<std::mutex> lock(domain_mutex);
91  delete s_factory;
92  s_factory = 0;
93 }
94 
95 }
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.
Definition: DomainFactory.h:23
static std::mutex domain_mutex
Mutex for use when calling the factory.
Definition: DomainFactory.h:42
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.
Definition: DomainFactory.h:36
static DomainFactory * factory()
Return a pointer to the factory.
A terminator that does nothing.
Definition: Boundary1D.h:184
void reg(const string &name, function< Domain1D *(Args...)> f)
Register a new object construction function.
Definition: FactoryBase.h:80
This class models the ion transportation in a flame.
Definition: IonFlow.h:29
An outlet.
Definition: Boundary1D.h:237
An outlet with specified composition.
Definition: Boundary1D.h:263
A reacting surface.
Definition: Boundary1D.h:332
This class represents 1D flow domains that satisfy the one-dimensional similarity solution for chemic...
Definition: StFlow.h:45
void setUnstrainedFlow()
Set flow configuration for burner-stabilized flames, using specified inlet mass fluxes.
Definition: StFlow.h:180
void setFreeFlow()
Set flow configuration for freely-propagating flames, using an internal point with a fixed temperatur...
Definition: StFlow.h:164
void setAxisymmetricFlow()
Set flow configuration for axisymmetric counterflow flames, using specified inlet mass fluxes.
Definition: StFlow.h:172
A non-reacting surface.
Definition: Boundary1D.h:303
A symmetry plane.
Definition: Boundary1D.h:211
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564