The product of the system matrix by the solution , is calculated, and compared to the right hand side . The calculated error is the absolute error in %.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(MAT_SOLV), | intent(in) | :: | slv_struct | |||
real(kind=R8), | intent(in), | dimension(:) | :: | a_elt | ||
real(kind=R8), | intent(in), | dimension(:) | :: | b | ||
real(kind=R8), | intent(out) | :: | error |
subroutine verif_solution(slv_struct, a_elt, b, error)
implicit none
type(MAT_SOLV), intent(in) :: slv_struct
real(kind=R8), dimension(:), intent(in) :: a_elt
real(kind=R8), dimension(:), intent(in) :: b
real(kind=R8), intent(out) :: error
real(kind=R8), dimension(slv_struct%nn) :: y
! to assess the accuracy, the solution is applied to the
! system matrix and compared to the rhs.
if (slv_struct%slv_t==MUMP) then
call prod_elemental_x(n = slv_struct%nn, &
nz = slv_struct%nt, &
nelt = slv_struct%ne, &
nvar = slv_struct%nvar, &
x = slv_struct%x, &
y = y, &
a_elt = a_elt, &
eltptr = slv_struct%eltptr, &
eltvar = slv_struct%eltvar)
else
call prod_a_x(n = slv_struct%nn, &
nz = slv_struct%nz, &
x = slv_struct%x, &
y = y, &
a_elt = a_elt, &
irow = slv_struct%irow, &
jptr = slv_struct%jptr, &
slvt = slv_struct%slv_t)
endif
error = 100*maxval( abs(y(1:slv_struct%nn) -b(1:slv_struct%nn)) )/ &
maxval( abs(y(1:slv_struct%nn) +b(1:slv_struct%nn)) )
return
endsubroutine verif_solution