Add basic Robin boundary support
This commit is contained in:
@@ -59,6 +59,9 @@ contains
|
||||
if (allocated(fsph)) rhs = rhs + fsph
|
||||
if (allocated(fcontact)) rhs = rhs + fcontact
|
||||
|
||||
call apply_implicit_robin(kmat, rhs, time, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) go to 900
|
||||
|
||||
call apply_implicit_dirichlet(kmat, rhs, time, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) go to 900
|
||||
|
||||
@@ -126,6 +129,96 @@ contains
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine apply_implicit_dirichlet
|
||||
|
||||
subroutine apply_implicit_robin(kmat, rhs, time, ierr)
|
||||
type(csr_matrix), intent(inout) :: kmat
|
||||
real(rk), intent(inout) :: rhs(:)
|
||||
real(rk), intent(in) :: time
|
||||
integer, intent(out) :: ierr
|
||||
integer :: item
|
||||
real(rk) :: scale
|
||||
|
||||
do item = 1, nrobin
|
||||
scale = database_amplitude_value(robin_amp(item), time)
|
||||
call apply_robin_target(kmat, rhs, robin_target(item), item, scale, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
end do
|
||||
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine apply_implicit_robin
|
||||
|
||||
subroutine apply_robin_target(kmat, rhs, target, item, scale, ierr)
|
||||
type(csr_matrix), intent(inout) :: kmat
|
||||
real(rk), intent(inout) :: rhs(:)
|
||||
character(len=*), intent(in) :: target
|
||||
integer, intent(in) :: item
|
||||
real(rk), intent(in) :: scale
|
||||
integer, intent(out) :: ierr
|
||||
integer :: node
|
||||
integer :: set_id
|
||||
integer :: pos
|
||||
integer :: external_id
|
||||
integer :: ios
|
||||
|
||||
read(target,*,iostat=ios) external_id
|
||||
if (ios .eq. 0) then
|
||||
node = database_find_node(external_id)
|
||||
if (node .eq. 0) then
|
||||
call error_set(FEM_ERR_INPUT, 'implicit Robin references unknown node', ierr)
|
||||
return
|
||||
end if
|
||||
call apply_robin_node(kmat, rhs, node, item, scale, ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
set_id = database_find_nset(target)
|
||||
if (set_id .eq. 0) then
|
||||
call error_set(FEM_ERR_INPUT, 'implicit Robin references unknown node set', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
do pos = nset_start(set_id), nset_start(set_id) + nset_count(set_id) - 1
|
||||
node = database_find_node(nset_items(pos))
|
||||
if (node .eq. 0) then
|
||||
call error_set(FEM_ERR_INPUT, 'implicit Robin node set contains unknown node', ierr)
|
||||
return
|
||||
end if
|
||||
call apply_robin_node(kmat, rhs, node, item, scale, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
end do
|
||||
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine apply_robin_target
|
||||
|
||||
subroutine apply_robin_node(kmat, rhs, node, item, scale, ierr)
|
||||
type(csr_matrix), intent(inout) :: kmat
|
||||
real(rk), intent(inout) :: rhs(:)
|
||||
integer, intent(in) :: node
|
||||
integer, intent(in) :: item
|
||||
real(rk), intent(in) :: scale
|
||||
integer, intent(out) :: ierr
|
||||
integer :: dof_num
|
||||
integer :: dof
|
||||
real(rk) :: stiffness
|
||||
|
||||
dof_num = robin_dof(item)
|
||||
if (dof_num .lt. 1 .or. dof_num .gt. NDOF_NODE) then
|
||||
call error_set(FEM_ERR_INPUT, 'implicit Robin dof is outside 1..6', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
dof = dof_id(dof_num,node)
|
||||
if (dof .gt. 0) then
|
||||
stiffness = scale * robin_stiffness(item)
|
||||
if (abs(stiffness) .gt. tiny(ONE)) then
|
||||
call csr_add_value(kmat, dof, dof, stiffness, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
rhs(dof) = rhs(dof) + stiffness * robin_reference(item)
|
||||
end if
|
||||
end if
|
||||
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine apply_robin_node
|
||||
|
||||
subroutine apply_bc_target(kmat, rhs, target, dof_num, value, ierr)
|
||||
type(csr_matrix), intent(inout) :: kmat
|
||||
real(rk), intent(inout) :: rhs(:)
|
||||
|
||||
Reference in New Issue
Block a user