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 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  (
54  dict.lookupOrDefault<wordList>("zeroATCPatchTypes", wordList())
55  ),
56  zeroATCZones_(0),
57  zeroATCcells_(0)
58 {
59  if (dict.found("zeroATCZones"))
60  {
61  const wordList zeroATCZoneNames(dict.get<wordList>("zeroATCZones"));
62  zeroATCZones_ = labelList(zeroATCZoneNames.size(), -1);
63  forAll(zeroATCZoneNames, zI)
64  {
65  label zoneID = mesh.cellZones().findZoneID(zeroATCZoneNames[zI]);
66  if (zoneID == -1)
67  {
69  << "cannot find cellZone "
70  << zeroATCZoneNames[zI]
71  << " for smoothing ATC"
72  << endl;
73  }
74  zeroATCZones_[zI] = zoneID;
75  }
76  }
77 }
78 
79 
80 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
81 
83 (
84  const fvMesh& mesh,
85  const dictionary& dict
86 )
87 {
88  const word modelType
89  (
90  dict.getOrDefault<word>("maskType", "faceCells")
91  );
92 
93  auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
94 
95  if (!cstrIter.found())
96  {
98  (
99  dict,
100  "zeroATCcells",
101  modelType,
102  *dictionaryConstructorTablePtr_
103  ) << exit(FatalIOError);
104  }
105 
106  return autoPtr<zeroATCcells> (cstrIter()(mesh,dict));
107 }
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace Foam
113 
114 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:74
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::dictionary::found
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionary.C:359
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::polyMesh::cellZones
const cellZoneMesh & cellZones() const
Return cell zone mesh.
Definition: polyMesh.H:483
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:81
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.H:1241
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:380
Foam::label
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:62
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:121
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:84
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ZoneMesh::findZoneID
label findZoneID(const word &zoneName) const
Find zone index given a name, return -1 if not found.
Definition: ZoneMesh.C:484
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:83
Foam::List< word >
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:122
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:294