Loading...
Searching...
No Matches
uniformFixedGradientFaPatchField.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) 2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::uniformFixedGradientFaPatchField
28
29Group
30 grpGenericBoundaryConditions
31
32Description
33 This boundary condition provides a uniform fixed gradient condition.
34
35Usage
36 \table
37 Property | Description | Required | Default
38 uniformGradient | uniform gradient | yes |
39 value | initial field value | optional |
40 \endtable
41
42 Example of the boundary condition specification:
43 \verbatim
44 <patchName>
45 {
46 type uniformFixedGradient;
47 uniformGradient constant 0.2;
48 }
49 \endverbatim
50
51Note
52 The uniformGradient entry is a Function1 type.
53 The example above gives the usage for supplying a constant value.
54
55 The \c value entry (optional) is used for the initial values.
56 Otherwise the \c uniformGradient is used for the evaluation.
57 In some cases (eg, coded or expression entries with references to other
58 fields) this can be problematic and the \c value entry will be needed.
59
60See also
61 Foam::Function1Types
62 Foam::fixedGradientFaPatchField
63
64SourceFiles
65 uniformFixedGradientFaPatchField.C
66
67\*---------------------------------------------------------------------------*/
68
69#ifndef Foam_uniformFixedGradientFaPatchField_H
70#define Foam_uniformFixedGradientFaPatchField_H
71
73#include "PatchFunction1.H"
74
75// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76
77namespace Foam
78{
79
80/*---------------------------------------------------------------------------*\
81 Class uniformFixedGradientFaPatchField Declaration
82\*---------------------------------------------------------------------------*/
83
84template<class Type>
86:
87 public fixedGradientFaPatchField<Type>
88{
89 // Private Data
90
91 //- Function providing the gradient
92 autoPtr<Function1<Type>> refGradFunc_;
93
94
95public:
96
97 //- Runtime type information
98 TypeName("uniformFixedGradient");
99
100
101 // Constructors
102
103 //- Construct from patch and internal field
105 (
106 const faPatch&,
108 );
109
110 //- Construct from patch and internal field and patch field
113 const faPatch&,
115 const Field<Type>& fld
116 );
117
118 //- Construct from patch, internal field and dictionary
120 (
121 const faPatch&,
123 const dictionary&
124 );
125
126 //- Construct by mapping onto a new patch
128 (
130 const faPatch&,
132 const faPatchFieldMapper&
133 );
134
135 //- Construct as copy
137 (
139 );
140
141 //- Construct as copy setting internal field reference
143 (
146 );
147
148 //- Return clone
149 virtual tmp<faPatchField<Type>> clone() const
150 {
151 return faPatchField<Type>::Clone(*this);
152 }
153
154 //- Clone with an internal field reference
156 (
158 ) const
159 {
160 return faPatchField<Type>::Clone(*this, iF);
161 }
162
163
164 // Member Functions
165
166 //- Update the coefficients associated with the patch field
167 virtual void updateCoeffs();
168
169 //- Write includes "value" entry
170 virtual void write(Ostream& os) const;
171};
172
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176} // End namespace Foam
178// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179
180#ifdef NoRepository
182#endif
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186#endif
187
188// ************************************************************************* //
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
A FieldMapper for finite-area patch fields.
static tmp< faPatchField< Type > > Clone(const DerivedPatchField &pf)
Clone a patch field with its own internal field reference.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition faPatch.H:76
This boundary condition supplies a fixed gradient condition, such that the patch values are calculate...
fixedGradientFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition tmp.H:75
This boundary condition provides a uniform fixed gradient condition.
uniformFixedGradientFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
virtual tmp< faPatchField< Type > > clone() const
Return clone.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("uniformFixedGradient")
Runtime type information.
virtual tmp< faPatchField< Type > > clone(const DimensionedField< Type, areaMesh > &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