Estimate local truncation error between 2 oscillation approximations.
The estimation is done by norm L2 of U:
$$ error = \sqrt{ \sum_i{ \frac{(lhs\%U_i - rhs\%U_i)^2}{lhs\%U_i^2} }} $$
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. |
||
class(integrand_object), | intent(in) | :: | rhs | Right hand side. |
Error estimation.
pure function local_error(lhs, rhs) result(error)
!< Estimate local truncation error between 2 oscillation approximations.
!<
!< The estimation is done by norm L2 of U:
!<
!< $$ error = \sqrt{ \sum_i{ \frac{(lhs\%U_i - rhs\%U_i)^2}{lhs\%U_i^2} }} $$
class(integrand_oscillation), intent(in) :: lhs !< Left hand side.
class(integrand_object), intent(in) :: rhs !< Right hand side.
real(R_P) :: error !< Error estimation.
integer(I_P) :: i !< Space counter.
select type(rhs)
class is(integrand_oscillation)
error = 0._R_P
do i=1, size(lhs%U, dim=1)
if (lhs%U(i) /= 0._R_P) then
error = error + (lhs%U(i) - rhs%U(i)) ** 2 / lhs%U(i) ** 2
elseif (rhs%U(i) /= 0._R_P) then
error = error + (lhs%U(i) - rhs%U(i)) ** 2 / rhs%U(i) ** 2
endif
enddo
error = sqrt(error)
endselect
endfunction local_error