FrontISTR  5.8.0
Large-scale structural analysis program with finit element method
fstr_StiffMatrix.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2019 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
6 
8  use m_fstr
9  implicit none
10 
11  private
12  public :: fstr_stiffmatrix
13 
14 contains
15 
16  !---------------------------------------------------------------------*
18  subroutine fstr_stiffmatrix( hecMESH, hecMAT, fstrSOLID, time, tincr)
19  !---------------------------------------------------------------------*
20  use m_static_lib
21  use mmechgauss
22 
23  type (hecmwst_local_mesh) :: hecmesh
24  type (hecmwst_matrix) :: hecmat
25  type (fstr_solid) :: fstrsolid
26  real(kind=kreal),intent(in) :: time
27  real(kind=kreal),intent(in) :: tincr
28 
29  type( tmaterial ), pointer :: material
30 
31  real(kind=kreal) :: stiffness(fstrsolid%max_ncon_stf*6, fstrsolid%max_ncon_stf*6)
32  integer(kind=kint) :: nodlocal(fstrsolid%max_ncon)
33  real(kind=kreal) :: tt(fstrsolid%max_ncon), ecoord(3,fstrsolid%max_ncon)
34  real(kind=kreal) :: thick
35  integer(kind=kint) :: ndof, itype, is, ie, ic_type, nn, icel, iis, i, j
36  real(kind=kreal) :: u(6,fstrsolid%max_ncon), du(6,fstrsolid%max_ncon), coords(3,3), u_prev(6,fstrsolid%max_ncon)
37  integer :: isect, ihead, cdsys_id
38 
39  ! ----- initialize
40  call hecmw_mat_clear( hecmat )
41 
42  ndof = hecmat%NDOF
43  tt(:) = 0.d0
44 
45  do itype= 1, hecmesh%n_elem_type
46  is= hecmesh%elem_type_index(itype-1) + 1
47  ie= hecmesh%elem_type_index(itype )
48  ic_type= hecmesh%elem_type_item(itype)
49  ! ----- Ignore link and patch elements
50  if (hecmw_is_etype_link(ic_type)) cycle
51  if (hecmw_is_etype_patch(ic_type)) cycle
52  ! ----- Set number of nodes
53 
54  ! ----- element loop
55  !$omp parallel default(none), &
56  !$omp& private(icel,iiS,nn,j,nodLOCAL,i,ecoord,du,u,u_prev,tt,cdsys_ID,coords, &
57  !$omp& material,thick,stiffness,isect,ihead), &
58  !$omp& shared(iS,iE,hecMESH,ndof,fstrSOLID,ic_type,hecMAT,time,tincr)
59  !$omp do
60  do icel= is, ie
61 
62  ! ----- nodal coordinate & displacement
63  iis= hecmesh%elem_node_index(icel-1)
64  nn = hecmesh%elem_node_index(icel)-iis
65  ! if( nn>150 ) stop "elemental nodes > 150!"
66 
67  do j=1,nn
68  nodlocal(j)= hecmesh%elem_node_item (iis+j)
69  do i=1, 3
70  ecoord(i,j) = hecmesh%node(3*nodlocal(j)+i-3)
71  enddo
72  do i=1,ndof
73  du(i,j) = fstrsolid%dunode(ndof*nodlocal(j)+i-ndof)
74  u(i,j) = fstrsolid%unode(ndof*nodlocal(j)+i-ndof) + du(i,j)
75  u_prev(i,j) = fstrsolid%unode(ndof*nodlocal(j)+i-ndof)
76  enddo
77  if( fstrsolid%TEMP_ngrp_tot > 0 .or. fstrsolid%TEMP_irres >0 ) &
78  tt(j)=fstrsolid%temperature( nodlocal(j) )
79  enddo
80 
81  isect = hecmesh%section_ID(icel)
82  ihead = hecmesh%section%sect_R_index(isect-1)
83  cdsys_id = hecmesh%section%sect_orien_ID(isect)
84  if( cdsys_id > 0 ) call get_coordsys(cdsys_id, hecmesh, fstrsolid, coords)
85  thick = hecmesh%section%sect_R_item(ihead+1)
86  material => fstrsolid%elements(icel)%gausses(1)%pMaterial
87 
88  if( ic_type==241 .or. ic_type==242 .or. ic_type==231 .or. ic_type==232 .or. ic_type==2322) then
89  if( material%nlgeom_flag /= infinitesimal ) call stiffmat_abort( ic_type, 2 )
90  call stf_c2( ic_type,nn,ecoord(1:2,1:nn),fstrsolid%elements(icel)%gausses(:),thick, &
91  stiffness(1:nn*ndof,1:nn*ndof), fstrsolid%elements(icel)%iset, &
92  u(1:2,1:nn) )
93 
94  elseif ( ic_type==301 ) then
95  call stf_c1( ic_type,nn,ecoord(:,1:nn),thick,fstrsolid%elements(icel)%gausses(:), &
96  stiffness(1:nn*ndof,1:nn*ndof), u(1:3,1:nn) )
97 
98  elseif ( ic_type==361 ) then
99  if( fstrsolid%sections(isect)%elemopt361 == kel361fi ) then ! full integration element
100  call stf_c3 &
101  ( ic_type, nn, ecoord(:, 1:nn), fstrsolid%elements(icel)%gausses(:), &
102  stiffness(1:nn*ndof, 1:nn*ndof), cdsys_id, coords, time, tincr, u(1:3,1:nn), tt(1:nn) )
103  else if( fstrsolid%sections(isect)%elemopt361 == kel361bbar ) then ! B-bar element
104  call stf_c3d8bbar &
105  ( ic_type, nn, ecoord(:, 1:nn), fstrsolid%elements(icel)%gausses(:), &
106  stiffness(1:nn*ndof,1:nn*ndof), cdsys_id, coords, time, tincr, u(1:3, 1:nn), tt(1:nn) )
107  else if( fstrsolid%sections(isect)%elemopt361 == kel361ic ) then ! incompatible element
108  call stf_c3d8ic &
109  ( ic_type, nn, ecoord(:,1:nn), fstrsolid%elements(icel)%gausses(:), &
110  stiffness(1:nn*ndof, 1:nn*ndof), cdsys_id, coords, time, tincr, u(1:3,1:nn), &
111  fstrsolid%elements(icel)%aux, tt(1:nn) )
112  else if( fstrsolid%sections(isect)%elemopt361 == kel361fbar ) then ! F-bar element
113  call stf_c3d8fbar &
114  ( ic_type, nn, ecoord(:, 1:nn), fstrsolid%elements(icel)%gausses(:), &
115  stiffness(1:nn*ndof,1:nn*ndof), cdsys_id, coords, time, tincr, u(1:3, 1:nn), tt(1:nn) )
116  endif
117 
118  elseif (ic_type==341 .or. ic_type==351 .or. ic_type==342 .or. ic_type==352 .or. ic_type==362 ) then
119  if( ic_type==341 .and. fstrsolid%sections(isect)%elemopt341 == kel341sesns ) cycle ! skip smoothed fem
120  call stf_c3 &
121  ( ic_type, nn, ecoord(:, 1:nn), fstrsolid%elements(icel)%gausses(:), &
122  stiffness(1:nn*ndof, 1:nn*ndof), cdsys_id, coords, time, tincr, u(1:3,1:nn), tt(1:nn) )
123 
124  else if( ic_type == 511) then
125  call stf_connector( ic_type,nn,ecoord(:,1:nn),fstrsolid%elements(icel)%gausses(:), &
126  stiffness(1:nn*ndof,1:nn*ndof), u(1:3,1:nn), tincr, tt(1:nn) )
127 
128  else if( ic_type == 611) then
129  if( material%nlgeom_flag /= infinitesimal ) call stiffmat_abort( ic_type, 2 )
130  call stf_beam(ic_type, nn, ecoord, hecmesh%section%sect_R_item(ihead+1:), &
131  & material%variables(m_youngs), material%variables(m_poisson), stiffness(1:nn*ndof,1:nn*ndof))
132 
133  else if( ic_type == 641 ) then
134  if( material%nlgeom_flag /= infinitesimal ) call stiffmat_abort( ic_type, 2 )
135  call stf_beam_641(ic_type, nn, ecoord, fstrsolid%elements(icel)%gausses(:), &
136  & hecmesh%section%sect_R_item(ihead+1:), stiffness(1:nn*ndof,1:nn*ndof))
137 
138  else if( ( ic_type == 741 ) .or. ( ic_type == 743 ) .or. ( ic_type == 731 ) ) then
139  if( material%nlgeom_flag /= infinitesimal ) call stiffmat_abort( ic_type, 2 )
140  call stf_shell_mitc(ic_type, nn, ndof, ecoord(1:3, 1:nn), fstrsolid%elements(icel)%gausses(:), &
141  & stiffness(1:nn*ndof, 1:nn*ndof), thick, 0)
142 
143  else if( ic_type == 761 ) then !for shell-solid mixed analysis
144  if( material%nlgeom_flag /= infinitesimal ) call stiffmat_abort( ic_type, 2 )
145  call stf_shell_mitc(731, 3, 6, ecoord(1:3, 1:3), fstrsolid%elements(icel)%gausses(:), &
146  & stiffness(1:nn*ndof, 1:nn*ndof), thick, 2)
147 
148  else if( ic_type == 781 ) then !for shell-solid mixed analysis
149  if( material%nlgeom_flag /= infinitesimal ) call stiffmat_abort( ic_type, 2 )
150  call stf_shell_mitc(741, 4, 6, ecoord(1:3, 1:4), fstrsolid%elements(icel)%gausses(:), &
151  & stiffness(1:nn*ndof, 1:nn*ndof), thick, 1)
152 
153  elseif ( ic_type==3414 ) then
154  if( material%mtype /= incomp_newtonian) call stiffmat_abort( ic_type, 3, material%mtype )
155  call stf_c3_vp &
156  ( ic_type, nn, ecoord(:, 1:nn),fstrsolid%elements(icel)%gausses(:), &
157  stiffness(1:nn*ndof, 1:nn*ndof), tincr, u_prev(1:4, 1:nn) )
158  else if ( ic_type == 881 .or. ic_type == 891 ) then !for selective es/ns smoothed fem
159  call stf_c3d4_sesns &
160  ( ic_type,nn,nodlocal,ecoord(:, 1:nn), fstrsolid%elements(icel)%gausses(:), &
161  stiffness, cdsys_id, coords, time, tincr, u(1:3,1:nn), tt(1:nn) )
162  else
163  call stiffmat_abort( ic_type, 1 )
164  endif
165 
166  ! elemact element
167  if( fstrsolid%elements(icel)%elemact_flag == kelact_inactive ) then
168  call stf_dummy( ndof, nn, ecoord(:,1:nn), u(1:3,1:nn), &
169  & stiffness(1:nn*ndof, 1:nn*ndof), fstrsolid%elements(icel) )
170  !stiffness(:,:) = fstrSOLID%elements(icel)%elemact_coeff*stiffness(:,:)
171  end if
172  !
173  ! ----- CONSTRUCT the GLOBAL MATRIX STARTED
174  call hecmw_mat_ass_elem(hecmat, nn, nodlocal, stiffness)
175 
176  enddo ! icel
177  !$omp end do
178  !$omp end parallel
179  enddo ! itype
180 
181  end subroutine fstr_stiffmatrix
182 
183  subroutine stiffmat_abort( ic_type, flag, mtype )
184  integer(kind=kint), intent(in) :: ic_type
185  integer(kind=kint), intent(in) :: flag
186  integer(kind=kint), intent(in), optional :: mtype
187 
188  if( flag == 1 ) then
189  write(*,*) '###ERROR### : Element type not supported for static analysis'
190  else if( flag == 2 ) then
191  write(*,*) '###ERROR### : Element type not supported for nonlinear static analysis'
192  else if( flag == 3 ) then
193  write(*,*) '###ERROR### : This element is not supported for this material'
194  endif
195  write(*,*) ' ic_type = ', ic_type
196  if( present(mtype) ) write(*,*) ' mtype = ', mtype
197  call hecmw_abort(hecmw_comm_get_comm())
198  end subroutine
199 
200 end module m_fstr_stiffmatrix
This module provides function to calculate tangent stiffness matrix.
subroutine, public fstr_stiffmatrix(hecMESH, hecMAT, fstrSOLID, time, tincr)
This subroutine creates tangential stiffness matrix.
subroutine stiffmat_abort(ic_type, flag, mtype)
This module defines common data and basic structures for analysis.
Definition: m_fstr.f90:15
integer(kind=kint), parameter kel361bbar
Definition: m_fstr.f90:79
subroutine get_coordsys(cdsys_ID, hecMESH, fstrSOLID, coords)
This subroutine fetch coords defined by local coordinate system.
Definition: m_fstr.f90:1091
integer(kind=kint), parameter kel341sesns
Definition: m_fstr.f90:76
integer(kind=kint), parameter kel361fi
Definition: m_fstr.f90:78
integer(kind=kint), parameter kel361ic
Definition: m_fstr.f90:80
integer(kind=kint), parameter kel361fbar
Definition: m_fstr.f90:81
This modules just summarizes all modules used in static analysis.
Definition: static_LIB.f90:6
This modules defines a structure to record history dependent parameter in static analysis.
Definition: mechgauss.f90:6