Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / src / finiteVolume / fields / fvPatchFields / constraint / wedge / wedgeFvPatchField.C
blobba195173924865641b031b837034971669c8de79
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "wedgeFvPatch.H"
28 #include "wedgeFvPatchField.H"
29 #include "transformField.H"
30 #include "symmTransform.H"
31 #include "diagTensor.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
40 template<class Type>
41 wedgeFvPatchField<Type>::wedgeFvPatchField
43     const fvPatch& p,
44     const DimensionedField<Type, volMesh>& iF
47     transformFvPatchField<Type>(p, iF)
51 template<class Type>
52 wedgeFvPatchField<Type>::wedgeFvPatchField
54     const wedgeFvPatchField<Type>& ptf,
55     const fvPatch& p,
56     const DimensionedField<Type, volMesh>& iF,
57     const fvPatchFieldMapper& mapper
60     transformFvPatchField<Type>(ptf, p, iF, mapper)
62     if (!isType<wedgeFvPatch>(this->patch()))
63     {
64         FatalErrorIn
65         (
66             "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
67             "(\n"
68             "    const wedgeFvPatchField<Type>& ptf,\n"
69             "    const fvPatch& p,\n"
70             "    const DimensionedField<Type, volMesh>& iF,\n"
71             "    const fvPatchFieldMapper& mapper\n"
72             ")\n"
73         )   << "\n    patch type '" << p.type()
74             << "' not constraint type '" << typeName << "'"
75             << "\n    for patch " << p.name()
76             << " of field " << this->dimensionedInternalField().name()
77             << " in file " << this->dimensionedInternalField().objectPath()
78             << exit(FatalIOError);
79     }
83 template<class Type>
84 wedgeFvPatchField<Type>::wedgeFvPatchField
86     const fvPatch& p,
87     const DimensionedField<Type, volMesh>& iF,
88     const dictionary& dict
91     transformFvPatchField<Type>(p, iF, dict)
93     if (!isType<wedgeFvPatch>(p))
94     {
95         FatalIOErrorIn
96         (
97             "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
98             "(\n"
99             "    const fvPatch& p,\n"
100             "    const Field<Type>& field,\n"
101             "    dictionary& dict\n"
102             ")\n",
103             dict
104         )   << "\n    patch type '" << p.type()
105             << "' not constraint type '" << typeName << "'"
106             << "\n    for patch " << p.name()
107             << " of field " << this->dimensionedInternalField().name()
108             << " in file " << this->dimensionedInternalField().objectPath()
109             << exit(FatalIOError);
110     }
112     evaluate();
116 template<class Type>
117 wedgeFvPatchField<Type>::wedgeFvPatchField
119     const wedgeFvPatchField<Type>& ptf
122     transformFvPatchField<Type>(ptf)
126 template<class Type>
127 wedgeFvPatchField<Type>::wedgeFvPatchField
129     const wedgeFvPatchField<Type>& ptf,
130     const DimensionedField<Type, volMesh>& iF
133     transformFvPatchField<Type>(ptf, iF)
137 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
139 template<class Type>
140 tmp<Field<Type> > wedgeFvPatchField<Type>::snGrad() const
142     Field<Type> pif = this->patchInternalField();
143     return
144     (
145         transform(refCast<const wedgeFvPatch>(this->patch()).cellT(), pif) - pif
146     )*(0.5*this->patch().deltaCoeffs());
150 template<class Type>
151 void wedgeFvPatchField<Type>::evaluate(const Pstream::commsTypes)
153     if (!this->updated())
154     {
155         this->updateCoeffs();
156     }
158     fvPatchField<Type>::operator==
159     (
160         transform
161         (
162             refCast<const wedgeFvPatch>(this->patch()).faceT(),
163             this->patchInternalField()
164         )
165     );
169 template<class Type>
170 tmp<Field<Type> > wedgeFvPatchField<Type>::snGradTransformDiag() const
172     diagTensor diagT = 
173         0.5*diag(I - refCast<const wedgeFvPatch>(this->patch()).cellT());
175     return tmp<Field<Type> >
176     (
177         new Field<Type>
178         (
179             this->size(),
180             transformMask<Type>
181             (
182                 pow
183                 (
184                     reinterpret_cast<const vector&>(diagT),
185                     pTraits<typename powProduct<vector, pTraits<Type>::rank>
186                     ::type>::zero
187                 )
188             )
189         )
190     );
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 } // End namespace Foam
198 // ************************************************************************* //