1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "thermoBaffleModel.H"
28 #include "directMappedVariableThicknessWallPolyPatch.H"
29 #include "wedgePolyPatch.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace regionModels
37 namespace thermoBaffleModels
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(thermoBaffleModel, 0);
43 defineRunTimeSelectionTable(thermoBaffleModel, mesh);
44 defineRunTimeSelectionTable(thermoBaffleModel, dictionary);
47 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
49 bool thermoBaffleModel::read()
51 regionModel1D::read();
56 void thermoBaffleModel::init()
60 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
62 // Check if region mesh in 1-D
63 label nTotalEdges = 0;
64 const label patchi = intCoupledPatchIDs_[0];
65 nTotalEdges = 2*nLayers_*rbm[patchi].nInternalEdges();
67 nLayers_*(rbm[patchi].nEdges() - rbm[patchi].nInternalEdges());
69 reduce(nTotalEdges, sumOp<label>());
78 isA<wedgePolyPatch>(rbm[patchi])
79 || isA<emptyPolyPatch>(rbm[patchi])
83 nFaces += rbm[patchi].size();
86 reduce(nFaces, sumOp<label>());
88 if (nTotalEdges == nFaces)
91 Info << "\nThe thermal baffle is 1D \n" << endl;
95 Info << "\nThe thermal baffle is 3D \n" << endl;
98 forAll(intCoupledPatchIDs_, i)
100 const label patchI = intCoupledPatchIDs_[i];
101 const polyPatch& pp = rbm[patchI];
104 !isA<directMappedVariableThicknessWallPolyPatch>(pp)
106 && !constantThickness_
111 "thermoBaffleModel::thermoBaffleModel"
116 ) << "\n patch type '" << pp.type()
118 << directMappedVariableThicknessWallPolyPatch::typeName
119 << "'. This is necessary for 1D solution "
120 << " and variable thickness"
121 << "\n for patch. " << pp.name()
124 else if (!isA<directMappedWallPolyPatch>(pp))
128 "thermoBaffleModel::thermoBaffleModel"
133 ) << "\n patch type '" << pp.type()
135 << directMappedWallPolyPatch::typeName
136 << "'. This is necessary for 3D solution"
137 << "\n for patch. " << pp.name()
142 if (oneD_ && !constantThickness_)
144 const label patchI = intCoupledPatchIDs_[0];
145 const polyPatch& pp = rbm[patchI];
146 const directMappedVariableThicknessWallPolyPatch& ppCoupled =
149 const directMappedVariableThicknessWallPolyPatch
152 thickness_ = ppCoupled.thickness();
154 // Check that thickness has the right size
155 if (thickness_.size() != pp.size())
159 "thermoBaffleModel::thermoBaffleModel"
164 ) << " coupled patches in thermoBaffle are " << nl
165 << " different sizes from list thickness" << nl
169 // Calculate thickness of the baffle on the first face only.
170 if (delta_.value() == 0.0)
172 forAll (ppCoupled, localFaceI)
174 label faceI = ppCoupled.start() + localFaceI;
177 boundaryFaceOppositeFace_[localFaceI];
181 regionMesh().faceCentres()[faceI]
182 - regionMesh().faceCentres()[faceO]
192 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
194 thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh)
198 delta_("delta", dimLength, 0.0),
200 constantThickness_(true)
204 thermoBaffleModel::thermoBaffleModel
206 const word& modelType,
208 const dictionary& dict
212 regionModel1D(mesh, "thermoBaffle", modelType, dict, true),
214 delta_("delta", dimLength, 0.0),
216 constantThickness_(dict.lookupOrDefault<bool>("constantThickness", true))
222 thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh)
224 regionModel1D(mesh, "thermoBaffle", modelType),
226 delta_("delta", dimLength, 0.0),
228 constantThickness_(lookupOrDefault<bool>("constantThickness", true))
234 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
236 thermoBaffleModel::~thermoBaffleModel()
240 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
242 void thermoBaffleModel::preEvolveRegion()
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 } // End namespace thermoBaffleModels
249 } // End namespace regionModels
250 } // End namespace Foam
252 // ************************************************************************* //