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 Usage
40  Example of the boundary condition specification:
41  \verbatim
42  <patchName>
43  {
44  // Mandatory entries (unmodifiable)
45  type fixedNormalSlip;
46  fixedValue uniform (1 0 0); // example entry for a vector field
47 
48  // Optional entries
49  writeValue false;
50 
51  // Mandatory/Optional (inherited) entries
52  ...
53  }
54  \endverbatim
55 
56  where the entries mean:
57  \table
58  Property | Description | Type | Reqd | Deflt
59  type | Type name: fixedNormalSlip | word | yes | -
60  fixedValue | User-defined value the normal component of which <!--
61  --> the boundary is set to <!--
62  --> | vectorField/tensorField | yes | -
63  writeValue | Output patch values (eg, ParaView) | bool | no | false
64  \endtable
65 
66  The inherited entries are elaborated in:
67  - \link transformFvPatchField.H \endlink
68  - \link fvPatchField.H \endlink
69 
70 See also
71  Foam::transformFvPatchField
72 
73 SourceFiles
74  fixedNormalSlipFvPatchField.C
75  fixedNormalSlipFvPatchFields.C
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #ifndef fixedNormalSlipFvPatchField_H
80 #define fixedNormalSlipFvPatchField_H
81 
82 #include "transformFvPatchField.H"
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 
86 namespace Foam
87 {
88 
89 /*---------------------------------------------------------------------------*\
90  Class fixedNormalSlipFvPatchField Declaration
91 \*---------------------------------------------------------------------------*/
92 
93 template<class Type>
94 class fixedNormalSlipFvPatchField
95 :
96  public transformFvPatchField<Type>
97 {
98  //- The parent boundary condition type
99  typedef transformFvPatchField<Type> parent_bctype;
100 
101 
102  // Private Data
103 
104  //- Value the normal component of which the boundary is set to
105  Field<Type> fixedValue_;
106 
107  //- Flag to output patch values (e.g. for ParaView)
108  bool writeValue_;
109 
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("fixedNormalSlip");
115 
116 
117  // Constructors
118 
119  //- Construct from patch and internal field
121  (
122  const fvPatch&,
124  );
125 
126  //- Construct from patch, internal field and dictionary
128  (
129  const fvPatch&,
131  const dictionary&
132  );
133 
134  //- Construct by mapping given fixedNormalSlipFvPatchField
135  //- onto a new patch
137  (
139  const fvPatch&,
141  const fvPatchFieldMapper&
142  );
143 
144  //- Construct as copy
146  (
148  );
149 
150  //- Construct and return a clone
151  virtual tmp<fvPatchField<Type>> clone() const
152  {
153  return tmp<fvPatchField<Type>>
154  (
156  );
157  }
158 
159  //- Construct as copy setting internal field reference
161  (
164  );
165 
166  //- Construct and return a clone setting internal field reference
168  (
170  ) const
171  {
172  return tmp<fvPatchField<Type>>
173  (
174  new fixedNormalSlipFvPatchField<Type>(*this, iF)
175  );
176  }
177 
178 
179  // Member Functions
180 
181  //- False: this patch field is not altered by assignment.
182  virtual bool assignable() const { return false; }
183 
184 
185  // Access
186 
187  //- User-defined input field (modifiable field)
188  virtual Field<Type>& fixedValue()
189  {
190  return fixedValue_;
191  }
193  //- User-defined input field (const field)
194  virtual const Field<Type>& fixedValue() const
195  {
196  return fixedValue_;
197  }
198 
199 
200  // Mapping
201 
202  //- Map (and resize as needed) from self given a mapping object
203  virtual void autoMap
204  (
205  const fvPatchFieldMapper& m
206  );
207 
208  //- Reverse map the given fvPatchField onto this fvPatchField
209  virtual void rmap
210  (
211  const fvPatchField<Type>& ptf,
212  const labelList& addr
213  );
214 
215 
216  // Evaluation
217 
218  //- Return gradient at boundary
219  virtual tmp<Field<Type>> snGrad() const;
220 
221  //- Evaluate the patch field
222  virtual void evaluate
223  (
224  const Pstream::commsTypes commsType =
226  );
227 
228  //- Return face-gradient transform diagonal
230 
231 
232  //- Write
233  virtual void write(Ostream&) const;
234 
235 
236  // Member Operators
238  virtual void operator=(const UList<Type>&) {}
239 
240  virtual void operator=(const fvPatchField<Type>&) {}
241  virtual void operator+=(const fvPatchField<Type>&) {}
242  virtual void operator-=(const fvPatchField<Type>&) {}
243  virtual void operator*=(const fvPatchField<scalar>&) {}
244  virtual void operator/=(const fvPatchField<scalar>&) {}
246  virtual void operator+=(const Field<Type>&) {}
247  virtual void operator-=(const Field<Type>&) {}
248 
249  virtual void operator*=(const Field<scalar>&) {}
250  virtual void operator/=(const Field<scalar>&) {}
251 
252  virtual void operator=(const Type&) {}
253  virtual void operator+=(const Type&) {}
254  virtual void operator-=(const Type&) {}
255  virtual void operator*=(const scalar) {}
256  virtual void operator/=(const scalar) {}
257 };
258 
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 } // End namespace Foam
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #ifdef NoRepository
268 #endif
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 #endif
273 
274 // ************************************************************************* //
virtual void operator=(const UList< Type > &)
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
"blocking" : (MPI_Bsend, MPI_Recv)
commsTypes
Communications types.
Definition: UPstream.H:72
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
Construct and return a clone.
virtual void operator*=(const fvPatchField< scalar > &)
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...
Definition: areaFieldsFwd.H:42
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
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.