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-2015 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  \heading Patch usage
61 
62  \table
63  Property | Description | Required | Default value
64  p | pressure field name | no | p
65  cyclicPatch | cyclic patch name | yes |
66  orientation | 1 to open or -1 to close | yes|
67  openFraction | current open fraction [0-1] | yes |
68  openingTime | time taken to open or close the baffle | yes |
69  maxOpenFractionDelta | max fraction change per timestep | yes |
70  minThresholdValue | minimum absolute pressure or
71  force difference for activation | yes |
72  forceBased | force (true) or pressure-based (false) activation | yes |
73  \endtable
74 
75  Example of the boundary condition specification:
76  \verbatim
77  myPatch
78  {
79  type activePressureForceBaffleVelocity;
80  p p;
81  cyclicPatch cyclic1;
82  orientation 1;
83  openFraction 0.2;
84  openingTime 5.0;
85  maxOpenFractionDelta 0.1;
86  minThresholdValue 0.01;
87  forceBased false;
88  }
89  \endverbatim
90 
91 SourceFiles
92  activePressureForceBaffleVelocityFvPatchVectorField.C
93 
94 \*---------------------------------------------------------------------------*/
95 
96 #ifndef activePressureForceBaffleVelocityFvPatchVectorField_H
97 #define activePressureForceBaffleVelocityFvPatchVectorField_H
98 
99 #include "fvPatchFields.H"
100 #include "fixedValueFvPatchFields.H"
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 namespace Foam
105 {
106 
107 /*---------------------------------------------------------------------------*\
108  Class activePressureForceBaffleVelocityFvPatchVectorField Declaration
109 \*---------------------------------------------------------------------------*/
110 
111 class activePressureForceBaffleVelocityFvPatchVectorField
112 :
113  public fixedValueFvPatchVectorField
114 {
115  // Private data
116 
117  //- Name of the pressure field used to calculate the force
118  // on the active baffle
119  word pName_;
120 
121  //- Name of the cyclic patch used when the active baffle is open
122  word cyclicPatchName_;
123 
124  //- Index of the cyclic patch used when the active baffle is open
126 
127  //- Orientation (1 or -1) of the active baffle mode
128  // Used to change the direction of opening or closing the baffle
130 
131  //- Initial wall patch areas
133 
134  //- Initial cyclic patch areas
136 
137  //- Initial neighbour-side cyclic patch areas
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 
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 
162 public:
163 
164  //- Runtime type information
165  TypeName("activePressureForceBaffleVelocity");
166 
167 
168  // Constructors
169 
170  //- Construct from patch and internal field
172  (
173  const fvPatch&,
174  const DimensionedField<vector, volMesh>&
175  );
176 
177  //- Construct from patch, internal field and dictionary
179  (
180  const fvPatch&,
182  const dictionary&
183  );
184 
185  //- Construct by mapping
187  (
189  const fvPatch&,
192  );
193 
194  //- Construct as copy
196  (
198  );
199 
200  //- Construct and return a clone
202  {
204  (
206  );
207  }
208 
209  //- Construct as copy setting internal field reference
211  (
214  );
215 
216  //- Construct and return a clone setting internal field reference
218  (
220  ) const
221  {
223  (
225  (
226  *this,
227  iF
228  )
229  );
230  }
231 
232 
233  // Member functions
234 
235  // Mapping functions
236 
237  //- Map (and resize as needed) from self given a mapping object
238  virtual void autoMap
239  (
240  const fvPatchFieldMapper&
241  );
242 
243  //- Reverse map the given fvPatchField onto this fvPatchField
244  virtual void rmap
245  (
246  const fvPatchVectorField&,
247  const labelList&
248  );
249 
250 
251  //- Update the coefficients associated with the patch field
252  virtual void updateCoeffs();
253 
254  //- Write
255  virtual void write(Ostream&) const;
256 };
257 
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 } // End namespace Foam
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 #endif
266 
267 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Foam::activePressureForceBaffleVelocityFvPatchVectorField::initWallSf_
vectorField initWallSf_
Initial wall patch areas.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:198
Foam::activePressureForceBaffleVelocityFvPatchVectorField::orientation_
label orientation_
Orientation (1 or -1) of the active baffle mode.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:195
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::activePressureForceBaffleVelocityFvPatchVectorField::cyclicPatchLabel_
label cyclicPatchLabel_
Index of the cyclic patch used when the active baffle is open.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:191
Foam::activePressureForceBaffleVelocityFvPatchVectorField::cyclicPatchName_
word cyclicPatchName_
Name of the cyclic patch used when the active baffle is open.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:188
Foam::activePressureForceBaffleVelocityFvPatchVectorField::TypeName
TypeName("activePressureForceBaffleVelocity")
Runtime type information.
Foam::activePressureForceBaffleVelocityFvPatchVectorField::openingTime_
scalar openingTime_
Time taken for the active baffle to open.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:210
Foam::activePressureForceBaffleVelocityFvPatchVectorField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.C:181
Foam::activePressureForceBaffleVelocityFvPatchVectorField::pName_
word pName_
Name of the pressure field used to calculate the force.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:185
Foam::activePressureForceBaffleVelocityFvPatchVectorField::minThresholdValue_
scalar minThresholdValue_
Minimum value for the active baffle to start opening.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:219
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:49
Foam::activePressureForceBaffleVelocityFvPatchVectorField::fBased_
bool fBased_
Force based active baffle.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:222
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::activePressureForceBaffleVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.C:354
Foam::activePressureForceBaffleVelocityFvPatchVectorField::openFraction_
scalar openFraction_
Current fraction of the active baffle which is open.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:207
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::activePressureForceBaffleVelocityFvPatchVectorField::curTimeIndex_
label curTimeIndex_
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:216
Foam::activePressureForceBaffleVelocityFvPatchVectorField::nbrCyclicSf_
vectorField nbrCyclicSf_
Initial neighbour-side cyclic patch areas.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:204
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::activePressureForceBaffleVelocityFvPatchVectorField::activePressureForceBaffleVelocityFvPatchVectorField
activePressureForceBaffleVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.C:36
Foam::activePressureForceBaffleVelocityFvPatchVectorField::maxOpenFractionDelta_
scalar maxOpenFractionDelta_
Maximum fractional change to the active baffle openness.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:214
fvPatchFields.H
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
fixedValueFvPatchFields.H
Foam::activePressureForceBaffleVelocityFvPatchVectorField::rmap
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.C:219
Foam::activePressureForceBaffleVelocityFvPatchVectorField::initCyclicSf_
vectorField initCyclicSf_
Initial cyclic patch areas.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:201
Foam::activePressureForceBaffleVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:267
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.C:243
Foam::activePressureForceBaffleVelocityFvPatchVectorField
This boundary condition is applied to the flow velocity, to simulate the opening or closure of a baff...
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:177
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51
Foam::activePressureForceBaffleVelocityFvPatchVectorField::baffleActivated_
bool baffleActivated_
Baffle is activated.
Definition: activePressureForceBaffleVelocityFvPatchVectorField.H:225