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 Type2>
126 (
127  const fvPatchField<Type2>& pf
128 )
129 {
130  return NewCalculatedType(pf.patch());
131 }
133 
134 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
135 
136 template<class Type>
139 (
140  const tmp<scalarField>&
141 ) const
142 {
144  << "cannot be called for a calculatedFvPatchField"
145  << "\n on patch " << this->patch().name()
146  << " of field " << this->internalField().name()
147  << " in file " << this->internalField().objectPath()
148  << "\n You are probably trying to solve for a field with a "
149  "default boundary condition."
150  << abort(FatalError);
151 
152  return *this;
153 }
154 
155 
156 template<class Type>
159 (
160  const tmp<scalarField>&
161 ) const
162 {
164  << "cannot be called for a calculatedFvPatchField"
165  << "\n on patch " << this->patch().name()
166  << " of field " << this->internalField().name()
167  << " in file " << this->internalField().objectPath()
168  << "\n You are probably trying to solve for a field with a "
169  "default boundary condition."
170  << abort(FatalError);
172  return *this;
173 }
174 
175 
176 template<class Type>
179 {
181  << "cannot be called for a calculatedFvPatchField"
182  << "\n on patch " << this->patch().name()
183  << " of field " << this->internalField().name()
184  << " in file " << this->internalField().objectPath()
185  << "\n You are probably trying to solve for a field with a "
186  "default boundary condition."
187  << abort(FatalError);
189  return *this;
190 }
191 
192 
193 template<class Type>
196 {
198  << "cannot be called for a calculatedFvPatchField"
199  << "\n on patch " << this->patch().name()
200  << " of field " << this->internalField().name()
201  << " in file " << this->internalField().objectPath()
202  << "\n You are probably trying to solve for a field with a "
203  "default boundary condition."
205 
206  return *this;
207 }
208 
209 
210 template<class Type>
212 {
215 }
216 
217 
218 // ************************************************************************* //
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
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
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.
tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
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 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: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...
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
readOption
Enumeration defining read preferences.