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 "partialSlipFvPatchField.H"
27 #include "symmTransformField.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 partialSlipFvPatchField<Type>::partialSlipFvPatchField
40 const DimensionedField<Type, volMesh>& iF
43 transformFvPatchField<Type>(p, iF),
44 valueFraction_(p.size(), 1.0)
49 partialSlipFvPatchField<Type>::partialSlipFvPatchField
51 const partialSlipFvPatchField<Type>& ptf,
53 const DimensionedField<Type, volMesh>& iF,
54 const fvPatchFieldMapper& mapper
57 transformFvPatchField<Type>(ptf, p, iF, mapper),
58 valueFraction_(ptf.valueFraction_, mapper)
63 partialSlipFvPatchField<Type>::partialSlipFvPatchField
66 const DimensionedField<Type, volMesh>& iF,
67 const dictionary& dict
70 transformFvPatchField<Type>(p, iF),
71 valueFraction_("valueFraction", dict, p.size())
78 partialSlipFvPatchField<Type>::partialSlipFvPatchField
80 const partialSlipFvPatchField<Type>& ptf
83 transformFvPatchField<Type>(ptf),
84 valueFraction_(ptf.valueFraction_)
89 partialSlipFvPatchField<Type>::partialSlipFvPatchField
91 const partialSlipFvPatchField<Type>& ptf,
92 const DimensionedField<Type, volMesh>& iF
95 transformFvPatchField<Type>(ptf, iF),
96 valueFraction_(ptf.valueFraction_)
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103 void partialSlipFvPatchField<Type>::autoMap
105 const fvPatchFieldMapper& m
108 transformFvPatchField<Type>::autoMap(m);
109 valueFraction_.autoMap(m);
114 void partialSlipFvPatchField<Type>::rmap
116 const fvPatchField<Type>& ptf,
117 const labelList& addr
120 transformFvPatchField<Type>::rmap(ptf, addr);
122 const partialSlipFvPatchField<Type>& dmptf =
123 refCast<const partialSlipFvPatchField<Type> >(ptf);
125 valueFraction_.rmap(dmptf.valueFraction_, addr);
130 tmp<Field<Type> > partialSlipFvPatchField<Type>::snGrad() const
132 vectorField nHat = this->patch().nf();
133 Field<Type> pif = this->patchInternalField();
137 (1.0 - valueFraction_)*transform(I - sqr(nHat), pif) - pif
138 )*this->patch().deltaCoeffs();
143 void partialSlipFvPatchField<Type>::evaluate(const Pstream::commsTypes)
145 if (!this->updated())
147 this->updateCoeffs();
150 vectorField nHat = this->patch().nf();
152 Field<Type>::operator=
154 (1.0 - valueFraction_)
155 *transform(I - sqr(nHat), this->patchInternalField())
158 transformFvPatchField<Type>::evaluate();
163 tmp<Field<Type> > partialSlipFvPatchField<Type>::snGradTransformDiag() const
165 vectorField nHat = this->patch().nf();
166 vectorField diag(nHat.size());
168 diag.replace(vector::X, mag(nHat.component(vector::X)));
169 diag.replace(vector::Y, mag(nHat.component(vector::Y)));
170 diag.replace(vector::Z, mag(nHat.component(vector::Z)));
173 valueFraction_*pTraits<Type>::one
174 + (1.0 - valueFraction_)
175 *transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
180 void partialSlipFvPatchField<Type>::write(Ostream& os) const
182 transformFvPatchField<Type>::write(os);
183 valueFraction_.writeEntry("valueFraction", os);
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 } // End namespace Foam
191 // ************************************************************************* //