Add Shell local frame and rotation kinematics
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
program test_shell_rotation_kinematics
|
||||
use sph_precision, only: rk
|
||||
use sph_error, only: SPH_SUCCESS
|
||||
use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, sph_build_model
|
||||
use sph_shell, only: shell_omega, shell_alpha, shell_director, &
|
||||
shell_max_angular_velocity, sph_shell_update_directors
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
|
||||
call check_rotation_input()
|
||||
call check_solid_isolation()
|
||||
|
||||
contains
|
||||
|
||||
subroutine check_rotation_input()
|
||||
real(rk) :: before(3)
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for Shell rotation input')
|
||||
call sph_read_inp('tests/data/shell_angular_velocity_update_061.inp', ierr)
|
||||
call assert_ok(ierr, 'read failed for Shell rotation input')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build failed for Shell rotation input')
|
||||
before = shell_director(:,1)
|
||||
if (any(abs(shell_omega(:,1) - (/0.0_rk, 10.0_rk, 0.0_rk/)) > &
|
||||
1.0e-12_rk)) call fail('Shell angular velocity input mismatch')
|
||||
if (any(abs(shell_alpha(:,1)) > 1.0e-12_rk)) &
|
||||
call fail('Shell angular acceleration default mismatch')
|
||||
if (abs(shell_max_angular_velocity - 10.0_rk) > 1.0e-12_rk) &
|
||||
call fail('Shell max angular velocity input mismatch')
|
||||
call sph_shell_update_directors(0.01_rk, ierr)
|
||||
call assert_ok(ierr, 'Shell rotation input update failed')
|
||||
if (abs(shell_director(1,1) - before(1)) < 1.0e-6_rk) &
|
||||
call fail('Shell input rotation did not move director')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed for Shell rotation input')
|
||||
end subroutine check_rotation_input
|
||||
|
||||
subroutine check_solid_isolation()
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for Shell rotation isolation')
|
||||
call sph_read_inp('tests/data/shell_solid_kinematics_isolation_061.inp', ierr)
|
||||
call assert_ok(ierr, 'read failed for Shell rotation isolation')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build failed for Shell rotation isolation')
|
||||
if (any(abs(shell_omega(:,3)) > 1.0e-12_rk)) &
|
||||
call fail('Solid particle Shell omega default changed')
|
||||
if (any(abs(shell_alpha(:,3)) > 1.0e-12_rk)) &
|
||||
call fail('Solid particle Shell alpha default changed')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed for Shell rotation isolation')
|
||||
end subroutine check_solid_isolation
|
||||
|
||||
subroutine assert_ok(ierr_value, message)
|
||||
integer, intent(in) :: ierr_value
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
if (ierr_value /= SPH_SUCCESS) call fail(message)
|
||||
end subroutine assert_ok
|
||||
|
||||
subroutine fail(message)
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
write(*, '(A)') trim(message)
|
||||
stop 1
|
||||
end subroutine fail
|
||||
|
||||
end program test_shell_rotation_kinematics
|
||||
Reference in New Issue
Block a user