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 
40 defineTypeNameAndDebug(zeroATCcells, 0);
41 defineRunTimeSelectionTable(zeroATCcells, dictionary);
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 
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 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::List::resize
void resize(const label len)
Adjust allocated size of list.
Definition: ListI.H:139
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
Foam::polyMesh::cellZones
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
Definition: polyMesh.H:492
zeroATCcells.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
zoneID
const labelIOList & zoneID
Definition: interpolatedFaces.H:22
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ZoneMesh::findZoneID
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
Definition: ZoneMesh.C:519
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::zeroATCcells::New
static autoPtr< zeroATCcells > New(const fvMesh &mesh, const dictionary &dict)
Return a reference to the selected turbulence model.
Definition: zeroATCcells.C:86
Foam::List< word >
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:148
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:328
Foam::dictionary::readIfPresent
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:405