activePressureForceBaffleVelocityFvPatchVectorField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::activePressureForceBaffleVelocityFvPatchVectorField
26 
27 Description
28  This boundary condition is applied to the flow velocity, to simulate the
29  opening or closure of a baffle due to local pressure or force changes,
30  by merging the behaviours of wall and cyclic conditions.
31 
32  The baffle joins two mesh regions, where the open fraction determines
33  the interpolation weights applied to each cyclic- and neighbour-patch
34  contribution. This means that this is boundary condition is meant to be
35  used in an extra wall beyond an existing cyclic patch pair. See PDRMesh
36  for more details.
37 
38  Once the threshold is crossed, this condition activated and continues to
39  open or close at a fixed rate using
40 
41  \f[
42  x = x_{old} + s \times \frac{dt}{DT}
43  \f]
44 
45  where
46 
47  \vartable
48  x | baffle open fraction [0-1]
49  x_{old} | baffle open fraction on previous evaluation
50  s | sign for orientation: 1 to open or -1 to close
51  dt | simulation time step
52  DT | time taken to open the baffle
53  \endvartable
54 
55  The open fraction is then applied to scale the patch areas.
56 
57 Usage
58  \table
59  Property | Description | Required | Default value
60  p | pressure field name | no | p
61  cyclicPatch | cyclic patch name | yes |
62  orientation | 1 to open or -1 to close | yes|
63  openFraction | current open fraction [0-1] | yes |
64  openingTime | time taken to open or close the baffle | yes |
65  maxOpenFractionDelta | max fraction change per timestep | yes |
66  minThresholdValue | minimum absolute pressure or
67  force difference for activation | yes |
68  forceBased | force (true) or pressure-based (false) activation | yes |
69  \endtable
70 
71  Example of the boundary condition specification:
72  \verbatim
73  <patchName>
74  {
75  type activePressureForceBaffleVelocity;
76  p p;
77  cyclicPatch cyclic1;
78  orientation 1;
79  openFraction 0.2;
80  openingTime 5.0;
81  maxOpenFractionDelta 0.1;
82  minThresholdValue 0.01;
83  forceBased false;
84  }
85  \endverbatim
86 
87 SourceFiles
88  activePressureForceBaffleVelocityFvPatchVectorField.C
89 
90 \*---------------------------------------------------------------------------*/
91 
92 #ifndef activePressureForceBaffleVelocityFvPatchVectorField_H
93 #define activePressureForceBaffleVelocityFvPatchVectorField_H
94 
95 #include "fvPatchFields.H"
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 namespace Foam
101 {
102 
103 /*---------------------------------------------------------------------------*\
104  Class activePressureForceBaffleVelocityFvPatchVectorField Declaration
105 \*---------------------------------------------------------------------------*/
106 
107 class activePressureForceBaffleVelocityFvPatchVectorField
108 :
109  public fixedValueFvPatchVectorField
110 {
111  // Private data
112 
113  //- Name of the pressure field used to calculate the force
114  // on the active baffle
115  word pName_;
116 
117  //- Name of the cyclic patch used when the active baffle is open
118  word cyclicPatchName_;
119 
120  //- Index of the cyclic patch used when the active baffle is open
121  label cyclicPatchLabel_;
122 
123  //- Orientation (1 or -1) of the active baffle mode
124  // Used to change the direction of opening or closing the baffle
125  label orientation_;
126 
127  //- Initial wall patch areas
128  vectorField initWallSf_;
129 
130  //- Initial cyclic patch areas
131  vectorField initCyclicSf_;
132 
133  //- Initial neighbour-side cyclic patch areas
134  vectorField nbrCyclicSf_;
135 
136  //- Current fraction of the active baffle which is open
137  scalar openFraction_;
138 
139  //- Time taken for the active baffle to open
140  scalar openingTime_;
141 
142  //- Maximum fractional change to the active baffle openness
143  // per time-step
144  scalar maxOpenFractionDelta_;
145 
146  label curTimeIndex_;
147 
148  //- Minimum value for the active baffle to start opening
149  scalar minThresholdValue_;
150 
151  //- Force based active baffle
152  bool fBased_;
153 
154  //- Baffle is activated
155  bool baffleActivated_;
156 
157 
158 public:
159 
160  //- Runtime type information
161  TypeName("activePressureForceBaffleVelocity");
162 
163 
164  // Constructors
165 
166  //- Construct from patch and internal field
168  (
169  const fvPatch&,
170  const DimensionedField<vector, volMesh>&
171  );
172 
173  //- Construct from patch, internal field and dictionary
175  (
176  const fvPatch&,
178  const dictionary&
179  );
180 
181  //- Construct by mapping
183  (
185  const fvPatch&,
187  const fvPatchFieldMapper&
188  );
189 
190  //- Construct as copy
192  (
194  );
195 
196  //- Construct and return a clone
197  virtual tmp<fvPatchVectorField> clone() const
198  {
200  (
202  );
203  }
204 
205  //- Construct as copy setting internal field reference
207  (
210  );
211 
212  //- Construct and return a clone setting internal field reference
214  (
216  ) const
217  {
219  (
221  (
222  *this,
223  iF
224  )
225  );
226  }
227 
228 
229  // Member functions
230 
231  // Mapping functions
232 
233  //- Map (and resize as needed) from self given a mapping object
234  virtual void autoMap
235  (
236  const fvPatchFieldMapper&
237  );
238 
239  //- Reverse map the given fvPatchField onto this fvPatchField
240  virtual void rmap
241  (
242  const fvPatchVectorField&,
243  const labelList&
244  );
245 
246 
247  //- Update the coefficients associated with the patch field
248  virtual void updateCoeffs();
249 
250  //- Write
251  virtual void write(Ostream&) const;
252 };
253 
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 } // End namespace Foam
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 #endif
262 
263 // ************************************************************************* //
This boundary condition is applied to the flow velocity, to simulate the opening or closure of a baff...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
TypeName("activePressureForceBaffleVelocity")
Runtime type information.
activePressureForceBaffleVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Foam::fvPatchFieldMapper.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Namespace for OpenFOAM.