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-------------------------------------------------------------------------------
12License
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
35namespace Foam
36{
37
38// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39
42
43// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44
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 }
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// ************************************************************************* //
void resize(const label len)
Adjust allocated size of list.
Definition: ListI.H:139
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
Definition: ZoneMesh.C:525
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
Definition: polyMesh.H:504
A class for handling words, derived from Foam::string.
Definition: word.H:68
Base class for selecting cells on which to zero the ATC term.
Definition: zeroATCcells.H:57
wordList zeroATCPatches_
Definition: zeroATCcells.H:74
labelList zeroATCZones_
Definition: zeroATCcells.H:75
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
const labelIOList & zoneID
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
IOerror FatalIOError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333