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 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 
82 template<class ModelType>
84 (
85  const phaseSystem& fluid,
86  const dictionary& dict,
87  const wordHashSet& ignoreKeys = wordHashSet()
88 )
89 {
90  checkInterfacialModelsDict<ModelType>
91  (
92  fluid,
93  dict,
94  ignoreKeys | wordHashSet({"blending"})
95  );
96 }
97 
98 
99 template<class ModelType, class ... Args>
101 <
102  ModelType,
106 (
107  const phaseSystem& fluid,
108  const dictionary& dict,
109  const wordHashSet& ignoreKeys,
110  const bool ignoreNonModelPhaseInterfaceTypes,
111  const Args& ... args
112 )
113 {
114  if (dict.empty())
115  {
116  return
118  <
119  ModelType,
122  >();
123  }
124 
125  return
126  generateInterfacialModels<ModelType, dictionary, Args ...>
127  (
128  fluid,
129  dict,
130  ignoreKeys | wordHashSet({"blending"}),
131  ignoreNonModelPhaseInterfaceTypes,
132  blendingDict<ModelType>(fluid, dict),
133  args ...
134  );
135 }
136 
137 
138 template<class ModelType>
140 <
141  ModelType,
145 (
146  const phaseSystem& fluid,
147  const dictionary& dict
148 )
149 {
150  return
151  generateBlendedInterfacialModels<ModelType>
152  (
153  fluid,
154  dict,
155  wordHashSet(),
156  false
157  );
158 }
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:67
A HashTable with keys but without contents.
Definition: HashSet.H:62
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:740
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:803
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:849
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:539
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:62
Namespace for OpenFOAM.
void generateInterfacialModels(PtrList< phaseInterface > &interfaces, PtrList< ModelType > &models, const phaseSystem &fluid, const dictionary &dict, const wordHashSet &ignoreKeys, const phaseInterface &interface, const Args &... args)
void checkBlendedInterfacialModelsDict(const phaseSystem &fluid, 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)