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

fix: fix indexing in calculate_ensemble_errors #744

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ensemble/ensemble_solutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function calculate_ensemble_errors(u; elapsedTime = 0.0, converged = false,
res = norm(m_final - m_final_analytic)
weak_errors[:weak_final] = res
if weak_timeseries_errors
ts_weak_errors = [mean([u.u[j][i] - u[j].u_analytic[i] for j in 1:length(u)])
ts_weak_errors = [mean([u[j].u[i] - u[j].u_analytic[i] for j in 1:length(u)])
for i in 1:length(u[1])]
ts_l2_errors = [sqrt.(sum(abs2, err) / length(err)) for err in ts_weak_errors]
l2_tmp = sqrt(sum(abs2, ts_l2_errors) / length(ts_l2_errors))
Expand All @@ -111,11 +111,11 @@ function calculate_ensemble_errors(u; elapsedTime = 0.0, converged = false,
weak_errors[:weak_l∞] = max_tmp
end
if weak_dense_errors
densetimes = collect(range(u.u[1].t[1], stop = u[1].t[end], length = 100))
densetimes = collect(range(u[1].t[1], stop = u[1].t[end], length = 100))
u_analytic = [[sol.prob.f.analytic(sol.prob.u0, sol.prob.p, densetimes[i],
sol.W(densetimes[i])[1])
for i in eachindex(densetimes)] for sol in u]
udense = [u.u[j](densetimes) for j in 1:length(u)]
udense = [u[j](densetimes) for j in 1:length(u)]
dense_weak_errors = [mean([udense[j][i] - u_analytic[j][i] for j in 1:length(u)])
for i in eachindex(densetimes)]
dense_L2_errors = [sqrt.(sum(abs2, err) / length(err)) for err in dense_weak_errors]
Expand Down
Loading