Estimate local truncation error between 2 euler approximations.
The estimation is done by norm L2 of U:
$$ error = \sqrt{ \sum_i{\sum_i{ \frac{(lhs\%U_i - rhs\%U_i)^2}{lhs\%U_i^2} }} } $$
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(euler_1d), | intent(in) | :: | lhs | Left hand side. |
||
| class(integrand), | intent(in) | :: | rhs | Right hand side. |
Error estimation.
function euler_local_error(lhs, rhs) result(error)
!< Estimate local truncation error between 2 euler approximations.
!<
!< The estimation is done by norm L2 of U:
!<
!< $$ error = \sqrt{ \sum_i{\sum_i{ \frac{(lhs\%U_i - rhs\%U_i)^2}{lhs\%U_i^2} }} } $$
class(euler_1d), intent(in) :: lhs !< Left hand side.
class(integrand), intent(in) :: rhs !< Right hand side.
real(R8P) :: error !< Error estimation.
real(R8P), allocatable :: U_lhs(:) !< Serialized conservative variables.
real(R8P), allocatable :: U_rhs(:) !< Serialized conservative variables.
integer(I4P) :: i !< Space counter.
integer(I4P) :: v !< Variables counter.
select type(rhs)
class is (euler_1d)
error = 0._R8P
do i=1, lhs%Ni
U_lhs = lhs%U(i)%array()
U_rhs = rhs%U(i)%array()
do v=1, size(U_lhs, dim=1)
error = error + (U_lhs(v) - U_rhs(v)) ** 2 / U_lhs(v) ** 2
enddo
enddo
error = sqrt(error)
endselect
endfunction euler_local_error