diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C index cf9450a657..5eefe82ff5 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.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 @@ -27,27 +27,22 @@ License #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "surfaceFields.H" -#include "fvCFD.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF ) : - fixedValueFvPatchScalarField(p, iF) + fixedValueFvPatchScalarField(p, iF), + pName_("p"), + psiName_("thermo:psi") {} -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( const fixedRhoFvPatchScalarField& ptf, const fvPatch& p, @@ -55,43 +50,51 @@ fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchScalarField(ptf, p, iF, mapper) + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + pName_(ptf.pName_), + psiName_(ptf.psiName_) {} -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict) + fixedValueFvPatchScalarField(p, iF, dict), + pName_(dict.lookupOrDefault("p", "p")), + psiName_(dict.lookupOrDefault("psi", "thermo:psi")) {} -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( - const fixedRhoFvPatchScalarField& tppsf + const fixedRhoFvPatchScalarField& frpsf ) : - fixedValueFvPatchScalarField(tppsf) + fixedValueFvPatchScalarField(frpsf), + pName_(frpsf.pName_), + psiName_(frpsf.psiName_) {} -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( - const fixedRhoFvPatchScalarField& tppsf, + const fixedRhoFvPatchScalarField& frpsf, const DimensionedField& iF ) : - fixedValueFvPatchScalarField(tppsf, iF) + fixedValueFvPatchScalarField(frpsf, iF), + pName_(frpsf.pName_), + psiName_(frpsf.psiName_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void fixedRhoFvPatchScalarField::updateCoeffs() +void Foam::fixedRhoFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -99,10 +102,10 @@ void fixedRhoFvPatchScalarField::updateCoeffs() } const fvPatchField& psip = - patch().lookupPatchField("psi"); + patch().lookupPatchField(psiName_); const fvPatchField& pp = - patch().lookupPatchField("p"); + patch().lookupPatchField(pName_); operator==(psip*pp); @@ -110,16 +113,24 @@ void fixedRhoFvPatchScalarField::updateCoeffs() } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); -makePatchTypeField -( - fvPatchScalarField, - fixedRhoFvPatchScalarField -); + writeEntryIfDifferent(os, "p", "p", this->pName_); + writeEntryIfDifferent(os, "psi", "thermo:psi", psiName_); + writeEntry("value", os); +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + fixedRhoFvPatchScalarField + ); +} // ************************************************************************* // diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H index 697ae723a5..6efbb4947d 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H @@ -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 @@ -24,9 +24,42 @@ License Class Foam::fixedRhoFvPatchScalarField +Group + grpInletBoundaryConditions + Description Foam::fixedRhoFvPatchScalarField + This boundary condition provides a fixed density inlet condition for + compressible solvers, where the density of calculated using: + + \f{ + \rho = \psi p + \f] + + where + \vartable + p | pressure [Pa] + \rho | density [kg/m3] + \endvartable + + + \heading Patch usage + + \table + Property | Description | Required | Default value + pName | Pressure field name | no | p + psiName | Compressibility field name | no | thermo:psi + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type fixedRho; + } + \endverbatim + SourceFiles fixedRhoFvPatchScalarField.C @@ -43,7 +76,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class fixedRhoFvPatchScalarField Declaration + Class fixedRhoFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ class fixedRhoFvPatchScalarField @@ -51,6 +84,17 @@ class fixedRhoFvPatchScalarField public fixedValueFvPatchScalarField { +private: + + // Private data + + //- Pressure field name, default = "p" + word pName_; + + //- Compressibility field name, default = "thermo:psi" + word psiName_; + + public: //- Runtime type information @@ -125,6 +169,10 @@ public: //- Update the coefficients associated with the patch field virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; };