FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
fstr_solve_dynamic.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 
9  use m_fstr
12  use fstr_frequency_analysis !Frequency analysis module
13  use m_fstr_timeinc
14 
15 contains
16 
17  !C================================================================C
19  !C================================================================C
20  subroutine fstr_solve_dynamic(hecMESH,hecMAT,fstrSOLID,fstrEIG &
21  ,fstrDYNAMIC,fstrRESULT,fstrPARAM &
22  ,fstrCPL,fstrFREQ, hecLagMAT &
23  ,conMAT )
24  use m_fstr_setup
25  implicit none
26  type(hecmwst_local_mesh) :: hecMESH
27  type(hecmwst_matrix) :: hecMAT
28  type(fstr_eigen) :: fstrEIG
29  type(fstr_solid) :: fstrSOLID
30  type(hecmwst_result_data) :: fstrRESULT
31  type(fstr_param) :: fstrPARAM
32  type(fstr_dynamic) :: fstrDYNAMIC
33  type(fstr_couple) :: fstrCPL !for COUPLE
34  type(fstr_freqanalysis) :: fstrFREQ
35  type(hecmwst_matrix_lagrange) :: hecLagMAT
36  type(fstr_info_contactchange) :: infoCTChange
37  type(hecmwst_matrix) :: conMAT
38  integer(kind=kint) :: i, j, num_monit, ig, is, iE, ik, in, ing, iunitS, iunit, ierror, flag, limit
39  character(len=HECMW_FILENAME_LEN) :: fname, header
40  integer(kind=kint) :: restart_step_num, restart_substep_num, restart_step_count, ndof
41 
42  num_monit = 0
43 
44  if(dabs(fstrdynamic%t_delta) < 1.0e-20) then
45  if( hecmesh%my_rank == 0 ) then
46  write(imsg,*) 'stop due to fstrDYNAMIC%t_delta = 0'
47  end if
48  call hecmw_abort( hecmw_comm_get_comm())
49  end if
50  call fstr_dynamic_alloc( hecmesh, fstrdynamic )
51 
52  !C-- file open for local use
53  !C
54  if(fstrdynamic%idx_resp == 1) then ! time history analysis
55  call hecmw_ctrl_is_subdir( flag, limit )
56  if( flag == 0)then
57  header = ""
58  else
59  header = adjustl("MONITOR/")
60  call hecmw_ctrl_make_subdir( adjustl("MONITOR/test.txt"), limit )
61  endif
62  ig = fstrdynamic%ngrp_monit
63  is = hecmesh%node_group%grp_index(ig-1)+1
64  ie = hecmesh%node_group%grp_index(ig)
65  do ik=is,ie
66  in = hecmesh%node_group%grp_item(ik)
67  if (in > hecmesh%nn_internal) cycle
68  num_monit = num_monit+1
69  ing = hecmesh%global_node_id(in)
70  iunits = 10*(num_monit-1)
71 
72  iunit = iunits + fstrdynamic%dynamic_IW4
73  write(fname,'(a,i0,a)') trim(header)//'dyna_disp_',ing,'.txt'
74  if(fstrdynamic%restart_nout < 0 ) then
75  open(iunit,file=fname, position = 'append', iostat=ierror)
76  else
77  open(iunit,file=fname, status = 'replace', iostat=ierror)
78  endif
79  if( ierror /= 0 ) then
80  write(*,*) 'stop due to file opening error:',trim(fname)
81  call hecmw_abort( hecmw_comm_get_comm())
82  end if
83 
84  iunit = iunits + fstrdynamic%dynamic_IW5
85  write(fname,'(a,i0,a)') trim(header)//'dyna_velo_',ing,'.txt'
86  if(fstrdynamic%restart_nout < 0 ) then
87  open(iunit,file=fname, position = 'append', iostat=ierror)
88  else
89  open(iunit,file=fname, status = 'replace', iostat=ierror)
90  endif
91  if( ierror /= 0 ) then
92  write(*,*) 'stop due to file opening error',trim(fname)
93  call hecmw_abort( hecmw_comm_get_comm())
94  end if
95 
96  iunit = iunits + fstrdynamic%dynamic_IW6
97  write(fname,'(a,i0,a)') trim(header)//'dyna_acce_',ing,'.txt'
98  if(fstrdynamic%restart_nout < 0 ) then
99  open(iunit,file=fname, position = 'append', iostat=ierror)
100  else
101  open(iunit,file=fname, status = 'replace', iostat=ierror)
102  endif
103  if( ierror /= 0 ) then
104  write(*,*) 'stop due to file opening error',trim(fname)
105  call hecmw_abort( hecmw_comm_get_comm())
106  end if
107 
108  iunit = iunits + fstrdynamic%dynamic_IW7
109  write(fname,'(a,i0,a)') trim(header)//'dyna_force_',ing,'.txt'
110  if(fstrdynamic%restart_nout < 0 ) then
111  open(iunit,file=fname, position = 'append', iostat=ierror)
112  else
113  open(iunit,file=fname, status = 'replace', iostat=ierror)
114  endif
115  if( ierror /= 0 ) then
116  write(*,*) 'stop due to file opening error',trim(fname)
117  call hecmw_abort( hecmw_comm_get_comm())
118  end if
119  iunit = iunits + fstrdynamic%dynamic_IW8
120  write(fname,'(a,i0,a)') trim(header)//'dyna_strain_',ing,'.txt'
121  if(fstrdynamic%restart_nout < 0 ) then
122  open(iunit,file=fname, position = 'append', iostat=ierror)
123  else
124  open(iunit,file=fname, status = 'replace', iostat=ierror)
125  endif
126  if( ierror /= 0 ) then
127  write(*,*) 'stop due to file opening error',trim(fname)
128  call hecmw_abort( hecmw_comm_get_comm())
129  end if
130 
131  iunit = iunits + fstrdynamic%dynamic_IW9
132  write(fname,'(a,i0,a)') trim(header)//'dyna_stress_',ing,'.txt'
133  if(fstrdynamic%restart_nout < 0 ) then
134  open(iunit,file=fname, position = 'append', iostat=ierror)
135  else
136  open(iunit,file=fname, status = 'replace', iostat=ierror)
137  endif
138  if( ierror /= 0 ) then
139  write(*,*) 'stop due to file opening error',trim(fname)
140  call hecmw_abort( hecmw_comm_get_comm())
141  end if
142  enddo
143  endif
144 
145  !C
146  !C-- initial condition
147  !C
148  fstrdynamic%DISP = 0.d0
149  fstrdynamic%VEL = 0.d0
150  fstrdynamic%ACC = 0.d0
151  fstrsolid%unode(:) =0.d0
152  fstrsolid%QFORCE(:) =0.d0
153  fstrdynamic%kineticEnergy=0.d0
154  fstrdynamic%strainEnergy=0.d0
155  fstrdynamic%totalEnergy=0.d0
156  call fstr_updatestate( hecmesh, fstrsolid, 0.d0 )
157 
158  ! ---- restart
159 
160  restart_step_num = 1
161  restart_substep_num = 1
162  restart_step_count = 0
163  infoctchange%contactNode_previous = 0
164 
165  if(associated(g_initialcnd))then
166  ndof = hecmat%NDOF
167  do j = 1, size(g_initialcnd)
168  if(g_initialcnd(j)%cond_name == "velocity")then
169  do i= 1, hecmesh%n_node
170  ing = g_initialcnd(j)%intval(i)
171  if(ing <= 0) cycle
172  fstrdynamic%VEL(ndof*i-(ndof-ing),1) = g_initialcnd(j)%realval(i)
173  end do
174  elseif(g_initialcnd(j)%cond_name == "acceleration")then
175  do i = 1, hecmesh%n_node
176  ing = g_initialcnd(j)%intval(i)
177  if(ing <= 0) cycle
178  fstrdynamic%ACC(ndof*i-(ndof-ing),1) = g_initialcnd(j)%realval(i)
179  enddo
180  endif
181  enddo
182  endif
183 
184  if(fstrdynamic%restart_nout >= 0 ) then
185  call dynamic_bc_init (hecmesh, hecmat, fstrsolid, fstrdynamic, fstrdynamic%t_curr)
186  call dynamic_bc_init_vl(hecmesh, hecmat, fstrsolid, fstrdynamic, fstrdynamic%t_curr)
187  call dynamic_bc_init_ac(hecmesh, hecmat, fstrsolid, fstrdynamic, fstrdynamic%t_curr)
188  endif
189 
190  !restart
191  if(fstrdynamic%restart_nout < 0 ) then
192  if( fstrdynamic%idx_eqa == 1 ) then
193  call fstr_read_restart_dyna_nl(restart_step_num,restart_substep_num,hecmesh,fstrsolid,fstrdynamic,fstrparam,&
194  infoctchange%contactNode_previous,restart_step_count)
195  elseif(fstrdynamic%idx_eqa == 11) then
196  call fstr_read_restart_dyna_nl(restart_step_num,restart_substep_num,hecmesh,fstrsolid,fstrdynamic,fstrparam,&
197  infoctchange%contactNode_previous,restart_step_count)
198  endif
199  fstrdynamic%restart_nout = - fstrdynamic%restart_nout
200  hecmat%Iarray(98) = 1
201  call fstr_set_time(fstrdynamic%t_curr)
202  call fstr_set_timeinc_base(fstrdynamic%t_delta)
203  end if
204 
205  if(fstrdynamic%idx_resp == 1) then ! time history analysis
206 
207  if(fstrdynamic%idx_eqa == 1) then ! implicit dynamic analysis
208  call fstr_solve_nlgeom_dynamic_implicit_contactslag(hecmesh,hecmat,fstrsolid,fstreig &
209  ,fstrdynamic,fstrresult,fstrparam &
210  ,fstrcpl,heclagmat,restart_step_num,restart_substep_num,infoctchange &
211  ,conmat,restart_step_count )
212 
213  else if(fstrdynamic%idx_eqa == 11) then ! explicit dynamic analysis
214  call fstr_solve_dynamic_nlexplicit(hecmesh,hecmat,fstrsolid,fstreig &
215  ,fstrdynamic,fstrresult,fstrparam,infoctchange &
216  ,fstrcpl, restart_substep_num, restart_step_count )
217  endif
218 
219  else if(fstrdynamic%idx_resp == 2) then ! frequency response analysis
220 
221  if( fstrparam%nlgeom ) then
222  if( hecmesh%my_rank .eq. 0 ) then
223  write(imsg,*) 'stop: steady-state harmonic response analysis is not yet available !'
224  end if
225  call hecmw_abort( hecmw_comm_get_comm())
226  end if
227 
228  if( hecmesh%my_rank .eq. 0 ) then
229  call fstr_solve_frequency_analysis(hecmesh, hecmat, fstrsolid, fstreig, fstrdynamic, &
230  fstrresult, fstrparam, fstrcpl, fstrfreq, heclagmat, &
231  restart_substep_num)
232  end if
233  end if
234 
235  !C-- file close for local use
236  if(fstrdynamic%idx_resp == 1) then ! time history analysis
237  do i=1,num_monit
238  iunits = 10*(i-1)
239  close(iunits + fstrdynamic%dynamic_IW4)
240  close(iunits + fstrdynamic%dynamic_IW5)
241  close(iunits + fstrdynamic%dynamic_IW6)
242  close(iunits + fstrdynamic%dynamic_IW7)
243  close(iunits + fstrdynamic%dynamic_IW8)
244  close(iunits + fstrdynamic%dynamic_IW9)
245  enddo
246  endif
247  !C-- end of finalization
248 
249  call fstr_dynamic_finalize( fstrdynamic )
250  call hecmat_finalize( hecmat )
251 
252  deallocate( fstreig%mass )
253 
254  end subroutine fstr_solve_dynamic
255 
256 end module fstr_solver_dynamic
void hecmw_ctrl_is_subdir(int *flag, int *limit)
void hecmw_ctrl_make_subdir(char *filename, int *err, int len)
This module contains subroutines for nonlinear explicit dynamic analysis.
subroutine fstr_solve_dynamic_nlexplicit(hecMESH, hecMAT, fstrSOLID, fstrEIG, fstrDYN, fstrRESULT, fstrPARAM, infoCTChange, fstrCPL, restrt_step_num, restrt_step_count)
This module contains subroutines for nonlinear implicit dynamic analysis.
subroutine fstr_solve_nlgeom_dynamic_implicit_contactslag(hecMESH, hecMAT, fstrSOLID, fstrEIG, fstrDYNAMIC, fstrRESULT, fstrPARAM, fstrCPL, hecLagMAT, restart_step_num, restart_substep_num, infoCTChange, conMAT, restart_step_count)
This subroutine provides function of nonlinear implicit dynamic analysis using the Newmark method....
subroutine fstr_solve_frequency_analysis(hecMESH, hecMAT, fstrSOLID, fstrEIG, fstrDYNAMIC, fstrRESULT, fstrPARAM, fstrCPL, fstrFREQ, hecLagMAT, restart_step_num)
This module contains subroutines controlling dynamic calculation.
subroutine fstr_solve_dynamic(hecMESH, hecMAT, fstrSOLID, fstrEIG, fstrDYNAMIC, fstrRESULT, fstrPARAM, fstrCPL, fstrFREQ, hecLagMAT, conMAT)
Master subroutine for dynamic analysis.
This module provides functions to read in data from control file and do necessary preparation for fol...
Definition: fstr_setup.f90:7
subroutine fstr_dynamic_alloc(hecMESH, fstrDYNAMIC)
Initial setting of dynamic calculation.
subroutine fstr_dynamic_finalize(fstrDYNAMIC)
Finalizer of fstr_solid.
This module provides functions to deal with time and increment of stress analysis.
subroutine fstr_set_timeinc_base(dtime_base)
subroutine fstr_set_time(time)
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
subroutine hecmat_finalize(hecMAT)
Definition: m_fstr.F90:942
integer(kind=kint), parameter imsg
Definition: m_fstr.F90:112
type(tinitialcondition), dimension(:), pointer, save g_initialcnd
Definition: m_fstr.F90:153
Data for coupling analysis.
Definition: m_fstr.F90:623
Data for DYNAMIC ANSLYSIS (fstrDYNAMIC)
Definition: m_fstr.F90:517
Package of data used by Lanczos eigenvalue solver.
Definition: m_fstr.F90:605
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.F90:156