uniformFixedGradientFvPatchField.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) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2017-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class Type>
35(
36 const fvPatch& p,
38)
39:
41 uniformGradient_(nullptr)
42{}
43
44
45template<class Type>
47(
48 const fvPatch& p,
50 const Field<Type>& fld
51)
52:
54 uniformGradient_(nullptr)
55{}
56
57
58template<class Type>
60(
61 const fvPatch& p,
63 const dictionary& dict
64)
65:
67 uniformGradient_
68 (
69 PatchFunction1<Type>::New(p.patch(), "uniformGradient", dict)
70 )
71{
72 this->patchType() = dict.getOrDefault<word>("patchType", word::null);
73 this->evaluate();
74}
75
76
77template<class Type>
79(
81 const fvPatch& p,
83 const fvPatchFieldMapper& mapper
84)
85:
86 fixedGradientFvPatchField<Type>(ptf, p, iF, mapper),
87 uniformGradient_(ptf.uniformGradient_.clone())
88{}
89
90
91template<class Type>
93(
95)
96:
98 uniformGradient_(ptf.uniformGradient_.clone())
99{}
100
101
102template<class Type>
104(
107)
108:
109 fixedGradientFvPatchField<Type>(ptf, iF),
110 uniformGradient_(ptf.uniformGradient_.clone())
111{
112 // Evaluate the profile if defined
113 if (ptf.uniformGradient_)
114 {
115 this->evaluate();
116 }
117}
118
119
120// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121
122template<class Type>
124{
125 if (this->updated())
126 {
127 return;
128 }
129
130 const scalar t = this->db().time().timeOutputValue();
131 this->gradient() = uniformGradient_->value(t);
132
134}
135
136
137template<class Type>
139{
141 uniformGradient_->writeData(os);
142 this->writeEntry("value", os);
143}
144
145
146// ************************************************************************* //
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
This boundary condition supplies a fixed gradient condition, such that the patch values are calculate...
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
const word & patchType() const
Optional patch type.
Definition: fvPatchField.H:380
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
This boundary condition provides a uniform fixed gradient condition.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for handling words, derived from Foam::string.
Definition: word.H:68
static const word null
An empty word.
Definition: word.H:80
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
dictionary dict