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