compare_real_3d Function

public function compare_real_3d(label, got, exp, tol)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: label
real, intent(in) :: got(:,:,:)
real, intent(in) :: exp(:,:,:)
real, intent(in) :: tol

Return Value logical


Called by

proc~~compare_real_3d~~CalledByGraph proc~compare_real_3d compare_real_3d proc~tests_sgs_statistics tests_sgs_statistics proc~tests_sgs_statistics->proc~compare_real_3d proc~execute_runmode_actions execute_runmode_actions proc~execute_runmode_actions->proc~tests_sgs_statistics program~udales uDALES program~udales->proc~execute_runmode_actions

Source Code

  logical function compare_real_3d(label, got, exp, tol)
    implicit none
    character(len=*), intent(in) :: label
    real, intent(in) :: got(:,:,:), exp(:,:,:)
    real, intent(in) :: tol
    real :: max_abs
    integer :: imax(3)

    max_abs = maxval(abs(got - exp))
    compare_real_3d = max_abs <= tol
    if ((.not. compare_real_3d) .and. myid == 0) then
      imax = maxloc(abs(got - exp))
      write(*,'(A,1X,A,1X,ES12.4,1X,A,I0,A,I0,A,I0,1X,A,ES12.4,1X,A,ES12.4,1X,A,ES12.4)') &
           'FAIL', trim(label), max_abs, 'idx', imax(1), ',', imax(2), ',', imax(3), &
           'got', got(imax(1),imax(2),imax(3)), 'exp', exp(imax(1),imax(2),imax(3)), 'tol', tol
    end if
  end function compare_real_3d