porosityModelList.C
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) 2012-2024 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 \*---------------------------------------------------------------------------*/
25 
26 #include "porosityModelList.H"
27 #include "volFields.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
32 (
33  const fvMesh& mesh,
34  const dictionary& dict
35 )
36 :
38  mesh_(mesh)
39 {
40  reset(dict);
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
45 
47 {}
48 
49 
50 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
51 
53 {
54  label count = 0;
56  {
57  if (iter().isDict())
58  {
59  count++;
60  }
61  }
62 
63  this->setSize(count);
64  label i = 0;
66  {
67  if (iter().isDict())
68  {
69  const word& name = iter().keyword();
70  const dictionary& modelDict = iter().dict();
71 
72  this->set
73  (
74  i++,
75  porosityModel::New(name, mesh_, modelDict)
76  );
77  }
78  }
79 }
80 
81 
83 (
85 )
86 {
87  forAll(*this, i)
88  {
89  this->operator[](i).addResistance(UEqn);
90  }
91 }
92 
93 
95 (
96  const fvVectorMatrix& UEqn,
97  volTensorField& AU,
98  bool correctAUprocBC
99 )
100 {
101  forAll(*this, i)
102  {
103  this->operator[](i).addResistance(UEqn, AU, correctAUprocBC);
104  }
105 }
106 
107 
109 {
110  forAll(*this, i)
111  {
112  this->operator[](i).movePoints();
113  }
114 
115  return true;
116 }
117 
118 
120 {
121  forAll(*this, i)
122  {
123  this->operator[](i).topoChange(map);
124  }
125 }
126 
127 
129 {
130  forAll(*this, i)
131  {
132  this->operator[](i).mapMesh(map);
133  }
134 }
135 
136 
138 (
139  const polyDistributionMap& map
140 )
141 {
142  forAll(*this, i)
143  {
144  this->operator[](i).distribute(map);
145  }
146 }
147 
148 
150 {
151  bool allOk = true;
152  forAll(*this, i)
153  {
154  porosityModel& pm = this->operator[](i);
155  bool ok = pm.read(dict.subDict(pm.name()));
156  allOk = (allOk && ok);
157  }
158  return allOk;
159 }
160 
161 
162 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:476
Generic GeometricField class.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:849
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void addResistance(fvVectorMatrix &UEqn)
Add resistance.
bool movePoints()
Update for mesh motion.
void reset(const dictionary &dict)
Reset the source list.
porosityModelList(const fvMesh &mesh, const dictionary &dict)
void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
bool read(const dictionary &dict)
Read dictionary.
void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Top level model for porosity models.
Definition: porosityModel.H:57
virtual bool read(const dictionary &dict)
Read porosity dictionary.
static autoPtr< porosityModel > New(const word &name, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName=word::null)
Selector.
const word & name() const
Return const access to the porosity model name.
A class for handling words, derived from string.
Definition: word.H:62
fvVectorMatrix & UEqn
Definition: UEqn.H:11
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
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
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
points setSize(newPointi)
dictionary dict