activePressureForceBaffleVelocityFvPatchVectorField.H 8.5 KB
 sergio committed Mar 07, 2011 1 2 3 4 /*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration |  5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation  sergio committed Apr 27, 2016 6  \\/ M anipulation | OpenCFD Ltd 2016  sergio committed Mar 07, 2011 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Class Foam::activePressureForceBaffleVelocityFvPatchVectorField  andy committed Jul 12, 2012 27 28 Group grpCoupledBoundaryConditions  andy committed Jul 12, 2012 29   sergio committed Mar 07, 2011 30 Description  andy committed Jul 05, 2012 31  This boundary condition is applied to the flow velocity, to simulate the  sergio committed Jun 02, 2016 32 33 34  opening or closure of a baffle due to area averaged pressure or force delta, between both sides of the baffle. This is achieved by merging the behaviours of wall and cyclic baffles  andy committed Jul 05, 2012 35 36 37  The baffle joins two mesh regions, where the open fraction determines the interpolation weights applied to each cyclic- and neighbour-patch  38  contribution. This means that this is boundary condition is meant to be  sergio committed Jun 02, 2016 39  used in an extra wall beyond an existing cyclic patch pair.  andy committed Jul 05, 2012 40   sergio committed Jun 02, 2016 41 42  The baffle is activated when the area weighted pressure difference between master and slave paches is larger then minThresholdValue.  sergio committed Apr 27, 2016 43   sergio committed Jun 02, 2016 44  Once the threshold is crossed, the baffle is activated and continues to  45  open or close at a fixed rate using  andy committed Jul 05, 2012 46 47  \f[  48  x = x_{old} + s \times \frac{dt}{DT}  andy committed Jul 05, 2012 49 50 51  \f] where  andy committed Jul 10, 2012 52   andy committed Jul 19, 2012 53  \vartable  andy committed Jul 10, 2012 54 55  x | baffle open fraction [0-1] x_{old} | baffle open fraction on previous evaluation  56  s | sign for orientation: 1 to open or -1 to close  andy committed Jul 10, 2012 57 58  dt | simulation time step DT | time taken to open the baffle  andy committed Jul 19, 2012 59  \endvartable  andy committed Jul 05, 2012 60 61 62  The open fraction is then applied to scale the patch areas.  andy committed Jul 19, 2012 63  \heading Patch usage  andy committed Jul 10, 2012 64   andy committed Jul 19, 2012 65  \table  andy committed Jul 10, 2012 66 67  Property | Description | Required | Default value p | pressure field name | no | p  68 69 70 71 72 73 74  cyclicPatch | cyclic patch name | yes | orientation | 1 to open or -1 to close | yes| openFraction | current open fraction [0-1] | yes | openingTime | time taken to open or close the baffle | yes | maxOpenFractionDelta | max fraction change per timestep | yes | minThresholdValue | minimum absolute pressure or force difference for activation | yes |  andy committed Jul 10, 2012 75  forceBased | force (true) or pressure-based (false) activation | yes |  sergio committed Apr 27, 2016 76  opening | Baffle is opening or closing (1 opening, 0 closing) | yes  andy committed Jul 19, 2012 77  \endtable  andy committed Jul 10, 2012 78   andy committed Jul 05, 2012 79 80  Example of the boundary condition specification: \verbatim  andy committed Jul 10, 2012 81 82 83 84 85 86 87 88 89 90 91  myPatch { type activePressureForceBaffleVelocity; p p; cyclicPatch cyclic1; orientation 1; openFraction 0.2; openingTime 5.0; maxOpenFractionDelta 0.1; minThresholdValue 0.01; forceBased false;  sergio committed Jun 02, 2016 92  opening true;  andy committed Jul 10, 2012 93  }  andy committed Jul 05, 2012 94  \endverbatim  sergio committed Mar 07, 2011 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112  SourceFiles activePressureForceBaffleVelocityFvPatchVectorField.C \*---------------------------------------------------------------------------*/ #ifndef activePressureForceBaffleVelocityFvPatchVectorField_H #define activePressureForceBaffleVelocityFvPatchVectorField_H #include "fvPatchFields.H" #include "fixedValueFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\  andy committed Jul 05, 2012 113  Class activePressureForceBaffleVelocityFvPatchVectorField Declaration  sergio committed Mar 07, 2011 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 \*---------------------------------------------------------------------------*/ class activePressureForceBaffleVelocityFvPatchVectorField : public fixedValueFvPatchVectorField { // Private data //- Name of the pressure field used to calculate the force // on the active baffle word pName_; //- Name of the cyclic patch used when the active baffle is open word cyclicPatchName_; //- Index of the cyclic patch used when the active baffle is open label cyclicPatchLabel_; //- Initial wall patch areas vectorField initWallSf_; //- Initial cyclic patch areas vectorField initCyclicSf_; //- Initial neighbour-side cyclic patch areas vectorField nbrCyclicSf_; //- Current fraction of the active baffle which is open scalar openFraction_; //- Time taken for the active baffle to open scalar openingTime_; //- Maximum fractional change to the active baffle openness // per time-step scalar maxOpenFractionDelta_; label curTimeIndex_; //- Minimum value for the active baffle to start opening scalar minThresholdValue_; //- Force based active baffle bool fBased_; //- Baffle is activated bool baffleActivated_;  sergio committed Apr 27, 2016 162 163 164  //- Baffle is opening or closing (1 opening, 0 closing) bool opening_;  andy committed Jul 05, 2012 165   sergio committed Mar 07, 2011 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 public: //- Runtime type information TypeName("activePressureForceBaffleVelocity"); // Constructors //- Construct from patch and internal field activePressureForceBaffleVelocityFvPatchVectorField ( const fvPatch&, const DimensionedField& ); //- Construct from patch, internal field and dictionary activePressureForceBaffleVelocityFvPatchVectorField ( const fvPatch&, const DimensionedField&, const dictionary& );  sergio committed Mar 07, 2011 189  //- Construct by mapping  sergio committed Mar 07, 2011 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227  activePressureForceBaffleVelocityFvPatchVectorField ( const activePressureForceBaffleVelocityFvPatchVectorField&, const fvPatch&, const DimensionedField&, const fvPatchFieldMapper& ); //- Construct as copy activePressureForceBaffleVelocityFvPatchVectorField ( const activePressureForceBaffleVelocityFvPatchVectorField& ); //- Construct and return a clone virtual tmp clone() const { return tmp ( new activePressureForceBaffleVelocityFvPatchVectorField(*this) ); } //- Construct as copy setting internal field reference activePressureForceBaffleVelocityFvPatchVectorField ( const activePressureForceBaffleVelocityFvPatchVectorField&, const DimensionedField& ); //- Construct and return a clone setting internal field reference virtual tmp clone ( const DimensionedField& iF ) const { return tmp (  sergio committed Mar 07, 2011 228 229 230 231 232  new activePressureForceBaffleVelocityFvPatchVectorField ( *this, iF )  sergio committed Mar 07, 2011 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271  ); } // Member functions // Mapping functions //- Map (and resize as needed) from self given a mapping object virtual void autoMap ( const fvPatchFieldMapper& ); //- Reverse map the given fvPatchField onto this fvPatchField virtual void rmap ( const fvPatchVectorField&, const labelList& ); //- Update the coefficients associated with the patch field virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* //