fvOptions: Added volumeFractionSource and solidEquilibriumEnergySource
The volumeFractionSource represents the effect of a reduction in the
volume of the domain due to the presence of a stationary phase, most
likely a solid porous media. It only represents the dynamic effects
associated with the reduction in volume; it does not does not model
loss, drag or heat transfer. Separate models (e.g., the existing
porosity models) will be necessary to represent these effects. An
example usage, in system/fvOptions, is as follows:
volumeFraction
{
type volumeFractionSource;
phase solid;
phi phi;
rho rho;
U U;
fields (rho U e);
}
The volume fraction will be read from constant/alpha.<phase>, and must
be generated in advance using setFields or a function object. Note that
the names of the flux, density (if compressible) and velocity must all
be specified. Every field for which a transport equation is solved
should also be specified in the "fields" entry.
The solidEquilibriumEnergySource adds the thermal inertia and diffusive
characteristics of a stationary solid phase to the energy equation of
the fluid, assuming that the two phases are in thermal equilibrium. An
example usage is as follows:
solidEqulibriumEnergy
{
type solidEqulibriumEnergySource;
phase solid;
field e;
}
This will read the volume fraction in the same way as the
volumeFractionSource option. In addition, thermal properties of the
solid will be constructed from settings in
system/thermophysicalProperties.<phase>.
Two tutorials have been added, demonstrating use of these options in
both incompressible and compressible simulations. These are
incompressible/pimpleFoam/laminar/blockedChannel and
compressible/rhoPimpleFoam/laminar/blockedChannel.
This commit is contained in:
@ -40,6 +40,8 @@ $(derivedSources)/buoyancyEnergy/buoyancyEnergyIO.C
|
||||
$(derivedSources)/verticalDamping/verticalDamping.C
|
||||
$(derivedSources)/phaseLimitStabilization/phaseLimitStabilization.C
|
||||
$(derivedSources)/accelerationSource/accelerationSource.C
|
||||
$(derivedSources)/volumeFractionSource/volumeFractionSource.C
|
||||
$(derivedSources)/solidEqulibriumEnergySource/solidEqulibriumEnergySource.C
|
||||
|
||||
interRegion = sources/interRegion
|
||||
$(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C
|
||||
|
||||
@ -0,0 +1,184 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019 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 "solidEqulibriumEnergySource.H"
|
||||
#include "fvmDdt.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fv
|
||||
{
|
||||
defineTypeNameAndDebug(solidEqulibriumEnergySource, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
option,
|
||||
solidEqulibriumEnergySource,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
const Foam::volScalarField& Foam::fv::solidEqulibriumEnergySource::alpha() const
|
||||
{
|
||||
const word alphaName = IOobject::groupName("alpha", phaseName_);
|
||||
|
||||
if (!mesh_.foundObject<volScalarField>(alphaName))
|
||||
{
|
||||
volScalarField* alphaPtr =
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
alphaName,
|
||||
mesh_.time().constant(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_
|
||||
);
|
||||
|
||||
alphaPtr->store();
|
||||
}
|
||||
|
||||
return mesh_.lookupObject<volScalarField>(alphaName);
|
||||
}
|
||||
|
||||
|
||||
const Foam::solidThermo& Foam::fv::solidEqulibriumEnergySource::thermo() const
|
||||
{
|
||||
const word thermoName =
|
||||
IOobject::groupName(basicThermo::dictName, phaseName_);
|
||||
|
||||
if (!mesh_.foundObject<solidThermo>(thermoName))
|
||||
{
|
||||
solidThermo* thermoPtr = solidThermo::New(mesh_, phaseName_).ptr();
|
||||
|
||||
thermoPtr->store();
|
||||
}
|
||||
|
||||
return mesh_.lookupObject<solidThermo>(thermoName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fv::solidEqulibriumEnergySource::solidEqulibriumEnergySource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
option(name, modelType, dict, mesh),
|
||||
phaseName_(dict.lookupType<word>("phase"))
|
||||
{
|
||||
read(dict);
|
||||
alpha();
|
||||
thermo();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fv::solidEqulibriumEnergySource::~solidEqulibriumEnergySource()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fv::solidEqulibriumEnergySource::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<scalar>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
const volScalarField alphahe(thermo().alphahe());
|
||||
|
||||
const volScalarField& A = this->alpha();
|
||||
const volScalarField B(1 - A);
|
||||
|
||||
eqn -=
|
||||
A/B*fvm::ddt(thermo().rho(), eqn.psi());
|
||||
- 1/B*fvm::laplacian
|
||||
(
|
||||
A*alphahe,
|
||||
eqn.psi(),
|
||||
"laplacian(" + alphahe.name() + "," + eqn.psi().name() + ")"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::solidEqulibriumEnergySource::addSup
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
fvMatrix<scalar>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
const volScalarField alphahe(alpha*thermo().alphahe());
|
||||
|
||||
const volScalarField& A = this->alpha();
|
||||
const volScalarField B(1 - A);
|
||||
|
||||
eqn -=
|
||||
A/B*fvm::ddt(alpha, thermo().rho(), eqn.psi());
|
||||
- 1/B*fvm::laplacian
|
||||
(
|
||||
A*alphahe,
|
||||
eqn.psi(),
|
||||
"laplacian(" + alphahe.name() + "," + eqn.psi().name() + ")"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::solidEqulibriumEnergySource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
{
|
||||
fieldNames_ = wordList(1, coeffs_.lookupType<word>("field"));
|
||||
|
||||
applied_.setSize(fieldNames_.size(), false);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,161 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019 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::solidEqulibriumEnergySource
|
||||
|
||||
Description
|
||||
This option adds the thermal inertia of a solid phase into the energy
|
||||
equation. It assumes that the solid is in thermal equilibrium with the
|
||||
surrounding fluid phase.
|
||||
|
||||
The volume fraction of the solid phase is read from constant/alpha.<phase>,
|
||||
and the associated thermophysical properties are specified in
|
||||
constant/thermophysicalProperties.<phase>.
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Req'd? | Default
|
||||
phase | Name of the solid phase | yes |
|
||||
field | Name of the energy field to apply the option to \\
|
||||
| yes |
|
||||
\endtable
|
||||
|
||||
Example specification:
|
||||
\verbatim
|
||||
<fvOptionName>
|
||||
{
|
||||
type solidEqulibriumEnergySource;
|
||||
phase solid;
|
||||
field e;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef solidEqulibriumEnergySource_H
|
||||
#define solidEqulibriumEnergySource_H
|
||||
|
||||
#include "fvOption.H"
|
||||
#include "volFields.H"
|
||||
#include "solidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fv
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class solidEqulibriumEnergySource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class solidEqulibriumEnergySource
|
||||
:
|
||||
public option
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Data
|
||||
|
||||
//- The name of the phase
|
||||
const word phaseName_;
|
||||
|
||||
//- Get the volume fraction field
|
||||
const volScalarField& alpha() const;
|
||||
|
||||
//- Get the thermo
|
||||
const solidThermo& thermo() const;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
solidEqulibriumEnergySource(const solidEqulibriumEnergySource&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const solidEqulibriumEnergySource&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("solidEqulibriumEnergySource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
solidEqulibriumEnergySource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~solidEqulibriumEnergySource();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Explicit and implicit sources for compressible equations
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
fvMatrix<scalar>&,
|
||||
const label
|
||||
);
|
||||
|
||||
//- Explicit and implicit sources for phase equations
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
const volScalarField&,
|
||||
fvMatrix<scalar>&,
|
||||
const label
|
||||
);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fv
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,467 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019 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 "volumeFractionSource.H"
|
||||
#include "fvmDdt.H"
|
||||
#include "fvmDiv.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fv
|
||||
{
|
||||
defineTypeNameAndDebug(volumeFractionSource, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
option,
|
||||
volumeFractionSource,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
const Foam::volScalarField& Foam::fv::volumeFractionSource::alpha() const
|
||||
{
|
||||
const word alphaName = IOobject::groupName("alpha", phaseName_);
|
||||
|
||||
if (!mesh_.foundObject<volScalarField>(alphaName))
|
||||
{
|
||||
volScalarField* alphaPtr =
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
alphaName,
|
||||
mesh_.time().constant(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_
|
||||
);
|
||||
|
||||
alphaPtr->store();
|
||||
}
|
||||
|
||||
return mesh_.lookupObject<volScalarField>(alphaName);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::fv::volumeFractionSource::D
|
||||
(
|
||||
const label fieldi
|
||||
) const
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
mesh().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
const turbulenceModel& turbulence =
|
||||
mesh().lookupObject<turbulenceModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
return turbulence.nuEff();
|
||||
}
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const compressible::turbulenceModel& turbulence =
|
||||
mesh().lookupObject<compressible::turbulenceModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
return
|
||||
fieldNames_[fieldi] == turbulence.transport().T().name()
|
||||
? turbulence.kappaEff()
|
||||
: fieldNames_[fieldi] == turbulence.transport().he().name()
|
||||
? turbulence.alphaEff()
|
||||
: turbulence.muEff();
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Dimensions of " << phi.name() << " not recognised"
|
||||
<< exit(FatalError);
|
||||
return tmp<volScalarField>(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
void Foam::fv::volumeFractionSource::addDivSup
|
||||
(
|
||||
fvMatrix<Type>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
mesh().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
const volScalarField AByB(this->alpha()/(1 - this->alpha()));
|
||||
|
||||
eqn -= AByB*fvm::div(phi, eqn.psi());
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addUDivSup
|
||||
(
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
mesh().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
const volScalarField AByB(this->alpha()/(1 - this->alpha()));
|
||||
|
||||
const word scheme("div(" + phiName_ + "," + eqn.psi().name() + ")");
|
||||
|
||||
eqn -= fvm::div(fvc::interpolate(AByB)*phi, eqn.psi(), scheme);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addRhoDivSup
|
||||
(
|
||||
fvMatrix<scalar>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
mesh().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
const volScalarField AByB(this->alpha()/(1 - this->alpha()));
|
||||
|
||||
eqn -= AByB*fvc::div(phi);
|
||||
}
|
||||
|
||||
|
||||
template <class Type, class AlphaFieldType>
|
||||
void Foam::fv::volumeFractionSource::addLaplacianSup
|
||||
(
|
||||
const AlphaFieldType& alpha,
|
||||
fvMatrix<Type>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
const volScalarField B(1 - this->alpha());
|
||||
|
||||
const volScalarField D(this->D(fieldi));
|
||||
|
||||
const word scheme("laplacian(" + D.name() + "," + eqn.psi().name() + ")");
|
||||
|
||||
eqn +=
|
||||
fvm::laplacian(D, eqn.psi())
|
||||
- 1/B*fvm::laplacian(B*D, eqn.psi(), scheme);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fv::volumeFractionSource::volumeFractionSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
option(name, modelType, dict, mesh),
|
||||
phaseName_(dict.lookupType<word>("phase")),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
UName_("U")
|
||||
{
|
||||
read(dict);
|
||||
alpha();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fv::volumeFractionSource::~volumeFractionSource()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
fvMatrix<scalar>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
if (fieldNames_[fieldi] == rhoName_)
|
||||
{
|
||||
addRhoDivSup(eqn, fieldi);
|
||||
}
|
||||
else
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
if (fieldNames_[fieldi] == UName_)
|
||||
{
|
||||
addUDivSup(eqn, fieldi);
|
||||
}
|
||||
else
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
fvMatrix<sphericalTensor>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
fvMatrix<symmTensor>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
fvMatrix<tensor>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<scalar>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
if (fieldNames_[fieldi] == rhoName_)
|
||||
{
|
||||
addRhoDivSup(eqn, fieldi);
|
||||
}
|
||||
else
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
if (fieldNames_[fieldi] == UName_)
|
||||
{
|
||||
addUDivSup(eqn, fieldi);
|
||||
}
|
||||
else
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<sphericalTensor>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<symmTensor>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<tensor>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(geometricOneField(), eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
fvMatrix<scalar>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
if (fieldNames_[fieldi] == rhoName_)
|
||||
{
|
||||
addRhoDivSup(eqn, fieldi);
|
||||
}
|
||||
else
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(alpha, eqn, fieldi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
if (fieldNames_[fieldi] == UName_)
|
||||
{
|
||||
addUDivSup(eqn, fieldi);
|
||||
}
|
||||
else
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(alpha, eqn, fieldi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
fvMatrix<sphericalTensor>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(alpha, eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
fvMatrix<symmTensor>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(alpha, eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::volumeFractionSource::addSup
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
fvMatrix<tensor>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
{
|
||||
addDivSup(eqn, fieldi);
|
||||
addLaplacianSup(alpha, eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::volumeFractionSource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
{
|
||||
if (coeffs_.found("fields"))
|
||||
{
|
||||
coeffs_.lookup("fields") >> fieldNames_;
|
||||
}
|
||||
|
||||
applied_.setSize(fieldNames_.size(), false);
|
||||
|
||||
dict.readIfPresent("phi", phiName_);
|
||||
|
||||
dict.readIfPresent("rho", rhoName_);
|
||||
|
||||
dict.readIfPresent("U", UName_);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,297 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019 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::volumeFractionSource
|
||||
|
||||
Description
|
||||
This option adds transport terms into the equations to account for the
|
||||
presence of a constant volume fraction. The volume fraction is read from
|
||||
constant/alpha.<phase>, where <phase> is given as a parameter to the
|
||||
option. Both advective and diffusive terms are added, and the resulting
|
||||
solution is time-accurate. The flux and velocity are treated as
|
||||
superficial.
|
||||
|
||||
This can be used to represent the effect of porous media that are caused
|
||||
purely by the reduction in volume of the fluid phase; i.e., additional
|
||||
blockage, and changes to transport and diffusion rates. It does not
|
||||
represent losses or transfers with the porous media. That requires separate
|
||||
sub-modelling.
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Req'd? | Default
|
||||
phase | Name of the phase associated with the volume fraction \\
|
||||
| yes |
|
||||
phi | Name of the flux field | no | phi
|
||||
rho | Name of the density field | no | rho
|
||||
U | Name of the velocity field | no | U
|
||||
fields | Names of the fields to apply the option to \\
|
||||
| yes |
|
||||
\endtable
|
||||
|
||||
Example specification:
|
||||
\verbatim
|
||||
<fvOptionName>
|
||||
{
|
||||
type volumeFractionSource;
|
||||
phase solid;
|
||||
phi phi;
|
||||
rho rho;
|
||||
U U;
|
||||
fields (rho U e);
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
volumeFractionSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef volumeFractionSource_H
|
||||
#define volumeFractionSource_H
|
||||
|
||||
#include "fvOption.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fv
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class volumeFractionSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class volumeFractionSource
|
||||
:
|
||||
public option
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Data
|
||||
|
||||
//- The name of the phase
|
||||
const word phaseName_;
|
||||
|
||||
//- The name of the flux field
|
||||
word phiName_;
|
||||
|
||||
//- The name of the density field
|
||||
word rhoName_;
|
||||
|
||||
//- The name of the velocity field
|
||||
word UName_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Get the volume fraction field
|
||||
const volScalarField& alpha() const;
|
||||
|
||||
//- Get the diffusivity for a given field
|
||||
tmp<volScalarField> D(const label) const;
|
||||
|
||||
//- Add time-derivative terms to an equation
|
||||
template <class Type>
|
||||
void addDdtSup(fvMatrix<Type>&, const label);
|
||||
|
||||
//- Add time-derivative terms to a compressible equation
|
||||
template <class Type>
|
||||
void addDdtSup(const volScalarField&, fvMatrix<Type>&, const label);
|
||||
|
||||
//- Add time-derivative terms to a phase-compressible equation
|
||||
template <class Type>
|
||||
void addDdtSup
|
||||
(
|
||||
const volScalarField&,
|
||||
const volScalarField&,
|
||||
fvMatrix<Type>&,
|
||||
const label
|
||||
);
|
||||
|
||||
//- Add divergence terms to an equation
|
||||
template <class Type>
|
||||
void addDivSup(fvMatrix<Type>&, const label);
|
||||
|
||||
//- Add divergence terms to the momentum equation
|
||||
void addUDivSup(fvMatrix<vector>&, const label);
|
||||
|
||||
//- Add divergence terms to the continuity equation
|
||||
void addRhoDivSup(fvMatrix<scalar>&, const label);
|
||||
|
||||
//- Add Laplacian terms to an equation
|
||||
template <class Type, class AlphaFieldType>
|
||||
void addLaplacianSup
|
||||
(
|
||||
const AlphaFieldType& alpha,
|
||||
fvMatrix<Type>& eqn,
|
||||
const label fieldi
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
volumeFractionSource(const volumeFractionSource&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const volumeFractionSource&);
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("volumeFractionSource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
volumeFractionSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~volumeFractionSource();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Evaluation
|
||||
|
||||
// Explicit and implicit sources
|
||||
|
||||
virtual void addSup(fvMatrix<scalar>&, const label);
|
||||
|
||||
virtual void addSup(fvMatrix<vector>&, const label);
|
||||
|
||||
virtual void addSup(fvMatrix<symmTensor>&, const label);
|
||||
|
||||
virtual void addSup(fvMatrix<sphericalTensor>&, const label);
|
||||
|
||||
virtual void addSup(fvMatrix<tensor>&, const label);
|
||||
|
||||
|
||||
// Explicit and implicit sources for compressible equations
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
fvMatrix<scalar>&,
|
||||
const label
|
||||
);
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
fvMatrix<vector>&,
|
||||
const label
|
||||
);
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
fvMatrix<symmTensor>&,
|
||||
const label
|
||||
);
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
fvMatrix<sphericalTensor>&,
|
||||
const label
|
||||
);
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
fvMatrix<tensor>&,
|
||||
const label
|
||||
);
|
||||
|
||||
|
||||
// Explicit and implicit sources for phase equations
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
const volScalarField&,
|
||||
fvMatrix<scalar>&,
|
||||
const label
|
||||
);
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
const volScalarField&,
|
||||
fvMatrix<vector>&,
|
||||
const label
|
||||
);
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
const volScalarField&,
|
||||
fvMatrix<symmTensor>&,
|
||||
const label
|
||||
);
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
const volScalarField&,
|
||||
fvMatrix<sphericalTensor>&,
|
||||
const label
|
||||
);
|
||||
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField&,
|
||||
const volScalarField&,
|
||||
fvMatrix<tensor>&,
|
||||
const label
|
||||
);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fv
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user