Skip to content

Commit

Permalink
bulk push. fixed bugs, added mass balance to bmi output vars, added s…
Browse files Browse the repository at this point in the history
…ynthetic examples with jupyter notebook to compare C, Py, and Hydrus results.
  • Loading branch information
ajkhattak committed Mar 3, 2023
1 parent caace01 commit 5ef7c1f
Show file tree
Hide file tree
Showing 25 changed files with 2,124 additions and 42 deletions.
19 changes: 19 additions & 0 deletions data/vG_default_params_synthetic.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"Texture theta_r theta_e alpha (cm^-1) n m Ks (cm/h)"
"Clay" 0.1 0.46 1.00E-02 1.25 0.2 0.612
"Clay-loam" 0.08 0.44 2.00E-02 1.42 0.29 0.3348
"Loam" 0.06 0.4 1.00E-02 1.47 0.32 0.504
"Loamy-sand" 0.05 0.39 3.00E-02 1.75 0.43 4.32
"Sand" 0.05 0.38 4.00E-02 3.18 0.69 26.64
"Sandy-clay" 0.12 0.39 3.00E-02 1.21 0.17 0.468
"Sandy-clay loam" 0.06 0.38 2.00E-02 1.33 0.25 0.54
"Sandy-loam" 0.04 0.39 3.00E-02 1.45 0.31 1.584
"Silt" 0.05 0.49 1.00E-02 1.68 0.4 1.836
"Silty-clay" 0.11 0.48 2.00E-02 1.32 0.24 0.432
"Silty-clay loam" 0.09 0.48 1.00E-02 1.52 0.34 0.468
"Silt-loam" 0.07 0.44 1.00E-02 1.66 0.4 0.756
"S1-1" 0.078 0.43 0.036 1.56 0.358974 3.12
"S1-2" 0.095 0.41 0.019 1.31 0.23664 0.26
"S1-3" 0.089 0.43 0.010 1.23 0.186991 0.07
"S3-1" 0.057 0.41 0.124 2.28 0.5614035 14.59
"S3-2" 0.078 0.43 0.036 1.56 0.3589743 1.04
"S3-3" 0.067 0.45 0.020 1.41 0.290780 0.45
File renamed without changes.
147 changes: 147 additions & 0 deletions forcing/forcing_data_synth_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
#Time,P(mm/h),PET(mm/h)
2016-10-01 00:00:00,0.0,0.0
2016-10-01 00:05:00,0.0,0.0
2016-10-01 00:10:00,0.0,0.0
2016-10-01 00:15:00,0.0,0.0
2016-10-01 00:20:00,0.0,0.0
2016-10-01 00:25:00,0.0,0.0
2016-10-01 00:30:00,20.0,0.0
2016-10-01 00:35:00,20.0,0.0
2016-10-01 00:40:00,20.0,0.0
2016-10-01 00:45:00,20.0,0.0
2016-10-01 00:50:00,20.0,0.0
2016-10-01 00:55:00,0.0,0.0
2016-10-01 01:00:00,0.0,0.0
2016-10-01 01:05:00,0.0,0.0
2016-10-01 01:10:00,0.0,0.0
2016-10-01 01:15:00,0.0,0.0
2016-10-01 01:20:00,0.0,0.0
2016-10-01 01:25:00,0.0,0.0
2016-10-01 01:30:00,0.0,0.0
2016-10-01 01:35:00,0.0,0.0
2016-10-01 01:40:00,0.0,0.0
2016-10-01 01:45:00,0.0,0.0
2016-10-01 01:50:00,0.0,0.0
2016-10-01 01:55:00,0.0,0.0
2016-10-01 02:00:00,0.0,0.0
2016-10-01 02:05:00,0.0,0.0
2016-10-01 02:10:00,0.0,0.0
2016-10-01 02:15:00,0.0,0.0
2016-10-01 02:20:00,0.0,0.0
2016-10-01 02:25:00,0.0,0.0
2016-10-01 02:30:00,0.0,0.0
2016-10-01 02:35:00,0.0,0.0
2016-10-01 02:40:00,0.0,0.0
2016-10-01 02:45:00,0.0,0.0
2016-10-01 02:50:00,0.0,0.0
2016-10-01 02:55:00,0.0,0.0
2016-10-01 03:00:00,0.0,0.0
2016-10-01 03:05:00,0.0,0.0
2016-10-01 03:10:00,0.0,0.0
2016-10-01 03:15:00,0.0,0.0
2016-10-01 03:20:00,0.0,0.0
2016-10-01 03:25:00,0.0,0.0
2016-10-01 03:30:00,0.0,0.0
2016-10-01 03:35:00,0.0,0.0
2016-10-01 03:40:00,0.0,0.0
2016-10-01 03:45:00,0.0,0.0
2016-10-01 03:50:00,0.0,0.0
2016-10-01 03:55:00,0.0,0.0
2016-10-01 04:00:00,0.0,0.0
2016-10-01 04:05:00,0.0,0.0
2016-10-01 04:10:00,0.0,0.0
2016-10-01 04:15:00,0.0,0.0
2016-10-01 04:20:00,0.0,0.0
2016-10-01 04:25:00,0.0,0.0
2016-10-01 04:30:00,0.0,0.0
2016-10-01 04:35:00,0.0,0.0
2016-10-01 04:40:00,0.0,0.0
2016-10-01 04:45:00,0.0,0.0
2016-10-01 04:50:00,0.0,0.0
2016-10-01 04:55:00,20.0,0.0
2016-10-01 05:00:00,20.0,0.0
2016-10-01 05:05:00,20.0,0.0
2016-10-01 05:10:00,20.0,0.0
2016-10-01 05:15:00,20.0,0.0
2016-10-01 05:20:00,20.0,0.0
2016-10-01 05:25:00,20.0,0.0
2016-10-01 05:30:00,20.0,0.0
2016-10-01 05:35:00,20.0,0.0
2016-10-01 05:40:00,20.0,0.0
2016-10-01 05:45:00,20.0,0.0
2016-10-01 05:50:00,20.0,0.0
2016-10-01 05:55:00,20.0,0.0
2016-10-01 06:00:00,20.0,0.0
2016-10-01 06:05:00,20.0,0.0
2016-10-01 06:10:00,20.0,0.0
2016-10-01 06:15:00,20.0,0.0
2016-10-01 06:20:00,20.0,0.0
2016-10-01 06:25:00,20.0,0.0
2016-10-01 06:30:00,20.0,0.0
2016-10-01 06:35:00,20.0,0.0
2016-10-01 06:40:00,20.0,0.0
2016-10-01 06:45:00,20.0,0.0
2016-10-01 06:50:00,20.0,0.0
2016-10-01 06:55:00,20.0,0.0
2016-10-01 07:00:00,20.0,0.0
2016-10-01 07:05:00,20.0,0.0
2016-10-01 07:10:00,20.0,0.0
2016-10-01 07:15:00,20.0,0.0
2016-10-01 07:20:00,20.0,0.0
2016-10-01 07:25:00,20.0,0.0
2016-10-01 07:30:00,20.0,0.0
2016-10-01 07:35:00,20.0,0.0
2016-10-01 07:40:00,20.0,0.0
2016-10-01 07:45:00,20.0,0.0
2016-10-01 07:50:00,20.0,0.0
2016-10-01 07:55:00,20.0,0.0
2016-10-01 08:00:00,20.0,0.0
2016-10-01 08:05:00,20.0,0.0
2016-10-01 08:10:00,20.0,0.0
2016-10-01 08:15:00,20.0,0.0
2016-10-01 08:20:00,20.0,0.0
2016-10-01 08:25:00,20.0,0.0
2016-10-01 08:30:00,20.0,0.0
2016-10-01 08:35:00,20.0,0.0
2016-10-01 08:40:00,20.0,0.0
2016-10-01 08:45:00,20.0,0.0
2016-10-01 08:50:00,20.0,0.0
2016-10-01 08:55:00,20.0,0.0
2016-10-01 09:00:00,20.0,0.0
2016-10-01 09:05:00,20.0,0.0
2016-10-01 09:10:00,20.0,0.0
2016-10-01 09:15:00,20.0,0.0
2016-10-01 09:20:00,20.0,0.0
2016-10-01 09:25:00,20.0,0.0
2016-10-01 09:30:00,20.0,0.0
2016-10-01 09:35:00,20.0,0.0
2016-10-01 09:40:00,20.0,0.0
2016-10-01 09:45:00,20.0,0.0
2016-10-01 09:50:00,20.0,0.0
2016-10-01 09:55:00,20.0,0.0
2016-10-01 10:00:00,20.0,0.0
2016-10-01 10:05:00,20.0,0.0
2016-10-01 10:10:00,20.0,0.0
2016-10-01 10:15:00,20.0,0.0
2016-10-01 10:20:00,20.0,0.0
2016-10-01 10:25:00,20.0,0.0
2016-10-01 10:30:00,20.0,0.0
2016-10-01 10:35:00,20.0,0.0
2016-10-01 10:40:00,20.0,0.0
2016-10-01 10:45:00,0.0,0.0
2016-10-01 10:50:00,0.0,0.0
2016-10-01 10:55:00,0.0,0.0
2016-10-01 11:00:00,0.0,0.0
2016-10-01 11:05:00,0.0,0.0
2016-10-01 11:10:00,0.0,0.0
2016-10-01 11:15:00,0.0,0.0
2016-10-01 11:20:00,0.0,0.0
2016-10-01 11:25:00,0.0,0.0
2016-10-01 11:30:00,0.0,0.0
2016-10-01 11:35:00,0.0,0.0
2016-10-01 11:40:00,0.0,0.0
2016-10-01 11:45:00,0.0,0.0
2016-10-01 11:50:00,0.0,0.0
2016-10-01 11:55:00,0.0,0.0


