uniformFixedGradientFvPatchField.H
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) 2020-2023 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 Class
28  Foam::uniformFixedGradientFvPatchField
29 
30 Group
31  grpGenericBoundaryConditions
32 
33 Description
34  This boundary condition provides a uniform fixed gradient condition.
35 
36 Usage
37  \table
38  Property | Description | Required | Default
39  uniformGradient | uniform gradient | yes |
40  value | initial field value | optional |
41  \endtable
42 
43  Example of the boundary condition specification:
44  \verbatim
45  <patchName>
46  {
47  type uniformFixedGradient;
48  uniformGradient constant 0.2;
49  }
50  \endverbatim
51 
52 Note
53  The uniformGradient entry is a PatchFunction1 type,
54  able to describe time and spatial varying functions.
55  The example above gives the usage for supplying a constant value.
56 
57  The \c value entry (optional) is used for the initial values.
58  Otherwise the \c uniformGradient is used for the evaluation.
59  In some cases (eg, coded or expression entries with references to other
60  fields) this can be problematic and the \c value entry will be needed.
61 
62 See also
63  Foam::Function1Types
64  Foam::fixedGradientFvPatchField
65 
66 SourceFiles
67  uniformFixedGradientFvPatchField.C
68 
69 \*---------------------------------------------------------------------------*/
70 
71 #ifndef Foam_uniformFixedGradientFvPatchField_H
72 #define Foam_uniformFixedGradientFvPatchField_H
73 
75 #include "PatchFunction1.H"
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 
82 /*---------------------------------------------------------------------------*\
83  Class uniformFixedGradientFvPatchField Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 template<class Type>
87 class uniformFixedGradientFvPatchField
88 :
89  public fixedGradientFvPatchField<Type>
90 {
91  // Private Data
92 
93  //- Function providing the gradient
94  autoPtr<PatchFunction1<Type>> refGradFunc_;
95 
96 
97 public:
98 
99  //- Runtime type information
100  TypeName("uniformFixedGradient");
101 
102 
103  // Constructors
104 
105  //- Construct from patch and internal field
107  (
108  const fvPatch&,
110  );
111 
112  //- Construct from patch and internal field and patch field
114  (
115  const fvPatch&,
117  const Field<Type>& fld
118  );
119 
120  //- Construct from patch, internal field and dictionary
122  (
123  const fvPatch&,
125  const dictionary&
126  );
127 
128  //- Construct by mapping onto a new patch
130  (
132  const fvPatch&,
134  const fvPatchFieldMapper&
135  );
136 
137  //- Construct as copy
139  (
141  );
142 
143  //- Construct and return a clone
144  virtual tmp<fvPatchField<Type>> clone() const
145  {
146  return tmp<fvPatchField<Type>>
147  (
149  );
150  }
151 
152  //- Construct as copy setting internal field reference
154  (
157  );
158 
159  //- Construct and return a clone setting internal field reference
161  (
163  ) const
164  {
165  return tmp<fvPatchField<Type>>
166  (
168  );
169  }
171 
172  // Member functions
173 
174  //- Update the coefficients associated with the patch field
175  virtual void updateCoeffs();
176 
177  //- Write
178  virtual void write(Ostream& os) const;
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #ifdef NoRepository
190 #endif
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #endif
195 
196 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual void write(Ostream &os) const
Write.
uniformFixedGradientFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Generic templated field type.
Definition: Field.H:62
TypeName("uniformFixedGradient")
Runtime type information.
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
This boundary condition provides a uniform fixed gradient condition.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.