calculatedFaPatchField.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) 2016-2017 Wikki Ltd
9  Copyright (C) 2021-2023 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 "faPatchFieldMapper.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class Type>
36 (
37  const faPatch& p,
39 )
40 :
41  faPatchField<Type>(p, iF)
42 {}
43 
44 
45 template<class Type>
47 (
48  const faPatch& p,
50  const dictionary& dict,
51  IOobjectOption::readOption requireValue
52 )
53 :
54  faPatchField<Type>(p, iF, dict, requireValue)
55 {}
56 
57 
58 template<class Type>
60 (
62  const faPatch& p,
64  const faPatchFieldMapper& mapper
65 )
66 :
67  faPatchField<Type>(ptf, p, iF, mapper)
68 {}
69 
70 
71 template<class Type>
73 (
75 )
76 :
77  faPatchField<Type>(ptf)
78 {}
79 
80 
81 template<class Type>
83 (
86 )
87 :
88  faPatchField<Type>(ptf, iF)
89 {}
90 
91 
92 template<class Type>
95 (
96  const faPatch& 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<faPatchField<Type>>
112  (
113  new calculatedFaPatchField<Type>
114  (
115  p,
116  DimensionedField<Type, areaMesh>::null()
117  )
118  );
119  }
120 }
121 
122 
123 template<class Type>
124 template<class AnyType>
127 (
128  const faPatchField<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  << "valueInternalCoeffs cannot be called for a calculatedFaPatchField"
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  << exit(FatalError);
152 
153  return *this;
154 }
155 
156 
157 template<class Type>
160 (
161  const tmp<scalarField>&
162 ) const
163 {
165  << "valueBoundaryCoeffs cannot be called for a calculatedFaPatchField"
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  << exit(FatalError);
173  return *this;
174 }
175 
176 
177 template<class Type>
180 {
182  << "gradientInternalCoeffs cannot be called for a "
183  "calculatedFaPatchField"
184  << "\n on patch " << this->patch().name()
185  << " of field " << this->internalField().name()
186  << " in file " << this->internalField().objectPath()
187  << "\n You are probably trying to solve for a field with a "
188  "default boundary condition."
189  << exit(FatalError);
191  return *this;
192 }
193 
194 
195 template<class Type>
198 {
200  << "\n "
201  "gradientBoundaryCoeffs cannot be called for a "
202  "calculatedFaPatchField"
203  << "\n on patch " << this->patch().name()
204  << " of field " << this->internalField().name()
205  << " in file " << this->internalField().objectPath()
206  << "\n You are probably trying to solve for a field with a "
207  "default boundary condition."
209 
210  return *this;
211 }
212 
213 
214 template<class Type>
216 {
219 }
220 
221 
222 // ************************************************************************* //
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.
const faPatch & patch() const noexcept
Return the patch.
Definition: faPatchField.H:231
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
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:608
virtual void write(Ostream &) const
Write.
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:46
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)
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
calculatedFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
OBJstream os(runTime.globalPath()/outputName)
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
static tmp< faPatchField< Type > > NewCalculatedType(const faPatch &p)
Return a pointer to a new calculatedFaPatchField created on freestore without setting patchField valu...
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
A FieldMapper for finite-area patch fields.
readOption
Enumeration defining read preferences.