GithubHelp home page GithubHelp logo

fabern / lwfbrook90.jl Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 1.0 127.23 MB

Istope-enabled implementation of the LWF-BROOK90 hydrological model in Julia

License: GNU General Public License v3.0

Julia 89.64% R 10.33% Batchfile 0.02%

lwfbrook90.jl's People

Contributors

fabern avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gitter-badger

lwfbrook90.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Select better solver method

Note that when moving to ComponentArrays.jl the testcase Hammel Loam NLAYER=103 showed oscillations with the previous solver method of Tsit5(). This lead to failure of the test.

Screenshot

Selecting an alternative solver method for stiff problems such as ImplicitEuler(autodiff=false), Rodas4P(autodiff=false), or Rosenbrock23(autodiff=false); seem to be much more efficient and result in better accuracy. Below code was used to to identify the issue.

# Define simulation model by reading in system definition and input data
model = SPAC("test/test-assets/Hammel-2001/input-files/",
                "Hammel_loam-NLayer-103-RESET=FALSE";
                simulate_isotopes = false);

# Prepare simulation by discretizing spatial domain
soil_discretization = discretize_soil(model.continuousIC.soil)
zspan = (maximum(model.soil_horizons.Upper_m),
            minimum(model.soil_horizons.Lower_m))
@assert zspan[1] == soil_discretization.Upper_m[1] "Soil discretization is not compatible with provided soil horizons"
@assert zspan[2] == soil_discretization.Lower_m[end] "Soil discretization is not compatible with provided soil horizons"
simulation = LWFBrook90.discretize(model;tspan=(0,2.5));
# Solve ODE:
# LWFBrook90.simulate!(simulation)
# solve_LWFB90(simulation.ODEProblem)
function norm_to_use(u::Real,            t) norm(u) end
function norm_to_use(u::ComponentVector, t)
    DiffEqBase.ODE_DEFAULT_NORM(reduce(vcat, [u.GWAT.mm,
                                                u.INTS.mm,
                                                u.INTR.mm,
                                                u.SNOW.mm,
                                                u.CC.mm,
                                                u.SNOWLQ.mm,
                                                u.SWATI.mm,
                                                u.RWU.mm,
                                                u.XYLEM.mm,
                                                u.TRANI.mm,
                                                u.aux.θ, u.aux.ψ, u.aux.K,
                                                u.accum
            ]),
        t)
end
function unstable_check_function(dt,u::ComponentVector,p,t)
    any(isnan, u.SWATI.mm) # Do it for SWATI (only amt)
end
# source: https://diffeq.sciml.ai/stable/basics/common_solver_opts/#Fixed-Stepsize-Usage
# Force the same time steps as with sol_working:
# If tstops is set without dt, then the algorithm will step directly to each value in tstops
tspan = simulation.ODEProblem.tspan
@time sol_current = solve(simulation.ODEProblem,
            # ImplicitEuler(autodiff=false);  # for stiff problems (~6.7s)
            # Rodas4P(autodiff=false);        # for stiff problems (~3.2s)
            Rosenbrock23(autodiff=false);   # for stiff problems   (~2.3s)
            # Tsit5(); # Tsit5 recommended for non-stiff problems
            progress = true,
            adaptive = true, internalnorm = norm_to_use # fix adaptivity norm for NAs
            # save_everystep = true,
            # tstops = sol_working.t, #[0.223, 0.4],
            # tstops = tspan[1]:0.00001:tspan[2], adaptive = false
    );
plot(sol_current.t, reduce(hcat, [sol_current.u[t].SWATI.mm[idx] for t in eachindex(sol_current)])', color = "orange", line = :dot)

Setup benchmark tests of soil infiltration (Richards) and evapotranspiration

Having test cases to compare with analytical solutions or numerical solutions form independent software programs (HYDRUS, SiSPAT-Isotope, ...) should be used to validate the implementation. Each test can be designed to test a specific model component, thus allowing for targeted debugging.

E.g. for flow and transport:

Reactivate Regression Tests

Because of a precompilation issue with JLD2 on all CI runs, regression tests were deactivated. This should be reversed, potentially with using CSV instead of JLD2 ?

Register package in JuliaRegistries

This issue is for future triggering the Registrator to update the JuliaRegistries with an updated package version.

Instructions: (from https://github.com/JuliaRegistries/Registrator.jl#via-the-github-app)

  1. Set the (Julia)Project.toml version field in your repository to your new desired version.
  2. Comment @JuliaRegistrator register on the commit/branch you want to register (e.g. like here or here).

Note that for release of LWFBrook90.jl v.0.1.0 the Registrator was triggered in thread:
2cd8602#commitcomment-47579208

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.