Estimate local truncation error between 2 advection 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(integrand_ladvection), | intent(in) | :: | lhs | Left hand side. |
||
class(integrand_object), | intent(in) | :: | rhs | Right hand side. |
Error estimation.
function local_error(lhs, rhs) result(error)
!< Estimate local truncation error between 2 advection 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(integrand_ladvection), 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_ladvection)
error = 0._R_P
do i=1, lhs%Ni
error = error + (lhs%u(i) - rhs%u(i)) ** 2
enddo
error = sqrt(error)
endselect
endfunction local_error