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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::uniformMixedFvPatchField
28 
29 Group
30  grpGenericBoundaryConditions
31 
32 Description
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 
41 Usage
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 
65 Note
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 
79 See also
80  Foam::Function1Types
81  Foam::mixedFvPatchField
82 
83 SourceFiles
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 
96 namespace Foam
97 {
98 
99 /*---------------------------------------------------------------------------*\
100  Class uniformMixedFvPatchField Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 template<class Type>
104 class uniformMixedFvPatchField
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 
120 public:
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 and return a clone
167  virtual tmp<fvPatchField<Type>> clone() const
168  {
169  return tmp<fvPatchField<Type>>
170  (
172  );
173  }
174 
175  //- Construct as copy setting internal field reference
177  (
180  );
181 
182  //- Construct and return a clone setting internal field reference
184  (
186  ) const
187  {
188  return tmp<fvPatchField<Type>>
189  (
190  new uniformMixedFvPatchField<Type>(*this, iF)
191  );
192  }
193 
194 
195  // Member Functions
196 
197  //- Update the coefficients associated with the patch field
198  virtual void updateCoeffs();
199 
200  //- Write
201  virtual void write(Ostream& os) const;
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #ifdef NoRepository
212  #include "uniformMixedFvPatchField.C"
213 #endif
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
This boundary condition provides &#39;mixed&#39; type boundary condition that mix a uniform fixed value and a...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
TypeName("uniformMixed")
Runtime type information.
virtual void write(Ostream &os) const
Write.
uniformMixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Generic templated field type.
Definition: Field.H:62
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
A FieldMapper for finite-volume patch fields.
OBJstream os(runTime.globalPath()/outputName)
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))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.