genericFvsPatchField.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) 2019-2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "genericFvsPatchField.H"
29 #include "fvPatchFieldMapper.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const fvPatch& p,
38 )
39 :
40  parent_bctype(p, iF)
41 {
43  << "Trying to construct an genericFvsPatchField on patch "
44  << this->patch().name()
45  << " of field " << this->internalField().name()
46  << abort(FatalError);
47 }
48 
49 
50 template<class Type>
52 (
53  const fvPatch& p,
55  const dictionary& dict
56 )
57 :
58  parent_bctype(p, iF, dict),
60 {
61  const label patchSize = this->size();
62  const word& patchName = this->patch().name();
63  const IOobject& io = this->internalField();
64 
65  if (!dict.found("value"))
66  {
67  reportMissingEntry("value", patchName, io);
68  }
69 
70  // Handle "value" separately
71  processGeneric(patchSize, patchName, io, true);
72 }
73 
74 
75 template<class Type>
77 (
78  const genericFvsPatchField<Type>& rhs,
79  const fvPatch& p,
81  const fvPatchFieldMapper& mapper
82 )
83 :
84  parent_bctype(rhs, p, iF, mapper),
86 {
87  this->mapGeneric(rhs, mapper);
88 }
89 
90 
91 template<class Type>
93 (
94  const genericFvsPatchField<Type>& rhs,
96 )
97 :
98  parent_bctype(rhs, iF),
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 
105 
106 template<class Type>
108 {
109  // Handle "value" separately
110  genericPatchFieldBase::writeGeneric(os, true);
111  this->writeEntry("value", os);
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 fvsPatchField<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 genericFvsPatchField";
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 genericFvsPatchField";
173 
174  genericFatalSolveError
175  (
176  this->patch().name(),
177  this->internalField()
178  );
180 
181  return *this;
182 }
183 
184 
185 template<class Type>
188 {
190  << "Cannot be called for a genericFvsPatchField";
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 genericFvsPatchField";
208 
209  genericFatalSolveError
210  (
211  this->patch().name(),
212  this->internalField()
213  );
215 
216  return *this;
217 }
218 
219 
220 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::genericFvsPatchField
This boundary condition provides a generic version of the calculated condition, useful as a fallback ...
Definition: genericFvsPatchField.H:57
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::genericPatchFieldBase
Generic infrastructure for reading/writing unknown patch types.
Definition: genericPatchFieldBase.H:54
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::genericFvsPatchField::valueBoundaryCoeffs
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Fatal.
Definition: genericFvsPatchField.C:167
Foam::fvsPatchField
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:68
Foam::calculatedFvsPatchField
Foam::calculatedFvsPatchField.
Definition: calculatedFvsPatchField.H:51
Foam::genericFvsPatchField::gradientInternalCoeffs
tmp< Field< Type > > gradientInternalCoeffs() const
Fatal.
Definition: genericFvsPatchField.C:187
fvPatchFieldMapper.H
genericFvsPatchField.H
Foam::genericFvsPatchField::gradientBoundaryCoeffs
tmp< Field< Type > > gradientBoundaryCoeffs() const
Fatal.
Definition: genericFvsPatchField.C:204
Foam::genericFvsPatchField::write
virtual void write(Ostream &) const
Write.
Definition: genericFvsPatchField.C:107
Foam::genericFvsPatchField::valueInternalCoeffs
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Fatal.
Definition: genericFvsPatchField.C:146
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::genericFvsPatchField::rmap
virtual void rmap(const fvsPatchField< Type > &, const labelList &)
Reverse map the given faPatchField onto this faPatchField.
Definition: genericFvsPatchField.C:128
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::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::genericFvsPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: genericFvsPatchField.C:117
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::List< label >
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::genericFvsPatchField::genericFvsPatchField
genericFvsPatchField(const fvPatch &, const DimensionedField< Type, surfaceMesh > &)
Construct from patch and internal field.
Definition: genericFvsPatchField.C:35
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
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
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62