mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated fixedRho BC
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
|
||||
@ -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<scalar, volMesh>& 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<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict)
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
pName_(dict.lookupOrDefault<word>("p", "p")),
|
||||
psiName_(dict.lookupOrDefault<word>("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<scalar, volMesh>& 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<scalar>& psip =
|
||||
patch().lookupPatchField<volScalarField, scalar>("psi");
|
||||
patch().lookupPatchField<volScalarField, scalar>(psiName_);
|
||||
|
||||
const fvPatchField<scalar>& pp =
|
||||
patch().lookupPatchField<volScalarField, scalar>("p");
|
||||
patch().lookupPatchField<volScalarField, scalar>(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<word>(os, "p", "p", this->pName_);
|
||||
writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
fixedRhoFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user