Skip to content

Commit

Permalink
Minor changes to the source code, some reources were updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariolina88 committed Nov 9, 2017
1 parent a0f51c4 commit 6fadc44
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 36 deletions.
2 changes: 1 addition & 1 deletion resources/Input/LAI_1_daily.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ Format,yyyy-MM-dd HH:mm,
,1998-11-03 00:00,0.766666667
,1998-11-04 00:00,-9999
,1998-11-05 00:00,-9999
,1998-11-06 00:00,-9999
,1998-11-06 00:00,0.8
,1998-11-07 00:00,-9999
,1998-11-08 00:00,-9999
,1998-11-09 00:00,-9999
Expand Down
7 changes: 3 additions & 4 deletions resources/Output/canopy/ET_Canopy.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
@T,table
Created,2017-07-30 19:32
Created,2017-10-06 08:26
Author,HortonMachine library
@H,timestamp,value_1
ID,,1
Type,Date,Double
Format,yyyy-MM-dd HH:mm,
,1998-10-03 00:00,0.0
,1998-10-04 00:00,1.75712008630895
,1998-10-05 00:00,1.7466932491079
,1998-11-03 00:00,1.05360518276067
,1998-11-04 00:00,1.00830685552745

7 changes: 3 additions & 4 deletions resources/Output/canopy/Q_Canopy.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
@T,table
Created,2017-07-30 19:32
Created,2017-10-06 08:26
Author,HortonMachine library
@H,timestamp,value_1
ID,,1
Type,Date,Double
Format,yyyy-MM-dd HH:mm,
,1998-10-03 00:00,0.1348868100304803
,1998-10-04 00:00,15.163637831229755
,1998-10-05 00:00,37.8971025087221
,1998-11-03 00:00,9.727577976518907
,1998-11-04 00:00,19.8988760784501

7 changes: 3 additions & 4 deletions resources/Output/canopy/S_Canopy.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
@T,table
Created,2017-07-30 19:32
Created,2017-10-06 08:26
Author,HortonMachine library
@H,timestamp,value_1
ID,,1
Type,Date,Double
Format,yyyy-MM-dd HH:mm,
,1998-10-03 00:00,0.3142980258721817
,1998-10-04 00:00,3.492359566686218
,1998-10-05 00:00,10.108995431213229
,1998-11-03 00:00,2.140335893970077
,1998-11-04 00:00,5.304078072652091

