FrontISTR  6.0.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, factor
45  real(kind=kreal) :: time_1, time_2
46  logical :: 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, fstrparam%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  infoctchange%active = .true.
111  call fstr_cutback_save( fstrsolid, infoctchange, infoctchange_bak )
112 
113  do tot_step=1, fstrsolid%nstep_tot
114  tot_step_print = tot_step+restart_step_num-1
115  if(hecmesh%my_rank==0) write(*,*) ''
116  if(hecmesh%my_rank==0) write(*,'(a,i5)') ' loading step=',tot_step_print
117 
118  if( fstrsolid%TEMP_ngrp_tot>0 ) then
119  do j=1, hecmesh%n_node
120  fstrsolid%temp_bak(j) = fstrsolid%temperature(j)
121  end do
122  endif
123  call fstr_updatestate( hecmesh, fstrsolid, 0.0d0 )
124 
125  call fstr_begin_nodal_kinematics_step( hecmesh, fstrsolid, hecmat%NDOF )
126  fstrsolid%unode_bak(:) = fstrsolid%unode(:)
127 
128  ! -------------------------------------------------------------------------
129  ! STEP LOOP
130  ! -------------------------------------------------------------------------
131  sub_step = restart_substep_num
132  do while(.true.)
133 
134  ! ----- time history of factor
135  call fstr_timeinc_settimeincrement( fstrsolid%step_ctrl(tot_step), fstrparam, sub_step, &
136  & fstrsolid%NRstat_i, fstrsolid%NRstat_r, fstrsolid%AutoINC_stat, fstrsolid%CutBack_stat )
137  if( fstrsolid%TEMP_irres > 0 ) then
138  fstrsolid%FACTOR(1) = 0.d0
139  fstrsolid%FACTOR(2) = 1.d0
140  call table_nlsta(hecmesh,fstrsolid,tot_step,fstr_get_time()+fstr_get_timeinc(), factor)
141  fstrsolid%TEMP_FACTOR = factor
142  else
143  call table_nlsta(hecmesh,fstrsolid,tot_step,fstr_get_time(),factor)
144  fstrsolid%FACTOR(1) = factor
145  call table_nlsta(hecmesh,fstrsolid,tot_step,fstr_get_time()+fstr_get_timeinc(), factor)
146  fstrsolid%FACTOR(2) = factor
147  endif
148 
149  if(hecmesh%my_rank==0) then
150  write(*,'(A,I0,2(A,E12.4))') ' sub_step= ',sub_step,', &
151  & current_time=',fstr_get_time(), ', time_inc=',fstr_get_timeinc()
152  write(*,'(A,2f12.7)') ' loading_factor= ', fstrsolid%FACTOR
153  if( fstrsolid%TEMP_irres > 0 ) write(*,'(A,2f12.7)') ' readtemp_factor= ', fstrsolid%TEMP_FACTOR
154  endif
155 
156  time_1 = hecmw_wtime()
157 
158  ! analysis algorithm ( Newton-Rapshon Method )
159  if( .not. is_interaction_active ) then
160  if( fstrparam%nlsolver_method == knsmnewton ) then
161  call fstr_newton( tot_step, hecmesh, hecmat, fstrsolid, fstrparam, &
162  restart_step_num, sub_step, fstr_get_time(), fstr_get_timeinc() )
163  else if( fstrparam%nlsolver_method == knsmquasinewton ) then
164  call fstr_quasi_newton( tot_step, hecmesh, hecmat, fstrsolid, fstrparam, &
165  restart_step_num, sub_step, fstr_get_time(), fstr_get_timeinc() )
166  endif
167  else
168  if( fstrparam%contact_algo == kcaslagrange ) then
169  call fstr_newton_contactslag( tot_step, hecmesh, hecmat, fstrsolid, fstrparam, heclagmat, &
170  restart_step_num, restart_substep_num, sub_step, fstr_get_time(), fstr_get_timeinc(), infoctchange, conmat )
171  else if( fstrparam%contact_algo == kcaalagrange ) then
172  call fstr_newton_contactalag( tot_step, hecmesh, hecmat, fstrsolid, fstrparam, &
173  restart_step_num, restart_substep_num, sub_step, fstr_get_time(), fstr_get_timeinc(), infoctchange, conmat )
174  endif
175  endif
176 
177  ! Time Increment
178  if( hecmesh%my_rank == 0 ) call fstr_timeinc_printstatus( fstrsolid%step_ctrl(tot_step), fstrparam, &
179  & tot_step_print, sub_step, fstrsolid%NRstat_i, fstrsolid%NRstat_r, &
180  & fstrsolid%AutoINC_stat, fstrsolid%CutBack_stat )
181  if( fstr_cutback_active() ) then
182 
183  if( fstrsolid%CutBack_stat == 0 ) then ! converged
184  call fstr_cutback_save( fstrsolid, infoctchange, infoctchange_bak ) ! save analysis state
185  call fstr_proceed_time() ! current time += time increment
186 
187  else ! not converged
188  cbbound = fstrparam%ainc(fstrsolid%step_ctrl(tot_step)%AincParam_id)%CBbound
189  if( fstrsolid%CutBack_stat == cbbound ) then
190  if( hecmesh%my_rank == 0 ) then
191  write(*,*) 'Number of successive cutback reached max number: ',cbbound
192  call fstr_timeinc_printstatus_final(.false.)
193  endif
194  call fstr_abort( hecmw_exit_noconv )
195  endif
196  call fstr_cutback_load( fstrsolid, infoctchange, infoctchange_bak ) ! load analysis state
197 
198  ! restore matrix structure for slagrange contact analysis
199  if( is_interaction_active ) then
200  call fstr_set_contact_active( infoctchange%active ) ! restore last scan-set active
201  call fstr_mat_con_contact( tot_step, fstrparam%contact_algo, hecmat, fstrsolid, heclagmat, &
202  & infoctchange, conmat, fstr_is_contact_active())
203  conmat%B(:) = 0.0d0
204  call solve_lineq_contact_init(hecmesh, hecmat, heclagmat, fstr_is_matrixstruct_symmetric(fstrsolid, hecmesh))
205  endif
206  if( hecmesh%my_rank == 0 ) write(*,*) '### State has been restored at time =',fstr_get_time()
207 
208  !stop if # of substeps reached upper bound.
209  if( sub_step == fstrsolid%step_ctrl(tot_step)%num_substep ) then
210  if( hecmesh%my_rank == 0 ) then
211  write(*,'(a,i5,a,f6.3)') '### Number of substeps reached max number: at total_step=', &
212  & tot_step_print, ' time=', fstr_get_time()
213  endif
214  call fstr_abort( hecmw_exit_noconv )
215  endif
216 
217  ! output time
218  time_2 = hecmw_wtime()
219  if( hecmesh%my_rank==0) write(imsg,'(a,",",2(I8,","),f10.2)') &
220  & 'step, substep, solve (sec) :', tot_step_print, sub_step, time_2 - time_1
221  cycle
222  endif
223  else
224  if( fstrsolid%CutBack_stat > 0 ) then
225  if( hecmesh%my_rank == 0 ) call fstr_timeinc_printstatus_final(.false.)
226  stop hecmw_exit_noconv
227  endif
228  call fstr_proceed_time() ! current time += time increment
229  endif
230 
231  step_count = step_count + 1
232 
233  ! ----- Restart
234  if( fstrsolid%restart_nout > 0) then
235  if( mod(step_count,fstrsolid%restart_nout) == 0 ) then
236  call fstr_write_restart(tot_step,tot_step_print,sub_step,step_count,fstr_get_time(), &
237  & fstr_get_timeinc_base(), hecmesh,fstrsolid,fstrparam,.false.,infoctchange%contactNode_current)
238  endif
239  endif
240 
241  ! ----- Result output (include visualize output)
242  is_outpoint = fstr_timeinc_istimepoint( fstrsolid%step_ctrl(tot_step), fstrparam ) &
243  & .or. fstr_timeinc_isstepfinished( fstrsolid%step_ctrl(tot_step) )
244  call fstr_static_output( tot_step, step_count, fstr_get_time(), hecmesh, fstrsolid, fstrparam, &
245  & fstrparam%solution_type, is_outpoint, fstr_get_timeinc() )
246 
247  time_2 = hecmw_wtime()
248  if( hecmesh%my_rank==0 ) then
249  write(imsg,'(A,",",2(I8,","),f10.2)') 'step, substep, solve (sec) :', tot_step_print, sub_step, time_2 - time_1
250  write(imsg,'(A,I0,",",1pE15.8)') '### stepcount (for output), time :', step_count, fstr_get_time()
251  endif
252 
253  !if time reached the end time of step, exit loop.
254  if( fstr_timeinc_isstepfinished( fstrsolid%step_ctrl(tot_step) ) ) exit
255 
256  if( sub_step == fstrsolid%step_ctrl(tot_step)%num_substep ) then
257  if( hecmesh%my_rank == 0 ) then
258  write(*,'(a,i5,a,f6.3)') '### Number of substeps reached max number: at total_step=', &
259  & tot_step_print, ' time=', fstr_get_time()
260  endif
261  if( hecmesh%my_rank == 0 ) call fstr_timeinc_printstatus_final(.false.)
262  stop hecmw_exit_noconv !stop if # of substeps reached upper bound.
263  endif
264 
265  sub_step = sub_step + 1
266  enddo !--- end of substep loop
267 
268  ! ----- Restart at the end of step
269  if( fstrsolid%restart_nout > 0 ) then
270  call fstr_write_restart(tot_step,tot_step_print,sub_step,step_count,fstr_get_time(),fstr_get_timeinc_base(), &
271  & hecmesh,fstrsolid,fstrparam,.true.,infoctchange%contactNode_current)
272  endif
273  restart_substep_num = 1
274  if( fstrsolid%TEMP_irres > 0 ) exit
275  enddo !--- end of tot_step loop
276 
277  call fstr_cutback_finalize( fstrsolid )
278 
279  ! message
280  if(myrank == 0)then
281  call fstr_timeinc_printstatus_final(.true.)
282  write(imsg,'("### FSTR_SOLVE_NLGEOM FINISHED!")')
283  write(*,'("### FSTR_SOLVE_NLGEOM FINISHED!")')
284  endif
285 
286  end subroutine fstr_solve_nlgeom
287 
288  !C================================================================C
291  !C================================================================C
292  subroutine table_nlsta(hecMESH, fstrSOLID, cstep, time, f_t)
293  type ( hecmwST_local_mesh ), intent(in) :: hecMESH
294  type ( fstr_solid ), intent(in) :: fstrSOLID
295  integer(kind=kint), intent(in) :: cstep
296  real(kind=kreal), intent(in) :: time
297  real(kind=kreal), intent(out) :: f_t
298 
299  integer(kind=kint) :: jj_n_amp
300 
301  jj_n_amp = fstrsolid%step_ctrl( cstep )%amp_id
302 
303  if( jj_n_amp <= 0 ) then ! Amplitude not defined
304  f_t = (time-fstrsolid%step_ctrl(cstep)%starttime)/fstrsolid%step_ctrl(cstep)%elapsetime
305  if( f_t>1.d0 ) f_t=1.d0
306  else
307  f_t = 1.0d0
308  call fstr_get_amplitude(hecmesh, fstrsolid, cstep, jj_n_amp, time, f_t)
309  endif
310 
311  end subroutine table_nlsta
312 
313 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:107
integer(kind=kint), parameter imsg
Definition: m_fstr.F90:121
subroutine fstr_get_amplitude(hecMESH, fstrSOLID, cstep, jj_n_amp, time, value)
Evaluate the amplitude-scaled target value a(t) for static analysis.
Definition: m_fstr.F90:1404
subroutine fstr_abort(code)
Terminate the analysis with a classified exit status. MPI_ABORT does not perform the Fortran I/O fina...
Definition: m_fstr.F90:711
integer(kind=kint), parameter kcaslagrange
contact analysis algorithm
Definition: m_fstr.F90:62
integer(kind=kint), parameter knsmnewton
nonlinear solver method (nsm)
Definition: m_fstr.F90:58
integer(kind=kint), parameter knsmquasinewton
Definition: m_fstr.F90:59
integer(kind=kint), parameter kcaalagrange
Definition: m_fstr.F90:63
type(tinitialcondition), dimension(:), pointer, save g_initialcnd
Definition: m_fstr.F90:162
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()
Whether contact stiffness and residual have to be assembled. Broader than is_contact_active(state): a...