Commit 2f86cdc7 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: more consistent use of dimensioned Zero

- when constructing dimensioned fields that are to be zero-initialized,
  it is preferrable to use a form such as

      dimensionedScalar(dims, Zero)
      dimensionedVector(dims, Zero)

  rather than

      dimensionedScalar("0", dims, 0)
      dimensionedVector("zero", dims, vector::zero)

  This reduces clutter and also avoids any suggestion that the name of
  the dimensioned quantity has any influence on the field's name.

  An even shorter version is possible. Eg,

      dimensionedScalar(dims)

  but reduces the clarity of meaning.

- NB: UniformDimensionedField is an exception to these style changes
  since it does use the name of the dimensioned type (instead of the
  regIOobject).
parent 06035b8a
......@@ -13,7 +13,7 @@ volVectorField U
);
// Initialise the velocity internal field to zero
U = dimensionedVector("0", U.dimensions(), Zero);
U = dimensionedVector(U.dimensions(), Zero);
surfaceScalarField phi
(
......@@ -74,7 +74,7 @@ volScalarField p
false
),
mesh,
dimensionedScalar(pName, sqr(dimVelocity), 0),
dimensionedScalar(sqr(dimVelocity), Zero),
pBCTypes
);
......@@ -105,7 +105,7 @@ volScalarField Phi
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("Phi", dimLength*dimVelocity, 0),
dimensionedScalar(dimLength*dimVelocity, Zero),
PhiBCTypes
);
......
......@@ -13,7 +13,7 @@ volVectorField U
);
// Initialise the velocity internal field to zero
U = dimensionedVector("0", U.dimensions(), Zero);
U = dimensionedVector(U.dimensions(), Zero);
surfaceScalarField phi
(
......@@ -74,7 +74,7 @@ volScalarField p
false
),
mesh,
dimensionedScalar(pName, sqr(dimVelocity), 0),
dimensionedScalar(sqr(dimVelocity), Zero),
pBCTypes
);
......@@ -105,7 +105,7 @@ volScalarField Phi
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("Phi", dimLength*dimVelocity, 0),
dimensionedScalar(dimLength*dimVelocity, Zero),
PhiBCTypes
);
......
......@@ -103,7 +103,7 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::basicSubGrid::XiEq() const
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", Nv.dimensions(), 0.0)
dimensionedScalar(Nv.dimensions(), Zero)
);
N.primitiveFieldRef() = Nv.primitiveField()*Cw;
......@@ -118,12 +118,7 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::basicSubGrid::XiEq() const
IOobject::NO_WRITE
),
U.mesh(),
dimensionedSymmTensor
(
"zero",
nsv.dimensions(),
Zero
)
dimensionedSymmTensor(nsv.dimensions(), Zero)
);
ns.primitiveFieldRef() = nsv.primitiveField()*Cw;
......
......@@ -104,12 +104,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::PDRDragModels::basic::Dcu() const
IOobject::NO_WRITE
),
U_.mesh(),
dimensionedSymmTensor
(
"zero",
dimMass/dimTime/pow(dimLength, 3),
Zero
)
dimensionedSymmTensor(dimMass/dimTime/dimVolume, Zero)
)
);
......@@ -143,7 +138,7 @@ Foam::tmp<Foam::volScalarField> Foam::PDRDragModels::basic::Gk() const
IOobject::NO_WRITE
),
U_.mesh(),
dimensionedScalar("zero", dimMass/dimLength/pow(dimTime, 3), 0.0)
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
)
);
......
......@@ -105,7 +105,7 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEXiEq::XiEq() const
IOobject::NO_WRITE
),
epsilon.mesh(),
dimensionedScalar("XiEq", dimless, 0.0)
dimensionedScalar(dimless, Zero)
)
);
volScalarField& xieq = tXiEq.ref();
......
......@@ -110,7 +110,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
false
),
mesh,
dimensionedScalar("zero", Nv.dimensions(), 0.0)
dimensionedScalar(Nv.dimensions(), Zero)
)
);
volScalarField& N = tN.ref();
......@@ -127,12 +127,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
IOobject::NO_WRITE
),
mesh,
dimensionedSymmTensor
(
"zero",
nsv.dimensions(),
Zero
)
dimensionedSymmTensor(nsv.dimensions(), Zero)
);
ns.primitiveFieldRef() = nsv.primitiveField()*pow(mesh.V(), 2.0/3.0);
......
......@@ -255,7 +255,7 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
IOobject::NO_WRITE
),
p.mesh(),
dimensionedScalar("Su0", dimVelocity, 0.0)
dimensionedScalar(dimVelocity, Zero)
)
);
......@@ -304,7 +304,7 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
IOobject::NO_WRITE
),
p.mesh(),
dimensionedScalar("Su0", dimVelocity, 0.0)
dimensionedScalar(dimVelocity, Zero)
)
);
......@@ -358,7 +358,7 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Ma
IOobject::NO_WRITE
),
phi.mesh(),
dimensionedScalar("Ma", dimless, 0.0)
dimensionedScalar(dimless, Zero)
)
);
......
......@@ -243,7 +243,7 @@ if (ign.ignited())
rho*max
(
sigmat - sigmas,
dimensionedScalar("0", sigmat.dimensions(), 0)
dimensionedScalar(sigmat.dimensions(), Zero)
),
Xi
)
......
......@@ -55,12 +55,7 @@
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar
(
"zero",
dimensionSet(dimEnergy/dimMass/dimTemperature),
0.0
)
dimensionedScalar(dimEnergy/dimMass/dimTemperature, Zero)
);
volVectorField U
......@@ -74,7 +69,7 @@
IOobject::NO_WRITE
),
mesh,
dimensionedVector("zero", dimVelocity, Zero)
dimensionedVector(dimVelocity, Zero)
);
#include "createPhi.H"
......
......@@ -142,7 +142,7 @@ volScalarField Qdot
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0)
dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)
);
#include "createDpdt.H"
......
......@@ -90,7 +90,7 @@ volScalarField Qdot
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0)
dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)
);
#include "createDpdt.H"
......
......@@ -111,7 +111,7 @@ volScalarField Qdot
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0)
dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)
);
#include "createDpdt.H"
......
......@@ -91,7 +91,7 @@ volScalarField Qdot
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0)
dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)
);
#include "createDpdt.H"
......
......@@ -104,7 +104,7 @@ License
mesh
),
mesh,
dimensionedScalar("rDeltaTY", rDeltaT.dimensions(), 0)
dimensionedScalar(rDeltaT.dimensions(), Zero)
);
bool foundY = false;
......
......@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
#include "readFluxScheme.H"
dimensionedScalar v_zero("v_zero", dimVolume/dimTime, 0.0);
const dimensionedScalar v_zero(dimVolume/dimTime, Zero);
// Courant numbers used to adjust the time-step
scalar CoNum = 0.0;
......
......@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
#include "readFluxScheme.H"
dimensionedScalar v_zero("v_zero", dimVolume/dimTime, 0.0);
const dimensionedScalar v_zero(dimVolume/dimTime, Zero);
// Courant numbers used to adjust the time-step
scalar CoNum = 0.0;
......
......@@ -91,7 +91,7 @@ volScalarField dpdt
mesh
),
mesh,
dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
dimensionedScalar(p.dimensions()/dimTime, Zero)
);
#include "createMRF.H"
......
......@@ -73,7 +73,7 @@ volScalarField dpdt
mesh
),
mesh,
dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
dimensionedScalar(p.dimensions()/dimTime, Zero)
);
Info<< "Creating field kinetic energy K\n" << endl;
......
......@@ -49,7 +49,7 @@
mesh
),
mesh,
dimensionedScalar("Mr", dimensionSet(0, 1, 0, 0, 0, 1, 0), 0)
dimensionedScalar(dimensionSet(0, 1, 0, 0, 0, 1, 0), Zero)
);
forAll(magnets, i)
......
......@@ -82,7 +82,7 @@ volVectorField P
V == max
(
P.component(Foam::vector::X) - strike,
dimensionedScalar("0", V.dimensions(), 0.0)
dimensionedScalar(V.dimensions(), Zero)
);
volScalarField delta
......
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