148 changes: 148 additions & 0 deletions forcing/forcing_data_synth_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#Time,P(mm/h),PET(mm/h)
2016-10-01 00:00:00,0.0,0.0
2016-10-01 00:05:00,0.0,0.0
2016-10-01 00:10:00,0.0,0.0
2016-10-01 00:15:00,0.0,0.0
2016-10-01 00:20:00,0.0,0.0
2016-10-01 00:25:00,0.0,0.0
2016-10-01 00:30:00,50.0,0.0
2016-10-01 00:35:00,50.0,0.0
2016-10-01 00:40:00,50.0,0.0
2016-10-01 00:45:00,50.0,0.0
2016-10-01 00:50:00,50.0,0.0
2016-10-01 00:55:00,0.0,0.0
2016-10-01 01:00:00,0.0,0.0
2016-10-01 01:05:00,0.0,0.0
2016-10-01 01:10:00,0.0,0.0
2016-10-01 01:15:00,0.0,0.0
2016-10-01 01:20:00,0.0,0.0
2016-10-01 01:25:00,0.0,0.0
2016-10-01 01:30:00,0.0,0.0
2016-10-01 01:35:00,0.0,0.0
2016-10-01 01:40:00,0.0,0.0
2016-10-01 01:45:00,0.0,0.0
2016-10-01 01:50:00,0.0,0.0
2016-10-01 01:55:00,0.0,0.0
2016-10-01 02:00:00,0.0,0.0
2016-10-01 02:05:00,0.0,0.0
2016-10-01 02:10:00,0.0,0.0
2016-10-01 02:15:00,0.0,0.0
2016-10-01 02:20:00,0.0,0.0
2016-10-01 02:25:00,0.0,0.0
2016-10-01 02:30:00,0.0,0.0
2016-10-01 02:35:00,0.0,0.0
2016-10-01 02:40:00,0.0,0.0
2016-10-01 02:45:00,0.0,0.0
2016-10-01 02:50:00,0.0,0.0
2016-10-01 02:55:00,0.0,0.0
2016-10-01 03:00:00,0.0,0.0
2016-10-01 03:05:00,0.0,0.0
2016-10-01 03:10:00,0.0,0.0
2016-10-01 03:15:00,0.0,0.0
2016-10-01 03:20:00,0.0,0.0
2016-10-01 03:25:00,0.0,0.0
2016-10-01 03:30:00,0.0,0.0
2016-10-01 03:35:00,0.0,0.0
2016-10-01 03:40:00,0.0,0.0
2016-10-01 03:45:00,0.0,0.0
2016-10-01 03:50:00,0.0,0.0
2016-10-01 03:55:00,0.0,0.0
2016-10-01 04:00:00,0.0,0.0
2016-10-01 04:05:00,0.0,0.0
2016-10-01 04:10:00,0.0,0.0
2016-10-01 04:15:00,0.0,0.0
2016-10-01 04:20:00,0.0,0.0
2016-10-01 04:25:00,0.0,0.0
2016-10-01 04:30:00,0.0,0.0
2016-10-01 04:35:00,0.0,0.0
2016-10-01 04:40:00,0.0,0.0
2016-10-01 04:45:00,0.0,0.0
2016-10-01 04:50:00,0.0,0.0
2016-10-01 04:55:00,50.0,0.0
2016-10-01 05:00:00,50.0,0.0
2016-10-01 05:05:00,50.0,0.0
2016-10-01 05:10:00,50.0,0.0
2016-10-01 05:15:00,50.0,0.0
2016-10-01 05:20:00,50.0,0.0
2016-10-01 05:25:00,50.0,0.0
2016-10-01 05:30:00,50.0,0.0
2016-10-01 05:35:00,50.0,0.0
2016-10-01 05:40:00,50.0,0.0
2016-10-01 05:45:00,50.0,0.0
2016-10-01 05:50:00,50.0,0.0
2016-10-01 05:55:00,50.0,0.0
2016-10-01 06:00:00,50.0,0.0
2016-10-01 06:05:00,50.0,0.0
2016-10-01 06:10:00,50.0,0.0
2016-10-01 06:15:00,50.0,0.0
2016-10-01 06:20:00,50.0,0.0
2016-10-01 06:25:00,50.0,0.0
2016-10-01 06:30:00,50.0,0.0
2016-10-01 06:35:00,50.0,0.0
2016-10-01 06:40:00,50.0,0.0
2016-10-01 06:45:00,50.0,0.0
2016-10-01 06:50:00,50.0,0.0
2016-10-01 06:55:00,50.0,0.0
2016-10-01 07:00:00,50.0,0.0
2016-10-01 07:05:00,50.0,0.0
2016-10-01 07:10:00,50.0,0.0
2016-10-01 07:15:00,50.0,0.0
2016-10-01 07:20:00,50.0,0.0
2016-10-01 07:25:00,50.0,0.0
2016-10-01 07:30:00,50.0,0.0
2016-10-01 07:35:00,50.0,0.0
2016-10-01 07:40:00,50.0,0.0
2016-10-01 07:45:00,50.0,0.0
2016-10-01 07:50:00,50.0,0.0
2016-10-01 07:55:00,50.0,0.0
2016-10-01 08:00:00,50.0,0.0
2016-10-01 08:05:00,50.0,0.0
2016-10-01 08:10:00,50.0,0.0
2016-10-01 08:15:00,50.0,0.0
2016-10-01 08:20:00,50.0,0.0
2016-10-01 08:25:00,50.0,0.0
2016-10-01 08:30:00,50.0,0.0
2016-10-01 08:35:00,50.0,0.0
2016-10-01 08:40:00,50.0,0.0
2016-10-01 08:45:00,50.0,0.0
2016-10-01 08:50:00,50.0,0.0
2016-10-01 08:55:00,50.0,0.0
2016-10-01 09:00:00,50.0,0.0
2016-10-01 09:05:00,50.0,0.0
2016-10-01 09:10:00,50.0,0.0
2016-10-01 09:15:00,50.0,0.0
2016-10-01 09:20:00,50.0,0.0
2016-10-01 09:25:00,50.0,0.0
2016-10-01 09:30:00,50.0,0.0
2016-10-01 09:35:00,50.0,0.0
2016-10-01 09:40:00,50.0,0.0
2016-10-01 09:45:00,50.0,0.0
2016-10-01 09:50:00,50.0,0.0
2016-10-01 09:55:00,50.0,0.0
2016-10-01 10:00:00,50.0,0.0
2016-10-01 10:05:00,50.0,0.0
2016-10-01 10:10:00,50.0,0.0
2016-10-01 10:15:00,50.0,0.0
2016-10-01 10:20:00,50.0,0.0
2016-10-01 10:25:00,50.0,0.0
2016-10-01 10:30:00,50.0,0.0
2016-10-01 10:35:00,50.0,0.0
2016-10-01 10:40:00,50.0,0.0
2016-10-01 10:45:00,0.0,0.0
2016-10-01 10:50:00,0.0,0.0
2016-10-01 10:55:00,0.0,0.0
2016-10-01 11:00:00,0.0,0.0
2016-10-01 11:05:00,0.0,0.0
2016-10-01 11:10:00,0.0,0.0
2016-10-01 11:15:00,0.0,0.0
2016-10-01 11:20:00,0.0,0.0
2016-10-01 11:25:00,0.0,0.0
2016-10-01 11:30:00,0.0,0.0
2016-10-01 11:35:00,0.0,0.0
2016-10-01 11:40:00,0.0,0.0
2016-10-01 11:45:00,0.0,0.0
2016-10-01 11:50:00,0.0,0.0
2016-10-01 11:55:00,0.0,0.0
2016-10-01 12:00:00,0.0,0.0


