Commit f6dce11a authored by Mark Olesen's avatar Mark Olesen

STYLE: use predefined dimension-sets in more places

- in many places just have a dimensioned Zero value, which can be
  written compactly.
  Eg,
      dimensionedScalar(dimVelocity) is the same as
      dimensionedScalar("0", dimVelocity, Zero)
parent 01cbbdef
......@@ -65,7 +65,6 @@ Foam::entrainmentModels::IsslerFC::IsslerFC
gn_(Us.db().lookupObject<areaScalarField>("gn"))
{
Info << " " << tauc_ << endl << endl;
}
......@@ -74,6 +73,8 @@ Foam::entrainmentModels::IsslerFC::IsslerFC
const Foam::areaScalarField &Foam::entrainmentModels::IsslerFC::Sm() const
{
const dimensionedScalar smallVel("small", dimVelocity, SMALL);
const areaScalarField u(mag(Us_));
const areaScalarField gs(mag(gs_));
const areaScalarField gamma_c(5./2.*u/h_);
......@@ -88,10 +89,10 @@ const Foam::areaScalarField &Foam::entrainmentModels::IsslerFC::Sm() const
const areaScalarField weinf
(
(h_*(gs+mu_*gn_)+4*K_*pow(gamma_c,2))
/ (h_*gamma_c+dimensionedScalar("small", dimVelocity, SMALL))
/ (h_*gamma_c+smallVel)
);
Sm_ = pos(u-uthr)*weinf*(1-uthr/(u+dimensionedScalar("small", dimVelocity, SMALL)));
Sm_ = pos(u-uthr)*weinf*(1-uthr/(u+smallVel));
const areaScalarField hlimit(h_*mag(gs_)-(tauc_-5*K_*gamma_c*gamma_c));
const areaScalarField hlimit2(h_-dimensionedScalar("small", dimLength, 1e-2));
......
......@@ -63,9 +63,8 @@ Foam::entrainmentModels::Medina::Medina
gs_(Us_.db().lookupObject<areaVectorField>("gs")),
gn_(Us_.db().lookupObject<areaScalarField>("gn"))
{
Info << " " << tauc_ << endl
<< " " << mu_ << endl << endl;
Info << " " << tauc_ << nl
<< " " << mu_ << nl << endl;
}
......@@ -80,7 +79,7 @@ const Foam::areaScalarField &Foam::entrainmentModels::Medina::Sm() const
areaScalarField hent(eflag*(mag(tau_) - taures)/(rho_*(gn_*mu_-mag(gs_))));
Sm_ = hent/Us_.db().time().deltaT();
Sm_ = max(Sm_, dimensionedScalar("0", dimVelocity, 0.));
Sm_ = max(Sm_, dimensionedScalar(dimVelocity));
Sm_ = min(Sm_, hentrain_/Us_.db().time().deltaT());
return Sm_;
......
......@@ -62,9 +62,8 @@ Foam::depositionModels::Stopingprofile::Stopingprofile
gs_(Us.db().lookupObject<areaVectorField>("gs")),
gn_(Us.db().lookupObject<areaScalarField>("gn"))
{
Info << " " << ud_ << endl
<< " " << ad_ << endl << endl;
Info << " " << ud_ << nl
<< " " << ad_ << nl << endl;
}
......@@ -74,7 +73,6 @@ Foam::depositionModels::Stopingprofile::Stopingprofile
const Foam::areaScalarField &Foam::depositionModels::Stopingprofile::Sd() const
{
const dimensionedScalar smallVel("small", dimVelocity, SMALL);
const dimensionedScalar zeroVel("0", dimVelocity, Zero);
areaScalarField a(pow(max(min(1. - mag(Us_)/ud_, 1.), 0.), ad_));
......@@ -86,13 +84,15 @@ const Foam::areaScalarField &Foam::depositionModels::Stopingprofile::Sd() const
hUddt = min(hUddt, 0.);
Sd_ = -a/(mag(Us_.oldTime())+smallVel)*hUddt;
Sd_ = max(Sd_, zeroVel);
Sd_ = max(Sd_, dimensionedScalar(dimVelocity));
Sd_ = min(Sd_, h_/Us_.db().time().deltaT());
forAll(Sd_, i)
{
if(mag(Us_.oldTime()[i]) < VSMALL)
if (mag(Us_.oldTime()[i]) < VSMALL)
{
Sd_[i] = 0;
}
}
return Sd_;
}
......
......@@ -70,16 +70,15 @@ Foam::depositionModel::depositionModel
IOobject::NO_WRITE
),
Us_.mesh(),
dimensionedScalar("one", dimensionSet(0, 1, -1, 0, 0, 0, 0), 0)
dimensionedScalar(dimVelocity)
)
{
Info<< " with " << endl
Info<< " with " << nl
<< " " << rho_ << endl;
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::depositionModel::read(const dictionary& depositionProperties)
{
......
......@@ -69,14 +69,14 @@ Foam::entrainmentModel::entrainmentModel
IOobject::NO_WRITE
),
Us_.mesh(),
dimensionedScalar("one", dimensionSet(0, 1, -1, 0, 0, 0, 0), 0)
dimensionedScalar(dimVelocity)
)
{
Info<< " with " << endl
Info<< " with " << nl
<< " " << rho_ << endl;
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
......
......@@ -41,7 +41,6 @@ Author
#include "IOdictionary.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
#include "dimensionedScalar.H"
#include "tmp.H"
#include "autoPtr.H"
#include "faMatrices.H"
......
......@@ -54,8 +54,7 @@ Foam::frictionModels::DarcyWeisbach::DarcyWeisbach
Cf_(frictionProperties_.subDict("DarcyWeisbachCoeffs").lookup("Cf")),
g_(frictionProperties_.subDict("DarcyWeisbachCoeffs").lookup("g"))
{
Info<< " " << Cf_ << endl << endl;
Info<< " " << Cf_ << nl << endl;
}
......@@ -71,7 +70,7 @@ const Foam::areaVectorField &Foam::frictionModels::DarcyWeisbach::tauSc() const
const Foam::areaScalarField &Foam::frictionModels::DarcyWeisbach::tauSp() const
{
tauSp_ = dimensionedScalar("0", dimensionSet(0, 1, -1, 0, 0, 0, 0), 0);
tauSp_ = dimensionedScalar(dimVelocity);
tauSp_ += Cf_ * g_ * mag(Us_);
return tauSp_;
......
......@@ -68,6 +68,7 @@ class DarcyWeisbach
dimensionedScalar Cf_;
dimensionedScalar g_;
public:
//- Runtime type information
......@@ -96,10 +97,10 @@ public:
// Member Functions
//- Return explicit coefficients for the linear system of equatiosn considering friction
virtual const areaVectorField &tauSc() const;
virtual const areaVectorField& tauSc() const;
//- Return implicit coefficients for the linear system of equatiosn considering friction
virtual const areaScalarField &tauSp() const;
virtual const areaScalarField& tauSp() const;
//- Return the friction properties dictionary
......
......@@ -54,19 +54,17 @@ Foam::frictionModels::ManningStrickler::ManningStrickler
n_(frictionProperties_.subDict("ManningStricklerCoeffs").lookup("n")),
g_(frictionProperties_.subDict("ManningStricklerCoeffs").lookup("g"))
{
Info<< " " << n_ << endl
<< " " << g_ << endl << endl;
Info<< " " << n_ << nl
<< " " << g_ << nl << endl;
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::areaVectorField&
Foam::frictionModels::ManningStrickler::tauSc() const
{
tauSc_ = dimensionedVector("0", dimensionSet(0, 2, -2, 0, 0, 0, 0), Zero);
tauSc_ = dimensionedVector(dimensionSet(0, 2, -2, 0, 0, 0, 0));
return tauSc_;
}
......@@ -74,7 +72,7 @@ Foam::frictionModels::ManningStrickler::tauSc() const
const Foam::areaScalarField&
Foam::frictionModels::ManningStrickler::tauSp() const
{
tauSp_ = dimensionedScalar("0", dimVelocity, Zero);
tauSp_ = dimensionedScalar(dimVelocity);
areaScalarField u(mag(Us_));
tauSp_ += sqr(n_)*g_*(u+u0_)/pow(h_+h0_, 1/3.);
......@@ -82,6 +80,7 @@ Foam::frictionModels::ManningStrickler::tauSp() const
return tauSp_;
}
bool Foam::frictionModels::ManningStrickler::read
(
const dictionary& frictionProperties
......
......@@ -45,11 +45,13 @@ namespace frictionModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::frictionModels::PoliquenForterre::PoliquenForterre
(const word& name,
(
const word& name,
const dictionary& frictionProperties,
const areaVectorField &Us,
const areaScalarField &h,
const areaScalarField &p)
const areaScalarField &p
)
:
frictionModel(name, frictionProperties, Us, h, p),
L_(frictionProperties_.subDict("PoliquenForterreCoeffs").lookup("L")),
......@@ -69,7 +71,7 @@ Foam::frictionModels::PoliquenForterre::PoliquenForterre
IOobject::AUTO_WRITE
),
Us_.mesh(),
dimensionedScalar("one", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0)
dimensionedScalar(dimless)
),
g_
(
......@@ -101,20 +103,16 @@ Foam::frictionModels::PoliquenForterre::PoliquenForterre
const Foam::areaVectorField&
Foam::frictionModels::PoliquenForterre::tauSc() const
{
tauSc_ = dimensionedVector
(
"0",
dimensionSet(0, 2, -2, 0, 0, 0, 0),
vector::zero
);
tauSc_ = dimensionedVector(dimensionSet(0, 2, -2, 0, 0, 0, 0));
return tauSc_;
}
const Foam::areaScalarField&
Foam::frictionModels::PoliquenForterre::tauSp() const
{
tauSp_ = dimensionedScalar("0", dimVelocity, 0);
tauSp_ = dimensionedScalar(dimVelocity);
const areaVectorField& n = Us_.mesh().faceAreaNormals();
const areaScalarField gn(g_ & n);
......@@ -150,6 +148,7 @@ Foam::frictionModels::PoliquenForterre::tauSp() const
return tauSp_;
}
bool Foam::frictionModels::PoliquenForterre::read
(
const dictionary& frictionProperties
......
......@@ -62,20 +62,23 @@ Foam::frictionModels::Voellmy::Voellmy
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::areaVectorField &Foam::frictionModels::Voellmy::tauSc() const
const Foam::areaVectorField& Foam::frictionModels::Voellmy::tauSc() const
{
tauSc_ = dimensionedVector("0", dimensionSet(0, 2, -2, 0, 0, 0, 0), vector::zero);
tauSc_ = dimensionedVector(dimensionSet(0, 2, -2, 0, 0, 0, 0));
return tauSc_;
}
const Foam::areaScalarField &Foam::frictionModels::Voellmy::tauSp() const
const Foam::areaScalarField& Foam::frictionModels::Voellmy::tauSp() const
{
tauSp_ = dimensionedScalar("0", dimVelocity, 0);
tauSp_ = dimensionedScalar(dimVelocity);
areaScalarField u(mag(Us_));
dimensionedScalar lambda
(
rho_*dimensionedScalar("g", dimensionSet(0, 1, -2, 0, 0, 0, 0), 9.81)/xi_
rho_
* dimensionedScalar("g", dimAcceleration, 9.81)
/ xi_
);
/*Coulomb Part*/
......@@ -88,6 +91,7 @@ const Foam::areaScalarField &Foam::frictionModels::Voellmy::tauSp() const
return tauSp_;
}
bool Foam::frictionModels::Voellmy::read
(
const dictionary& frictionProperties
......
......@@ -45,7 +45,8 @@ Foam::frictionModel::frictionModel
const dictionary& frictionProperties,
const areaVectorField &Us,
const areaScalarField &h,
const areaScalarField &p)
const areaScalarField &p
)
:
name_(name),
frictionProperties_(frictionProperties),
......@@ -66,28 +67,26 @@ Foam::frictionModel::frictionModel
IOobject::NO_WRITE
),
Us_.mesh(),
dimensionedScalar("one", dimensionSet(0, 1, -1, 0, 0, 0, 0), 0)
dimensionedScalar(dimVelocity)
),
tauSc_
(
IOobject
(
name,
Us_.time().timeName(),
Us_.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
Us_.mesh(),
dimensionedVector("one", dimensionSet(0, 2, -2, 0, 0, 0, 0), vector(0, 0, 0))
)
IOobject
(
name,
Us_.time().timeName(),
Us_.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
Us_.mesh(),
dimensionedVector(dimensionSet(0, 2, -2, 0, 0, 0, 0))
)
{
Info<< " with " << endl
<< " " << rho_ << endl
<< " " << u0_ << endl
<< " " << h0_ << endl;
}
......
......@@ -46,47 +46,53 @@ namespace frictionModels
Foam::frictionModels::kt::kt
(const word& name,
const dictionary& frictionProperties,
const areaVectorField &Us,
const areaScalarField &h,
const areaScalarField &p)
const areaVectorField& Us,
const areaScalarField& h,
const areaScalarField& p
)
:
frictionModel(name, frictionProperties, Us, h, p),
mu_(frictionProperties_.subDict("ktCoeffs").lookup("mu")),
chi_(frictionProperties_.subDict("ktCoeffs").lookup("chi"))
{
Info<< " " << mu_ << endl
<< " " << chi_ << endl << endl;
Info<< " " << mu_ << nl
<< " " << chi_ << nl << endl;
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::areaVectorField &Foam::frictionModels::kt::tauSc() const
const Foam::areaVectorField& Foam::frictionModels::kt::tauSc() const
{
tauSc_ = dimensionedVector("0", dimensionSet(0, 2, -2, 0, 0, 0, 0), vector::zero);
tauSc_ = dimensionedVector(dimensionSet(0, 2, -2, 0, 0, 0, 0));
return tauSc_;
}
const Foam::areaScalarField &Foam::frictionModels::kt::tauSp() const
const Foam::areaScalarField& Foam::frictionModels::kt::tauSp() const
{
tauSp_ = dimensionedScalar("0", dimVelocity, 0);
tauSp_ = dimensionedScalar(dimVelocity);
areaScalarField u(mag(Us_));
dimensionedScalar lambda(dimensionedScalar("g", dimensionSet(0, 1, -2, 0, 0, 0, 0), 9.81)/chi_);
dimensionedScalar lambda
(
dimensionedScalar("g", dimAcceleration, 9.81)
/ chi_
);
/*Coulomb Part*/
// Coulomb Part
tauSp_ += 1./rho_ * p_ * mu_ *
1./(u + u0_);
/*Kinetic Part*/
// Kinetic Part
tauSp_ += lambda *
u/(sqr(h_+h0_));
return tauSp_;
}
bool Foam::frictionModels::kt::read
(
const dictionary& frictionProperties
......
......@@ -67,31 +67,30 @@ Foam::frictionModels::MuI::MuI
IOobject::NO_WRITE
),
Us_.mesh(),
dimensionedScalar("one", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0)
dimensionedScalar(dimless)
)
{
Info<< " " << d_ << endl
<< " " << rhop_ << endl
<< " " << mus_ << endl
<< " " << mu2_ << endl
<< " " << I0_ << endl << endl;
Info<< " " << d_ << nl
<< " " << rhop_ << nl
<< " " << mus_ << nl
<< " " << mu2_ << nl
<< " " << I0_ << nl << endl;
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::areaVectorField &Foam::frictionModels::MuI::tauSc() const
const Foam::areaVectorField& Foam::frictionModels::MuI::tauSc() const
{
tauSc_ = dimensionedVector("0", dimensionSet(0, 2, -2, 0, 0, 0, 0), vector::zero);
tauSc_ = dimensionedVector(dimensionSet(0, 2, -2, 0, 0, 0, 0));
return tauSc_;
}
const Foam::areaScalarField &Foam::frictionModels::MuI::tauSp() const
const Foam::areaScalarField& Foam::frictionModels::MuI::tauSp() const
{
tauSp_ = dimensionedScalar("0", dimVelocity, 0);
tauSp_ = dimensionedScalar(dimVelocity);
const areaScalarField u(mag(Us_));
const areaScalarField gamma(5./2.*u/(h_+h0_));
......@@ -105,6 +104,7 @@ const Foam::areaScalarField &Foam::frictionModels::MuI::tauSp() const
return tauSp_;
}
bool Foam::frictionModels::MuI::read
(
const dictionary& frictionProperties
......
......@@ -10,5 +10,6 @@ pb += friction->rho()*(g*h)&n;
//pb = fac::average(fac::interpolate(pb));
pb = Foam::max(pb, dimensionedScalar("pb_min", dimensionSet(1, -1, -2, 0, 0, 0, 0), 0));
// Clipping
pb = Foam::max(pb, dimensionedScalar(dimPressure));
......@@ -95,7 +95,7 @@
IOobject::AUTO_WRITE
),
aMesh,
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0, 0, 0), 0)
dimensionedScalar(dimPressure)
);
areaVectorField pbn
......@@ -109,7 +109,7 @@
IOobject::NO_WRITE
),
aMesh,
dimensionedVector("zero", dimensionSet(1, -1, -2, 0, 0, 0, 0), vector(0, 0, 0))
dimensionedVector(dimPressure)
);
areaVectorField tau
......@@ -123,7 +123,7 @@
IOobject::AUTO_WRITE
),
aMesh,
dimensionedVector("zero", dimensionSet(1, -1, -2, 0, 0, 0, 0), vector(0, 0, 0))
dimensionedVector(dimPressure)
);
//entrainment height
......@@ -138,5 +138,5 @@
IOobject::AUTO_WRITE
),
aMesh,
dimensionedScalar( "zero", dimLength, 0 )
dimensionedScalar(dimLength)
);
......@@ -9,7 +9,7 @@ volVectorField U
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("0", dimVelocity, vector::zero)
dimensionedVector(dimVelocity)
);
volScalarField H
......@@ -23,7 +23,7 @@ volScalarField H
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimensionSet(0, 1, 0, 0, 0, 0, 0), 0)
dimensionedScalar(dimLength)
);
volScalarField Hentrain
......@@ -37,7 +37,7 @@ volScalarField Hentrain
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimensionSet(0, 1, 0, 0, 0, 0, 0), 0)
dimensionedScalar(dimLength)
);
volScalarField Pb
......@@ -51,7 +51,7 @@ volScalarField Pb
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0, 0, 0), 0)
dimensionedScalar(dimPressure)
);
volVectorField Tau
......@@ -65,7 +65,7 @@ volVectorField Tau
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("zero", dimensionSet(1, -1, -2, 0, 0, 0, 0), vector::zero)
dimensionedVector(dimPressure)
);
......
......@@ -29,7 +29,8 @@ Description
The solver is based on the Finite Area Method.
Model derivation and description:
Rauter and Tukovic (submitted to Computer & Fluids):
A finite area scheme for shallow granular flows on three-dimensionalc surfaces
A finite area scheme for shallow granular flows on three-dimensional
surfaces
Author
Matthias Rauter matthias.rauter@uibk.ac.at
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment