zeroATCcells.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2007-2019 PCOpt/NTUA
9  Copyright (C) 2013-2019 FOSS GP
10  Copyright (C) 2019-2021 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 \*---------------------------------------------------------------------------*/
29 
30 #include "zeroATCcells.H"
31 #include "fvMesh.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
45 zeroATCcells::zeroATCcells
46 (
47  const fvMesh& mesh,
48  const dictionary& dict
49 )
50 :
51  mesh_(mesh),
52  zeroATCPatches_(),
53  zeroATCZones_(),
54  zeroATCcells_()
55 {
56  dict.readIfPresent("zeroATCPatchTypes", zeroATCPatches_);
57 
58  wordList zeroATCZoneNames;
59 
60  if (dict.readIfPresent("zeroATCZones", zeroATCZoneNames))
61  {
62  zeroATCZones_.resize(zeroATCZoneNames.size(), -1);
63 
64  forAll(zeroATCZoneNames, zI)
65  {
66  const word& zoneName = zeroATCZoneNames[zI];
67 
68  label zoneID = mesh.cellZones().findZoneID(zoneName);
69  if (zoneID == -1)
70  {
72  << "cannot find cellZone "
73  << zoneName
74  << " for smoothing ATC"
75  << endl;
76  }
77  zeroATCZones_[zI] = zoneID;
78  }
79  }
80 }
81 
82 
83 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
84 
85 autoPtr<zeroATCcells> zeroATCcells::New
86 (
87  const fvMesh& mesh,
88  const dictionary& dict
89 )
90 {
91  const word modelType
92  (
93  dict.getOrDefault<word>("maskType", "faceCells")
94  );
95 
96  auto* ctorPtr = dictionaryConstructorTable(modelType);
97 
98  if (!ctorPtr)
99  {
101  (
102  dict,
103  "zeroATCcells",
104  modelType,
105  *dictionaryConstructorTablePtr_
106  ) << exit(FatalIOError);
107  }
108 
109  return autoPtr<zeroATCcells> (ctorPtr(mesh,dict));
110 }
111 
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 } // End namespace Foam
116 
117 // ************************************************************************* //
dictionary dict
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
void resize(const label len)
Adjust allocated size of list.
Definition: ListI.H:160
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
static autoPtr< zeroATCcells > New(const fvMesh &mesh, const dictionary &dict)
Return a reference to the selected turbulence model.
Definition: zeroATCcells.C:79
dynamicFvMesh & mesh
wordList zeroATCPatches_
Definition: zeroATCcells.H:74
A class for handling words, derived from Foam::string.
Definition: word.H:63
labelList zeroATCZones_
Definition: zeroATCcells.H:75
Base class for selecting cells on which to zero the ATC term.
Definition: zeroATCcells.H:52
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:635
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...