Loading...
Searching...
No Matches
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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35namespace Foam
36{
37
38// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39
40defineTypeNameAndDebug(zeroATCcells, 0);
42
43// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44
45zeroATCcells::zeroATCcells
46(
47 const fvMesh& mesh,
48 const dictionary& dict
49)
50:
51 mesh_(mesh),
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 {
71 WarningInFunction
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
85autoPtr<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// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A class for handling words, derived from Foam::string.
Definition word.H:66
Base class for selecting cells on which to zero the ATC term.
const fvMesh & mesh_
labelList zeroATCcells_
static autoPtr< zeroATCcells > New(const fvMesh &mesh, const dictionary &dict)
Return a reference to the selected turbulence model.
wordList zeroATCPatches_
labelList zeroATCZones_
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition error.H:637
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict