1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "fixedNormalSlipFvPatchField.H"
28 #include "symmTransformField.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
41 const DimensionedField<Type, volMesh>& iF
44 transformFvPatchField<Type>(p, iF),
45 fixedValue_(p.size(), pTraits<Type>::zero)
50 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
52 const fixedNormalSlipFvPatchField<Type>& ptf,
54 const DimensionedField<Type, volMesh>& iF,
55 const fvPatchFieldMapper& mapper
58 transformFvPatchField<Type>(ptf, p, iF, mapper),
59 fixedValue_(ptf.fixedValue_, mapper)
64 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
67 const DimensionedField<Type, volMesh>& iF,
68 const dictionary& dict
71 transformFvPatchField<Type>(p, iF),
72 fixedValue_("fixedValue", dict, p.size())
79 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
81 const fixedNormalSlipFvPatchField<Type>& ptf
84 transformFvPatchField<Type>(ptf),
85 fixedValue_(ptf.fixedValue_)
90 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
92 const fixedNormalSlipFvPatchField<Type>& ptf,
93 const DimensionedField<Type, volMesh>& iF
96 transformFvPatchField<Type>(ptf, iF),
97 fixedValue_(ptf.fixedValue_)
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 void fixedNormalSlipFvPatchField<Type>::autoMap
106 const fvPatchFieldMapper& m
109 transformFvPatchField<Type>::autoMap(m);
110 fixedValue_.autoMap(m);
115 void fixedNormalSlipFvPatchField<Type>::rmap
117 const fvPatchField<Type>& ptf,
118 const labelList& addr
121 transformFvPatchField<Type>::rmap(ptf, addr);
123 const fixedNormalSlipFvPatchField<Type>& dmptf =
124 refCast<const fixedNormalSlipFvPatchField<Type> >(ptf);
126 fixedValue_.rmap(dmptf.fixedValue_, addr);
131 tmp<Field<Type> > fixedNormalSlipFvPatchField<Type>::snGrad() const
133 vectorField nHat = this->patch().nf();
134 Field<Type> pif = this->patchInternalField();
138 (nHat*(nHat & fixedValue_) + transform(I - sqr(nHat), pif)) - pif
139 )*this->patch().deltaCoeffs();
144 void fixedNormalSlipFvPatchField<Type>::evaluate(const Pstream::commsTypes)
146 if (!this->updated())
148 this->updateCoeffs();
151 vectorField nHat = this->patch().nf();
153 Field<Type>::operator=
155 nHat*(nHat & fixedValue_)
156 + transform(I - sqr(nHat), this->patchInternalField())
159 transformFvPatchField<Type>::evaluate();
165 fixedNormalSlipFvPatchField<Type>::snGradTransformDiag() const
167 vectorField nHat = this->patch().nf();
168 vectorField diag(nHat.size());
170 diag.replace(vector::X, mag(nHat.component(vector::X)));
171 diag.replace(vector::Y, mag(nHat.component(vector::Y)));
172 diag.replace(vector::Z, mag(nHat.component(vector::Z)));
174 return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
179 void fixedNormalSlipFvPatchField<Type>::write(Ostream& os) const
181 transformFvPatchField<Type>::write(os);
182 fixedValue_.writeEntry("fixedValue", os);
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 } // End namespace Foam
190 // ************************************************************************* //