Skip to content
Commits on Source (7)
......@@ -5,7 +5,7 @@
(
"h",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -20,7 +20,7 @@
(
"Us",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -34,7 +34,7 @@
(
"c",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -48,7 +48,7 @@
(
"hentrain",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......@@ -62,7 +62,7 @@
(
"phis",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......@@ -75,7 +75,7 @@
(
"phi2s",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......@@ -91,7 +91,7 @@
(
"gn",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -104,7 +104,7 @@
(
"gs",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -117,7 +117,7 @@
(
"geff",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -130,7 +130,7 @@
(
"Sd",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -144,7 +144,7 @@
(
"Sa",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -159,7 +159,7 @@
(
"tau",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -173,7 +173,7 @@
(
"dist",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......
......@@ -5,7 +5,7 @@
(
"h",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -20,7 +20,7 @@
(
"Us",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -34,7 +34,7 @@
(
"phis",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......@@ -48,7 +48,7 @@
(
"phi2s",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......@@ -64,7 +64,7 @@
(
"gn",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -77,7 +77,7 @@
(
"gs",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -90,7 +90,7 @@
(
"pb",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -104,7 +104,7 @@
(
"tau",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -119,7 +119,7 @@
(
"hentrain",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......
......@@ -5,7 +5,7 @@
(
"h2",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -20,7 +20,7 @@
(
"Us2",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -33,7 +33,7 @@
(
"UsDiff",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -47,7 +47,7 @@
(
"c2",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -60,7 +60,7 @@
(
"powderLayerAlone",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -74,7 +74,7 @@
(
"phis2",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......@@ -87,7 +87,7 @@
(
"phi2s2",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......@@ -100,7 +100,7 @@
(
"geff",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -113,7 +113,7 @@
(
"Sdp",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -127,7 +127,7 @@
(
"Spd",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -141,7 +141,7 @@
(
"Sap",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -155,7 +155,7 @@
(
"tau2",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......
......@@ -5,7 +5,7 @@
(
"h1",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -20,7 +20,7 @@
(
"Us1",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -34,7 +34,7 @@
(
"phis1",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......@@ -48,15 +48,14 @@
(
"phi2s1",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fac::interpolate(h1*Us1) & aMesh.Le()
);
areaVectorField n = aMesh.faceAreaNormals();
const areaVectorField& n = aMesh.faceAreaNormals();
areaScalarField gn
(
......@@ -64,7 +63,7 @@
(
"gn",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -77,7 +76,7 @@
(
"gs",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -90,7 +89,7 @@
(
"pb",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -104,7 +103,7 @@
(
"tau",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
......@@ -119,7 +118,7 @@
(
"hentrain",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
......
......@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
(
fieldNames[fieldsI],
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
......@@ -175,7 +175,7 @@ int main(int argc, char *argv[])
(
"projection",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -256,7 +256,10 @@ int main(int argc, char *argv[])
shapefile shp;
fileName filename = areaDict.get<fileName>("filename");
filename.expand();
shp.read(filename);
if (!shp.read(filename.lessExt()))
{
Info << "Unable to open shapefile \"" << filename << "\"";
}
if (shp.shptype() != shapefile::POLYGON &&
shp.shptype() != shapefile::POLYGONM &&
......@@ -291,7 +294,7 @@ int main(int argc, char *argv[])
(
"projection",
runTime.timeName(),
mesh,
aMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
......@@ -560,19 +563,18 @@ int main(int argc, char *argv[])
Switch linInterpol = interpolation == "linear";
Switch nnInterpol = interpolation == "nearestneighbor";
if (linInterpol)
{
forAll(c.internalField(), vi)
{
f[vi] = grid.interpolate(c[vi].x(), c[vi].y());
f[vi] = grid.interpolate(c[vi].x()-offset.x(), c[vi].y()-offset.y());
}
}
else if (nnInterpol)
{
forAll(c.internalField(), vi)
{
f[vi] = grid.interpolateNN(c[vi].x(), c[vi].y());
f[vi] = grid.interpolateNN(c[vi].x()-offset.x(), c[vi].y()-offset.y());
}
}
else
......
......@@ -54,5 +54,7 @@ $(functionObjects)/shapefileWrite.C
$(functionObjects)/gridfileWrite.C
$(functionObjects)/autoAreaToVolumeMapping.C
$(functionObjects)/isoLine.C
$(functionObjects)/peakValues.C
$(functionObjects)/totalVolume.C
LIB = $(FOAM_MODULE_LIBBIN)/libfaAvalanche
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 Matthias Rauter
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -73,15 +74,12 @@ Foam::functionObjects::autoAreaToVolumeMapping::autoAreaToVolumeMapping
const dictionary& dict
)
:
regionFunctionObject(name, runTime, dict),
aMesh_
(
obr_.lookupObject<faMesh>("faMesh")
),
mesh_
(
obr_.lookupObject<fvMesh>("data")
),
fvMeshFunctionObject(name, runTime, dict),
#if (OPENFOAM < 2310)
aMesh_(mesh_.lookupObject<faMesh>("faMesh")),
#else
aMesh_(faMesh::mesh(mesh_)),
#endif
writeOption_(ANY_WRITE),
objectNames_(),
prefix_("fa_"),
......@@ -95,7 +93,7 @@ Foam::functionObjects::autoAreaToVolumeMapping::autoAreaToVolumeMapping
bool Foam::functionObjects::autoAreaToVolumeMapping::read(const dictionary& dict)
{
regionFunctionObject::read(dict);
fvMeshFunctionObject::read(dict);
if (dict.found("field"))
{
......@@ -140,7 +138,10 @@ bool Foam::functionObjects::autoAreaToVolumeMapping::write()
}
// Get selection
const wordList selectedNames(obr_.sortedNames<regIOobject>(objectNames_));
const wordList selectedNames
(
aMesh_.thisDb().sortedNames(objectNames_)
);
// Warning if anything was missed
bitSet missed(objectNames_.size());
......@@ -160,20 +161,17 @@ bool Foam::functionObjects::autoAreaToVolumeMapping::write()
WarningInFunction
<< "No corresponding selection for "
<< flatOutput(subset(missed, objectNames_)) << nl
<< "Available objects in database:"
<< nl << obr_.sortedToc()
<< "Available objects in database:" << nl
<< aMesh_.thisDb().sortedToc()
<< endl;
}
for (const word& objName : selectedNames)
{
regIOobject& obj = obr_.lookupObjectRef<regIOobject>(objName);
const regIOobject& obj =
aMesh_.thisDb().lookupObject<regIOobject>(objName);
if (obj.type() != "areaScalarField" &&
obj.type() != "areaVectorField" &&
obj.type() != "areaSphericalTensorField" &&
obj.type() != "areaSymmTensorField" &&
obj.type() != "areaTensorField")
if (!fieldTypes::area.contains(obj.type()))
{
continue;
}
......@@ -186,7 +184,6 @@ bool Foam::functionObjects::autoAreaToVolumeMapping::write()
{
continue;
}
break;
}
case NO_WRITE:
......@@ -195,7 +192,6 @@ bool Foam::functionObjects::autoAreaToVolumeMapping::write()
{
continue;
}
break;
}
case ANY_WRITE:
......@@ -217,7 +213,8 @@ bool Foam::functionObjects::autoAreaToVolumeMapping::write()
}
if (obj.name().ends_with("_0"))
{
Info << " ignoring old " << obj.type() <<" " << obj.name() << endl;
Info<< " ignoring old " << obj.type()
<< ' ' << obj.name() << endl;
continue;
}
else if
......@@ -226,113 +223,51 @@ bool Foam::functionObjects::autoAreaToVolumeMapping::write()
&& obr_.time().writeTime()
)
{
Info << " automatically writing " << obj.type() <<" " << obj.name() << endl;
Info<< " automatically writing " << obj.type()
<< ' ' << obj.name() << endl;
}
else
{
Info << " writing " << obj.type() <<" " << obj.name() << endl;
Info<< " writing " << obj.type()
<< ' ' << obj.name() << endl;
}
if (obj.type() == "areaScalarField")
{
const areaScalarField &f = obr_.lookupObjectRef<areaScalarField>(obj.name());
volScalarField F
(
IOobject
(
prefix_+f.name(),
obr_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(f.dimensions())
);
vsm_.mapToVolume(f, F.boundaryFieldRef());
F.write();
}
else if(obj.type() == "areaVectorField")
{
const areaVectorField &f = obr_.lookupObjectRef<areaVectorField>(obj.name());
volVectorField F
(
IOobject
(
prefix_+f.name(),
obr_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedVector(f.dimensions())
);
vsm_.mapToVolume(f, F.boundaryFieldRef());
F.write();
}
else if(obj.type() == "areaSphericalTensorField")
{
const areaSphericalTensorField &f = obr_.lookupObjectRef<areaSphericalTensorField>(obj.name());
volSphericalTensorField F
(
IOobject
(
prefix_+f.name(),
obr_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedSphericalTensor(f.dimensions())
);
vsm_.mapToVolume(f, F.boundaryFieldRef());
F.write();
}
else if(obj.type() == "areaSymmTensorField")
{
const areaSymmTensorField &f = obr_.lookupObjectRef<areaSymmTensorField>(obj.name());
volSymmTensorField F
(
IOobject
(
prefix_+f.name(),
obr_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedSymmTensor(f.dimensions())
);
vsm_.mapToVolume(f, F.boundaryFieldRef());
F.write();
}
else if(obj.type() == "areaTensorField")
{
const areaTensorField &f = obr_.lookupObjectRef<areaTensorField>(obj.name());
volTensorField F
(
IOobject
(
prefix_+f.name(),
obr_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedTensor(f.dimensions())
);
vsm_.mapToVolume(f, F.boundaryFieldRef());
F.write();
#undef doLocalCode
#define doLocalCode(Type) \
{ \
const auto* afld = isA<AreaField<Type>>(obj); \
\
if (afld) \
{ \
VolumeField<Type> vfld \
( \
IOobject \
( \
prefix_ + obj.name(), \
mesh_.time().timeName(), \
mesh_.thisDb(), \
IOobject::NO_READ, \
IOobject::NO_WRITE, \
IOobject::NO_REGISTER \
), \
mesh_, \
Zero, \
afld->dimensions() \
); \
\
vsm_.mapToVolume(*afld, vfld.boundaryFieldRef()); \
vfld.write(); \
continue; \
} \
}
doLocalCode(scalar);
doLocalCode(vector);
doLocalCode(sphericalTensor);
doLocalCode(symmTensor);
doLocalCode(tensor);
#undef doLocalCode
}
Info << endl;
......
......@@ -42,12 +42,12 @@ SourceFiles
#ifndef autoAreaToVolumeMapping_H
#define autoAreaToVolumeMapping_H
#include "regionFunctionObject.H"
#include "fvMeshFunctionObject.H"
#include "wordRes.H"
#include "Enum.H"
#include "areaFieldsFwd.H"
#include "volMesh.H"
#include "fvMesh.H"
#include "volMesh.H"
#include "volSurfaceMapping.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -62,12 +62,12 @@ namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class functionObjects::autoAreaToVolumeMapping Declaration
Class autoAreaToVolumeMapping Declaration
\*---------------------------------------------------------------------------*/
class autoAreaToVolumeMapping
:
public regionFunctionObject
public fvMeshFunctionObject
{
public:
......@@ -91,9 +91,6 @@ private:
//- Reference to faMesh
const faMesh& aMesh_;
//- Reference to fvMesh
const fvMesh& mesh_;
//- To only write objects of defined writeOption
writeOption writeOption_;
......
......@@ -238,10 +238,11 @@ Foam::functionObjects::gridfileWrite::gridfileWrite
)
:
regionFunctionObject(name, runTime, dict),
aMesh_
(
obr_.lookupObject<faMesh>("faMesh")
),
#if (OPENFOAM < 2310)
aMesh_(obr_.lookupObject<faMesh>("faMesh")),
#else
aMesh_(faMesh::mesh(refCast<const polyMesh>(obr_))),
#endif
writeOption_(ANY_WRITE),
objectNames_(),
secondOrderInterpolations_(false),
......@@ -398,7 +399,10 @@ bool Foam::functionObjects::gridfileWrite::write()
}
// Get selection
const wordList selectedNames(obr_.sortedNames<regIOobject>(objectNames_));
const wordList selectedNames
(
aMesh_.thisDb().sortedNames(objectNames_)
);
// Warning if anything was missed
bitSet missed(objectNames_.size());
......@@ -418,22 +422,18 @@ bool Foam::functionObjects::gridfileWrite::write()
WarningInFunction
<< "No corresponding selection for "
<< flatOutput(subset(missed, objectNames_)) << nl
<< "Available objects in database:"
<< nl << obr_.sortedToc()
<< "Available objects in database:" << nl
<< aMesh_.thisDb().sortedToc()
<< endl;
}
for (const word& objName : selectedNames)
{
regIOobject& obj = obr_.lookupObjectRef<regIOobject>(objName);
const regIOobject& obj =
aMesh_.thisDb().lookupObject<regIOobject>(objName);
if (obj.type() != "areaScalarField" &&
obj.type() != "areaVectorField" &&
obj.type() != "areaSphericalTensorField" &&
obj.type() != "areaSymmTensorField" &&
obj.type() != "areaTensorField")
if (!fieldTypes::area.contains(obj.type()))
{
continue;
}
......@@ -446,7 +446,6 @@ bool Foam::functionObjects::gridfileWrite::write()
{
continue;
}
break;
}
case NO_WRITE:
......@@ -455,7 +454,6 @@ bool Foam::functionObjects::gridfileWrite::write()
{
continue;
}
break;
}
case ANY_WRITE:
......@@ -475,9 +473,11 @@ bool Foam::functionObjects::gridfileWrite::write()
break;
}
}
if (obj.name().ends_with("_0"))
{
Info << " ignoring old " << obj.type() <<" " << obj.name() << endl;
Info<< " ignoring old " << obj.type()
<< ' ' << obj.name() << endl;
continue;
}
else if
......@@ -486,106 +486,141 @@ bool Foam::functionObjects::gridfileWrite::write()
&& obr_.time().writeTime()
)
{
Info << " automatically writing " << obj.type() <<" " << obj.name() << endl;
Info<< " automatically writing " << obj.type()
<< ' ' << obj.name() << endl;
}
else
{
Info << " writing " << obj.type() <<" " << obj.name() << endl;
Info<< " writing " << obj.type()
<< ' ' << obj.name() << endl;
}
if (obj.type() == "areaScalarField")
{
const areaScalarField &f = obr_.lookupObjectRef<areaScalarField>(obj.name());
fileName filename(fileName::concat(obr_.time().timePath(), obj.name()+postfix_));
// Output file name
fileName fn
(
fileName::concat(obr_.time().timePath(), obj.name()+postfix_)
);
this->writeField(f, filename);
}
else if (obj.type() == "areaVectorField")
// scalar
{
const areaVectorField &v = obr_.lookupObjectRef<areaVectorField>(obj.name());
fileName fn(fileName::concat(obr_.time().timePath(), obj.name()+"_mag"+postfix_));
this->writeField(mag(v), fn);
const auto* afld = isA<AreaField<scalar>>(obj);
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_x"+postfix_));
this->writeField(v.component(vector::X), fn);
if (afld)
{
const auto& fld = *afld;
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_y"+postfix_));
this->writeField(v.component(vector::Y), fn);
this->writeField(fld, fn);
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_z"+postfix_));
this->writeField(v.component(vector::Z), fn);
continue;
}
}
else if (obj.type() == "areaSphericalTensorField")
{
const areaSphericalTensorField &v = obr_.lookupObjectRef<areaSphericalTensorField>(obj.name());
fileName fn(fileName::concat(obr_.time().timePath(), obj.name()+"_mag"+postfix_));
this->writeField(mag(v), fn);
}
else if (obj.type() == "areaSymmTensorField")
// vector
{
const areaSymmTensorField &v = obr_.lookupObjectRef<areaSymmTensorField>(obj.name());
const auto* afld = isA<AreaField<vector>>(obj);
fileName fn(fileName::concat(obr_.time().timePath(), obj.name()+"_mag"+postfix_));
this->writeField(mag(v), fn);
if (afld)
{
const auto& fld = *afld;
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_xx"+postfix_));
this->writeField(v.component(tensor::XX), fn);
fn.replace_name(obj.name()+"_mag"+postfix_);
this->writeField(mag(fld), fn);
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_xy"+postfix_));
this->writeField(v.component(tensor::XY), fn);
#undef writeCmpt
#define writeCmpt(Name, Cmpt) \
{ \
fn.replace_name(obj.name() + Name + postfix_); \
this->writeField(fld.component(vector:: Cmpt), fn); \
}
writeCmpt("_x", X);
writeCmpt("_y", Y);
writeCmpt("_z", Z);
#undef writeCmpt
continue;
}
}
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_xz"+postfix_));
this->writeField(v.component(tensor::XZ), fn);
// sphericalTensor
{
const auto* afld = isA<AreaField<sphericalTensor>>(obj);
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_yy"+postfix_));
this->writeField(v.component(tensor::YY), fn);
if (afld)
{
const auto& fld = *afld;
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_yz"+postfix_));
this->writeField(v.component(tensor::YZ), fn);
// Could also write directly...
fn.replace_name(obj.name()+"_mag"+postfix_);
this->writeField(mag(fld), fn);
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_zz"+postfix_));
this->writeField(v.component(tensor::ZZ), fn);
continue;
}
}
else if (obj.type() == "areaTensorField")
// symmTensor
{
const areaTensorField &v = obr_.lookupObjectRef<areaTensorField>(obj.name());
const auto* afld = isA<AreaField<symmTensor>>(obj);
fileName fn(fileName::concat(obr_.time().timePath(), obj.name()+"_mag"+postfix_));
this->writeField(mag(v), fn);
if (afld)
{
const auto& fld = *afld;
fn.replace_name(obj.name()+"_mag"+postfix_);
this->writeField(mag(fld), fn);
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_xx"+postfix_));
this->writeField(v.component(tensor::XX), fn);
#undef writeCmpt
#define writeCmpt(Name, Cmpt) \
{ \
fn.replace_name(obj.name() + Name + postfix_); \
this->writeField(fld.component(symmTensor:: Cmpt), fn); \
}
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_xy"+postfix_));
this->writeField(v.component(tensor::XY), fn);
writeCmpt("_xx", XX);
writeCmpt("_xy", XY);
writeCmpt("_xz", XZ);
writeCmpt("_yy", YY);
writeCmpt("_yz", YZ);
writeCmpt("_zz", ZZ);
#undef writeCmpt
continue;
}
}
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_xz"+postfix_));
this->writeField(v.component(tensor::XZ), fn);
// tensor
{
const auto* afld = isA<AreaField<tensor>>(obj);
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_yx"+postfix_));
this->writeField(v.component(tensor::YX), fn);
if (afld)
{
const auto& fld = *afld;
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_yy"+postfix_));
this->writeField(v.component(tensor::YY), fn);
fn.replace_name(obj.name()+"_mag"+postfix_);
this->writeField(mag(fld), fn);
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_yz"+postfix_));
this->writeField(v.component(tensor::YZ), fn);
#undef writeCmpt
#define writeCmpt(Name, Cmpt) \
{ \
fn.replace_name(obj.name() + Name + postfix_); \
this->writeField(fld.component(tensor:: Cmpt), fn); \
}
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_zx"+postfix_));
this->writeField(v.component(tensor::ZX), fn);
writeCmpt("_xx", XX);
writeCmpt("_xy", XY);
writeCmpt("_xz", XZ);
writeCmpt("_yx", YX);
writeCmpt("_yy", YY);
writeCmpt("_yz", YZ);
writeCmpt("_zx", ZX);
writeCmpt("_zy", ZY);
writeCmpt("_zz", ZZ);
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_zy"+postfix_));
this->writeField(v.component(tensor::ZY), fn);
#undef writeCmpt
fn = fileName(fileName::concat(obr_.time().timePath(), obj.name()+"_zz"+postfix_));
this->writeField(v.component(tensor::ZZ), fn);
}
else
{
continue;
continue;
}
}
}
......
......@@ -61,10 +61,11 @@ Foam::functionObjects::isoLine::isoLine
)
:
regionFunctionObject(name, runTime, dict),
aMesh_
(
obr_.lookupObject<faMesh>("faMesh")
),
#if (OPENFOAM < 2310)
aMesh_(obr_.lookupObject<faMesh>("faMesh")),
#else
aMesh_(faMesh::mesh(refCast<const polyMesh>(obr_))),
#endif
fileName_(),
fieldName_(),
isoValues_(),
......@@ -106,7 +107,8 @@ bool Foam::functionObjects::isoLine::write()
Info << type() << " " << name() << " write:" << nl;
const areaScalarField& phi = obr_.lookupObject<areaScalarField>(fieldName_);
const areaScalarField& phi =
aMesh_.thisDb().lookupObject<areaScalarField>(fieldName_);
Info<< "field " << fieldName_
<< ": limits: " << min(phi).value() << ", " << max(phi).value() << nl;
......@@ -324,11 +326,14 @@ bool Foam::functionObjects::isoLine::write()
}
fileName filename(fileName::concat(obr_.time().timePath(), fileName_));
fileName fn
(
fileName::concat(obr_.time().timePath(), fileName_)
);
Info<< "Writing to " << filename << nl << nl;
Info<< "Writing to " << fn << nl << nl;
shp.calcBoundingBox();
shp.write(filename);
shp.write(fn);
return true;
}
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | avalanche module
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 Matthias Rauter
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "peakValues.H"
#include "Time.H"
#include "areaFields.H"
#include "ListOps.H"
#include "addToRunTimeSelectionTable.H"
#include "shapefile.H"
#include "faCFD.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(peakValues, 0);
addRemovableToRunTimeSelectionTable
(
functionObject,
peakValues,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::peakValues::peakValues
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
#if (OPENFOAM < 2310)
aMesh_(mesh_.lookupObject<faMesh>("faMesh")),
#else
aMesh_(faMesh::mesh(mesh_)),
#endif
outputName_("max_"),
fieldName_()
{
read(dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::peakValues::read(const dictionary& dict)
{
regionFunctionObject::read(dict);
dict.readEntry("field", fieldName_);
dict.readEntry("output", outputName_);
return true;
}
bool Foam::functionObjects::peakValues::execute()
{
// scalar
{
const auto* phiPtr =
aMesh_.thisDb().cfindObject<areaScalarField>(fieldName_);
if (phiPtr)
{
const areaScalarField& phi = *phiPtr;
auto* maxField =
aMesh_.thisDb().getObjectPtr<areaScalarField>(outputName_);
if (!maxField)
{
maxField = new areaScalarField
(
IOobject
(
outputName_,
obr_.time().timeName(),
aMesh_.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
phi
);
regIOobject::store(maxField);
Info<< "Initializing peak Value field \"" << outputName_
<< "\" for areaScalarField \"" << fieldName_ << "\"" << nl;
}
else
{
*maxField = max(phi, *maxField);
}
return true;
}
}
// vector
{
const auto* phiPtr =
aMesh_.thisDb().cfindObject<areaVectorField>(fieldName_);
if (phiPtr)
{
const auto& phi = *phiPtr;
auto* maxField =
aMesh_.thisDb().getObjectPtr<areaScalarField>(outputName_);
if (!maxField)
{
maxField = new areaScalarField
(
IOobject
(
outputName_,
obr_.time().timeName(),
aMesh_.thisDb(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
mag(phi)
);
regIOobject::store(maxField);
Info << "Initializing peak Value field \"" << outputName_
<< "\" for areaVectorField \"" << fieldName_ << "\"" << nl;
}
else
{
*maxField = max(mag(phi), *maxField);
}
}
return true;
}
// Fallthrough
return false;
}
bool Foam::functionObjects::peakValues::write()
{
return true;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | avalanche module
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 Matthias Rauter
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::peakValues
Group
grpUtilitiesFunctionObjects
Description
Calculate the peak values of faFields over the runtime
Usage
SourceFiles
peakValues.C
\*---------------------------------------------------------------------------*/
#ifndef avalance_peakValues_H
#define avalance_peakValues_H
#include "fvMeshFunctionObject.H"
#include "areaFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class faMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class functionObjects::peakValues Declaration
\*---------------------------------------------------------------------------*/
class peakValues
:
public fvMeshFunctionObject
{
// Private Data
//- Reference to faMesh
const faMesh& aMesh_;
//- The name given to the max field (output)
word outputName_;
//- Field for which peak values are calculated
word fieldName_;
// Private Member Functions
//- No copy construct
peakValues(const peakValues&) = delete;
//- No copy assignment
void operator=(const peakValues&) = delete;
public:
//- Runtime type information
TypeName("peakValues");
// Constructors
//- Construct from Time and dictionary
peakValues
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~peakValues() = default;
// Member Functions
//- Read the writeObjects data
virtual bool read(const dictionary&);
//- Do nothing
virtual bool execute();
//- Write the registered objects
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -73,10 +73,11 @@ Foam::functionObjects::shapefileWrite::shapefileWrite
)
:
regionFunctionObject(name, runTime, dict),
aMesh_
(
obr_.lookupObject<faMesh>("faMesh")
),
#if (OPENFOAM < 2310)
aMesh_(obr_.lookupObject<faMesh>("faMesh")),
#else
aMesh_(faMesh::mesh(refCast<const polyMesh>(obr_))),
#endif
writeOption_(ANY_WRITE),
objectNames_(),
prefix_("polys")
......@@ -273,7 +274,10 @@ bool Foam::functionObjects::shapefileWrite::write()
}
// Get selection
const wordList selectedNames(obr_.sortedNames<regIOobject>(objectNames_));
const wordList selectedNames
(
aMesh_.thisDb().sortedNames(objectNames_)
);
// Warning if anything was missed
bitSet missed(objectNames_.size());
......@@ -294,7 +298,7 @@ bool Foam::functionObjects::shapefileWrite::write()
<< "No corresponding selection for "
<< flatOutput(subset(missed, objectNames_)) << nl
<< "Available objects in database:"
<< nl << obr_.sortedToc()
<< nl << aMesh_.thisDb().sortedToc()
<< endl;
}
......@@ -305,13 +309,10 @@ bool Foam::functionObjects::shapefileWrite::write()
for (const word& objName : selectedNames)
{
regIOobject& obj = obr_.lookupObjectRef<regIOobject>(objName);
const regIOobject& obj =
aMesh_.thisDb().lookupObject<regIOobject>(objName);
if (obj.type() != "areaScalarField" &&
obj.type() != "areaVectorField" &&
obj.type() != "areaSphericalTensorField" &&
obj.type() != "areaSymmTensorField" &&
obj.type() != "areaTensorField")
if (!fieldTypes::area.contains(obj.type()))
{
continue;
}
......@@ -324,7 +325,6 @@ bool Foam::functionObjects::shapefileWrite::write()
{
continue;
}
break;
}
case NO_WRITE:
......@@ -333,7 +333,6 @@ bool Foam::functionObjects::shapefileWrite::write()
{
continue;
}
break;
}
case ANY_WRITE:
......@@ -355,7 +354,8 @@ bool Foam::functionObjects::shapefileWrite::write()
}
if (obj.name().ends_with("_0"))
{
Info << " ignoring old " << obj.type() <<" " << obj.name() << endl;
Info<< " ignoring old " << obj.type()
<< ' ' << obj.name() << endl;
continue;
}
else if
......@@ -364,45 +364,44 @@ bool Foam::functionObjects::shapefileWrite::write()
&& obr_.time().writeTime()
)
{
Info << " automatically writing " << obj.type() <<" " << obj.name() << endl;
Info<< " automatically writing " << obj.type()
<< ' ' << obj.name() << endl;
}
else
{
Info << " writing " << obj.type() <<" " << obj.name() << endl;
Info<< " writing " << obj.type()
<< ' ' << obj.name() << endl;
}
if (obj.type() == "areaScalarField")
{
const areaScalarField &f = obr_.lookupObjectRef<areaScalarField>(obj.name());
addToShapeFile(f, shp_);
}
else if(obj.type() == "areaVectorField")
{
const areaVectorField &f = obr_.lookupObjectRef<areaVectorField>(obj.name());
addToShapeFile(f, shp_);
}
else if(obj.type() == "areaSphericalTensorField")
{
const areaSphericalTensorField &f = obr_.lookupObjectRef<areaSphericalTensorField>(obj.name());
addToShapeFile(f, shp_);
}
else if(obj.type() == "areaSymmTensorField")
{
const areaSymmTensorField &f = obr_.lookupObjectRef<areaSymmTensorField>(obj.name());
addToShapeFile(f, shp_);
}
else if(obj.type() == "areaTensorField")
{
const areaTensorField &f = obr_.lookupObjectRef<areaTensorField>(obj.name());
addToShapeFile(f, shp_);
#undef doLocalCode
#define doLocalCode(Type) \
{ \
const auto* afld = isA<AreaField<Type>>(obj); \
\
if (afld) \
{ \
addToShapeFile(*afld, shp_); \
continue; \
} \
}
doLocalCode(scalar);
doLocalCode(vector);
doLocalCode(sphericalTensor);
doLocalCode(symmTensor);
doLocalCode(tensor);
#undef doLocalCode
}
fileName filename(fileName::concat(obr_.time().timePath(), prefix_+obr_.time().timeName()));
fileName fn
(
fileName::concat(obr_.time().timePath(), prefix_+obr_.time().timeName())
);
Info << "Writing to " << filename << nl << nl;
Info<< "Writing to " << fn << nl << nl;
writeShapeFile(shp_, filename);
writeShapeFile(shp_, fn);
return true;
}
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | avalanche module
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 Matthias Rauter
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "totalVolume.H"
#include "Time.H"
#include "polyMesh.H"
#include "faMesh.H"
#include "fvMesh.H"
#include "areaFields.H"
#include "ListOps.H"
#include "addToRunTimeSelectionTable.H"
#include "faCFD.H"
#include "HormannAgathos.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(totalVolume, 0);
addRemovableToRunTimeSelectionTable
(
functionObject,
totalVolume,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::totalVolume::totalVolume
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
regionFunctionObject(name, runTime, dict),
#if (OPENFOAM < 2310)
aMesh_(obr_.lookupObject<faMesh>("faMesh")),
#else
aMesh_(faMesh::mesh(refCast<const polyMesh>(obr_))),
#endif
cName_(),
hName_("h"),
tableOutput_("totalVolume.csv"),
dataFilePtr_(nullptr)
{
read(dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::totalVolume::read(const dictionary& dict)
{
regionFunctionObject::read(dict);
cName_ = dict.getOrDefault<word>("cfield", word::null);
hName_ = dict.getOrDefault<word>("hField", "h");
tableOutput_ = dict.getOrDefault<word>("tableOutput", "totalVolume.csv");
if (UPstream::master())
{
dataFilePtr_.reset(new OFstream(tableOutput_));
}
if (UPstream::master())
{
dataFilePtr_() << "time" << tab << "volume" << endl;
}
expire();
return true;
}
bool Foam::functionObjects::totalVolume::execute()
{
const auto& h =
aMesh_.thisDb().lookupObject<areaScalarField>(hName_);
const auto* concPtr =
aMesh_.thisDb().cfindObject<areaScalarField>(cName_);
scalar sumOfVolume = 0;
if (concPtr)
{
const auto& c = *concPtr;
sumOfVolume = gSum
(
h.primitiveField() * aMesh_.S()
* c.primitiveField()
);
}
else
{
sumOfVolume = gSum
(
h.primitiveField() * aMesh_.S()
);
}
if (UPstream::master())
{
dataFilePtr_() << obr_.time().value() << tab << sumOfVolume << endl;
}
return true;
}
bool Foam::functionObjects::totalVolume::write()
{
return true;
}
void Foam::functionObjects::totalVolume::updateMesh(const mapPolyMesh& mpm)
{
expire();
}
void Foam::functionObjects::totalVolume::movePoints(const polyMesh& mesh)
{
expire();
}
void Foam::functionObjects::totalVolume::readUpdate(const polyMesh::readUpdateState state)
{
expire();
}
void Foam::functionObjects::totalVolume::expire()
{
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | avalanche module
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 Matthias Rauter
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::totalVolume
Group
grpUtilitiesFunctionObjects
Description
calculate the total mass in a simulation. The mass is assumed to
be the product of phase density c and flow height h. The phase
density is optional.
Usage
SourceFiles
totalVolume.C
\*---------------------------------------------------------------------------*/
#ifndef totalVolume_H
#define totalVolume_H
#include "regionFunctionObject.H"
#include "wordRes.H"
#include "Enum.H"
#include "gridfile.H"
#include "areaFieldsFwd.H"
#include "polyMesh.H"
#include "pointList.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class faMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class functionObjects::totalVolume Declaration
\*---------------------------------------------------------------------------*/
class totalVolume
:
public regionFunctionObject
{
// Private Data
//- Reference to faMesh
const faMesh& aMesh_;
//- Name of the concentration field
word cName_;
//- Name of the flow height field
word hName_;
//- Output filename
word tableOutput_;
//- The file for results
autoPtr<OFstream> dataFilePtr_;
// Private Member Functions
//- No copy construct
totalVolume(const totalVolume&) = delete;
//- No copy assignment
void operator=(const totalVolume&) = delete;
public:
//- Runtime type information
TypeName("totalVolume");
// Constructors
//- Construct from Time and dictionary
totalVolume
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~totalVolume() = default;
// Member Functions
//- Read the writeObjects data
virtual bool read(const dictionary&);
//- Do nothing
virtual bool execute();
//- Write the registered objects
virtual bool write();
//- Update for changes of mesh - expires the surfaces
virtual void updateMesh(const mapPolyMesh& mpm);
//- Update for mesh point-motion - expires the surfaces
virtual void movePoints(const polyMesh& mesh);
//- Update for changes of mesh due to readUpdate - expires the surfaces
virtual void readUpdate(const polyMesh::readUpdateState state);
//- Mark intermediate surfaces and writers as needing an update.
void expire();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -33,7 +33,9 @@ Author
#include <iterator>
#include <sstream>
#include <limits>
#include <cctype>
#include <cmath>
#include <algorithm>
// Debugging output
#undef DebugInfo
......@@ -165,6 +167,12 @@ int gridfile::read(const std::string& fname)
while((!pFile.eof()) && readheader )
{
std::getline(pFile, line);
std::transform(line.begin(), line.end(), line.begin(), ::tolower);
// OR:
// stringOps::inplaceLower(line);
DebugInfo << "line=" << line << std::endl;
std::string::size_type i = std::string::npos;
......@@ -207,7 +215,7 @@ int gridfile::read(const std::string& fname)
{
this->dy_ = std::stod(line.substr(i + 2));
}
else if ((i = line.find("NODATA_value")) != std::string::npos)
else if ((i = line.find("nodata_value")) != std::string::npos)
{
this->NODATA_value_ = std::stod(line.substr(i + 12));
readheader = false;
......@@ -288,11 +296,10 @@ int gridfile::write(const std::string& fname)
return 0;
}
pFile << "xllcenter " << this->xllcenter_ << std::endl
<< "yllcenter " << this->yllcenter_ << std::endl
pFile << "ncols " << this->ncols_ << std::endl
<< "nrows " << this->nrows_ << std::endl
<< "ncols " << this->ncols_ << std::endl
<< "NODATA_value " << this->NODATA_value_ << std::endl;
<< "xllcenter " << this->xllcenter_ << std::endl
<< "yllcenter " << this->yllcenter_ << std::endl;
if (this->dx_ == this->dy_)
{
......@@ -304,6 +311,8 @@ int gridfile::write(const std::string& fname)
<< "dy " << dy_ << std::endl;
}
pFile << "NODATA_value " << this->NODATA_value_ << std::endl;
for (unsigned int j=0; j<this->nrows_; j++)
{
for (unsigned int i=0; i<this->ncols_; i++)
......
......@@ -24,7 +24,7 @@ fields
{
type shapefile;
filename "<constant>/gisdata/aoi";
#include "<constant>/offset"
#include "<constant>/offset";
filltype linear;
valueAtZero 1.6;
......@@ -37,7 +37,7 @@ fields
{
type shapefile;
filename "<constant>/gisdata/release";
#include "<constant>/offset"
#include "<constant>/offset";
filltype linear;
valueAtZero 0;
......@@ -54,7 +54,7 @@ fields
{
type shapefile;
filename "<constant>/gisdata/release";
#include "<constant>/offset"
#include "<constant>/offset";
filltype linear;
valueAtZero 1.6;
......
......@@ -22,9 +22,9 @@ fields
(
base
{
type shapefile;
filename "constant/gisdata/aoi";
#include "../constant/offset";
type shapefile;
filename "<constant>/gisdata/aoi";
#include "<constant>/offset";
filltype linear;
valueAtZero 1.6;
......@@ -35,9 +35,9 @@ fields
releaseArea1
{
type shapefile;
filename "../wolfsgrube/constant/gisdata/release";
#include "../constant/offset";
type shapefile;
filename "<constant>/gisdata/release";
#include "<constant>/offset";
filltype linear;
valueAtZero 0;
......@@ -45,16 +45,16 @@ fields
}
);
}
h1
h
{
default h0 [0 1 0 0 0 0 0] 1e-5;
regions
(
releaseArea1
{
type shapefile;
filename "../wolfsgrube/constant/gisdata/release";
#include "../constant/offset";
type shapefile;
filename "<constant>/gisdata/release";
#include "<constant>/offset";
filltype linear;
valueAtZero 1.6;
......@@ -65,3 +65,5 @@ fields
);
}
}
// ************************************************************************** //