-
Notifications
You must be signed in to change notification settings - Fork 29
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
Source code updates #30
Merged
Merged
Conversation
This file contains 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
The code for calculating the peak rate (`qp_cms`) has been updated to include a conditional check based on the value of `bsn_cc%sed_det`. - If `bsn_cc%sed_det` equals 1, the peak rate is calculated using the half-hour rainfall intensity method, involving computations of `xx`, `altc`, and `qp_cms`. - If `bsn_cc%sed_det` is not equal to 1, the peak rate is calculated using the NRCS dimensionless hydrograph with PRF method, involving unit conversions and computations of `qp_cfs` and `qp_cms`. The previous implementation of the NRCS dimensionless hydrograph with PRF method has been removed and replaced with this new conditional logic. Add conditional peak rate method and update comments Updated `basin_module.f90` to clarify `sed_det` variable options for peak rate methods. Modified `ero_pkq.f90` to conditionally calculate peak rate (`qp_cms`) based on `sed_det`, using either the NRCS dimensionless hydrograph with PRF or the half-hour rainfall intensity method. Commented out assignments to `ch_in_d` and `ch_out_d` in `sd_channel_control3.f90`.
Updated the comment for `sed_det` in `basin_module.f90` to clarify its usage for the peak rate method. Commented out the assignments of `ch_in_d` and `ch_out_d` to `chaz` in `sd_channel_control3.f90`, indicating these lines are no longer active.
Refactored `hru_carbon_output.f90` to move redundant monthly carbon variable resets (`hsc_m`, `hrc_m`, `hpc_m`, `hscf_m`) to the end of the monthly print block, ensuring they are executed only once. Added lines to reset yearly carbon variables (`hsc_y`, `hrc_y`, `hpc_y`, `hscf_y`) after the yearly print block. Simplified `pl_biomass_gro.f90` by using the pre-calculated `pl_mass_up%c` value directly for `hpc_d(j)%npp_c` calculation, eliminating redundant recalculation within the conditional block.
- Remove initialization of `ave_rate` to zero - Include `pk_rto` factor in `peakrate` calculation - Uncomment and modify `vel` calculation to use `peakrate` - Limit `flovol_ob` to 80% of `ht1%flo` - Change `exp_co` from `0.0007` to `0.0003` - Add commented-out debug code for channel `ich == 2133` - Reduce `ebank_m` coefficient by an order of magnitude - Update `arc_len` calculation formula - Include factor of `1000` in `ebank_t` calculation - Modify `ch_morph(ich)%w_yr` calculation in `time_control.f90` to include division by `1000`
Replaced references to rsd1 with soil1 across multiple files to update residue and soil data handling. This includes changes in logging, calculations of cover variables, residue decomposition, and nutrient mineralization processes. Key updates include: - actions.f90: Updated logging for various agricultural actions. - albedo.f90, ero_cfactor.f90, ero_ovrsed.f90, et_act.f90: Updated cover variable calculations. - cal_allo_init.f90, hru_allo.f90: Removed allocation of rsd1. - hru_control.f90: Updated residue decomposition and nutrient processes. - mallo_control.f90: Updated manure application logging. - mgt_harvbiomass.f90, mgt_harvgrain.f90, mgt_harvresidue.f90, mgt_harvtuber.f90, mgt_killop.f90, mgt_sched.f90: Updated residue pool variables and calculations. - nut_nminrl.f90, nut_orgnc.f90, nut_orgnc2.f90, nut_psed.f90: Updated nutrient calculations and soil water factor. - pl_burnop.f90, pl_dormant.f90, pl_leaf_senes.f90, pl_mortality.f90: Updated plant and residue mass handling. - pl_partition.f90: Refactored logic for root, seed, and leaf components. - re_initialize.f90: Removed rsd1 from re-initialization. - rsd_decomp.f90: Refactored decomposition and mineralization logic. - stmp_solt.f90: Updated soil cover impact calculation. - wallo_control.f90, wind_ero_veg.f90: Updated output and comments.
Removed `smix` and introduced new variables (`mix_mn`, `mix_mp`, `mix_org`, `mix_clay`, `mix_silt`, `mix_sand`) in `mgt_newtillmix.f90` for soil component mixing. Updated soil layers directly with these new variables. In `plant_init.f90`, removed allocation and deallocation of residue-related arrays (`rsd1(j)%tot`, `rsd1(j)%meta`, `rsd1(j)%str`, `rsd1(j)%lignin`). Added initialization and update of residue pools (`soil1(j)%rsd`, `soil1(j)%meta`, `soil1(j)%str`, `soil1(j)%lig`) based on `bsn_cc%cswat` condition. Replaced fresh organic residue pools initialization with static and century fresh organic carbon pools. Included conditions for different residue types (`metabolic`, `structural`, `lignin`) and updated corresponding soil layers. These changes improve modularity and maintainability of the code.
Refactored code to include conditional checks for `bsn_cc%cswat` values. - Enclosed initialization of active humus for SWAT model within a conditional block checking `bsn_cc%cswat == 0`. - Enclosed initialization of CENTURY organic pools within a conditional block checking `bsn_cc%cswat == 2`. - Moved initialization of various soil organic pools inside respective conditional blocks. - Removed code zeroing root, incorporated residue, and litter pools. - Updated total carbon calculation to sum components directly, excluding zeroed litter pools.
Added a new variable `iob` for output write in the loop. Modified `soil_prof_hsta` calculation by removing a redundant line. Added conditional statements to differentiate accumulation of soil profile components based on layer index `ly`. Updated `soil1(j)%tot_org` calculation to include only specific components. Changed output write statements to include new soil profile components and adjusted their order.
Removed unused integer variables and their assignments from the `time` structure. Initialized `hrc_d(j)%rsd_surfdecay_c` and `hrc_d(j)%rsd_rootdecay_c` to zero. Modified `rsdn_pct` calculation to use `soil1(j)%rsd(1)%n` and `soil1(j)%meta(1)%n`. Added block to set residue decomposition values for printing, distinguishing between surface and subsurface/root residues. Removed outdated commented-out lines. Updated `soil1(j)%tot(k)%c` calculation to include `soil1(j)%rsd(k)%c`.
Renamed `res_decay_c` to `rsd_decay_c` for clarity. Introduced new variables for surface and root carbon processes: `plant_surf_c`, `plant_root_c`, `rsd_surfdecay_c`, and `rsd_rootdecay_c`. Updated `carbon_terrestrial_inputs` type for consistent initialization. Added new types: `organic_allocations`, `organic_controls`, `organic_fractions`, `organic_transformations`, and `carbon_soil_transformations`, with variables initialized to zero. Updated functions to use new variable names and types. These changes enhance code clarity and maintainability.
Added a new type `organic_mixing_mass` with various organic mass pools. Introduced instances of `organic_mixing_mass` and `mineral_nitrogen`. Added instances of `mineral_phosphorus` type. Replaced `soil_profile_mass1` with `soil_profile_mass`, adding new fields for organic mass pools and removing redundant fields. Added instances of `plant_community_mass`. Introduced interface operators and functions for arithmetic operations on `mineral_nitrogen` and `mineral_phosphorus`. Added functions for adding `mineral_phosphorus` and `organic_mass` instances.
Added new character variables `plt_cov` and `mgt_ops` to multiple headers. Corrected alignment of variables in `output_nutbal_header` and `output_soilc_header`. Replaced `res_decay_c` with `rsd_decay_c` in `output_rescarb_header` and `output_rescarb_header_units`. Changed `tot_c` value in `output_soilc_header`. Reorganized and renamed variables in `output_soilc_header` and updated corresponding units in `output_soilc_header_units`.
Replaced the addition of const * rsd1(iihru)%tot_com with const * soil1(iihru)%rsd(1) in the bsn_org_rsd calculation. This change updates the data source for the calculation, potentially correcting or updating the reference to the appropriate data structure.
The subroutine `orgncswat2` in `orgncswat2.f90` has been completely removed. This subroutine was responsible for calculating the amount of organic nitrogen removed in surface runoff when using CSWAT==2. It included various calculations and updates to soil nitrogen pools and carbon losses. The subroutine `pl_leaf_drop` in `pl_leaf_drop.f90` has also been completely removed. This subroutine checked the dormant status of different plant types and included calculations related to plant carbon and nitrogen dynamics, as well as updates to soil nitrogen and carbon pools. These removals indicate a significant change in the codebase, potentially due to a refactor or a shift in the approach to handling these calculations.
Removed the `organic_mineral_hydrograph1` type definition and its associated variables (`vol`, `sed`, `algae`, `biofilm`, `chla`, `cbod`, `dox`, `temp`) from `organic_mineral_mass_module.f90`. Removed the `soil_profile_mass` type definition and its associated variables (`name`, `sol`, `sw`) from `organic_mineral_mass_module.f90`. Removed the `plant_community_mass` type definition and its associated variables (`name`, `tot`, `veg`, `root`, `grain`, `tot_com`, `veg_com`, `root_com`, `grain_com`, `rsd`, `rsd_st`, `plnt`) from `organic_mineral_mass_module.f90`. The `animal_herds` type definition remains unchanged.
tugraskan
commented
Dec 5, 2024
! soil1(j)%tot_org = soil_prof_hact + soil_prof_hsta + soil_prof_microb | ||
soil1(j)%tot_org = soil_prof_hs + soil_prof_hp + soil_prof_microb + soil_prof_meta + & | ||
soil_prof_str + soil_prof_lig | ||
soil1(j)%tot_org = soil_prof_hs + soil_prof_hp + soil_prof_microb |
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.
add meta too apparently
tugraskan
commented
Dec 5, 2024
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.
possible double counting
Reviewed pull request and looks good. |
Successful merge. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Tried to add Franks changes back, they were not carried over from Jeffs code.