Release FemLite 0.3.0
FemLite CI / build-test (push) Has been cancelled

This commit is contained in:
shenw
2026-06-23 19:28:44 +08:00
parent f838ccc099
commit be02684827
74 changed files with 11618 additions and 201 deletions
+99 -1
View File
@@ -22,6 +22,7 @@ module fem_database
integer :: nmpc = 0
integer :: nmpc_term = 0
integer :: ncontact_plane = 0
integer :: ncontact_pair = 0
real(rk), allocatable :: coord0(:,:)
real(rk), allocatable :: coord(:,:)
@@ -44,6 +45,7 @@ module fem_database
real(rk), allocatable :: fext(:)
real(rk), allocatable :: fsph(:)
real(rk), allocatable :: fcontact(:)
real(rk), allocatable :: freaction(:)
integer, allocatable :: elem_gp_start(:)
integer, allocatable :: elem_ngp(:)
@@ -139,6 +141,11 @@ module fem_database
real(rk), allocatable :: contact_offset(:)
real(rk), allocatable :: contact_penalty(:)
real(rk), allocatable :: contact_damping(:)
character(len=NAME_LEN), allocatable :: contact_pair_slave(:)
character(len=NAME_LEN), allocatable :: contact_pair_master(:)
real(rk), allocatable :: contact_pair_penalty(:)
real(rk), allocatable :: contact_pair_damping(:)
real(rk), allocatable :: contact_pair_search(:)
contains
@@ -590,6 +597,43 @@ contains
ierr = FEM_SUCCESS
end subroutine database_allocate_contact
subroutine database_allocate_contact_pair(num_pairs, ierr)
integer, intent(in) :: num_pairs
integer, intent(out) :: ierr
integer :: stat
if (num_pairs .lt. 0) then
call error_set(FEM_ERR_INPUT, 'number of contact pairs must be non-negative', ierr)
return
end if
if (allocated(contact_pair_slave)) deallocate(contact_pair_slave)
if (allocated(contact_pair_master)) deallocate(contact_pair_master)
if (allocated(contact_pair_penalty)) deallocate(contact_pair_penalty)
if (allocated(contact_pair_damping)) deallocate(contact_pair_damping)
if (allocated(contact_pair_search)) deallocate(contact_pair_search)
ncontact_pair = num_pairs
if (num_pairs .gt. 0) then
allocate(contact_pair_slave(num_pairs), contact_pair_master(num_pairs), &
contact_pair_penalty(num_pairs), contact_pair_damping(num_pairs), &
contact_pair_search(num_pairs), stat=stat)
if (stat .ne. 0) then
ncontact_pair = 0
call error_set(FEM_ERR_INTERNAL, 'failed to allocate contact pair arrays', ierr)
return
end if
contact_pair_slave = 'ALL'
contact_pair_master = 'ALL'
contact_pair_penalty = ZERO
contact_pair_damping = ZERO
contact_pair_search = ZERO
end if
ierr = FEM_SUCCESS
end subroutine database_allocate_contact_pair
subroutine database_allocate_basic(num_nodes, num_elems, num_dof, ierr)
integer, intent(in) :: num_nodes
integer, intent(in) :: num_elems
@@ -640,6 +684,7 @@ contains
if (allocated(fext)) deallocate(fext)
if (allocated(fsph)) deallocate(fsph)
if (allocated(fcontact)) deallocate(fcontact)
if (allocated(freaction)) deallocate(freaction)
if (.not. allocated(dof_id)) then
allocate(dof_id(NDOF_NODE,nnode), stat=stat)
@@ -651,7 +696,8 @@ contains
end if
allocate(u(ndof), v(ndof), a(ndof), vhalf(ndof), mass_diag(ndof), &
fint(ndof), fext(ndof), fsph(ndof), fcontact(ndof), stat=stat)
fint(ndof), fext(ndof), fsph(ndof), fcontact(ndof), &
freaction(ndof), stat=stat)
if (stat .ne. 0) then
call error_set(FEM_ERR_INTERNAL, 'failed to allocate global vectors', ierr)
return
@@ -666,6 +712,7 @@ contains
fext = ZERO
fsph = ZERO
fcontact = ZERO
freaction = ZERO
ierr = FEM_SUCCESS
end subroutine database_allocate_vectors
@@ -692,6 +739,7 @@ contains
if (allocated(fext)) fext = ZERO
if (allocated(fsph)) fsph = ZERO
if (allocated(fcontact)) fcontact = ZERO
if (allocated(freaction)) freaction = ZERO
if (allocated(nset_name)) nset_name = ' '
if (allocated(nset_start)) nset_start = 0
if (allocated(nset_count)) nset_count = 0
@@ -770,6 +818,11 @@ contains
if (allocated(contact_offset)) contact_offset = ZERO
if (allocated(contact_penalty)) contact_penalty = ZERO
if (allocated(contact_damping)) contact_damping = ZERO
if (allocated(contact_pair_slave)) contact_pair_slave = 'ALL'
if (allocated(contact_pair_master)) contact_pair_master = 'ALL'
if (allocated(contact_pair_penalty)) contact_pair_penalty = ZERO
if (allocated(contact_pair_damping)) contact_pair_damping = ZERO
if (allocated(contact_pair_search)) contact_pair_search = ZERO
ierr = FEM_SUCCESS
end subroutine database_initialize
@@ -1361,9 +1414,47 @@ contains
end if
end do
do item = 1, ncontact_pair
if (.not. contact_surface_target_exists(contact_pair_slave(item))) then
call error_set(FEM_ERR_INPUT, 'contact pair slave is not ALL, an element, or an element set', ierr)
return
end if
if (.not. contact_surface_target_exists(contact_pair_master(item))) then
call error_set(FEM_ERR_INPUT, 'contact pair master is not ALL, an element, or an element set', ierr)
return
end if
if (contact_pair_penalty(item) .le. ZERO) then
call error_set(FEM_ERR_INPUT, 'contact pair penalty must be positive', ierr)
return
end if
if (contact_pair_damping(item) .lt. ZERO) then
call error_set(FEM_ERR_INPUT, 'contact pair damping must be non-negative', ierr)
return
end if
if (contact_pair_search(item) .lt. ZERO) then
call error_set(FEM_ERR_INPUT, 'contact pair search distance must be non-negative', ierr)
return
end if
end do
ierr = FEM_SUCCESS
end subroutine validate_contact_data
logical function contact_surface_target_exists(target)
character(len=*), intent(in) :: target
character(len=NAME_LEN) :: local_target
local_target = adjustl(target)
contact_surface_target_exists = .false.
if (len_trim(local_target) .eq. 0) then
contact_surface_target_exists = .true.
else if (trim(local_target) .eq. 'ALL' .or. trim(local_target) .eq. 'all') then
contact_surface_target_exists = .true.
else
contact_surface_target_exists = elem_or_elset_exists(local_target)
end if
end function contact_surface_target_exists
logical function contact_target_exists(target)
character(len=*), intent(in) :: target
character(len=NAME_LEN) :: local_target
@@ -1428,6 +1519,7 @@ contains
if (allocated(fext)) deallocate(fext)
if (allocated(fsph)) deallocate(fsph)
if (allocated(fcontact)) deallocate(fcontact)
if (allocated(freaction)) deallocate(freaction)
if (allocated(elem_gp_start)) deallocate(elem_gp_start)
if (allocated(elem_ngp)) deallocate(elem_ngp)
if (allocated(stress)) deallocate(stress)
@@ -1511,6 +1603,11 @@ contains
if (allocated(contact_offset)) deallocate(contact_offset)
if (allocated(contact_penalty)) deallocate(contact_penalty)
if (allocated(contact_damping)) deallocate(contact_damping)
if (allocated(contact_pair_slave)) deallocate(contact_pair_slave)
if (allocated(contact_pair_master)) deallocate(contact_pair_master)
if (allocated(contact_pair_penalty)) deallocate(contact_pair_penalty)
if (allocated(contact_pair_damping)) deallocate(contact_pair_damping)
if (allocated(contact_pair_search)) deallocate(contact_pair_search)
nnode = 0
nelem = 0
@@ -1530,6 +1627,7 @@ contains
nmpc = 0
nmpc_term = 0
ncontact_plane = 0
ncontact_pair = 0
ierr = FEM_SUCCESS
end subroutine database_finalize