Commit a82a2f62 authored by Mark Olesen's avatar Mark Olesen

ENH: use dictionary guarded access for dimensioned types

parent 31bbd299
......@@ -25,9 +25,9 @@ autoPtr<depositionModel> deposition
depositionModel::New(transportProperties, Us, h, hentrain, pb, tau)
);
dimensionedScalar hmin(transportProperties.lookup("hmin"));
dimensionedScalar hmin("hmin", dimLength, transportProperties);
dimensionedScalar xi(transportProperties.lookup("xi"));
dimensionedScalar xi("xi", dimless, transportProperties);
Switch pressureFeedback(transportProperties.lookup("pressureFeedback"));
......
......@@ -41,7 +41,10 @@ autoPtr<elevationModel> elevationModel::New
const dictionary& elevationProperties
)
{
word elevationModelTypeName(elevationProperties.lookup("elevationModel"));
const word elevationModelTypeName
(
elevationProperties.get<word>("elevationModel")
);
Info<< "Selecting elevation model "
<< elevationModelTypeName << endl;
......
......@@ -74,23 +74,16 @@ int main(int argc, char *argv[])
);
label cellCountX, cellCountY;
scalar minX, maxX, minY, maxY, meshH;
Switch tri;
demMeshDict.lookup("cellCountX") >> cellCountX;
demMeshDict.lookup("cellCountY") >> cellCountY;
demMeshDict.lookup("minX") >> minX;
demMeshDict.lookup("maxX") >> maxX;
demMeshDict.lookup("minY") >> minY;
demMeshDict.lookup("maxY") >> maxY;
demMeshDict.lookup("h") >> meshH;
const label cellCountX = demMeshDict.get<label>("cellCountX");
const label cellCountY = demMeshDict.get<label>("cellCountY");
const label cellCountZ = 1;
const scalar minX = demMeshDict.get<scalar>("minX");
const scalar maxX = demMeshDict.get<scalar>("maxX");
const scalar minY = demMeshDict.get<scalar>("minY");
const scalar maxY = demMeshDict.get<scalar>("maxY");
const scalar meshH = demMeshDict.get<scalar>("h");
const scalar cellCount = cellCountX*cellCountY;
const scalar pointCount = (cellCountZ+1)*(cellCountX+1)*(cellCountY+1);
const scalar dx = (maxX-minX)/cellCountX;
......
......@@ -56,8 +56,8 @@ Foam::depositionModels::Stoppingprofile::Stoppingprofile
)
:
depositionModel(type(), depositionProperties, Us, h, hentrain, pb, tau),
ud_(coeffDict_.lookup("ud")),
ad_(coeffDict_.lookup("ad")),
ud_("ud", coeffDict_),
ad_("ad", coeffDict_),
gs_(Us.db().lookupObject<areaVectorField>("gs")),
gn_(Us.db().lookupObject<areaScalarField>("gn"))
{
......@@ -88,7 +88,7 @@ Foam::depositionModels::Stoppingprofile::Sd() const
& Us_.oldTime()/(mag(Us_.oldTime()) + smallVel)
);
hUddt = min(hUddt, dimensionedScalar("zero", hUddt.dimensions(), 0));
hUddt = min(hUddt, dimensionedScalar(hUddt.dimensions(), Zero));
Sd_ = -a/(mag(Us_.oldTime())+smallVel)*hUddt;
Sd_ = max(Sd_, dimensionedScalar(dimVelocity));
Sd_ = min(Sd_, h_/Us_.db().time().deltaT());
......@@ -111,8 +111,8 @@ bool Foam::depositionModels::Stoppingprofile::read
{
readDict(type(), depositionProperties);
coeffDict_.lookup("ud") >> ud_;
coeffDict_.lookup("ad") >> ad_;
coeffDict_.readEntry("ud", ud_);
coeffDict_.readEntry("ad", ad_);
return true;
}
......
......@@ -70,7 +70,7 @@ Foam::depositionModel::depositionModel
(
depositionProperties_.optionalSubDict(type + "Coeffs")
),
rho_(depositionProperties_.lookup("rho")),
rho_("rho", dimDensity, depositionProperties_),
Us_(Us),
h_(h),
hentrain_(hentrain),
......
......@@ -41,7 +41,7 @@ Foam::autoPtr<Foam::depositionModel> Foam::depositionModel::New
)
{
const word modelName(deposition.lookup("depositionModel"));
const word modelName(deposition.get<word>("depositionModel"));
Info<< "Selecting deposition model "
<< modelName << endl;
......
......@@ -56,7 +56,7 @@ Foam::entrainmentModels::Erosionenergy::Erosionenergy
)
:
entrainmentModel(type(), entrainmentProperties, Us, h, hentrain, pb, tau),
eb_(coeffDict_.lookup("eb")),
eb_("eb", sqr(dimLength/dimTime), coeffDict_),
gs_(Us_.db().lookupObject<areaVectorField>("gs")),
gn_(Us_.db().lookupObject<areaScalarField>("gn"))
{
......@@ -83,7 +83,7 @@ bool Foam::entrainmentModels::Erosionenergy::read
{
readDict(type(), entrainmentProperties);
coeffDict_.lookup("eb") >> eb_;
coeffDict_.readEntry("eb", eb_);
return true;
}
......
......@@ -56,7 +56,7 @@ Foam::entrainmentModels::Front::Front
)
:
entrainmentModel(type(), entrainmentProperties, Us, h, hentrain, pb, tau),
htrigger_(coeffDict_.lookup("htrigger"))
htrigger_("htrigger", coeffDict_)
{
Info << " " << htrigger_ << endl << endl;
}
......@@ -82,7 +82,7 @@ bool Foam::entrainmentModels::Front::read
{
readDict(type(), entrainmentProperties);
coeffDict_.lookup("htrigger") >> htrigger_;
coeffDict_.readEntry("htrigger", htrigger_);
return true;
}
......
......@@ -56,10 +56,9 @@ Foam::entrainmentModels::IsslerFC::IsslerFC
)
:
entrainmentModel(type(), entrainmentProperties, Us, h, hentrain, pb, tau),
tauc_(coeffDict_.lookup("tauc")),
mu_(coeffDict_.lookup("mu")),
K_(coeffDict_.lookup("K")),
tauc_("tauc", coeffDict_),
mu_("mu", coeffDict_),
K_("K", coeffDict_),
gs_(Us.db().lookupObject<areaVectorField>("gs")),
gn_(Us.db().lookupObject<areaScalarField>("gn"))
{
......@@ -113,7 +112,7 @@ bool Foam::entrainmentModels::IsslerFC::read
{
readDict(type(), entrainmentProperties);
coeffDict_.lookup("tauc") >> tauc_;
coeffDict_.readEntry("tauc", tauc_);
return true;
}
......
......@@ -56,8 +56,8 @@ Foam::entrainmentModels::Medina::Medina
)
:
entrainmentModel(type(), entrainmentProperties, Us, h, hentrain, pb, tau),
tauc_(coeffDict_.lookup("tauc")),
mu_(coeffDict_.lookup("mu")),
tauc_("tauc", coeffDict_),
mu_("mu", coeffDict_),
gs_(Us_.db().lookupObject<areaVectorField>("gs")),
gn_(Us_.db().lookupObject<areaScalarField>("gn"))
{
......@@ -92,8 +92,8 @@ bool Foam::entrainmentModels::Medina::read
{
readDict(type(), entrainmentProperties);
coeffDict_.lookup("tauc") >> tauc_;
coeffDict_.lookup("mu") >> mu_;
coeffDict_.readEntry("tauc", tauc_);
coeffDict_.readEntry("mu", mu_);
return true;
}
......
......@@ -70,7 +70,7 @@ Foam::entrainmentModel::entrainmentModel
(
entrainmentProperties_.optionalSubDict(type + "Coeffs")
),
rho_(entrainmentProperties_.lookup("rho")),
rho_("rho", dimDensity, entrainmentProperties_),
Us_(Us),
h_(h),
hentrain_(hentrain),
......
......@@ -40,7 +40,7 @@ Foam::autoPtr<Foam::entrainmentModel> Foam::entrainmentModel::New
const areaVectorField& tau
)
{
const word modelName(entrainmentProperties.lookup("entrainmentModel"));
const word modelName(entrainmentProperties.get<word>("entrainmentModel"));
Info<< "Selecting entrainment model "
<< modelName << endl;
......
......@@ -52,8 +52,8 @@ Foam::frictionModels::DarcyWeisbach::DarcyWeisbach
)
:
frictionModel(type(), frictionProperties, Us, h, p),
Cf_(coeffDict_.lookup("Cf")),
g_(coeffDict_.lookup("g"))
Cf_("Cf", coeffDict_),
g_("g", coeffDict_)
{
Info<< " " << Cf_ << nl << endl;
}
......
......@@ -52,8 +52,8 @@ Foam::frictionModels::ManningStrickler::ManningStrickler
)
:
frictionModel(type(), frictionProperties, Us, h, p),
n_(coeffDict_.lookup("n")),
g_(coeffDict_.lookup("g"))
n_("n", coeffDict_),
g_("g", coeffDict_)
{
Info<< " " << n_ << nl
<< " " << g_ << nl << endl;
......
......@@ -53,12 +53,12 @@ Foam::frictionModels::PoliquenForterre::PoliquenForterre
)
:
frictionModel(type(), frictionProperties, Us, h, p),
L_(coeffDict_.lookup("L")),
beta_(coeffDict_.lookup("beta")),
zeta1_(coeffDict_.lookup("zeta1")),
zeta2_(coeffDict_.lookup("zeta2")),
zeta3_(coeffDict_.lookup("zeta3")),
gamma_(coeffDict_.lookup("gamma")),
L_("L", coeffDict_),
beta_("beta", coeffDict_),
zeta1_("zeta1", coeffDict_),
zeta2_("zeta2", coeffDict_),
zeta3_("zeta3", coeffDict_),
gamma_("gamma", coeffDict_),
mu_
(
IOobject
......
......@@ -52,8 +52,8 @@ Foam::frictionModels::Voellmy::Voellmy
)
:
frictionModel(type(), frictionProperties, Us, h, p),
mu_(coeffDict_.lookup("mu")),
xi_(coeffDict_.lookup("xi"))
mu_("mu", dimless, coeffDict_),
xi_("xi", dimless, coeffDict_)
{
Info<< " " << mu_ << nl
<< " " << xi_ << nl << endl;
......@@ -100,7 +100,7 @@ bool Foam::frictionModels::Voellmy::read
{
readDict(type(), frictionProperties);
//frictionProperties_.lookup("nu") >> nu0_;
//frictionProperties_.readEntry("nu", nu0_);
return true;
}
......
......@@ -81,9 +81,9 @@ Foam::frictionModel::frictionModel
(
frictionProperties_.optionalSubDict(type + "Coeffs")
),
rho_(frictionProperties_.lookup("rho")),
u0_(frictionProperties_.lookup("u0")),
h0_(frictionProperties_.lookup("h0")),
rho_("rho", dimDensity, frictionProperties_),
u0_("u0", dimVelocity, frictionProperties_),
h0_("h0", dimLength, frictionProperties_),
Us_(Us),
h_(h),
p_(p),
......
......@@ -38,10 +38,9 @@ Foam::autoPtr<Foam::frictionModel> Foam::frictionModel::New
const areaScalarField& p
)
{
const word modelName(frictionProperties.lookup("frictionModel"));
const word modelName(frictionProperties.get<word>("frictionModel"));
Info<< "Selecting friction model "
<< modelName << endl;
Info<< "Selecting friction model " << modelName << nl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelName);
......
......@@ -52,8 +52,8 @@ Foam::frictionModels::kt::kt
)
:
frictionModel(type(), frictionProperties, Us, h, p),
mu_(coeffDict_.lookup("mu")),
chi_(coeffDict_.lookup("chi"))
mu_("mu", coeffDict_),
chi_("chi", coeffDict_)
{
Info<< " " << mu_ << nl
<< " " << chi_ << nl << endl;
......
......@@ -52,11 +52,11 @@ Foam::frictionModels::MuI::MuI
)
:
frictionModel(type(), frictionProperties, Us, h, p),
d_(coeffDict_.lookup("d")),
rhop_(coeffDict_.lookup("rho_p")),
mus_(coeffDict_.lookup("mu_s")),
mu2_(coeffDict_.lookup("mu_2")),
I0_(coeffDict_.lookup("I_0")),
d_("d", dimLength, coeffDict_),
rhop_("rho_p", dimDensity, coeffDict_),
mus_("mu_s", dimless, coeffDict_),
mu2_("mu_2", dimless, coeffDict_),
I0_("I_0", dimless, coeffDict_),
mu_
(
IOobject
......
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