fixedJumpFvPatchField.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-2016 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::fixedJumpFvPatchField
29 
30 Group
31  grpCoupledBoundaryConditions
32 
33 Description
34  This boundary condition provides a jump condition, using the \c cyclic
35  condition as a base.
36 
37  The jump is specified as a fixed value field, applied as an offset to the
38  'owner' patch.
39 
40 Usage
41  \table
42  Property | Description | Required | Default value
43  patchType | underlying patch type should be \c cyclic| yes |
44  jump | current jump value | yes |
45  relax | under-relaxation factor | no |
46  minJump | Minimum jump value | no |
47  \endtable
48 
49  Example of the boundary condition specification:
50  \verbatim
51  <patchName>
52  {
53  type fixedJump;
54  patchType cyclic;
55  jump uniform 10;
56  }
57  \endverbatim
58 
59  The above example shows the use of a fixed jump of '10'.
60 
61 Note
62  The underlying \c patchType should be set to \c cyclic
63 
64 See also
65  Foam::jumpCyclicFvPatchField
66 
67 SourceFiles
68  fixedJumpFvPatchField.C
69 
70 \*---------------------------------------------------------------------------*/
71 
72 #ifndef fixedJumpFvPatchField_H
73 #define fixedJumpFvPatchField_H
74 
75 #include "jumpCyclicFvPatchField.H"
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 
82 /*---------------------------------------------------------------------------*\
83  Class fixedJumpFvPatchField Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 template<class Type>
87 class fixedJumpFvPatchField
88 :
89  public jumpCyclicFvPatchField<Type>
90 {
91 
92  // Private data
93 
94  //- "jump" field
95  Field<Type> jump_;
96 
97  //- "jump" field at old time level
98  Field<Type> jump0_;
99 
100  //- Minimum allowable jump value
101  Type minJump_;
102 
103 
104  //- Under-relaxation factor
105  scalar relaxFactor_;
106 
107  //- Time index
108  label timeIndex_;
109 
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("fixedJump");
115 
116  // Constructors
117 
118  //- Construct from patch and internal field
120  (
121  const fvPatch&,
123  );
124 
125  //- Construct from patch, internal field and dictionary
127  (
128  const fvPatch&,
130  const dictionary&,
131  const bool needValue = true
132  );
133 
134  //- Construct by mapping given fixedJumpFvPatchField onto a
135  // new patch
137  (
139  const fvPatch&,
141  const fvPatchFieldMapper&
142  );
143 
144  //- Construct as copy
146  (
148  );
149 
150  //- Construct as copy setting internal field reference
152  (
155  );
156 
157  //- Return a clone
158  virtual tmp<fvPatchField<Type>> clone() const
159  {
160  return fvPatchField<Type>::Clone(*this);
161  }
162 
163  //- Clone with an internal field reference
165  (
167  ) const
168  {
169  return fvPatchField<Type>::Clone(*this, iF);
170  }
171 
172 
173  // Member functions
174 
175  // Access
176 
177  //- Set the jump field
178  virtual void setJump(const Field<Type>& jump);
179 
180  //- Set the jump field (uniform value)
181  virtual void setJump(const Type& jump);
182 
183  //- Return the "jump" across the patch
184  virtual tmp<Field<Type>> jump() const;
185 
186  //- Return the old time "jump" across the patch
187  virtual tmp<Field<Type>> jump0() const;
188 
189  //- Return the under-relaxation factor
190  virtual scalar relaxFactor() const;
191 
192  //- Return the relaxed "jump" across the patch
193  virtual void relax();
194 
195 
196  // Mapping functions
197 
198  //- Map (and resize as needed) from self given a mapping object
199  virtual void autoMap
200  (
201  const fvPatchFieldMapper&
202  );
204  //- Reverse map the given fvPatchField onto this fvPatchField
205  virtual void rmap
206  (
207  const fvPatchField<Type>&,
208  const labelList&
209  );
210 
211 
212  //- Write
213  virtual void write(Ostream&) const;
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #ifdef NoRepository
224  #include "fixedJumpFvPatchField.C"
225 #endif
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
TypeName("fixedJump")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
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...
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
fixedJumpFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A FieldMapper for finite-volume patch fields.
virtual void write(Ostream &) const
Write.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual tmp< fvPatchField< Type > > clone() const
Return a clone.
This boundary condition provides a jump condition, using the cyclic condition as a base...
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void relax()
Return the relaxed "jump" across the patch.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual tmp< Field< Type > > jump() const
Return the "jump" across the patch.
virtual void setJump(const Field< Type > &jump)
Set the jump field.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual scalar relaxFactor() const
Return the under-relaxation factor.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual tmp< Field< Type > > jump0() const
Return the old time "jump" across the patch.
Namespace for OpenFOAM.