Skip to content

Commit fba5ac5

Browse files
committed
The WFIUH was modified in order to decrease the computational demand. Now the output discharge is directly computed in hour and not in seconds anymore. The resources and the test cases were updated according to the refactoring.
1 parent 9522569 commit fba5ac5

File tree

10 files changed

+86
-95
lines changed

10 files changed

+86
-95
lines changed

resources/Input/InputRO_1.csv

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ Format,yyyy-MM-dd HH:mm,
1111
,1997-01-01 03:00,0
1212
,1997-01-01 04:00,0
1313
,1997-01-01 05:00,0
14-
,1997-01-01 06:00,1.7190913370310199E-4
15-
,1997-01-01 07:00,6.147714850909813E-5
16-
,1997-01-01 08:00,2.1775146247071664E-5
17-
,1997-01-01 09:00,5.6462244150956575E-6
18-
,1997-01-01 10:00,1.1684025212621574E-6
19-
,1997-01-01 11:00,2.1502096814174365E-7
20-
,1997-01-01 12:00,3.957276326072012E-8
21-
,1997-01-01 13:00,8.389282796228414E-9
22-
,1997-01-01 14:00,2.308585433929977E-9
23-
,1997-01-01 15:00,8.27513862988738E-10
24-
,1997-01-01 16:00,2.967447954027591E-10
14+
,1997-01-01 06:00,0
15+
,1997-01-01 07:00,0
16+
,1997-01-01 08:00,0
17+
,1997-01-01 09:00,0
18+
,1997-01-01 10:00,0
19+
,1997-01-01 11:00,0
20+
,1997-01-01 12:00,0
21+
,1997-01-01 13:00,0
22+
,1997-01-01 14:00,0
23+
,1997-01-01 15:00,0
24+
,1997-01-01 16:00,0
2525
,1997-01-01 17:00,1.0644918280178217E-10
2626
,1997-01-01 18:00,3.8131026114385236E-11
2727
,1997-01-01 19:00,1.3716611180214498E-11
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@T,table
2+
Created,2017-09-19 16:25
3+
Author,HortonMachine library
4+
@H,timestamp,value_1
5+
ID,,1
6+
Type,Date,Double
7+
Format,yyyy-MM-dd HH:mm,
8+
,1997-01-01 00:00,0.0
9+
,1997-01-01 01:00,0.0029880398521947463
10+
,1997-01-01 02:00,0.004235668935120196
11+
,1997-01-01 03:00,0.004596262334222073
12+
,1997-01-01 04:00,0.004754539611584759
13+
,1997-01-01 05:00,0.004430917997229152
14+
,1997-01-01 06:00,0.004217198476063385
15+
,1997-01-01 07:00,0.004715793945150948
16+
,1997-01-01 08:00,0.0034884736314014855
17+
,1997-01-01 09:00,0.0022409312350462032
18+
,1997-01-01 10:00,0.001974101021157078
19+
,1997-01-01 11:00,0.0012111796157117456
20+
,1997-01-01 12:00,8.422025972651812E-4
21+
,1997-01-01 13:00,0.0
22+
,1997-01-01 14:00,0.0
23+
,1997-01-01 15:00,0.0
24+

resources/Output/runoff/Q_runoff_2.csv

Lines changed: 0 additions & 14 deletions
This file was deleted.

resources/Output/runoff/Q_runoff_2_1.csv

Lines changed: 0 additions & 14 deletions
This file was deleted.

resources/Output/runoff/Q_runoff_3.csv

Lines changed: 0 additions & 14 deletions
This file was deleted.

