fixedGradientFvPatchField.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-------------------------------------------------------------------------------
10License
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
29#include "dictionary.H"
30
31// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32
33template<class Type>
35(
36 const fvPatch& p,
38)
39:
40 fvPatchField<Type>(p, iF),
41 gradient_(p.size(), Zero)
42{}
43
44
45template<class Type>
47(
48 const fvPatch& p,
50 const dictionary& dict
51)
52:
53 fvPatchField<Type>(p, iF, dict, false),
54 gradient_("gradient", dict, p.size())
55{
56 evaluate();
57}
58
59
60template<class Type>
62(
64 const fvPatch& p,
66 const fvPatchFieldMapper& mapper
67)
68:
69 fvPatchField<Type>(ptf, p, iF, mapper),
70 gradient_(ptf.gradient_, mapper)
71{
72 if (notNull(iF) && mapper.hasUnmapped())
73 {
75 << "On field " << iF.name() << " patch " << p.name()
76 << " patchField " << this->type()
77 << " : mapper does not map all values." << nl
78 << " To avoid this warning fully specify the mapping in derived"
79 << " patch fields." << endl;
80 }
81}
82
83
84template<class Type>
86(
88)
89:
90 fvPatchField<Type>(ptf),
91 gradient_(ptf.gradient_)
92{}
93
94
95template<class Type>
97(
100)
101:
102 fvPatchField<Type>(ptf, iF),
103 gradient_(ptf.gradient_)
104{}
105
106
107// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108
109template<class Type>
111(
112 const fvPatchFieldMapper& m
113)
114{
116 gradient_.autoMap(m);
117}
118
119
120template<class Type>
122(
123 const fvPatchField<Type>& ptf,
124 const labelList& addr
125)
126{
127 fvPatchField<Type>::rmap(ptf, addr);
128
130 refCast<const fixedGradientFvPatchField<Type>>(ptf);
131
132 gradient_.rmap(fgptf.gradient_, addr);
133}
134
135
136template<class Type>
138{
139 if (!this->updated())
140 {
141 this->updateCoeffs();
142 }
143
145 (
146 this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
147 );
148
150}
151
152
153template<class Type>
156(
157 const tmp<scalarField>&
158) const
159{
160 return tmp<Field<Type>>::New(this->size(), pTraits<Type>::one);
161}
162
163
164template<class Type>
167(
168 const tmp<scalarField>&
169) const
170{
171 return gradient()/this->patch().deltaCoeffs();
172}
173
174
175template<class Type>
178{
179 return tmp<Field<Type>>::New(this->size(), Zero);
180}
181
182
183template<class Type>
186{
187 return gradient();
188}
189
190
191template<class Type>
193{
195 gradient_.writeEntry("gradient", os);
196}
197
198
199// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual bool hasUnmapped() const =0
Any unmapped values?
Generic templated field type.
Definition: Field.H:82
void evaluate()
Evaluate boundary conditions.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
commsTypes
Types of communications.
Definition: UPstream.H:67
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
This boundary condition supplies a fixed gradient condition, such that the patch values are calculate...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:82
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: fvPatchField.C:252
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: fvPatchField.C:315
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:62
A class for managing temporary objects.
Definition: tmp.H:65
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
bool notNull(const T *ptr)
True if ptr is not a pointer (of type T) to the nullObject.
Definition: nullObject.H:207
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
dictionary dict