Skip to content

Commit 6ff873c

Browse files
author
Pierre Horgue
committed
OpenFOAM-10: fix compatibility for utilities
1 parent 1961573 commit 6ff873c

File tree

9 files changed

+46
-44
lines changed

9 files changed

+46
-44
lines changed

utilities/darcyFoam/createFields.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
word phaseName("");
2-
if (args.found("phase")) phaseName = args.opt("phase");
2+
if (args.optionFound("phase")) phaseName = args.option("phase");
33

44
Info << nl << "Reading field p\n" << endl;
55
volScalarField p

utilities/darcyFoam/readEvent.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
bool sourceEventIsPresent = transportProperties.found("eventFileWaterSource");
1+
bool sourceEventIsPresent = transportProperties.optionFound("eventFileWaterSource");
22
word sourceEventFileName = transportProperties.lookupOrDefault<word>("eventFileWaterSource","");
33
sourceEventFile sourceEvent(sourceEventFileName);
44
if (sourceEventIsPresent)

utilities/setBoundaryWaterLevel/Make/options

+2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ EXE_INC = \
22
-I$(LIB_SRC)/finiteVolume/lnInclude \
33
-I$(LIB_SRC)/meshTools/lnInclude \
44
-I$(LIB_SRC)/surfMesh/lnInclude \
5+
-I$(LIB_SRC)/triSurface/lnInclude \
56
-I../../libraries/toolsGIS/lnInclude
67

78
EXE_LIBS = \
89
-lfiniteVolume \
910
-lmeshTools \
1011
-lsurfMesh \
12+
-ltriSurface \
1113
-L$(FOAM_USER_LIBBIN) \
1214
-lPMFporousBoundaryConditions \
1315
-lPMFtoolsGIS

utilities/setBoundaryWaterLevel/potentialField.H

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
);
1414

1515
//-- Reading patch information
16-
word patchName = args.opt("patch");
16+
word patchName = args.option("patch");
1717
label patchID = mesh.boundaryMesh().findPatchID(patchName);
1818
fvPatchScalarField& potentialPatch = potential.boundaryFieldRef()[patchID];
1919

2020
//-- Compute and set up head pressure
21-
if (args.found("DEM"))
21+
if (args.optionFound("DEM"))
2222
{
2323
//- reading DEM informations
24-
DEMfile fixedPotentialDEM(args.opt("DEM"));
25-
scalar offsetPotential = args.getOrDefault<scalar>("offset",0.);
24+
DEMfile fixedPotentialDEM(args.option("DEM"));
25+
scalar offsetPotential = args.optionLookupOrDefault<scalar>("offset",0.);
2626
if (offsetPotential==0)
2727
{
2828
Info << nl << "Potential fixed using DEM" << endl;
@@ -39,14 +39,14 @@
3939
potentialPatch[facei] = fixedPotentialDEM.interpolate(faces[facei]) + offsetPotential;
4040
}
4141
}
42-
else if (args.found("STL"))
42+
else if (args.optionFound("STL"))
4343
{
4444
//- reading STL informations
45-
word STLfile = args.opt("STL");
45+
word STLfile = args.option("STL");
4646
triSurfaceMesh potentialSTL(IOobject(STLfile,mesh));
4747
pointField pPoints( potentialSTL.points() );
48-
scalar thresholdPotential = args.getOrDefault<scalar>("threshold",0.);
49-
scalar offsetPotential = args.getOrDefault<scalar>("offset",0.);
48+
scalar thresholdPotential = args.optionLookupOrDefault<scalar>("threshold",0.);
49+
scalar offsetPotential = args.optionLookupOrDefault<scalar>("offset",0.);
5050
Info << nl << "Potential fixed using points over " << thresholdPotential << " in STL = " << STLfile << " offseted by " << offsetPotential << endl;
5151
const vectorField& faces = mesh.boundary()[patchID].patch().faceCentres();
5252

@@ -70,10 +70,10 @@
7070
potentialPatch[facei] = pPoints[id_point].z() + offsetPotential;
7171
}
7272
}
73-
else if (args.found("value"))
73+
else if (args.optionFound("value"))
7474
{
7575
//- uniform potential
76-
scalar uniformPotential = args.getOrDefault<scalar>("value",0.);
76+
scalar uniformPotential = args.optionLookupOrDefault<scalar>("value",0.);
7777
Info << nl << "Uniform potential fixed = " << uniformPotential << " m " << endl;
7878
//- computing and writing local potential
7979
forAll(potentialPatch,facei)

utilities/setBoundaryWaterLevel/pressureheadField.H

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
);
1515

