BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / constraint / wedge / wedgeFvPatchField.C
blob73955b7c2b2917bde3a14e8f2271cfd154af15a6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
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
19     for more details.
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  * * * * * * * * * * * * * * //
35 template<class Type>
36 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
38     const fvPatch& p,
39     const DimensionedField<Type, volMesh>& iF
42     transformFvPatchField<Type>(p, iF)
46 template<class Type>
47 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
49     const wedgeFvPatchField<Type>& ptf,
50     const fvPatch& p,
51     const DimensionedField<Type, volMesh>& iF,
52     const fvPatchFieldMapper& mapper
55     transformFvPatchField<Type>(ptf, p, iF, mapper)
57     if (!isType<wedgeFvPatch>(this->patch()))
58     {
59         FatalErrorIn
60         (
61             "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
62             "(\n"
63             "    const wedgeFvPatchField<Type>& ptf,\n"
64             "    const fvPatch& p,\n"
65             "    const DimensionedField<Type, volMesh>& iF,\n"
66             "    const fvPatchFieldMapper& mapper\n"
67             ")\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);
74     }
78 template<class Type>
79 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
81     const fvPatch& p,
82     const DimensionedField<Type, volMesh>& iF,
83     const dictionary& dict
86     transformFvPatchField<Type>(p, iF, dict)
88     if (!isType<wedgeFvPatch>(p))
89     {
90         FatalIOErrorIn
91         (
92             "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
93             "(\n"
94             "    const fvPatch& p,\n"
95             "    const Field<Type>& field,\n"
96             "    dictionary& dict\n"
97             ")\n",
98             dict
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);
105     }
107     evaluate();
111 template<class Type>
112 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
114     const wedgeFvPatchField<Type>& ptf
117     transformFvPatchField<Type>(ptf)
121 template<class Type>
122 Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
124     const wedgeFvPatchField<Type>& ptf,
125     const DimensionedField<Type, volMesh>& iF
128     transformFvPatchField<Type>(ptf, iF)
132 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
134 template<class Type>
135 Foam::tmp<Foam::Field<Type> > Foam::wedgeFvPatchField<Type>::snGrad() const
137     const Field<Type> pif(this->patchInternalField());
139     return
140     (
141         transform(refCast<const wedgeFvPatch>(this->patch()).cellT(), pif) - pif
142     )*(0.5*this->patch().deltaCoeffs());
146 template<class Type>
147 void Foam::wedgeFvPatchField<Type>::evaluate(const Pstream::commsTypes)
149     if (!this->updated())
150     {
151         this->updateCoeffs();
152     }
154     fvPatchField<Type>::operator==
155     (
156         transform
157         (
158             refCast<const wedgeFvPatch>(this->patch()).faceT(),
159             this->patchInternalField()
160         )
161     );
165 template<class Type>
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> >
175     (
176         new Field<Type>
177         (
178             this->size(),
179             transformMask<Type>
180             (
181                 pow
182                 (
183                     diagV,
184                     pTraits<typename powProduct<vector, pTraits<Type>::rank>
185                     ::type>::zero
186                 )
187             )
188         )
189     );
193 // ************************************************************************* //