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
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,6 +40,8 @@ Description
|
||||
Property | Description | Required | Default value
|
||||
patchType | underlying patch type should be \c cyclic| yes |
|
||||
jumpTable | jump data, e.g. \c csvFile | yes |
|
||||
phi | flux field name | no | phi
|
||||
rho | density field name | no | none
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
@ -98,6 +100,15 @@ class fanFvPatchField
|
||||
:
|
||||
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
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
|
||||
if (this->cyclicPatch().owner())
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>("phi");
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
@ -58,7 +58,7 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
|
||||
|
||||
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));
|
||||
@ -76,7 +76,9 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
|
||||
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())
|
||||
{
|
||||
|
||||
@ -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-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,8 +30,6 @@ License
|
||||
#include "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::freestreamPressureFvPatchScalarField::
|
||||
@ -41,7 +39,25 @@ freestreamPressureFvPatchScalarField
|
||||
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
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
Foam::freestreamPressureFvPatchScalarField::
|
||||
freestreamPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchScalarField(p, iF, dict)
|
||||
zeroGradientFvPatchScalarField(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -76,7 +83,10 @@ freestreamPressureFvPatchScalarField
|
||||
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
|
||||
)
|
||||
:
|
||||
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 =
|
||||
refCast<const freestreamFvPatchVectorField>
|
||||
(
|
||||
patch().lookupPatchField<volVectorField, vector>("U")
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_)
|
||||
);
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>("phi");
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
fvsPatchField<scalar>& phip =
|
||||
const_cast<fvsPatchField<scalar>&>
|
||||
@ -122,7 +135,7 @@ void Foam::freestreamPressureFvPatchScalarField::updateCoeffs()
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
phip = rhop*(patch().Sf() & Up.freestreamValue());
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,6 +34,13 @@ Description
|
||||
|
||||
\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:
|
||||
\verbatim
|
||||
myPatch
|
||||
@ -73,6 +80,18 @@ class freestreamPressureFvPatchScalarField
|
||||
:
|
||||
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:
|
||||
|
||||
|
||||
@ -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-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,30 +38,7 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
curTimeIndex_(-1)
|
||||
{}
|
||||
|
||||
|
||||
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_("phi"),
|
||||
curTimeIndex_(-1)
|
||||
{}
|
||||
|
||||
@ -85,6 +62,7 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
||||
psi_(readScalar(dict.lookup("psi"))),
|
||||
ams_(readScalar(dict.lookup("ams"))),
|
||||
ams0_(ams_),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
curTimeIndex_(-1)
|
||||
{
|
||||
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
|
||||
(
|
||||
const syringePressureFvPatchScalarField& sppsf,
|
||||
@ -110,6 +113,7 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
||||
psi_(sppsf.psi_),
|
||||
ams_(sppsf.ams_),
|
||||
ams0_(sppsf.ams0_),
|
||||
phiName_(sppsf.phiName_),
|
||||
curTimeIndex_(-1)
|
||||
{}
|
||||
|
||||
@ -131,6 +135,7 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField
|
||||
psi_(sppsf.psi_),
|
||||
ams_(sppsf.ams_),
|
||||
ams0_(sppsf.ams0_),
|
||||
phiName_(sppsf.phiName_),
|
||||
curTimeIndex_(-1)
|
||||
{}
|
||||
|
||||
@ -193,7 +198,7 @@ void Foam::syringePressureFvPatchScalarField::updateCoeffs()
|
||||
scalar deltaT = db().time().deltaTValue();
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>("phi");
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
@ -133,6 +133,9 @@ class syringePressureFvPatchScalarField
|
||||
//- Added gas mass at previous time step
|
||||
scalar ams0_;
|
||||
|
||||
//- Name of the flux transporting the field
|
||||
word phiName_;
|
||||
|
||||
//- Current time index used to store ms0_
|
||||
label curTimeIndex_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user