Loading...
Searching...
No Matches
multiphaseInterSystemTemplates.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2017-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
29
30template<class modelType>
32(
33 const dictTable& modelDicts,
35 <
39 >& models
40)
41{
42 forAllConstIters(modelDicts, iter)
43 {
44 const phasePairKey& key = iter.key();
45
46 models.insert
47 (
48 key,
49 modelType::New
50 (
51 iter.val(),
52 phasePairs_[key]
53 )
54 );
55 }
56}
57
58
59template<class modelType>
61(
62 const dictTable& modelDicts,
63 const fvMesh& mesh,
64 HashTable
65 <
66 autoPtr<modelType>,
67 phasePairKey,
69 >& models
70)
71{
72 forAllConstIters(modelDicts, iter)
73 {
74 const phasePairKey& key = iter.key();
75
76 models.insert
77 (
78 key,
79 modelType::New
80 (
81 iter.val(),
82 mesh
83 )
84 );
85 }
86}
87
88
89template<class modelType>
91(
92 const word& modelName,
93 HashTable
94 <
95 autoPtr<modelType>,
96 phasePairKey,
98 >& models
99)
100{
101 dictTable modelDicts(lookup(modelName));
102
103 generatePairs(modelDicts);
104
105 createSubModels(modelDicts, models);
106}
107
108
109template<class modelType>
111(
112 const word& modelName,
113 const fvMesh& mesh,
115 <
119 >& models
120)
121{
122 dictTable modelDicts(lookup(modelName));
123
124 generatePairs(modelDicts);
125
126 createSubModels(modelDicts, mesh, models);
127}
128
129
130template<class modelType>
132(
133 const word& modelName,
135 <
139 >& models
140)
141{
142 typedef
144 modelTypeTable;
145
146 for (const word& phaseName : phaseNames_)
147 {
148 modelTypeTable tempModels;
149 generatePairsAndSubModels
150 (
151 IOobject::groupName(modelName, phaseName),
152 tempModels
153 );
154
155 forAllConstIters(tempModels, tempModelIter)
156 {
157 const phasePairKey& key = tempModelIter.key();
158
159 if (!models.found(key))
160 {
161 models.insert
162 (
163 key,
165 );
166 }
167
168 models[key].insert
169 (
170 phaseName,
171 *tempModelIter
172 );
173 }
174 }
175}
176
177
178template <class modelType>
180(
181 const phasePair& key
182) const
183{
184 return
185 mesh().lookupObject<modelType>
187 IOobject::groupName(modelType::typeName, key.name())
188 );
189}
190
191
192template <class modelType>
194(
195 const multiphaseInter::phaseModel& from,
197) const
198{
199 return lookupSubModel<modelType>(orderedPhasePair(from, to));
200}
201
202
203// ************************************************************************* //
A HashTable similar to std::unordered_map.
Definition HashTable.H:124
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
void createSubModels(const dictTable &modelDicts, HashTable< autoPtr< modelType >, phasePairKey, phasePairKey::hash > &models)
Generate pairs and sub-model tables using pair keys.
void generatePairs(const dictTable &modelDicts)
Generate pairs.
const modelType & lookupSubModel(const phasePair &key) const
Access a sub model between a phase pair.
void generatePairsAndSubModels(const word &modelName, HashTable< autoPtr< modelType >, phasePairKey, phasePairKey::hash > &models)
Generate pairs and sub-model tables.
phasePairTable phasePairs_
Phase pairs.
const fvMesh & mesh() const
Return mesh.
HashTable< dictionary, phasePairKey, phasePairKey::hash > dictTable
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
An ordered or unorder pair of phase names. Typically specified as follows.
phasePairKey::hasher hash
Alternative name for functor.
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition phasePair.H:52
Lookup type of boundary radiation properties.
Definition lookup.H:60
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Definition stdFoam.H:235