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.txx
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  typedef uniformMixedFvPatchField<Type> this_bctype;
109  typedef mixedFvPatchField<Type> parent_bctype;
110 
111  // Private Data
112 
113  //- Function providing the value
114  autoPtr<PatchFunction1<Type>> refValueFunc_;
115 
116  //- Function providing the gradient
117  autoPtr<PatchFunction1<Type>> refGradFunc_;
118 
119  //- Function providing the value-fraction
120  autoPtr<PatchFunction1<scalar>> valueFractionFunc_;
121 
122 
123 public:
125  //- Runtime type information
126  TypeName("uniformMixed");
127 
128 
129  // Constructors
130 
131  //- Construct from patch and internal field
133  (
134  const fvPatch&,
136  );
137 
138  //- Construct from patch and internal field and patch field
140  (
141  const fvPatch&,
143  const Field<Type>& fld
144  );
145 
146  //- Construct from patch, internal field and dictionary
148  (
149  const fvPatch&,
151  const dictionary&
152  );
153 
154  //- Construct by mapping onto a new patch
156  (
157  const this_bctype&,
158  const fvPatch&,
160  const fvPatchFieldMapper&
161  );
162 
163  //- Construct as copy setting internal field reference
165  (
166  const this_bctype&,
168  );
169 
170  //- No copy without an internal field
171  [[deprecated("2026-03: soon = delete")]]
173  #ifdef Foam_fvPatchField_copyConstruct
174  : this_bctype(pfld, pfld.internalField()) {}
175  #else
176  = delete;
177  #endif
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  // Member Operators
199 
200  //- Inherit assignment
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #ifdef NoRepository
212  #include "uniformMixedFvPatchField.txx"
213 #endif
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
friend Ostream & operator(Ostream &, const fvPatchField< Type > &)
virtual void write(Ostream &os) const
Write.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
This boundary condition provides a base class for &#39;mixed&#39; type boundary conditions, i.e. conditions that mix fixed value and patch-normal gradient conditions.
TypeName("uniformMixed")
Runtime type information.
uniformMixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:635
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition: Field.H:69
A FieldMapper for finite-volume patch fields.
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...
const DimensionedField< Type, volMesh > & internalField() const noexcept
Return const-reference to the dimensioned internal field.
Definition: fvPatchField.H:734
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.
virtual tmp< fvPatchField< Type > > clone() const
No clone without an internal field reference.
Definition: fvPatchField.H:610