FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
fstr_Update.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 !-------------------------------------------------------------------------------
7  use m_fstr
8  implicit none
9 
10  private :: update_abort
11 
12 contains
13 
14  !=====================================================================*
15  ! UPDATE_C3
25  subroutine fstr_updatenewton ( hecMESH, hecMAT, fstrSOLID, time, tincr,iter, strainEnergy)
26  !=====================================================================*
27  use m_static_lib
28  use m_elemact
32 
33  type (hecmwST_matrix) :: hecMAT
34  type (hecmwST_local_mesh) :: hecMESH
35  type (fstr_solid) :: fstrSOLID
36  real(kind=kreal),intent(in) :: time
37  real(kind=kreal),intent(in) :: tincr
38  integer, intent(in) :: iter
39 
40  integer(kind=kint) :: nodLOCAL(fstrSOLID%max_ncon)
41  real(kind=kreal) :: ecoord(3, fstrsolid%max_ncon)
42  real(kind=kreal) :: thick, thick0(6)
43  integer(kind=kint) :: ndof, itype, is, iE, ic_type, nn, icel, iiS, i, j
44 
45  real(kind=kreal) :: total_disp(6, fstrsolid%max_ncon), du(6, fstrsolid%max_ncon), ddu(6, fstrsolid%max_ncon)
46  real(kind=kreal) :: shell_director(3, fstrsolid%max_ncon)
47  real(kind=kreal) :: shell_ref_director(3, fstrsolid%max_ncon)
48  real(kind=kreal) :: tt(fstrsolid%max_ncon), tt0(fstrsolid%max_ncon), ttn(fstrsolid%max_ncon)
49  real(kind=kreal) :: qf(fstrsolid%max_ncon*6), coords(3, 3)
50  integer :: isect, ihead, cdsys_ID
51  integer :: ndim, initt
52 
53  real(kind=kreal), optional :: strainenergy
54  real(kind=kreal) :: tmp, lambda(1), ddlambda(1)
55  real(kind=kreal) :: ddaux(3,3)
56 
57  ndof = hecmat%NDOF
58  fstrsolid%QFORCE=0.0d0
59  call fstr_ensure_finite_rotation_state( hecmesh, fstrsolid, ndof )
60 
61  tt0 = 0.d0
62  ttn = 0.d0
63  tt = 0.d0
64 
65  ! if initial temperature exists
66  initt = 0
67  if( associated(g_initialcnd) ) then
68  do j=1,size(g_initialcnd)
69  if( g_initialcnd(j)%cond_name=="temperature" ) then
70  initt=j
71  exit
72  endif
73  end do
74  endif
75 
76  ! --------------------------------------------------------------------
77  ! updated
78  ! 1. stress and strain : ep^(k) = ep^(k-1)+dep^(k)
79  ! sgm^(k) = sgm^(k-1)+dsgm^(k)
80  ! 2. Internal Force : Q^(k-1) ( u^(k-1) )
81  ! --------------------------------------------------------------------
82  ! ----------------------------------------------------------------------------------
83  ! calculate the Strain and Stress and Internal Force ( Equivalent Nodal Force )
84  ! ----------------------------------------------------------------------------------
85 
86  do itype = 1, hecmesh%n_elem_type
87  is = hecmesh%elem_type_index(itype-1)+1
88  ie = hecmesh%elem_type_index(itype )
89  ic_type= hecmesh%elem_type_item(itype)
90  if (hecmw_is_etype_link(ic_type)) cycle
91  if (hecmw_is_etype_patch(ic_type)) cycle
92 
93  !element loop
94  !$omp parallel default(none), &
95  !$omp& private(icel,iiS,j,nn,nodLOCAL,i,ecoord,ddu,du,total_disp,shell_director,shell_ref_director, &
96  !$omp& cdsys_ID,coords,thick,qf,isect,ihead,tmp,ndim,ddaux,thick0, &
97  !$omp& lambda,ddlambda), &
98  !$omp& shared(iS,iE,hecMESH,fstrSOLID,ndof,hecMAT,ic_type,fstrPR, &
99  !$omp& strainEnergy,iter,time,tincr,initt,g_InitialCnd), &
100  !$omp& firstprivate(tt0,ttn,tt)
101  !$omp do
102  do icel = is, ie
103 
104  ! ----- nodal coordinate, displacement and temperature
105  iis = hecmesh%elem_node_index(icel-1)
106  nn = hecmesh%elem_node_index(icel)-iis
107  !if( nn>150 ) stop "elemental nodes > 150!"
108 
109  thick = 0.d0
110  do j = 1, size(fstrsolid%elements(icel)%gausses)
111  thick0(1:6) = fstrsolid%elements(icel)%gausses(j)%stress(1:6)
112  thick = thick + dsqrt(dot_product(thick0(1:6),thick0(1:6)))
113  enddo
114  if( thick < 1.d-10 ) then
115  do j = 1, size(fstrsolid%elements(icel)%gausses)
116  if( associated(fstrsolid%elements(icel)%gausses(j)%fstatus) ) &
117  & fstrsolid%elements(icel)%gausses(j)%fstatus = 0.d0
118  enddo
119  end if
120 
121  do j = 1, nn
122  nodlocal(j) = hecmesh%elem_node_item (iis+j)
123  do i = 1, 3
124  ecoord(i,j) = hecmesh%node(3*nodlocal(j)+i-3)
125  enddo
126  do i = 1, ndof
127  ddu(i,j) = hecmat%X(ndof*nodlocal(j)+i-ndof)
128  du(i,j) = fstrsolid%dunode(ndof*nodlocal(j)+i-ndof)
129  total_disp(i,j) = fstrsolid%unode(ndof*nodlocal(j)+i-ndof)
130  enddo
131 
132  if( fstrsolid%TEMP_ngrp_tot > 0 .or. fstrsolid%TEMP_irres > 0 ) then
133  if( iselastoplastic(fstrsolid%elements(icel)%gausses(1)%pMaterial%mtype) .or. &
134  fstrsolid%elements(icel)%gausses(1)%pMaterial%mtype == norton ) then
135  tt0(j)=fstrsolid%last_temp( nodlocal(j) )
136  else
137  tt0(j) = 0.d0
138  if( hecmesh%hecmw_flag_initcon == 1 ) tt0(j) = hecmesh%node_init_val_item(nodlocal(j))
139  if( initt>0 ) tt0(j) = g_initialcnd(initt)%realval(nodlocal(j))
140  endif
141  ttn(j) = fstrsolid%last_temp( nodlocal(j) )
142  tt(j) = fstrsolid%temperature( nodlocal(j) )
143  endif
144  enddo
145 
146  isect = hecmesh%section_ID(icel)
147  ihead = hecmesh%section%sect_R_index(isect-1)
148  thick = hecmesh%section%sect_R_item(ihead+1)
149  cdsys_id = hecmesh%section%sect_orien_ID(isect)
150  if( cdsys_id > 0 ) call get_coordsys(cdsys_id, hecmesh, fstrsolid, coords)
151 
152  ! ===== calculate the Internal Force
153  if( ic_type == 241 .or. ic_type == 242 .or. ic_type == 231 .or. ic_type == 232 .or. ic_type == 2322 ) then
154  call update_c2( ic_type,nn,ecoord(1:3,1:nn),fstrsolid%elements(icel)%gausses(:), &
155  thick,fstrsolid%elements(icel)%iset, &
156  total_disp(1:2,1:nn), ddu(1:2,1:nn), qf(1:nn*ndof), &
157  tt(1:nn), tt0(1:nn), ttn(1:nn) )
158 
159  else if( ic_type == 301 ) then
160  call update_c1( ic_type,nn,ecoord(:,1:nn), thick, total_disp(1:3,1:nn), du(1:3,1:nn), &
161  qf(1:nn*ndof),fstrsolid%elements(icel)%gausses(:) )
162 
163  else if( ic_type == 361 ) then
164  if( fstrsolid%sections(isect)%elemopt361 == kel361fi ) then ! full integration element
165  call update_c3( ic_type, nn, ecoord(:,1:nn), total_disp(1:3,1:nn), du(1:3,1:nn), cdsys_id, coords, &
166  qf(1:nn*ndof), fstrsolid%elements(icel)%gausses(:), iter, time, tincr, tt(1:nn), tt0(1:nn), ttn(1:nn) )
167  else if( fstrsolid%sections(isect)%elemopt361 == kel361bbar ) then ! B-bar element
168  call update_c3d8bbar( ic_type, nn, ecoord(:,1:nn), total_disp(1:3,1:nn), du(1:3,1:nn), cdsys_id, coords, &
169  qf(1:nn*ndof), fstrsolid%elements(icel)%gausses(:), iter, time, tincr, tt(1:nn), tt0(1:nn), ttn(1:nn) )
170  else if( fstrsolid%sections(isect)%elemopt361 == kel361ic ) then ! incompatible element
171  call update_c3d8ic( ic_type,nn,ecoord(:,1:nn), total_disp(1:3,1:nn), du(1:3,1:nn), ddu(1:3,1:nn), cdsys_id, coords,&
172  qf(1:nn*ndof), fstrsolid%elements(icel)%gausses(:), iter, time, tincr, &
173  fstrsolid%elements(icel)%aux, ddaux(1:3,1:3), tt(1:nn), tt0(1:nn), ttn(1:nn) )
174  fstrsolid%elements(icel)%aux(1:3,1:3) = fstrsolid%elements(icel)%aux(1:3,1:3) + ddaux(1:3,1:3)
175  else if( fstrsolid%sections(isect)%elemopt361 == kel361fbar ) then ! F-bar element
176  call update_c3d8fbar( ic_type, nn, ecoord(:,1:nn), total_disp(1:3,1:nn), du(1:3,1:nn), cdsys_id, coords, &
177  qf(1:nn*ndof), fstrsolid%elements(icel)%gausses(:), iter, time, tincr, tt(1:nn), tt0(1:nn), ttn(1:nn) )
178  else if( fstrsolid%sections(isect)%elemopt361 == kel361up ) then ! UP element
179  lambda(1) = -0.5d0*fstrsolid%elements(icel)%p(1)
180  CALL update_c3_up &
181  ( ic_type, nn, ecoord(:,1:nn), total_disp(1:3,1:nn), du(1:3,1:nn), ddu(1:3,1:nn), &
182  cdsys_id, coords, qf(1:nn*ndof), fstrsolid%elements(icel)%gausses(:), &
183  iter, time, tincr, 1, lambda, ddlambda, tt(1:nn), tt0(1:nn) )
184  lambda(1) = lambda(1) + ddlambda(1)
185  fstrsolid%elements(icel)%p(1) = -2.0d0*lambda(1)
186  endif
187  else if (ic_type == 341 .or. ic_type == 351 .or. ic_type == 342 .or. ic_type == 352 .or. ic_type == 362 ) then
188  if( ic_type==341 .and. fstrsolid%sections(isect)%elemopt341 == kel341sesns ) cycle ! skip smoothed fem
189  call update_c3( ic_type, nn, ecoord(:,1:nn), total_disp(1:3,1:nn), du(1:3,1:nn), cdsys_id, coords, &
190  qf(1:nn*ndof), fstrsolid%elements(icel)%gausses(:), iter, time, tincr, tt(1:nn), tt0(1:nn), ttn(1:nn) )
191 
192  else if( ic_type == 511) then
193  call update_connector( ic_type,nn,ecoord(:,1:nn), total_disp(1:3,1:nn), du(1:3,1:nn), &
194  qf(1:nn*ndof),fstrsolid%elements(icel)%gausses(:) )
195 
196  else if( ic_type == 611) then
197  if( fstrpr%nlgeom ) call update_abort( ic_type, 2 )
198  CALL updatest_beam(ic_type, nn, ecoord, total_disp(1:6,1:nn), du(1:6,1:nn), &
199  & hecmesh%section%sect_R_item(ihead+1:), fstrsolid%elements(icel)%gausses(:), qf(1:nn*ndof))
200 
201  else if( ic_type == 641 ) then
202  if( fstrpr%nlgeom ) call update_abort( ic_type, 2 )
203  call updatest_beam_641(ic_type, nn, ecoord, total_disp(1:ndof,1:nn), du(1:ndof,1:nn), &
204  & fstrsolid%elements(icel)%gausses(:), hecmesh%section%sect_R_item(ihead+1:), qf(1:nn*ndof))
205 
206  else if( ( ic_type == 741 ) .or. ( ic_type == 743 ) .or. ( ic_type == 731 ) ) then
207  if( fstr_uses_finite_rotation_kinematics( ic_type, nn, &
208  fstrsolid%elements(icel)%gausses(1)%pMaterial ) ) then
209  call fstr_get_shell_trial_directors( fstrsolid, thick, nn, nodlocal(1:nn), shell_director(1:3,1:nn) )
210  call fstr_get_shell_reference_directors( fstrsolid, thick, nn, nodlocal(1:nn), &
211  shell_ref_director(1:3,1:nn) )
212  call updatest_shell_mitc(ic_type, nn, ndof, ecoord(1:3, 1:nn), total_disp(1:ndof,1:nn), du(1:ndof,1:nn), &
213  & fstrsolid%elements(icel)%gausses(:), qf(1:nn*ndof), thick, 0, &
214  & element=fstrsolid%elements(icel), nddirector=shell_director(1:3,1:nn), &
215  & ndrefdirector=shell_ref_director(1:3,1:nn))
216  else
217  if( fstrpr%nlgeom ) call update_abort( ic_type, 2 )
218  call updatest_shell_mitc(ic_type, nn, ndof, ecoord(1:3, 1:nn), total_disp(1:ndof,1:nn), &
219  & du(1:ndof,1:nn), fstrsolid%elements(icel)%gausses(:), qf(1:nn*ndof), thick, 0)
220  endif
221 
222  else if( ic_type == 761 ) then !for shell-solid mixed analysis
223  if( fstrpr%nlgeom ) call update_abort( ic_type, 2 )
224  call updatest_shell_mitc33(731, 3, 6, ecoord(1:3, 1:3), total_disp(1:ndof,1:nn), du(1:ndof,1:nn), &
225  & fstrsolid%elements(icel)%gausses(:), qf(1:nn*ndof), thick, 2)
226 
227  else if( ic_type == 781 ) then !for shell-solid mixed analysis
228  if( fstrpr%nlgeom ) call update_abort( ic_type, 2 )
229  call updatest_shell_mitc33(741, 4, 6, ecoord(1:3, 1:4), total_disp(1:ndof,1:nn), du(1:ndof,1:nn), &
230  & fstrsolid%elements(icel)%gausses(:), qf(1:nn*ndof), thick, 1)
231 
232  else if ( ic_type == 3414 ) then
233  if(fstrsolid%elements(icel)%gausses(1)%pMaterial%mtype /= incomp_newtonian) &
234  & call update_abort( ic_type, 3, fstrsolid%elements(icel)%gausses(1)%pMaterial%mtype )
235  call update_c3_vp &
236  ( ic_type, nn, ecoord(:,1:nn), total_disp(1:4,1:nn), du(1:4,1:nn), &
237  fstrsolid%elements(icel)%gausses(:) )
238  qf = 0.0d0
239 
240  else if ( ic_type == 881 .or. ic_type == 891 ) then !for selective es/ns smoothed fem
241  call update_c3_sesns( ic_type, nn, nodlocal, ecoord(:,1:nn), total_disp(1:3,1:nn), du(1:3,1:nn), cdsys_id, coords, &
242  qf(1:nn*ndof), fstrsolid%elements(icel)%gausses(:), time, tincr, tt(1:nn), tt0(1:nn), ttn(1:nn) )
243 
244  else
245  write(*, *) '###ERROR### : Element type not supported for nonlinear static analysis'
246  write(*, *) ' ic_type = ', ic_type
247  call hecmw_abort(hecmw_comm_get_comm())
248 
249  endif
250 
251  ! elemact element
252  if( fstrsolid%elements(icel)%elemact_flag == kelact_inactive ) then
253  call update_dummy( ndof, nn, ecoord(:,1:nn), total_disp(1:3,1:nn), &
254  & du(1:3,1:nn), qf(1:nn*ndof), fstrsolid%elements(icel) )
255  !qf(:) = fstrSOLID%elements(icel)%elemact_coeff*qf(:)
256  end if
257 
258  ! ----- calculate the global internal force ( Q(u_{n+1}^{k-1}) )
259  do j = 1, nn
260  do i = 1, ndof
261  !$omp atomic
262  fstrsolid%QFORCE(ndof*(nodlocal(j)-1)+i) = fstrsolid%QFORCE(ndof*(nodlocal(j)-1)+i)+qf(ndof*(j-1)+i)
263  enddo
264  enddo
265 
266  ! ----- calculate strain energy
267  if(present(strainenergy))then
268  ndim = getspacedimension( fstrsolid%elements(icel)%etype )
269  do j = 1, nn
270  do i = 1, ndim
271  tmp = 0.5d0*( fstrsolid%elements(icel)%equiForces(ndim*(j-1)+i)+qf(ndim*(j-1)+i) )*ddu(i,j)
272  !$omp atomic
273  strainenergy = strainenergy+tmp
274  fstrsolid%elements(icel)%equiForces(ndim*(j-1)+i) = qf(ndim*(j-1)+i)
275  enddo
276  enddo
277  endif
278 
279  enddo ! icel
280  !$omp end do
281  !$omp end parallel
282  enddo ! itype
283 
284  !C
285  !C Update for fstrSOLID%QFORCE
286  !C
287  call hecmw_update_r(hecmesh,fstrsolid%QFORCE,hecmesh%n_node, ndof)
288  end subroutine fstr_updatenewton
289 
290 
292  subroutine fstr_updatestate( hecMESH, fstrSOLID, tincr)
293  use m_fstr
294  use m_static_lib
295  use m_elastoplastic
296  use mcreep
297  use mviscoelastic
298  type(hecmwst_local_mesh) :: hecmesh
299  type(fstr_solid) :: fstrSOLID
300  real(kind=kreal) :: tincr
301  integer(kind=kint) :: itype, is, iE, ic_type, icel, ngauss, i
302  integer(kind=kint) :: ishell
303 
304  if( associated( fstrsolid%temperature ) ) then
305  do i = 1, hecmesh%n_node
306  fstrsolid%last_temp(i) = fstrsolid%temperature(i)
307  end do
308  endif
309 
310  do itype = 1, hecmesh%n_elem_type
311  is = hecmesh%elem_type_index(itype-1) + 1
312  ie = hecmesh%elem_type_index(itype )
313  ic_type= hecmesh%elem_type_item(itype)
314  if( ic_type == 301 ) ic_type = 111
315  if( hecmw_is_etype_link(ic_type) ) cycle
316  if( hecmw_is_etype_patch(ic_type) ) cycle
317 
318  ngauss = numofquadpoints( ic_type )
319  do icel = is, ie
320  if( iselastoplastic( fstrsolid%elements(icel)%gausses(1)%pMaterial%mtype ) ) then
321  do i = 1, ngauss
322  call updateepstate( fstrsolid%elements(icel)%gausses(i) )
323  enddo
324  elseif( fstrsolid%elements(icel)%gausses(1)%pMaterial%mtype == norton ) then
325  if( tincr>0.d0 ) then
326  do i = 1, ngauss
327  call updateviscostate( fstrsolid%elements(icel)%gausses(i) )
328  enddo
329  endif
330  elseif( isviscoelastic( fstrsolid%elements(icel)%gausses(1)%pMaterial%mtype ) ) then
331  if( tincr > 0.d0 ) then
332  do i = 1, ngauss
333  call updateviscoelasticstate( fstrsolid%elements(icel)%gausses(i) )
334  enddo
335  endif
336  endif
337 
338  do i = 1, ngauss
339  fstrsolid%elements(icel)%gausses(i)%strain_bak = fstrsolid%elements(icel)%gausses(i)%strain
340  fstrsolid%elements(icel)%gausses(i)%stress_bak = fstrsolid%elements(icel)%gausses(i)%stress
341  fstrsolid%elements(icel)%gausses(i)%strain_energy_bak = fstrsolid%elements(icel)%gausses(i)%strain_energy
342  enddo
343 
344  if( associated( fstrsolid%elements(icel)%shell_layer_gausses ) ) then
345  do ishell = 1, size( fstrsolid%elements(icel)%shell_layer_gausses )
346  fstrsolid%elements(icel)%shell_layer_gausses(ishell)%strain_bak = &
347  fstrsolid%elements(icel)%shell_layer_gausses(ishell)%strain
348  fstrsolid%elements(icel)%shell_layer_gausses(ishell)%stress_bak = &
349  fstrsolid%elements(icel)%shell_layer_gausses(ishell)%stress
350  fstrsolid%elements(icel)%shell_layer_gausses(ishell)%strain_energy_bak = &
351  fstrsolid%elements(icel)%shell_layer_gausses(ishell)%strain_energy
352  enddo
353  endif
354  enddo
355  enddo
356 
357  do i = 1, hecmesh%n_node
358  fstrsolid%QFORCE_bak(i) = fstrsolid%QFORCE(i)
359  end do
360 
361  end subroutine fstr_updatestate
362 
363  subroutine update_abort( ic_type, flag, mtype )
364  integer(kind=kint), intent(in) :: ic_type
365  integer(kind=kint), intent(in) :: flag
366  integer(kind=kint), intent(in), optional :: mtype
367 
368  if( flag == 1 ) then
369  write(*,*) '###ERROR### : Element type not supported for static analysis'
370  else if( flag == 2 ) then
371  write(*,*) '###ERROR### : Element type not supported for nonlinear static analysis'
372  else if( flag == 3 ) then
373  write(*,*) '###ERROR### : This element is not supported for this material'
374  endif
375  write(*,*) ' ic_type = ', ic_type
376  if( present(mtype) ) write(*,*) ' mtype = ', mtype
377  call hecmw_abort(hecmw_comm_get_comm())
378  end subroutine
379 
380 end module m_fstr_update
This module provide functions for elastoplastic calculation.
subroutine, public updateepstate(gauss)
Clear elatoplastic state.
This module defined elemact data and function.
subroutine update_dummy(ndof, nn, ecoord, u, du, qf, element)
integer, parameter kelact_inactive
Shared predicates for finite-rotation nodal kinematics.
logical function, public fstr_uses_finite_rotation_kinematics(etype, nn, material)
Finite-rotation nodal kinematics for NLGEOM.
subroutine, public fstr_get_shell_trial_directors(fstrSOLID, thick, nn, nodLOCAL, directors)
Half-thickness director from the current Newton trial frame (dtriad).
subroutine, public fstr_ensure_finite_rotation_state(hecMESH, fstrSOLID, ndof)
Build the per-node reference frames once, by averaging element shell triads at shared nodes....
subroutine, public fstr_get_shell_reference_directors(fstrSOLID, thick, nn, nodLOCAL, directors)
Half-thickness director from the fixed reference frame (ref_triad).
This module provides function to calculate to do updates.
Definition: fstr_Update.f90:6
subroutine fstr_updatestate(hecMESH, fstrSOLID, tincr)
Update elastiplastic status.
subroutine fstr_updatenewton(hecMESH, hecMAT, fstrSOLID, time, tincr, iter, strainEnergy)
Update displacement, stress, strain and internal forces.
Definition: fstr_Update.f90:26
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
integer(kind=kint), parameter kel361bbar
Definition: m_fstr.F90:80
subroutine get_coordsys(cdsys_ID, hecMESH, fstrSOLID, coords)
This subroutine fetch coords defined by local coordinate system.
Definition: m_fstr.F90:1109
integer(kind=kint), parameter kel341sesns
Definition: m_fstr.F90:77
integer(kind=kint), parameter kel361up
Definition: m_fstr.F90:83
integer(kind=kint), parameter kel361fi
Definition: m_fstr.F90:79
integer(kind=kint), parameter kel361ic
Definition: m_fstr.F90:81
type(fstr_param), target fstrpr
GLOBAL VARIABLE INITIALIZED IN FSTR_SETUP.
Definition: m_fstr.F90:213
integer(kind=kint), parameter kel361fbar
Definition: m_fstr.F90:82
type(tinitialcondition), dimension(:), pointer, save g_initialcnd
Definition: m_fstr.F90:154
This modules just summarizes all modules used in static analysis.
Definition: static_LIB.f90:6
This module provides functions for creep calculation.
Definition: creep.f90:6
subroutine updateviscostate(gauss)
Update viscoplastic state.
Definition: creep.f90:214
This module provides functions for viscoelastic calculation.
Definition: Viscoelastic.f90:6
subroutine updateviscoelasticstate(gauss)
Update viscoplastic state.