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 "wedgeFvPatch.H"
27 #include "wedgeFvPatchField.H"
28 #include "transformField.H"
29 #include "symmTransform.H"
30 #include "diagTensor.H"
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
39 const DimensionedField<Type, volMesh>& iF
42 transformFvPatchField<Type>(p, iF)
47 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
49 const wedgeFvPatchField<Type>& ptf,
51 const DimensionedField<Type, volMesh>& iF,
52 const fvPatchFieldMapper& mapper
55 transformFvPatchField<Type>(ptf, p, iF, mapper)
57 if (!isType<wedgeFvPatch>(this->patch()))
61 "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
63 " const wedgeFvPatchField<Type>& ptf,\n"
64 " const fvPatch& p,\n"
65 " const DimensionedField<Type, volMesh>& iF,\n"
66 " const fvPatchFieldMapper& mapper\n"
68 ) << "\n patch type '" << p.type()
69 << "' not constraint type '" << typeName << "'"
70 << "\n for patch " << p.name()
71 << " of field " << this->dimensionedInternalField().name()
72 << " in file " << this->dimensionedInternalField().objectPath()
73 << exit(FatalIOError);
79 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
82 const DimensionedField<Type, volMesh>& iF,
83 const dictionary& dict
86 transformFvPatchField<Type>(p, iF, dict)
88 if (!isType<wedgeFvPatch>(p))
92 "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
94 " const fvPatch& p,\n"
95 " const Field<Type>& field,\n"
99 ) << "\n patch type '" << p.type()
100 << "' not constraint type '" << typeName << "'"
101 << "\n for patch " << p.name()
102 << " of field " << this->dimensionedInternalField().name()
103 << " in file " << this->dimensionedInternalField().objectPath()
104 << exit(FatalIOError);
112 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
114 const wedgeFvPatchField<Type>& ptf
117 transformFvPatchField<Type>(ptf)
122 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
124 const wedgeFvPatchField<Type>& ptf,
125 const DimensionedField<Type, volMesh>& iF
128 transformFvPatchField<Type>(ptf, iF)
132 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
135 Foam::tmp<Foam::Field<Type> > Foam::wedgeFvPatchField<Type>::snGrad() const
137 const Field<Type> pif(this->patchInternalField());
141 transform(refCast<const wedgeFvPatch>(this->patch()).cellT(), pif) - pif
142 )*(0.5*this->patch().deltaCoeffs());
147 void Foam::wedgeFvPatchField<Type>::evaluate(const Pstream::commsTypes)
149 if (!this->updated())
151 this->updateCoeffs();
154 fvPatchField<Type>::operator==
158 refCast<const wedgeFvPatch>(this->patch()).faceT(),
159 this->patchInternalField()
166 Foam::tmp<Foam::Field<Type> >
167 Foam::wedgeFvPatchField<Type>::snGradTransformDiag() const
169 const diagTensor diagT =
170 0.5*diag(I - refCast<const wedgeFvPatch>(this->patch()).cellT());
172 const vector diagV(diagT.xx(), diagT.yy(), diagT.zz());
174 return tmp<Field<Type> >
184 pTraits<typename powProduct<vector, pTraits<Type>::rank>
193 // ************************************************************************* //