calculatedFvPatchField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "calculatedFvPatchField.H"
30 #include "fvPatchFieldMapper.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 template<class Type>
36 {
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
43 template<class Type>
45 (
46  const fvPatch& p,
48 )
49 :
50  fvPatchField<Type>(p, iF)
51 {}
52 
53 
54 template<class Type>
56 (
57  const fvPatch& p,
59  const dictionary& dict,
60  const bool valueRequired
61 )
62 :
63  fvPatchField<Type>(p, iF, dict, valueRequired)
64 {}
65 
66 
67 template<class Type>
69 (
71  const fvPatch& p,
73  const fvPatchFieldMapper& mapper
74 )
75 :
76  fvPatchField<Type>(ptf, p, iF, mapper)
77 {}
78 
79 
80 template<class Type>
82 (
84 )
85 :
86  fvPatchField<Type>(ptf)
87 {}
88 
89 
90 template<class Type>
92 (
95 )
96 :
97  fvPatchField<Type>(ptf, iF)
98 {}
99 
100 
101 template<class Type>
104 (
105  const fvPatch& p
106 )
107 {
108  auto* patchTypeCtor = patchConstructorTable(p.type());
109 
110  if (patchTypeCtor)
111  {
112  return patchTypeCtor
113  (
114  p,
116  );
117  }
118  else
119  {
120  return tmp<fvPatchField<Type>>
121  (
122  new calculatedFvPatchField<Type>
123  (
124  p,
125  DimensionedField<Type, volMesh>::null()
126  )
127  );
128  }
129 }
130 
131 
132 template<class Type>
133 template<class Type2>
135 (
136  const fvPatchField<Type2>& pf
137 )
138 {
139  return NewCalculatedType(pf.patch());
140 }
142 
143 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
144 
145 template<class Type>
148 (
149  const tmp<scalarField>&
150 ) const
151 {
153  << "cannot be called for a calculatedFvPatchField"
154  << "\n on patch " << this->patch().name()
155  << " of field " << this->internalField().name()
156  << " in file " << this->internalField().objectPath()
157  << "\n You are probably trying to solve for a field with a "
158  "default boundary condition."
159  << abort(FatalError);
160 
161  return *this;
162 }
163 
164 
165 template<class Type>
168 (
169  const tmp<scalarField>&
170 ) const
171 {
173  << "cannot be called for a calculatedFvPatchField"
174  << "\n on patch " << this->patch().name()
175  << " of field " << this->internalField().name()
176  << " in file " << this->internalField().objectPath()
177  << "\n You are probably trying to solve for a field with a "
178  "default boundary condition."
179  << abort(FatalError);
181  return *this;
182 }
183 
184 
185 template<class Type>
188 {
190  << "cannot be called for a calculatedFvPatchField"
191  << "\n on patch " << this->patch().name()
192  << " of field " << this->internalField().name()
193  << " in file " << this->internalField().objectPath()
194  << "\n You are probably trying to solve for a field with a "
195  "default boundary condition."
196  << abort(FatalError);
198  return *this;
199 }
200 
201 
202 template<class Type>
205 {
207  << "cannot be called for a calculatedFvPatchField"
208  << "\n on patch " << this->patch().name()
209  << " of field " << this->internalField().name()
210  << " in file " << this->internalField().objectPath()
211  << "\n You are probably trying to solve for a field with a "
212  "default boundary condition."
214 
215  return *this;
216 }
217 
218 
219 template<class Type>
221 {
223  this->writeEntry("value", os);
224 }
225 
226 
227 // ************************************************************************* //
dictionary dict
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:578
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:68
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual void write(Ostream &) const
Write.
tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
static const word & calculatedType()
The type name for calculated patch fields.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
A class for handling words, derived from Foam::string.
Definition: word.H:63
A FieldMapper for finite-volume patch fields.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
errorManip< error > abort(error &err)
Definition: errorManip.H:139
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
OBJstream os(runTime.globalPath()/outputName)
calculatedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
static tmp< fvPatchField< Type > > NewCalculatedType(const fvPatch &)
Return a pointer to a new calculatedFvPatchField created on.
const std::string patch
OpenFOAM patch number as a std::string.
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50