mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated supersonicFreestream and waveTransmissive BCs
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,6 +38,9 @@ supersonicFreestreamFvPatchVectorField
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(p, iF),
|
||||
TName_("T"),
|
||||
pName_("p"),
|
||||
psiName_("thermo:psi"),
|
||||
UInf_(vector::zero),
|
||||
pInf_(0),
|
||||
TInf_(0),
|
||||
@ -59,6 +62,9 @@ supersonicFreestreamFvPatchVectorField
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(ptf, p, iF, mapper),
|
||||
TName_(ptf.TName_),
|
||||
pName_(ptf.pName_),
|
||||
psiName_(ptf.psiName_),
|
||||
UInf_(ptf.UInf_),
|
||||
pInf_(ptf.pInf_),
|
||||
TInf_(ptf.TInf_),
|
||||
@ -75,6 +81,9 @@ supersonicFreestreamFvPatchVectorField
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(p, iF),
|
||||
TName_(dict.lookupOrDefault<word>("T", "T")),
|
||||
pName_(dict.lookupOrDefault<word>("p", "p")),
|
||||
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
|
||||
UInf_(dict.lookup("UInf")),
|
||||
pInf_(readScalar(dict.lookup("pInf"))),
|
||||
TInf_(readScalar(dict.lookup("TInf"))),
|
||||
@ -120,6 +129,9 @@ supersonicFreestreamFvPatchVectorField
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(sfspvf),
|
||||
TName_(sfspvf.TName_),
|
||||
pName_(sfspvf.pName_),
|
||||
psiName_(sfspvf.psiName_),
|
||||
UInf_(sfspvf.UInf_),
|
||||
pInf_(sfspvf.pInf_),
|
||||
TInf_(sfspvf.TInf_),
|
||||
@ -135,6 +147,9 @@ supersonicFreestreamFvPatchVectorField
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(sfspvf, iF),
|
||||
TName_(sfspvf.TName_),
|
||||
pName_(sfspvf.pName_),
|
||||
psiName_(sfspvf.psiName_),
|
||||
UInf_(sfspvf.UInf_),
|
||||
pInf_(sfspvf.pInf_),
|
||||
TInf_(sfspvf.TInf_),
|
||||
@ -152,13 +167,13 @@ void Foam::supersonicFreestreamFvPatchVectorField::updateCoeffs()
|
||||
}
|
||||
|
||||
const fvPatchField<scalar>& pT =
|
||||
patch().lookupPatchField<volScalarField, scalar>("T");
|
||||
patch().lookupPatchField<volScalarField, scalar>(TName_);
|
||||
|
||||
const fvPatchField<scalar>& pp =
|
||||
patch().lookupPatchField<volScalarField, scalar>("p");
|
||||
patch().lookupPatchField<volScalarField, scalar>(pName_);
|
||||
|
||||
const fvPatchField<scalar>& ppsi =
|
||||
patch().lookupPatchField<volScalarField, scalar>("psi");
|
||||
patch().lookupPatchField<volScalarField, scalar>(psiName_);
|
||||
|
||||
// Need R of the free-stream flow. Assume R is independent of location
|
||||
// along patch so use face 0
|
||||
@ -288,6 +303,9 @@ void Foam::supersonicFreestreamFvPatchVectorField::updateCoeffs()
|
||||
void Foam::supersonicFreestreamFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "T", "T", TName_);
|
||||
writeEntryIfDifferent<word>(os, "p", "p", pName_);
|
||||
writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_);
|
||||
os.writeKeyword("UInf") << UInf_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("pInf") << pInf_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("TInf") << TInf_ << token::END_STATEMENT << nl;
|
||||
|
||||
@ -40,6 +40,9 @@ Description
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
TName | Temperature field name | no | T
|
||||
pName | Pressure field name | no | p
|
||||
psiName | Compressibility field name | no | thermo:psi
|
||||
UInf | free-stream velocity | yes |
|
||||
pInf | free-stream pressure | yes |
|
||||
TInf | free-stream temperature | yes |
|
||||
@ -88,6 +91,15 @@ class supersonicFreestreamFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of temperature field, default = "T"
|
||||
word TName_;
|
||||
|
||||
//- Name of pressure field, default = "p"
|
||||
word pName_;
|
||||
|
||||
//- Name of compressibility field field, default = "thermo:psi"
|
||||
word psiName_;
|
||||
|
||||
//- Velocity of the free stream
|
||||
vector UInf_;
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
|
||||
)
|
||||
:
|
||||
advectiveFvPatchField<Type>(p, iF),
|
||||
psiName_("psi"),
|
||||
psiName_("thermo:psi"),
|
||||
gamma_(0.0)
|
||||
{}
|
||||
|
||||
@ -70,7 +70,7 @@ Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
|
||||
)
|
||||
:
|
||||
advectiveFvPatchField<Type>(p, iF, dict),
|
||||
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
|
||||
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
|
||||
gamma_(readScalar(dict.lookup("gamma")))
|
||||
{}
|
||||
|
||||
@ -108,27 +108,21 @@ Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const
|
||||
{
|
||||
// Lookup the velocity and compressibility of the patch
|
||||
const fvPatchField<scalar>& psip =
|
||||
this->patch().template lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
psiName_
|
||||
);
|
||||
this->patch().template
|
||||
lookupPatchField<volScalarField, scalar>(psiName_);
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
this->db().template lookupObject<surfaceScalarField>(this->phiName_);
|
||||
|
||||
fvsPatchField<scalar> phip =
|
||||
this->patch().template lookupPatchField<surfaceScalarField, scalar>
|
||||
(
|
||||
this->phiName_
|
||||
);
|
||||
this->patch().template
|
||||
lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
|
||||
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchScalarField& rhop =
|
||||
this->patch().template lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
this->rhoName_
|
||||
);
|
||||
this->patch().template
|
||||
lookupPatchField<volScalarField, scalar>(this->rhoName_);
|
||||
|
||||
phip /= rhop;
|
||||
}
|
||||
@ -145,18 +139,12 @@ void Foam::waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<Type>::write(os);
|
||||
|
||||
if (this->phiName_ != "phi")
|
||||
{
|
||||
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
if (this->rhoName_ != "rho")
|
||||
{
|
||||
os.writeKeyword("rho") << this->rhoName_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
if (psiName_ != "psi")
|
||||
{
|
||||
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
this->template
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", this->phiName_);
|
||||
this->template
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", this->rhoName_);
|
||||
this->template
|
||||
writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_);
|
||||
|
||||
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user