Skip to content
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

Extend plant hydraulics rooting depth to support fields #783

Merged
merged 16 commits into from
Oct 2, 2024

Commits on Oct 1, 2024

  1. Change PlantHydraulicsParameters to hold rooting_depth

    PlantHydraulicsParameters previously held a root distribution function
    that had a default value for rooting depth. This function is
    always the same outside testing, so it was removed as a parameter
    and placed into src. rooting_depth, an argument to the distribution function
    is now a parameters that is either a Float or a field. The tests are changed to
    check passing rooting_depth as a float or a field of floats that are the same everywhere.
    One test in plant_hydraulics_test.jl only checks the case of when rooting_depth is a float
    because changing to a field requires extensive changes to the entire test.
    imreddyTeja committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    d4dd47d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    099033e View commit details
    Browse the repository at this point in the history
  3. Change plant hydraulics integration test to use fields

    The test solves a system of functions which is defined in
    initial_compute_expected_tendecy!. That function is now changed
    to support fields, but each equation in the system of equations still
    outputs a scalar. This is done by taking a mean across the resulting field.
    This is done because NLsolve does not work of equations on fields.
    imreddyTeja committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    16b5aa3 View commit details
    Browse the repository at this point in the history
  4. Change runs to use spatially varying rooting depth

    longruns/land.jl, benchmarks/land.jl and longruns/land_regional.jl
    are changed to use the root depth map from the clm data
    imreddyTeja committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    4b76f9d View commit details
    Browse the repository at this point in the history
  5. Add message in NEWS.md

    imreddyTeja committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    1eb7ad2 View commit details
    Browse the repository at this point in the history
  6. Make suggested changes

    imreddyTeja committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    1e23db8 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7cf6c83 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0d1ee0b View commit details
    Browse the repository at this point in the history
  9. Change plant_hydraulics_test to follow previous behavior

    Previously the Plant hydraulics model integration tests
    were changed to work with rooting_depth as a field. In the test,
    the solution of a system of equations is found using NLsolve.
    The previous change redefined each equation in the system of equations
    to create a field of values the equation evaluates to, and then takes
    the mean of the field so the equation still results in a scalar.
    
    To better follow the functionality of the previous test, this commit
    reverts the system of equations to only work on a scalar rooting_depth.
    The solution to the system of equations is returned as a vector of floats.
    It is not possible to create a ClimaCore Field of vectors. Instead, the
    solution is stored as a vector of fields.
    
    To implement this, a function that returns a function representing
    a system of equations is created. This results in a system of equations
    for each cell. At first, each system of equations was solved once for each
    variable in the vector of solutions, resulting in many repeated equations solves.
    To prevent this a dictionary is used. Each variable in the solution must be
    returned independently in order to create a vector of fields.
    imreddyTeja committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    db1363f View commit details
    Browse the repository at this point in the history
  10. Make changes not breaking

    Add a constructor that finds rooting_depth from
    root_distribution
    imreddyTeja committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    43f439f View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    9b3246f View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    5703f1e View commit details
    Browse the repository at this point in the history
  13. Revert to breaking change

    A previous commit made the change not breaking
    by making constructor accept a rooting_distribtion
    parameter, and then calculating rooting_depth from that.
    That calculation assumes that rooting_distribuion will be in
    a specific form.
    imreddyTeja committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    0253ee6 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    5bb62f7 View commit details
    Browse the repository at this point in the history
  15. Make changes non-breaking (again)

    Added support for root_distribution. The PlantHydraulicsParameters
    struct has root_distribtion again. Both root_distribution and
    root_depth can be nothing. The constructor uses depwarn when
    root_distribution is passed in. If neither root_depth or root_distribution
    are passed in to the constructor, an error is thrown.
    
    There were two uses of root_distribution. At these spots, a new
    function is defined, which takes in the rooting_depth and a z as an argument.
    If that rooting_depth argument is nothing, then it calls root_distribution
    form the params. Otherwise it calls from src.
    
    Removes breaking change from NEWS.md
    imreddyTeja committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    c801e51 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    418e68b View commit details
    Browse the repository at this point in the history