transportModel: remove IOdictionary base-class so that it is entirely abstract

This commit is contained in:
Henry
2013-07-07 22:54:33 +01:00
parent bdfabee363
commit 72ea7b4680
23 changed files with 287 additions and 50 deletions

View File

@ -112,7 +112,13 @@ public:
tmp<volScalarField> nu() const
{
return thermo_->mu()/thermo_->rho();
return thermo_->nu();
}
//- Return the laminar viscosity for patch
tmp<scalarField> nu(const label patchi) const
{
return thermo_->nu(patchi);
}
tmp<volScalarField> kappa() const

View File

@ -50,6 +50,18 @@ Foam::threePhaseMixture::threePhaseMixture
const surfaceScalarField& phi
)
:
IOdictionary
(
IOobject
(
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
transportModel(U, phi),
phase1Name_("phase1"),

View File

@ -35,6 +35,7 @@ SourceFiles
#define threePhaseMixture_H
#include "incompressible/transportModel/transportModel.H"
#include "IOdictionary.H"
#include "incompressible/viscosityModels/viscosityModel/viscosityModel.H"
#include "dimensionedScalar.H"
#include "volFields.H"
@ -50,6 +51,7 @@ namespace Foam
class threePhaseMixture
:
public IOdictionary,
public transportModel
{
// Private data
@ -176,6 +178,12 @@ public:
return nu_;
}
//- Return the laminar viscosity for patch
tmp<scalarField> nu(const label patchi) const
{
return nu_.boundaryField()[patchi];
}
//- Return the face-interpolated dynamic laminar viscosity
tmp<surfaceScalarField> nuf() const;

View File

@ -371,6 +371,18 @@ Foam::multiphaseSystem::multiphaseSystem
const surfaceScalarField& phi
)
:
IOdictionary
(
IOobject
(
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
transportModel(U, phi),
phases_(lookup("phases"), phaseModel::iNew(U.mesh())),
@ -482,18 +494,54 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::rho() const
}
Foam::tmp<Foam::scalarField>
Foam::multiphaseSystem::rho(const label patchi) const
{
PtrDictionary<phaseModel>::const_iterator iter = phases_.begin();
tmp<scalarField> trho = iter().boundaryField()[patchi]*iter().rho().value();
for (++iter; iter != phases_.end(); ++iter)
{
trho() += iter().boundaryField()[patchi]*iter().rho().value();
}
return trho;
}
Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::nu() const
{
PtrDictionary<phaseModel>::const_iterator iter = phases_.begin();
tmp<volScalarField> tnu = iter()*iter().nu();
tmp<volScalarField> tmu = iter()*(iter().rho()*iter().nu());
for (++iter; iter != phases_.end(); ++iter)
{
tnu() += iter()*iter().nu();
tmu() += iter()*(iter().rho()*iter().nu());
}
return tnu;
return tmu/rho();
}
Foam::tmp<Foam::scalarField>
Foam::multiphaseSystem::nu(const label patchi) const
{
PtrDictionary<phaseModel>::const_iterator iter = phases_.begin();
tmp<scalarField> tmu =
iter().boundaryField()[patchi]
*(iter().rho().value()*iter().nu().value());
for (++iter; iter != phases_.end(); ++iter)
{
tmu() +=
iter().boundaryField()[patchi]
*(iter().rho().value()*iter().nu().value());
}
return tmu/rho(patchi);
}

View File

@ -43,6 +43,7 @@ SourceFiles
#define multiphaseSystem_H
#include "incompressible/transportModel/transportModel.H"
#include "IOdictionary.H"
#include "phaseModel.H"
#include "PtrDictionary.H"
#include "volFields.H"
@ -61,6 +62,7 @@ namespace Foam
class multiphaseSystem
:
public IOdictionary,
public transportModel
{
@ -255,9 +257,15 @@ public:
//- Return the mixture density
tmp<volScalarField> rho() const;
//- Return the mixture density for patch
tmp<scalarField> rho(const label patchi) const;
//- Return the mixture laminar viscosity
tmp<volScalarField> nu() const;
//- Return the laminar viscosity for patch
tmp<scalarField> nu(const label patchi) const;
//- Return the virtual-mass coefficient for the given phase
tmp<volScalarField> Cvm(const phaseModel& phase) const;

View File

@ -65,6 +65,18 @@ Foam::multiphaseMixture::multiphaseMixture
const surfaceScalarField& phi
)
:
IOdictionary
(
IOobject
(
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
transportModel(U, phi),
phases_(lookup("phases"), phase::iNew(U, phi)),
@ -116,7 +128,8 @@ Foam::multiphaseMixture::multiphaseMixture
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::rho() const
Foam::tmp<Foam::volScalarField>
Foam::multiphaseMixture::rho() const
{
PtrDictionary<phase>::const_iterator iter = phases_.begin();
@ -131,7 +144,24 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::rho() const
}
Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::mu() const
Foam::tmp<Foam::scalarField>
Foam::multiphaseMixture::rho(const label patchi) const
{
PtrDictionary<phase>::const_iterator iter = phases_.begin();
tmp<scalarField> trho = iter().boundaryField()[patchi]*iter().rho().value();
for (++iter; iter != phases_.end(); ++iter)
{
trho() += iter().boundaryField()[patchi]*iter().rho().value();
}
return trho;
}
Foam::tmp<Foam::volScalarField>
Foam::multiphaseMixture::mu() const
{
PtrDictionary<phase>::const_iterator iter = phases_.begin();
@ -146,7 +176,30 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::mu() const
}
Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseMixture::muf() const
Foam::tmp<Foam::scalarField>
Foam::multiphaseMixture::mu(const label patchi) const
{
PtrDictionary<phase>::const_iterator iter = phases_.begin();
tmp<scalarField> tmu =
iter().boundaryField()[patchi]
*iter().rho().value()
*iter().nu(patchi);
for (++iter; iter != phases_.end(); ++iter)
{
tmu() +=
iter().boundaryField()[patchi]
*iter().rho().value()
*iter().nu(patchi);
}
return tmu;
}
Foam::tmp<Foam::surfaceScalarField>
Foam::multiphaseMixture::muf() const
{
PtrDictionary<phase>::const_iterator iter = phases_.begin();
@ -163,13 +216,22 @@ Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseMixture::muf() const
}
Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::nu() const
Foam::tmp<Foam::volScalarField>
Foam::multiphaseMixture::nu() const
{
return mu()/rho();
}
Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseMixture::nuf() const
Foam::tmp<Foam::scalarField>
Foam::multiphaseMixture::nu(const label patchi) const
{
return mu(patchi)/rho(patchi);
}
Foam::tmp<Foam::surfaceScalarField>
Foam::multiphaseMixture::nuf() const
{
return muf()/fvc::interpolate(rho());
}

View File

@ -43,12 +43,12 @@ SourceFiles
#define multiphaseMixture_H
#include "incompressible/transportModel/transportModel.H"
#include "IOdictionary.H"
#include "phase.H"
#include "PtrDictionary.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -60,6 +60,7 @@ namespace Foam
class multiphaseMixture
:
public IOdictionary,
public transportModel
{
public:
@ -229,15 +230,24 @@ public:
//- Return the mixture density
tmp<volScalarField> rho() const;
//- Return the mixture density for patch
tmp<scalarField> rho(const label patchi) const;
//- Return the dynamic laminar viscosity
tmp<volScalarField> mu() const;
//- Return the dynamic laminar viscosity for patch
tmp<scalarField> mu(const label patchi) const;
//- Return the face-interpolated dynamic laminar viscosity
tmp<surfaceScalarField> muf() const;
//- Return the kinematic laminar viscosity
tmp<volScalarField> nu() const;
//- Return the laminar viscosity for patch
tmp<scalarField> nu(const label patchi) const;
//- Return the face-interpolated dynamic laminar viscosity
tmp<surfaceScalarField> nuf() const;

View File

@ -129,6 +129,12 @@ public:
return nuModel_->nu();
}
//- Return the laminar viscosity for patch
tmp<scalarField> nu(const label patchi) const
{
return nuModel_->nu(patchi);
}
//- Return const-access to phase1 density
const dimensionedScalar& rho() const
{