mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -127,7 +127,6 @@ derivedFvPatchFields = $(fvPatchFields)/derived
|
||||
$(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/advective/advectiveFvPatchFields.C
|
||||
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/codedMixed/codedMixedFvPatchFields.C
|
||||
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
|
||||
@ -154,7 +153,6 @@ $(derivedFvPatchFields)/mappedFixedValue/mappedFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/mappedFlowRate/mappedFlowRateFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C
|
||||
$(derivedFvPatchFields)/movingWallVelocity/movingWallVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/oscillatingFixedValue/oscillatingFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C
|
||||
$(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C
|
||||
|
||||
56
src/finiteVolume/cfdTools/compressible/createRhoUf.H
Normal file
56
src/finiteVolume/cfdTools/compressible/createRhoUf.H
Normal file
@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Global
|
||||
createRhoUf
|
||||
|
||||
Description
|
||||
Creates and initialises the velocity velocity field rhoUf.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef createRhoUf_H
|
||||
#define createRhoUf_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "Reading/calculating face velocity rhoUf\n" << endl;
|
||||
|
||||
surfaceVectorField rhoUf
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoUf",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rho*U)
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -461,6 +461,28 @@ void Foam::MRFZone::makeRelative(volVectorField& U) const
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::makeRelative(surfaceScalarField& phi) const
|
||||
{
|
||||
makeRelativeRhoFlux(geometricOneField(), phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::makeRelative(FieldField<fvsPatchField, scalar>& phi) const
|
||||
{
|
||||
makeRelativeRhoFlux(oneFieldField(), phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
makeRelativeRhoFlux(rho, phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::makeAbsolute(volVectorField& U) const
|
||||
{
|
||||
const volVectorField& C = mesh_.C();
|
||||
@ -499,28 +521,6 @@ void Foam::MRFZone::makeAbsolute(volVectorField& U) const
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::makeRelative(surfaceScalarField& phi) const
|
||||
{
|
||||
makeRelativeRhoFlux(geometricOneField(), phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::makeRelative(FieldField<fvsPatchField, scalar>& phi) const
|
||||
{
|
||||
return makeRelativeRhoFlux(oneFieldField(), phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
makeRelativeRhoFlux(rho, phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::makeAbsolute(surfaceScalarField& phi) const
|
||||
{
|
||||
makeAbsoluteRhoFlux(geometricOneField(), phi);
|
||||
|
||||
@ -218,9 +218,6 @@ public:
|
||||
//- Make the given absolute velocity relative within the MRF region
|
||||
void makeRelative(volVectorField& U) const;
|
||||
|
||||
//- Make the given relative velocity absolute within the MRF region
|
||||
void makeAbsolute(volVectorField& U) const;
|
||||
|
||||
//- Make the given absolute flux relative within the MRF region
|
||||
void makeRelative(surfaceScalarField& phi) const;
|
||||
|
||||
@ -235,6 +232,9 @@ public:
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Make the given relative velocity absolute within the MRF region
|
||||
void makeAbsolute(volVectorField& U) const;
|
||||
|
||||
//- Make the given relative flux absolute within the MRF region
|
||||
void makeAbsolute(surfaceScalarField& phi) const;
|
||||
|
||||
|
||||
@ -169,15 +169,6 @@ void Foam::MRFZoneList::makeRelative(volVectorField& U) const
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZoneList::makeAbsolute(volVectorField& U) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
operator[](i).makeAbsolute(U);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZoneList::makeRelative(surfaceScalarField& phi) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
@ -193,7 +184,7 @@ Foam::MRFZoneList::relative
|
||||
const tmp<FieldField<fvsPatchField, scalar> >& phi
|
||||
) const
|
||||
{
|
||||
tmp<FieldField<fvsPatchField, scalar> > rphi(phi);
|
||||
tmp<FieldField<fvsPatchField, scalar> > rphi(phi.ptr());
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
@ -217,6 +208,15 @@ void Foam::MRFZoneList::makeRelative
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZoneList::makeAbsolute(volVectorField& U) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
operator[](i).makeAbsolute(U);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZoneList::makeAbsolute(surfaceScalarField& phi) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
|
||||
13
src/finiteVolume/cfdTools/general/include/createPcorrTypes.H
Normal file
13
src/finiteVolume/cfdTools/general/include/createPcorrTypes.H
Normal file
@ -0,0 +1,13 @@
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
for (label i=0; i<p.boundaryField().size(); i++)
|
||||
{
|
||||
if (p.boundaryField()[i].fixesValue())
|
||||
{
|
||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p_rgh.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
for (label i=0; i<p_rgh.boundaryField().size(); i++)
|
||||
{
|
||||
if (p_rgh.boundaryField()[i].fixesValue())
|
||||
{
|
||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
56
src/finiteVolume/cfdTools/incompressible/createUf.H
Normal file
56
src/finiteVolume/cfdTools/incompressible/createUf.H
Normal file
@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Global
|
||||
createUf
|
||||
|
||||
Description
|
||||
Creates and initialises the velocity velocity field Uf.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef createUf_H
|
||||
#define createUf_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "Reading/calculating face velocity Uf\n" << endl;
|
||||
|
||||
surfaceVectorField Uf
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Uf",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(U)
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,167 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "buoyantPressureFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "uniformDimensionedFields.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::buoyantPressureFvPatchScalarField::
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
rhoName_("rho")
|
||||
{}
|
||||
|
||||
|
||||
Foam::buoyantPressureFvPatchScalarField::
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
||||
{
|
||||
if (dict.found("value") && dict.found("gradient"))
|
||||
{
|
||||
fvPatchField<scalar>::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
);
|
||||
gradient() = scalarField("gradient", dict, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
gradient() = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::buoyantPressureFvPatchScalarField::
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const buoyantPressureFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::buoyantPressureFvPatchScalarField::
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const buoyantPressureFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(ptf),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::buoyantPressureFvPatchScalarField::
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const buoyantPressureFvPatchScalarField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(ptf, iF),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::buoyantPressureFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const uniformDimensionedVectorField& g =
|
||||
db().lookupObject<uniformDimensionedVectorField>("g");
|
||||
|
||||
const fvPatchField<scalar>& rho =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
// If the variable name is "p_rgh", "ph_rgh" or "pd"
|
||||
// assume it is p? - rho*g.h and set the gradient appropriately.
|
||||
// Otherwise assume the variable is the static pressure.
|
||||
if
|
||||
(
|
||||
dimensionedInternalField().name() == "p_rgh"
|
||||
|| dimensionedInternalField().name() == "ph_rgh"
|
||||
|| dimensionedInternalField().name() == "pd"
|
||||
)
|
||||
{
|
||||
gradient() = -rho.snGrad()*(g.value() & patch().Cf());
|
||||
}
|
||||
else
|
||||
{
|
||||
gradient() = rho*(g.value() & patch().nf());
|
||||
}
|
||||
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::buoyantPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedGradientFvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
buoyantPressureFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,196 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::buoyantPressureFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpGenericBoundaryConditions grpWallBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition sets the pressure gradient appropriately for
|
||||
buoyant flow.
|
||||
|
||||
If the variable name is one of:
|
||||
- \c pd
|
||||
- \c p_rgh
|
||||
- \c ph_rgh
|
||||
we assume that the pressure variable is \f$p - \rho(g \cdot h)\f$ and the
|
||||
gradient set using:
|
||||
\f[
|
||||
\nabla(p) = -\nabla_\perp(\rho)(g \cdot h)
|
||||
\f]
|
||||
|
||||
where
|
||||
|
||||
\vartable
|
||||
\rho | density [kg/m3]
|
||||
g | acceleration due to gravity [m/s2]
|
||||
h | patch face centres [m]
|
||||
\endvartable
|
||||
|
||||
Otherwise we assume that it is the static pressure, and the gradient
|
||||
calculated using:
|
||||
\f[
|
||||
\nabla(p) = \rho(g \cdot n)
|
||||
\f]
|
||||
|
||||
where
|
||||
\vartable
|
||||
n | patch face normal vectors
|
||||
\endvartable
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
rho | density field name | no | rho
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type buoyantPressure;
|
||||
rho rho;
|
||||
value uniform 0;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
buoyantPressureFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef buoyantPressureFvPatchScalarFields_H
|
||||
#define buoyantPressureFvPatchScalarFields_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class buoyantPressureFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class buoyantPressureFvPatchScalarField
|
||||
:
|
||||
public fixedGradientFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the density field used to calculate the buoyancy force
|
||||
word rhoName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("buoyantPressure");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// buoyantPressureFvPatchScalarField onto a new patch
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const buoyantPressureFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const buoyantPressureFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new buoyantPressureFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
buoyantPressureFvPatchScalarField
|
||||
(
|
||||
const buoyantPressureFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new buoyantPressureFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -38,11 +38,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
phiHbyAName_("phiHbyA"),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
DpName_("Dp"),
|
||||
adjoint_(false)
|
||||
curTimeIndex_(-1)
|
||||
{}
|
||||
|
||||
|
||||
@ -54,13 +50,12 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
|
||||
phiHbyAName_(ptf.phiHbyAName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
DpName_(ptf.DpName_),
|
||||
adjoint_(ptf.adjoint_)
|
||||
{}
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
curTimeIndex_(-1)
|
||||
{
|
||||
gradient() = 0.0;
|
||||
map(gradient(), mapper);
|
||||
}
|
||||
|
||||
|
||||
Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
@ -71,11 +66,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
phiHbyAName_(dict.lookupOrDefault<word>("phiHbyA", "phiHbyA")),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
DpName_(dict.lookupOrDefault<word>("Dp", "Dp")),
|
||||
adjoint_(dict.lookupOrDefault<Switch>("adjoint", false))
|
||||
curTimeIndex_(-1)
|
||||
{
|
||||
if (dict.found("value") && dict.found("gradient"))
|
||||
{
|
||||
@ -99,11 +90,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(wbppsf),
|
||||
phiHbyAName_(wbppsf.phiHbyAName_),
|
||||
phiName_(wbppsf.phiName_),
|
||||
rhoName_(wbppsf.rhoName_),
|
||||
DpName_(wbppsf.DpName_),
|
||||
adjoint_(wbppsf.adjoint_)
|
||||
curTimeIndex_(-1)
|
||||
{}
|
||||
|
||||
|
||||
@ -114,16 +101,29 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(wbppsf, iF),
|
||||
phiHbyAName_(wbppsf.phiHbyAName_),
|
||||
phiName_(wbppsf.phiName_),
|
||||
rhoName_(wbppsf.rhoName_),
|
||||
DpName_(wbppsf.DpName_),
|
||||
adjoint_(wbppsf.adjoint_)
|
||||
curTimeIndex_(-1)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs
|
||||
(
|
||||
const scalarField& snGradp
|
||||
)
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
curTimeIndex_ = this->db().time().timeIndex();
|
||||
|
||||
gradient() = snGradp;
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
@ -131,76 +131,19 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const surfaceScalarField& phiHbyA =
|
||||
db().lookupObject<surfaceScalarField>(phiHbyAName_);
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
fvsPatchField<scalar> phiHbyAp =
|
||||
patch().patchField<surfaceScalarField, scalar>(phiHbyA);
|
||||
|
||||
fvsPatchField<scalar> phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
/*
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
if (curTimeIndex_ != this->db().time().timeIndex())
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
phip /= rhop;
|
||||
FatalErrorIn("fixedFluxPressureFvPatchScalarField::updateCoeffs()")
|
||||
<< "updateCoeffs(const scalarField& snGradp) MUST be called before"
|
||||
" updateCoeffs() or evaluate() to set the boundary gradient."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (phiHbyA.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
phiHbyAp /= rhop;
|
||||
}
|
||||
*/
|
||||
|
||||
const scalarField *DppPtr = NULL;
|
||||
|
||||
if (db().foundObject<volScalarField>(DpName_))
|
||||
{
|
||||
DppPtr =
|
||||
&patch().lookupPatchField<volScalarField, scalar>(DpName_);
|
||||
}
|
||||
else if (db().foundObject<surfaceScalarField>(DpName_))
|
||||
{
|
||||
const surfaceScalarField& Dp =
|
||||
db().lookupObject<surfaceScalarField>(DpName_);
|
||||
|
||||
DppPtr =
|
||||
&patch().patchField<surfaceScalarField, scalar>(Dp);
|
||||
}
|
||||
|
||||
if (adjoint_)
|
||||
{
|
||||
gradient() = (phip - phiHbyAp)/patch().magSf()/(*DppPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
gradient() = (phiHbyAp - phip)/patch().magSf()/(*DppPtr);
|
||||
}
|
||||
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedGradientFvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "Dp", "Dp", DpName_);
|
||||
if (adjoint_)
|
||||
{
|
||||
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
@ -216,4 +159,5 @@ namespace Foam
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -28,44 +28,15 @@ Group
|
||||
grpInletBoundaryConditions grpWallBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition adjusts the pressure gradient such that the flux
|
||||
on the boundary is that specified by the velocity boundary condition.
|
||||
|
||||
The predicted flux to be compensated by the pressure gradient is evaluated
|
||||
as \f$(\phi - \phi_{H/A})\f$, both of which are looked-up from the database,
|
||||
as is the pressure diffusivity used to calculate the gradient using:
|
||||
|
||||
\f[
|
||||
\nabla(p) = \frac{\phi_{H/A} - \phi}{|Sf| D_p}
|
||||
\f]
|
||||
|
||||
where
|
||||
|
||||
\vartable
|
||||
phi | flux
|
||||
D_p | pressure diffusivity
|
||||
Sf | patch face areas [m2]
|
||||
\endvartable
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
phiHbyA | name of predicted flux field | no | phiHbyA
|
||||
phi | name of flux field | no | phi
|
||||
rho | name of density field | no | rho
|
||||
Dp | name of pressure diffusivity field | no | Dp
|
||||
\endtable
|
||||
This boundary condition sets the pressure gradient to the provided value
|
||||
such that the flux on the boundary is that specified by the velocity
|
||||
boundary condition.
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
phiHbyA phiHbyA;
|
||||
phi phi;
|
||||
rho rho;
|
||||
Dp Dp;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -99,21 +70,8 @@ class fixedFluxPressureFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the predicted flux transporting the field
|
||||
word phiHbyAName_;
|
||||
|
||||
//- Name of the flux transporting the field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the density field used to normalise the mass flux
|
||||
// if neccessary
|
||||
word rhoName_;
|
||||
|
||||
//- Name of the pressure diffusivity field
|
||||
word DpName_;
|
||||
|
||||
//- Is the pressure adjoint, i.e. has the opposite sign
|
||||
Switch adjoint_;
|
||||
//- Current time index (used for updating)
|
||||
label curTimeIndex_;
|
||||
|
||||
|
||||
public:
|
||||
@ -186,7 +144,10 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
//- Update the patch pressure gradient field from the given snGradp
|
||||
virtual void updateCoeffs(const scalarField& snGradp);
|
||||
|
||||
//- Update the patch pressure gradient field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
@ -200,6 +161,39 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "volFields.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<class GradBC>
|
||||
inline void setSnGrad
|
||||
(
|
||||
volScalarField::GeometricBoundaryField& bf,
|
||||
const FieldField<fvsPatchField, scalar>& snGrad
|
||||
)
|
||||
{
|
||||
forAll(bf, patchi)
|
||||
{
|
||||
if (isA<GradBC>(bf[patchi]))
|
||||
{
|
||||
refCast<GradBC>(bf[patchi]).updateCoeffs(snGrad[patchi]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class GradBC>
|
||||
inline void setSnGrad
|
||||
(
|
||||
volScalarField::GeometricBoundaryField& bf,
|
||||
const tmp<FieldField<fvsPatchField, scalar> >& tsnGrad
|
||||
)
|
||||
{
|
||||
setSnGrad<GradBC>(bf, tsnGrad());
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -1,197 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "multiphaseFixedFluxPressureFvPatchScalarField.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
phiHbyAName_("phiHbyA"),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
DpName_("Dp")
|
||||
{}
|
||||
|
||||
|
||||
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const multiphaseFixedFluxPressureFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
|
||||
phiHbyAName_(ptf.phiHbyAName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
DpName_(ptf.DpName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
phiHbyAName_(dict.lookupOrDefault<word>("phiHbyA", "phiHbyA")),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
DpName_(dict.lookupOrDefault<word>("Dp", "Dp"))
|
||||
{
|
||||
if (dict.found("gradient"))
|
||||
{
|
||||
gradient() = scalarField("gradient", dict, p.size());
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
fixedGradientFvPatchScalarField::evaluate();
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
gradient() = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const multiphaseFixedFluxPressureFvPatchScalarField& mfppsf
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(mfppsf),
|
||||
phiHbyAName_(mfppsf.phiHbyAName_),
|
||||
phiName_(mfppsf.phiName_),
|
||||
rhoName_(mfppsf.rhoName_),
|
||||
DpName_(mfppsf.DpName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const multiphaseFixedFluxPressureFvPatchScalarField& mfppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(mfppsf, iF),
|
||||
phiHbyAName_(mfppsf.phiHbyAName_),
|
||||
phiName_(mfppsf.phiName_),
|
||||
rhoName_(mfppsf.rhoName_),
|
||||
DpName_(mfppsf.DpName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::multiphaseFixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const surfaceScalarField& phiHbyA =
|
||||
db().lookupObject<surfaceScalarField>(phiHbyAName_);
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
fvsPatchField<scalar> phiHbyAp =
|
||||
patch().patchField<surfaceScalarField, scalar>(phiHbyA);
|
||||
|
||||
fvsPatchField<scalar> phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
/*
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
phip /= rhop;
|
||||
}
|
||||
|
||||
if (phiHbyA.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
phiHbyAp /= rhop;
|
||||
}
|
||||
*/
|
||||
|
||||
const fvsPatchField<scalar>& Dpp =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>(DpName_);
|
||||
|
||||
gradient() = (phiHbyAp - phip)/patch().magSf()/Dpp;
|
||||
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::multiphaseFixedFluxPressureFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "Dp", "Dp", DpName_);
|
||||
gradient().writeEntry("gradient", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,199 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::multiphaseFixedFluxPressureFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallBoundaryConditions grpGenericBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition adjusts the pressure gradient such that the flux
|
||||
on the boundary is that specified by the velocity boundary condition.
|
||||
|
||||
The predicted flux to be compensated by the pressure gradient is evaluated
|
||||
as \f$(\phi - \phi_{H/A})\f$, both of which are looked-up from the database,
|
||||
as is the pressure diffusivity Dp used to calculate the gradient using:
|
||||
|
||||
\f[
|
||||
\nabla(p) = \frac{\phi_{H/A} - \phi}{|Sf| Dp}
|
||||
\f]
|
||||
|
||||
where
|
||||
|
||||
\vartable
|
||||
\phi | flux
|
||||
Dp | pressure diffusivity
|
||||
Sf | patch face areas [m2]
|
||||
\endvartable
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
phiHbyA | name of predicted flux field | no | phiHbyA
|
||||
phi | name of flux field | no | phi
|
||||
rho | name of density field | no | rho
|
||||
Dp | name of pressure diffusivity field | no | Dp
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type multiphaseFixedFluxPressure;
|
||||
phiHbyA phiHbyA;
|
||||
phi phi;
|
||||
rho rho;
|
||||
Dp Dp;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
multiphaseFixedFluxPressureFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef multiphaseFixedFluxPressureFvPatchScalarFields_H
|
||||
#define multiphaseFixedFluxPressureFvPatchScalarFields_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class multiphaseFixedFluxPressureFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class multiphaseFixedFluxPressureFvPatchScalarField
|
||||
:
|
||||
public fixedGradientFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the predicted flux transporting the field
|
||||
word phiHbyAName_;
|
||||
|
||||
//- Name of the flux transporting the field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the density field used to normalise the mass flux
|
||||
// if neccessary
|
||||
word rhoName_;
|
||||
|
||||
//- Name of the pressure diffusivity field
|
||||
word DpName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("multiphaseFixedFluxPressure");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// multiphaseFixedFluxPressureFvPatchScalarField onto a new patch
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const multiphaseFixedFluxPressureFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const multiphaseFixedFluxPressureFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new multiphaseFixedFluxPressureFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
multiphaseFixedFluxPressureFvPatchScalarField
|
||||
(
|
||||
const multiphaseFixedFluxPressureFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new multiphaseFixedFluxPressureFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "volFields.H"
|
||||
#include "fvsPatchFields.H"
|
||||
#include "ListOps.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
@ -480,6 +481,15 @@ void Foam::fv::option::makeRelative(surfaceScalarField& phi) const
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::option::makeRelative
|
||||
(
|
||||
FieldField<fvsPatchField, scalar>& phi
|
||||
) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::option::makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
|
||||
@ -427,6 +427,12 @@ public:
|
||||
//- Make the given absolute flux relative
|
||||
virtual void makeRelative(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given absolute boundary flux relative
|
||||
virtual void makeRelative
|
||||
(
|
||||
FieldField<fvsPatchField, scalar>& phi
|
||||
) const;
|
||||
|
||||
//- Make the given absolute mass-flux relative
|
||||
virtual void makeRelative
|
||||
(
|
||||
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "fvOptionList.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvMesh.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -129,6 +130,23 @@ void Foam::fv::optionList::makeRelative
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::FieldField<Foam::fvsPatchField, Foam::scalar> >
|
||||
Foam::fv::optionList::relative
|
||||
(
|
||||
const tmp<FieldField<fvsPatchField, scalar> >& phi
|
||||
) const
|
||||
{
|
||||
tmp<FieldField<fvsPatchField, scalar> > rphi(phi.ptr());
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
operator[](i).makeRelative(rphi());
|
||||
}
|
||||
|
||||
return rphi;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::optionList::makeAbsolute(surfaceScalarField& phi) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
|
||||
@ -166,6 +166,12 @@ public:
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Return the given absolute boundary flux relative
|
||||
tmp<FieldField<fvsPatchField, scalar> > relative
|
||||
(
|
||||
const tmp<FieldField<fvsPatchField, scalar> >& tphi
|
||||
) const;
|
||||
|
||||
//- Make the given relative flux absolute
|
||||
void makeAbsolute(surfaceScalarField& phi) const;
|
||||
|
||||
|
||||
@ -126,6 +126,15 @@ void Foam::fv::MRFSource::makeRelative(surfaceScalarField& phi) const
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::MRFSource::makeRelative
|
||||
(
|
||||
FieldField<fvsPatchField, scalar>& phi
|
||||
) const
|
||||
{
|
||||
mrfPtr_->makeRelative(phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::MRFSource::makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
|
||||
@ -140,6 +140,12 @@ public:
|
||||
//- Make the given absolute flux relative
|
||||
virtual void makeRelative(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given absolute boundary flux relative
|
||||
virtual void makeRelative
|
||||
(
|
||||
FieldField<fvsPatchField, scalar>& phi
|
||||
) const;
|
||||
|
||||
//- Make the given absolute mass-flux relative
|
||||
virtual void makeRelative
|
||||
(
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -229,8 +229,24 @@ curvatureSeparation::curvatureSeparation
|
||||
deltaByR1Min_(coeffs().lookupOrDefault<scalar>("deltaByR1Min", 0.0)),
|
||||
definedPatchRadii_(),
|
||||
magG_(mag(owner.g().value())),
|
||||
gHat_(owner.g().value()/magG_)
|
||||
gHat_(vector::zero)
|
||||
{
|
||||
if (magG_ < ROOTVSMALL)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"curvatureSeparation::curvatureSeparation"
|
||||
"("
|
||||
"const surfaceFilmModel&, "
|
||||
"const dictionary&"
|
||||
")"
|
||||
)
|
||||
<< "Acceleration due to gravity must be non-zero"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
gHat_ = owner.g().value()/magG_;
|
||||
|
||||
List<Tuple2<word, scalar> > prIn(coeffs().lookup("definedPatchRadii"));
|
||||
const wordList& allPatchNames = owner.regionMesh().boundaryMesh().names();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user