fabern / lwfbrook90.jl Goto Github PK
View Code? Open in Web Editor NEWIstope-enabled implementation of the LWF-BROOK90 hydrological model in Julia
License: GNU General Public License v3.0
Istope-enabled implementation of the LWF-BROOK90 hydrological model in Julia
License: GNU General Public License v3.0
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!
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.
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)
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:
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 ?
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)
Note that for release of LWFBrook90.jl v.0.1.0 the Registrator was triggered in thread:
2cd8602#commitcomment-47579208
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.