Commit 43beb060 authored by Henry Weller's avatar Henry Weller
Browse files

Standardized cell, patch and face loop index names

parent 2d5ff316
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -131,11 +131,11 @@ int main(int argc, char *argv[])
protectedCell = 0;
}
forAll(betav, cellI)
forAll(betav, celli)
{
if (betav[cellI] < 0.99)
if (betav[celli] < 0.99)
{
protectedCell[cellI] = 1;
protectedCell[celli] = 1;
}
}
......
......@@ -155,11 +155,11 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::D
volScalarField& D(tmpD.ref());
forAll(p, cellI)
forAll(p, celli)
{
D[cellI] =
localThermo.alphah(p[cellI], T[cellI])
/localThermo.rho(p[cellI], T[cellI]);
D[celli] =
localThermo.alphah(p[celli], T[celli])
/localThermo.rho(p[celli], T[celli]);
}
D /= Le_;
......@@ -209,11 +209,11 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
volScalarField& L(tmpL.ref());
forAll(p, cellI)
forAll(p, celli)
{
L[cellI] =
localThermo.Ha(p[cellI], Tf[cellI])
- otherLocalThermo.Ha(otherP[cellI], Tf[cellI]);
L[celli] =
localThermo.Ha(p[celli], Tf[celli])
- otherLocalThermo.Ha(otherP[celli], Tf[celli]);
}
return tmpL;
......
......@@ -85,23 +85,23 @@ alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::yPlusTherm
tmp<scalarField> typsf(new scalarField(this->size()));
scalarField& ypsf = typsf.ref();
forAll(ypsf, faceI)
forAll(ypsf, facei)
{
scalar ypt = 11.0;
for (int i=0; i<maxIters_; i++)
{
scalar f = ypt - (log(E_*ypt)/kappa_ + P[faceI])/Prat[faceI];
scalar df = 1 - 1.0/(ypt*kappa_*Prat[faceI]);
scalar f = ypt - (log(E_*ypt)/kappa_ + P[facei])/Prat[facei];
scalar df = 1 - 1.0/(ypt*kappa_*Prat[facei]);
scalar yptNew = ypt - f/df;
if (yptNew < VSMALL)
{
ypsf[faceI] = 0;
ypsf[facei] = 0;
}
else if (mag(yptNew - ypt) < tolerance_)
{
ypsf[faceI] = yptNew;
ypsf[facei] = yptNew;
}
else
{
......@@ -109,7 +109,7 @@ alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::yPlusTherm
}
}
ypsf[faceI] = ypt;
ypsf[facei] = ypt;
}
return typsf;
......@@ -200,32 +200,32 @@ alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::calcAlphat
scalarField& alphatConv = talphatConv.ref();
// Populate boundary values
forAll(alphatConv, faceI)
forAll(alphatConv, facei)
{
// Evaluate new effective thermal diffusivity
scalar alphaEff = 0.0;
if (yPlus[faceI] < yPlusTherm[faceI])
if (yPlus[facei] < yPlusTherm[facei])
{
scalar A = qDot[faceI]*rhow[faceI]*uTau[faceI]*y[faceI];
scalar B = qDot[faceI]*Pr[faceI]*yPlus[faceI];
scalar C = Pr[faceI]*0.5*rhow[faceI]*uTau[faceI]*sqr(magUp[faceI]);
scalar A = qDot[facei]*rhow[facei]*uTau[facei]*y[facei];
scalar B = qDot[facei]*Pr[facei]*yPlus[facei];
scalar C = Pr[facei]*0.5*rhow[facei]*uTau[facei]*sqr(magUp[facei]);
alphaEff = A/(B + C + VSMALL);
}
else
{
scalar A = qDot[faceI]*rhow[faceI]*uTau[faceI]*y[faceI];
scalar A = qDot[facei]*rhow[facei]*uTau[facei]*y[facei];
scalar B =
qDot[faceI]*Prt_*(1.0/kappa_*log(E_*yPlus[faceI]) + P[faceI]);
qDot[facei]*Prt_*(1.0/kappa_*log(E_*yPlus[facei]) + P[facei]);
scalar magUc =
uTau[faceI]/kappa_*log(E_*yPlusTherm[faceI]) - mag(Uw[faceI]);
uTau[facei]/kappa_*log(E_*yPlusTherm[facei]) - mag(Uw[facei]);
scalar C =
0.5*rhow[faceI]*uTau[faceI]
*(Prt_*sqr(magUp[faceI]) + (Pr[faceI] - Prt_)*sqr(magUc));
0.5*rhow[facei]*uTau[facei]
*(Prt_*sqr(magUp[facei]) + (Pr[facei] - Prt_)*sqr(magUc));
alphaEff = A/(B + C + VSMALL);
}
// Update convective heat transfer turbulent thermal diffusivity
alphatConv[faceI] = max(0.0, alphaEff - alphaw[faceI]);
alphatConv[facei] = max(0.0, alphaEff - alphaw[facei]);
}
return talphatConv;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -88,9 +88,9 @@ int main(int argc, char *argv[])
dimensionedScalar("aggomeration", dimless, 0.0)
);
scalarField& fld = scalarAgglomeration.internalField();
forAll(fld, cellI)
forAll(fld, celli)
{
fld[cellI] = cellToCoarse[cellI];
fld[celli] = cellToCoarse[celli];
}
fld /= max(fld);
scalarAgglomeration.correctBoundaryConditions();
......@@ -167,9 +167,9 @@ int main(int argc, char *argv[])
dimensionedScalar("aggomeration", dimless, 0.0)
);
scalarField& fld = scalarAgglomeration.internalField();
forAll(fld, cellI)
forAll(fld, celli)
{
fld[cellI] = cellToCoarse[cellI];
fld[celli] = cellToCoarse[celli];
}
if (normalise)
{
......@@ -185,9 +185,9 @@ int main(int argc, char *argv[])
label vertI = 0;
// Write all mesh cc
forAll(mesh.cellCentres(), cellI)
forAll(mesh.cellCentres(), celli)
{
meshTools::writeOBJ(str, mesh.cellCentres()[cellI]);
meshTools::writeOBJ(str, mesh.cellCentres()[celli]);
vertI++;
}
......@@ -205,9 +205,9 @@ int main(int argc, char *argv[])
forAll(cellLabels, i)
{
label cellI = cellLabels[i];
label celli = cellLabels[i];
str << "l " << cellI+1 << ' ' << vertI << nl;
str << "l " << celli+1 << ' ' << vertI << nl;
}
}
}
......
......@@ -114,9 +114,9 @@ int main(int argc, char *argv[])
dimensionedScalar("patchDist", dimLength, 0.0)
);
scalarField pf(vsf.boundaryField()[patch.index()].size());
forAll(pf, faceI)
forAll(pf, facei)
{
pf[faceI] = Foam::sqrt(allFaceInfo[faceI].distSqr());
pf[facei] = Foam::sqrt(allFaceInfo[facei].distSqr());
}
vsf.boundaryFieldRef()[patch.index()] = pf;
......
......@@ -72,10 +72,10 @@ using namespace Foam;
// const faceList& localFaces = p.localFaces();
// const vectorField& faceAreas = mesh.faceAreas();
//
// forAll(localFaces, faceI)
// forAll(localFaces, facei)
// {
// const face& f = localFaces[faceI];
// const vector& n = faceAreas[meshFaces[faceI]];
// const face& f = localFaces[facei];
// const vector& n = faceAreas[meshFaces[facei]];
// forAll(f, fp)
// {
// extrudeN[f[fp]] += n;
......
......@@ -168,13 +168,13 @@ int main(int argc, char *argv[])
// stencilPoints
// );
//
// forAll(stencilPoints, faceI)
// forAll(stencilPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"faceEdgeCell" + Foam::name(faceI) + ".obj",
// mesh.faceCentres()[faceI],
// stencilPoints[faceI]
// runTime.path()/"faceEdgeCell" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// stencilPoints[facei]
// );
// }
// }
......@@ -200,14 +200,14 @@ int main(int argc, char *argv[])
// //{
// // const labelListList& stencil = addressing.stencil();
// // List<List<scalar>> stencilWeights(stencil.size());
// // forAll(stencil, faceI)
// // forAll(stencil, facei)
// // {
// // const labelList& fStencil = stencil[faceI];
// // const labelList& fStencil = stencil[facei];
// //
// // if (fStencil.size() > 0)
// // {
// // // Uniform weights
// // stencilWeights[faceI] = scalarList
// // stencilWeights[facei] = scalarList
// // (
// // fStencil.size(),
// // 1.0/fStencil.size()
......@@ -230,15 +230,15 @@ int main(int argc, char *argv[])
// stencilPoints
// );
//
// forAll(stencilPoints, faceI)
// forAll(stencilPoints, facei)
// {
// if (stencilPoints[faceI].size() >= 15)
// if (stencilPoints[facei].size() >= 15)
// {
// writeStencilOBJ
// (
// runTime.path()/"centredFace" + Foam::name(faceI) + ".obj",
// mesh.faceCentres()[faceI],
// stencilPoints[faceI]
// runTime.path()/"centredFace" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// stencilPoints[facei]
// );
// }
// }
......@@ -267,13 +267,13 @@ int main(int argc, char *argv[])
// // stencilPoints
// //);
// //
// //forAll(stencilPoints, faceI)
// //forAll(stencilPoints, facei)
// //{
// // writeStencilOBJ
// // (
// // runTime.path()/"centredPoint" + Foam::name(faceI) + ".obj",
// // mesh.faceCentres()[faceI],
// // stencilPoints[faceI]
// // runTime.path()/"centredPoint" + Foam::name(facei) + ".obj",
// // mesh.faceCentres()[facei],
// // stencilPoints[facei]
// // );
// //}
// }
......@@ -302,13 +302,13 @@ int main(int argc, char *argv[])
// // stencilPoints
// //);
// //
// //forAll(stencilPoints, faceI)
// //forAll(stencilPoints, facei)
// //{
// // writeStencilOBJ
// // (
// // runTime.path()/"centredEdge" + Foam::name(faceI) + ".obj",
// // mesh.faceCentres()[faceI],
// // stencilPoints[faceI]
// // runTime.path()/"centredEdge" + Foam::name(facei) + ".obj",
// // mesh.faceCentres()[facei],
// // stencilPoints[facei]
// // );
// //}
// }
......@@ -340,13 +340,13 @@ int main(int argc, char *argv[])
// ownPoints
// );
//
// forAll(ownPoints, faceI)
// forAll(ownPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"ownFEC" + Foam::name(faceI) + ".obj",
// mesh.faceCentres()[faceI],
// ownPoints[faceI]
// runTime.path()/"ownFEC" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// ownPoints[facei]
// );
// }
// }
......@@ -361,13 +361,13 @@ int main(int argc, char *argv[])
// neiPoints
// );
//
// forAll(neiPoints, faceI)
// forAll(neiPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"neiFEC" + Foam::name(faceI) + ".obj",
// mesh.faceCentres()[faceI],
// neiPoints[faceI]
// runTime.path()/"neiFEC" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// neiPoints[facei]
// );
// }
// }
......@@ -400,13 +400,13 @@ int main(int argc, char *argv[])
// ownPoints
// );
//
// forAll(ownPoints, faceI)
// forAll(ownPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"ownCFC" + Foam::name(faceI) + ".obj",
// mesh.faceCentres()[faceI],
// ownPoints[faceI]
// runTime.path()/"ownCFC" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// ownPoints[facei]
// );
// }
// }
......@@ -421,13 +421,13 @@ int main(int argc, char *argv[])
// neiPoints
// );
//
// forAll(neiPoints, faceI)
// forAll(neiPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"neiCFC" + Foam::name(faceI) + ".obj",
// mesh.faceCentres()[faceI],
// neiPoints[faceI]
// runTime.path()/"neiCFC" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// neiPoints[facei]
// );
// }
// }
......@@ -458,13 +458,13 @@ int main(int argc, char *argv[])
stencilPoints
);
forAll(stencilPoints, cellI)
forAll(stencilPoints, celli)
{
writeStencilOBJ
(
runTime.path()/"centredCECCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI],
stencilPoints[cellI]
runTime.path()/"centredCECCell" + Foam::name(celli) + ".obj",
mesh.cellCentres()[celli],
stencilPoints[celli]
);
}
}
......@@ -486,13 +486,13 @@ int main(int argc, char *argv[])
stencilPoints
);
forAll(stencilPoints, cellI)
forAll(stencilPoints, celli)
{
writeStencilOBJ
(
runTime.path()/"centredCPCCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI],
stencilPoints[cellI]
runTime.path()/"centredCPCCell" + Foam::name(celli) + ".obj",
mesh.cellCentres()[celli],
stencilPoints[celli]
);
}
}
......@@ -514,13 +514,13 @@ int main(int argc, char *argv[])
stencilPoints
);
forAll(stencilPoints, cellI)
forAll(stencilPoints, celli)
{
writeStencilOBJ
(
runTime.path()/"centredCFCCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI],
stencilPoints[cellI]
runTime.path()/"centredCFCCell" + Foam::name(celli) + ".obj",
mesh.cellCentres()[celli],
stencilPoints[celli]
);
}
}
......@@ -538,12 +538,12 @@ int main(int argc, char *argv[])
// );
// for (label faci = 0; faci < mesh.nInternalFaces(); faci++)
// {
// const scalarList& stData = stencilData[faceI];
// const scalarList& stWeight = fit[faceI];
// const scalarList& stData = stencilData[facei];
// const scalarList& stWeight = fit[facei];
//
// forAll(stData, i)
// {
// sf[faceI] += stWeight[i]*stData[i];
// sf[facei] += stWeight[i]*stData[i];
// }
// }
// See finiteVolume/lnInclude/leastSquaresGrad.C
......
......@@ -150,9 +150,9 @@ int main(int argc, char *argv[])
List<point> compactFld(map.constructSize(), Zero);
// Insert my internal values
forAll(fld, cellI)
forAll(fld, celli)
{
compactFld[cellI] = fld[cellI];
compactFld[celli] = fld[celli];
}
// Insert my boundary values
label nCompact = fld.size();
......@@ -172,27 +172,27 @@ int main(int argc, char *argv[])
// 2. Pull to stencil
stencilPoints.setSize(stencil.size());
forAll(stencil, cellI)
forAll(stencil, celli)
{
const labelList& compactCells = stencil[cellI];
const labelList& compactCells = stencil[celli];
stencilPoints[cellI].setSize(compactCells.size());
stencilPoints[celli].setSize(compactCells.size());
forAll(compactCells, i)
{
stencilPoints[cellI][i] = compactFld[compactCells[i]];
stencilPoints[celli][i] = compactFld[compactCells[i]];
}
}
}
forAll(stencilPoints, cellI)
forAll(stencilPoints, celli)
{
writeStencilOBJ
(
runTime.path()/"centredCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI],
stencilPoints[cellI]
runTime.path()/"centredCell" + Foam::name(celli) + ".obj",
mesh.cellCentres()[celli],
stencilPoints[celli]
);
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -66,26 +66,26 @@ int main(int argc, char *argv[])
}
// convert from local to global and back.
for (label cellI = 0; cellI < mesh.nCells(); cellI++)
for (label celli = 0; celli < mesh.nCells(); celli++)
{
// to global index
label globalCellI = globalNumbering.toGlobal(cellI);
label globalCellI = globalNumbering.toGlobal(celli);
// and back
label procI = globalNumbering.whichProcID(globalCellI);
label localCellI = globalNumbering.toLocal(globalCellI);
if (procI != Pstream::myProcNo() || localCellI != cellI)
if (procI != Pstream::myProcNo() || localCellI != celli)
{
FatalErrorInFunction
<< "Problem. cellI:" << cellI << " localCellI:" << localCellI
<< "Problem. celli:" << celli << " localCellI:" << localCellI
<< " procI:" << procI << abort(FatalError);
}
if (!globalNumbering.isLocal(globalCellI))
{
FatalErrorInFunction
<< "Problem. cellI:" << cellI << " globalCellI:" << globalCellI
<< "Problem. celli:" << celli << " globalCellI:" << globalCellI
<< " not local" << abort(FatalError);
}
}
......
......@@ -196,16 +196,16 @@ int main(int argc, char *argv[])
}
{
const label cellI = args.optionLookupOrDefault("cell", 0);
const label celli = args.optionLookupOrDefault("cell", 0);
tensorField mI(momentOfInertia::meshInertia(mesh));
tensor& J = mI[cellI];
tensor& J = mI[celli];
vector eVal = eigenValues(J);
Info<< nl
<< "Inertia tensor of cell " << cellI << " " << J << nl
<< "Inertia tensor of cell " << celli << " " << J << nl
<< "eigenValues (principal moments) " << eVal << endl;
J /= cmptMax(eVal);
......@@ -215,16 +215,16 @@ int main(int argc, char *argv[])
Info<< "eigenVectors (principal axes, from normalised inertia) " << eVec
<< endl;
OFstream str("cell_" + name(cellI) + "_inertia.obj");
OFstream str("cell_" + name(celli) + "_inertia.obj");
Info<< nl << "Writing scaled principal axes of cell " << cellI << " to "