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_openmp), | 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_openmp), intent(IN) :: lhs !< Left hand side.
class(integrand), intent(IN) :: rhs !< Right hand side.
real(R_P) :: error !< Error estimation.
integer(I_P) :: i !< Space counter.
integer(I_P) :: v !< Variables counter.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
select type(rhs)
class is (euler_1D_openmp)
error = 0._R_P
do i=1, lhs%Ni
do v=1, lhs%Nc
error = error + (lhs%U(v, i) - rhs%U(v, i))**2/lhs%U(v, i)**2
enddo
enddo
error = sqrt(error)
endselect
return
!---------------------------------------------------------------------------------------------------------------------------------
endfunction euler_local_error