Skip to content

Commit

Permalink
ignore ".XY" poi, to avoid java heap overflow for large design
Browse files Browse the repository at this point in the history
  • Loading branch information
yannrichet authored Feb 6, 2023
1 parent dcb054f commit f24822b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 124 deletions.
123 changes: 11 additions & 112 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ It supports the following syntax and features:
* __need__ a *.poi file which setup output Points Of Interest coordinates:
```
first_poi=2500,15
second_poi=2500,250
second_poi=2900,250
sampledline10points=2500,15:10:2900,250
map10x10points=2500,15:10,10:2900,250
...
```
* parameter syntax:
Expand All @@ -20,133 +22,28 @@ It supports the following syntax and features:
* example input files:
* .cas file
```
/---------------------------------------------------------------------
/ TELEMAC2D Version v6p1 16 juil. 2012
/ TELEMAC 2D : rupture digue - Qinitial
/---------------------------------------------------------------------
/
/ ENTREES-SORTIES, FICHIERS
/---------------------------------------------------------------------
/
RESULTS FILE ='r2d_breach.slf'
/
BOUNDARY CONDITIONS FILE ='geo_breach.cli'
/
LIQUID BOUNDARIES FILE ='t2d_breach.liq'
/
GEOMETRY FILE ='geo_breach.slf'
/
PREVIOUS COMPUTATION FILE ='ini_breach.slf'
/
BREACHES DATA FILE ='breach.txt'
/
/---------------------------------------------------------------------
/ ENTREES-SORTIES, GENERALITES
/---------------------------------------------------------------------
/
COMPUTATION CONTINUED =true
/
/-------------------------------------------------------------------
/---
/
TITLE='TELEMAC 2D : rupture digue - Qinitial'
/
/
/---------------------------------------------------------------------
/ ENTREES-SORTIES, GRAPHIQUES ET LISTING
/---------------------------------------------------------------------
/
MASS-BALANCE =YES
/
LISTING PRINTOUT PERIOD =20
/
...
VARIABLES FOR GRAPHIC PRINTOUTS =U,V,S,H,B,L,D,W
/
GRAPHIC PRINTOUT PERIOD =120
/
INFORMATION ABOUT SOLVER =YES
/
/
/---------------------------------------------------------------------
/ EQUATIONS
/---------------------------------------------------------------------
/
FRICTION COEFFICIENT =15.
/
...
VELOCITY DIFFUSIVITY =$(vel~0.005)
/
LAW OF BOTTOM FRICTION =3
/
/
/---------------------------------------------------------------------
/ EQUATIONS, CONDITIONS INITIALES
/---------------------------------------------------------------------
/
INITIAL CONDITIONS ='COTE CONSTANTE'
/
...
INITIAL ELEVATION =$(init_elev~[1.5,2.5])
/
/
/---------------------------------------------------------------------
/ EQUATIONS, CONDITIONS LIMITES
/---------------------------------------------------------------------
/
PRESCRIBED FLOWRATES =0;50.0
/
VELOCITY PROFILES =1;4
/
PRESCRIBED ELEVATIONS =2.0;0
/
OPTION FOR LIQUID BOUNDARIES =1;1
/
/
/---------------------------------------------------------------------
/ PARAMETRES NUMERIQUES
/---------------------------------------------------------------------
/
BREACH =YES
/
TREATMENT OF THE LINEAR SYSTEM =2
/
FREE SURFACE GRADIENT COMPATIBILITY =0.9
/
INITIAL TIME SET TO ZERO =true
/
TIME STEP =0.5
/
SUPG OPTION =1;2
/
DURATION =2700
/
CONTINUITY CORRECTION =true
/
/---------------------------------------------------------------------
/ PARAMETRES NUMERIQUES, SOLVEUR
/---------------------------------------------------------------------
/
SOLVER =1
/
SOLVER ACCURACY =1.E-5
/
/
/---------------------------------------------------------------------
/ PARAMETRES NUMERIQUES, VITESSE-CELERITE-HAUTEUR
/---------------------------------------------------------------------
/
MASS-LUMPING ON VELOCITY =1.
/
IMPLICITATION FOR DEPTH =0.6
/
MASS-LUMPING ON H =1.
/
IMPLICITATION FOR VELOCITY =0.6
...
```
* .poi file (dedicated to specify Funz output Points Of Interest):
```
xylowercenter=2500,15
xymediumcenter=2500,250
xylowerright=2900,15
xymediumright=2900,250
allmap=2500,15:10,10:2900,250
.notreadmap=2500,15:100,100:2900,250
```
* will identify input:
* vel, expected to default value 0.005
Expand All @@ -155,6 +52,8 @@ It supports the following syntax and features:
* file type supported: *.slf `RESULTS FILE` (Seraphin format)
* read any `VARIABLES FOR GRAPHIC PRINTOUTS` at .poi points, along time
* will return time dependant arrays like: `H_xylowerright`=`[2.3383100032806396,2.3411474227905273,2.3438708782196045,2.3465609550476074,...]`
* will return time dependant maps (10x10 pixels) like: `H_allmap`=`[[2.3383100032806396,2.3411474227905273,...],[...],...]]`
* will **NOT** return ignored maps (100x100 pixels, too much) like: `H_.notreadmap`=`[[2.3383100032806396,2.3411474227905273,...],[...],...]]`



Expand Down
30 changes: 18 additions & 12 deletions src/main/java/org/funz/Telemac/TelemacIOPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public void setInputFiles(File... inputfiles) {
if (variables_sorties_graphiques != null && !pois.isEmpty()) {
for (String o : variables_sorties_graphiques) {
for (String p : pois.stringPropertyNames()) {
_output.put(o + "_" + p.replace(" ", ""), new double[]{Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random()});
if (p.charAt(0)!='.') // ignore ".abc" output
_output.put(o + "_" + p.replace(" ", ""), new double[]{Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random()});
}
}

Expand Down Expand Up @@ -160,26 +161,31 @@ public boolean accept(File pathname) {
lout.put("error","Could not find .cas file !");
return lout;
}

lout.putAll(TelemacHelper.extractPOIfromCASRES(cas, pois));
Map all = TelemacHelper.extractPOIfromCASRES(cas, pois);
for (String k : all.keySet())
if (k.charAt(0)!='.') // ignore ".abc" output
lout.put(k, all.get(k));
all = null;
} catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
lout.put("error","Could not read coord "+pois+" in results of cas "+cas.getName()+" : "+sw.toString());
}
} else {
for (File f : csvfiles) {
try {
lout.put(f.getName().substring(0, f.getName().indexOf(".csv")), readDoubleArray2D(FileUtils.readFileToString(f)));
} catch (IOException ex) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
lout.put("error","Could not read csv file "+f.getName()+" : "+sw.toString());
for (File f : csvfiles) {
try {
String k = f.getName().substring(0, f.getName().indexOf(".csv"));
if (k.length()>3 && k.charAt(2)!='.') // ignore ".abc" output
lout.put(k, readDoubleArray2D(FileUtils.readFileToString(f)));
} catch (IOException ex) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
lout.put("error","Could not read csv file "+f.getName()+" : "+sw.toString());
}
}
}
}

for (String k:lout.keySet()) { // simplify if possible to 1D arrays
if (lout.get(k) instanceof double[][])
Expand Down

0 comments on commit f24822b

Please sign in to comment.