waveTransmissiveFvPatchField.H 6.08 KB
 OpenFOAM-admin committed Apr 15, 2008 1 2 3 4 /*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration |  OpenFOAM bot committed Oct 31, 2019 5  \\ / A nd | www.openfoam.com  OpenFOAM-admin committed Apr 15, 2008 6  \\/ M anipulation |  OpenFOAM bot committed Feb 06, 2019 7 -------------------------------------------------------------------------------  OpenFOAM bot committed Oct 31, 2019 8  Copyright (C) 2011-2016 OpenFOAM Foundation  OpenFOAM-admin committed Apr 15, 2008 9 10 11 12 ------------------------------------------------------------------------------- License This file is part of OpenFOAM.  Mark Olesen committed Mar 29, 2010 13 14 15 16  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-admin committed Apr 15, 2008 17 18 19 20 21 22 23  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  Mark Olesen committed Mar 29, 2010 24  along with OpenFOAM. If not, see .  OpenFOAM-admin committed Apr 15, 2008 25 26 27 28  Class Foam::waveTransmissiveFvPatchField  andy committed Jul 12, 2012 29 30 Group grpOutletBoundaryConditions  andy committed Jul 12, 2012 31   OpenFOAM-admin committed Apr 15, 2008 32 Description  andy committed Jul 10, 2012 33  This boundary condition provides a wave transmissive outflow condition,  Henry Weller committed Dec 05, 2016 34 35  based on solving DDt(W, field) = 0 at the boundary \c W is the wave velocity and \c field is the field to which this boundary condition is applied.  andy committed Jul 10, 2012 36 37 38 39  The wave speed is calculated using: \f[  Henry Weller committed Dec 05, 2016 40  w_p = \frac{\phi_p}{|Sf|} + \sqrt{\frac{\gamma}{\psi_p}}  andy committed Jul 10, 2012 41 42 43 44  \f] where  andy committed Jul 19, 2012 45  \vartable  Henry Weller committed Dec 05, 2016 46  w_p | patch wave speed  andy committed Jul 10, 2012 47 48 49 50  \phi_p | patch face flux \psi_p | patch compressibility Sf | patch face area vector \gamma | ratio of specific heats  andy committed Jul 19, 2012 51  \endvartable  andy committed Jul 10, 2012 52   Henry Weller committed Jun 17, 2016 53 Usage  andy committed Jul 19, 2012 54  \table  andy committed Jul 10, 2012 55 56 57  Property | Description | Required | Default value phi | flux field name | no | phi rho | density field name | no | rho  58  psi | compressibility field name | no | thermo:psi  andy committed Jul 10, 2012 59  gamma | ratio of specific heats (Cp/Cv) | yes |  andy committed Jul 19, 2012 60  \endtable  andy committed Jul 10, 2012 61 62 63  Example of the boundary condition specification: \verbatim  Henry Weller committed Jun 19, 2016 64   andy committed Jul 10, 2012 65 66 67 68 69 70 71 72  { type waveTransmissive; phi phi; psi psi; gamma 1.4; } \endverbatim  Henry Weller committed Jun 17, 2016 73 See also  andy committed Jul 10, 2012 74  Foam::advectiveFvPatchField  OpenFOAM-admin committed Apr 15, 2008 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91  SourceFiles waveTransmissiveFvPatchField.C \*---------------------------------------------------------------------------*/ #ifndef waveTransmissiveFvPatchField_H #define waveTransmissiveFvPatchField_H #include "advectiveFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\  andy committed Jul 10, 2012 92  Class waveTransmissiveFvPatchField Declaration  OpenFOAM-admin committed Apr 15, 2008 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 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 \*---------------------------------------------------------------------------*/ template class waveTransmissiveFvPatchField : public advectiveFvPatchField { // Private data //- Name of the compressibility field used to calculate the wave speed word psiName_; //- Heat capacity ratio scalar gamma_; public: //- Runtime type information TypeName("waveTransmissive"); // Constructors //- Construct from patch and internal field waveTransmissiveFvPatchField ( const fvPatch&, const DimensionedField& ); //- Construct from patch, internal field and dictionary waveTransmissiveFvPatchField ( const fvPatch&, const DimensionedField&, const dictionary& ); //- Construct by mapping given waveTransmissiveFvPatchField // onto a new patch waveTransmissiveFvPatchField ( const waveTransmissiveFvPatchField&, const fvPatch&, const DimensionedField&, const fvPatchFieldMapper& ); //- Construct as copy waveTransmissiveFvPatchField ( const waveTransmissiveFvPatchField& ); //- Construct and return a clone  150  virtual tmp> clone() const  OpenFOAM-admin committed Apr 15, 2008 151  {  152  return tmp>  OpenFOAM-admin committed Apr 15, 2008 153 154 155 156 157 158 159 160 161 162 163 164 165  ( new waveTransmissiveFvPatchField(*this) ); } //- Construct as copy setting internal field reference waveTransmissiveFvPatchField ( const waveTransmissiveFvPatchField&, const DimensionedField& ); //- Construct and return a clone setting internal field reference  166  virtual tmp> clone  OpenFOAM-admin committed Apr 15, 2008 167 168 169 170  ( const DimensionedField& iF ) const {  171  return tmp>  OpenFOAM-admin committed Apr 15, 2008 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212  ( new waveTransmissiveFvPatchField(*this, iF) ); } // Member functions // Access //- Return the heat capacity ratio scalar gamma() const { return gamma_; } //- Return reference to the heat capacity ratio to allow adjustment scalar& gamma() { return gamma_; } // Evaluation functions //- Calculate and return the advection speed at the boundary virtual tmp advectionSpeed() const; //- Write virtual void write(Ostream&) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository  Henry Weller committed Feb 29, 2016 213  #include "waveTransmissiveFvPatchField.C"  OpenFOAM-admin committed Apr 15, 2008 214 215 216 217 218 219 220 #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* //