diff --git a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C index 32c9fc4264..2f2195c8ff 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C @@ -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("T", "T")), + pName_(dict.lookupOrDefault("p", "p")), + psiName_(dict.lookupOrDefault("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& pT = - patch().lookupPatchField("T"); + patch().lookupPatchField(TName_); const fvPatchField& pp = - patch().lookupPatchField("p"); + patch().lookupPatchField(pName_); const fvPatchField& ppsi = - patch().lookupPatchField("psi"); + patch().lookupPatchField(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(os, "T", "T", TName_); + writeEntryIfDifferent(os, "p", "p", pName_); + writeEntryIfDifferent(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; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.H index 402fc365f3..6f6ea27bcb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.H @@ -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_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C index ca19c5d8ab..a4a64c22d4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C @@ -41,7 +41,7 @@ Foam::waveTransmissiveFvPatchField::waveTransmissiveFvPatchField ) : advectiveFvPatchField(p, iF), - psiName_("psi"), + psiName_("thermo:psi"), gamma_(0.0) {} @@ -70,7 +70,7 @@ Foam::waveTransmissiveFvPatchField::waveTransmissiveFvPatchField ) : advectiveFvPatchField(p, iF, dict), - psiName_(dict.lookupOrDefault("psi", "psi")), + psiName_(dict.lookupOrDefault("psi", "thermo:psi")), gamma_(readScalar(dict.lookup("gamma"))) {} @@ -108,27 +108,21 @@ Foam::waveTransmissiveFvPatchField::advectionSpeed() const { // Lookup the velocity and compressibility of the patch const fvPatchField& psip = - this->patch().template lookupPatchField - ( - psiName_ - ); + this->patch().template + lookupPatchField(psiName_); const surfaceScalarField& phi = this->db().template lookupObject(this->phiName_); fvsPatchField phip = - this->patch().template lookupPatchField - ( - this->phiName_ - ); + this->patch().template + lookupPatchField(this->phiName_); if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchScalarField& rhop = - this->patch().template lookupPatchField - ( - this->rhoName_ - ); + this->patch().template + lookupPatchField(this->rhoName_); phip /= rhop; } @@ -145,18 +139,12 @@ void Foam::waveTransmissiveFvPatchField::write(Ostream& os) const { fvPatchField::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(os, "phi", "phi", this->phiName_); + this->template + writeEntryIfDifferent(os, "rho", "rho", this->rhoName_); + this->template + writeEntryIfDifferent(os, "psi", "thermo:psi", psiName_); os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;