generateBlendedInterfacialModels.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) 2025-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 Namespace
25  Foam
26 
27 Description
28  Functions for generating tables of blended interfacial models
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef generateBlendedInterfacialModels_H
33 #define generateBlendedInterfacialModels_H
34 
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 template<class ModelType>
46 (
47  const phaseSystem& fluid,
48  const dictionary& dict
49 )
50 {
51  if (dict.found("blending"))
52  {
53  if (dict.isDict("blending"))
54  {
55  return dict.subDict("blending");
56  }
57 
58  const dictionary& fluidBlendingDict = fluid.subDict("blending");
59 
60  return fluidBlendingDict.subDict(dict.lookup<word>("blending"));
61  }
62 
63  if (fluid.found("blending"))
64  {
65  const dictionary& fluidBlendingDict = fluid.subDict("blending");
66 
67  if (fluidBlendingDict.found(modelName<ModelType>()))
68  {
69  return fluidBlendingDict.subDict(modelName<ModelType>());
70  }
71 
72  if (fluidBlendingDict.found("default"))
73  {
74  return fluidBlendingDict.subDict("default");
75  }
76  }
77 
78  return dict.subDict("blending");
79 }
80 
81 
83 (
84  const dictionary& dict,
85  const wordHashSet& ignoreKeys = wordHashSet()
86 )
87 {
88  return modelSubDicts(dict, ignoreKeys | wordHashSet({"blending"}));
89 }
90 
91 
92 template<class ModelType>
94 (
95  const phaseSystem& fluid,
96  const dictionary& dict,
97  const wordHashSet& ignoreKeys = wordHashSet()
98 )
99 {
100  checkInterfacialModelsDict<ModelType>
101  (
102  fluid,
103  dict,
104  ignoreKeys | wordHashSet({"blending"})
105  );
106 }
107 
108 
109 template<class ModelType, class ... Args>
111 <
112  ModelType,
116 (
117  const phaseSystem& fluid,
118  const dictionary& dict,
119  const wordHashSet& ignoreKeys,
120  const bool ignoreNonModelPhaseInterfaceTypes,
121  const Args& ... args
122 )
123 {
124  if (dict.empty())
125  {
126  return
128  <
129  ModelType,
132  >();
133  }
134 
135  return
136  generateInterfacialModels<ModelType, dictionary, Args ...>
137  (
138  fluid,
139  dict,
140  ignoreKeys | wordHashSet({"blending"}),
141  ignoreNonModelPhaseInterfaceTypes,
142  blendingDict<ModelType>(fluid, dict),
143  args ...
144  );
145 }
146 
147 
148 template<class ModelType>
150 <
151  ModelType,
155 (
156  const phaseSystem& fluid,
157  const dictionary& dict
158 )
159 {
160  return
161  generateBlendedInterfacialModels<ModelType>
162  (
163  fluid,
164  dict,
165  wordHashSet(),
166  false
167  );
168 }
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:68
A HashTable with keys but without contents.
Definition: HashSet.H:62
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
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:732
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:778
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:468
Word-pair based class used for keying interface models in hash tables.
Class to represent a system of phases.
Definition: phaseSystem.H:74
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
UPtrList< const dictionary > modelSubDicts(const dictionary &dict, const wordHashSet &ignoreKeys=wordHashSet())
void checkBlendedInterfacialModelsDict(const phaseSystem &fluid, const dictionary &dict, const wordHashSet &ignoreKeys=wordHashSet())
void generateInterfacialModels(PtrList< phaseInterface > &interfaces, PtrList< ModelType > &models, const phaseSystem &fluid, const UPtrList< const dictionary > &subDicts, const wordHashSet &ignoreKeys, const phaseInterface &interface, const Args &... args)
UPtrList< const dictionary > blendedModelSubDicts(const dictionary &dict, const wordHashSet &ignoreKeys=wordHashSet())
Foam::HashPtrTable< ModelType, Foam::phaseInterfaceKey, Foam::phaseInterfaceKey::hash > generateBlendedInterfacialModels(const phaseSystem &fluid, const dictionary &dict, const wordHashSet &ignoreKeys, const bool ignoreNonModelPhaseInterfaceTypes, const Args &... args)
const dictionary & blendingDict(const phaseSystem &fluid, const dictionary &dict)
HashSet wordHashSet
A HashSet with word keys.
Definition: HashSet.H:210
dictionary dict
Foam::argList args(argc, argv)