Skip to content

Commit

Permalink
run for 1 hour
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Sep 13, 2024
1 parent 7406ee8 commit 53b2277
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions experiments/standalone/Vegetation/timestep_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ Y.canopy.hydraulics.ϑ_l.:2 .= augmented_liquid_fraction.(ν, S_l_ini[2])

seconds_per_day = 3600 * 24.0
t0 = 150seconds_per_day
N_days = 0.5
N_days = 0.0417
tf = t0 + N_days * seconds_per_day
evaluate!(Y.canopy.energy.T, atmos.T, t0)
set_initial_cache! = make_set_initial_cache(canopy)
set_initial_cache!(p, Y, t0);

saveat = Array(t0:(3 * 3600):tf)
updateat = Array(t0:(3600 * 3):tf)
saveat = Array(t0:(0.5 * 3600):tf)
updateat = Array(t0:(3600 * 0.5):tf)
drivers = ClimaLand.get_drivers(canopy)
updatefunc = ClimaLand.make_update_drivers(drivers)
cb = ClimaLand.DriverUpdateCallback(updateat, updatefunc)
Expand All @@ -209,23 +209,23 @@ prob = SciMLBase.ODEProblem(
savedir = joinpath(pkgdir(ClimaLand), "experiments/standalone/Vegetation");

ref_dt = 0.001
# ref_sol =
# SciMLBase.solve(prob, ode_algo; dt = ref_dt, callback = cb, saveat = saveat);
# ref_T = [parent(ref_sol.u[k].canopy.energy.T)[1] for k in 1:length(ref_sol.t)]
# open(joinpath(savedir, "exp_T_dt$(ref_dt)_$(N_days)days.txt"), "w") do io
# writedlm(io, ref_T, ',')
# end;
ref_sol =
SciMLBase.solve(prob, ode_algo; dt = ref_dt, callback = cb, saveat = saveat);
ref_T = [parent(ref_sol.u[k].canopy.energy.T)[1] for k in 1:length(ref_sol.t)]
open(joinpath(savedir, "exp_T_dt$(ref_dt)_$(N_days)days.txt"), "w") do io
writedlm(io, ref_T, ',')
end;

ref_T = readdlm(joinpath(savedir, "exp_T_dt$(ref_dt)_$(N_days)days.txt"))
# ref_T = readdlm(joinpath(savedir, "exp_T_dt$(ref_dt)_$(N_days)days.txt"))

dts = [1.0, 0.1, 0.01]
sols = []
for dt in dts
@info dt

saveat = Array(t0:(3 * 3600):tf)
saveat = Array(t0:(0.5 * 3600):tf)
evaluate!(Y.canopy.energy.T, atmos.T, t0)
updateat = Array(t0:(3600 * 3):tf)
updateat = Array(t0:(3600 * 0.5):tf)
updatefunc = ClimaLand.make_update_drivers(drivers)
cb = ClimaLand.DriverUpdateCallback(updateat, updatefunc)

Expand Down

0 comments on commit 53b2277

Please sign in to comment.