BlendedInterfacialModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2014-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::BlendedInterfacialModel
26 
27 Description
28  Wrapper class for interfacial models for which multiple instances of the
29  model are used for different configurations of the interface; e.g.,
30  bubbles, droplets, segregated flow, displaced by another phase, ... The
31  values generated by these multiple models are then "blended" to create a
32  single effective coefficient or source.
33 
34 SourceFiles
35  BlendedInterfacialModel.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef BlendedInterfacialModel_H
40 #define BlendedInterfacialModel_H
41 
42 #include "blendingMethod.H"
43 #include "hashedWordList.H"
46 #include "TypeSet.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class BlendedInterfacialModel Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class ModelType>
59 :
60  public regIOobject
61 {
62  // Private Data
63 
64  //- The interface
65  const phaseInterface interface_;
66 
67  //- Blending method
68  autoPtr<blendingMethod> blending_;
69 
70  //- Model for general configurations
71  autoPtr<ModelType> modelGeneral_;
72 
73  //- Model for phase 1 dispersed in phase 2
74  autoPtr<ModelType> model1DispersedIn2_;
75 
76  //- Model for phase 2 dispersed in phase 1
77  autoPtr<ModelType> model2DispersedIn1_;
78 
79  //- Model for phase 1 segregated with phase 2
80  autoPtr<ModelType> model1SegregatedWith2_;
81 
82  //- Models for general configurations displaced by a third phase
83  PtrList<ModelType> modelsGeneralDisplaced_;
84 
85  //- Models for phase 1 dispersed in phase 2 displaced by a third phase
86  PtrList<ModelType> models1DispersedIn2Displaced_;
87 
88  //- Models for phase 2 dispersed in phase 1 displaced by a third phase
89  PtrList<ModelType> models2DispersedIn1Displaced_;
90 
91  //- Models for phase 1 segregated with phase 2 displaced by a third
92  // phase
93  PtrList<ModelType> models1SegregatedWith2Displaced_;
94 
95  //- Time index of last check
96  mutable label checkTimeIndex_;
97 
98 
99  // Private Member Functions
100 
101  //- Check compatibility of the available models and the blending method
102  void check() const;
103 
104  //- Calculate the blending coefficients
105  template<class GeoMesh>
106  void calculateBlendingCoeffs
107  (
108  const UPtrList<const volScalarField>& alphas,
117  ) const;
118 
119  //- Write out a set or surface that visualises the various models'
120  // utilisation of the blending space
121  void postProcessBlendingCoefficients(const word& format) const;
122 
123 
124 protected:
125 
126  // Protected Member Functions
127 
128  //- Return a blended field
129  template<class Type, class GeoMesh, class ... Args>
131  (
133  (ModelType::*method)(Args ...) const,
134  const word& name,
135  const dimensionSet& dims,
136  Args ... args
137  ) const;
138 
139  //- Return a table of blended fields
140  template<class Type, class GeoMesh, class ... Args>
142  (
144  (ModelType::*method)(Args ...) const,
145  const word& name,
146  const dimensionSet& dims,
147  Args ... args
148  ) const;
149 
150  //- Return a bool combined (or) from all models
151  template<class ... Args>
152  bool evaluate
153  (
154  bool (ModelType::*method)(Args ...) const,
155  Args ... args
156  ) const;
157 
158  //- Return a hashed word list combined from all models
159  template<class ... Args>
161  (
162  const hashedWordList& (ModelType::*method)(Args ...) const,
163  Args ... args
164  ) const;
165 
166 
167 public:
168 
169  //- Public Type Definitions
170 
171  //- The underlying model type
172  typedef ModelType modelType;
173 
174  //- Required phase interface types
176 
177  //- Allowed phase interface types
178  typedef TypeSet
179  <
184 
185 
186  //- Runtime type information
187  TypeName("BlendedInterfacialModel");
188 
189 
190  // Constructors
191 
192  //- Construct from a dictionary, an interface and a blending dictionary
193  template<class ... Args>
195  (
196  const UPtrList<const dictionary>& subDicts,
197  const phaseInterface& interface,
198  const dictionary& blendingDict,
199  const Args& ... args
200  );
201 
202  //- Disallow default bitwise copy construction
204  (
206  ) = delete;
207 
208 
209  //- Destructor
211 
212 
213  // Member Functions
214 
215  //- Access the interface
216  const phaseInterface& interface() const;
217 
218  //- Dummy write for regIOobject
219  bool writeData(Ostream& os) const;
220 
221 
222  // Member Operators
223 
224  //- Disallow default bitwise assignment
225  void operator=(const BlendedInterfacialModel<ModelType>&) = delete;
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #define defineBlendedInterfacialModelTypeNameAndDebug(ModelType, DebugSwitch) \
232  \
233  defineTemplateTypeNameAndDebugWithName \
234  ( \
235  BlendedInterfacialModel<ModelType>, \
236  ( \
237  word(BlendedInterfacialModel<ModelType>::typeName_()) + "<" \
238  + ModelType::typeName + ">" \
239  ).c_str(), \
240  DebugSwitch \
241  );
242 
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 } // End namespace Foam
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #ifdef NoRepository
251  #include "BlendedInterfacialModel.C"
252 #endif
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 #endif
257 
258 // ************************************************************************* //
Wrapper class for interfacial models for which multiple instances of the model are used for different...
TypeSet requiredPhaseInterfaces
Required phase interface types.
void operator=(const BlendedInterfacialModel< ModelType > &)=delete
Disallow default bitwise assignment.
const phaseInterface & interface() const
Access the interface.
bool writeData(Ostream &os) const
Dummy write for regIOobject.
BlendedInterfacialModel(const UPtrList< const dictionary > &subDicts, const phaseInterface &interface, const dictionary &blendingDict, const Args &... args)
Construct from a dictionary, an interface and a blending dictionary.
TypeSet< dispersedPhaseInterface, segregatedPhaseInterface, displacedPhaseInterface > allowedPhaseInterfaces
Allowed phase interface types.
TypeName("BlendedInterfacialModel")
Runtime type information.
ModelType modelType
Public Type Definitions.
tmp< GeometricField< Type, GeoMesh > > evaluate(tmp< GeometricField< Type, GeoMesh >>(ModelType::*method)(Args ...) const, const word &name, const dimensionSet &dims, Args ... args) const
Return a blended field.
Generic GeometricField class.
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:68
const word & name() const
Return name.
Definition: IOobject.H:307
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:66
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Dimension set for the base types.
Definition: dimensionSet.H:125
Class to represent a interface between phases where one phase is considered dispersed within the othe...
Class to represent an interface between phases which has been displaced to some extent by a third pha...
A wordList with hashed indices for faster lookup by name.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
Class to represent a interface between phases where the two phases are considered to be segregated; t...
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const dictionary & blendingDict(const phaseSystem &fluid, const dictionary &dict)
word format(conversionProperties.lookup("format"))
Foam::argList args(argc, argv)
Template meta-programming for operations involving sets of types.
Definition: TypeSet.H:47