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 -------------------------------------------------------------------------------
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::uniformMixedFaPatchField
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 Usage
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 
62 Note
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 
76 See also
77  Foam::Function1Types
78  Foam::mixedFaPatchField
79 
80 SourceFiles
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 
93 namespace Foam
94 {
95 
96 /*---------------------------------------------------------------------------*\
97  Class uniformMixedFaPatchField Declaration
98 \*---------------------------------------------------------------------------*/
99 
100 template<class Type>
101 class uniformMixedFaPatchField
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 
117 public:
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 and return a clone
164  virtual tmp<faPatchField<Type>> clone() const
165  {
166  return tmp<faPatchField<Type>>
167  (
169  );
170  }
171 
172  //- Construct as copy setting internal field reference
174  (
177  );
178 
179  //- Construct and return a clone setting internal field reference
181  (
183  ) const
184  {
185  return tmp<faPatchField<Type>>
186  (
187  new uniformMixedFaPatchField<Type>(*this, iF)
188  );
189  }
190 
191 
192  // Member Functions
193 
194  //- Update the coefficients associated with the patch field
195  virtual void updateCoeffs();
196 
197  //- Write
198  virtual void write(Ostream& os) const;
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #ifdef NoRepository
209  #include "uniformMixedFaPatchField.C"
210 #endif
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
TypeName("uniformMixed")
Runtime type information.
virtual void write(Ostream &os) const
Write.
Generic templated field type.
Definition: Field.H:62
OBJstream os(runTime.globalPath()/outputName)
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
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.
This boundary condition provides &#39;mixed&#39; type boundary condition that mix a uniform fixed value and a...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual tmp< faPatchField< Type > > clone() const
Construct and return a clone.
A FieldMapper for finite-area patch fields.
uniformMixedFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.