Loading...
Searching...
No Matches
uniformMixedFaPatchField.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::uniformMixedFaPatchField
28
29Group
30 grpGenericBoundaryConditions
31
32Description
33 This boundary condition provides 'mixed' type boundary condition
34 that mix a \em uniform fixed value and a \em uniform patch-normal
35 gradient condition. The term "uniform" is a legacy name since the
36 prescribed values were previously spatially uniform across that patch.
37
38Usage
39 \table
40 Property | Description | Required | Default
41 uniformValue | uniform value | partly | 0
42 uniformGradient | uniform gradient | partly | 0
43 uniformValueFraction | uniform valueFraction | partly | depends
44 value | initial field value | optional |
45 \endtable
46
47 Example of the boundary condition specification:
48 \verbatim
49 <patchName>
50 {
51 type uniformMixed;
52 uniformValue constant 0.2;
53 uniformGradient constant 0.2;
54 uniformValueFraction
55 {
56 type sine;
57 ...
58 }
59 }
60 \endverbatim
61
62Note
63 This boundary condition allows \em lazier definitions so that either
64 or both: \c uniformValue and \c uniformGradient must be defined.
65 If only of these entries is defined, the value fraction is automatically
66 treated appropriately (ie, 0 with \c uniformGradient and 1 with
67 uniformValue).
68 If both \c uniformValue and \c uniformGradient are defined,
69 the \c uniformValueFraction must also be defined.
70
71 The \c value entry (optional) is used for the initial values.
72 Otherwise the function(s) are used for the evaluation.
73 In some cases (eg, coded or expression entries with references to other
74 fields) this can be problematic and the \c value entry will be needed.
75
76See also
77 Foam::Function1Types
78 Foam::mixedFaPatchField
79
80SourceFiles
81 uniformMixedFaPatchField.C
82
83\*---------------------------------------------------------------------------*/
84
85#ifndef Foam_uniformMixedFaPatchField_H
86#define Foam_uniformMixedFaPatchField_H
87
88#include "mixedFaPatchField.H"
89#include "Function1.H"
90
91// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92
93namespace Foam
94{
95
96/*---------------------------------------------------------------------------*\
97 Class uniformMixedFaPatchField Declaration
98\*---------------------------------------------------------------------------*/
99
100template<class Type>
102:
103 public mixedFaPatchField<Type>
104{
105 // Private Data
106
107 //- Function providing the value
108 autoPtr<Function1<Type>> refValueFunc_;
109
110 //- Function providing the gradient
111 autoPtr<Function1<Type>> refGradFunc_;
112
113 //- Function providing the value-fraction
114 autoPtr<Function1<scalar>> valueFractionFunc_;
115
116
117public:
118
119 //- Runtime type information
120 TypeName("uniformMixed");
122
123 // Constructors
124
125 //- Construct from patch and internal field
127 (
128 const faPatch&,
130 );
131
132 //- Construct from patch and internal field and patch field
134 (
135 const faPatch&,
137 const Field<Type>& fld
138 );
139
140 //- Construct from patch, internal field and dictionary
142 (
143 const faPatch&,
145 const dictionary&
146 );
147
148 //- Construct by mapping onto a new patch
150 (
152 const faPatch&,
154 const faPatchFieldMapper&
155 );
156
157 //- Construct as copy
159 (
161 );
162
163 //- Construct as copy setting internal field reference
165 (
168 );
169
170 //- Return clone
171 virtual tmp<faPatchField<Type>> clone() const
172 {
173 return faPatchField<Type>::Clone(*this);
174 }
175
176 //- Clone with an internal field reference
178 (
180 ) const
181 {
182 return faPatchField<Type>::Clone(*this, iF);
183 }
184
185
186 // Member Functions
187
188 //- Update the coefficients associated with the patch field
189 virtual void updateCoeffs();
190
191 //- Write includes "value" entry (for visualisation / restart)
192 virtual void write(Ostream& os) const;
193};
194
195
196// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197
198} // End namespace Foam
199
200// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201
202#ifdef NoRepository
204#endif
205
206// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207
208#endif
209
210// ************************************************************************* //
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 provides a base class for 'mixed' type boundary conditions,...
mixedFaPatchField(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 'mixed' type boundary condition that mix a uniform fixed value and a...
virtual tmp< faPatchField< Type > > clone() const
Return clone.
TypeName("uniformMixed")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual tmp< faPatchField< Type > > clone(const DimensionedField< Type, areaMesh > &iF) const
Clone with an internal field reference.
uniformMixedFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
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