Commit 4c21f24a authored by Henry Weller's avatar Henry Weller
Browse files

Input of dimensionedScalars: update read-construction of dimensionedScalar in applications

so that the specification of the name and dimensions are optional in property dictionaries.

Update tutorials so that the name of the dimensionedScalar property is
no longer duplicated but optional dimensions are still provided and are
checked on read.
parent 745e07e6
Info<< "Reading financial properties\n" << endl;
Info<< "Reading financial properties\n" << endl;
IOdictionary financialProperties
IOdictionary financialProperties
(
IOobject
(
IOobject
(
"financialProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
"financialProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar strike
(
financialProperties.lookup("strike")
);
dimensionedScalar strike
(
"strike",
dimLength,
financialProperties.lookup("strike")
);
dimensionedScalar r
(
financialProperties.lookup("r")
);
dimensionedScalar r
(
"r",
dimless/dimTime,
financialProperties.lookup("r")
);
dimensionedScalar sigma
(
financialProperties.lookup("sigma")
);
dimensionedScalar sigma
(
"sigma",
dimensionSet(0, 0, -0.5, 0, 0),
financialProperties.lookup("sigma")
);
dimensionedScalar sigmaSqr = sqr(sigma);
dimensionedScalar sigmaSqr = sqr(sigma);
Info<< nl << "Reading field V" << endl;
Info<< nl << "Reading field V" << endl;
volScalarField V
volScalarField V
(
IOobject
(
IOobject
(
"V",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
"V",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
surfaceVectorField Pf
surfaceVectorField Pf
(
IOobject
(
IOobject
(
"Pf",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh.Cf()
);
"Pf",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh.Cf()
);
volVectorField P
(
IOobject
(
"P",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh.C()
);
//- V == max(strike - P.x(), dimensionedScalar("0", V.dimensions(), 0.0));
V == max
volVectorField P
(
IOobject
(
P.component(Foam::vector::X) - strike,
dimensionedScalar("0", V.dimensions(), 0.0)
);
"P",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh.C()
);
V == max
(
P.component(Foam::vector::X) - strike,
dimensionedScalar("0", V.dimensions(), 0.0)
);
volScalarField delta
volScalarField delta
(
IOobject
(
IOobject
(
"delta",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
fvc::grad(V)().component(Foam::vector::X)
);
"delta",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
fvc::grad(V)().component(Foam::vector::X)
);
singlePhaseTransportModel laminarTransport(U, phi);
singlePhaseTransportModel laminarTransport(U, phi);
// Thermal expansion coefficient [1/K]
dimensionedScalar beta(laminarTransport.lookup("beta"));
// Thermal expansion coefficient [1/K]
dimensionedScalar beta
(
"beta",
dimless/dimTemperature,
laminarTransport.lookup("beta")
);
// Reference temperature [K]
dimensionedScalar TRef(laminarTransport.lookup("TRef"));
// Reference temperature [K]
dimensionedScalar TRef("TRef", dimTemperature, laminarTransport.lookup("TRef"));
// Laminar Prandtl number
dimensionedScalar Pr(laminarTransport.lookup("Pr"));
// Laminar Prandtl number
dimensionedScalar Pr("Pr", dimless, laminarTransport.lookup("Pr"));
// Turbulent Prandtl number
dimensionedScalar Prt(laminarTransport.lookup("Prt"));
// Turbulent Prandtl number
dimensionedScalar Prt("Prt", dimless, laminarTransport.lookup("Prt"));
Info<< "Reading field U\n" << endl;
volVectorField U
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Creating face flux\n" << endl;
surfaceScalarField phi
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Creating face flux\n" << endl;
surfaceScalarField phi
(
IOobject
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
"phi",
runTime.timeName(),
mesh,
dimensionedScalar("zero", mesh.Sf().dimensions()*U.dimensions(), 0.0)
);
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", mesh.Sf().dimensions()*U.dimensions(), 0.0)
);
singlePhaseTransportModel laminarTransport(U, phi);
singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
);
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
);
dimensionedVector Ubar(laminarTransport.lookup("Ubar"));
dimensionedVector Ubar("Ubar", dimVelocity, laminarTransport.lookup("Ubar"));
vector flowDirection = (Ubar/mag(Ubar)).value();
tensor flowMask = sqr(flowDirection);
vector flowDirection = (Ubar/mag(Ubar)).value();
tensor flowMask = sqr(flowDirection);
dimensionedVector gradP
(
"gradP",
dimensionSet(0, 1, -2, 0, 0),
vector::zero
);
dimensionedVector gradP
(
"gradP",
dimensionSet(0, 1, -2, 0, 0),
vector::zero
);
......@@ -18,6 +18,8 @@
dimensionedScalar rhoInfValue
(
"rhoInf",
dimDensity,
laminarTransport.lookup("rhoInf")
);
......
Info<< "Reading thermodynamicProperties\n" << endl;
Info<< "Reading thermodynamicProperties\n" << endl;
IOdictionary thermodynamicProperties
IOdictionary thermodynamicProperties
(
IOobject
(
IOobject
(
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar psil(thermodynamicProperties.lookup("psil"));
dimensionedScalar rholSat(thermodynamicProperties.lookup("rholSat"));
dimensionedScalar psiv(thermodynamicProperties.lookup("psiv"));
dimensionedScalar pSat(thermodynamicProperties.lookup("pSat"));
dimensionedScalar rhovSat("rhovSat", psiv*pSat);
dimensionedScalar rhol0("rhol0", rholSat - pSat*psil);
dimensionedScalar rhoMin(thermodynamicProperties.lookup("rhoMin"));
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar psil
(
"psil",
dimCompressibility,
thermodynamicProperties.lookup("psil")
);
dimensionedScalar rholSat
(
"rholSat",
dimDensity,
thermodynamicProperties.lookup("rholSat")
);
dimensionedScalar psiv
(
"psiv",
dimCompressibility,
thermodynamicProperties.lookup("psiv")
);
dimensionedScalar pSat
(
"pSat",
dimPressure,
thermodynamicProperties.lookup("pSat")
);
dimensionedScalar rhovSat("rhovSat", psiv*pSat);
dimensionedScalar rhol0("rhol0", rholSat - pSat*psil);
dimensionedScalar rhoMin
(
"rhoMin",
dimDensity,
thermodynamicProperties.lookup("rhoMin")
);
......@@ -46,7 +46,7 @@ volScalarField rho
mixture.rho()
);
dimensionedScalar pMin(mixture.lookup("pMin"));
dimensionedScalar pMin("pMin", dimPressure, mixture.lookup("pMin"));
mesh.setFluxRequired(p_rgh.name());
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -152,9 +152,9 @@ Foam::incompressibleThreePhaseMixture::incompressibleThreePhaseMixture
)
),
rho1_(nuModel1_->viscosityProperties().lookup("rho")),
rho2_(nuModel2_->viscosityProperties().lookup("rho")),
rho3_(nuModel3_->viscosityProperties().lookup("rho"))
rho1_("rho", dimDensity, nuModel1_->viscosityProperties().lookup("rho")),
rho2_("rho", dimDensity, nuModel2_->viscosityProperties().lookup("rho")),
rho3_("rho", dimDensity, nuModel3_->viscosityProperties().lookup("rho"))
{
alpha3_ == 1.0 - alpha1_ - alpha2_;
calcNu();
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -44,7 +44,7 @@ Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture
:
incompressibleTwoPhaseMixture(U, phi),
phaseChangeTwoPhaseMixtureCoeffs_(subDict(type + "Coeffs")),
pSat_(lookup("pSat"))
pSat_("pSat", dimPressure, lookup("pSat"))
{}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -59,7 +59,7 @@ Foam::phase::phase
phi
)
),
rho_(phaseDict_.lookup("rho"))
rho_("rho", dimDensity, phaseDict_.lookup("rho"))
{}
......
......@@ -37,10 +37,10 @@ volScalarField& alpha2(mixture.alpha2());
const dimensionedScalar& rho1 = mixture.rho1();
const dimensionedScalar& rho2 = mixture.rho2();
dimensionedScalar Dab(mixture.lookup("Dab"));
dimensionedScalar Dab("Dab", dimViscosity, mixture.lookup("Dab"));
// Read the reciprocal of the turbulent Schmidt number
dimensionedScalar alphatab(mixture.lookup("alphatab"));
dimensionedScalar alphatab("alphatab", dimless, mixture.lookup("alphatab"));
// Need to store rho for ddt(rho, U)
volScalarField rho("rho", alpha1*rho1 + alpha2*rho2);
......
......@@ -16,38 +16,38 @@ FoamFile
transportModel Newtonian;
nu nu [ 0 2 -1 0 0 0 0 ] 1.5e-05;
nu [0 2 -1 0 0 0 0] 1.5e-05;
BirdCarreauCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-03;
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-05;
m m [ 0 0 1 0 0 0 0 ] 1;
n n [ 0 0 0 0 0 0 0 ] 0.5;
nu0 [0 2 -1 0 0 0 0] 1e-03;
nuInf [0 2 -1 0 0 0 0] 1e-05;
m [0 0 1 0 0 0 0] 1;
n [0 0 0 0 0 0 0] 0.5;
}
CrossPowerLawCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-03;
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-05;
m m [ 0 0 1 0 0 0 0 ] 1;
n n [ 0 0 0 0 0 0 0 ] 0.5;
nu0 [0 2 -1 0 0 0 0] 1e-03;
nuInf [0 2 -1 0 0 0 0] 1e-05;
m [0 0 1 0 0 0 0] 1;
n [0 0 0 0 0 0 0] 0.5;
}
powerLawCoeffs
{
nuMax nuMax [ 0 2 -1 0 0 0 0 ] 1e-03;
nuMin nuMin [ 0 2 -1 0 0 0 0 ] 1e-05;
k k [ 0 2 -1 0 0 0 0 ] 1e-05;
n n [ 0 0 0 0 0 0 0 ] 1;
nuMax [0 2 -1 0 0 0 0] 1e-03;
nuMin [0 2 -1 0 0 0 0] 1e-05;
k [0 2 -1 0 0 0 0] 1e-05;
n [0 0 0 0 0 0 0] 1;
}
HerschelBulkleyCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-03;
tau0 tau0 [ 0 2 -2 0 0 0 0 ] 1;
k k [ 0 2 -1 0 0 0 0 ] 1e-05;
n n [ 0 0 0 0 0 0 0 ] 1;
nu0 [0 2 -1 0 0 0 0] 1e-03;
tau0 [0 2 -2 0 0 0 0] 1;
k [0 2 -1 0 0 0 0] 1e-05;
n [0 0 0 0 0 0 0] 1;
}
// ************************************************************************* //
......@@ -16,38 +16,38 @@ FoamFile
transportModel Newtonian;
nu nu [ 0 2 -1 0 0 0 0 ] 1.5e-05;
nu [0 2 -1 0 0 0 0] 1.5e-05;
BirdCarreauCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-03;
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-05;
m m [ 0 0 1 0 0 0 0 ] 1;
n n [ 0 0 0 0 0 0 0 ] 0.5;
nu0 [0 2 -1 0 0 0 0] 1e-03;
nuInf [0 2 -1 0 0 0 0] 1e-05;
m [0 0 1 0 0 0 0] 1;
n [0 0 0 0 0 0 0] 0.5;
}
CrossPowerLawCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-03;
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-05;
m m [ 0 0 1 0 0 0 0 ] 1;
n n [ 0 0 0 0 0 0 0 ] 0.5;
nu0 [0 2 -1 0 0 0 0] 1e-03;
nuInf [0 2 -1 0 0 0 0] 1e-05;
m [0 0 1 0 0 0 0] 1;
n [0 0 0 0 0 0 0] 0.5;
}
powerLawCoeffs
{
nuMax nuMax [ 0 2 -1 0 0 0 0 ] 1e-03;
nuMin nuMin [ 0 2 -1 0 0 0 0 ] 1e-05;
k k [ 0 2 -1 0 0 0 0 ] 1e-05;
n n [ 0 0 0 0 0 0 0 ] 1;
nuMax [0 2 -1 0 0 0 0] 1e-03;
nuMin [0 2 -1 0 0 0 0] 1e-05;
k [0 2 -1 0 0 0 0] 1e-05;
n [0 0 0 0 0 0 0] 1;
}
HerschelBulkleyCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-03;
tau0 tau0 [ 0 2 -2 0 0 0 0 ] 1;
k k [ 0 2 -1 0 0 0 0 ] 1e-05;
n n [ 0 0 0 0 0 0 0 ] 1;
nu0 [0 2 -1 0 0 0 0] 1e-03;
tau0 [0 2 -2 0 0 0 0] 1;
k [0 2 -1 0 0 0 0] 1e-05;
n [0 0 0 0 0 0 0] 1;
}
// ************************************************************************* //
......@@ -16,38 +16,38 @@ FoamFile
transportModel Newtonian;