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:
@ -83,7 +83,8 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
|
|||||||
Ubar_(coeffs_.lookup("Ubar")),
|
Ubar_(coeffs_.lookup("Ubar")),
|
||||||
gradPini_(coeffs_.lookup("gradPini")),
|
gradPini_(coeffs_.lookup("gradPini")),
|
||||||
gradP_(gradPini_),
|
gradP_(gradPini_),
|
||||||
flowDir_(Ubar_/mag(Ubar_))
|
flowDir_(Ubar_/mag(Ubar_)),
|
||||||
|
invAPtr_(NULL)
|
||||||
{
|
{
|
||||||
coeffs_.lookup("fieldNames") >> fieldNames_;
|
coeffs_.lookup("fieldNames") >> fieldNames_;
|
||||||
|
|
||||||
@ -124,36 +125,9 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::pressureGradientExplicitSource::addSup
|
|
||||||
(
|
|
||||||
fvMatrix<vector>& eqn,
|
|
||||||
const label fieldI
|
|
||||||
)
|
|
||||||
{
|
|
||||||
DimensionedField<vector, volMesh> Su
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
name_ + fieldNames_[fieldI] + "Sup",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedVector("zero", gradP_.dimensions(), vector::zero)
|
|
||||||
);
|
|
||||||
|
|
||||||
UIndirectList<vector>(Su, cells_) = flowDir_*gradP_.value();
|
|
||||||
|
|
||||||
eqn += Su;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::pressureGradientExplicitSource::correct(volVectorField& U)
|
void Foam::pressureGradientExplicitSource::correct(volVectorField& U)
|
||||||
{
|
{
|
||||||
const volScalarField& rAU =
|
const scalarField& rAU = invAPtr_().internalField();
|
||||||
mesh_.lookupObject<volScalarField>("(1|A(" + U.name() + "))");
|
|
||||||
|
|
||||||
// Integrate flow variables over cell set
|
// Integrate flow variables over cell set
|
||||||
scalar magUbarAve = 0.0;
|
scalar magUbarAve = 0.0;
|
||||||
@ -196,4 +170,61 @@ void Foam::pressureGradientExplicitSource::correct(volVectorField& U)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::pressureGradientExplicitSource::addSup
|
||||||
|
(
|
||||||
|
fvMatrix<vector>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DimensionedField<vector, volMesh> Su
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
name_ + fieldNames_[fieldI] + "Sup",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedVector("zero", gradP_.dimensions(), vector::zero)
|
||||||
|
);
|
||||||
|
|
||||||
|
UIndirectList<vector>(Su, cells_) = flowDir_*gradP_.value();
|
||||||
|
|
||||||
|
eqn += Su;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::pressureGradientExplicitSource::setValue
|
||||||
|
(
|
||||||
|
fvMatrix<vector>& eqn,
|
||||||
|
const label
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (invAPtr_.empty())
|
||||||
|
{
|
||||||
|
invAPtr_.reset
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
name_ + "::invA",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
1.0/eqn.A()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
invAPtr_() = 1.0/eqn.A();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Description
|
|||||||
|
|
||||||
pressureGradientExplicitSourceCoeffs
|
pressureGradientExplicitSourceCoeffs
|
||||||
{
|
{
|
||||||
UName U; // name of velocity field
|
fieldNames (U); // name of velocity field
|
||||||
Ubar (10.0 0 0); // desired average velocity
|
Ubar (10.0 0 0); // desired average velocity
|
||||||
gradPini gradPini [0 2 -2 0 0] 0; // initial pressure gradient
|
gradPini gradPini [0 2 -2 0 0] 0; // initial pressure gradient
|
||||||
flowDir (1 0 0); // flow direction
|
flowDir (1 0 0); // flow direction
|
||||||
@ -82,6 +82,9 @@ class pressureGradientExplicitSource
|
|||||||
//- Flow direction
|
//- Flow direction
|
||||||
vector flowDir_;
|
vector flowDir_;
|
||||||
|
|
||||||
|
//- Matrix 1/A coefficients field pointer
|
||||||
|
autoPtr<volScalarField> invAPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -126,6 +129,13 @@ public:
|
|||||||
//- Add explicit contribution to equation
|
//- Add explicit contribution to equation
|
||||||
virtual void addSup(fvMatrix<vector>& eqn, const label fieldI);
|
virtual void addSup(fvMatrix<vector>& eqn, const label fieldI);
|
||||||
|
|
||||||
|
//- Set 1/A coefficient
|
||||||
|
virtual void setValue
|
||||||
|
(
|
||||||
|
fvMatrix<vector>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user