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 :
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 :
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  (
123  (
124  p,
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 }
141 
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);
180 
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);
197 
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."
213  << abort(FatalError);
214 
215  return *this;
216 }
217 
218 
219 template<class Type>
221 {
223  this->writeEntry("value", os);
224 }
225 
226 
227 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::calculatedFvPatchField::valueBoundaryCoeffs
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
Definition: calculatedFvPatchField.C:168
Foam::calculatedFvPatchField::gradientInternalCoeffs
tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
Definition: calculatedFvPatchField.C:187
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::calculatedFvPatchField::calculatedFvPatchField
calculatedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: calculatedFvPatchField.C:45
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
calculatedFvPatchField.H
fvPatchFieldMapper.H
Foam::fvPatchField::calculatedType
static const word & calculatedType()
Return the type of the calculated for of fvPatchField.
Definition: calculatedFvPatchField.C:35
Foam::calculatedFvPatchField::gradientBoundaryCoeffs
tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
Definition: calculatedFvPatchField.C:204
Foam::calculatedFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: calculatedFvPatchField.C:220
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::calculatedFvPatchField
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
Definition: calculatedFvPatchField.H:66
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::fvPatchField::NewCalculatedType
static tmp< fvPatchField< Type > > NewCalculatedType(const fvPatch &)
Return a pointer to a new calculatedFvPatchField created on.
Definition: calculatedFvPatchField.C:104
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:36
Foam::calculatedFvPatchField::valueInternalCoeffs
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Definition: calculatedFvPatchField.C:148
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::fvPatchField::patch
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:357
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54