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 "fixedNormalSlipFvPatchField.H"
27 #include "symmTransformField.H"
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
36 const DimensionedField<Type, volMesh>& iF
39 transformFvPatchField<Type>(p, iF),
40 fixedValue_(p.size(), pTraits<Type>::zero)
45 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
47 const fixedNormalSlipFvPatchField<Type>& ptf,
49 const DimensionedField<Type, volMesh>& iF,
50 const fvPatchFieldMapper& mapper
53 transformFvPatchField<Type>(ptf, p, iF, mapper),
54 fixedValue_(ptf.fixedValue_, mapper)
59 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
62 const DimensionedField<Type, volMesh>& iF,
63 const dictionary& dict
66 transformFvPatchField<Type>(p, iF),
67 fixedValue_("fixedValue", dict, p.size())
74 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
76 const fixedNormalSlipFvPatchField<Type>& ptf
79 transformFvPatchField<Type>(ptf),
80 fixedValue_(ptf.fixedValue_)
85 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
87 const fixedNormalSlipFvPatchField<Type>& ptf,
88 const DimensionedField<Type, volMesh>& iF
91 transformFvPatchField<Type>(ptf, iF),
92 fixedValue_(ptf.fixedValue_)
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99 void Foam::fixedNormalSlipFvPatchField<Type>::autoMap
101 const fvPatchFieldMapper& m
104 transformFvPatchField<Type>::autoMap(m);
105 fixedValue_.autoMap(m);
110 void Foam::fixedNormalSlipFvPatchField<Type>::rmap
112 const fvPatchField<Type>& ptf,
113 const labelList& addr
116 transformFvPatchField<Type>::rmap(ptf, addr);
118 const fixedNormalSlipFvPatchField<Type>& dmptf =
119 refCast<const fixedNormalSlipFvPatchField<Type> >(ptf);
121 fixedValue_.rmap(dmptf.fixedValue_, addr);
126 Foam::tmp<Foam::Field<Type> >
127 Foam::fixedNormalSlipFvPatchField<Type>::snGrad() const
129 const vectorField nHat(this->patch().nf());
130 const Field<Type> pif(this->patchInternalField());
134 (nHat*(nHat & fixedValue_) + transform(I - sqr(nHat), pif)) - pif
135 )*this->patch().deltaCoeffs();
140 void Foam::fixedNormalSlipFvPatchField<Type>::evaluate
142 const Pstream::commsTypes
145 if (!this->updated())
147 this->updateCoeffs();
150 const vectorField nHat(this->patch().nf());
152 Field<Type>::operator=
154 nHat*(nHat & fixedValue_)
155 + transform(I - sqr(nHat), this->patchInternalField())
158 transformFvPatchField<Type>::evaluate();
163 Foam::tmp<Foam::Field<Type> >
164 Foam::fixedNormalSlipFvPatchField<Type>::snGradTransformDiag() const
166 const vectorField nHat(this->patch().nf());
167 vectorField diag(nHat.size());
169 diag.replace(vector::X, mag(nHat.component(vector::X)));
170 diag.replace(vector::Y, mag(nHat.component(vector::Y)));
171 diag.replace(vector::Z, mag(nHat.component(vector::Z)));
173 return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
178 void Foam::fixedNormalSlipFvPatchField<Type>::write(Ostream& os) const
180 transformFvPatchField<Type>::write(os);
181 fixedValue_.writeEntry("fixedValue", os);
185 // ************************************************************************* //