Skip to content
Snippets Groups Projects
Commit 65831d81 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: add End info output for solver and utilities

- for easier parsing of tutorial output etc.
parent 4d1b3396
Branches
Tags
1 merge request!2Code style
......@@ -48,35 +48,35 @@ Author
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFaMesh.H"
# include "readGravitationalAcceleration.H"
# include "createFaFields.H"
# include "readTransportProperties.H"
# include "createFvFields.H"
# include "createTimeControls.H"
Info << "\nStarting time loop\n" << endl;
# include "readSolutionControls.H"
Info << endl
<< "Numerical settings" << endl
<< " max number of iterations " << nCorr << endl
<< " min number of iterations " << minCorr << endl
<< " TOL h " << hResidualMax << endl
<< " TOL Us " << UsResidualMax << endl << endl;
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFaMesh.H"
#include "readGravitationalAcceleration.H"
#include "createFaFields.H"
#include "readTransportProperties.H"
#include "createFvFields.H"
#include "createTimeControls.H"
Info<< "\nStarting time loop\n" << endl;
#include "readSolutionControls.H"
Info<< endl
<< "Numerical settings" << endl
<< " max number of iterations " << nCorr << endl
<< " min number of iterations " << minCorr << endl
<< " TOL h " << hResidualMax << endl
<< " TOL Us " << UsResidualMax << endl << endl;
Switch initDeltaT =
runTime.controlDict().lookup("initDeltaT");
if (initDeltaT)
{
Info << "Initializing Delta T" << endl;
# include "readTimeControls.H"
# include "surfaceCourantNo.H"
Info<< "Initializing Delta T" << endl;
#include "readTimeControls.H"
#include "surfaceCourantNo.H"
runTime.setDeltaT(
min(maxCo/(CoNum + SMALL)*runTime.deltaT().value(), maxDeltaT)
);
......@@ -86,19 +86,19 @@ int main(int argc, char *argv[])
while (runTime.run())
{
# include "readSolutionControls.H"
# include "readTimeControls.H"
# include "surfaceCourantNo.H"
# include "setDeltaT.H"
#include "readSolutionControls.H"
#include "readTimeControls.H"
#include "surfaceCourantNo.H"
#include "setDeltaT.H"
runTime++;
Info << "Time = " << runTime.timeName() << nl << endl;
Info<< "Time = " << runTime.timeName() << nl << endl;
final = false;
for (int iCorr = 0; ; iCorr++)
{
# include "calcBasalstress.H"
#include "calcBasalstress.H"
const areaVectorField & tauSc = friction->tauSc();
const areaScalarField & tauSp = friction->tauSp();
......@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
}
if (dryCellCount > 0)
{
Info << "Number of dry cells = " << dryCellCount << endl;
Info<< "Number of dry cells = " << dryCellCount << endl;
}
}
......@@ -237,27 +237,34 @@ int main(int argc, char *argv[])
{
if (hResidual.initialResidual() < hResidualMax && mag(UsResidual.initialResidual()) < UsResidualMax)
{
Info << "reached residual in h = "
<< hResidual.initialResidual()
<< " < " << hResidualMax
<< " and in Us = "
<< UsResidual.initialResidual()
<< " < " << UsResidualMax
<< ", stopping loop!" << endl;
Info<< "reached residual in h = "
<< hResidual.initialResidual()
<< " < " << hResidualMax
<< " and in Us = "
<< UsResidual.initialResidual()
<< " < " << UsResidualMax
<< ", stopping loop!" << endl;
}
else
{
Info << "Reached maximum numbers of iterations, stopping loop!" << endl;
Info<< "Reached maximum numbers of iterations, "
<< "stopping loop!" << endl;
}
break;
}
if ((hResidual.initialResidual() < hResidualMax && mag(UsResidual.initialResidual()) < UsResidualMax && iCorr >= minCorr) || iCorr >= nCorr)
if
(
(
hResidual.initialResidual() < hResidualMax
&& mag(UsResidual.initialResidual()) < UsResidualMax
&& iCorr >= minCorr
)
|| iCorr >= nCorr
)
{
final = true;
}
}
if (runTime.outputTime())
......@@ -270,13 +277,16 @@ int main(int argc, char *argv[])
runTime.write();
}
Info << "ExecutionTime = "
Info<< "ExecutionTime = "
<< scalar(runTime.elapsedCpuTime())
<< " s\n" << endl << endl;
}
return(0);
Info<< nl << "End" << endl;
return 0;
}
// ************************************************************************* //
......@@ -41,10 +41,10 @@ Author
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFaMesh.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFaMesh.H"
areaVectorField c = aMesh.areaCentres();
areaVectorField n = aMesh.faceAreaNormals();
......@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
Info << "Reading field " << fieldNames[fieldsI] << endl;
Info<< "Reading field " << fieldNames[fieldsI] << endl;
areaScalarField f
(
......@@ -106,13 +106,14 @@ int main(int argc, char *argv[])
if (fdefault.value() > -1e99)
{
Info << "Setting field " << fieldNames[fieldsI] << " to default value" << endl;
Info<< "Setting field " << fieldNames[fieldsI]
<< " to default value" << endl;
f.ref() = fdefault;
}
string str = fieldNames[fieldsI];
str[0] = toupper(str[0]);
Info << "Creating field " << str << endl;
Info<< "Creating field " << str << endl;
volScalarField F
(
......@@ -132,7 +133,7 @@ int main(int argc, char *argv[])
volSurfaceMapping vsm(aMesh);
Info << "Reading regions" << endl;
Info<< "Reading regions" << endl;
const PtrList<entry> regions
(
......@@ -146,7 +147,7 @@ int main(int argc, char *argv[])
{
const entry& regionInfo = regions[areaI];
Info << "processing region " << regions[areaI].keyword() << endl;
Info<< "processing region " << regions[areaI].keyword() << endl;
if (!regionInfo.isDict())
{
FatalIOErrorIn("releaseAreaMapping.C", releaseArea)
......@@ -246,10 +247,10 @@ int main(int argc, char *argv[])
projection = n&vector(0, 0, -1);
}
Info << "linear function with" << endl
<< " x0 = " << x0 << ", dfdx = " << fx << endl
<< " y0 = " << y0 << ", dfdy = " << fy << endl
<< " z0 = " << z0 << ", dfdz = " << fz << endl;
Info<< "linear function with" << nl
<< " x0 = " << x0 << ", dfdx = " << fx << nl
<< " y0 = " << y0 << ", dfdy = " << fy << nl
<< " z0 = " << z0 << ", dfdz = " << fz << endl;
points.resize(vertices.size());
......@@ -291,16 +292,17 @@ int main(int argc, char *argv[])
}
}
Info << "Writing fields" << endl;
Info<< "Writing fields" << endl;
vsm.mapToVolume(f, F.boundaryFieldRef());
f.write();
F.write();
}
return(0);
Info<< nl << "End" << endl;
return 0;
}
// ************************************************************************* //
......@@ -40,13 +40,12 @@ Author
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
const word dictName("slopeMeshDict");
const word polyMeshDir = polyMesh::meshSubDir;
IOdictionary demMeshDict
(
IOobject
......@@ -75,7 +74,6 @@ int main(int argc, char *argv[])
);
label cellCountX, cellCountY;
scalar minX, maxX, minY, maxY, meshH;
Switch tri;
......@@ -104,10 +102,14 @@ int main(int argc, char *argv[])
//y-paralell-faces
Info << "creating Mesh with "<< cellCount << " cells, "<< faceCount << " faces and " << pointCount << " points" << endl;
Info << "x = [" << minX << ";" << maxX << "] (" << cellCountX << ")" << endl;
Info << "y = [" << minY << ";" << maxY << "] (" << cellCountY << ")" << endl;
Info << "cellsize = " << dx << "m x " << dy << "m" << endl;
Info<< "creating Mesh with "
<< cellCount << " cells, "
<< faceCount << " faces and "
<< pointCount << " points" << nl;
Info<< "x = [" << minX << ";" << maxX << "] (" << cellCountX << ")" << nl
<< "y = [" << minY << ";" << maxY << "] (" << cellCountY << ")" << nl
<< "cellsize = " << dx << "m x " << dy << "m" << endl;
pointField points(pointCount);
......@@ -203,8 +205,6 @@ int main(int argc, char *argv[])
}
minXboundary = lf;
//creating x-planes
......@@ -362,7 +362,7 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
/*
Info << "Points of Interest:" << endl;
Info<< "Points of Interest:" << endl;
const PtrList<entry> pois
(
......@@ -391,11 +391,14 @@ int main(int argc, char *argv[])
poiDict.lookup("localPosition") >> localPos;
Info << poiNames[poiI] << "(" << localPos << ")" << " = " << elevation->X(localPos) << endl;
Info<< poiNames[poiI] << "(" << localPos << ")" << " = " << elevation->X(localPos) << endl;
}*/
return(0);
Info<< nl << "End" << endl;
return 0;
}
// ************************************************************************* //
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