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-2022 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 
29 SourceFiles
30  BlendedInterfacialModel.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef BlendedInterfacialModel_H
35 #define BlendedInterfacialModel_H
36 
37 #include "blendingMethod.H"
38 #include "phaseInterface.H"
39 #include "HashPtrTable.H"
40 #include "hashedWordList.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class BlendedInterfacialModel Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class ModelType>
53 :
54  public regIOobject
55 {
56  // Private Data
57 
58  //- The interface
59  const phaseInterface interface_;
60 
61  //- Blending method
62  autoPtr<blendingMethod> blending_;
63 
64  //- Model for general configurations
65  autoPtr<ModelType> modelGeneral_;
66 
67  //- Model for phase 1 dispersed in phase 2
68  autoPtr<ModelType> model1DispersedIn2_;
69 
70  //- Model for phase 2 dispersed in phase 1
71  autoPtr<ModelType> model2DispersedIn1_;
72 
73  //- Model for phase 1 segregated with phase 2
74  autoPtr<ModelType> model1SegregatedWith2_;
75 
76  //- Models for general configurations displaced by a third phase
77  PtrList<ModelType> modelsGeneralDisplaced_;
78 
79  //- Models for phase 1 dispersed in phase 2 displaced by a third phase
80  PtrList<ModelType> models1DispersedIn2Displaced_;
81 
82  //- Models for phase 2 dispersed in phase 1 displaced by a third phase
83  PtrList<ModelType> models2DispersedIn1Displaced_;
84 
85  //- Models for phase 1 segregated with phase 2 displaced by a third
86  // phase
87  PtrList<ModelType> models1SegregatedWith2Displaced_;
88 
89  //- Time index of last check
90  mutable label checkTimeIndex_;
91 
92 
93  // Private Member Functions
94 
95  //- Check compatibility of the available models and the blending method
96  void check() const;
97 
98  //- Calculate the blending coefficients
99  template<template<class> class PatchField, class GeoMesh>
100  void calculateBlendingCoeffs
101  (
102  const UPtrList<const volScalarField>& alphas,
111  const bool subtract
112  ) const;
113 
114  //- Correct coeff/value on fixed flux boundary conditions
115  template<class Type, template<class> class PatchField, class GeoMesh>
116  void correctFixedFluxBCs
117  (
119  ) const;
120 
121  //- Write out a set or surface that visualises the various models'
122  // utilisation of the blending space
123  void postProcessBlendingCoefficients(const word& format) const;
124 
125 
126 protected:
127 
128  // Protected Member Functions
129 
130  //- Return a blended field
131  template
132  <
133  class Type,
134  template<class> class PatchField,
135  class GeoMesh,
136  class ... Args
137  >
139  (
141  (ModelType::*method)(Args ...) const,
142  const word& name,
143  const dimensionSet& dims,
144  const bool subtract,
145  Args ... args
146  ) const;
147 
148  //- Return a table of blended fields
149  template
150  <
151  class Type,
152  template<class> class PatchField,
153  class GeoMesh,
154  class ... Args
155  >
157  (
159  (ModelType::*method)(Args ...) const,
160  const word& name,
161  const dimensionSet& dims,
162  const bool subtract,
163  Args ... args
164  ) const;
165 
166  //- Return a bool combined (or) from all models
167  template<class ... Args>
168  bool evaluate
169  (
170  bool (ModelType::*method)(Args ...) const,
171  Args ... args
172  ) const;
173 
174  //- Return a hashed word list combined from all models
175  template<class ... Args>
177  (
178  const hashedWordList& (ModelType::*method)(Args ...) const,
179  Args ... args
180  ) const;
181 
182 
183 public:
184 
185  //- Runtime type information
186  TypeName("BlendedInterfacialModel");
187 
188 
189  // Constructors
190 
191  //- Construct from a dictionary and an interface
193  (
194  const dictionary& dict,
196  );
197 
198  //- Disallow default bitwise copy construction
200  (
202  ) = delete;
203 
204 
205  //- Destructor
207 
208 
209  // Member Functions
210 
211  //- Access the interface
212  const phaseInterface& interface() const;
213 
214  //- Dummy write for regIOobject
215  bool writeData(Ostream& os) const;
216 
217 
218  // Member Operators
219 
220  //- Disallow default bitwise assignment
221  void operator=(const BlendedInterfacialModel<ModelType>&) = delete;
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 #define defineBlendedInterfacialModelTypeNameAndDebug(ModelType, DebugSwitch) \
228  \
229  defineTemplateTypeNameAndDebugWithName \
230  ( \
231  BlendedInterfacialModel<ModelType>, \
232  ( \
233  word(BlendedInterfacialModel<ModelType>::typeName_()) + "<" \
234  + ModelType::typeName + ">" \
235  ).c_str(), \
236  DebugSwitch \
237  );
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #ifdef NoRepository
247  #include "BlendedInterfacialModel.C"
248 #endif
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #endif
253 
254 // ************************************************************************* //
dictionary dict
const word & name() const
Return name.
Definition: IOobject.H:315
bool writeData(Ostream &os) const
Dummy write for regIOobject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
~BlendedInterfacialModel()
Destructor.
word format(conversionProperties.lookup("format"))
Generic GeometricField class.
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:50
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Class to represent an interface between phases. Derivations can further specify the configuration of ...
Dimension set for the base types.
Definition: dimensionSet.H:121
A class for handling words, derived from string.
Definition: word.H:59
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:54
BlendedInterfacialModel(const dictionary &dict, const phaseInterface &interface)
Construct from a dictionary and an interface.
tmp< GeometricField< Type, PatchField, GeoMesh > > evaluate(tmp< GeometricField< Type, PatchField, GeoMesh >>(ModelType::*method)(Args ...) const, const word &name, const dimensionSet &dims, const bool subtract, Args ... args) const
Return a blended field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
const phaseInterface & interface() const
Access the interface.
A wordList with hashed indices for faster lookup by name.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:52
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:46
rDeltaTY field()
A class for managing temporary objects.
Definition: PtrList.H:53
Foam::argList args(argc, argv)
void operator=(const BlendedInterfacialModel< ModelType > &)=delete
Disallow default bitwise assignment.
TypeName("BlendedInterfacialModel")
Runtime type information.
Namespace for OpenFOAM.