What can I do to calculate the L2 norm between the exact solution and my numerical solution?

mcr.92
Thu, 16 May 2024 13:47:13 +0000
Numerics

I am solving a differential equation by the MOL method, it has an exact solution so I want to calculate the error in the L2 norm. I made this code

F1(x) = A*(cosh(B*x))
F2(y) = A*(cosh(B*y))
FC = -(2*(B^2)*K - W)/(ρ*C_s)
F3(t::Real) = t > t_c ? E * exp(FC * t) : 1 + E * exp(t)
T(t::Real)= x -> F1(x[1])*F2(x[2])*F3(t)
(...)
uₕₜ = solve(ode_solver,op_Af,u₀,t_0,t_f)

  error_L2 = Vector{Float64}(undef, 22)
for (uₕ,t) in uₕₜ
      error_L2[i] = √(integrate((T(t) - uₕ)^2, dΩ))
end

but when trying to up 2 the difference between the exact solution and my approximate solution it gives me an error. What can I do to calculate this norm?

4 posts - 3 participants