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