FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
fstr_solve_NLGEOM.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  use m_static_lib
10  use m_static_output
14  use m_fstr_restart
16  use m_fstr_timeinc
17  use m_fstr_cutback
18  use mcontact
20 
21  implicit none
22 
23 contains
24 
25  !======================================================================!
31  subroutine fstr_solve_nlgeom(hecMESH,hecMAT,fstrSOLID,hecLagMAT,fstrPARAM,conMAT)
32  type (hecmwST_local_mesh) :: hecMESH
33  type (hecmwST_matrix ) :: hecMAT
34  type (fstr_param ) :: fstrPARAM
35  type (fstr_solid ) :: fstrSOLID
36  type (hecmwST_matrix_lagrange) :: hecLagMAT
37  type (fstr_info_contactChange) :: infoCTChange, infoCTChange_bak
38  type (hecmwST_matrix ) :: conMAT
39 
40  integer(kind=kint) :: ndof, nn
41  integer(kind=kint) :: j, i, tot_step, step_count, tot_step_print, CBbound
42  integer(kind=kint) :: sub_step
43  integer(kind=kint) :: restart_step_num, restart_substep_num
44  real(kind=kreal) :: ctime, dtime, endtime, factor
45  real(kind=kreal) :: time_1, time_2
46  logical :: ctchanged, is_OutPoint, is_interaction_active
47 
48  if(hecmesh%my_rank==0) call fstr_timeinc_printstatus_init
49 
50  hecmat%NDOF = hecmesh%n_dof
51 
52  ndof = hecmat%NDOF
53  nn = ndof*ndof
54 
55  is_interaction_active = ( associated( fstrsolid%contacts ) .or. associated( fstrsolid%embeds ) )
56 
57  if( fstrsolid%TEMP_ngrp_tot>0 .and. hecmesh%hecmw_flag_initcon==1 ) then
58  fstrsolid%last_temp = 0.0d0
59  fstrsolid%temperature = 0.0d0
60  do j=1, size(hecmesh%node_init_val_item)
61  i = hecmesh%node_init_val_index(j)
62  fstrsolid%last_temp(j) = hecmesh%node_init_val_item(i)
63  fstrsolid%temperature(j) = hecmesh%node_init_val_item(i)
64  end do
65  endif
66  if( fstrsolid%TEMP_ngrp_tot>0 .and. associated(g_initialcnd) ) then
67  fstrsolid%last_temp = 0.0d0
68  fstrsolid%temperature = 0.0d0
69  do j=1,size(g_initialcnd)
70  if( g_initialcnd(j)%cond_name=="temperature" ) then
71  if( .not. associated(fstrsolid%temperature) ) then
72  allocate( fstrsolid%temperature( hecmesh%n_node ) )
73  allocate( fstrsolid%temp_bak( hecmesh%n_node ) )
74  allocate( fstrsolid%last_temp( hecmesh%n_node ) )
75  endif
76  do i= 1, hecmesh%n_node
77  fstrsolid%last_temp(i) = g_initialcnd(j)%realval(i)
78  fstrsolid%temperature(i) = fstrsolid%last_temp(i)
79  enddo
80  endif
81  end do
82  endif
83 
84  if( associated( fstrsolid%contacts ) ) then
85  call initialize_contact_output_vectors(fstrsolid,hecmat)
86  call setup_contact_elesurf_for_area( 1, hecmesh, fstrsolid )
87  endif
88  if( fstrsolid%n_embeds > 0 ) call initialize_embed_vectors(fstrsolid,hecmat)
89 
90  restart_step_num = 1
91  restart_substep_num = 1
92  fstrsolid%unode = 0.0d0
93  step_count = 0 !**
94  infoctchange%contactNode_previous = 0
95  infoctchange%contactNode_current = 0
96  if( fstrsolid%restart_nout < 0 ) then
97  call fstr_read_restart(restart_step_num,restart_substep_num,step_count,ctime,dtime,hecmesh,fstrsolid, &
98  fstrparam,infoctchange%contactNode_previous)
99  hecmat%Iarray(98) = 1
100  call fstr_set_time( ctime )
101  call fstr_set_timeinc_base( dtime )
102  fstrsolid%restart_nout = - fstrsolid%restart_nout
103  else
104  call fstr_static_output( 1, 0, 0.d0, hecmesh, fstrsolid, fstrparam, fstrpr%solution_type, .true., 0.d0 )
105  endif
106 
107  fstrsolid%FACTOR = 0.0d0
108  call fstr_begin_nodal_kinematics_step( hecmesh, fstrsolid, hecmat%NDOF )
109  call fstr_cutback_init( hecmesh, fstrsolid, fstrparam )
110  call fstr_cutback_save( fstrsolid, infoctchange, infoctchange_bak )
111 
112  do tot_step=1, fstrsolid%nstep_tot
113  tot_step_print = tot_step+restart_step_num-1
114  if(hecmesh%my_rank==0) write(*,*) ''
115  if(hecmesh%my_rank==0) write(*,'(a,i5)') ' loading step=',tot_step_print
116 
117  if( fstrsolid%TEMP_ngrp_tot>0 ) then
118  do j=1, hecmesh%n_node
119  fstrsolid%temp_bak(j) = fstrsolid%temperature(j)
120  end do
121  endif
122  call fstr_updatestate( hecmesh, fstrsolid, 0.0d0 )
123 
124  call fstr_begin_nodal_kinematics_step( hecmesh, fstrsolid, hecmat%NDOF )
125  fstrsolid%unode_bak(:) = fstrsolid%unode(:)
126 
127  ! -------------------------------------------------------------------------
128  ! STEP LOOP
129  ! -------------------------------------------------------------------------
130  sub_step = restart_substep_num
131  do while(.true.)
132 
133  ! ----- time history of factor
134  call fstr_timeinc_settimeincrement( fstrsolid%step_ctrl(tot_step), fstrparam, sub_step, &
135  & fstrsolid%NRstat_i, fstrsolid%NRstat_r, fstrsolid%AutoINC_stat, fstrsolid%CutBack_stat )
136  if( fstrsolid%TEMP_irres > 0 ) then
137  fstrsolid%FACTOR(1) = 0.d0
138  fstrsolid%FACTOR(2) = 1.d0
139  call table_nlsta(hecmesh,fstrsolid,tot_step,fstr_get_time()+fstr_get_timeinc(), factor)
140  fstrsolid%TEMP_FACTOR = factor
141  else
142  call table_nlsta(hecmesh,fstrsolid,tot_step,fstr_get_time(),factor)
143  fstrsolid%FACTOR(1) = factor
144  call table_nlsta(hecmesh,fstrsolid,tot_step,fstr_get_time()+fstr_get_timeinc(), factor)
145  fstrsolid%FACTOR(2) = factor
146  endif
147 
148  if(hecmesh%my_rank==0) then
149  write(*,'(A,I0,2(A,E12.4))') ' sub_step= ',sub_step,', &
150  & current_time=',fstr_get_time(), ', time_inc=',fstr_get_timeinc()
151  write(*,'(A,2f12.7)') ' loading_factor= ', fstrsolid%FACTOR
152  if( fstrsolid%TEMP_irres > 0 ) write(*,'(A,2f12.7)') ' readtemp_factor= ', fstrsolid%TEMP_FACTOR
153  endif
154 
155  time_1 = hecmw_wtime()
156 
157  ! analysis algorithm ( Newton-Rapshon Method )
158  if( .not. is_interaction_active ) then
159  if( fstrparam%nlsolver_method == knsmnewton ) then
160  call fstr_newton( tot_step, hecmesh, hecmat, fstrsolid, fstrparam, &
161  restart_step_num, sub_step, fstr_get_time(), fstr_get_timeinc() )
162  else if( fstrparam%nlsolver_method == knsmquasinewton ) then
163  call fstr_quasi_newton( tot_step, hecmesh, hecmat, fstrsolid, fstrparam, &
164  restart_step_num, sub_step, fstr_get_time(), fstr_get_timeinc() )
165  endif
166  else
167  if( fstrparam%contact_algo == kcaslagrange ) then
168  call fstr_newton_contactslag( tot_step, hecmesh, hecmat, fstrsolid, fstrparam, heclagmat, &
169  restart_step_num, restart_substep_num, sub_step, fstr_get_time(), fstr_get_timeinc(), infoctchange, conmat )
170  else if( fstrparam%contact_algo == kcaalagrange ) then
171  call fstr_newton_contactalag( tot_step, hecmesh, hecmat, fstrsolid, fstrparam, &
172  restart_step_num, restart_substep_num, sub_step, fstr_get_time(), fstr_get_timeinc(), infoctchange, conmat )
173  endif
174  endif
175 
176  ! Time Increment
177  if( hecmesh%my_rank == 0 ) call fstr_timeinc_printstatus( fstrsolid%step_ctrl(tot_step), fstrparam, &
178  & tot_step_print, sub_step, fstrsolid%NRstat_i, fstrsolid%NRstat_r, &
179  & fstrsolid%AutoINC_stat, fstrsolid%CutBack_stat )
180  if( fstr_cutback_active() ) then
181 
182  if( fstrsolid%CutBack_stat == 0 ) then ! converged
183  call fstr_cutback_save( fstrsolid, infoctchange, infoctchange_bak ) ! save analysis state
184  call fstr_proceed_time() ! current time += time increment
185 
186  else ! not converged
187  cbbound = fstrparam%ainc(fstrsolid%step_ctrl(tot_step)%AincParam_id)%CBbound
188  if( fstrsolid%CutBack_stat == cbbound ) then
189  if( hecmesh%my_rank == 0 ) then
190  write(*,*) 'Number of successive cutback reached max number: ',cbbound
191  call fstr_timeinc_printstatus_final(.false.)
192  endif
193  call hecmw_abort( hecmw_comm_get_comm() )
194  endif
195  call fstr_cutback_load( fstrsolid, infoctchange, infoctchange_bak ) ! load analysis state
196  call fstr_set_contact_active( infoctchange%contactNode_current > 0 )
197 
198  ! restore matrix structure for slagrange contact analysis
199  if( is_interaction_active .and. fstrparam%contact_algo == kcaslagrange ) then
200  call fstr_mat_con_contact( tot_step, fstrparam%contact_algo, hecmat, fstrsolid, heclagmat, &
201  & infoctchange, conmat, fstr_is_contact_active())
202  conmat%B(:) = 0.0d0
203  call solve_lineq_contact_init(hecmesh, hecmat, heclagmat, fstr_is_matrixstruct_symmetric(fstrsolid, hecmesh))
204  endif
205  if( hecmesh%my_rank == 0 ) write(*,*) '### State has been restored at time =',fstr_get_time()
206 
207  !stop if # of substeps reached upper bound.
208  if( sub_step == fstrsolid%step_ctrl(tot_step)%num_substep ) then
209  if( hecmesh%my_rank == 0 ) then
210  write(*,'(a,i5,a,f6.3)') '### Number of substeps reached max number: at total_step=', &
211  & tot_step_print, ' time=', fstr_get_time()
212  endif
213  call hecmw_abort( hecmw_comm_get_comm())
214  endif
215 
216  ! output time
217  time_2 = hecmw_wtime()
218  if( hecmesh%my_rank==0) write(imsg,'(a,",",2(I8,","),f10.2)') &
219  & 'step, substep, solve (sec) :', tot_step_print, sub_step, time_2 - time_1
220  cycle
221  endif
222  else
223  if( fstrsolid%CutBack_stat > 0 ) stop
224  call fstr_proceed_time() ! current time += time increment
225  endif
226 
227  step_count = step_count + 1
228 
229  ! ----- Restart
230  if( fstrsolid%restart_nout > 0) then
231  if( mod(step_count,fstrsolid%restart_nout) == 0 ) then
232  call fstr_write_restart(tot_step,tot_step_print,sub_step,step_count,fstr_get_time(), &
233  & fstr_get_timeinc_base(), hecmesh,fstrsolid,fstrparam,.false.,infoctchange%contactNode_current)
234  endif
235  endif
236 
237  ! ----- Result output (include visualize output)
238  is_outpoint = fstr_timeinc_istimepoint( fstrsolid%step_ctrl(tot_step), fstrparam ) &
239  & .or. fstr_timeinc_isstepfinished( fstrsolid%step_ctrl(tot_step) )
240  call fstr_static_output( tot_step, step_count, fstr_get_time(), hecmesh, fstrsolid, fstrparam, &
241  & fstrpr%solution_type, is_outpoint, fstr_get_timeinc() )
242 
243  time_2 = hecmw_wtime()
244  if( hecmesh%my_rank==0 ) then
245  write(imsg,'(A,",",2(I8,","),f10.2)') 'step, substep, solve (sec) :', tot_step_print, sub_step, time_2 - time_1
246  write(imsg,'(A,I0,",",1pE15.8)') '### stepcount (for output), time :', step_count, fstr_get_time()
247  endif
248 
249  !if time reached the end time of step, exit loop.
250  if( fstr_timeinc_isstepfinished( fstrsolid%step_ctrl(tot_step) ) ) exit
251 
252  if( sub_step == fstrsolid%step_ctrl(tot_step)%num_substep ) then
253  if( hecmesh%my_rank == 0 ) then
254  write(*,'(a,i5,a,f6.3)') '### Number of substeps reached max number: at total_step=', &
255  & tot_step_print, ' time=', fstr_get_time()
256  endif
257  if( hecmesh%my_rank == 0 ) call fstr_timeinc_printstatus_final(.false.)
258  stop !stop if # of substeps reached upper bound.
259  endif
260 
261  sub_step = sub_step + 1
262  enddo !--- end of substep loop
263 
264  ! ----- Restart at the end of step
265  if( fstrsolid%restart_nout > 0 ) then
266  call fstr_write_restart(tot_step,tot_step_print,sub_step,step_count,fstr_get_time(),fstr_get_timeinc_base(), &
267  & hecmesh,fstrsolid,fstrparam,.true.,infoctchange%contactNode_current)
268  endif
269  restart_substep_num = 1
270  if( fstrsolid%TEMP_irres > 0 ) exit
271  enddo !--- end of tot_step loop
272 
273  call fstr_cutback_finalize( fstrsolid )
274 
275  ! message
276  if(myrank == 0)then
277  call fstr_timeinc_printstatus_final(.true.)
278  write(imsg,'("### FSTR_SOLVE_NLGEOM FINISHED!")')
279  write(*,'("### FSTR_SOLVE_NLGEOM FINISHED!")')
280  endif
281 
282  end subroutine fstr_solve_nlgeom
283 
284  !C================================================================C
287  !C================================================================C
288  subroutine table_nlsta(hecMESH, fstrSOLID, cstep, time, f_t)
289  type ( hecmwST_local_mesh ), intent(in) :: hecMESH
290  type ( fstr_solid ), intent(in) :: fstrSOLID
291  integer(kind=kint), intent(in) :: cstep
292  real(kind=kreal), intent(in) :: time
293  real(kind=kreal), intent(out) :: f_t
294 
295  integer(kind=kint) :: jj_n_amp
296 
297  jj_n_amp = fstrsolid%step_ctrl( cstep )%amp_id
298 
299  if( jj_n_amp <= 0 ) then ! Amplitude not defined
300  f_t = (time-fstrsolid%step_ctrl(cstep)%starttime)/fstrsolid%step_ctrl(cstep)%elapsetime
301  if( f_t>1.d0 ) f_t=1.d0
302  else
303  call table_amp(hecmesh, fstrsolid, cstep, jj_n_amp, time, f_t)
304  endif
305 
306  end subroutine table_nlsta
307 
308 end module m_fstr_solve_nlgeom
This module provides functions of reconstructing.
subroutine, public fstr_mat_con_contact(cstep, contact_algo, hecMAT, fstrSOLID, hecLagMAT, infoCTChange, conMAT, is_contact_active_flag)
this subroutine reconstructs node-based (stiffness) matrix structure \corresponding to contact state
logical function, public fstr_is_matrixstruct_symmetric(fstrSOLID, hecMESH)
this function judges whether sitiffness matrix is symmetric or not
This module provides functions to deal with cutback.
Definition: fstr_Cutback.f90:7
subroutine fstr_cutback_save(fstrSOLID, infoCTChange, infoCTChange_bak)
Save analysis status.
subroutine fstr_cutback_load(fstrSOLID, infoCTChange, infoCTChange_bak)
Load analysis status.
subroutine fstr_cutback_init(hecMESH, fstrSOLID, fstrPARAM)
Initializer of cutback variables.
subroutine fstr_cutback_finalize(fstrSOLID)
Finalizer of cutback variables.
logical function fstr_cutback_active()
Finite-rotation nodal kinematics for NLGEOM.
subroutine, public fstr_begin_nodal_kinematics_step(hecMESH, fstrSOLID, ndof)
Snapshot the converged rotation state at the start of a load step and reset the Newton trial state to...
This module provides functions on nonlinear analysis.
subroutine fstr_newton_contactslag(cstep, hecMESH, hecMAT, fstrSOLID, fstrPARAM, hecLagMAT, restart_step_num, restart_substep_num, sub_step, ctime, dtime, infoCTChange, conMAT)
This subroutine solve nonlinear solid mechanics problems by Newton-Raphson method....
subroutine fstr_newton_contactalag(cstep, hecMESH, hecMAT, fstrSOLID, fstrPARAM, restart_step_num, restart_substep_num, sub_step, ctime, dtime, infoCTChange, conMAT)
This subroutine solve nonlinear solid mechanics problems by Newton-Raphson method combined with Neste...
subroutine fstr_newton(cstep, hecMESH, hecMAT, fstrSOLID, fstrPARAM, restrt_step_num, sub_step, ctime, dtime)
This subroutine solve nonlinear solid mechanics problems by Newton-Raphson method.
This module provides functions on nonlinear analysis.
subroutine fstr_quasi_newton(cstep, hecMESH, hecMAT, fstrSOLID, fstrPARAM, restrt_step_num, sub_step, ctime, dtime)
This subroutine solve nonlinear solid mechanics problems by Newton-Raphson method.
This module provides functions to read in and write out restart files.
Definition: fstr_Restart.f90:8
subroutine fstr_read_restart(cstep, substep, step_count, ctime, dtime, hecMESH, fstrSOLID, fstrPARAM, contactNode)
Read in restart file.
subroutine fstr_write_restart(cstep, cstep_ext, substep, step_count, ctime, dtime, hecMESH, fstrSOLID, fstrPARAM, is_StepFinished, contactNode)
write out restart file
This module provides main suboruitne for nonliear calculation.
subroutine table_nlsta(hecMESH, fstrSOLID, cstep, time, f_t)
This subroutine decide the loading increment considering the amplitude definition.
subroutine fstr_solve_nlgeom(hecMESH, hecMAT, fstrSOLID, hecLagMAT, fstrPARAM, conMAT)
This module provides main subroutine for nonlinear calculation.
This module provides functions to deal with time and increment of stress analysis.
real(kind=kreal) function fstr_get_timeinc()
logical function fstr_timeinc_istimepoint(stepinfo, fstrPARAM)
real(kind=kreal) function fstr_get_timeinc_base()
subroutine fstr_set_timeinc_base(dtime_base)
subroutine fstr_timeinc_settimeincrement(stepinfo, fstrPARAM, substep, NRstatI, NRstatR, AutoINC_stat, Cutback_stat)
real(kind=kreal) function fstr_get_time()
subroutine fstr_proceed_time()
subroutine fstr_timeinc_printstatus_final(success_flag)
subroutine fstr_timeinc_printstatus_init
subroutine fstr_set_time(time)
logical function fstr_timeinc_isstepfinished(stepinfo)
subroutine fstr_timeinc_printstatus(stepinfo, fstrPARAM, totstep, substep, NRstatI, NRstatR, AutoINC_stat, Cutback_stat)
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
integer(kind=kint) myrank
PARALLEL EXECUTION.
Definition: m_fstr.F90:98
integer(kind=kint), parameter imsg
Definition: m_fstr.F90:112
integer(kind=kint), parameter kcaslagrange
contact analysis algorithm
Definition: m_fstr.F90:61
integer(kind=kint), parameter knsmnewton
nonlinear solver method (nsm)
Definition: m_fstr.F90:57
integer(kind=kint), parameter knsmquasinewton
Definition: m_fstr.F90:58
integer(kind=kint), parameter kcaalagrange
Definition: m_fstr.F90:62
subroutine table_amp(hecMESH, fstrSOLID, cstep, jj_n_amp, time, f_t)
Definition: m_fstr.F90:1191
type(fstr_param), target fstrpr
GLOBAL VARIABLE INITIALIZED IN FSTR_SETUP.
Definition: m_fstr.F90:212
type(tinitialcondition), dimension(:), pointer, save g_initialcnd
Definition: m_fstr.F90:153
This module provides functions to solve sparse system of \linear equitions in the case of contact ana...
subroutine, public solve_lineq_contact_init(hecMESH, hecMAT, hecLagMAT, is_sym)
This subroutine.
This modules just summarizes all modules used in static analysis.
Definition: static_LIB.f90:6
This module provides functions to output result.
subroutine fstr_static_output(cstep, istep, time, hecMESH, fstrSOLID, fstrPARAM, flag, outflag, dtime)
Output result.
Top-level contact analysis module (System level)
subroutine fstr_set_contact_active(a)
logical function fstr_is_contact_active()