fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / finiteVolume / fields / fvPatchFields / constraint / wedge / wedgeFvPatchField.C
blob33c8135666a0d3e54259d655c2f255676f19766b
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     const diagTensor diagT =
173         0.5*diag(I - refCast<const wedgeFvPatch>(this->patch()).cellT());
175     const vector diagV(diagT.xx(), diagT.yy(), diagT.zz());
177     return tmp<Field<Type> >
178     (
179         new Field<Type>
180         (
181             this->size(),
182             transformMask<Type>
183             (
184                 pow
185                 (
186                     diagV,
187                     pTraits<typename powProduct<vector, pTraits<Type>::rank>
188                     ::type>::zero
189                 )
190             )
191         )
192     );
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 } // End namespace Foam
200 // ************************************************************************* //