FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
fstr_dynamic_setup.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 !-------------------------------------------------------------------------------
8  use m_fstr
9  use hecmw_setup_util, only &
11  use fstr_setup_util, only &
12  : fstr_param_pack &
15  implicit none
16 
17 contains
18 
20  subroutine fstr_dynamic_init( fstrDYNAMIC )
21  use m_fstr
22  type(fstr_dynamic) :: fstrDYNAMIC
23  fstrdynamic%idx_eqa = 1
24  fstrdynamic%idx_resp = 1
25  fstrdynamic%n_step = 1
26  fstrdynamic%t_start = 0.0
27  fstrdynamic%t_curr = 0.0d0
28  fstrdynamic%t_end = 1.0
29  fstrdynamic%t_delta = 1.0
30  fstrdynamic%gamma = 0.5
31  fstrdynamic%beta = 0.25
32  fstrdynamic%alpha = 0.0
33  fstrdynamic%idx_mas = kmasslumped
34  fstrdynamic%idx_dmp = 1
35  fstrdynamic%ray_m = 0.0
36  fstrdynamic%ray_k = 0.0
37  fstrdynamic%restart_nout = 0
38  fstrdynamic%nout = 100
39  fstrdynamic%ngrp_monit = 0
40  fstrdynamic%nout_monit = 1
41  fstrdynamic%iout_list(1) = 0
42  fstrdynamic%iout_list(2) = 0
43  fstrdynamic%iout_list(3) = 0
44  fstrdynamic%iout_list(4) = 0
45  fstrdynamic%iout_list(5) = 0
46  fstrdynamic%iout_list(6) = 0
47 
48  end subroutine fstr_dynamic_init
49 
51  subroutine fstr_dynamic_alloc( hecMESH, fstrDYNAMIC )
52  use m_fstr
53  type(hecmwst_local_mesh),target :: hecMESH
54  type(fstr_dynamic) :: fstrDYNAMIC
55 
56  integer :: ierror, ndof,nnod
57 
58  ndof=hecmesh%n_dof
59  nnod=hecmesh%n_node
60  if(fstrdynamic%idx_eqa == 11) then
61  allocate( fstrdynamic%DISP(ndof*nnod,3) ,stat=ierror )
62  if( ierror /= 0 ) then
63  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, DISP>'
64  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
65  call flush(idbg)
66  call hecmw_abort( hecmw_comm_get_comm())
67  end if
68  allocate( fstrdynamic%VEL (ndof*nnod,1) ,stat=ierror )
69  if( ierror /= 0 ) then
70  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEL>'
71  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
72  call flush(idbg)
73  call hecmw_abort( hecmw_comm_get_comm())
74  end if
75  allocate( fstrdynamic%ACC (ndof*nnod,1) ,stat=ierror )
76  if( ierror /= 0 ) then
77  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, ACC>'
78  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
79  call flush(idbg)
80  call hecmw_abort( hecmw_comm_get_comm())
81  end if
82  else
83  allocate( fstrdynamic%DISP(ndof*nnod,2) ,stat=ierror )
84  if( ierror /= 0 ) then
85  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, DISP>'
86  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
87  call flush(idbg)
88  call hecmw_abort( hecmw_comm_get_comm())
89  end if
90  allocate( fstrdynamic%VEL (ndof*nnod,2) ,stat=ierror )
91  if( ierror /= 0 ) then
92  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEL>'
93  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
94  call flush(idbg)
95  call hecmw_abort( hecmw_comm_get_comm())
96  end if
97  allocate( fstrdynamic%ACC (ndof*nnod,2) ,stat=ierror )
98  if( ierror /= 0 ) then
99  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, ACC>'
100  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
101  call flush(idbg)
102  call hecmw_abort( hecmw_comm_get_comm())
103  end if
104  endif
105 
106 
107  allocate( fstrdynamic%VEC1(ndof*nnod) ,stat=ierror )
108  if( ierror /= 0 ) then
109  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEC1>'
110  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
111  call flush(idbg)
112  call hecmw_abort( hecmw_comm_get_comm())
113  end if
114  allocate( fstrdynamic%VEC2(ndof*nnod) ,stat=ierror )
115  if( ierror /= 0 ) then
116  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEC2>'
117  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
118  call flush(idbg)
119  call hecmw_abort( hecmw_comm_get_comm())
120  end if
121  allocate( fstrdynamic%VEC3(ndof*nnod) ,stat=ierror )
122  if( ierror /= 0 ) then
123  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEC3>'
124  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
125  call flush(idbg)
126  call hecmw_abort( hecmw_comm_get_comm())
127  end if
128  if( fstrdynamic%idx_eqa == 2 ) then
129  allocate( fstrdynamic%HHT_FORCE(ndof*nnod) ,stat=ierror )
130  if( ierror /= 0 ) then
131  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, HHT_FORCE>'
132  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
133  call flush(idbg)
134  call hecmw_abort( hecmw_comm_get_comm())
135  end if
136  fstrdynamic%HHT_FORCE(:) = 0.0d0
137  endif
138 
139  end subroutine fstr_dynamic_alloc
140 
142  subroutine fstr_dynamic_finalize( fstrDYNAMIC )
143  type(fstr_dynamic) :: fstrDYNAMIC
144 
145  integer :: ierror
146  if( associated(fstrdynamic%DISP) ) &
147  deallocate( fstrdynamic%DISP ,stat=ierror )
148  if( ierror /= 0 ) then
149  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, DISP>'
150  call flush(idbg)
151  call hecmw_abort( hecmw_comm_get_comm())
152  end if
153  if( associated(fstrdynamic%VEL) ) &
154  deallocate( fstrdynamic%VEL ,stat=ierror )
155  if( ierror /= 0 ) then
156  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, VEL>'
157  call flush(idbg)
158  call hecmw_abort( hecmw_comm_get_comm())
159  end if
160  if( associated(fstrdynamic%ACC) ) &
161  deallocate( fstrdynamic%ACC ,stat=ierror )
162  if( ierror /= 0 ) then
163  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, ACC>'
164  call flush(idbg)
165  call hecmw_abort( hecmw_comm_get_comm())
166  end if
167  if( associated(fstrdynamic%HHT_FORCE) ) then
168  deallocate( fstrdynamic%HHT_FORCE ,stat=ierror )
169  if( ierror /= 0 ) then
170  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, HHT_FORCE>'
171  call flush(idbg)
172  call hecmw_abort( hecmw_comm_get_comm())
173  end if
174  endif
175  if( associated(fstrdynamic%VEC1) ) &
176  deallocate( fstrdynamic%VEC1 ,stat=ierror )
177  if( ierror /= 0 ) then
178  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, VEC1>'
179  call flush(idbg)
180  call hecmw_abort( hecmw_comm_get_comm())
181  end if
182  if( associated(fstrdynamic%VEC2) ) &
183  deallocate( fstrdynamic%VEC2 ,stat=ierror )
184  if( ierror /= 0 ) then
185  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, VEC2>'
186  call flush(idbg)
187  call hecmw_abort( hecmw_comm_get_comm())
188  end if
189  if( associated(fstrdynamic%VEC3) ) &
190  deallocate( fstrdynamic%VEC3 ,stat=ierror )
191  if( ierror /= 0 ) then
192  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, VEC3>'
193  call flush(idbg)
194  call hecmw_abort( hecmw_comm_get_comm())
195  end if
196 
197  end subroutine
198 
199  !-----------------------------------------------------------------------------!
201  !-----------------------------------------------------------------------------!
202 
203  subroutine fstr_setup_dynamic( ctrl, P )
204  implicit none
205  integer(kind=kint) :: ctrl
206  type(fstr_param_pack) :: P
207  integer(kind=kint) :: rcode
208  character(HECMW_NAME_LEN) :: grp_id_name(1)
209  integer(kind=kint) :: grp_id(1)
210  logical :: is_alpha_given
211 
212  rcode = fstr_ctrl_get_dynamic( ctrl, &
213  p%PARAM%nlgeom, &
214  p%DYN%idx_eqa, &
215  p%DYN%idx_resp,&
216  p%DYN%n_step, &
217  p%DYN%t_start, &
218  p%DYN%t_end, &
219  p%DYN%t_delta, &
220  p%DYN%gamma, &
221  p%DYN%beta, &
222  p%DYN%alpha, &
223  p%DYN%idx_mas, &
224  p%DYN%idx_dmp, &
225  p%DYN%ray_m, &
226  p%DYN%ray_k, &
227  p%DYN%nout, &
228  grp_id_name(1), hecmw_name_len, &
229  p%DYN%nout_monit, &
230  p%DYN%iout_list )
231 
232  if( rcode /= 0) call fstr_ctrl_err_stop
233 
234  if( p%DYN%idx_eqa /= 1 .and. p%DYN%idx_eqa /= 2 .and. p%DYN%idx_eqa /= 11 ) then
235  write(*,*) '### Error: !DYNAMIC time integration type must be 1 (Newmark-beta), 2 (HHT) or 11 (explicit)'
236  write(ilog,*) '### Error: !DYNAMIC time integration type must be 1 (Newmark-beta), 2 (HHT) or 11 (explicit)'
237  call flush(6)
238  call flush(ilog)
239  call fstr_ctrl_err_stop
240  endif
241  if( p%DYN%idx_eqa == 2 .and. p%DYN%idx_resp /= 1 ) then
242  write(*,*) '### Error: HHT method is available only for time history analysis'
243  write(ilog,*) '### Error: HHT method is available only for time history analysis'
244  call flush(6)
245  call flush(ilog)
246  call fstr_ctrl_err_stop
247  endif
248 
249  is_alpha_given = ( p%DYN%alpha < huge(0.0d0) )
250  if( p%DYN%idx_eqa == 2 ) then
251  if( .not. is_alpha_given ) then
252  write(*,*) '### Warning: !DYNAMIC HHT parameter alpha is not given; Newmark-beta method is used'
253  write(ilog,*) '### Warning: !DYNAMIC HHT parameter alpha is not given; Newmark-beta method is used'
254  p%DYN%idx_eqa = 1
255  p%DYN%alpha = 0.0d0
256  else
257  if( p%DYN%alpha < -1.0d0/3.0d0 .or. p%DYN%alpha > 0.0d0 ) then
258  write(*,*) '### Warning: !DYNAMIC HHT parameter alpha must be in [-1/3, 0]; alpha = 0 is used'
259  write(ilog,*) '### Warning: !DYNAMIC HHT parameter alpha must be in [-1/3, 0]; alpha = 0 is used'
260  p%DYN%alpha = 0.0d0
261  endif
262  ! gamma and beta given with alpha are not used
263  p%DYN%beta = 0.25d0*(1.0d0-p%DYN%alpha)**2
264  p%DYN%gamma = 0.5d0-p%DYN%alpha
265  if( myrank == 0 ) write(imsg,'(a,3(1x,1pe12.5))') &
266  'INFO: HHT method with alpha, beta, gamma =', p%DYN%alpha, p%DYN%beta, p%DYN%gamma
267  endif
268  else
269  if( is_alpha_given ) then
270  write(*,*) '### Warning: !DYNAMIC HHT parameter alpha is ignored except for the HHT method (2)'
271  write(ilog,*) '### Warning: !DYNAMIC HHT parameter alpha is ignored except for the HHT method (2)'
272  endif
273  p%DYN%alpha = 0.0d0
274  endif
275 
276  if( p%DYN%idx_mas /= kmasslumped .and. p%DYN%idx_mas /= kmassconsistent ) then
277  write(*,*) '### Error: !DYNAMIC mass matrix type must be 1 (lumped) or 2 (consistent)'
278  write(ilog,*) '### Error: !DYNAMIC mass matrix type must be 1 (lumped) or 2 (consistent)'
279  call flush(6)
280  call flush(ilog)
281  call fstr_ctrl_err_stop
282  endif
283  if( p%DYN%idx_mas == kmassconsistent .and. &
284  (p%DYN%idx_eqa == 11 .or. p%DYN%idx_resp /= 1) ) then
285  write(*,*) '### Error: consistent mass matrix is available only for implicit transient analysis'
286  write(ilog,*) '### Error: consistent mass matrix is available only for implicit transient analysis'
287  call flush(6)
288  call flush(ilog)
289  call fstr_ctrl_err_stop
290  endif
291 
292  if (p%DYN%idx_resp == 1) then
293  call node_grp_name_to_id_ex( p%MESH, '!DYNAMIC', 1, grp_id_name, grp_id)
294  p%DYN%ngrp_monit = grp_id(1)
295  else
296  read(grp_id_name,*) p%DYN%ngrp_monit
297  endif
298 
299  end subroutine fstr_setup_dynamic
300 
301 end module m_fstr_dynamic_setup
This module contains control file data obtaining functions for dynamic analysis.
integer(kind=kint) function fstr_ctrl_get_dynamic(ctrl, nlgeom, idx_eqa, idx_resp, n_step, t_start, t_end, t_delta, gamma, beta, alpha, idx_mas, idx_dmp, ray_m, ray_k, nout, node_id, node_id_len, nout_monit, iout_list)
Read in !DYNAMIC.
This module contains auxiliary functions in calculation setup.
subroutine fstr_ctrl_err_stop
This module contains auxiliary functions in calculation setup.
subroutine node_grp_name_to_id_ex(hecMESH, header_name, n, grp_id_name, grp_ID)
This module provides subroutines to initialize, allocate and finalize fstr_dynamic,...
subroutine fstr_dynamic_finalize(fstrDYNAMIC)
Finalizer of fstr_dynamic.
subroutine fstr_setup_dynamic(ctrl, P)
Read in !DYNAMIC !
subroutine fstr_dynamic_init(fstrDYNAMIC)
Initial setting of dynamic calculation.
subroutine fstr_dynamic_alloc(hecMESH, fstrDYNAMIC)
Initial setting of dynamic calculation.
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
integer(kind=kint), parameter idbg
Definition: m_fstr.F90:122
integer(kind=kint), parameter kmassconsistent
Definition: m_fstr.F90:74
integer(kind=kint), parameter ilog
FILE HANDLER.
Definition: m_fstr.F90:118
integer(kind=kint), parameter kmasslumped
mass matrix type
Definition: m_fstr.F90:73
Package of all data needs to initialize.
Data for DYNAMIC ANSLYSIS (fstrDYNAMIC)
Definition: m_fstr.F90:525