Add Solid reference correction diagnostics
This commit is contained in:
@@ -5,7 +5,9 @@ program test_solid_gradient_correction
|
||||
use sph_database, only: npart, h
|
||||
use sph_solid_dynamics, only: sph_solid_build_reference_state
|
||||
use sph_solid_state, only: solid_correction_matrix, solid_deformation_gradient, &
|
||||
solid_reference_volume
|
||||
solid_reference_volume, solid_correction_determinant, &
|
||||
solid_reference_neighbor_count, solid_correction_status, &
|
||||
SPH_SOLID_CORRECTION_OK
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
@@ -27,9 +29,15 @@ contains
|
||||
call sph_solid_build_reference_state(ierr)
|
||||
call assert_ok(ierr, 'Solid reference state build failed')
|
||||
do i = 1, npart
|
||||
call assert_identity(solid_correction_matrix(:,:,i), 'Solid correction matrix mismatch')
|
||||
call assert_identity(solid_deformation_gradient(:,:,i), 'Solid deformation gradient mismatch')
|
||||
call assert_finite_matrix(solid_correction_matrix(:,:,i), &
|
||||
'Solid correction matrix is not finite')
|
||||
if (solid_reference_volume(i) <= 0.0_rk) call fail('Solid reference volume missing')
|
||||
if (solid_reference_neighbor_count(i) < 3) call fail('Solid reference neighbor count missing')
|
||||
if (solid_correction_status(i) /= SPH_SOLID_CORRECTION_OK) then
|
||||
call fail('Solid correction matrix was not accepted')
|
||||
end if
|
||||
if (solid_correction_determinant(i) <= 0.0_rk) call fail('Solid correction determinant missing')
|
||||
end do
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed for Solid reference state')
|
||||
@@ -65,6 +73,20 @@ contains
|
||||
end do
|
||||
end subroutine assert_identity
|
||||
|
||||
subroutine assert_finite_matrix(matrix, message)
|
||||
real(rk), intent(in) :: matrix(:,:)
|
||||
character(len=*), intent(in) :: message
|
||||
integer :: i
|
||||
integer :: j
|
||||
|
||||
do i = 1, SPH_NDIM
|
||||
do j = 1, SPH_NDIM
|
||||
if (matrix(i,j) /= matrix(i,j)) call fail(message)
|
||||
if (abs(matrix(i,j)) > huge(matrix(i,j)) * 0.5_rk) call fail(message)
|
||||
end do
|
||||
end do
|
||||
end subroutine assert_finite_matrix
|
||||
|
||||
subroutine assert_ok(ierr_value, message)
|
||||
integer, intent(in) :: ierr_value
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
Reference in New Issue
Block a user