Merge remote-tracking branch 'origin/FFTW-selftest' into development
This commit is contained in:
commit
758ad6072c
|
@ -142,7 +142,7 @@ contains
|
||||||
!> level chosen.
|
!> level chosen.
|
||||||
!> Initializes FFTW.
|
!> Initializes FFTW.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine spectral_utilities_init
|
subroutine spectral_utilities_init()
|
||||||
|
|
||||||
PetscErrorCode :: err_PETSc
|
PetscErrorCode :: err_PETSc
|
||||||
integer :: i, j, k, &
|
integer :: i, j, k, &
|
||||||
|
@ -350,6 +350,8 @@ subroutine spectral_utilities_init
|
||||||
allocate (gamma_hat(3,3,3,3,cells1Red,cells(2),cells3), source = cmplx(0.0_pReal,0.0_pReal,pReal))
|
allocate (gamma_hat(3,3,3,3,cells1Red,cells(2),cells3), source = cmplx(0.0_pReal,0.0_pReal,pReal))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call selfTest()
|
||||||
|
|
||||||
end subroutine spectral_utilities_init
|
end subroutine spectral_utilities_init
|
||||||
|
|
||||||
|
|
||||||
|
@ -1146,4 +1148,41 @@ subroutine utilities_saveReferenceStiffness
|
||||||
|
|
||||||
end subroutine utilities_saveReferenceStiffness
|
end subroutine utilities_saveReferenceStiffness
|
||||||
|
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief Check correctness of forward-backward transform.
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
subroutine selfTest()
|
||||||
|
|
||||||
|
real(pReal), allocatable, dimension(:,:,:,:,:) :: tensorField_real_
|
||||||
|
real(pReal), allocatable, dimension(:,:,:,:) :: vectorField_real_
|
||||||
|
real(pReal), allocatable, dimension(:,:,:) :: scalarField_real_
|
||||||
|
|
||||||
|
|
||||||
|
call random_number(tensorField_real)
|
||||||
|
tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal
|
||||||
|
tensorField_real_ = tensorField_real
|
||||||
|
call utilities_FFTtensorForward()
|
||||||
|
call utilities_FFTtensorBackward()
|
||||||
|
tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal
|
||||||
|
if (maxval(abs(tensorField_real_ - tensorField_real))>5.0e-15_pReal) error stop 'tensorField'
|
||||||
|
|
||||||
|
call random_number(vectorField_real)
|
||||||
|
vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal
|
||||||
|
vectorField_real_ = vectorField_real
|
||||||
|
call utilities_FFTvectorForward()
|
||||||
|
call utilities_FFTvectorBackward()
|
||||||
|
vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal
|
||||||
|
if (maxval(abs(vectorField_real_ - vectorField_real))>5.0e-15_pReal) error stop 'vectorField'
|
||||||
|
|
||||||
|
call random_number(scalarField_real)
|
||||||
|
scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal
|
||||||
|
scalarField_real_ = scalarField_real
|
||||||
|
call utilities_FFTscalarForward()
|
||||||
|
call utilities_FFTscalarBackward()
|
||||||
|
scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal
|
||||||
|
if (maxval(abs(scalarField_real_ - scalarField_real))>5.0e-15_pReal) error stop 'scalarField'
|
||||||
|
|
||||||
|
end subroutine selfTest
|
||||||
|
|
||||||
end module spectral_utilities
|
end module spectral_utilities
|
||||||
|
|
|
@ -48,7 +48,7 @@ contains
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Report precision and do self test.
|
!> @brief Report precision and do self test.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine prec_init
|
subroutine prec_init()
|
||||||
|
|
||||||
print'(/,1x,a)', '<<<+- prec init -+>>>'
|
print'(/,1x,a)', '<<<+- prec init -+>>>'
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ subroutine prec_init
|
||||||
print'( a,e10.3)', ' epsilon value: ',PREAL_EPSILON
|
print'( a,e10.3)', ' epsilon value: ',PREAL_EPSILON
|
||||||
print'( a,i3)', ' decimal precision: ',precision(0.0_pReal)
|
print'( a,i3)', ' decimal precision: ',precision(0.0_pReal)
|
||||||
|
|
||||||
call selfTest
|
call selfTest()
|
||||||
|
|
||||||
end subroutine prec_init
|
end subroutine prec_init
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ end function prec_bytesToC_INT64_T
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Check correctness of some prec functions.
|
!> @brief Check correctness of some prec functions.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine selfTest
|
subroutine selfTest()
|
||||||
|
|
||||||
integer, allocatable, dimension(:) :: realloc_lhs_test
|
integer, allocatable, dimension(:) :: realloc_lhs_test
|
||||||
real(pReal), dimension(1) :: f
|
real(pReal), dimension(1) :: f
|
||||||
|
|
Loading…
Reference in New Issue