mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
fvPatchFields: Support explicitly named U, phi and rho in all BCs
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1717
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -40,6 +40,8 @@ Description
|
|||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
patchType | underlying patch type should be \c cyclic| yes |
|
patchType | underlying patch type should be \c cyclic| yes |
|
||||||
jumpTable | jump data, e.g. \c csvFile | yes |
|
jumpTable | jump data, e.g. \c csvFile | yes |
|
||||||
|
phi | flux field name | no | phi
|
||||||
|
rho | density field name | no | none
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
@ -98,6 +100,15 @@ class fanFvPatchField
|
|||||||
:
|
:
|
||||||
public uniformJumpFvPatchField<Type>
|
public uniformJumpFvPatchField<Type>
|
||||||
{
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of the flux transporting the field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of the density field used to normalise the mass flux
|
||||||
|
// if neccessary
|
||||||
|
word rhoName_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
|
|||||||
if (this->cyclicPatch().owner())
|
if (this->cyclicPatch().owner())
|
||||||
{
|
{
|
||||||
const surfaceScalarField& phi =
|
const surfaceScalarField& phi =
|
||||||
db().lookupObject<surfaceScalarField>("phi");
|
db().lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
const fvsPatchField<scalar>& phip =
|
const fvsPatchField<scalar>& phip =
|
||||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||||
@ -58,7 +58,7 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
|
|||||||
|
|
||||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
{
|
{
|
||||||
Un /= patch().lookupPatchField<volScalarField, scalar>("rho");
|
Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->jump_ = max(this->jumpTable_->value(Un), scalar(0));
|
this->jump_ = max(this->jumpTable_->value(Un), scalar(0));
|
||||||
@ -76,7 +76,9 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
uniformJumpFvPatchField<scalar>(p, iF)
|
uniformJumpFvPatchField<scalar>(p, iF),
|
||||||
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
|
rhoName_(dict.lookupOrDefault<word>("rho", "none"))
|
||||||
{
|
{
|
||||||
if (this->cyclicPatch().owner())
|
if (this->cyclicPatch().owner())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,8 +30,6 @@ License
|
|||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::freestreamPressureFvPatchScalarField::
|
Foam::freestreamPressureFvPatchScalarField::
|
||||||
@ -41,7 +39,25 @@ freestreamPressureFvPatchScalarField
|
|||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
zeroGradientFvPatchScalarField(p, iF)
|
zeroGradientFvPatchScalarField(p, iF),
|
||||||
|
UName_("U"),
|
||||||
|
phiName_("phi"),
|
||||||
|
rhoName_("none")
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::freestreamPressureFvPatchScalarField::
|
||||||
|
freestreamPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchScalarField(p, iF, dict),
|
||||||
|
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||||
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
|
rhoName_(dict.lookupOrDefault<word>("rho", "none"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -54,19 +70,10 @@ freestreamPressureFvPatchScalarField
|
|||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
zeroGradientFvPatchScalarField(ptf, p, iF, mapper)
|
zeroGradientFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
{}
|
UName_(ptf.UName_),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_)
|
||||||
Foam::freestreamPressureFvPatchScalarField::
|
|
||||||
freestreamPressureFvPatchScalarField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
zeroGradientFvPatchScalarField(p, iF, dict)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -76,7 +83,10 @@ freestreamPressureFvPatchScalarField
|
|||||||
const freestreamPressureFvPatchScalarField& wbppsf
|
const freestreamPressureFvPatchScalarField& wbppsf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
zeroGradientFvPatchScalarField(wbppsf)
|
zeroGradientFvPatchScalarField(wbppsf),
|
||||||
|
UName_(wbppsf.UName_),
|
||||||
|
phiName_(wbppsf.phiName_),
|
||||||
|
rhoName_(wbppsf.rhoName_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +97,10 @@ freestreamPressureFvPatchScalarField
|
|||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
zeroGradientFvPatchScalarField(wbppsf, iF)
|
zeroGradientFvPatchScalarField(wbppsf, iF),
|
||||||
|
UName_(wbppsf.UName_),
|
||||||
|
phiName_(wbppsf.phiName_),
|
||||||
|
rhoName_(wbppsf.rhoName_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -103,11 +116,11 @@ void Foam::freestreamPressureFvPatchScalarField::updateCoeffs()
|
|||||||
const freestreamFvPatchVectorField& Up =
|
const freestreamFvPatchVectorField& Up =
|
||||||
refCast<const freestreamFvPatchVectorField>
|
refCast<const freestreamFvPatchVectorField>
|
||||||
(
|
(
|
||||||
patch().lookupPatchField<volVectorField, vector>("U")
|
patch().lookupPatchField<volVectorField, vector>(UName_)
|
||||||
);
|
);
|
||||||
|
|
||||||
const surfaceScalarField& phi =
|
const surfaceScalarField& phi =
|
||||||
db().lookupObject<surfaceScalarField>("phi");
|
db().lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
fvsPatchField<scalar>& phip =
|
fvsPatchField<scalar>& phip =
|
||||||
const_cast<fvsPatchField<scalar>&>
|
const_cast<fvsPatchField<scalar>&>
|
||||||
@ -122,7 +135,7 @@ void Foam::freestreamPressureFvPatchScalarField::updateCoeffs()
|
|||||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
{
|
{
|
||||||
const fvPatchField<scalar>& rhop =
|
const fvPatchField<scalar>& rhop =
|
||||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
|
||||||
phip = rhop*(patch().Sf() & Up.freestreamValue());
|
phip = rhop*(patch().Sf() & Up.freestreamValue());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -34,6 +34,13 @@ Description
|
|||||||
|
|
||||||
\heading Patch usage
|
\heading Patch usage
|
||||||
|
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
U | velocity field name | no | U
|
||||||
|
phi | flux field name | no | phi
|
||||||
|
rho | density field name | no | none
|
||||||
|
\endtable
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
\verbatim
|
\verbatim
|
||||||
myPatch
|
myPatch
|
||||||
@ -73,6 +80,18 @@ class freestreamPressureFvPatchScalarField
|
|||||||
:
|
:
|
||||||
public zeroGradientFvPatchScalarField
|
public zeroGradientFvPatchScalarField
|
||||||
{
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of the velocity field
|
||||||
|
word UName_;
|
||||||
|
|
||||||
|
//- Name of the flux transporting the field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of the density field used to normalise the mass flux
|
||||||
|
// if neccessary
|
||||||
|
word rhoName_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -38,30 +38,7 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(p, iF),
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
curTimeIndex_(-1)
|
phiName_("phi"),
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
|
||||||
(
|
|
||||||
const syringePressureFvPatchScalarField& sppsf,
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
|
||||||
const fvPatchFieldMapper& mapper
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fixedValueFvPatchScalarField(sppsf, p, iF, mapper),
|
|
||||||
Ap_(sppsf.Ap_),
|
|
||||||
Sp_(sppsf.Sp_),
|
|
||||||
VsI_(sppsf.VsI_),
|
|
||||||
tas_(sppsf.tas_),
|
|
||||||
tae_(sppsf.tae_),
|
|
||||||
tds_(sppsf.tds_),
|
|
||||||
tde_(sppsf.tde_),
|
|
||||||
psI_(sppsf.psI_),
|
|
||||||
psi_(sppsf.psi_),
|
|
||||||
ams_(sppsf.ams_),
|
|
||||||
ams0_(sppsf.ams0_),
|
|
||||||
curTimeIndex_(-1)
|
curTimeIndex_(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -85,6 +62,7 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
|||||||
psi_(readScalar(dict.lookup("psi"))),
|
psi_(readScalar(dict.lookup("psi"))),
|
||||||
ams_(readScalar(dict.lookup("ams"))),
|
ams_(readScalar(dict.lookup("ams"))),
|
||||||
ams0_(ams_),
|
ams0_(ams_),
|
||||||
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
curTimeIndex_(-1)
|
curTimeIndex_(-1)
|
||||||
{
|
{
|
||||||
scalar ps = (psI_*VsI_ + ams_/psi_)/Vs(db().time().value());
|
scalar ps = (psI_*VsI_ + ams_/psi_)/Vs(db().time().value());
|
||||||
@ -92,6 +70,31 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const syringePressureFvPatchScalarField& sppsf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(sppsf, p, iF, mapper),
|
||||||
|
Ap_(sppsf.Ap_),
|
||||||
|
Sp_(sppsf.Sp_),
|
||||||
|
VsI_(sppsf.VsI_),
|
||||||
|
tas_(sppsf.tas_),
|
||||||
|
tae_(sppsf.tae_),
|
||||||
|
tds_(sppsf.tds_),
|
||||||
|
tde_(sppsf.tde_),
|
||||||
|
psI_(sppsf.psI_),
|
||||||
|
psi_(sppsf.psi_),
|
||||||
|
ams_(sppsf.ams_),
|
||||||
|
ams0_(sppsf.ams0_),
|
||||||
|
phiName_(sppsf.phiName_),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
||||||
(
|
(
|
||||||
const syringePressureFvPatchScalarField& sppsf,
|
const syringePressureFvPatchScalarField& sppsf,
|
||||||
@ -110,6 +113,7 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
|||||||
psi_(sppsf.psi_),
|
psi_(sppsf.psi_),
|
||||||
ams_(sppsf.ams_),
|
ams_(sppsf.ams_),
|
||||||
ams0_(sppsf.ams0_),
|
ams0_(sppsf.ams0_),
|
||||||
|
phiName_(sppsf.phiName_),
|
||||||
curTimeIndex_(-1)
|
curTimeIndex_(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -131,6 +135,7 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
|||||||
psi_(sppsf.psi_),
|
psi_(sppsf.psi_),
|
||||||
ams_(sppsf.ams_),
|
ams_(sppsf.ams_),
|
||||||
ams0_(sppsf.ams0_),
|
ams0_(sppsf.ams0_),
|
||||||
|
phiName_(sppsf.phiName_),
|
||||||
curTimeIndex_(-1)
|
curTimeIndex_(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -193,7 +198,7 @@ void Foam::syringePressureFvPatchScalarField::updateCoeffs()
|
|||||||
scalar deltaT = db().time().deltaTValue();
|
scalar deltaT = db().time().deltaTValue();
|
||||||
|
|
||||||
const surfaceScalarField& phi =
|
const surfaceScalarField& phi =
|
||||||
db().lookupObject<surfaceScalarField>("phi");
|
db().lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
const fvsPatchField<scalar>& phip =
|
const fvsPatchField<scalar>& phip =
|
||||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||||
|
|||||||
@ -133,6 +133,9 @@ class syringePressureFvPatchScalarField
|
|||||||
//- Added gas mass at previous time step
|
//- Added gas mass at previous time step
|
||||||
scalar ams0_;
|
scalar ams0_;
|
||||||
|
|
||||||
|
//- Name of the flux transporting the field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
//- Current time index used to store ms0_
|
//- Current time index used to store ms0_
|
||||||
label curTimeIndex_;
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user