Add analytical rigid plane contact

This commit is contained in:
shenw
2026-06-24 19:26:51 +08:00
parent 10777d836c
commit 29d4280236
10 changed files with 703 additions and 91 deletions
+66
View File
@@ -37,6 +37,8 @@ subroutine start_nset(set_index, item_pos, set_name_value)
surface_name(surface_index) = surface_name_value
if (allocated(surface_type)) surface_type(surface_index) = surface_type_value
if (allocated(surface_plane_normal)) surface_plane_normal(:,surface_index) = ZERO
if (allocated(surface_plane_offset)) surface_plane_offset(surface_index) = ZERO
surface_start(surface_index) = item_pos + 1
surface_count(surface_index) = 0
end subroutine start_surface
@@ -84,6 +86,10 @@ subroutine start_nset(set_index, item_pos, set_name_value)
call error_set(FEM_ERR_INPUT, '*SURFACE has more data lines than counted', ierr)
return
end if
if (trim(surface_type(surface_index)) .eq. 'ANALYTICAL') then
call add_analytical_surface_line(line, surface_index, item_pos, ierr)
return
end if
call csv_token(line, 1, token)
if (len_trim(token) .eq. 0) then
@@ -109,6 +115,66 @@ subroutine start_nset(set_index, item_pos, set_name_value)
ierr = FEM_SUCCESS
end subroutine add_surface_line
subroutine add_analytical_surface_line(line, surface_index, item_pos, ierr)
character(len=*), intent(in) :: line
integer, intent(in) :: surface_index
integer, intent(inout) :: item_pos
integer, intent(out) :: ierr
character(len=LINE_LEN) :: token
character(len=NAME_LEN) :: kind
real(rk) :: normal(NDIM)
real(rk) :: offset
integer :: idir
if (surface_count(surface_index) .gt. 0) then
call error_set(FEM_ERR_INPUT, 'analytical surface supports one plane line', ierr)
return
end if
call csv_token(line, 1, token)
call strip_keyword_quotes(token)
call to_upper(token, kind)
if (trim(kind) .ne. 'PLANE') then
call error_set(FEM_ERR_INPUT, 'analytical surface line must start with PLANE', ierr)
return
end if
do idir = 1, NDIM
call read_surface_real(line, idir + 1, normal(idir), ierr)
if (ierr .ne. FEM_SUCCESS) return
end do
call read_surface_real(line, 5, offset, ierr)
if (ierr .ne. FEM_SUCCESS) return
item_pos = item_pos + 1
if (allocated(surface_owner)) surface_owner(item_pos) = surface_index
surface_target(item_pos) = 'PLANE'
surface_face(item_pos) = ' '
surface_plane_normal(:,surface_index) = normal
surface_plane_offset(surface_index) = offset
surface_count(surface_index) = surface_count(surface_index) + 1
ierr = FEM_SUCCESS
end subroutine add_analytical_surface_line
subroutine read_surface_real(line, field_index, value, ierr)
character(len=*), intent(in) :: line
integer, intent(in) :: field_index
real(rk), intent(out) :: value
integer, intent(out) :: ierr
character(len=LINE_LEN) :: token
integer :: ios
call csv_token(line, field_index, token)
if (len_trim(token) .eq. 0) then
call error_set(FEM_ERR_INPUT, 'analytical surface plane data is incomplete', ierr)
return
end if
read(token,*,iostat=ios) value
if (ios .ne. 0) then
call error_set(FEM_ERR_INPUT, 'failed to parse analytical surface plane data', ierr)
return
end if
ierr = FEM_SUCCESS
end subroutine read_surface_real
subroutine add_set_line(line, generate_mode, set_index, item_pos, is_node_set, ierr)
character(len=*), intent(in) :: line
logical, intent(in) :: generate_mode
+4 -2
View File
@@ -924,8 +924,10 @@ contains
end if
call get_keyword_value(line, 'TYPE', type_value)
if (len_trim(type_value) .eq. 0) type_value = 'ELEMENT'
if (trim(type_value) .ne. 'ELEMENT' .and. trim(type_value) .ne. 'NODE') then
call error_set(FEM_ERR_INPUT, 'only *SURFACE TYPE=ELEMENT/NODE is supported', ierr)
if (trim(type_value) .ne. 'ELEMENT' .and. trim(type_value) .ne. 'NODE' .and. &
trim(type_value) .ne. 'ANALYTICAL') then
call error_set(FEM_ERR_INPUT, &
'only *SURFACE TYPE=ELEMENT/NODE/ANALYTICAL is supported', ierr)
return
end if
call get_keyword_value(line, 'OP', op_value)