FrontISTR  6.0.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
15  use m_static_echo
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(fstr_param), target, save :: fstrparam
24  type(fstr_solid), save :: fstrsolid
25  type(fstr_heat), save :: fstrheat
26  type(fstr_eigen), save :: fstreig
27  type(fstr_dynamic), save :: fstrdynamic
28  type(hecmwst_result_data), save :: fstrresult
29  type(fstr_couple), save :: fstrcpl
30  type(fstr_freqanalysis), save :: fstrfreq
31  character(len=HECMW_NAME_LEN) :: name_id
32 
33 contains
34 
35  subroutine fstr_main() bind(C,NAME='fstr_main')
36  implicit none
37  real(kind=kreal) :: t1, t2, t3
38 
39  t1=0.0d0; t2=0.0d0; t3=0.0d0
40 
41  ! =============== INITIALIZE ===================
42 
43  call hecmw_init
44  myrank = hecmw_comm_get_rank()
45  nprocs = hecmw_comm_get_size()
46 
47  t1 = hecmw_wtime()
48 
49  name_id = 'fstrMSH'
50  call hecmw_get_mesh( name_id , hecmesh )
51 
52  if( hecmesh%contact_pair%n_pair > 0 ) then
53  paracontactflag = .true.
54  if( myrank == 0 ) then
55  print *,'paraContactFlag',paracontactflag
56  endif
57  endif
58 
60 
61  call fstr_init
62 
64 
65  t2 = hecmw_wtime()
66 
67  ! =============== ANALYSIS =====================
68 
69  select case( fstrparam%solution_type )
70  case( kststatic )
72  case( kstdynamic )
74  case( ksteigen )
76  case( kstheat )
78  case( kststaticeigen )
80  end select
81 
82  t3 = hecmw_wtime()
83 
84  if(hecmesh%my_rank==0) then
85  write(*,*)
86  write(*,*) '===================================='
87  write(*,'(a,f10.2)') ' TOTAL TIME (sec) :', t3 - t1
88  write(*,'(a,f10.2)') ' pre (sec) :', t2 - t1
89  write(*,'(a,f10.2)') ' solve (sec) :', t3 - t2
90  write(*,*) '===================================='
91 
92  write(imsg,*) '===================================='
93  write(imsg,'(a,f10.2)') ' TOTAL TIME (sec) :', t3 - t1
94  write(imsg,'(a,f10.2)') ' pre (sec) :', t2 - t1
95  write(imsg,'(a,f10.2)') ' solve (sec) :', t3 - t2
96  write(imsg,*) '===================================='
97  endif
98 
99  ! =============== FINALIZE =====================
100 
102  call fstr_finalize()
103  call hecmw_dist_free(hecmesh)
104  call hecmw_finalize
105  if(hecmesh%my_rank==0) write(*,*) 'FrontISTR Completed !!'
106 
107  end subroutine fstr_main
108 
109  !=============================================================================!
111  !=============================================================================!
112 
113  subroutine fstr_init
114  implicit none
115 
116  ! set pointer to null
117  call hecmw_nullify_matrix ( hecmat )
118  call hecmw_nullify_result_data( fstrresult )
125  call fstr_init_file
126 
127  ! ------- initial value setting -------------
128  call fstr_mat_init ( hecmat )
130 
131  call fstr_solid_init( fstrsolid )
132  call fstr_eigen_init( fstreig )
133  call fstr_heat_init ( fstrheat )
134  call fstr_dynamic_init( fstrdynamic )
135 
136  ! ------- scan cnt file -------------
138 
139  ! ------- hecMAT setting -------------
140  call hecmw_mat_con(hecmesh, hecmat, kstheat == fstrparam%solution_type)
141  if( kstheat == fstrparam%solution_type ) then
142  hecmat%NDOF = 1
143  else
144  hecmat%NDOF = hecmesh%n_dof
145  end if
146 
147  call hecmat_init( hecmat )
148  end subroutine fstr_init
149 
150  !------------------------------------------------------------------------------
152  subroutine fstr_init_file
153  implicit none
154  character(len=HECMW_FILENAME_LEN) :: s, r
155  character(len=HECMW_FILENAME_LEN) :: stafileNAME
156  character(len=HECMW_FILENAME_LEN) :: logfileNAME
157  character(len=HECMW_FILENAME_LEN) :: msgfileNAME
158  character(len=HECMW_FILENAME_LEN) :: dbgfileNAME
159  integer :: stat, flag, limit, irank
160 
161  ! set file name --------------------------------
162  call hecmw_ctrl_is_subdir( flag, limit )
163  write(s,*) myrank
164  if( flag == 0 ) then
165  write( logfilename, '(a,a)') trim(adjustl(s)), '.log'
166  logfilename = adjustl(logfilename)
167  write( dbgfilename, '(a,a)') 'FSTR.dbg.', trim(adjustl(s))
168  dbgfilename = adjustl(dbgfilename)
169  else
170  if( nprocs > limit ) then
171  irank = myrank / limit
172  write(r,*) irank
173  write( logfilename, '(a,a,a,a,a)') 'LOG/TRUNK', trim(adjustl(r)), '/', trim(adjustl(s)), '.log'
174  logfilename = adjustl(logfilename)
175  call hecmw_ctrl_make_subdir( logfilename, stat )
176  if( stat /= 0 ) call fstr_setup_util_err_stop( '### Cannot create directory' )
177  write( dbgfilename, '(a,a,a,a,a)') 'DBG/TRUNK', trim(adjustl(r)), '/', 'FSTR.dbg.', trim(adjustl(s))
178  dbgfilename = adjustl(dbgfilename)
179  call hecmw_ctrl_make_subdir( dbgfilename, stat )
180  if( stat /= 0 ) call fstr_setup_util_err_stop( '### Cannot create directory' )
181  else
182  write( logfilename, '(a,a,a)') 'LOG/', trim(adjustl(s)), '.log'
183  logfilename = adjustl(logfilename)
184  call hecmw_ctrl_make_subdir( logfilename, stat )
185  if( stat /= 0 ) call fstr_setup_util_err_stop( '### Cannot create directory' )
186  write( dbgfilename, '(a,a,a)') 'DBG/', 'FSTR.dbg.', trim(adjustl(s))
187  dbgfilename = adjustl(dbgfilename)
188  call hecmw_ctrl_make_subdir( dbgfilename, stat )
189  if( stat /= 0 ) call fstr_setup_util_err_stop( '### Cannot create directory' )
190  endif
191  endif
192  stafilename = 'FSTR.sta'
193  msgfilename = 'FSTR.msg'
194 
195  ! open & opening message out -------------------
196  ! MSGFILE
197  if( myrank == 0) then
198  open(imsg, file=msgfilename, status='replace', iostat=stat)
199  if( stat /= 0 ) then
200  call fstr_setup_util_err_stop( '### Cannot open message file :'//msgfilename )
201  endif
202  write(imsg,*) ':========================================:'
203  write(imsg,*) ':** BEGIN FSTR Structural Analysis **:'
204  write(imsg,*) ':========================================:'
205  write(imsg,*) ' Total no. of processors: ',nprocs
206  write(imsg,*)
207  write(imsg,*)
208  write(imsg,*)
209  write(imsg,*) ' * STAGE Initialization and input **'
210  endif
211 
212  ! LOGFILE & STAFILE
213  open (ilog, file = logfilename, status = 'replace', iostat=stat )
214  if( stat /= 0 ) then
215  call fstr_setup_util_err_stop( '### Cannot open log file :'//logfilename )
216  endif
217 
218  if( myrank == 0 ) then
219  open (ista,file = stafilename, status = 'replace', iostat=stat )
220  write(ista,'(''####'',a80)') stafilename
221  if( stat /= 0 ) then
222  call fstr_setup_util_err_stop( '### Cannot open status file :'//stafilename )
223  endif
224  endif
225 
226  open (idbg,file = dbgfilename, status = 'replace', iostat=stat)
227  write(idbg,'(''####'',a80)') dbgfilename
228  if( stat /= 0 ) then
229  call fstr_setup_util_err_stop( '### Cannot open debug file :'//dbgfilename )
230  endif
231  end subroutine fstr_init_file
232 
233  !------------------------------------------------------------------------------
236  implicit none
237  character(len=HECMW_FILENAME_LEN) :: cntfileNAME
238 
239  name_id='fstrCNT'
240  call hecmw_ctrl_get_control_file( name_id, cntfilename )
241 
242  ! loading boundary conditions etc. from fstr control file or nastran mesh file
243  ! and setup parameters ...
244  if( fstr_ctrl_is_inp_file( cntfilename ) ) then
246  fstrfreq )
247  else
249  endif
250 
252 
253  if( myrank == 0) write(*,*) 'fstr_setup: OK'
254  write(ilog,*) 'fstr_setup: OK'
255  call flush(6)
256 
257  end subroutine fstr_init_condition
258 
259  !=============================================================================!
261  !=============================================================================!
262 
264  implicit none
265 
266  if( fstrparam%fg_echo.eq.1 ) call fstr_echo(hecmesh)
267 
268  if(myrank .EQ. 0) then
269  write(imsg,*)
270  write(imsg,*)
271  write(imsg,*)
272  endif
273 
274  if( fstrparam%nlgeom ) then
275  if( myrank == 0) write(imsg,*) ' *** STAGE Non Linear static analysis **'
276  else
277  if( myrank == 0 ) write(imsg,*) ' *** STAGE Linear static analysis **'
278  endif
279 
281 
282  call fstr_solid_finalize( fstrsolid )
283 
284  end subroutine fstr_static_analysis
285 
286  !=============================================================================!
288  !=============================================================================!
289 
291  use hecmw
292  use m_fstr
293  implicit none
294 
295  if( fstrparam%fg_echo.eq.1 ) call fstr_echo(hecmesh)
296  if(myrank .EQ. 0) then
297  write(imsg,*)
298  write(imsg,*)
299  write(imsg,*)
300  write(imsg,*) ' *** STAGE Eigenvalue analysis **'
301  endif
302 
304 
305  end subroutine fstr_eigen_analysis
306 
307  !=============================================================================!
309  !=============================================================================!
310 
312  implicit none
313 
314  if( fstrparam%fg_echo.eq.1 ) call heat_echo(fstrparam,hecmesh,fstrheat)
315  if(myrank .EQ. 0) then
316  write(imsg,*)
317  write(imsg,*)
318  write(imsg,*)
319  write(imsg,*) ' *** STAGE Heat analysis **'
320  endif
321 
323 
324  end subroutine fstr_heat_analysis
325 
326  !=============================================================================!
328  !=============================================================================!
329 
331  implicit none
332 
333  if( fstrparam%fg_echo.eq.1 ) call fstr_echo(hecmesh)
334 
335  if(myrank == 0) then
336  write(imsg,*)
337  write(imsg,*)
338  write(imsg,*)
339  if( fstrparam%nlgeom ) then
340  write(imsg,*) ' *** STAGE Nonlinear dynamic analysis **'
341  else
342  write(imsg,*) ' *** STAGE Linear dynamic analysis **'
343  endif
344  endif
345 
348 
349  end subroutine fstr_dynamic_analysis
350 
351  !=============================================================================!
353  !=============================================================================!
354 
356  implicit none
357 
358  if( fstrparam%fg_echo==1 ) call fstr_echo(hecmesh)
359 
360  if(myrank == 0) then
361  write(imsg,*)
362  write(imsg,*)
363  write(imsg,*)
364  write(imsg,*) ' *** STAGE Static -> Eigen analysis **'
365  write(*,*) ' *** STAGE Static -> Eigen analysis **'
366  write(imsg,*)
367  write(imsg,*) ' *** Stage 1: Nonlinear static analysis **'
368  write(*,*) ' *** Stage 1: Nonlinear static analysis **'
369  endif
370 
372 
373  if(myrank == 0) then
374  write(imsg,*)
375  write(imsg,*) ' *** Stage 2: Eigenvalue analysis **'
376  write(*,*)
377  write(*,*) ' *** Stage 2: Eigenvalue analysis **'
378  endif
379 
381 
382  call fstr_solid_finalize( fstrsolid )
383 
384  end subroutine fstr_static_eigen_analysis
385 
386  !=============================================================================!
388  !=============================================================================!
389 
390  subroutine fstr_finalize
391  implicit none
392 
393  if( myrank == 0 ) then
394  write(imsg,*)
395  write(imsg,*)
396  write(imsg,*)
397  write(imsg,*) ':========================================:'
398  write(imsg,*) ':** END of FSTR **:'
399  write(imsg,*) ':========================================:'
400  close(imsg)
401  close(ista)
402  endif
403 
404  call fstr_solid_finalize( fstrsolid )
405  call hecmat_finalize( hecmat )
406 
407  close(ilog)
408  close(idbg)
409  end subroutine fstr_finalize
410 
411 end module m_fstr_main
int fstr_ctrl_is_inp_file(char *filename)
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, fstrPARAM, fstrCPL, fstrFREQ)
Master subroutine for dynamic analysis.
Definition: hecmw.f90:6
type(hecmwst_result_data), save fstrresult
Definition: fistr_main.f90:28
subroutine fstr_dynamic_analysis
Master subroutine of dynamic analysis !
Definition: fistr_main.f90:331
type(hecmwst_matrix), save hecmat
Definition: fistr_main.f90:22
subroutine fstr_static_eigen_analysis
Master subroutine of static -> eigen analysis !
Definition: fistr_main.f90:356
subroutine fstr_init
Initializer !
Definition: fistr_main.f90:114
subroutine fstr_heat_analysis
Master subroutine of heat analysis !
Definition: fistr_main.f90:312
type(fstr_param), target, save fstrparam
Definition: fistr_main.f90:23
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:236
type(fstr_solid), save fstrsolid
Definition: fistr_main.f90:24
type(fstr_heat), save fstrheat
Definition: fistr_main.f90:25
subroutine fstr_static_analysis
Master subroutine of linear/nonlinear static analysis !
Definition: fistr_main.f90:264
subroutine fstr_finalize
Finalizer !
Definition: fistr_main.f90:391
type(fstr_dynamic), save fstrdynamic
Definition: fistr_main.f90:27
subroutine fstr_main()
Definition: fistr_main.f90:36
type(fstr_couple), save fstrcpl
Definition: fistr_main.f90:29
subroutine fstr_init_file
Open all files preparing calculation.
Definition: fistr_main.f90:153
type(fstr_freqanalysis), save fstrfreq
Definition: fistr_main.f90:30
subroutine fstr_eigen_analysis
Master subroutine of eigen analysis !
Definition: fistr_main.f90:291
character(len=hecmw_name_len) name_id
Definition: fistr_main.f90:31
type(fstr_eigen), save fstreig
Definition: fistr_main.f90:26
This module provides the entry point for ELEMCHECK (pre-analysis input validation)
subroutine fstr_input_precheck(hecMESH, hecMAT, fstrSOLID, fstrPARAM)
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 the analysis data of an inp file and do necessary preparati...
subroutine, public fstr_setup_inp(inp_filename, hecMESH, hecMAT, fstrPARAM, fstrSOLID, fstrEIG, fstrHEAT, fstrDYNAMIC, fstrCPL, fstrFREQ)
Read in and initialize the analysis data of an inp file !
This module provides functions to read in data from control file and do necessary preparation for fol...
Definition: fstr_setup.f90:7
subroutine fstr_setup(cntl_filename, hecMESH, hecMAT, fstrPARAM, fstrSOLID, fstrEIG, fstrHEAT, fstrDYNAMIC, fstrCPL, fstrFREQ)
Read in and initialize control data !
Definition: fstr_setup.f90:43
This module provides a function to control eigen analysis.
subroutine fstr_solve_eigen(hecMESH, hecMAT, fstrEIG, fstrSOLID, fstrRESULT, fstrPARAM)
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, fstrPARAM)
This module provides main subroutine for nonlinear calculation.
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
subroutine hecmat_finalize(hecMAT)
Definition: m_fstr.F90:1212
subroutine fstr_nullify_fstr_couple(C)
Definition: m_fstr.F90:1108
integer(kind=kint) myrank
PARALLEL EXECUTION.
Definition: m_fstr.F90:117
subroutine fstr_param_init(fstrPARAM, hecMESH)
Initializer of structure fstr_param.
Definition: m_fstr.F90:1269
integer(kind=kint), parameter imsg
Definition: m_fstr.F90:131
integer(kind=kint), parameter kstdynamic
Definition: m_fstr.F90:41
subroutine fstr_nullify_fstr_heat(H)
Definition: m_fstr.F90:1000
integer(kind=kint), parameter idbg
Definition: m_fstr.F90:132
subroutine fstr_mat_init(hecMAT)
Initializer of structure hecmwST_matrix.
Definition: m_fstr.F90:1120
subroutine fstr_nullify_fstr_eigen(E)
Definition: m_fstr.F90:1096
integer(kind=kint) nprocs
Definition: m_fstr.F90:118
integer(kind=kint), parameter ilog
FILE HANDLER.
Definition: m_fstr.F90:128
integer(kind=kint), parameter kststatic
Definition: m_fstr.F90:38
subroutine hecmat_init(hecMAT)
Definition: m_fstr.F90:1163
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:129
subroutine fstr_nullify_fstr_param(P)
NULL POINTER SETTING TO AVOID RUNTIME ERROR.
Definition: m_fstr.F90:817
integer(kind=kint), parameter ksteigen
Definition: m_fstr.F90:39
subroutine fstr_nullify_fstr_solid(S)
Definition: m_fstr.F90:863
subroutine fstr_nullify_fstr_dynamic(DY)
Definition: m_fstr.F90:1057
logical paracontactflag
PARALLEL CONTACT FLAG.
Definition: m_fstr.F90:121
ECHO for HEAT solver.
Definition: heat_echo.f90:6
subroutine heat_echo(p, hecMESH, fstrHEAT)
Definition: heat_echo.f90:10
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:650
Data for DYNAMIC ANSLYSIS (fstrDYNAMIC)
Definition: m_fstr.F90:533
Package of data used by Lanczos eigenvalue solver.
Definition: m_fstr.F90:631
Data for HEAT ANSLYSIS (fstrHEAT)
Definition: m_fstr.F90:447
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.F90:151