1616
//-- Reading patch information
17-
word patchName = args.opt("patch");
17+
word patchName = args.option("patch");
1818
label patchID = mesh.boundaryMesh().findPatchID(patchName);
1919
fvPatchScalarField& hPatch = h.boundaryFieldRef()[patchID];
2020

2121
//-- Compute and set up head pressure
22-
if (args.found("DEM"))
22+
if (args.optionFound("DEM"))
2323
{
2424
//- reading DEM informations
25-
DEMfile fixedPotentialDEM(args.opt("DEM"));
26-
scalar offseth = args.getOrDefault<scalar>("offset",0.);
25+
DEMfile fixedPotentialDEM(args.option("DEM"));
26+
scalar offseth = args.optionLookupOrDefault<scalar>("offset",0.);
2727
if (offseth==0)
2828
{
2929
Info << nl << "Potential fixed using DEM " << endl;
@@ -40,14 +40,14 @@
4040
hPatch[facei] = fixedPotentialDEM.interpolate(faces[facei]) - faces[facei].z() + offseth;
4141
}
4242
}
43-
else if (args.found("STL"))
43+
else if (args.optionFound("STL"))
4444
{
4545
//- reading STL informations
46-
word STLfile = args.opt("STL");
46+
word STLfile = args.option("STL");
4747
triSurfaceMesh potentialSTL(IOobject(STLfile,mesh));
4848
pointField pPoints( potentialSTL.points() );
49-
scalar thresholdh = args.getOrDefault<scalar>("threshold",0.);
50-
scalar offseth = args.getOrDefault<scalar>("offset",0.);
49+
scalar thresholdh = args.optionLookupOrDefault<scalar>("threshold",0.);
50+
scalar offseth = args.optionLookupOrDefault<scalar>("offset",0.);
5151
Info << nl << "Potential fixed using points over " << thresholdh << " in STL = " << STLfile << " offseted by " << offseth << endl;
5252

5353
//- computing local potential
@@ -75,7 +75,7 @@
7575
{
7676
//- uniform potential
7777
const vectorField& faces = mesh.boundary()[patchID].patch().faceCentres();
78-
scalar potential = args.opt("value",0.);
78+
scalar potential = args.optionLookupOrDefault("value",0.);
7979
Info << nl << "Uniform potential fixed = " << potential << " m " << endl;
8080
forAll(hPatch,facei)
8181
{

utilities/setBoundaryWaterLevel/setBoundaryWaterLevel.C

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
7171

7272
Foam::argList args(argc,argv);
7373

74-
if (!args.found("patch"))
74+
if (!args.optionFound("patch"))
7575
{
7676
FatalError << "no patch specified"
7777
<< nl << " use option -patch"
@@ -82,9 +82,9 @@ int main(int argc, char *argv[])
8282
#include "createMesh.H"
8383

8484
word field("h");
85-
if (args.found("field"))
85+
if (args.optionFound("field"))
8686
{
87-
field = args.opt("field");
87+
field = args.option("field");
8888
}
8989

9090
if(field == "h")

utilities/setFieldsFromDEM/setFieldsFromDEM.C

+7-7
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ int main(int argc, char *argv[])
5959
Foam::argList args(argc,argv);
6060

6161
word nameDEM = "default";
62-
if (args.found("file"))
62+
if (args.optionFound("file"))
6363
{
64-
nameDEM = args.opt("file");
64+
nameDEM = args.option("file");
6565
}
6666
else
6767
{
@@ -71,9 +71,9 @@ int main(int argc, char *argv[])
7171
}
7272

7373
word nameField = "default";
74-
if (args.found("field"))
74+
if (args.optionFound("field"))
7575
{
76-
nameField = args.opt("field");
76+
nameField = args.option("field");
7777
}
7878
else
7979
{
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
8282
<< exit(FatalError);
8383
}
8484

85-
scalar offset = args.opt("offset",0.);
85+
scalar offset = args.optionLookupOrDefault("offset",0.);
8686

8787
#include "createTime.H"
8888
#include "createMesh.H"
@@ -93,9 +93,9 @@ int main(int argc, char *argv[])
9393
DEMfile sourceFile(nameDEM);
9494

9595
word fileDir = "constant";
96-
if (args.found("folder"))
96+
if (args.optionFound("folder"))
9797
{
98-
fileDir = args.opt("folder");
98+
fileDir = args.option("folder");
9999
}
100100

101101
volScalarField outputFile

utilities/setFieldsFromXY/setFieldsFromXY.C

+8-8
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ int main(int argc, char *argv[])
6464
Foam::argList args(argc,argv);
6565

6666
word nameXY = "default";
67-
if (args.found("file"))
67+
if (args.optionFound("file"))
6868
{
69-
nameXY = args.opt("file");
69+
nameXY = args.option("file");
7070
}
7171
else
7272
{
@@ -76,9 +76,9 @@ int main(int argc, char *argv[])
7676
}
7777

7878
word nameField = "default";
79-
if (args.found("field"))
79+
if (args.optionFound("field"))
8080
{
81-
nameField = args.opt("field");
81+
nameField = args.option("field");
8282
}
8383

8484
else
@@ -88,8 +88,8 @@ int main(int argc, char *argv[])
8888
<< exit(FatalError);
8989
}
9090

91-
scalar offset = args.opt("offset",0.);
92-
label npoints = args.opt("npoints",3);
91+
scalar offset = args.optionLookupOrDefault("offset",0.);
92+
label npoints = args.optionLookupOrDefault("npoints",3);
9393

9494
#include "createTime.H"
9595
#include "createMesh.H"
@@ -100,9 +100,9 @@ int main(int argc, char *argv[])
100100
XYfile sourceFile(nameXY, mesh, npoints);
101101

102102
word fileDir = "constant";
103-
if (args.found("folder"))
103+
if (args.optionFound("folder"))
104104
{
105-
fileDir = args.opt("folder");
105+
fileDir = args.option("folder");
106106
}
107107

108108
volScalarField outputFile

utilities/subSetMeshFromDEM/subsetMeshFromDEM.C

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Usage
4747
int main(int argc, char *argv[])
4848
{
4949

50-
argList::addArgument("DEMtop","DEM file (.xyz) for top patch");
51-
argList::addArgument("DEMbottom","DEM file (.xyz) for bottom patch");
50+
argList::validArgs.append("DEMtop"),
51+
argList::validArgs.append("DEMbottom");
5252

5353
Foam::argList args(argc,argv);
5454

@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
6767
scalar ztop = topFile.interpolate(mesh.C()[celli]);
6868
if (mesh.C()[celli].z() < ztop) topCells.insert(celli);
6969
}
70-
fvMeshSubset::exposedPatchName = "top";
70+
7171
fvMeshSubset topMesh(mesh);
7272
topMesh.setCellSubset(topCells, -1, true);
7373
const fvMesh& interMesh = topMesh.subMesh();
@@ -82,13 +82,13 @@ int main(int argc, char *argv[])
8282
scalar zbottom = bottomFile.interpolate(interMesh.C()[celli]);
8383
if (interMesh.C()[celli].z() > zbottom) bottomCells.insert(celli);
8484
}
85-
fvMeshSubset::exposedPatchName = "bottom";
85+
8686
fvMeshSubset finalMesh(topMesh.subMesh());
8787
finalMesh.setCellSubset(bottomCells, -1, true);
8888

8989
//- write final mesh
9090
fvMesh& outMesh = finalMesh.subMesh();
91-
fvMeshTools::removeEmptyPatches(outMesh, true);
91+
9292
outMesh.setInstance(runTime.constant());
9393
outMesh.write();
9494

0 commit comments

Comments
 (0)