FreeFOAM The Cross-Platform CFD Toolkit
wedgeFvPatchField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "wedgeFvPatchField.H"
29 #include <OpenFOAM/symmTransform.H>
30 #include <OpenFOAM/diagTensor.H>
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
39 template<class Type>
41 (
42  const fvPatch& p,
44 )
45 :
47 {}
48 
49 
50 template<class Type>
52 (
53  const wedgeFvPatchField<Type>& ptf,
54  const fvPatch& p,
56  const fvPatchFieldMapper& mapper
57 )
58 :
59  transformFvPatchField<Type>(ptf, p, iF, mapper)
60 {
61  if (!isType<wedgeFvPatch>(this->patch()))
62  {
64  (
65  "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
66  "(\n"
67  " const wedgeFvPatchField<Type>& ptf,\n"
68  " const fvPatch& p,\n"
69  " const DimensionedField<Type, volMesh>& iF,\n"
70  " const fvPatchFieldMapper& mapper\n"
71  ")\n"
72  ) << "\n patch type '" << p.type()
73  << "' not constraint type '" << typeName << "'"
74  << "\n for patch " << p.name()
75  << " of field " << this->dimensionedInternalField().name()
76  << " in file " << this->dimensionedInternalField().objectPath()
77  << exit(FatalIOError);
78  }
79 }
80 
81 
82 template<class Type>
84 (
85  const fvPatch& p,
87  const dictionary& dict
88 )
89 :
91 {
92  if (!isType<wedgeFvPatch>(p))
93  {
95  (
96  "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
97  "(\n"
98  " const fvPatch& p,\n"
99  " const Field<Type>& field,\n"
100  " dictionary& dict\n"
101  ")\n",
102  dict
103  ) << "\n patch type '" << p.type()
104  << "' not constraint type '" << typeName << "'"
105  << "\n for patch " << p.name()
106  << " of field " << this->dimensionedInternalField().name()
107  << " in file " << this->dimensionedInternalField().objectPath()
108  << exit(FatalIOError);
109  }
110 
111  evaluate();
112 }
113 
114 
115 template<class Type>
117 (
118  const wedgeFvPatchField<Type>& ptf
119 )
120 :
122 {}
123 
124 
125 template<class Type>
127 (
128  const wedgeFvPatchField<Type>& ptf,
130 )
131 :
133 {}
134 
135 
136 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
137 
138 template<class Type>
140 {
141  Field<Type> pif = this->patchInternalField();
142  return
143  (
144  transform(refCast<const wedgeFvPatch>(this->patch()).cellT(), pif) - pif
145  )*(0.5*this->patch().deltaCoeffs());
146 }
147 
148 
149 template<class Type>
151 {
152  if (!this->updated())
153  {
154  this->updateCoeffs();
155  }
156 
158  (
159  transform
160  (
161  refCast<const wedgeFvPatch>(this->patch()).faceT(),
162  this->patchInternalField()
163  )
164  );
165 }
166 
167 
168 template<class Type>
170 {
171  const diagTensor diagT =
172  0.5*diag(I - refCast<const wedgeFvPatch>(this->patch()).cellT());
173 
174  const vector diagV(diagT.xx(), diagT.yy(), diagT.zz());
175 
176  return tmp<Field<Type> >
177  (
178  new Field<Type>
179  (
180  this->size(),
181  transformMask<Type>
182  (
183  pow
184  (
185  diagV,
187  ::type>::zero
188  )
189  )
190  )
191  );
192 }
193 
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // ************************ vim: set sw=4 sts=4 et: ************************ //