activePressureForceBaffleVelocityFvPatchVectorField.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 | Copyright (C) 2011-2016 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 Group
28  grpCoupledBoundaryConditions
29 
30 Description
31  This boundary condition is applied to the flow velocity, to simulate the
32  opening or closure of a baffle due to local pressure or force changes,
33  by merging the behaviours of wall and cyclic conditions.
34 
35  The baffle joins two mesh regions, where the open fraction determines
36  the interpolation weights applied to each cyclic- and neighbour-patch
37  contribution. This means that this is boundary condition is meant to be
38  used in an extra wall beyond an existing cyclic patch pair. See PDRMesh
39  for more details.
40 
41  Once the threshold is crossed, this condition activated and continues to
42  open or close at a fixed rate using
43 
44  \f[
45  x = x_{old} + s \times \frac{dt}{DT}
46  \f]
47 
48  where
49 
50  \vartable
51  x | baffle open fraction [0-1]
52  x_{old} | baffle open fraction on previous evaluation
53  s | sign for orientation: 1 to open or -1 to close
54  dt | simulation time step
55  DT | time taken to open the baffle
56  \endvartable
57 
58  The open fraction is then applied to scale the patch areas.
59 
60 Usage
61  \table
62  Property | Description | Required | Default value
63  p | pressure field name | no | p
64  cyclicPatch | cyclic patch name | yes |
65  orientation | 1 to open or -1 to close | yes|
66  openFraction | current open fraction [0-1] | yes |
67  openingTime | time taken to open or close the baffle | yes |
68  maxOpenFractionDelta | max fraction change per timestep | yes |
69  minThresholdValue | minimum absolute pressure or
70  force difference for activation | yes |
71  forceBased | force (true) or pressure-based (false) activation | yes |
72  \endtable
73 
74  Example of the boundary condition specification:
75  \verbatim
76  <patchName>
77  {
78  type activePressureForceBaffleVelocity;
79  p p;
80  cyclicPatch cyclic1;
81  orientation 1;
82  openFraction 0.2;
83  openingTime 5.0;
84  maxOpenFractionDelta 0.1;
85  minThresholdValue 0.01;
86  forceBased false;
87  }
88  \endverbatim
89 
90 SourceFiles
91  activePressureForceBaffleVelocityFvPatchVectorField.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef activePressureForceBaffleVelocityFvPatchVectorField_H
96 #define activePressureForceBaffleVelocityFvPatchVectorField_H
97 
98 #include "fvPatchFields.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 
106 /*---------------------------------------------------------------------------*\
107  Class activePressureForceBaffleVelocityFvPatchVectorField Declaration
108 \*---------------------------------------------------------------------------*/
109 
110 class activePressureForceBaffleVelocityFvPatchVectorField
111 :
112  public fixedValueFvPatchVectorField
113 {
114  // Private data
115 
116  //- Name of the pressure field used to calculate the force
117  // on the active baffle
118  word pName_;
119 
120  //- Name of the cyclic patch used when the active baffle is open
121  word cyclicPatchName_;
122 
123  //- Index of the cyclic patch used when the active baffle is open
124  label cyclicPatchLabel_;
125 
126  //- Orientation (1 or -1) of the active baffle mode
127  // Used to change the direction of opening or closing the baffle
128  label orientation_;
129 
130  //- Initial wall patch areas
131  vectorField initWallSf_;
132 
133  //- Initial cyclic patch areas
134  vectorField initCyclicSf_;
135 
136  //- Initial neighbour-side cyclic patch areas
137  vectorField nbrCyclicSf_;
138 
139  //- Current fraction of the active baffle which is open
140  scalar openFraction_;
141 
142  //- Time taken for the active baffle to open
143  scalar openingTime_;
144 
145  //- Maximum fractional change to the active baffle openness
146  // per time-step
147  scalar maxOpenFractionDelta_;
148 
149  label curTimeIndex_;
150 
151  //- Minimum value for the active baffle to start opening
152  scalar minThresholdValue_;
153 
154  //- Force based active baffle
155  bool fBased_;
156 
157  //- Baffle is activated
158  bool baffleActivated_;
159 
160 
161 public:
162 
163  //- Runtime type information
164  TypeName("activePressureForceBaffleVelocity");
165 
166 
167  // Constructors
168 
169  //- Construct from patch and internal field
171  (
172  const fvPatch&,
173  const DimensionedField<vector, volMesh>&
174  );
175 
176  //- Construct from patch, internal field and dictionary
178  (
179  const fvPatch&,
181  const dictionary&
182  );
183 
184  //- Construct by mapping
186  (
188  const fvPatch&,
190  const fvPatchFieldMapper&
191  );
192 
193  //- Construct as copy
195  (
197  );
198 
199  //- Construct and return a clone
200  virtual tmp<fvPatchVectorField> clone() const
201  {
203  (
205  );
206  }
207 
208  //- Construct as copy setting internal field reference
210  (
213  );
214 
215  //- Construct and return a clone setting internal field reference
217  (
219  ) const
220  {
222  (
224  (
225  *this,
226  iF
227  )
228  );
229  }
230 
231 
232  // Member functions
233 
234  // Mapping functions
235 
236  //- Map (and resize as needed) from self given a mapping object
237  virtual void autoMap
238  (
239  const fvPatchFieldMapper&
240  );
241 
242  //- Reverse map the given fvPatchField onto this fvPatchField
243  virtual void rmap
244  (
245  const fvPatchVectorField&,
246  const labelList&
247  );
248 
249 
250  //- Update the coefficients associated with the patch field
251  virtual void updateCoeffs();
252 
253  //- Write
254  virtual void write(Ostream&) const;
255 };
256 
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 } // End namespace Foam
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 #endif
265 
266 // ************************************************************************* //
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.