partialSlipFvPatchField.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::partialSlipFvPatchField
29 
30 Group
31  grpWallBoundaryConditions grpGenericBoundaryConditions
32 
33 Description
34  This boundary condition provides a partial slip condition.
35  The amount of slip is controlled by a user-supplied field.
36 
37  The "value" entry is NO_READ, optional write.
38 
39 Usage
40  \table
41  Property | Description | Reqd | Default
42  type | Type name: partialSlip | yes | -
43  refValue | Reference value at zero slip | no | 0
44  valueFraction | Fraction of refValue used for boundary [0-1] | yes |
45  writeValue | Output patch value (eg, ParaView) | no | false
46  \endtable
47 
48  Example of the boundary condition specification:
49  \verbatim
50  <patchName>
51  {
52  type partialSlip;
53  refValue uniform 0.001;
54  valueFraction uniform 0.1;
55  }
56  \endverbatim
57 
58 See also
59  Foam::transformFvPatchField
60 
61 SourceFiles
62  partialSlipFvPatchField.txx
63 
64 \*---------------------------------------------------------------------------*/
65 
66 #ifndef Foam_partialSlipFvPatchField_H
67 #define Foam_partialSlipFvPatchField_H
68 
69 #include "transformFvPatchField.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class partialSlipFvPatchField Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 template<class Type>
81 class partialSlipFvPatchField
82 :
83  public transformFvPatchField<Type>
84 {
85  typedef partialSlipFvPatchField<Type> this_bctype;
86  typedef transformFvPatchField<Type> parent_bctype;
87 
88 
89  // Private Data
90 
91  //- Reference value
92  Field<Type> refValue_;
93 
94  //- Fraction (0-1) of value used for boundary condition
95  scalarField valueFraction_;
96 
97  //- Flag to output patch values (e.g. for ParaView)
98  bool writeValue_;
99 
100 
101 public:
102 
103  //- Runtime type information
104  TypeName("partialSlip");
105 
106 
107  // Constructors
108 
109  //- Construct from patch and internal field
111  (
112  const fvPatch&,
114  );
115 
116  //- Construct from patch, internal field and dictionary.
117  //- The "value" entry is NO_READ.
119  (
120  const fvPatch&,
122  const dictionary&
123  );
124 
125  //- Construct by mapping onto a new patch
127  (
128  const this_bctype&,
129  const fvPatch&,
131  const fvPatchFieldMapper&
132  );
133 
134  //- Construct as copy setting internal field reference
136  (
137  const this_bctype&,
139  );
140 
141  //- No copy without an internal field
142  [[deprecated("2026-03: soon = delete")]]
144  #ifdef Foam_fvPatchField_copyConstruct
145  : this_bctype(pfld, pfld.internalField()) {}
146  #else
147  = delete;
148  #endif
149 
150  //- Clone with an internal field reference
152  (
154  ) const
155  {
156  return fvPatchField<Type>::Clone(*this, iF);
157  }
158 
159 
160  // Member Functions
161 
162  //- False: this patch field is not altered by assignment
163  virtual bool assignable() const { return false; }
164 
165 
166  // Access
167 
168  virtual Field<Type>& refValue()
169  {
170  return refValue_;
171  }
172 
173  virtual const Field<Type>& refValue() const
174  {
175  return refValue_;
176  }
177 
178  virtual scalarField& valueFraction()
179  {
180  return valueFraction_;
181  }
182 
183  virtual const scalarField& valueFraction() const
184  {
185  return valueFraction_;
186  }
187 
188 
189  // Mapping
190 
191  //- Map (and resize as needed) from self given a mapping object
192  virtual void autoMap
193  (
194  const fvPatchFieldMapper&
195  );
196 
197  //- Reverse map the given fvPatchField onto this fvPatchField
198  virtual void rmap
199  (
200  const fvPatchField<Type>&,
201  const labelList&
202  );
203 
204 
205  // Evaluation
206 
207  //- Return gradient at boundary
208  virtual tmp<Field<Type>> snGrad() const;
209 
210  //- Retrieve patch-normal gradient [contiguous storage]
211  virtual void snGrad(UList<Type>& result) const;
212 
213  //- Evaluate the patch field
214  virtual void evaluate
215  (
216  const Pstream::commsTypes commsType =
218  );
219 
220  //- Return face-gradient transform diagonal
221  virtual tmp<Field<Type>> snGradTransformDiag() const;
222 
223 
224  //- Write
225  virtual void write(Ostream&) const;
226 
227 
228  // Member Operators
229 
230  virtual void operator=(const UList<Type>&) {}
231 
232  virtual void operator=(const fvPatchField<Type>&) {}
233  virtual void operator+=(const fvPatchField<Type>&) {}
234  virtual void operator-=(const fvPatchField<Type>&) {}
235  virtual void operator*=(const fvPatchField<scalar>&) {}
236  virtual void operator/=(const fvPatchField<scalar>&) {}
237 
238  virtual void operator+=(const Field<Type>&) {}
239  virtual void operator-=(const Field<Type>&) {}
240 
241  virtual void operator*=(const Field<scalar>&) {}
242  virtual void operator/=(const Field<scalar>&) {}
243 
244  virtual void operator=(const Type&) {}
245  virtual void operator+=(const Type&) {}
246  virtual void operator-=(const Type&) {}
247  virtual void operator*=(const scalar) {}
248  virtual void operator/=(const scalar) {}
249 };
250 
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 } // End namespace Foam
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #ifdef NoRepository
259  #include "partialSlipFvPatchField.txx"
260 #endif
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 #endif
265 
266 // ************************************************************************* //
virtual void operator*=(const fvPatchField< scalar > &)
virtual void operator-=(const fvPatchField< Type > &)
commsTypes
Communications types.
Definition: UPstream.H:81
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
virtual void write(Ostream &) const
Write.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
partialSlipFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual scalarField & valueFraction()
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
virtual Field< Type > & refValue()
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:635
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
TypeName("partialSlip")
Runtime type information.
virtual bool assignable() const
False: this patch field is not altered by assignment.
Intermediate layer (not used directly as a user boundary condition). The "value" entry is NO_READ...
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field.
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
virtual void operator=(const UList< Type > &)
A class for managing temporary objects.
Definition: HashPtrTable.H:50
"buffered" : (MPI_Bsend, MPI_Recv)
virtual void operator+=(const fvPatchField< Type > &)
virtual void operator/=(const fvPatchField< scalar > &)
Namespace for OpenFOAM.
virtual tmp< fvPatchField< Type > > clone() const
No clone without an internal field reference.
Definition: fvPatchField.H:610