1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "immersedBoundaryWallFunctionFvPatchField.H"
27 #include "fvPatchFieldMapper.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "wallFvPatch.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace incompressible
40 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
45 void immersedBoundaryWallFunctionFvPatchField<Type>::setIbCellValues
47 const Field<Type>& ibcValues
50 const labelList& ibc = this->ibPatch().ibCells();
52 if (ibcValues.size() != ibc.size())
56 "template<class Type>\n"
57 "void immersedBoundaryWallFunctionFvPatchField<Type>::"
60 " const Field<Type>& ibcValues\n"
62 ) << "Size of ibcValues field not equal to the number of IB cells."
63 << nl << "ibcValues: " << ibcValues.size()
64 << " ibc: " << ibc.size()
68 // Get non-const access to internal field
69 Field<Type>& psiI = const_cast<Field<Type>&>(this->internalField());
71 if (wallValue_.empty() || wallMask_.empty())
73 immersedBoundaryFvPatchField<Type>::setIbCellValues(ibcValues);
77 forAll (ibcValues, cellI)
79 // If mask is set use the wall value, otherwise use the
83 psiI[ibc[cellI]] = wallValue_[cellI];
87 psiI[ibc[cellI]] = ibcValues[cellI];
94 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
97 immersedBoundaryWallFunctionFvPatchField<Type>::
98 immersedBoundaryWallFunctionFvPatchField
101 const DimensionedField<Type, volMesh>& iF
104 immersedBoundaryFvPatchField<Type>(p, iF),
111 immersedBoundaryWallFunctionFvPatchField<Type>::
112 immersedBoundaryWallFunctionFvPatchField
115 const DimensionedField<Type, volMesh>& iF,
116 const dictionary& dict
119 immersedBoundaryFvPatchField<Type>(p, iF, dict),
126 immersedBoundaryWallFunctionFvPatchField<Type>::
127 immersedBoundaryWallFunctionFvPatchField
129 const immersedBoundaryWallFunctionFvPatchField& ptf,
131 const DimensionedField<Type, volMesh>& iF,
132 const fvPatchFieldMapper& mapper
135 immersedBoundaryFvPatchField<Type>(ptf, p, iF, mapper),
142 immersedBoundaryWallFunctionFvPatchField<Type>::
143 immersedBoundaryWallFunctionFvPatchField
145 const immersedBoundaryWallFunctionFvPatchField& tkqrwfpf
148 immersedBoundaryFvPatchField<Type>(tkqrwfpf),
155 immersedBoundaryWallFunctionFvPatchField<Type>::
156 immersedBoundaryWallFunctionFvPatchField
158 const immersedBoundaryWallFunctionFvPatchField& tkqrwfpf,
159 const DimensionedField<Type, volMesh>& iF
162 immersedBoundaryFvPatchField<Type>(tkqrwfpf, iF),
168 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
171 Foam::Field<Type>& immersedBoundaryWallFunctionFvPatchField<Type>::wallValue() const
173 // Note: on a moving mesh, the intersection has changed and
174 // wallValue fields should be cleared and recalculated.
175 // This should happen only once, but I cannot see the mechanism
177 // Bugfix 30/OCT/2015 - check if the mesh is moving
179 const immersedBoundaryFvPatch& ibFvP =
180 immersedBoundaryFvPatchField<Type>::ibPatch();
185 || (ibFvP.movingIb() || ibFvP.boundaryMesh().mesh().moving())
190 this->ibPatch().ibCells().size(),
200 Foam::boolList& immersedBoundaryWallFunctionFvPatchField<Type>::wallMask() const
202 // Note: on a moving mesh, the intersection has changed and
203 // wallValue fields should be cleared and recalculated.
204 // This should happen only once, but I cannot see the mechanism
206 // Bugfix 30/OCT/2015 - check if the mesh is moving
207 const immersedBoundaryFvPatch& ibFvP =
208 immersedBoundaryFvPatchField<Type>::ibPatch();
213 || (ibFvP.movingIb() || ibFvP.boundaryMesh().mesh().moving())
218 this->ibPatch().ibCells().size(),
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 } // End namespace RASModels
230 } // End namespace incompressible
231 } // End namespace Foam
233 // ************************************************************************* //