diff --git a/include/bmi_lgar.hxx b/include/bmi_lgar.hxx index cf40d6c..be549ee 100644 --- a/include/bmi_lgar.hxx +++ b/include/bmi_lgar.hxx @@ -62,6 +62,7 @@ public: this->output_var_names[14] = "mass_balance"; this->output_var_names[15] = NWM_PONDED_DEPTH_OUT_VAR; this->output_var_names[16] = "precipitation_rate_out"; + this->output_var_names[17] = "groundwater_to_stream_recharge_m3_per_s"; /* this->output_var_names[13] = "cum_precipitation"; @@ -146,7 +147,7 @@ private: void realloc_soil(); struct model_state* state; static const int input_var_name_count = 3; - static const int output_var_name_count = 17; + static const int output_var_name_count = 18; static const int calib_var_name_count = 7; std::string input_var_names[input_var_name_count]; @@ -175,6 +176,8 @@ private: double volQ_gw_timestep_m; double volPET_timestep_m; double mass_balance_m; + double volQ_gw_timestep_m3_per_s; + double catchment_area_m2; }; struct bmi_unit_conversion bmi_unit_conv; diff --git a/src/bmi_lgar.cxx b/src/bmi_lgar.cxx index 1410b9c..96ec9a6 100644 --- a/src/bmi_lgar.cxx +++ b/src/bmi_lgar.cxx @@ -68,6 +68,9 @@ Initialize (std::string config_file) giuh_runoff_queue[i] = 0.0; } + bmi_unit_conv.volQ_gw_timestep_m3_per_s = 0.0; + bmi_unit_conv.catchment_area_m2 = 0.0; + } /** @@ -126,6 +129,7 @@ Update() bmi_unit_conv.volrunoff_timestep_m = state->lgar_bmi_input_params->precipitation_mm_per_h * mm_to_m; bmi_unit_conv.volQ_timestep_m = state->lgar_bmi_input_params->precipitation_mm_per_h * mm_to_m; bmi_unit_conv.volQ_gw_timestep_m = 0.0; + bmi_unit_conv.volQ_gw_timestep_m3_per_s = 0.0; bmi_unit_conv.volPET_timestep_m = 0.0; bmi_unit_conv.volrunoff_giuh_timestep_m = 0.0; bmi_unit_conv.volrunoff_giuh_ponded_m = 0.0; @@ -603,6 +607,15 @@ Update() bmi_unit_conv.volrunoff_timestep_m = volrunoff_timestep_cm * state->units.cm_to_m; bmi_unit_conv.volQ_timestep_m = volQ_timestep_cm * state->units.cm_to_m; bmi_unit_conv.volQ_gw_timestep_m = volQ_gw_timestep_cm * state->units.cm_to_m; + if (bmi_unit_conv.catchment_area_m2 > 0.0 && this->GetTimeStep() > 0.0) { + bmi_unit_conv.volQ_gw_timestep_m3_per_s = + (bmi_unit_conv.volQ_gw_timestep_m * bmi_unit_conv.catchment_area_m2) / + this->GetTimeStep(); + } + else { + bmi_unit_conv.volQ_gw_timestep_m3_per_s = 0.0; + } + bmi_unit_conv.volPET_timestep_m = PET_timestep_cm * state->units.cm_to_m; bmi_unit_conv.volrunoff_giuh_timestep_m = volrunoff_giuh_timestep_cm * state->units.cm_to_m; bmi_unit_conv.volrunoff_giuh_ponded_m = volrunoff_giuh_ponded_cm * state->units.cm_to_m; @@ -779,6 +792,7 @@ GetVarGrid(std::string name) || name.compare("infiltration") == 0 || name.compare("percolation") == 0 || name.compare("groundwater_to_stream_recharge") == 0 + || name.compare("groundwater_to_stream_recharge_m3_per_s") == 0 || name.compare("mass_balance") == 0 || name.compare(NWM_PONDED_DEPTH_OUT_VAR) == 0 || name.compare("reset_time") == 0 @@ -870,6 +884,10 @@ GetVarUnits(std::string name) return "m"; else if (name.compare("mass_balance") == 0 || name.compare("groundwater_to_stream_recharge") == 0) return "m"; + else if (name.compare("groundwater_to_stream_recharge_m3_per_s") == 0) + return "m3 s-1"; + else if (name.compare("mass_balance") == 0) + return "m"; else if (name.compare("soil_moisture_wetting_fronts") == 0) // array of doubles return "none"; else if (name.compare("soil_depth_layers") == 0 || name.compare("soil_depth_wetting_fronts") == 0) // array of doubles @@ -907,7 +925,8 @@ GetVarLocation(std::string name) || name.compare("soil_storage") == 0 || name.compare(NWM_PONDED_DEPTH_OUT_VAR)) // double return "node"; else if (name.compare("total_discharge") == 0 || name.compare("infiltration") == 0 - || name.compare("percolation") == 0 || name.compare("groundwater_to_stream_recharge") == 0) // double + || name.compare("percolation") == 0 || name.compare("groundwater_to_stream_recharge") == 0 + || name.compare("groundwater_to_stream_recharge_m3_per_s") == 0) //double return "node"; else if (name.compare("soil_moisture_wetting_fronts") == 0) // array of doubles return "node"; @@ -1021,6 +1040,8 @@ GetValuePtr (std::string name) return (void*)(&bmi_unit_conv.volrech_timestep_m); else if (name.compare("groundwater_to_stream_recharge") == 0) return (void*)(&bmi_unit_conv.volQ_gw_timestep_m); + else if (name.compare("groundwater_to_stream_recharge_m3_per_s") == 0) + return (void*)(&bmi_unit_conv.volQ_gw_timestep_m3_per_s); else if (name.compare("mass_balance") == 0) return (void*)(&bmi_unit_conv.mass_balance_m); else if (name.compare(NWM_PONDED_DEPTH_OUT_VAR) == 0)