14 changes: 10 additions & 4 deletions src/main/java/canopyOUT/WaterBudgetCanopyOUT.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class WaterBudgetCanopyOUT{
@Description("Leaf Area Index Hashmap")
@In
public HashMap<Integer, double[]> inHMLAI;

//double LAI=1;


@Description("coefficient canopy out")
Expand Down Expand Up @@ -146,12 +148,14 @@ public void process() throws Exception {


double LAI= inHMLAI.get(ID)[0];
if (isNovalue(LAI)) LAI= 3;
if (isNovalue(LAI)) LAI=0.6;
//} else LAI=LAI_t;


if(step==0){

initialConditionS_i.put(ID,new double[]{kc_canopy_out*LAI/2});
initialConditionS_i.put(ID,new double[]{kc_canopy_out*LAI/2});
System.out.println("kc_in"+kc_canopy_out);
}

ETp=0;
Expand Down Expand Up @@ -198,15 +202,17 @@ public double computeS(double rain, double S_i, double LAI) throws IOException {
/** Boundaries conditions*/
double[] y = new double[] { S_i, s_CanopyMax };

//System.out.println("kc_in"+kc_canopy_out);


/** Choice of the ODE solver */
SolverODE solver;
solver=SimpleIntegratorFactory.createSolver(solver_model, 1, ode, y);

/** result of the resolution of the ODE*/
S_i=(S_i<0.1&rain==0)?0:solver.integrateValues();


S_i=(S_i<0)?0:S_i;
//if (S_i<0.1)System.out.println("canopy"+S_i);

return S_i;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/groundWater/WaterBudgetGroundWater.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public void process() throws Exception {
if(step==0){
for (Entry<Integer, double[]> entry : entrySet){
Integer ID = entry.getKey();
initialConditionS_i.put(ID,new double[]{Smax/2});
initialConditionS_i.put(ID,new double[]{5});
System.out.println("gw"+a+"-"+b+"-"+Smax);
}
}

Expand Down Expand Up @@ -171,7 +172,7 @@ public double computeS(double recharge, double S_i) throws IOException {
/** Check of the Storage values: they cannot be negative*/
if (S_i<0) S_i=0;

if(S_i<1)System.out.println("gw"+a+"-"+b+"-"+Smax);
if(S_i<0.01)System.out.println("gw"+a+"-"+b+"-"+Smax);


return S_i;
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/rootZone/WaterBudgetRootZone.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ public void process() throws Exception {
for (Entry<Integer, double[]> entry : entrySet){
Integer ID = entry.getKey();
initialConditionS_i.put(ID,new double[]{s_RootZoneMax/2});
System.out.println("P:"+Pmax );
//System.out.println("input:"+actualInput );
System.out.println("b:"+b_rz );
System.out.println("pB:"+pB );
}
}

Expand Down Expand Up @@ -185,10 +189,7 @@ public void process() throws Exception {

//System.out.println("RZmax:"+s_RootZoneMax );

//System.out.println("P:"+Pmax );
//System.out.println("input:"+actualInput );
//System.out.println("b:"+b_rz );
//System.out.println("pB:"+pB );




Expand Down Expand Up @@ -279,7 +280,7 @@ public double computeS(double actualInput, double S_i, double ETp) throws IOExce
/** Check of the Storage values: they cannot be negative*/
//if (S_i<0) S_i=0;

if(S_i<0.5)System.out.println("rootzone"+"-"+s_RootZoneMax+"-"+Pmax+"-"+b_rz);
//if(S_i<0.5)System.out.println("rootzone"+"-"+s_RootZoneMax+"-"+Pmax+"-"+b_rz);


return S_i;
Expand All @@ -295,7 +296,7 @@ public double computeS(double actualInput, double S_i, double ETp) throws IOExce
* @throws IOException Signals that an I/O exception has occurred.
*/
public double computeR(double S_i) throws IOException {
double Rg=Pmax*Math.pow(S_i, b_rz);
double Rg=Pmax*Math.pow(S_i/s_RootZoneMax, b_rz);
return Rg;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/rootZone/waterBudgetODE.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public int getDimension() {
*/
public void computeDerivatives(double t, double[] y, double[] yDot)
throws MaxCountExceededException, DimensionMismatchException {
yDot[0] =actualInput-Math.max(0, (ETp*Math.min(1,1.33*(y[0]/s_RootZoneMax))))-Pmax*Math.pow(y[0], b_rz);
yDot[0] =actualInput-Math.max(0, (ETp*Math.min(1,1.33*(y[0]/s_RootZoneMax))))-Pmax*Math.pow(y[0]/s_RootZoneMax, b_rz);
//System.out.println("y"+yDot[0]);

}
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/simpleBucket/WaterBudget.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class WaterBudget{

@Description("Smax")
@In
public double Smax=10;
public double Smax_ro=10;


@Description("ODE solver model: dp853, Eulero ")
Expand Down Expand Up @@ -113,7 +113,8 @@ public void process() throws Exception {
if(step==0){
for (Entry<Integer, double[]> entry : entrySet){
Integer ID = entry.getKey();
initialConditionS_i.put(ID,new double[]{Smax/2});
initialConditionS_i.put(ID,new double[]{Smax_ro/2});
System.out.println("ro"+a_ro+"-"+b_ro+"-"+Smax_ro);
}
}

Expand Down Expand Up @@ -156,10 +157,10 @@ public double computeS(double recharge, double S_i) throws IOException {


/** Creation of the differential equation*/
FirstOrderDifferentialEquations ode=new waterBudgetODE(recharge,a_ro,b_ro);
FirstOrderDifferentialEquations ode=new waterBudgetODE(recharge,a_ro,b_ro,Smax_ro);

/** Boundaries conditions*/
double[] y = new double[] { S_i, Smax };
double[] y = new double[] { S_i, Smax_ro };

/** Choice of the ODE solver */
SolverODE solver;
Expand All @@ -171,7 +172,7 @@ public double computeS(double recharge, double S_i) throws IOException {
/** Check of the Storage values: they cannot be negative*/
if (S_i<0) S_i=0;

//if(S_i<1)System.out.println("ro"+a_ro+"-"+b_ro+"-"+Smax);
//if(S_i<1)System.out.println("ro"+a_ro+"-"+b_ro+"-"+Smax_ro);


return S_i;
Expand All @@ -185,7 +186,7 @@ public double computeS(double recharge, double S_i) throws IOException {
* @throws IOException Signals that an I/O exception has occurred.
*/
public double computeQ(double S_i) throws IOException {
double Q=a_ro*Math.pow(S_i,b_ro);
double Q=a_ro*Math.pow(S_i/Smax_ro,b_ro);
return Q;
}

Expand Down
7 changes: 5 additions & 2 deletions src/main/java/simpleBucket/waterBudgetODE.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class waterBudgetODE implements FirstOrderDifferentialEquations{
public double b;

public double recharge;

public double Smax_ro;



Expand All @@ -47,10 +49,11 @@ public class waterBudgetODE implements FirstOrderDifferentialEquations{
* @param recharge: input recharge value
* @param Qmod: the modeled input discharge
*/
public waterBudgetODE(double recharge, double a, double b) {
public waterBudgetODE(double recharge, double a, double b, double Smax_ro) {
this.a=a;
this.b=b;
this.recharge=recharge;
this.Smax_ro=Smax_ro;

}

Expand All @@ -66,7 +69,7 @@ public int getDimension() {
*/
public void computeDerivatives(double t, double[] y, double[] yDot)
throws MaxCountExceededException, DimensionMismatchException {
yDot[0] =recharge-a*Math.pow(y[0], b);
yDot[0] =recharge-a*Math.pow(y[0]/Smax_ro, b);



Expand Down
4 changes: 2 additions & 2 deletions src/test/java/waterBudgetTest/TestCanopyOUT.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class TestCanopyOUT{
@Test
public void testLinear() throws Exception {

String startDate = "1998-10-03 00:00";
String endDate = "1998-10-05 00:00";
String startDate = "1998-11-03 00:00";
String endDate = "1998-11-07 00:00";
int timeStepMinutes = 60*24;
String fId = "ID";

Expand Down

0 comments on commit 6fadc44

Please sign in to comment.