fvConstraints, fvModels: zeroDimensionalFixedPressure

A constraint and a model have been added, both called
zeroDimensionalFixedPressure, that together act to maintain a pressure
constraint in a zero-dimensional case. These must be used
simultaneously. The desired pressure can be specified as a time-varying
Function1.

These replace the pressureConstraintSource, which has been removed.

The new classes operate by obtaining the residual of the complete
pressure equation, and using that to calculate the mass or volume
sources that need adding to the fluid in order to maintain the
constraint. This process is far more convergent than the previous
approach, it does not require the fluid to have a certain thermodynamic
model, and it is generalisable to multiphase.

This functionality requires only minimal specification. The constraint
contains all the settings and should be specified in
system/fvConstraints as follows:

    zeroDimensionalFixedPressure1
    {
        type            zeroDimensionalFixedPressure;

        // Name of the pressure field, default = p
        //p               p;

        // Name of the density field, default = rho
        //rho             rho;

        // Constant pressure value
        pressure        1e5;

        //// Time-varying pressure value
        //pressure
        //{
        //    type            table;
        //    values
        //    (
        //        (0 1e5)
        //        (1 1e5)
        //        (1.1 1.4e5)
        //        (10 1.4e5)
        //    );
        //}
    }

The model is then added to constant/fvModels, and requires no settings:

    zeroDimensionalFixedPressure1
    {
        type            zeroDimensionalFixedPressure;
    }
This commit is contained in:
Will Bainbridge
2023-04-18 16:29:47 +01:00
parent 5c7131288c
commit 9cdd2a3e7a
25 changed files with 939 additions and 928 deletions

View File

@ -126,7 +126,13 @@ void Foam::solvers::compressibleMultiphaseVoF::pressureCorrector()
}
}
solve(p_rghEqnComp + p_rghEqnIncomp);
{
fvScalarMatrix p_rghEqn(p_rghEqnComp + p_rghEqnIncomp);
fvConstraints().constrain(p_rghEqn);
p_rghEqn.solve();
}
if (pimple.finalNonOrthogonalIter())
{

View File

@ -185,10 +185,16 @@ void Foam::solvers::compressibleVoF::pressureCorrector()
== Sp_rgh
);
solve
(
p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp
);
{
fvScalarMatrix p_rghEqn
(
p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp
);
fvConstraints().constrain(p_rghEqn);
p_rghEqn.solve();
}
if (pimple.finalNonOrthogonalIter())
{

View File

@ -159,6 +159,8 @@ void Foam::solvers::isothermalFluid::correctBuoyantPressure()
pressureReference.refValue()
);
fvConstraints().constrain(p_rghEqn);
p_rghEqn.solve();
}
}
@ -195,6 +197,8 @@ void Foam::solvers::isothermalFluid::correctBuoyantPressure()
pressureReference.refValue()
);
fvConstraints().constrain(p_rghEqn);
p_rghEqn.solve();
}
}

View File

@ -146,6 +146,8 @@ void Foam::solvers::isothermalFluid::correctPressure()
pressureReference.refValue()
);
fvConstraints().constrain(pEqn);
pEqn.solve();
if (pimple.finalNonOrthogonalIter())
@ -190,6 +192,8 @@ void Foam::solvers::isothermalFluid::correctPressure()
pressureReference.refValue()
);
fvConstraints().constrain(pEqn);
pEqn.solve();
if (pimple.finalNonOrthogonalIter())

View File

@ -330,6 +330,8 @@ void Foam::solvers::multiphaseEuler::cellPressureCorrector()
);
}
fvConstraints().constrain(pEqn);
pEqn.solve();
}

View File

@ -308,6 +308,8 @@ void Foam::solvers::multiphaseEuler::facePressureCorrector()
);
}
fvConstraints().constrain(pEqn);
pEqn.solve();
}

View File

@ -6,5 +6,7 @@ limitMag/limitMag.C
bound/boundConstraint.C
meanVelocityForce/meanVelocityForce.C
meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C
zeroDimensionalFixedPressure/zeroDimensionalFixedPressureConstraint.C
zeroDimensionalFixedPressure/zeroDimensionalFixedPressureModel.C
LIB = $(FOAM_LIBBIN)/libfvConstraints

