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 
30 #include "fvPatchFieldMapper.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class Type>
36 (
37  const fvPatch& p,
39 )
40 :
41  fvPatchField<Type>(p, iF)
42 {}
43 
44 
45 template<class Type>
47 (
48  const fvPatch& p,
50  const dictionary& dict,
51  IOobjectOption::readOption requireValue
52 )
53 :
54  fvPatchField<Type>(p, iF, dict, requireValue)
55 {}
56 
57 
58 template<class Type>
60 (
62  const fvPatch& p,
64  const fvPatchFieldMapper& mapper
65 )
66 :
67  fvPatchField<Type>(ptf, p, iF, mapper)
68 {}
69 
70 
71 template<class Type>
73 (
75 )
76 :
77  fvPatchField<Type>(ptf)
78 {}
79 
80 
81 template<class Type>
83 (
86 )
87 :
88  fvPatchField<Type>(ptf, iF)
89 {}
90 
91 
92 template<class Type>
95 (
96  const fvPatch& p
97 )
98 {
99  auto* patchTypeCtor = patchConstructorTable(p.type());
100 
101  if (patchTypeCtor)
102  {
103  return patchTypeCtor
104  (
105  p,
107  );
108  }
109  else
110  {
111  return tmp<fvPatchField<Type>>
112  (
113  new calculatedFvPatchField<Type>
114  (
115  p,
116  DimensionedField<Type, volMesh>::null()
117  )
118  );
119  }
120 }
121 
122 
123 template<class Type>
124 template<class AnyType>
127 (
128  const fvPatchField<AnyType>& pf
129 )
130 {
131  return NewCalculatedType(pf.patch());
132 }
134 
135 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
136 
137 template<class Type>
140 (
141  const tmp<scalarField>&
142 ) const
143 {
145  << "cannot be called for a calculatedFvPatchField"
146  << "\n on patch " << this->patch().name()
147  << " of field " << this->internalField().name()
148  << " in file " << this->internalField().objectPath()
149  << "\n You are probably trying to solve for a field with a "
150  "default boundary condition."
151  << abort(FatalError);
152 
153  return *this;
154 }
155 
156 
157 template<class Type>
160 (
161  const tmp<scalarField>&
162 ) const
163 {
165  << "cannot be called for a calculatedFvPatchField"
166  << "\n on patch " << this->patch().name()
167  << " of field " << this->internalField().name()
168  << " in file " << this->internalField().objectPath()
169  << "\n You are probably trying to solve for a field with a "
170  "default boundary condition."
171  << abort(FatalError);
173  return *this;
174 }
175 
176 
177 template<class Type>
180 {
182  << "cannot be called for a calculatedFvPatchField"
183  << "\n on patch " << this->patch().name()
184  << " of field " << this->internalField().name()
185  << " in file " << this->internalField().objectPath()
186  << "\n You are probably trying to solve for a field with a "
187  "default boundary condition."
188  << abort(FatalError);
190  return *this;
191 }
192 
193 
194 template<class Type>
197 {
199  << "cannot be called for a calculatedFvPatchField"
200  << "\n on patch " << this->patch().name()
201  << " of field " << this->internalField().name()
202  << " in file " << this->internalField().objectPath()
203  << "\n You are probably trying to solve for a field with a "
204  "default boundary condition."
206 
207  return *this;
208 }
209 
210 
211 template<class Type>
213 {
216 }
217 
218 
219 // ************************************************************************* //
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:129
const fvPatch & patch() const noexcept
Return the patch.
Definition: fvPatchField.H:269
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:608
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual void write(Ostream &) const
Write includes "value" entry.
tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
static tmp< fvPatchField< Type > > NewCalculatedType(const fvPatch &p)
Return a pointer to a new calculatedFvPatchField created on.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
A FieldMapper for finite-volume patch fields.
This boundary condition is not designed to be evaluated; it is assumed 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:56
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...
const std::string patch
OpenFOAM patch number as a std::string.
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
readOption
Enumeration defining read preferences.