fixedNormalSlipFvPatchField.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::fixedNormalSlipFvPatchField
29 
30 Group
31  grpGenericBoundaryConditions grpWallBoundaryConditions
32 
33 Description
34  This boundary condition sets the patch-normal component to the field (vector
35  or tensor) to the patch-normal component of a user specified field.
36  The tangential component is treated as slip, i.e. copied from the internal
37  field.
38 
39  The "value" entry is NO_READ, optional write.
40 
41 Usage
42  Example of the boundary condition specification:
43  \verbatim
44  <patchName>
45  {
46  // Mandatory entries (unmodifiable)
47  type fixedNormalSlip;
48  fixedValue uniform (1 0 0); // example entry for a vector field
49 
50  // Optional entries
51  writeValue false;
52 
53  // Mandatory/Optional (inherited) entries
54  ...
55  }
56  \endverbatim
57 
58  where the entries mean:
59  \table
60  Property | Description | Type | Reqd | Deflt
61  type | Type name: fixedNormalSlip | word | yes | -
62  fixedValue | User-defined value the normal component of which <!--
63  --> the boundary is set to <!--
64  --> | vectorField/tensorField | yes | -
65  writeValue | Output patch values (eg, ParaView) | bool | no | false
66  \endtable
67 
68  The inherited entries are elaborated in:
69  - \link transformFvPatchField.H \endlink
70  - \link fvPatchField.H \endlink
71 
72 See also
73  Foam::transformFvPatchField
74 
75 SourceFiles
76  fixedNormalSlipFvPatchField.C
77  fixedNormalSlipFvPatchFields.C
78 
79 \*---------------------------------------------------------------------------*/
80 
81 #ifndef Foam_fixedNormalSlipFvPatchField_H
82 #define Foam_fixedNormalSlipFvPatchField_H
83 
84 #include "transformFvPatchField.H"
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 namespace Foam
89 {
90 
91 /*---------------------------------------------------------------------------*\
92  Class fixedNormalSlipFvPatchField Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 template<class Type>
96 class fixedNormalSlipFvPatchField
97 :
98  public transformFvPatchField<Type>
99 {
100  //- The parent boundary condition type
101  typedef transformFvPatchField<Type> parent_bctype;
102 
103 
104  // Private Data
105 
106  //- Value the normal component of which the boundary is set to
107  Field<Type> fixedValue_;
108 
109  //- Flag to output patch values (e.g. for ParaView)
110  bool writeValue_;
111 
112 
113 public:
114 
115  //- Runtime type information
116  TypeName("fixedNormalSlip");
117 
118 
119  // Constructors
120 
121  //- Construct from patch and internal field
123  (
124  const fvPatch&,
126  );
127 
128  //- Construct from patch, internal field and dictionary.
129  //- The "value" entry is NO_READ.
131  (
132  const fvPatch&,
134  const dictionary&
135  );
136 
137  //- Construct by mapping given fixedNormalSlipFvPatchField
138  //- onto a new patch
140  (
142  const fvPatch&,
144  const fvPatchFieldMapper&
145  );
146 
147  //- Construct as copy
149  (
151  );
152 
153  //- Construct as copy setting internal field reference
155  (
158  );
159 
160  //- Return a clone
161  virtual tmp<fvPatchField<Type>> clone() const
162  {
163  return fvPatchField<Type>::Clone(*this);
164  }
165 
166  //- Clone with an internal field reference
168  (
170  ) const
171  {
172  return fvPatchField<Type>::Clone(*this, iF);
173  }
174 
175 
176  // Member Functions
177 
178  //- False: this patch field is not altered by assignment.
179  virtual bool assignable() const { return false; }
180 
181 
182  // Access
183 
184  //- User-defined input field (modifiable field)
185  virtual Field<Type>& fixedValue()
186  {
187  return fixedValue_;
188  }
189 
190  //- User-defined input field (const field)
191  virtual const Field<Type>& fixedValue() const
192  {
193  return fixedValue_;
194  }
195 
196 
197  // Mapping
198 
199  //- Map (and resize as needed) from self given a mapping object
200  virtual void autoMap
201  (
202  const fvPatchFieldMapper& m
203  );
205  //- Reverse map the given fvPatchField onto this fvPatchField
206  virtual void rmap
207  (
208  const fvPatchField<Type>& ptf,
209  const labelList& addr
210  );
211 
212 
213  // Evaluation
214 
215  //- Return gradient at boundary
216  virtual tmp<Field<Type>> snGrad() const;
217 
218  //- Evaluate the patch field
219  virtual void evaluate
220  (
221  const Pstream::commsTypes commsType =
223  );
224 
225  //- Return face-gradient transform diagonal
227 
228 
229  //- Write
230  virtual void write(Ostream&) const;
231 
232 
233  // Member Operators
235  virtual void operator=(const UList<Type>&) {}
236 
237  virtual void operator=(const fvPatchField<Type>&) {}
238  virtual void operator+=(const fvPatchField<Type>&) {}
239  virtual void operator-=(const fvPatchField<Type>&) {}
240  virtual void operator*=(const fvPatchField<scalar>&) {}
241  virtual void operator/=(const fvPatchField<scalar>&) {}
243  virtual void operator+=(const Field<Type>&) {}
244  virtual void operator-=(const Field<Type>&) {}
245 
246  virtual void operator*=(const Field<scalar>&) {}
247  virtual void operator/=(const Field<scalar>&) {}
248 
249  virtual void operator=(const Type&) {}
250  virtual void operator+=(const Type&) {}
251  virtual void operator-=(const Type&) {}
252  virtual void operator*=(const scalar) {}
253  virtual void operator/=(const scalar) {}
254 };
255 
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 } // End namespace Foam
260 
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 #ifdef NoRepository
265 #endif
266 
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 
269 #endif
270 
271 // ************************************************************************* //
virtual void operator=(const UList< Type > &)
commsTypes
Communications types.
Definition: UPstream.H:77
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void operator-=(const fvPatchField< Type > &)
virtual Field< Type > & fixedValue()
User-defined input field (modifiable field)
fixedNormalSlipFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void rmap(const fvPatchField< Type > &ptf, const labelList &addr)
Reverse map the given fvPatchField onto this fvPatchField.
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 void write(Ostream &) const
Write.
virtual tmp< fvPatchField< Type > > clone() const
Return a clone.
virtual void operator*=(const fvPatchField< scalar > &)
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field.
Generic templated field type.
Definition: Field.H:62
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
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
virtual void operator+=(const fvPatchField< Type > &)
virtual void operator/=(const fvPatchField< scalar > &)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual bool assignable() const
False: this patch field is not altered by assignment.
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
This boundary condition sets the patch-normal component to the field (vector or tensor) to the patch-...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
"buffered" : (MPI_Bsend, MPI_Recv)
TypeName("fixedNormalSlip")
Runtime type information.
Namespace for OpenFOAM.
virtual void autoMap(const fvPatchFieldMapper &m)
Map (and resize as needed) from self given a mapping object.