7 changes: 4 additions & 3 deletions include/all.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ struct lgar_bmi_parameters
int sft_coupled = 0; // model coupling flag. if true, lasam is coupled to soil freeze thaw model; default is uncoupled version

double *giuh_ordinates; // geomorphological instantaneous unit hydrograph
int num_giuh_ordinates; // number of giuh ordinates
int num_giuh_ordinates; // number of giuh ordinates

};

Expand Down Expand Up @@ -172,7 +172,8 @@ struct lgar_mass_balance_variables

double volrech_cm; // volume of water leaving soil through the bottom of the domain (ground water recharge)
double volrunoff_giuh_cm; // volume of giuh runoff
double volQ_cm; // total outgoing water
double volQ_cm; // total outgoing water
double local_mass_balance; // local (per timestep) mass balance error
};


Expand Down Expand Up @@ -275,7 +276,7 @@ extern double lgar_merge_wetting_fronts(int num_layers, struct wetting_front *cu
int *soil_type, double *frozen_factor, struct soil_properties_ *soil_properties);

// subroutine to handle wet over dry wetting fronts condtions
extern void lgar_fix_wet_over_dry_fronts(double *mass_change, double* cum_layer_thickness_cm, int *soil_type,
extern void lgar_fix_dry_over_wet_fronts(double *mass_change, double* cum_layer_thickness_cm, int *soil_type,
struct soil_properties_ *soil_properties);

// finds free drainage wetting front (the deepest wetting front with psi value closer to zero; saturated in terms of psi)
Expand Down
6 changes: 4 additions & 2 deletions include/bmi_lgar.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ public:
this->output_var_names[7] = "actual_evapotranspiration";
this->output_var_names[8] = "surface_runoff"; // direct surface runoff
this->output_var_names[9] = "giuh_runoff";
this->output_var_names[10] = "soil_storage";
this->output_var_names[10] = "soil_storage";
this->output_var_names[11] = "total_discharge";
this->output_var_names[12] = "infiltration";
this->output_var_names[13] = "percolation";
this->output_var_names[14] = "mass_balance";

/*
this->output_var_names[13] = "cum_precipitation";
Expand Down Expand Up @@ -122,7 +123,7 @@ public:
private:
struct model_state* state;
static const int input_var_name_count = 3;
static const int output_var_name_count = 14;
static const int output_var_name_count = 15;

std::string input_var_names[input_var_name_count];
std::string output_var_names[output_var_name_count];
Expand All @@ -142,6 +143,7 @@ private:
double volrunoff_giuh_timestep_m;
double volQ_timestep_m;
double volPET_timestep_m;
double mass_balance_m;
};

struct bmi_unit_conversion bmi_unit_conv;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5ef7c1f

Please sign in to comment.