FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
fistr_main.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 !-------------------------------------------------------------------------------
5 module m_fstr_main
6 
7  use hecmw
8  use m_fstr
10  use m_fstr_setup
14  use m_static_echo
15  use m_heat_init
16  use m_heat_echo
17  use m_fstr_precheck
18  use m_fstr_rcap_io
20 
21  type(hecmwst_local_mesh), save :: hecmesh
22  type(hecmwst_matrix), save :: hecmat
23  type(hecmwst_matrix), save :: conmat
24  type(fstr_solid), save :: fstrsolid
25  type(hecmwst_matrix_lagrange), save :: heclagmat
26  type(fstr_heat), save :: fstrheat
27  type(fstr_eigen), save :: fstreig
28  type(fstr_dynamic), save :: fstrdynamic
29  type(hecmwst_result_data), save :: fstrresult
30  type(fstr_couple), save :: fstrcpl
31  type(fstr_freqanalysis), save :: fstrfreq
32  character(len=HECMW_FILENAME_LEN) :: name_id
33 
34 contains
35 
36  subroutine fstr_main() bind(C,NAME='fstr_main')
37  implicit none
38  real(kind=kreal) :: t1, t2, t3
39 
40  t1=0.0d0; t2=0.0d0; t3=0.0d0
41 
42  ! =============== INITIALIZE ===================
43 
44  call hecmw_init
45  myrank = hecmw_comm_get_rank()
46  nprocs = hecmw_comm_get_size()
47 
48  t1 = hecmw_wtime()
49 
50  name_id = 'fstrMSH'
51  call hecmw_get_mesh( name_id , hecmesh )
52 
53  if( hecmesh%contact_pair%n_pair > 0 ) then
54  paracontactflag = .true.
55  if( myrank == 0 ) then
56  print *,'paraContactFlag',paracontactflag
57  endif
58  endif
59 
61 
62  call fstr_init
63 
65 
66  t2 = hecmw_wtime()
67 
68  ! =============== ANALYSIS =====================
69 
70  select case( fstrpr%solution_type )
71  case( kststatic )
73  case( kstdynamic )
75  case( ksteigen )
77  case( kstheat )
79  case( kststaticeigen )
81  end select
82 
83  t3 = hecmw_wtime()
84 
85  if(hecmesh%my_rank==0) then
86  write(*,*)
87  write(*,*) '===================================='
88  write(*,'(a,f10.2)') ' TOTAL TIME (sec) :', t3 - t1
89  write(*,'(a,f10.2)') ' pre (sec) :', t2 - t1
90  write(*,'(a,f10.2)') ' solve (sec) :', t3 - t2
91  write(*,*) '===================================='
92 
93  write(imsg,*) '===================================='
94  write(imsg,'(a,f10.2)') ' TOTAL TIME (sec) :', t3 - t1
95  write(imsg,'(a,f10.2)') ' pre (sec) :', t2 - t1
96  write(imsg,'(a,f10.2)') ' solve (sec) :', t3 - t2
97  write(imsg,*) '===================================='
98  endif
99 
100  ! =============== FINALIZE =====================
101 
103  call fstr_finalize()
104  call hecmw_dist_free(hecmesh)
105  call hecmw_finalize
106  if(hecmesh%my_rank==0) write(*,*) 'FrontISTR Completed !!'
107 
108  end subroutine fstr_main
109 
110  !=============================================================================!
112  !=============================================================================!
113 
114  subroutine fstr_init
115  implicit none
116 
117  ! set pointer to null
118  call hecmw_nullify_matrix ( hecmat )
119  call hecmw_nullify_matrix ( conmat )
120  call hecmw_nullify_result_data( fstrresult )
127  call fstr_init_file
128 
129  ! ---- default setting of global params ---
130  dt = 1
131  etime = 1
132  itmax = 20
133  eps = 1.0d-6
134 
135  ! ------- global pointer setting ----------
136  ref_temp => fstrpr%ref_temp
137  iecho => fstrpr%fg_echo
138  iresult => fstrpr%fg_result
139  ivisual => fstrpr%fg_visual
140 
141  ! for heat ...
142  ineutral => fstrpr%fg_neutral
143  irres => fstrpr%fg_irres
144  iwres => fstrpr%fg_iwres
145  nrres => fstrpr%nrres
146  nprint => fstrpr%nprint
147 
148 
149  ! ------- initial value setting -------------
150  call fstr_mat_init ( hecmat )
152 
154  call fstr_eigen_init( fstreig )
155  call fstr_heat_init ( fstrheat )
157 
158  ! ------- scan cnt file -------------
160 
161  ! ------- hecMAT setting -------------
162  call hecmw_mat_con(hecmesh, hecmat)
163  hecmat%NDOF = hecmesh%n_dof
164  if( kstheat == fstrpr%solution_type ) then
167  hecmat%NDOF = 1
168  endif
169  call hecmat_init( hecmat )
170  end subroutine fstr_init
171 
172  !------------------------------------------------------------------------------
174  subroutine fstr_init_file
175  implicit none
176  character(len=HECMW_FILENAME_LEN) :: s, r
177  character(len=HECMW_FILENAME_LEN) :: stafileNAME
178  character(len=HECMW_FILENAME_LEN) :: logfileNAME
179  character(len=HECMW_FILENAME_LEN) :: msgfileNAME
180  character(len=HECMW_FILENAME_LEN) :: dbgfileNAME
181  integer :: stat, flag, limit, irank
182 
183  ! set file name --------------------------------
184  call hecmw_ctrl_is_subdir( flag, limit )
185  write(s,*) myrank
186  if( flag == 0 ) then
187  write( logfilename, '(a,a)') trim(adjustl(s)), '.log'
188  logfilename = adjustl(logfilename)
189  write( dbgfilename, '(a,a)') 'FSTR.dbg.', trim(adjustl(s))
190  dbgfilename = adjustl(dbgfilename)
191  else
192  if( nprocs > limit ) then
193  irank = myrank / limit
194  write(r,*) irank
195  write( logfilename, '(a,a,a,a,a)') 'LOG/TRUNK', trim(adjustl(r)), '/', trim(adjustl(s)), '.log'
196  logfilename = adjustl(logfilename)
197  call hecmw_ctrl_make_subdir( logfilename, stat )
198  if( stat /= 0 ) call fstr_setup_util_err_stop( '### Cannot create directory' )
199  write( dbgfilename, '(a,a,a,a,a)') 'DBG/TRUNK', trim(adjustl(r)), '/', 'FSTR.dbg.', trim(adjustl(s))
200  dbgfilename = adjustl(dbgfilename)
201  call hecmw_ctrl_make_subdir( dbgfilename, stat )
202  if( stat /= 0 ) call fstr_setup_util_err_stop( '### Cannot create directory' )
203  else
204  write( logfilename, '(a,a,a)') 'LOG/', trim(adjustl(s)), '.log'
205  logfilename = adjustl(logfilename)
206  call hecmw_ctrl_make_subdir( logfilename, stat )
207  if( stat /= 0 ) call fstr_setup_util_err_stop( '### Cannot create directory' )
208  write( dbgfilename, '(a,a,a)') 'DBG/', 'FSTR.dbg.', trim(adjustl(s))
209  dbgfilename = adjustl(dbgfilename)
210  call hecmw_ctrl_make_subdir( dbgfilename, stat )
211  if( stat /= 0 ) call fstr_setup_util_err_stop( '### Cannot create directory' )
212  endif
213  endif
214  stafilename = 'FSTR.sta'
215  msgfilename = 'FSTR.msg'
216 
217  ! open & opening message out -------------------
218  ! MSGFILE
219  if( myrank == 0) then
220  open(imsg, file=msgfilename, status='replace', iostat=stat)
221  if( stat /= 0 ) then
222  call fstr_setup_util_err_stop( '### Cannot open message file :'//msgfilename )
223  endif
224  write(imsg,*) ':========================================:'
225  write(imsg,*) ':** BEGIN FSTR Structural Analysis **:'
226  write(imsg,*) ':========================================:'
227  write(imsg,*) ' Total no. of processors: ',nprocs
228  write(imsg,*)
229  write(imsg,*)
230  write(imsg,*)
231  write(imsg,*) ' * STAGE Initialization and input **'
232  endif
233 
234  ! LOGFILE & STAFILE
235  open (ilog, file = logfilename, status = 'replace', iostat=stat )
236  if( stat /= 0 ) then
237  call fstr_setup_util_err_stop( '### Cannot open log file :'//logfilename )
238  endif
239 
240  if( myrank == 0 ) then
241  open (ista,file = stafilename, status = 'replace', iostat=stat )
242  write(ista,'(''####'',a80)') stafilename
243  if( stat /= 0 ) then
244  call fstr_setup_util_err_stop( '### Cannot open status file :'//stafilename )
245  endif
246  endif
247 
248  open (idbg,file = dbgfilename, status = 'replace', iostat=stat)
249  write(idbg,'(''####'',a80)') dbgfilename
250  if( stat /= 0 ) then
251  call fstr_setup_util_err_stop( '### Cannot open debug file :'//dbgfilename )
252  endif
253  end subroutine fstr_init_file
254 
255  !------------------------------------------------------------------------------
258  implicit none
259  character(len=HECMW_FILENAME_LEN) :: cntfileNAME
260 
261  name_id='fstrCNT'
262  call hecmw_ctrl_get_control_file( name_id, cntfilename )
263 
264  ! loading boundary conditions etc. from fstr control file or nastran mesh file
265  ! and setup parameters ...
266  svrarray(:) = hecmat%Rarray(:)
267  sviarray(:) = hecmat%Iarray(:)
268 
270 
271  hecmat%Rarray(:) = svrarray(:)
272  hecmat%Iarray(:) = sviarray(:)
273 
275 
276  if( myrank == 0) write(*,*) 'fstr_setup: OK'
277  write(ilog,*) 'fstr_setup: OK'
278  call flush(6)
279 
280  end subroutine fstr_init_condition
281 
282  !=============================================================================!
284  !=============================================================================!
285 
287  implicit none
288 
289  if( iecho.eq.1 ) call fstr_echo(hecmesh)
290 
291  if(myrank .EQ. 0) then
292  write(imsg,*)
293  write(imsg,*)
294  write(imsg,*)
295  endif
296 
297  if( fstrpr%nlgeom ) then
298  if( myrank == 0) write(imsg,*) ' *** STAGE Non Linear static analysis **'
299  else
300  if( myrank == 0 ) write(imsg,*) ' *** STAGE Linear static analysis **'
301  endif
302 
304 
306 
307  end subroutine fstr_static_analysis
308 
309  !=============================================================================!
311  !=============================================================================!
312 
314  use hecmw
315  use m_fstr
316  implicit none
317 
318  if( iecho.eq.1 ) call fstr_echo(hecmesh)
319  if(myrank .EQ. 0) then
320  write(imsg,*)
321  write(imsg,*)
322  write(imsg,*)
323  write(imsg,*) ' *** STAGE Eigenvalue analysis **'
324  endif
325 
327 
328  end subroutine fstr_eigen_analysis
329 
330  !=============================================================================!
332  !=============================================================================!
333 
335  implicit none
336 
337  if( iecho.eq.1 ) call heat_echo(fstrpr,hecmesh,fstrheat)
338  if(myrank .EQ. 0) then
339  write(imsg,*)
340  write(imsg,*)
341  write(imsg,*)
342  write(imsg,*) ' *** STAGE Heat analysis **'
343  endif
344 
346 
347  end subroutine fstr_heat_analysis
348 
349  !=============================================================================!
351  !=============================================================================!
352 
354  implicit none
355 
356  if( iecho.eq.1 ) call fstr_echo(hecmesh)
357 
358  if(myrank == 0) then
359  write(imsg,*)
360  write(imsg,*)
361  write(imsg,*)
362  if( fstrpr%nlgeom ) then
363  write(imsg,*) ' *** STAGE Nonlinear dynamic analysis **'
364  else
365  write(imsg,*) ' *** STAGE Linear dynamic analysis **'
366  endif
367  endif
368 
371  conmat )
372 
373  end subroutine fstr_dynamic_analysis
374 
375  !=============================================================================!
377  !=============================================================================!
378 
380  implicit none
381 
382  if( iecho==1 ) call fstr_echo(hecmesh)
383 
384  if(myrank == 0) then
385  write(imsg,*)
386  write(imsg,*)
387  write(imsg,*)
388  write(imsg,*) ' *** STAGE Static -> Eigen analysis **'
389  write(*,*) ' *** STAGE Static -> Eigen analysis **'
390  write(imsg,*)
391  write(imsg,*) ' *** Stage 1: Nonlinear static analysis **'
392  write(*,*) ' *** Stage 1: Nonlinear static analysis **'
393  endif
394 
396 
397  if(myrank == 0) then
398  write(imsg,*)
399  write(imsg,*) ' *** Stage 2: Eigenvalue analysis **'
400  write(*,*)
401  write(*,*) ' *** Stage 2: Eigenvalue analysis **'
402  endif
403 
405 
407 
408  end subroutine fstr_static_eigen_analysis
409 
410  !=============================================================================!
412  !=============================================================================!
413 
414  subroutine fstr_finalize
415  implicit none
416 
417  if( myrank == 0 ) then
418  write(imsg,*)
419  write(imsg,*)
420  write(imsg,*)
421  write(imsg,*) ':========================================:'
422  write(imsg,*) ':** END of FSTR **:'
423  write(imsg,*) ':========================================:'
424  close(imsg)
425  close(ista)
426  endif
427 
429  call hecmat_finalize( hecmat )
430 
431  close(ilog)
432  close(idbg)
433  end subroutine fstr_finalize
434 
435 end module m_fstr_main
void hecmw_ctrl_is_subdir(int *flag, int *limit)
void hecmw_ctrl_make_subdir(char *filename, int *err, int len)
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.
Definition: hecmw.f90:6
type(hecmwst_result_data), save fstrresult
Definition: fistr_main.f90:29
subroutine fstr_dynamic_analysis
Master subroutine of dynamic analysis !
Definition: fistr_main.f90:354
type(hecmwst_matrix), save hecmat
Definition: fistr_main.f90:22
type(hecmwst_matrix_lagrange), save heclagmat
Definition: fistr_main.f90:25
subroutine fstr_static_eigen_analysis
Master subroutine of static -> eigen analysis !
Definition: fistr_main.f90:380
subroutine fstr_init
Initializer !
Definition: fistr_main.f90:115
subroutine fstr_heat_analysis
Master subroutine of heat analysis !
Definition: fistr_main.f90:335
type(hecmwst_local_mesh), save hecmesh
Definition: fistr_main.f90:21
subroutine fstr_init_condition
Read in control file and do all preparation.
Definition: fistr_main.f90:258
type(fstr_solid), save fstrsolid
Definition: fistr_main.f90:24
type(fstr_heat), save fstrheat
Definition: fistr_main.f90:26
subroutine fstr_static_analysis
Master subroutine of linear/nonlinear static analysis !
Definition: fistr_main.f90:287
character(len=hecmw_filename_len) name_id
Definition: fistr_main.f90:32
subroutine fstr_finalize
Finalizer !
Definition: fistr_main.f90:415
type(fstr_dynamic), save fstrdynamic
Definition: fistr_main.f90:28
subroutine fstr_main()
Definition: fistr_main.f90:37
type(fstr_couple), save fstrcpl
Definition: fistr_main.f90:30
subroutine fstr_init_file
Open all files preparing calculation.
Definition: fistr_main.f90:175
type(fstr_freqanalysis), save fstrfreq
Definition: fistr_main.f90:31
type(hecmwst_matrix), save conmat
Definition: fistr_main.f90:23
subroutine fstr_eigen_analysis
Master subroutine of eigen analysis !
Definition: fistr_main.f90:314
type(fstr_eigen), save fstreig
Definition: fistr_main.f90:27
This module provides the entry point for ELEMCHECK (pre-analysis input validation)
subroutine fstr_input_precheck(hecMESH, hecMAT, fstrSOLID)
Main entry point (called from fistr_main)
subroutine, public fstr_rcap_finalize(fstrPARAM, fstrCPL)
subroutine, public fstr_rcap_initialize(hecMESH, fstrPARAM, fstrCPL)
This module provides functions to read in data from control file and do necessary preparation for fol...
Definition: fstr_setup.f90:7
subroutine fstr_eigen_init(fstrEIG)
Initial setting of eigen ca;culation.
subroutine fstr_solid_finalize(fstrSOLID)
Finalizer of fstr_solid.
subroutine fstr_solid_init(hecMESH, fstrSOLID)
Initializer of structure fstr_solid.
subroutine fstr_dynamic_init(fstrDYNAMIC)
Initial setting of dynamic calculation.
subroutine fstr_heat_init(fstrHEAT)
Initial setting of heat analysis.
subroutine fstr_setup(cntl_filename, hecMESH, fstrPARAM, fstrSOLID, fstrEIG, fstrHEAT, fstrDYNAMIC, fstrCPL, fstrFREQ)
Read in and initialize control data !
Definition: fstr_setup.f90:48
This module provides a function to control eigen analysis.
subroutine fstr_solve_eigen(hecMESH, hecMAT, fstrEIG, fstrSOLID, fstrRESULT, fstrPARAM, hecLagMAT)
solve eigenvalue probrem
This module provides a function to control heat analysis.
subroutine fstr_solve_heat(hecMESH, hecMAT, fstrSOLID, fstrRESULT, fstrPARAM, fstrHEAT)
This module provides main suboruitne for nonliear calculation.
subroutine fstr_solve_nlgeom(hecMESH, hecMAT, fstrSOLID, hecLagMAT, fstrPARAM, conMAT)
This module provides main subroutine for nonlinear calculation.
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
integer(kind=kint), pointer iresult
Definition: m_fstr.F90:129
subroutine hecmat_finalize(hecMAT)
Definition: m_fstr.F90:975
subroutine fstr_nullify_fstr_couple(C)
Definition: m_fstr.F90:872
real(kind=kreal) eps
Definition: m_fstr.F90:149
integer(kind=kint) myrank
PARALLEL EXECUTION.
Definition: m_fstr.F90:103
subroutine fstr_param_init(fstrPARAM, hecMESH)
Initializer of structure fstr_param.
Definition: m_fstr.F90:1032
integer(kind=kint), parameter imsg
Definition: m_fstr.F90:117
real(kind=kreal), dimension(100) svrarray
Definition: m_fstr.F90:125
integer(kind=kint), parameter kstdynamic
Definition: m_fstr.F90:41
integer(kind=kint), pointer ineutral
Definition: m_fstr.F90:131
subroutine fstr_nullify_fstr_heat(H)
Definition: m_fstr.F90:786
real(kind=kreal) etime
Definition: m_fstr.F90:147
integer(kind=kint), parameter idbg
Definition: m_fstr.F90:118
integer(kind=kint), dimension(100) sviarray
SOLVER CONTROL.
Definition: m_fstr.F90:124
subroutine fstr_mat_init(hecMAT)
Initializer of structure hecmwST_matrix.
Definition: m_fstr.F90:883
integer(kind=kint) itmax
Definition: m_fstr.F90:148
subroutine fstr_nullify_fstr_eigen(E)
Definition: m_fstr.F90:865
integer(kind=kint) nprocs
Definition: m_fstr.F90:104
integer(kind=kint), pointer iwres
Definition: m_fstr.F90:133
integer(kind=kint), parameter ilog
FILE HANDLER.
Definition: m_fstr.F90:114
integer(kind=kint), pointer nprint
Definition: m_fstr.F90:135
real(kind=kreal) dt
ANALYSIS CONTROL for NLGEOM and HEAT.
Definition: m_fstr.F90:146
integer(kind=kint), pointer nrres
Definition: m_fstr.F90:134
integer(kind=kint), parameter kststatic
Definition: m_fstr.F90:38
subroutine hecmat_init(hecMAT)
Definition: m_fstr.F90:926
integer(kind=kint), parameter kststaticeigen
Definition: m_fstr.F90:43
integer(kind=kint), parameter kstheat
Definition: m_fstr.F90:40
integer(kind=kint), parameter ista
Definition: m_fstr.F90:115
real(kind=kreal), pointer ref_temp
REFTEMP.
Definition: m_fstr.F90:143
integer(kind=kint), pointer irres
Definition: m_fstr.F90:132
integer(kind=kint), pointer iecho
FLAG for ECHO/RESULT/POST.
Definition: m_fstr.F90:128
type(fstr_param), target fstrpr
GLOBAL VARIABLE INITIALIZED IN FSTR_SETUP.
Definition: m_fstr.F90:218
subroutine fstr_nullify_fstr_param(P)
NULL POINTER SETTING TO AVOID RUNTIME ERROR.
Definition: m_fstr.F90:709
integer(kind=kint), parameter ksteigen
Definition: m_fstr.F90:39
integer(kind=kint), pointer ivisual
Definition: m_fstr.F90:130
subroutine fstr_nullify_fstr_solid(S)
Definition: m_fstr.F90:723
subroutine fstr_nullify_fstr_dynamic(DY)
Definition: m_fstr.F90:840
logical paracontactflag
PARALLEL CONTACT FLAG.
Definition: m_fstr.F90:107
ECHO for HEAT solver.
Definition: heat_echo.f90:6
subroutine heat_echo(p, hecMESH, fstrHEAT)
Definition: heat_echo.f90:10
This module provides functions to initialize heat analysis.
Definition: heat_init.f90:6
subroutine heat_init_material(hecMESH, fstrHEAT)
Definition: heat_init.f90:167
subroutine heat_init_amplitude(hecMESH, fstrHEAT)
Definition: heat_init.f90:83
HECMW to FSTR Mesh Data Converter. Converting Connectivity of Element Type 232, 342 and 352.
subroutine hecmw2fstr_mesh_conv(hecMESH)
This module provide a function to ECHO for IFSTR solver.
Definition: static_echo.f90:6
subroutine fstr_echo(hecMESH)
ECHO for IFSTR solver.
Definition: static_echo.f90:14
Data for coupling analysis.
Definition: m_fstr.F90:646
Data for DYNAMIC ANSLYSIS (fstrDYNAMIC)
Definition: m_fstr.F90:540
Package of data used by Lanczos eigenvalue solver.
Definition: m_fstr.F90:628
Data for HEAT ANSLYSIS (fstrHEAT)
Definition: m_fstr.F90:458