-
Notifications
You must be signed in to change notification settings - Fork 26
Added new modules for Infiltration, Evapotranspiration, and soil moisture storage and movement. #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
djmallum
wants to merge
65
commits into
Chrismarsh:develop
Choose a base branch
from
djmallum:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Added new modules for Infiltration, Evapotranspiration, and soil moisture storage and movement. #147
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
bd42536
Base submodule interface class added
djmallum a799caa
Adding classes for a soil module divided into parts:
djmallum e409132
Adding soil module
djmallum 0ab0ecd
Adjusted ET names to be more accurate
djmallum cbb5cdb
Added .swp files to .gitignore
djmallum 5b968ce
Added an infiltration module and a soil data table
djmallum 4f65b1d
gitignore now includes .swo files
djmallum 878d56c
Adding ET baseclass evapbase
djmallum f6cbd20
Extra lines removed from gitignore
djmallum 221717b
/CMakeLists.txt editted to work with local spack
djmallum 4cc02e6
Added soil attribute functions to triangulation
djmallum bb25015
Changing name of ET variables in soil_module
djmallum a2bd539
Added air heat capacity, and velocity profile constant kappa to Atmos…
djmallum 807a80a
Adding an ET module and submodules
djmallum 53b8348
Added new (sub)modules to CMakeLists
djmallum 11fe9e2
Added soil_storage as dependency for Green-Ampt
djmallum b642a24
Encapsulating components of Infil_All
djmallum a3289ad
Changes to Soil::soils_na class
djmallum 9681c57
Google tests for infiltration submodules
djmallum 8cc159e
CMakeLists updated
djmallum e08e02e
Infil_All: ensured SoilDataObj remains const
djmallum 4b36fcc
Uncommented main.cpp for tests
djmallum 9546acf
Added CSV reader class to aid with google tests
djmallum 274fa9b
Fixed logger comment warning
djmallum 67596dd
Infil_All: Updating after unit tests
djmallum 3a57bdc
K_Estimate: Interface from submodule_base, updating internal functino…
djmallum d2e4a9f
soil_two_layer calculations encapsulated
djmallum 1cf0bcf
Changes to crack to enable unit tests only
djmallum d48112c
soil_two_layer simplified with new soil_classes
djmallum e7d98d1
Added const specifier to soil object getter
djmallum fb5c066
Outputted `runoff_to_depression`
djmallum 3ab5ca3
Infil_All: Re-adding removed is_new_day function
djmallum 14a007a
Added runoff_to_depression to two_layer_DTO
djmallum db10bc0
Google Tests: Ayers now expects const soil object
djmallum 13a54c1
Introducing interface for freeze/thaw depths
djmallum c63283e
Added descriptive comment to allow_runoff_from_infiltration
djmallum 7ac14c6
Googletest of the accumulator class
djmallum 8488937
GoogleTests Crack rain_on_snow calculation fix
djmallum 1447843
Adding XG_algorithm class
djmallum e4b169f
Adding get_new_day to two_layer_DTO
djmallum 6149db0
Utility class daily_accumulator added
djmallum 58c662d
New submodule base_class: base_step
djmallum fd8036e
Updated googletest to commit 571930618fa96eabcd05b573285edbee9fc13bae
djmallum bf13a14
Adding set up functions for XG algorithm to soil_module
djmallum ec260b3
Updated K_estimate and soil_DTO with new get_dt()
djmallum f09debf
Including isostream into base_step
djmallum 410cc64
New base class base_step for submodules.
djmallum 1e67a83
Modifying soil_module run to use XG
djmallum 5e53ac3
Default values of cfg.get changes to match expected type
djmallum ad82a60
Changes to is_lake, get_dt and get_new_day functions
djmallum 4e6be3a
Merge branch 'utility/daily_accumulator' into develop
djmallum 9c9c959
Updated depends/provides
djmallum 3e8e768
f4 now correctly divided by the minimum stomatal resistance
djmallum 0054404
Merge branch 'refactor/soil_module' into develop
djmallum 683d4a9
Added missing .cpp to CMakeLists
djmallum 266b13c
Merge branch 'bug-fix/ET_module' into develop
djmallum 0309fa6
XG google test added
djmallum bc41309
Fixed typo in Infil_All comment
djmallum a4dff9a
Merge branch 'new_submodule/XG_algorithm' into develop
djmallum e9fb8d7
Removed hard-coded porosity from soil_module
djmallum 5586667
Removed crhm test components of XG
djmallum 788febb
including concepts in base_step
djmallum 76c0be4
Updated is_lake from function to variable in Soil_ET
djmallum 7e6b5f3
Removing .hpps from CMakeLists.txt
djmallum 9179c9b
Merge remote-tracking branch 'upstream/develop' into develop
djmallum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was getting an odd build warning with this one, even commented, so I removed the . But obviously didn't need to... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
src/modules/EvapotranspirationModels/PenmanMonteith.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| #include "PenmanMonteith.hpp" | ||
|
|
||
|
|
||
| PenmanMonteith::PenmanMonteith(double& LAI, double& LAImax, double& veg_Ht, double& wind_height, double& stomatal_res_min, double& soil_d, double& F_to_g, const double Cp, const double K, const double tension, const double pore_sz, const double theta_pwp, const double phi) | ||
| : leaf_area_index(LAI), leaf_area_index_max(LAImax), Veg_height(veg_Ht), wind_measurement_height(wind_height), stomatal_resistance_min(stomatal_res_min), soil_depth(soil_d), Frac_to_ground(F_to_g), heat_capacity_air(Cp), kappa(K), air_entry_tension(tension), pore_size_dist(pore_sz), wilt_point(theta_pwp), porosity(phi) | ||
| { | ||
| if (leaf_area_index == 0) | ||
| has_vegetation = false; | ||
| else | ||
| has_vegetation = true; | ||
|
|
||
|
|
||
| // TODO other checks on values might be good | ||
| } | ||
|
|
||
| PenmanMonteith::~PenmanMonteith() | ||
| { | ||
| //Do nothing | ||
| } | ||
|
|
||
| void PenmanMonteith::CalcHeights() | ||
| { | ||
| Z0 = Veg_height/7.6; | ||
| d = Veg_height*0.67; | ||
| } | ||
|
|
||
| double PenmanMonteith::CalcAeroResistance(const PM_vars& var) | ||
| { | ||
| if (wind_measurement_height - d > 0) | ||
| { | ||
| return pow( log((wind_measurement_height - d)/Z0),2) / | ||
| (pow(kappa,2) * var.wind_speed); | ||
| } | ||
| else | ||
| { | ||
| return 0; // I don't know if this is right, but it is at least... safe. | ||
| } | ||
| } | ||
|
|
||
| double PenmanMonteith::CalcStomatalResistance(const PM_vars& var) | ||
| { | ||
| double rcstar = stomatal_resistance_min; | ||
|
|
||
| // In CRHM, the below calculation is an option, for now just use the minimum option. | ||
| if (has_vegetation) | ||
| { | ||
|
|
||
| double LAI = Veg_height/2.0*leaf_area_index_max; //TODO ad hoc for test | ||
| rcstar = stomatal_resistance_min * leaf_area_index_max / LAI; | ||
| // rcstar = stomatal_resistance_min * leaf_area_index_max / leaf_area_index; TODO commented for test | ||
| } | ||
| // TODO check units. for example, short_wave_in - 1.5 is suspect | ||
| double f1 = 1.0; | ||
| if (var.short_wave_in > 0.0) | ||
| f1 = std::max(1.0, 500.0/var.short_wave_in - 1.5); | ||
| //max <double> (1.0, 500.0/(var.short_wave_in - 1.5)); | ||
|
|
||
| double f2 = std::max(1.0, 2.0 * (var.saturated_vapour_pressure - var.vapour_pressure) ); | ||
| //<double> (1.0, 2.0 * (var.saturated_vapour_pressure - var.vapour_pressure) ); | ||
|
|
||
| double p = air_entry_tension * pow(porosity / (var.soil_storage/soil_depth/1000.0 + wilt_point), pore_size_dist); | ||
| double f3 = std::max(1.0, p/40.0); | ||
|
|
||
| double f4 = 1.0; | ||
| if (var.t < 5.0 || var.t > 40.0) | ||
| f4 = 5000/stomatal_resistance_min; | ||
|
|
||
| if (var.short_wave_in <= 0) | ||
| return 5000; | ||
| else | ||
| { | ||
| return std::min(rcstar * f1 * f2 * f3 * f4, 5000.0); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| void PenmanMonteith::CalcEvapT(var_base& basevar, model_output& output) | ||
| { | ||
|
|
||
| const PM_vars & var = static_cast<const PM_vars&>(basevar); | ||
| PM_output &out = static_cast<PM_output&>(output); | ||
|
|
||
| double Q = var.all_wave_net * (1 - Frac_to_ground); | ||
|
|
||
| if (IsFirstRun) | ||
| { | ||
| CalcHeights(); | ||
| IsFirstRun = false; | ||
| } | ||
|
|
||
| double aero_resistance = CalcAeroResistance(var); | ||
| double stomatal_resistance = CalcStomatalResistance(var); | ||
|
|
||
| double radiation = delta(var.t) * Q * 24; //24 --> hours/day, should be generalized or encoded in Q in a future version | ||
| // Actual units are mm/day | ||
|
|
||
| double mass = AirDensity(var.t,var.vapour_pressure,var.P_atm) * heat_capacity_air * | ||
| (var.saturated_vapour_pressure - var.vapour_pressure)/ ( aero_resistance * lambda(var.t) * water_density ); | ||
| mass *= m_per_s_to_mm_per_day; | ||
|
|
||
| out.ET = (radiation + mass) / ( delta(var.t) + gamma(var.P_atm, var.t, heat_capacity_air) * ( 1 + stomatal_resistance / aero_resistance )); | ||
|
|
||
| out.ET *= 1.0 / 24.0; // As with the radiation variable, assumed the timestep is hours here. TODO for the future. | ||
| out.stomatal_resistance = stomatal_resistance; | ||
| } | ||
|
|
||
| // TODO make delta, gamma, density fucntions | ||
|
|
||
| double PenmanMonteith::AirDensity(double& t, double& ea, double& Pa) // atmospheric density (kg/m^3) | ||
| { | ||
| const double R0 = 2870; | ||
| return (1E4*Pa /(R0*( 273.15 + t))*(1.0 - 0.379*(ea/Pa))); // | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change can probably be rejected and is specific to the build on my mac