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 valueRequired = 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 and return a clone
151  virtual tmp<fvPatchField<Type>> clone() const
152  {
153  return tmp<fvPatchField<Type>>
154  (
155  new fixedJumpFvPatchField<Type>(*this)
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 fixedJumpFvPatchField<Type>(*this, iF)
175  );
176  }
177 
178 
179  // Member functions
180 
181  // Access
182 
183  //- Set the jump field
184  virtual void setJump(const Field<Type>& jump);
185 
186  //- Set the jump field (uniform value)
187  virtual void setJump(const Type& jump);
188 
189  //- Return the "jump" across the patch
190  virtual tmp<Field<Type>> jump() const;
191 
192  //- Return the old time "jump" across the patch
193  virtual tmp<Field<Type>> jump0() const;
194 
195  //- Return the under-relaxation factor
196  virtual scalar relaxFactor() const;
197 
198  //- Return the relaxed "jump" across the patch
199  virtual void relax();
200 
201 
202  // Mapping functions
203 
204  //- Map (and resize as needed) from self given a mapping object
205  virtual void autoMap
206  (
207  const fvPatchFieldMapper&
208  );
209 
210  //- Reverse map the given fvPatchField onto this fvPatchField
211  virtual void rmap
212  (
213  const fvPatchField<Type>&,
214  const labelList&
215  );
216 
217 
218  //- Write
219  virtual void write(Ostream&) const;
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
230  #include "fixedJumpFvPatchField.C"
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::fixedJumpFvPatchField::relax
virtual void relax()
Return the relaxed "jump" across the patch.
Definition: fixedJumpFvPatchField.C:208
Foam::fixedJumpFvPatchField::setJump
virtual void setJump(const Field< Type > &jump)
Set the jump field.
Definition: fixedJumpFvPatchField.C:147
Foam::fixedJumpFvPatchField::jump0
virtual tmp< Field< Type > > jump0() const
Return the old time "jump" across the patch.
Definition: fixedJumpFvPatchField.C:184
Foam::fixedJumpFvPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: fixedJumpFvPatchField.C:228
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fixedJumpFvPatchField::relaxFactor
virtual scalar relaxFactor() const
Return the under-relaxation factor.
Definition: fixedJumpFvPatchField.C:201
Foam::fixedJumpFvPatchField::fixedJumpFvPatchField
fixedJumpFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: fixedJumpFvPatchField.C:35
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::fixedJumpFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base.
Definition: fixedJumpFvPatchField.H:111
Foam::fixedJumpFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fixedJumpFvPatchField.C:254
Foam::fixedJumpFvPatchField::rmap
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: fixedJumpFvPatchField.C:240
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::jumpCyclicFvPatchField
This boundary condition provides a base class for coupled-cyclic conditions with a specified 'jump' (...
Definition: jumpCyclicFvPatchField.H:59
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fixedJumpFvPatchField.C
Foam::List< label >
Foam::fixedJumpFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: fixedJumpFvPatchField.H:175
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fixedJumpFvPatchField::TypeName
TypeName("fixedJump")
Runtime type information.
jumpCyclicFvPatchField.H
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::fixedJumpFvPatchField::jump
virtual tmp< Field< Type > > jump() const
Return the "jump" across the patch.
Definition: fixedJumpFvPatchField.C:167