uniformFixedGradientFvPatchField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "setSizeFieldMapper.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 (
34  const fvPatch& p,
36  const dictionary& dict
37 )
38 :
39  fixedGradientFvPatchField<Type>(p, iF),
40  uniformGradient_
41  (
42  Function1<Type>::New
43  (
44  "uniformGradient",
45  this->time().userUnits(),
46  iF.dimensions()/dimLength,
47  dict
48  )
49  )
50 {
51  this->evaluate();
52 }
53 
54 
55 template<class Type>
57 (
59  const fvPatch& p,
61  const fieldMapper& mapper
62 )
63 :
64  fixedGradientFvPatchField<Type>(ptf, p, iF, mapper, false), // Don't map
65  uniformGradient_(ptf.uniformGradient_, false)
66 {
67  // Evaluate since value not mapped
68  this->evaluate();
69 }
70 
71 
72 template<class Type>
74 (
77 )
78 :
79  fixedGradientFvPatchField<Type>(ptf, iF),
80  uniformGradient_(ptf.uniformGradient_, false)
81 {
82  // Evaluate the profile if defined
83  if (ptf.uniformGradient_.valid())
84  {
85  this->evaluate();
86  }
87 }
88 
89 
90 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
91 
92 template<class Type>
94 (
95  const fvPatchField<Type>& ptf,
96  const fieldMapper& mapper
97 )
98 {
99  // Resize as necessary
101  (
102  ptf,
103  setSizeFieldMapper(this->patch().size())
104  );
105 
106  // Evaluate since value not mapped
107  this->evaluate();
108 }
109 
110 
111 template<class Type>
113 {
114  if (this->updated())
115  {
116  return;
117  }
118 
119  this->gradient() = uniformGradient_->value(this->time().value());
120 
122 }
123 
124 
125 template<class Type>
127 {
129  writeEntry
130  (
131  os,
132  this->time().userUnits(),
133  this->internalField().dimensions()/dimLength,
134  uniformGradient_()
135  );
136  writeEntry(os, "value", *this);
137 }
138 
139 
140 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Run-time selectable general function of one variable.
Definition: Function1.H:62
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
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 void write(Ostream &) const
Write.
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:90
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:208
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
Mapper which sets the field size. It does not actually map values.
This boundary condition provides a uniform fixed gradient condition.
uniformFixedGradientFvPatchField(const fvPatch &, const DimensionedField< Type, fvMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
const dimensionSet time
const dimensionSet & dimLength
Definition: dimensions.C:141
void evaluate(GeometricField< Type, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, GeoMesh > &x)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dictionary dict
volScalarField & p