Add Shell small strain kinematics

This commit is contained in:
Codex
2026-07-03 21:29:59 +08:00
parent 4619fdf4ac
commit 2f9edf0a25
6 changed files with 590 additions and 33 deletions
+240 -2
View File
@@ -5,7 +5,7 @@ module sph_shell
use sph_database, only: SPH_MAX_MATERIALS, SPH_MAX_SETS, SPH_MAX_ELEMENTS, &
SPH_MAX_ELEMENT_NODES, SPH_NAME_LEN, material_count, material_name, &
material_type, material_density, npart, particle_id_ext, &
particle_phase, particle_status, material_id, x0, mass, volume, &
particle_phase, particle_status, material_id, x0, x, mass, volume, &
internal_energy, temperature, nset_count, nset_name, &
nset_member_count, nset_members, elset_count, elset_name, &
elset_member_count, elset_members, element_id_ext, element_conn_count, &
@@ -76,6 +76,9 @@ module sph_shell
integer :: shell_inertia_degenerate_count = 0
real(rk) :: shell_director_max_length_error = 0.0_rk
real(rk) :: shell_max_angular_velocity = 0.0_rk
real(rk) :: shell_max_membrane_strain = 0.0_rk
real(rk) :: shell_max_bending_strain = 0.0_rk
real(rk) :: shell_max_shear_strain = 0.0_rk
real(rk), allocatable :: shell_thickness(:)
real(rk), allocatable :: shell_director(:,:)
real(rk), allocatable :: shell_reference_area(:)
@@ -90,6 +93,9 @@ module sph_shell
real(rk), allocatable :: shell_membrane_strain(:,:)
real(rk), allocatable :: shell_bending_strain(:,:)
real(rk), allocatable :: shell_shear_strain(:,:)
real(rk), allocatable :: shell_membrane_strain_increment(:,:)
real(rk), allocatable :: shell_bending_strain_increment(:,:)
real(rk), allocatable :: shell_shear_strain_increment(:,:)
real(rk), allocatable :: shell_damage(:)
real(rk), allocatable :: shell_softening(:)
real(rk), allocatable :: shell_internal_energy(:)
@@ -164,6 +170,9 @@ contains
shell_inertia_degenerate_count = 0
shell_director_max_length_error = 0.0_rk
shell_max_angular_velocity = 0.0_rk
shell_max_membrane_strain = 0.0_rk
shell_max_bending_strain = 0.0_rk
shell_max_shear_strain = 0.0_rk
end subroutine sph_shell_clear_orientation_table
subroutine sph_shell_note_material(name, material_type_in)
@@ -480,6 +489,25 @@ contains
call sph_shell_update_max_angular_velocity()
end subroutine sph_shell_set_particle_angular_velocity
subroutine sph_shell_set_particle_director(index, director_value, ierr)
integer, intent(in) :: index
real(rk), intent(in) :: director_value(SPH_NDIM)
integer, intent(out) :: ierr
integer :: status_value
ierr = SPH_SUCCESS
if (index < 1 .or. index > npart .or. .not. allocated(shell_director)) then
call sph_error_set(SPH_ERROR_ARGUMENT, 'Shell director index is invalid')
ierr = SPH_ERROR_ARGUMENT
return
end if
status_value = shell_director_status(index)
if (status_value == SPH_SHELL_DIRECTOR_NONE) status_value = SPH_SHELL_DIRECTOR_INPUT
call sph_shell_apply_director(index, director_value, status_value, ierr)
if (ierr /= SPH_SUCCESS) return
call sph_shell_initialize_local_frame(index, section_id(index), ierr)
end subroutine sph_shell_set_particle_director
subroutine sph_shell_build_state(ierr)
integer, intent(out) :: ierr
@@ -515,7 +543,10 @@ contains
allocated(shell_local_e2) .and. &
allocated(shell_local_e3) .and. &
allocated(shell_local_frame_status) .and. &
allocated(shell_alpha)) return
allocated(shell_alpha) .and. &
allocated(shell_membrane_strain_increment) .and. &
allocated(shell_bending_strain_increment) .and. &
allocated(shell_shear_strain_increment)) return
call sph_shell_deallocate_state()
end if
allocate(shell_thickness(npart), shell_director(SPH_NDIM,npart), &
@@ -527,6 +558,9 @@ contains
shell_membrane_strain(SPH_SHELL_MEMBRANE_COMPONENTS,npart), &
shell_bending_strain(SPH_SHELL_BENDING_COMPONENTS,npart), &
shell_shear_strain(SPH_SHELL_SHEAR_COMPONENTS,npart), &
shell_membrane_strain_increment(SPH_SHELL_MEMBRANE_COMPONENTS,npart), &
shell_bending_strain_increment(SPH_SHELL_BENDING_COMPONENTS,npart), &
shell_shear_strain_increment(SPH_SHELL_SHEAR_COMPONENTS,npart), &
shell_damage(npart), shell_softening(npart), &
shell_internal_energy(npart), shell_failure_status(npart), &
shell_ip_count(npart), &
@@ -565,6 +599,9 @@ contains
if (allocated(shell_membrane_strain)) deallocate(shell_membrane_strain)
if (allocated(shell_bending_strain)) deallocate(shell_bending_strain)
if (allocated(shell_shear_strain)) deallocate(shell_shear_strain)
if (allocated(shell_membrane_strain_increment)) deallocate(shell_membrane_strain_increment)
if (allocated(shell_bending_strain_increment)) deallocate(shell_bending_strain_increment)
if (allocated(shell_shear_strain_increment)) deallocate(shell_shear_strain_increment)
if (allocated(shell_damage)) deallocate(shell_damage)
if (allocated(shell_softening)) deallocate(shell_softening)
if (allocated(shell_internal_energy)) deallocate(shell_internal_energy)
@@ -595,6 +632,9 @@ contains
if (allocated(shell_membrane_strain)) shell_membrane_strain = 0.0_rk
if (allocated(shell_bending_strain)) shell_bending_strain = 0.0_rk
if (allocated(shell_shear_strain)) shell_shear_strain = 0.0_rk
if (allocated(shell_membrane_strain_increment)) shell_membrane_strain_increment = 0.0_rk
if (allocated(shell_bending_strain_increment)) shell_bending_strain_increment = 0.0_rk
if (allocated(shell_shear_strain_increment)) shell_shear_strain_increment = 0.0_rk
if (allocated(shell_damage)) shell_damage = 0.0_rk
if (allocated(shell_softening)) shell_softening = 0.0_rk
if (allocated(shell_internal_energy)) shell_internal_energy = 0.0_rk
@@ -620,6 +660,9 @@ contains
shell_inertia_degenerate_count = 0
shell_director_max_length_error = 0.0_rk
shell_max_angular_velocity = 0.0_rk
shell_max_membrane_strain = 0.0_rk
shell_max_bending_strain = 0.0_rk
shell_max_shear_strain = 0.0_rk
end subroutine sph_shell_reset_build_diagnostics
subroutine sph_shell_initialize_particle_state(ierr)
@@ -997,6 +1040,201 @@ contains
call sph_shell_update_max_angular_velocity()
end subroutine sph_shell_update_directors
subroutine sph_shell_compute_small_strain(ierr)
integer, intent(out) :: ierr
integer :: i
real(rk) :: displacement_grad(3,2)
real(rk) :: director_grad(2,2)
ierr = SPH_SUCCESS
if (.not. allocated(shell_membrane_strain)) return
shell_membrane_strain = 0.0_rk
shell_bending_strain = 0.0_rk
shell_shear_strain = 0.0_rk
shell_membrane_strain_increment = 0.0_rk
shell_bending_strain_increment = 0.0_rk
shell_shear_strain_increment = 0.0_rk
shell_max_membrane_strain = 0.0_rk
shell_max_bending_strain = 0.0_rk
shell_max_shear_strain = 0.0_rk
do i = 1, npart
if (.not. sph_shell_particle_is_active_section(i, section_id(i))) cycle
if (allocated(shell_failure_status)) then
if (shell_failure_status(i) /= SPH_STATUS_ACTIVE) cycle
end if
if (shell_local_frame_status(i) /= SPH_SHELL_FRAME_OK) then
call sph_error_set(SPH_ERROR_INPUT, 'Shell strain requires local frame')
ierr = SPH_ERROR_INPUT
return
end if
call sph_shell_compute_local_gradients(i, displacement_grad, &
director_grad, ierr)
if (ierr /= SPH_SUCCESS) return
call sph_shell_store_strain(i, displacement_grad, director_grad, ierr)
if (ierr /= SPH_SUCCESS) return
end do
end subroutine sph_shell_compute_small_strain
subroutine sph_shell_compute_local_gradients(index, displacement_grad, &
director_grad, ierr)
integer, intent(in) :: index
real(rk), intent(out) :: displacement_grad(3,2)
real(rk), intent(out) :: director_grad(2,2)
integer, intent(out) :: ierr
integer :: j
integer :: row
integer :: neighbor_count
real(rk) :: moment(2,2)
real(rk) :: disp_rhs(3,2)
real(rk) :: dir_rhs(2,2)
real(rk) :: rlocal(2)
real(rk) :: displacement_delta(SPH_NDIM)
real(rk) :: director_delta(SPH_NDIM)
real(rk) :: disp_local(3)
real(rk) :: dir_local(2)
ierr = SPH_SUCCESS
displacement_grad = 0.0_rk
director_grad = 0.0_rk
moment = 0.0_rk
disp_rhs = 0.0_rk
dir_rhs = 0.0_rk
neighbor_count = 0
do j = 1, npart
if (j == index) cycle
if (.not. sph_shell_particle_is_active_section(j, section_id(index))) cycle
rlocal(1) = sum((x0(:,j) - x0(:,index)) * shell_local_e1(:,index))
rlocal(2) = sum((x0(:,j) - x0(:,index)) * shell_local_e2(:,index))
if (sum(rlocal * rlocal) <= SPH_SHELL_EPS) cycle
displacement_delta = (x(:,j) - x0(:,j)) - (x(:,index) - x0(:,index))
director_delta = shell_director(:,j) - shell_director(:,index)
disp_local(1) = sum(displacement_delta * shell_local_e1(:,index))
disp_local(2) = sum(displacement_delta * shell_local_e2(:,index))
disp_local(3) = sum(displacement_delta * shell_local_e3(:,index))
dir_local(1) = sum(director_delta * shell_local_e1(:,index))
dir_local(2) = sum(director_delta * shell_local_e2(:,index))
moment(1,1) = moment(1,1) + rlocal(1) * rlocal(1)
moment(1,2) = moment(1,2) + rlocal(1) * rlocal(2)
moment(2,2) = moment(2,2) + rlocal(2) * rlocal(2)
do row = 1, 3
disp_rhs(row,1) = disp_rhs(row,1) + disp_local(row) * rlocal(1)
disp_rhs(row,2) = disp_rhs(row,2) + disp_local(row) * rlocal(2)
end do
do row = 1, 2
dir_rhs(row,1) = dir_rhs(row,1) + dir_local(row) * rlocal(1)
dir_rhs(row,2) = dir_rhs(row,2) + dir_local(row) * rlocal(2)
end do
neighbor_count = neighbor_count + 1
end do
moment(2,1) = moment(1,2)
if (neighbor_count <= 0) then
call sph_error_set(SPH_ERROR_INPUT, 'Shell strain gradient has no neighbors')
ierr = SPH_ERROR_INPUT
return
end if
call sph_shell_solve_local_gradient(moment, disp_rhs, displacement_grad, ierr)
if (ierr /= SPH_SUCCESS) return
call sph_shell_solve_local_gradient_2(moment, dir_rhs, director_grad, ierr)
end subroutine sph_shell_compute_local_gradients
subroutine sph_shell_solve_local_gradient(moment, rhs, gradient, ierr)
real(rk), intent(in) :: moment(2,2)
real(rk), intent(in) :: rhs(3,2)
real(rk), intent(out) :: gradient(3,2)
integer, intent(out) :: ierr
integer :: row
ierr = SPH_SUCCESS
gradient = 0.0_rk
do row = 1, 3
call sph_shell_solve_local_gradient_row(moment, rhs(row,:), &
gradient(row,:), ierr)
if (ierr /= SPH_SUCCESS) return
end do
end subroutine sph_shell_solve_local_gradient
subroutine sph_shell_solve_local_gradient_2(moment, rhs, gradient, ierr)
real(rk), intent(in) :: moment(2,2)
real(rk), intent(in) :: rhs(2,2)
real(rk), intent(out) :: gradient(2,2)
integer, intent(out) :: ierr
integer :: row
ierr = SPH_SUCCESS
gradient = 0.0_rk
do row = 1, 2
call sph_shell_solve_local_gradient_row(moment, rhs(row,:), &
gradient(row,:), ierr)
if (ierr /= SPH_SUCCESS) return
end do
end subroutine sph_shell_solve_local_gradient_2
subroutine sph_shell_solve_local_gradient_row(moment, rhs, gradient, ierr)
real(rk), intent(in) :: moment(2,2)
real(rk), intent(in) :: rhs(2)
real(rk), intent(out) :: gradient(2)
integer, intent(out) :: ierr
real(rk) :: det
ierr = SPH_SUCCESS
gradient = 0.0_rk
det = moment(1,1) * moment(2,2) - moment(1,2) * moment(2,1)
if (abs(det) > SPH_SHELL_EPS) then
gradient(1) = (rhs(1) * moment(2,2) - rhs(2) * moment(2,1)) / det
gradient(2) = (-rhs(1) * moment(1,2) + rhs(2) * moment(1,1)) / det
else if (moment(1,1) > SPH_SHELL_EPS .and. &
abs(moment(1,2)) <= SPH_SHELL_EPS) then
gradient(1) = rhs(1) / moment(1,1)
else if (moment(2,2) > SPH_SHELL_EPS .and. &
abs(moment(1,2)) <= SPH_SHELL_EPS) then
gradient(2) = rhs(2) / moment(2,2)
else
call sph_error_set(SPH_ERROR_INPUT, 'Shell strain gradient is degenerate')
ierr = SPH_ERROR_INPUT
end if
end subroutine sph_shell_solve_local_gradient_row
subroutine sph_shell_store_strain(index, displacement_grad, director_grad, ierr)
integer, intent(in) :: index
real(rk), intent(in) :: displacement_grad(3,2)
real(rk), intent(in) :: director_grad(2,2)
integer, intent(out) :: ierr
ierr = SPH_SUCCESS
if (.not. sph_shell_vector_is_finite(reshape(displacement_grad, (/6/))) .or. &
.not. sph_shell_vector_is_finite(reshape(director_grad, (/4/)))) then
call sph_error_set(SPH_ERROR_INPUT, 'Shell strain gradient is not finite')
ierr = SPH_ERROR_INPUT
return
end if
shell_membrane_strain(1,index) = displacement_grad(1,1)
shell_membrane_strain(2,index) = displacement_grad(2,2)
shell_membrane_strain(3,index) = 0.5_rk * &
(displacement_grad(1,2) + displacement_grad(2,1))
shell_bending_strain(1,index) = director_grad(1,1)
shell_bending_strain(2,index) = director_grad(2,2)
shell_bending_strain(3,index) = 0.5_rk * &
(director_grad(1,2) + director_grad(2,1))
shell_shear_strain(1,index) = displacement_grad(3,1)
shell_shear_strain(2,index) = displacement_grad(3,2)
shell_membrane_strain_increment(:,index) = shell_membrane_strain(:,index)
shell_bending_strain_increment(:,index) = shell_bending_strain(:,index)
shell_shear_strain_increment(:,index) = shell_shear_strain(:,index)
call sph_shell_update_strain_diagnostics(index)
end subroutine sph_shell_store_strain
subroutine sph_shell_update_strain_diagnostics(index)
integer, intent(in) :: index
shell_max_membrane_strain = max(shell_max_membrane_strain, &
maxval(abs(shell_membrane_strain(:,index))))
shell_max_bending_strain = max(shell_max_bending_strain, &
maxval(abs(shell_bending_strain(:,index))))
shell_max_shear_strain = max(shell_max_shear_strain, &
maxval(abs(shell_shear_strain(:,index))))
end subroutine sph_shell_update_strain_diagnostics
subroutine sph_shell_find_director_for_particle(index, director_value, found)
integer, intent(in) :: index
real(rk), intent(out) :: director_value(SPH_NDIM)