genericFvPatchField.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) 2019-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  parent_bctype(p, iF)
42 {
44  << "Trying to construct generic patchField on patch "
45  << this->patch().name()
46  << " of field " << this->internalField().name()
47  << abort(FatalError);
48 }
49 
50 
51 template<class Type>
53 (
54  const fvPatch& p,
56  const dictionary& dict
57 )
58 :
59  parent_bctype(p, iF, dict),
61 {
62  const label patchSize = this->size();
63  const word& patchName = this->patch().name();
64  const IOobject& io = this->internalField();
65 
66  if (!dict.findEntry("value", keyType::LITERAL))
67  {
68  reportMissingEntry("value", patchName, io);
69  }
70 
71  // Handle "value" separately
72  processGeneric(patchSize, patchName, io, true);
73 }
74 
75 
76 template<class Type>
78 (
79  const genericFvPatchField<Type>& rhs,
80  const fvPatch& p,
82  const fvPatchFieldMapper& mapper
83 )
84 :
85  parent_bctype(rhs, p, iF, mapper),
87 {
88  this->mapGeneric(rhs, mapper);
89 }
90 
91 
92 template<class Type>
94 (
95  const genericFvPatchField<Type>& rhs,
97 )
98 :
99  parent_bctype(rhs, iF),
101 {}
102 
103 
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105 
106 template<class Type>
108 {
109  // Handle "value" separately
112 }
113 
114 
115 template<class Type>
117 (
118  const fvPatchFieldMapper& m
119 )
120 {
121  parent_bctype::autoMap(m);
122  this->autoMapGeneric(m);
123 }
124 
125 
126 template<class Type>
128 (
129  const fvPatchField<Type>& rhs,
130  const labelList& addr
131 )
132 {
133  parent_bctype::rmap(rhs, addr);
134 
135  const auto* base = isA<genericPatchFieldBase>(rhs);
136  if (base)
137  {
138  this->rmapGeneric(*base, addr);
139  }
140 }
141 
142 
143 template<class Type>
146 (
147  const tmp<scalarField>&
148 ) const
149 {
151  << "Cannot be called for a generic patchField";
152 
153  genericFatalSolveError
154  (
155  this->patch().name(),
156  this->internalField()
157  );
159 
160  return *this;
161 }
162 
163 
164 template<class Type>
167 (
168  const tmp<scalarField>&
169 ) const
170 {
172  << "Cannot be called for a generic patchField";
173 
174  genericFatalSolveError
175  (
176  this->patch().name(),
177  this->internalField()
178  );
181  return *this;
182 }
183 
184 
185 template<class Type>
188 {
190  << "Cannot be called for a generic patchField";
191 
192  genericFatalSolveError
193  (
194  this->patch().name(),
195  this->internalField()
196  );
198 
199  return *this;
200 }
201 
202 template<class Type>
205 {
207  << "Cannot be called for a generic patchField";
208 
209  genericFatalSolveError
210  (
211  this->patch().name(),
212  this->internalField()
213  );
215 
216  return *this;
217 }
218 
219 
220 // ************************************************************************* //
tmp< Field< Type > > gradientInternalCoeffs() const
Fatal.
dictionary dict
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
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:598
void writeGeneric(Ostream &os, const bool separateValue) const
Write all generic entries from dictionary, optionally treating the "value" entry separately.
This boundary condition provides a generic version of the calculated condition, useful as a fallback ...
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual void write(Ostream &) const
Write.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
Definition: fvPatchField.H:375
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
void reportMissingEntry(const word &entryName, const word &patchName, const IOobject &io) const
FatalError for missing entry.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Fatal.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
A FieldMapper for finite-volume patch fields.
tmp< Field< Type > > gradientBoundaryCoeffs() const
Fatal.
void processGeneric(const label patchSize, const word &patchName, const IOobject &io, const bool separateValue)
genericFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
String literal.
Definition: keyType.H:82
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
label size() const noexcept
The number of elements in the container.
Definition: UList.H:671
OBJstream os(runTime.globalPath()/outputName)
Generic infrastructure for reading/writing unknown patch types.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
const DimensionedField< Type, volMesh > & internalField() const noexcept
Return const-reference to the dimensioned internal field.
Definition: fvPatchField.H:662
const std::string patch
OpenFOAM patch number as a std::string.
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
Definition: dictionaryI.H:84
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Fatal.
virtual const word & name() const
Return name.
Definition: fvPatch.H:210
volScalarField & p
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172