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.txx
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  typedef uniformFixedGradientFvPatchField<Type> this_bctype;
92  typedef fixedGradientFvPatchField<Type> parent_bctype;
93 
94  // Private Data
95 
96  //- Function providing the gradient
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("uniformFixedGradient");
104 
105 
106  // Constructors
107 
108  //- Construct from patch and internal field
110  (
111  const fvPatch&,
113  );
114 
115  //- Construct from patch and internal field and patch field
117  (
118  const fvPatch&,
120  const Field<Type>& fld
121  );
122 
123  //- Construct from patch, internal field and dictionary
125  (
126  const fvPatch&,
128  const dictionary&
129  );
130 
131  //- Construct by mapping onto a new patch
133  (
134  const this_bctype&,
135  const fvPatch&,
137  const fvPatchFieldMapper&
138  );
139 
140  //- Construct as copy setting internal field reference
142  (
143  const this_bctype&,
145  );
146 
147  //- No copy without an internal field
148  [[deprecated("2026-03: soon = delete")]]
150  #ifdef Foam_fvPatchField_copyConstruct
151  : this_bctype(pfld, pfld.internalField()) {}
152  #else
153  = delete;
154  #endif
155 
156  //- Clone with an internal field reference
158  (
160  ) const
161  {
162  return fvPatchField<Type>::Clone(*this, iF);
163  }
164 
165 
166  // Member functions
167 
168  //- Update the coefficients associated with the patch field
169  virtual void updateCoeffs();
170 
171  //- Write
172  virtual void write(Ostream& os) const;
173 
174 
175  // Member Operators
176 
177  //- Inherit assignment
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #ifdef NoRepository
189  #include "uniformFixedGradientFvPatchField.txx"
190 #endif
191 
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:130
friend Ostream & operator(Ostream &, const fvPatchField< Type > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
uniformFixedGradientFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:635
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition: Field.H:69
TypeName("uniformFixedGradient")
Runtime type information.
A FieldMapper for finite-volume patch fields.
This boundary condition supplies a fixed gradient condition, such that the patch values are calculate...
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 void write(Ostream &os) const
Write.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const DimensionedField< Type, volMesh > & internalField() const noexcept
Return const-reference to the dimensioned internal field.
Definition: fvPatchField.H:734
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.
virtual tmp< fvPatchField< Type > > clone() const
No clone without an internal field reference.
Definition: fvPatchField.H:610