waveTransmissiveFvPatchField.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "waveTransmissiveFvPatchField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "volFields.H"
00031 #include "EulerDdtScheme.H"
00032 #include "CrankNicholsonDdtScheme.H"
00033 #include "backwardDdtScheme.H"
00034
00035
00036
00037 namespace Foam
00038 {
00039
00040
00041
00042 template<class Type>
00043 waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
00044 (
00045 const fvPatch& p,
00046 const DimensionedField<Type, volMesh>& iF
00047 )
00048 :
00049 advectiveFvPatchField<Type>(p, iF),
00050 psiName_("psi"),
00051 gamma_(0.0)
00052 {}
00053
00054
00055 template<class Type>
00056 waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
00057 (
00058 const waveTransmissiveFvPatchField& ptf,
00059 const fvPatch& p,
00060 const DimensionedField<Type, volMesh>& iF,
00061 const fvPatchFieldMapper& mapper
00062 )
00063 :
00064 advectiveFvPatchField<Type>(ptf, p, iF, mapper),
00065 psiName_(ptf.psiName_),
00066 gamma_(ptf.gamma_)
00067 {}
00068
00069
00070 template<class Type>
00071 waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
00072 (
00073 const fvPatch& p,
00074 const DimensionedField<Type, volMesh>& iF,
00075 const dictionary& dict
00076 )
00077 :
00078 advectiveFvPatchField<Type>(p, iF, dict),
00079 psiName_(dict.lookupOrDefault<word>("psi", "psi")),
00080 gamma_(readScalar(dict.lookup("gamma")))
00081 {}
00082
00083
00084 template<class Type>
00085 waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
00086 (
00087 const waveTransmissiveFvPatchField& ptpsf
00088 )
00089 :
00090 advectiveFvPatchField<Type>(ptpsf),
00091 psiName_(ptpsf.psiName_),
00092 gamma_(ptpsf.gamma_)
00093 {}
00094
00095
00096 template<class Type>
00097 waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
00098 (
00099 const waveTransmissiveFvPatchField& ptpsf,
00100 const DimensionedField<Type, volMesh>& iF
00101 )
00102 :
00103 advectiveFvPatchField<Type>(ptpsf, iF),
00104 psiName_(ptpsf.psiName_),
00105 gamma_(ptpsf.gamma_)
00106 {}
00107
00108
00109
00110
00111 template<class Type>
00112 tmp<scalarField> waveTransmissiveFvPatchField<Type>::advectionSpeed() const
00113 {
00114
00115 const fvPatchField<scalar>& psip = this->patch().lookupPatchField
00116 (
00117 psiName_,
00118 reinterpret_cast<const volScalarField*>(0),
00119 reinterpret_cast<const scalar*>(0)
00120 );
00121
00122 const surfaceScalarField& phi =
00123 this->db().objectRegistry::lookupObject<surfaceScalarField>
00124 (this->phiName_);
00125
00126 fvsPatchField<scalar> phip = this->patch().lookupPatchField
00127 (
00128 this->phiName_,
00129 reinterpret_cast<const surfaceScalarField*>(0),
00130 reinterpret_cast<const scalar*>(0)
00131 );
00132
00133 if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
00134 {
00135 const fvPatchScalarField& rhop = this->patch().lookupPatchField
00136 (
00137 this->rhoName_,
00138 reinterpret_cast<const volScalarField*>(0),
00139 reinterpret_cast<const scalar*>(0)
00140 );
00141
00142 phip /= rhop;
00143 }
00144
00145
00146
00147
00148 return phip/this->patch().magSf() + sqrt(gamma_/psip);
00149 }
00150
00151
00152 template<class Type>
00153 void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
00154 {
00155 fvPatchField<Type>::write(os);
00156
00157 if (this->phiName_ != "phi")
00158 {
00159 os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
00160 }
00161 if (this->rhoName_ != "rho")
00162 {
00163 os.writeKeyword("rho") << this->rhoName_ << token::END_STATEMENT << nl;
00164 }
00165 if (psiName_ != "psi")
00166 {
00167 os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
00168 }
00169 os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
00170
00171 if (this->lInf_ > SMALL)
00172 {
00173 os.writeKeyword("fieldInf") << this->fieldInf_
00174 << token::END_STATEMENT << nl;
00175 os.writeKeyword("lInf") << this->lInf_
00176 << token::END_STATEMENT << nl;
00177 }
00178
00179 this->writeEntry("value", os);
00180 }
00181
00182
00183
00184
00185 }
00186
00187
Copyright © 2000-2009 OpenCFD Ltd