Commit 5632ef2d 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 b9841df8
......@@ -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
......
......@@ -72,7 +72,7 @@
IOobject::NO_WRITE
),
aMesh,
dimensionedScalar("Sm", dimLength/dimTime, 0)
dimensionedScalar(dimLength/dimTime, Zero)
);
// Mass sink
......@@ -87,7 +87,7 @@
IOobject::NO_WRITE
),
aMesh,
dimensionedScalar("Sd", dimLength/dimTime, 0)
dimensionedScalar(dimLength/dimTime, Zero)
);
areaVectorField Ug
......@@ -101,7 +101,7 @@
IOobject::NO_WRITE
),
aMesh,
dimensionedVector("Ug", dimVelocity, vector::zero)
dimensionedVector(dimVelocity, Zero)
);
......
......@@ -9,7 +9,7 @@ volVectorField U
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("0", dimVelocity, vector::zero)
dimensionedVector(dimVelocity, Zero)
);
......@@ -24,7 +24,7 @@ volScalarField H
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("0", dimLength, 0)
dimensionedScalar(dimLength, Zero)
);
// Create volume-to surface mapping object
......
......@@ -43,7 +43,7 @@ areaVectorField Us
IOobject::NO_WRITE
),
aMesh,
dimensioned<vector>("Us", dimVelocity, vector::zero)
dimensionedVector(dimVelocity, Zero)
);
dimensioned<scalar> Uinf("Uinf", dimVelocity, 1.0);
......
......@@ -12,7 +12,7 @@
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("0", dimless/dimLength, 0)
dimensionedScalar(dimless/dimLength, Zero)
);
vsm.mapToVolume(Cs, Cvf.boundaryFieldRef());
......@@ -29,7 +29,7 @@
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("zero", dimVelocity, vector::zero)
dimensionedVector(dimVelocity, Zero)
);
vsm.mapToVolume(Us, U.boundaryFieldRef());
......
......@@ -12,7 +12,7 @@
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("0", dimless/dimLength, 0)
dimensionedScalar(dimless/dimLength, Zero)
);
vsm.mapToVolume(Cs, Cvf.boundaryFieldRef());
......@@ -29,7 +29,7 @@
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("zero", dimVelocity, vector::zero)
dimensionedVector(dimVelocity, Zero)
);
vsm.mapToVolume(Us, U.boundaryFieldRef());
......
......@@ -122,7 +122,7 @@ forAll(fluidRegions, i)
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
dimensionedScalar("hRef", dimLength, 0)
dimensionedScalar("hRef", dimLength, Zero) // uses name
)
);
......
......@@ -122,7 +122,7 @@ forAll(fluidRegions, i)
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
dimensionedScalar("hRef", dimLength, 0)
dimensionedScalar("hRef", dimLength, Zero) // uses name
)
);
......@@ -223,12 +223,7 @@ forAll(fluidRegions, i)
fluidRegions[i]
),
fluidRegions[i],
dimensionedScalar
(
"dpdt",
thermoFluid[i].p().dimensions()/dimTime,
0
)
dimensionedScalar(thermoFluid[i].p().dimensions()/dimTime, Zero)
)
);
......
......@@ -51,12 +51,7 @@
IOobject::NO_WRITE
),
solidRegions[i],
dimensionedSymmTensor
(
"zero",
tkappaByCp().dimensions(),
Zero
),
dimensionedSymmTensor(tkappaByCp().dimensions(), Zero),
zeroGradientFvPatchSymmTensorField::typeName
)
);
......
......@@ -86,8 +86,8 @@ autoPtr<incompressible::turbulenceModel> turbulence
);
dimensionedScalar zeroSensitivity("0", dimVelocity*dimVelocity, 0.0);
dimensionedScalar zeroAlpha("0", dimless/dimTime, 0.0);
dimensionedScalar zeroSensitivity(dimVelocity*dimVelocity, Zero);
dimensionedScalar zeroAlpha(dimless/dimTime, Zero);
dimensionedScalar lambda
(
......
......@@ -25,7 +25,7 @@ surfaceScalarField phi
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", mesh.Sf().dimensions()*U.dimensions(), 0.0)
dimensionedScalar(mesh.Sf().dimensions()*U.dimensions(), Zero)
);
......
......@@ -47,7 +47,7 @@ if (mesh.changing())
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("pcorr", p.dimensions(), 0.0),
dimensionedScalar(p.dimensions(), Zero),
pcorrTypes
);
......
......@@ -25,7 +25,7 @@ volScalarField h0
IOobject::READ_IF_PRESENT
),
mesh,
dimensionedScalar("h0", dimLength, 0.0)
dimensionedScalar(dimLength, Zero)
);
Info<< "Creating field hU\n" << endl;
......
......@@ -120,12 +120,7 @@ int main(int argc, char *argv[])
mesh
),
mesh,
dimensionedVector
(
"0",
cloudSU.dimensions()/dimVolume,
Zero
),
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
zeroGradientFvPatchVectorField::typeName
);
......
......@@ -100,12 +100,7 @@ int main(int argc, char *argv[])
mesh
),
mesh,
dimensionedVector
(
"0",
cloudSU.dimensions()/dimVolume,
Zero
),
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
zeroGradientFvPatchVectorField::typeName
);
......
......@@ -119,7 +119,7 @@ volScalarField alphac
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("0", dimless, 0)
dimensionedScalar(dimless, Zero)
);
word kinematicCloudName("kinematicCloud");
......
......@@ -63,7 +63,7 @@ volScalarField rhoEffLagrangian
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimDensity, 0.0)
dimensionedScalar(dimDensity, Zero)
);
// dynamic pressure field - used externally (optional)
......@@ -78,7 +78,7 @@ volScalarField pDyn
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimPressure, 0.0)
dimensionedScalar(dimPressure, Zero)
);
......@@ -126,7 +126,7 @@ volScalarField Qdot
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0)
dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)
);
#include "createDpdt.H"
......
......@@ -121,7 +121,7 @@ volScalarField Qdot
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.