Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
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
27Class
28 Foam::uniformFixedGradientFvPatchField
29
30Group
31 grpGenericBoundaryConditions
32
33Description
34 This boundary condition provides a uniform fixed gradient condition.
35
36Usage
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
52Note
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
62See also
63 Foam::Function1Types
64 Foam::fixedGradientFvPatchField
65
66SourceFiles
67 uniformFixedGradientFvPatchField.C
68
69\*---------------------------------------------------------------------------*/
70
71#ifndef Foam_uniformFixedGradientFvPatchField_H
72#define Foam_uniformFixedGradientFvPatchField_H
73
75#include "PatchFunction1.H"
76
77// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78
79namespace Foam
80{
81
82/*---------------------------------------------------------------------------*\
83 Class uniformFixedGradientFvPatchField Declaration
84\*---------------------------------------------------------------------------*/
85
86template<class Type>
88:
89 public fixedGradientFvPatchField<Type>
90{
91 // Private Data
92
93 //- Function providing the gradient
94 autoPtr<PatchFunction1<Type>> refGradFunc_;
95
96
97public:
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
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 as copy setting internal field reference
145 (
148 );
149
150 //- Return a clone
151 virtual tmp<fvPatchField<Type>> clone() const
152 {
153 return fvPatchField<Type>::Clone(*this);
154 }
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
176// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178} // End namespace Foam
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182#ifdef NoRepository
184#endif
185
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188#endif
189
190// ************************************************************************* //
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-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 that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
This boundary condition supplies a fixed gradient condition, such that the patch values are calculate...
fixedGradientFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A FieldMapper for finite-volume patch fields.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
A class for managing temporary objects.
Definition tmp.H:75
This boundary condition provides a uniform fixed gradient condition.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("uniformFixedGradient")
Runtime type information.
uniformFixedGradientFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual tmp< fvPatchField< Type > > clone() const
Return a clone.
virtual tmp< fvPatchField< Type > > clone(const DimensionedField< Type, volMesh > &iF) const
Clone with an internal field reference.
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68