Commit 28c8d896 authored by Matti Rauter's avatar Matti Rauter

Merge branch 'code-style' into 'master'

Code style

See merge request !2
parents def72acc e06736a6
faSavageHutterFoam.C
EXE = $(FOAM_USER_APPBIN)/faSavageHutterFoam
......@@ -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;
}
// ************************************************************************* //
......@@ -12,17 +12,17 @@ IOdictionary transportProperties
autoPtr<frictionModel> friction
(
frictionModel::New("frictionModel", transportProperties, Us, h, pb)
frictionModel::New(transportProperties, Us, h, pb)
);
autoPtr<entrainmentModel> entrainment
(
entrainmentModel::New("entrainment", transportProperties, Us, h, hentrain, pb, tau)
entrainmentModel::New(transportProperties, Us, h, hentrain, pb, tau)
);
autoPtr<depositionModel> deposition
(
depositionModel::New("deposition", transportProperties, Us, h, hentrain, pb, tau)
depositionModel::New(transportProperties, Us, h, hentrain, pb, tau)
);
dimensionedScalar hmin(transportProperties.lookup("hmin"));
......
......@@ -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;
}
// ************************************************************************* //
slopeMesh.C
elevationModels/elevationModel/elevationModel.C
elevationModels/elevationModel/newElevationModel.C
elevationModels/elevationModel/elevationModelNew.C
elevationModels/simpleSlope/SimpleSlope.C
EXE = $(FOAM_USER_APPBIN)/slopeMesh
......@@ -21,7 +21,6 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::elevationModels
......@@ -67,12 +66,12 @@ namespace Foam
class elevationModel
{
protected:
// Protected data
word name_;
dictionary elevationProperties_;
......@@ -135,7 +134,7 @@ public:
// Member Functions
//- Return the global point X for the local point x
virtual vector X(const vector &x) const = 0;
virtual vector X(const vector& x) const = 0;
//- Return the elevation properties dictionary
const dictionary& elevationProperties() const
......
......@@ -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;
}
// ************************************************************************* //
entrainment = entrainmentModels
deposition = deposition
$(deposition)/depositionModel/depositionModel.C
$(deposition)/depositionModel/depositionModelNew.C
$(deposition)/depositionOff/depositionOff.C
$(deposition)/Stoppingprofile/Stoppingprofile.C
entrainment = entrainment
$(entrainment)/entrainmentModel/entrainmentModel.C
$(entrainment)/entrainmentModel/newEntrainmentModel.C
$(entrainment)/depositionModel/depositionModel.C
$(entrainment)/depositionModel/newDepositionModel.C
$(entrainment)/entrainmentModel/entrainmentModelNew.C
$(entrainment)/entrainmentOff/entrainmentOff.C
$(entrainment)/Erosionenergy/Erosionenergy.C
$(entrainment)/Front/Front.C
$(entrainment)/IsslerFC/IsslerFC.C
$(entrainment)/Medina/Medina.C
$(entrainment)/depositionOff/depositionOff.C
$(entrainment)/Stopingprofile/Stopingprofile.C
friction = frictionModels
friction = friction
$(friction)/frictionModel/frictionModel.C
$(friction)/frictionModel/newFrictionModel.C
$(friction)/frictionModel/frictionModelNew.C
$(friction)/PoliquenForterre/PoliquenForterre.C
$(friction)/muI/muI.C
$(friction)/Voellmy/Voellmy.C
......
......@@ -28,7 +28,7 @@ Author
#include "fvCFD.H"
#include "faCFD.H"
#include "Stopingprofile.H"
#include "Stoppingprofile.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -37,28 +37,27 @@ namespace Foam
{
namespace depositionModels
{
defineTypeNameAndDebug(Stopingprofile, 0);
addToRunTimeSelectionTable(depositionModel, Stopingprofile, dictionary);
defineTypeNameAndDebug(Stoppingprofile, 0);
addToRunTimeSelectionTable(depositionModel, Stoppingprofile, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::depositionModels::Stopingprofile::Stopingprofile
Foam::depositionModels::Stoppingprofile::Stoppingprofile
(
const word& name,
const dictionary& depositionProperties,
const areaVectorField &Us,
const areaScalarField &h,
const areaScalarField &hentrain,
const areaScalarField &pb,
const areaVectorField &tau
const areaVectorField& Us,
const areaScalarField& h,
const areaScalarField& hentrain,
const areaScalarField& pb,
const areaVectorField& tau
)
:
depositionModel(name, depositionProperties, Us, h, hentrain, pb, tau),
ud_(depositionProperties.subDict("StopingprofileCoeffs").lookup("ud")),
ad_(depositionProperties.subDict("StopingprofileCoeffs").lookup("ad")),
depositionModel(type(), depositionProperties, Us, h, hentrain, pb, tau),
ud_(coeffDict_.lookup("ud")),
ad_(coeffDict_.lookup("ad")),
gs_(Us.db().lookupObject<areaVectorField>("gs")),
gn_(Us.db().lookupObject<areaScalarField>("gn"))
{
......@@ -69,8 +68,8 @@ Foam::depositionModels::Stopingprofile::Stopingprofile
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::areaScalarField &Foam::depositionModels::Stopingprofile::Sd() const
const Foam::areaScalarField&
Foam::depositionModels::Stoppingprofile::Sd() const
{
const dimensionedScalar smallVel("small", dimVelocity, SMALL);
......@@ -97,15 +96,16 @@ const Foam::areaScalarField &Foam::depositionModels::Stopingprofile::Sd() const
return Sd_;
}
bool Foam::depositionModels::Stopingprofile::read
bool Foam::depositionModels::Stoppingprofile::read
(
const dictionary& depositionProperties
)
{
depositionModel::read(depositionProperties);
readDict(type(), depositionProperties);
depositionProperties_.lookup("ud") >> ud_;
depositionProperties_.lookup("ad") >> ad_;
coeffDict_.lookup("ud") >> ud_;
coeffDict_.lookup("ad") >> ad_;
return true;
}
......
......@@ -22,21 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::depositionModels::Stopingprofile
Foam::depositionModels::Stoppingprofile
Description
A deposition model following a new approach. Presented at OFW12 in Exeter.
SourceFiles
Stopingprofile.C
Stoppingprofile.C
Author
Matthias Rauter matthias.rauter@uibk.ac.at
\*---------------------------------------------------------------------------*/
#ifndef Stopingprofile_H
#define Stopingprofile_H
#ifndef Stoppingprofile_H
#define Stoppingprofile_H
#include "depositionModel.H"
#include "dimensionedScalar.H"
......@@ -50,7 +50,6 @@ Author
#include "faMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
......@@ -59,19 +58,19 @@ namespace depositionModels
{
/*---------------------------------------------------------------------------*\
Class Stopingprofile Declaration
Class Stoppingprofile Declaration
\*---------------------------------------------------------------------------*/
class Stopingprofile
class Stoppingprofile
:
public depositionModel
{
// Private data
//Deposion velocity parameter u_d
//- Deposition velocity parameter u_d
dimensionedScalar ud_;
//Formfactor for deposition curve
//- Form-factor for deposition curve
dimensionedScalar ad_;
//- Reference to the gravitation fields
......@@ -81,15 +80,14 @@ class Stopingprofile
public:
//- Runtime type information
TypeName("Stopingprofile");
TypeName("Stoppingprofile");
// Constructors
//- Construct from components
Stopingprofile
Stoppingprofile
(
const word& name,
const dictionary& frictionProperties,
const areaVectorField& Us,
const areaScalarField& h,
......@@ -100,12 +98,13 @@ public:
//- Destructor
virtual ~Stopingprofile() = default;
virtual ~Stoppingprofile() = default;
// Member Functions
//- Return Sink by deposition
virtual const areaScalarField &Sd() const;
virtual const areaScalarField& Sd() const;
//- Read depositionProperties dictionary
virtual bool read(const dictionary& depositionProperties);
......
......@@ -39,21 +39,38 @@ namespace Foam
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::depositionModel::readDict
(
const word& type,
const dictionary& dict
)
{
depositionProperties_ = dict;
coeffDict_ = depositionProperties_.optionalSubDict(type + "Coeffs");
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::depositionModel::depositionModel
(
const word& name,
const word& type,
const dictionary& depositionProperties,
const areaVectorField &Us,
const areaScalarField &h,
const areaScalarField &hentrain,
const areaScalarField &pb,
const areaVectorField &tau
const areaVectorField& Us,
const areaScalarField& h,
const areaScalarField& hentrain,
const areaScalarField& pb,
const areaVectorField& tau
)
:
name_(name),
rho_(depositionProperties.lookup("rho")),
depositionProperties_(depositionProperties),
coeffDict_
(
depositionProperties_.optionalSubDict(type + "Coeffs")
),
rho_(depositionProperties_.lookup("rho")),
Us_(Us),
h_(h),
hentrain_(hentrain),
......@@ -78,14 +95,4 @@ Foam::depositionModel::depositionModel
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::depositionModel::read(const dictionary& depositionProperties)
{
depositionProperties_ = depositionProperties;
return true;
}
// ************************************************************************* //
......@@ -35,7 +35,7 @@ Description
SourceFiles
depositionModel.C
newdepositionModel.C
depositionModelNew.C
Author
Matthias Rauter matthias.rauter@uibk.ac.at
......@@ -61,7 +61,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class depositionModel Declaration
Class depositionModel Declaration
\*---------------------------------------------------------------------------*/
class depositionModel
......@@ -70,33 +70,38 @@ protected:
// Protected data
word name_;
dictionary depositionProperties_;
//- Model coefficients dictionary
dictionary coeffDict_;
//- The density
dimensionedScalar rho_;
//- Reference to the surface velocity field
const areaVectorField &Us_;
const areaVectorField& Us_;
//- Reference to the flow height field
const areaScalarField &h_;
const areaScalarField& h_;