View File

@ -0,0 +1,308 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "zeroDimensionalFixedPressureConstraint.H"
#include "zeroDimensionalFixedPressureModel.H"
#include "fvModels.H"
#include "fvMatrix.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(zeroDimensionalFixedPressureConstraint, 0);
addToRunTimeSelectionTable
(
fvConstraint,
zeroDimensionalFixedPressureConstraint,
dictionary
);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::fv::zeroDimensionalFixedPressureModel&
Foam::fv::zeroDimensionalFixedPressureConstraint::model() const
{
const fvModels& models = fvModels::New(mesh());
forAll(models, i)
{
if (isA<zeroDimensionalFixedPressureModel>(models[i]))
{
return refCast<const zeroDimensionalFixedPressureModel>
(
models[i]
);
}
}
FatalErrorInFunction
<< "The " << typeName << " fvConstraint requires a corresponding "
<< zeroDimensionalFixedPressureModel::typeName << " fvModel"
<< exit(FatalError);
return NullObjectRef<zeroDimensionalFixedPressureModel>();
}
template<class AlphaFieldType>
Foam::tmp<Foam::volScalarField::Internal>
Foam::fv::zeroDimensionalFixedPressureConstraint::massSource
(
const AlphaFieldType& alpha,
const volScalarField::Internal& rho
) const
{
// Source does not exist yet. Return zero.
if (!sourcePtr_.valid())
{
return
volScalarField::Internal::New
(
typedName("source"),
mesh(),
dimensionedScalar(dimMass/dimVolume/dimTime, 0)
);
}
// Source for mass-based pressure equations
if (sourcePtr_->dimensions() == dimMass/dimVolume/dimTime)
{
return alpha*sourcePtr_();
}
// Source for volume-based pressure equations
if (sourcePtr_->dimensions() == dimless/dimTime)
{
return alpha*rho*sourcePtr_();
}
FatalErrorInFunction
<< "Pressure equation dimensions not recognised"
<< exit(FatalError);
return tmp<volScalarField::Internal>(nullptr);
}
void Foam::fv::zeroDimensionalFixedPressureConstraint::readCoeffs()
{
pName_ = coeffs().lookupOrDefault<word>("p", "p");
rhoName_ = coeffs().lookupOrDefault<word>("rho", "rho");
p_.reset(Function1<scalar>::New("pressure", coeffs()).ptr());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::zeroDimensionalFixedPressureConstraint::
zeroDimensionalFixedPressureConstraint
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
fvConstraint(name, modelType, mesh, dict),
pName_(word::null),
rhoName_(word::null),
p_(nullptr),
sourcePtr_(nullptr)
{
if (mesh.nGeometricD() != 0)
{
FatalIOErrorInFunction(dict)
<< "Zero-dimensional fvConstraint applied to a "
<< mesh.nGeometricD() << "-dimensional mesh"
<< exit(FatalIOError);
}
readCoeffs();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::zeroDimensionalFixedPressureConstraint::
~zeroDimensionalFixedPressureConstraint()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList
Foam::fv::zeroDimensionalFixedPressureConstraint::constrainedFields() const
{
return wordList(1, pName_);
}
const Foam::volScalarField::Internal&
Foam::fv::zeroDimensionalFixedPressureConstraint::pEqnSource
(
fvMatrix<scalar>& pEqn
) const
{
// Ensure the corresponding fvModel exits
model();
// Construct the source if it does not yet exist
if (!sourcePtr_.valid())
{
sourcePtr_.set
(
new volScalarField::Internal
(
IOobject
(
typedName("source"),
mesh().time().timeName(),
mesh(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh(),
dimensionedScalar(pEqn.dimensions()/dimVolume, 0)
)
);
}
return sourcePtr_();
}
Foam::tmp<Foam::volScalarField::Internal>
Foam::fv::zeroDimensionalFixedPressureConstraint::massSource
(
const volScalarField::Internal& rho
) const
{
return massSource<geometricOneField>(geometricOneField(), rho);
}
Foam::tmp<Foam::volScalarField::Internal>
Foam::fv::zeroDimensionalFixedPressureConstraint::massSource
(
const volScalarField::Internal& alpha,
const volScalarField::Internal& rho
) const
{
return massSource<volScalarField::Internal>(alpha, rho);
}
bool Foam::fv::zeroDimensionalFixedPressureConstraint::constrain
(
fvMatrix<scalar>& pEqn,
const word& fieldName
) const
{
// Construct the source if it does not yet exist
pEqnSource(pEqn);
// Check the dimensions have not changed
sourcePtr_->dimensions() = pEqn.dimensions()/dimVolume;
// Remove the previous iteration's source from the pressure equation
pEqn += sourcePtr_();
// Set the source as the residual of the pressure equation when evaluated
// at the desired pressure
sourcePtr_() =
pEqn
& volScalarField::Internal::New
(
"p",
mesh(),
dimensionedScalar
(
dimPressure,
p_->value(mesh().time().userTimeValue())
)
);
// Add the source to the pressure equation to force the pressure towards
// the desired value
pEqn -= sourcePtr_();
return true;
}
bool Foam::fv::zeroDimensionalFixedPressureConstraint::movePoints()
{
return true;
}
void Foam::fv::zeroDimensionalFixedPressureConstraint::topoChange
(
const polyTopoChangeMap& map
)
{}
void Foam::fv::zeroDimensionalFixedPressureConstraint::mapMesh
(
const polyMeshMap& map
)
{}
void Foam::fv::zeroDimensionalFixedPressureConstraint::distribute
(
const polyDistributionMap& map
)
{}
bool Foam::fv::zeroDimensionalFixedPressureConstraint::read
(
const dictionary& dict
)
{
if (fvConstraint::read(dict))
{
readCoeffs();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,220 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::fv::zeroDimensionalFixedPressureConstraint
Description
Zero-dimensional fixed pressure constraint. Should be used in conjunction
with the zeroDimensionalFixedPressureModel.
This constraint and model facilitates specification of a constant or
time-varying pressure. It adds mass source terms proportional to the error
that remains when the pressure equation is evaluated at the desired
pressure. Iteration may be necessary to converge the constraint in the case
of non-linear equations of state.
Properties are added or removed with their current value. The model
therefore represents a uniform expansion or contraction in infinite space.
Usage
Example usage:
\verbatim
{
type zeroDimensionalFixedPressure;
// Name of the pressure field, default = p
//p p;
// Name of the density field, default = rho
//rho rho;
// Pressure value
pressure 1e5;
}
\endverbatim
\*---------------------------------------------------------------------------*/
#ifndef zeroDimensionalFixedPressureConstraint_H
#define zeroDimensionalFixedPressureConstraint_H
#include "fvConstraint.H"
#include "Function1.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
class zeroDimensionalFixedPressureModel;
/*---------------------------------------------------------------------------*\
Class zeroDimensionalFixedPressureConstraint Declaration
\*---------------------------------------------------------------------------*/
class zeroDimensionalFixedPressureConstraint
:
public fvConstraint
{
// Private data
//- Pressure field name, default = p
word pName_;
//- Density field name, default = rho
word rhoName_;
//- The pressure value
autoPtr<Function1<scalar>> p_;
//- The mass or volume source
mutable autoPtr<volScalarField::Internal> sourcePtr_;
// Private member functions
//- Access the corresponding model
const zeroDimensionalFixedPressureModel& model() const;
//- Get the mass source
template<class AlphaFieldType>
tmp<volScalarField::Internal> massSource
(
const AlphaFieldType& alpha,
const volScalarField::Internal& rho
) const;
//- Non-virtual read
void readCoeffs();
public:
//- Runtime type information
TypeName("zeroDimensionalFixedPressure");
// Constructors
//- Construct from dictionary
zeroDimensionalFixedPressureConstraint
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~zeroDimensionalFixedPressureConstraint();
// Member Functions
// Access
//- Pressure field name
inline const word& pName() const
{
return pName_;
}
//- Density field name
inline const word& rhoName() const
{
return rhoName_;
}
// Checks
//- Return the list of fields constrained by the fvConstraint
virtual wordList constrainedFields() const;
// Constraints
//- Return the mass or volume source for the pressure equation
const volScalarField::Internal& pEqnSource
(
fvMatrix<scalar>& pEqn
) const;
//- Return the mass source
tmp<volScalarField::Internal> massSource
(
const volScalarField::Internal& rho
) const;
//- Return the mass source for a given phase
tmp<volScalarField::Internal> massSource
(
const volScalarField::Internal& alpha,
const volScalarField::Internal& rho
) const;
//- Apply the constraint to the pressure equation
virtual bool constrain
(
fvMatrix<scalar>& pEqn,
const word& fieldName
) const;
// Mesh changes
//- Update for mesh motion
virtual bool movePoints();
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
//- Redistribute or update using the given distribution map
virtual void distribute(const polyDistributionMap&);
// IO
//- Read dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,292 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "zeroDimensionalFixedPressureModel.H"
#include "zeroDimensionalFixedPressureConstraint.H"
#include "fvConstraints.H"
#include "fvmSup.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(zeroDimensionalFixedPressureModel, 0);
addToRunTimeSelectionTable
(
fvModel,
zeroDimensionalFixedPressureModel,
dictionary
);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::fv::zeroDimensionalFixedPressureConstraint&
Foam::fv::zeroDimensionalFixedPressureModel::constraint() const
{
const fvConstraints& constraints = fvConstraints::New(mesh());
forAll(constraints, i)
{
if (isA<zeroDimensionalFixedPressureConstraint>(constraints[i]))
{
return refCast<const zeroDimensionalFixedPressureConstraint>
(
constraints[i]
);
}
}
FatalErrorInFunction
<< "The " << typeName << " fvModel requires a corresponding "
<< zeroDimensionalFixedPressureConstraint::typeName << " fvConstraint"
<< exit(FatalError);
return NullObjectRef<zeroDimensionalFixedPressureConstraint>();
}
template<class Type>
void Foam::fv::zeroDimensionalFixedPressureModel::addSupType
(
fvMatrix<Type>& eqn,
const word& fieldName
) const
{
FatalErrorInFunction
<< "Cannot add a fixed pressure source to field " << fieldName
<< " because this field's equation is not in mass-conservative form"
<< exit(FatalError);
}
void Foam::fv::zeroDimensionalFixedPressureModel::addSupType
(
fvMatrix<scalar>& eqn,
const word& fieldName
) const
{
if (IOobject::member(fieldName) == constraint().rhoName())
{
eqn += constraint().massSource(eqn.psi()());
}
else
{
addSupType<scalar>(eqn, fieldName); // error above
}
}
template<class Type>
void Foam::fv::zeroDimensionalFixedPressureModel::addSupType
(
const volScalarField& rho,
fvMatrix<Type>& eqn,
const word& fieldName
) const
{
eqn -= fvm::SuSp(-constraint().massSource(rho()), eqn.psi());
}
void Foam::fv::zeroDimensionalFixedPressureModel::addSupType
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const word& fieldName
) const
{
if (IOobject::member(fieldName) == constraint().rhoName())
{
if (IOobject::member(eqn.psi().name()) == constraint().pName())
{
eqn += constraint().pEqnSource(eqn);
}
else if (IOobject::member(eqn.psi().name()) == constraint().rhoName())
{
// Phase density equation. Argument names are misleading.
const volScalarField& alpha = rho;
const volScalarField& rho = eqn.psi();
eqn += constraint().massSource(alpha(), rho());
}
else
{
FatalErrorInFunction
<< "Cannot add source for density field " << fieldName
<< " into an equation for " << eqn.psi().name()
<< exit(FatalError);
}
}
else
{
addSupType<scalar>(rho, eqn, fieldName);
}
}
template<class Type>
void Foam::fv::zeroDimensionalFixedPressureModel::addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<Type>& eqn,
const word& fieldName
) const
{
eqn -= fvm::SuSp(-constraint().massSource(alpha(), rho()), eqn.psi());
}
void Foam::fv::zeroDimensionalFixedPressureModel::addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const word& fieldName
) const
{
if (IOobject::member(fieldName) == constraint().rhoName())
{
if (IOobject::member(eqn.psi().name()) == constraint().pName())
{
eqn += alpha*constraint().pEqnSource(eqn);
}
else if (IOobject::member(eqn.psi().name()) == constraint().rhoName())
{
FatalErrorInFunction
<< "Cannot add source for density field " << fieldName
<< " into a phase-conservative equation for "
<< eqn.psi().name() << exit(FatalError);
}
else
{
FatalErrorInFunction
<< "Cannot add source for density field " << fieldName
<< " into an equation for " << eqn.psi().name()
<< exit(FatalError);
}
}
else
{
addSupType<scalar>(alpha, rho, eqn, fieldName);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::zeroDimensionalFixedPressureModel::zeroDimensionalFixedPressureModel
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
fvModel(name, modelType, mesh, dict)
{
if (mesh.nGeometricD() != 0)
{
FatalIOErrorInFunction(dict)
<< "Zero-dimensional fvModel applied to a "
<< mesh.nGeometricD() << "-dimensional mesh"
<< exit(FatalIOError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::zeroDimensionalFixedPressureModel::
~zeroDimensionalFixedPressureModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::zeroDimensionalFixedPressureModel::addsSupToField
(
const word& fieldName
) const
{
return true;
}
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_SUP,
fv::zeroDimensionalFixedPressureModel
);
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_RHO_SUP,
fv::zeroDimensionalFixedPressureModel
);
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_SUP,
fv::zeroDimensionalFixedPressureModel
);
bool Foam::fv::zeroDimensionalFixedPressureModel::movePoints()
{
return true;
}
void Foam::fv::zeroDimensionalFixedPressureModel::topoChange
(
const polyTopoChangeMap& map
)
{}
void Foam::fv::zeroDimensionalFixedPressureModel::mapMesh
(
const polyMeshMap& map
)
{}
void Foam::fv::zeroDimensionalFixedPressureModel::distribute
(
const polyDistributionMap& map
)
{}
// ************************************************************************* //

View File

@ -22,17 +22,35 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fv::zeroDimensional::constraintSource
Foam::fv::zeroDimensionalFixedPressureModel
Description
Base class for zero-dimensional constraint sources.
Zero-dimensional fixed pressure source. Should be used in conjunction
with the zeroDimensionalFixedPressureConstraint.
This constraint and model facilitates specification of a constant or
time-varying pressure. It adds mass source terms proportional to the error
that remains when the pressure equation is evaluated at the desired
pressure. Iteration may be necessary to converge the constraint in the case
of non-linear equations of state.
Properties are added or removed with their current value. The model
therefore represents a uniform expansion or contraction in infinite space.
Usage
Example usage:
\verbatim
{
type zeroDimensionalFixedPressure;
}
\endverbatim
\*---------------------------------------------------------------------------*/
#ifndef constraintSource_H
#define constraintSource_H
#ifndef zeroDimensionalFixedPressureModel_H
#define zeroDimensionalFixedPressureModel_H
#include "zeroDimensionalFvModel.H"
#include "fvModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,23 +58,24 @@ namespace Foam
{
namespace fv
{
namespace zeroDimensional
{
class zeroDimensionalFixedPressureConstraint;
/*---------------------------------------------------------------------------*\
Class constraintSource Declaration
Class zeroDimensionalFixedPressureModel Declaration
\*---------------------------------------------------------------------------*/
class constraintSource
class zeroDimensionalFixedPressureModel
:
public zeroDimensionalFvModel
public fvModel
{
// Private member functions
// Sources
//- Access the corresponding constraint
const zeroDimensionalFixedPressureConstraint& constraint() const;
//- Return the mass source
virtual tmp<volScalarField::Internal> dmdt() const = 0;
// Sources
//- Add a source term to an equation
template<class Type>
@ -92,17 +111,26 @@ class constraintSource
const word& fieldName
) const;
//- Add a source term to a scalar phase equation
void addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const word& fieldName
) const;
public:
//- Runtime type information
TypeName("constraintSource");
TypeName("zeroDimensionalFixedPressure");
// Constructors
//- Construct from dictionary
constraintSource
zeroDimensionalFixedPressureModel
(
const word& name,
const word& modelType,
@ -112,7 +140,7 @@ public:
//- Destructor
virtual ~constraintSource();
virtual ~zeroDimensionalFixedPressureModel();
// Member Functions
@ -123,10 +151,6 @@ public:
// field's transport equation
virtual bool addsSupToField(const word& fieldName) const;
//- Return the list of fields for which the fvModel adds source term
// to the transport equation
virtual wordList addSupFields() const;
// Sources
@ -138,12 +162,26 @@ public:
//- Add a source term to a phase equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_ALPHA_RHO_SUP);
// Mesh changes
//- Update for mesh motion
virtual bool movePoints();
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
//- Redistribute or update using the given distribution map
virtual void distribute(const polyDistributionMap&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace zeroDimensional
} // End namespace fv
} // End namespace Foam

View File

@ -25,8 +25,8 @@ derived/volumeFractionSource/volumeFractionSource.C
derived/solidEquilibriumEnergySource/solidEquilibriumEnergySource.C
derived/massSource/massSource.C
derived/heatSource/heatSource.C
derived/heatTransfer/heatTransfer.C
derived/zeroDimensionalMassSource/zeroDimensionalMassSource.C
interRegion/interRegionModel/interRegionModel.C
interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C
@ -40,10 +40,4 @@ derived/heatTransfer/heatTransferCoefficientModels/function1/function1.C
derived/heatTransfer/heatTransferCoefficientModels/function2/function2.C
derived/heatTransfer/heatTransferCoefficientModels/variable/variable.C
zeroDimensional/zeroDimensionalFvModel/zeroDimensionalFvModel.C
zeroDimensional/constraintSource/constraintSource.C
zeroDimensional/densityConstraintSource/densityConstraintSource.C
zeroDimensional/pressureConstraintSource/pressureConstraintSource.C
zeroDimensional/zeroDimensionalMassSource/zeroDimensionalMassSource.C
LIB = $(FOAM_LIBBIN)/libfvModels

View File

@ -1,183 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "constraintSource.H"
#include "fluidThermo.H"
#include "fvModels.H"
#include "fvMatrix.H"
#include "fvmSup.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
namespace zeroDimensional
{
defineTypeNameAndDebug(constraintSource, 0);
}
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::fv::zeroDimensional::constraintSource::addSupType
(
fvMatrix<Type>& eqn,
const word& fieldName
) const
{
FatalErrorInFunction
<< "Cannot add a constraint source to field " << fieldName
<< " because this field's equation is not in mass-conservative form"
<< exit(FatalError);
}
void Foam::fv::zeroDimensional::constraintSource::addSupType
(
fvMatrix<scalar>& eqn,
const word& fieldName
) const
{
if (fieldName == "rho")
{
eqn += dmdt();
}
else
{
addSupType<scalar>(eqn, fieldName);
}
}
template<class Type>
void Foam::fv::zeroDimensional::constraintSource::addSupType
(
const volScalarField& rho,
fvMatrix<Type>& eqn,
const word& fieldName
) const
{
eqn -= fvm::SuSp(-dmdt(), eqn.psi());
}
void Foam::fv::zeroDimensional::constraintSource::addSupType
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const word& fieldName
) const
{
if (fieldName == "rho")
{
eqn += dmdt();
}
else
{
addSupType<scalar>(rho, eqn, fieldName);
}
}
template<class Type>
void Foam::fv::zeroDimensional::constraintSource::addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<Type>& eqn,
const word& fieldName
) const
{
FatalErrorInFunction
<< "Constraint sources do not support phase equations"
<< exit(FatalError);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::zeroDimensional::constraintSource::constraintSource
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
zeroDimensionalFvModel(name, modelType, mesh, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::zeroDimensional::constraintSource::~constraintSource()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::zeroDimensional::constraintSource::addsSupToField
(
const word& fieldName
) const
{
return true;
}
Foam::wordList Foam::fv::zeroDimensional::constraintSource::addSupFields() const
{
return wordList(1, "rho");
}
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_SUP,
fv::zeroDimensional::constraintSource
);
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_RHO_SUP,
fv::zeroDimensional::constraintSource
);
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_SUP,
fv::zeroDimensional::constraintSource
);
// ************************************************************************* //

View File

@ -1,112 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "densityConstraintSource.H"
#include "fluidThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
namespace zeroDimensional
{
defineTypeNameAndDebug(densityConstraintSource, 0);
addToRunTimeSelectionTable(fvModel, densityConstraintSource, dictionary);
}
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::fv::zeroDimensional::densityConstraintSource::readCoeffs()
{
rho_.reset(Function1<scalar>::New("rho", coeffs()).ptr());
}
Foam::tmp<Foam::volScalarField::Internal>
Foam::fv::zeroDimensional::densityConstraintSource::dmdt() const
{
const fluidThermo& thermo =
mesh().lookupObject<fluidThermo>(physicalProperties::typeName);
const scalar t = mesh().time().userTimeValue();
const dimensionedScalar& deltaT = mesh().time().deltaT();
const dimensionedScalar rhoTarget(dimPressure, rho_->value(t));
const volScalarField::Internal& rho = thermo.rho();
return (rhoTarget - rho)/deltaT;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::zeroDimensional::densityConstraintSource::densityConstraintSource
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
constraintSource(name, modelType, mesh, dict),
rho_(nullptr)
{
readCoeffs();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::zeroDimensional::densityConstraintSource::~densityConstraintSource()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::zeroDimensional::densityConstraintSource::read
(
const dictionary& dict
)
{
if (fvModel::read(dict))
{
readCoeffs();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,142 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::fv::zeroDimensional::densityConstraintSource
Description
Zero-dimensional density constraint source.
This model facilitates specification of a time-varying density (or,
equivalently, specific volume) be using a Function1. It adds or removes
mass appropriately to achieve the desired density.
Fluid properties are added or removed with their current value. This model
therefore represents a uniform expansion or contraction in an infinite
space.
Note that in the case of a constant density this model does not do
anything. A zero-dimension case naturally has both constant mass and
volume.
This only works for a compressible fluid.
Usage
Example usage:
\verbatim
{
type densityConstraintSource;
rho
{
type scale;
values
(
(0 1.16)
(1 1.16)
(1.1 2.02)
(10 2.02)
);
}
}
\endverbatim
\*---------------------------------------------------------------------------*/
#ifndef densityConstraintSource_H
#define densityConstraintSource_H
#include "constraintSource.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
namespace zeroDimensional
{
/*---------------------------------------------------------------------------*\
Class densityConstraintSource Declaration
\*---------------------------------------------------------------------------*/
class densityConstraintSource
:
public constraintSource
{
// Private data
//- The density value
autoPtr<Function1<scalar>> rho_;
// Private member functions
//- Non-virtual read
void readCoeffs();
//- Return the mass source
virtual tmp<volScalarField::Internal> dmdt() const;
public:
//- Runtime type information
TypeName("densityConstraintSource");
// Constructors
//- Construct from dictionary
densityConstraintSource
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~densityConstraintSource();
// Member Functions
//- Read dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace zeroDimensional
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,120 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "pressureConstraintSource.H"
#include "fluidThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
namespace zeroDimensional
{
defineTypeNameAndDebug(pressureConstraintSource, 0);
addToRunTimeSelectionTable(fvModel, pressureConstraintSource, dictionary);
}
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::fv::zeroDimensional::pressureConstraintSource::readCoeffs()
{
p_.reset(Function1<scalar>::New("p", coeffs()).ptr());
}
Foam::tmp<Foam::volScalarField::Internal>
Foam::fv::zeroDimensional::pressureConstraintSource::dmdt() const
{
const fluidThermo& thermo =
mesh().lookupObject<fluidThermo>(physicalProperties::typeName);
if (thermo.incompressible())
{
FatalErrorInFunction
<< "Cannot constrain the pressure of an incompressible fluid"
<< exit(FatalError);
}
const scalar t = mesh().time().userTimeValue();
const dimensionedScalar& deltaT = mesh().time().deltaT();
const dimensionedScalar pTarget(dimPressure, p_->value(t));
const volScalarField::Internal& p = thermo.p();
const volScalarField::Internal& psi = thermo.psi();
return (pTarget - p)*psi/deltaT;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::zeroDimensional::pressureConstraintSource::pressureConstraintSource
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
constraintSource(name, modelType, mesh, dict),
p_(nullptr)
{
readCoeffs();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::zeroDimensional::pressureConstraintSource::~pressureConstraintSource()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::zeroDimensional::pressureConstraintSource::read
(
const dictionary& dict
)
{
if (fvModel::read(dict))
{
readCoeffs();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,131 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::fv::zeroDimensional::pressureConstraintSource
Description
Zero-dimensional pressure constraint source.
This model facilitates specification of a constant or time-varying
pressure. It uses the fluids compressibility to determine the amount of
mass necessary to add or remove to achieve the desired pressure. Iteration
may be necessary to converge the constraint in the case of non-linear
equations of state.
Properties are added or removed with their current value. The model
therefore represents a uniform expansion or contraction in infinite space.
This only works for a compressible fluid. In the case of an incompressible
fluid, a standard fixed value fvConstraint should be used instead to bypass
solution of the pressure equation alltogether.
Usage
Example usage:
\verbatim
{
type pressureConstraintSource;
p 1e5;
}
\endverbatim
\*---------------------------------------------------------------------------*/
#ifndef pressureConstraintSource_H
#define pressureConstraintSource_H
#include "constraintSource.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
namespace zeroDimensional
{
/*---------------------------------------------------------------------------*\
Class pressureConstraintSource Declaration
\*---------------------------------------------------------------------------*/
class pressureConstraintSource
:
public constraintSource
{
// Private data
//- The pressure value
autoPtr<Function1<scalar>> p_;
// Private member functions
//- Non-virtual read
void readCoeffs();
//- Return the mass source
tmp<volScalarField::Internal> dmdt() const;
public:
//- Runtime type information
TypeName("pressureConstraintSource");
// Constructors
//- Construct from dictionary
pressureConstraintSource
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~pressureConstraintSource();
// Member Functions
//- Read dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace zeroDimensional
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,101 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "zeroDimensionalFvModel.H"
#include "fluidThermo.H"
#include "fvModels.H"
#include "fvMatrix.H"
#include "fvmSup.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(zeroDimensionalFvModel, 0);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::zeroDimensionalFvModel::zeroDimensionalFvModel
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
fvModel(name, modelType, mesh, dict)
{
if (mesh.nGeometricD() != 0)
{
FatalIOErrorInFunction(dict)
<< "Zero-dimensional fvModel applied to a "
<< mesh.nGeometricD() << "-dimensional mesh"
<< exit(FatalIOError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::zeroDimensionalFvModel::~zeroDimensionalFvModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::zeroDimensionalFvModel::movePoints()
{
return true;
}
void Foam::fv::zeroDimensionalFvModel::topoChange
(
const polyTopoChangeMap& map
)
{}
void Foam::fv::zeroDimensionalFvModel::mapMesh
(
const polyMeshMap& map
)
{}
void Foam::fv::zeroDimensionalFvModel::distribute
(
const polyDistributionMap& map
)
{}
// ************************************************************************* //

View File

@ -1,101 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::fv::zeroDimensionalFvModel
Description
Base class for zero-dimensional fvModels.
\*---------------------------------------------------------------------------*/
#ifndef zeroDimensionalFvModel_H
#define zeroDimensionalFvModel_H
#include "fvModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
/*---------------------------------------------------------------------------*\
Class zeroDimensionalFvModel Declaration
\*---------------------------------------------------------------------------*/
class zeroDimensionalFvModel
:
public fvModel
{
public:
//- Runtime type information
TypeName("zeroDimensionalFvModel");
// Constructors
//- Construct from dictionary
zeroDimensionalFvModel
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~zeroDimensionalFvModel();
// Member Functions
// Mesh changes
//- Update for mesh motion
virtual bool movePoints();
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
//- Redistribute or update using the given distribution map
virtual void distribute(const polyDistributionMap&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -16,7 +16,7 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 5.06625e+06;
internalField uniform 5.06625e6;
boundaryField {}

View File

@ -14,10 +14,9 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
pressureConstraintSource1
zeroDimensionalFixedPressure1
{
type pressureConstraintSource;
p 1.36789e6;
type zeroDimensionalFixedPressure;
}
//************************************************************************* //

View File

@ -0,0 +1,24 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object fvConstraints;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
zeroDimensionalFixedPressure1
{
type zeroDimensionalFixedPressure;
pressure 5.06625e6;
}
// ************************************************************************* //

View File

@ -47,7 +47,7 @@ solvers
PIMPLE
{
nOuterCorrectors 1;
nCorrectors 2;
nCorrectors 1;
nNonOrthogonalCorrectors 0;
}