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>
93 template<class AnyType>
95 (
96  const faPatchField<AnyType>& pf
97 )
98 {
99  auto* patchTypeCtor = patchConstructorTable(pf.patch().type());
100 
101  if (patchTypeCtor)
102  {
103  return patchTypeCtor
104  (
105  pf.patch(),
107  );
108  }
109  else
110  {
111  return tmp<faPatchField<Type>>
112  (
113  new calculatedFaPatchField<Type>
114  (
115  pf.patch(),
116  DimensionedField<Type, areaMesh>::null()
117  )
118  );
119  }
120 }
122 
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
124 
125 template<class Type>
128 (
129  const tmp<scalarField>&
130 ) const
131 {
133  << "valueInternalCoeffs cannot be called for a calculatedFaPatchField"
134  << "\n on patch " << this->patch().name()
135  << " of field " << this->internalField().name()
136  << " in file " << this->internalField().objectPath()
137  << "\n You are probably trying to solve for a field with a "
138  "default boundary condition."
139  << exit(FatalError);
140 
141  return *this;
142 }
143 
144 
145 template<class Type>
148 (
149  const tmp<scalarField>&
150 ) const
151 {
153  << "valueBoundaryCoeffs cannot be called for a calculatedFaPatchField"
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  << exit(FatalError);
161  return *this;
162 }
163 
164 
165 template<class Type>
168 {
170  << "gradientInternalCoeffs cannot be called for a "
171  "calculatedFaPatchField"
172  << "\n on patch " << this->patch().name()
173  << " of field " << this->internalField().name()
174  << " in file " << this->internalField().objectPath()
175  << "\n You are probably trying to solve for a field with a "
176  "default boundary condition."
177  << exit(FatalError);
179  return *this;
180 }
181 
182 
183 template<class Type>
186 {
188  << "\n "
189  "gradientBoundaryCoeffs cannot be called for a "
190  "calculatedFaPatchField"
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."
197 
198  return *this;
199 }
200 
201 
202 template<class Type>
204 {
207 }
208 
209 
210 // ************************************************************************* //
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:598
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:56
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)
static tmp< faPatchField< Type > > NewCalculatedType(const faPatchField< AnyType > &pf)
Return a pointer to a new calculatedFaPatchField created on freestore without setting patchField valu...
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
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
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.