resources/Output/runoff/Q_runoff_3_1.csv

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@T,table
2+
Created,2017-09-19 16:25
3+
Author,HortonMachine library
4+
@H,timestamp,value_1
5+
ID,,1
6+
Type,Date,Double
7+
Format,yyyy-MM-dd HH:mm,
8+
,1997-01-01 00:00,0.0
9+
,1997-01-01 01:00,0.013762721939484501
10+
,1997-01-01 02:00,0.019509222321433862
11+
,1997-01-01 03:00,0.021170092634595013
12+
,1997-01-01 04:00,0.021899107729919563
13+
,1997-01-01 05:00,0.020408527111086167
14+
,1997-01-01 06:00,0.01942414855914558
15+
,1997-01-01 07:00,0.02172064764910877
16+
,1997-01-01 08:00,0.016067688169198246
17+
,1997-01-01 09:00,0.010321587060089985
18+
,1997-01-01 10:00,0.00909258402784734
19+
,1997-01-01 11:00,0.005578616449030558
20+
,1997-01-01 12:00,0.003879131717188655
21+
,1997-01-01 13:00,0.0
22+
,1997-01-01 14:00,0.0
23+
,1997-01-01 15:00,0.0
24+

src/main/java/runoff/WFIUHKinematic.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,38 +69,40 @@ public WFIUHKinematic(double [][] widthFunction, double inputFluxes, int inTimes
6969

7070
// tcorr is the concentration time in seconds
7171
int tcorr =(int) widthFunction[widthFunction.length - 1][0];
72+
int tcorr_h=tcorr/3600;
7273

73-
// is the duration of the precipitation in minutes
74+
// is the duration of the precipitation in seconds
7475
int tpmax =inTimestep*60;
75-
tpmax=(tpmax>tcorr)?tcorr:tpmax;
76+
int tpmax_h =inTimestep/60;
77+
tpmax_h=(tpmax_h>tcorr_h)?tcorr_h:tpmax_h;
7678

7779

7880

7981
//is the discharge computed in m^3/s according to the WFIUH at time step i+1 (i1)
80-
double[] Q_i1 = new double[(int) tcorr + tpmax + 1];
82+
double[] Q_i1 = new double[(int) tcorr_h + tpmax_h + 1];
8183

8284

83-
for( int t = 1; t <= tcorr; t += 1 ) {
85+
for( int t = 1; t <= tcorr_h; t += 1 ) {
8486

85-
if (t <= tpmax) {
87+
if (t <= tpmax_h) {
8688

87-
Q_i1[t]=(double) (inputFluxes* area*ModelsEngine.width_interpolate(widthFunction, t, 0, 2));
89+
Q_i1[t]=(double) (inputFluxes* area*ModelsEngine.width_interpolate(widthFunction, t*3600, 0, 2));
8890

8991

9092

9193
} else {
92-
Q_i1[t]= (double) (inputFluxes *area* (ModelsEngine.width_interpolate(widthFunction, t, 0, 2) - ModelsEngine
93-
.width_interpolate(widthFunction, t - tpmax, 0, 2)));
94+
Q_i1[t]= (double) (inputFluxes *area* (ModelsEngine.width_interpolate(widthFunction, t*3600, 0, 2) - ModelsEngine
95+
.width_interpolate(widthFunction, t*3600 - tpmax, 0, 2)));
9496
}
9597

9698
}
9799

98100

99101

100-
for( int t = tcorr; t < (tcorr + tpmax); t += 1 ) {
102+
for( int t = tcorr_h; t < (tcorr_h + tpmax_h); t += 1 ) {
101103

102104
Q_i1[t] = (double) (inputFluxes * area*(widthFunction[widthFunction.length - 1][2]
103-
- ModelsEngine.width_interpolate(widthFunction, t - tpmax, 0, 2)));
105+
- ModelsEngine.width_interpolate(widthFunction, t*3600 - tpmax, 0, 2)));
104106
}
105107

106108

src/main/java/runoff/WaterBudgetRunoff.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void process() throws Exception {
160160
// and its timeStep, plus the length of the width function/60, since we want minute intervals
161161

162162
// now is in minutes
163-
runoff=new double [(int) widthFunction[widthFunction.length - 1][0] +inTimestep*60 + 1];
163+
runoff=new double [(int) widthFunction[widthFunction.length - 1][0]/3600 +inTimestep/60 + 1];
164164

165165
}
166166

@@ -181,16 +181,16 @@ public void process() throws Exception {
181181

182182
/** The output of the previous computation in the average discharge in 1 minute in m^3/s
183183
* so we need the compute the hourly average */
184-
double Q=computeMean(runoff,inTimestep);
184+
//double Q=computeMean(runoff,inTimestep);
185185

186186
//System.out.println("runoff:"+Q);
187-
double Q_mm=Q*conversion/(area);
187+
double Q_mm=runoff[0]*conversion/(area);
188188

189189

190190
/** Save the result in hashmaps for each station*/
191-
storeResult_series(ID,alpha*rain,Q,Q_mm);
191+
storeResult_series(ID,alpha*rain,runoff[0],Q_mm);
192192

193-
runoff=computeNewVector(runoff,inTimestep);
193+
runoff=computeNewVector(runoff,inTimestep/60);
194194

195195
step++;
196196

@@ -253,7 +253,7 @@ public double computeMean (double [] runoff, int inTimeStep ){
253253

254254
public double [] computeNewVector (double [] runoff,int inTimeStep){
255255

256-
inTimeStep=inTimeStep*60;
256+
//inTimeStep=inTimeStep*60;
257257

258258
for (int i=0;i<runoff.length;i++){
259259
if (i<runoff.length-inTimeStep){

src/test/java/waterBudgetTest/TestRunoff.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ public class TestRunoff{
1919
public void testLinear() throws Exception {
2020

2121
String startDate = "1997-01-01 00:00";
22-
String endDate = "1997-01-01 05:00";
22+
String endDate = "1997-01-01 15:00";
2323
int timeStepMinutes = 60;
2424
String fId = "ID";
2525

2626
String inPathToPrec = "resources/Input/InputRO_1.csv";
27-
String pathToQ= "resources/Output/runoff/Q_runoff_2_1.csv";
28-
String pathToQint= "resources/Output/runoff/Q_runoff_3_1.csv";
27+
String pathToQ= "resources/Output/runoff/Q_runoff.csv";
28+
String pathToQmm= "resources/Output/runoff/Q_runoff_mm.csv";
2929

3030

3131

@@ -42,7 +42,7 @@ public void testLinear() throws Exception {
4242
writerQ.fileNovalue="-9999";
4343

4444

45-
writerQint.file = pathToQint;
45+
writerQint.file = pathToQmm;
4646
writerQint.tStart = startDate;
4747
writerQint.tTimestep = timeStepMinutes;
4848
writerQint.fileNovalue="-9999";
@@ -68,17 +68,14 @@ public void testLinear() throws Exception {
6868

6969

7070
while( JReader.doProcess ) {
71-
72-
//waterBudgetRunoff.solver_model="dp853";
73-
//waterBudgetRunoff.ET_model="AET";
71+
7472
waterBudgetRunoff.inRescaledDistance=width_sup;
75-
waterBudgetRunoff.pCelerity=4;
73+
waterBudgetRunoff.pCelerity=0.4;
7674
waterBudgetRunoff.inTopindex=topIndex;
7775
waterBudgetRunoff.pSat=20;
7876
waterBudgetRunoff.inTimestep=timeStepMinutes;
7977
waterBudgetRunoff.ID=1;
8078
waterBudgetRunoff.alpha=1;
81-
//waterBudgetRunoff.s_RunoffMax=4.60;
8279

8380
JReader.nextRecord();
8481

@@ -88,7 +85,7 @@ public void testLinear() throws Exception {
8885
waterBudgetRunoff.process();
8986

9087
HashMap<Integer, double[]> outHMDischarge = waterBudgetRunoff.outHMDischarge;
91-
HashMap<Integer, double[]> outHMDischargeint = waterBudgetRunoff.outHMDischarge_mm;
88+
HashMap<Integer, double[]> outHMDischarge_mm = waterBudgetRunoff.outHMDischarge_mm;
9289

9390

9491
writerQ.inData = outHMDischarge;
@@ -98,10 +95,10 @@ public void testLinear() throws Exception {
9895
writerQ.close();
9996
}
10097

101-
writerQint.inData = outHMDischargeint;
98+
writerQint.inData = outHMDischarge_mm;
10299
writerQint.writeNextLine();
103100

104-
if (pathToQint != null) {
101+
if (pathToQmm != null) {
105102
writerQint.close();
106103
}
107104

0 commit comments

Comments
 (0)