FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
fstr_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 &
13  , hecmw_streqr
14  use fstr_setup_util
17  use fstr_ctrl_heat
18  use fstr_ctrl_eigen
21  use mcontactparam
23  use m_out
24  use m_step
25  use m_utilities
27  implicit none
28 
31  type(hecmwst_local_mesh), pointer :: mesh
32  type(fstr_param), pointer :: param
33  type(fstr_solid), pointer :: solid
34  type(fstr_heat), pointer :: heat
35  type(fstr_eigen), pointer :: eigen
36  type(fstr_dynamic), pointer :: dyn
37  type(fstr_couple), pointer :: cpl
38  type(fstr_freqanalysis), pointer :: freq
39  end type fstr_param_pack
40 
41 contains
42 
43  !=============================================================================!
45  !=============================================================================!
46  subroutine fstr_setup( cntl_filename, hecMESH, fstrPARAM, &
47  fstrSOLID, fstrEIG, fstrHEAT, fstrDYNAMIC, fstrCPL, fstrFREQ )
48  use mmaterial
49  character(len=HECMW_FILENAME_LEN) :: cntl_filename, input_filename
50  type(hecmwst_local_mesh),target :: hecMESH
51  type(fstr_param),target :: fstrPARAM
52  type(fstr_solid),target :: fstrSOLID
53  type(fstr_eigen),target :: fstrEIG
54  type(fstr_heat),target :: fstrHEAT
55  type(fstr_dynamic),target :: fstrDYNAMIC
56  type(fstr_couple),target :: fstrCPL
57  type(fstr_freqanalysis), target :: fstrFREQ
58 
59  integer(kind=kint) :: ctrl, ctrl_list(20), ictrl
60  type(fstr_param_pack) :: P
61 
62  integer, parameter :: MAXOUTFILE = 10
63  double precision, parameter :: dpi = 3.14159265358979323846d0
64 
65  integer(kind=kint) :: version, result, visual, femap, n_totlyr
66  integer(kind=kint) :: rcode, n, i, cid, nout, ierror, cparam_id
67  character(len=HECMW_NAME_LEN) :: header_name
68  real(kind=kreal) :: ee, pp, rho, alpha, thick, alpha_over_mu
69  real(kind=kreal) :: beam_radius, &
70  beam_angle1, beam_angle2, beam_angle3,&
71  beam_angle4, beam_angle5, beam_angle6
72  logical :: isOK
73  type(t_output_ctrl) :: outctrl
74  type(tshellmat),pointer :: shmat(:)
75  character(len=HECMW_FILENAME_LEN) :: logfileNAME, mName, mName2, mName3
76 
77  ! counters
78  integer(kind=kint) :: c_solution, c_solver, c_nlsolver, c_step, c_echo, c_amplitude
79  integer(kind=kint) :: c_static, c_boundary, c_cload, c_dload, c_temperature, c_reftemp, c_spring, c_elemact
80  integer(kind=kint) :: c_heat, c_fixtemp, c_cflux, c_dflux, c_sflux, c_film, c_sfilm, c_radiate, c_sradiate
81  integer(kind=kint) :: c_eigen, c_contact, c_contactparam, c_embed, c_contact_if
82  integer(kind=kint) :: c_dynamic, c_velocity, c_acceleration
83  integer(kind=kint) :: c_fload, c_facc, c_eigenread
84  integer(kind=kint) :: c_couple, c_material
85  integer(kind=kint) :: c_mpc, c_weldline, c_initial
86  integer(kind=kint) :: c_istep, c_localcoord, c_section
87  integer(kind=kint) :: c_elemopt, c_aincparam, c_timepoints, c_cnvparam
88  integer(kind=kint) :: c_output, islog
89  integer(kind=kint) :: k
90  integer(kind=kint) :: ss_nslav, ss_nmas_vis, ss_nmas_glob, ss_bad ! MORTAR=YES visibility guard scratch
91  integer(kind=kint) :: cache = 1
92 
93  write( logfilename, '(i5,''.log'')' ) myrank
94 
95  ! packaging
96  p%MESH => hecmesh
97  p%PARAM => fstrparam
98  p%SOLID => fstrsolid
99  p%EIGEN => fstreig
100  p%HEAT => fstrheat
101  p%DYN => fstrdynamic
102  p%CPL => fstrcpl
103  p%FREQ => fstrfreq
104 
105  fstrparam%contact_algo = kcaalagrange
106 
107  c_solution = 0; c_solver = 0; c_nlsolver = 0; c_step = 0; c_output = 0; c_echo = 0; c_amplitude = 0
108  c_static = 0; c_boundary = 0; c_cload = 0; c_dload = 0; c_temperature = 0; c_reftemp = 0; c_spring = 0;
109  c_elemact = 0;
110  c_heat = 0; c_fixtemp = 0; c_cflux = 0; c_dflux = 0; c_sflux = 0
111  c_film = 0; c_sfilm = 0; c_radiate= 0; c_sradiate = 0
112  c_eigen = 0; c_contact = 0; c_contactparam = 0; c_embed = 0; c_contact_if = 0
113  c_dynamic = 0; c_velocity = 0; c_acceleration = 0
114  c_couple = 0; c_material = 0; c_section =0
115  c_mpc = 0; c_weldline = 0; c_initial = 0
116  c_istep = 0; c_localcoord = 0
117  c_fload = 0; c_facc = 0; c_eigenread = 0
118  c_elemopt = 0;
119  c_aincparam= 0; c_timepoints = 0; c_cnvparam = 0
120 
121  ctrl_list = 0
122  ictrl = 1
123  ctrl = fstr_ctrl_open( cntl_filename )
124  if( ctrl < 0 ) then
125  write(*,*) '### Error: Cannot open FSTR control file : ', cntl_filename
126  write(ilog,*) '### Error: Cannot open FSTR control file : ', cntl_filename
127  stop hecmw_exit_input
128  end if
129 
130  version =0
131  do
132  rcode = fstr_ctrl_get_c_h_name( ctrl, header_name, hecmw_name_len )
133  if( header_name == '!VERSION' ) then
134  rcode = fstr_ctrl_get_data_ex( ctrl, 1, 'i ', version )
135  else if( header_name == '!SOLUTION' ) then
136  c_solution = c_solution + 1
137  call fstr_setup_solution( ctrl, c_solution, p )
138  else if( header_name == '!NONLINEAR_SOLVER' ) then
139  c_nlsolver = c_nlsolver + 1
140  call fstr_setup_nonlinear_solver( ctrl, c_nlsolver, p )
141  else if( header_name == '!SOLVER' ) then
142  c_solver = c_solver + 1
143  call fstr_setup_solver( ctrl, c_solver, p )
144  else if( header_name == '!ISTEP' ) then
145  c_istep = c_istep + 1
146  else if( header_name == '!STEP' ) then
147  if( version==0 ) then
148  c_step = c_step + 1
149  call fstr_setup_step( ctrl, c_step, p )
150  else
151  c_istep = c_istep + 1
152  endif
153  else if( header_name == '!WRITE' ) then
154  call fstr_ctrl_get_output( ctrl, outctrl, islog, result, visual, femap )
155  if( visual==1 ) p%PARAM%fg_visual= 1
156  if( result==1 ) p%PARAM%fg_result = 1
157  c_output = c_output+1
158  else if( header_name == '!ECHO' ) then
159  c_echo = c_echo + 1
160  call fstr_setup_echo( ctrl, c_echo, p )
161  else if( header_name == '!RESTART' ) then
162  call fstr_setup_restart( ctrl, nout, p%PARAM%restart_version )
163  fstrsolid%restart_nout= nout
164  fstrdynamic%restart_nout= nout
165  fstrheat%restart_nout= nout
166  else if( header_name == '!ORIENTATION' ) then
167  c_localcoord = c_localcoord + 1
168  else if( header_name == '!AUTOINC_PARAM' ) then
169  c_aincparam = c_aincparam + 1
170  else if( header_name == '!CONVERG_PARAM' ) then
171  c_cnvparam = c_cnvparam + 1
172  else if( header_name == '!TIME_POINTS' ) then
173  c_timepoints = c_timepoints + 1
174  else if( header_name == '!OUTPUT_SSTYPE' ) then
175  call fstr_setup_output_sstype( ctrl, p )
176  else if( header_name == '!INITIAL_CONDITION' ) then
177  c_initial = c_initial + 1
178  else if( header_name == '!AMPLITUDE' ) then
179  c_amplitude = c_amplitude + 1
180  call fstr_setup_amplitude( ctrl, p )
181  else if( header_name == '!ELEMENT_ACTIVATION' ) then
182  c_elemact = c_elemact + 1
183  call fstr_setup_element_activation( ctrl, c_elemact, p )
184 
185  !--------------- for static -------------------------
186 
187  else if( header_name == '!STATIC' ) then
188  c_static = c_static + 1
189  call fstr_setup_static( ctrl, c_static, p )
190  else if( header_name == '!BOUNDARY' ) then
191  c_boundary = c_boundary + 1
192  call fstr_setup_boundary( ctrl, c_boundary, p )
193  else if( header_name == '!CLOAD' ) then
194  c_cload = c_cload + 1
195  call fstr_setup_cload( ctrl, c_cload, p )
196  n = fstr_ctrl_get_data_line_n( ctrl )
197  else if( header_name == '!DLOAD' ) then
198  c_dload = c_dload + 1
199  call fstr_setup_dload( ctrl, c_dload, p )
200  else if( header_name == '!CONTACT_ALGO' ) then
201  call fstr_setup_contactalgo( ctrl, p )
202  else if( header_name == '!CONTACT' ) then
203  n = fstr_ctrl_get_data_line_n( ctrl )
204  c_contact = c_contact + n
205  else if( header_name == '!EMBED' ) then
206  n = fstr_ctrl_get_data_line_n( ctrl )
207  c_embed = c_embed + n
208  else if( header_name == '!CONTACT_PARAM' ) then
209  c_contactparam = c_contactparam + 1
210  else if( header_name == '!CONTACT_INTERFERENCE' ) then
211  n = fstr_ctrl_get_data_line_n( ctrl )
212  c_contact_if = c_contact_if + n
213  else if( header_name == '!MATERIAL' ) then
214  c_material = c_material + 1
215  else if( header_name == '!TEMPERATURE' ) then
216  c_temperature = c_temperature + 1
217  call fstr_setup_temperature( ctrl, c_temperature, p )
218  else if( header_name == '!SPRING' ) then
219  c_spring = c_spring + 1
220  call fstr_setup_spring( ctrl, c_spring, p )
221  else if( header_name == '!REFTEMP' ) then
222  c_reftemp = c_reftemp + 1
223  call fstr_setup_reftemp( ctrl, c_reftemp, p )
224 
225  !--------------- for heat -------------------------
226 
227  else if( header_name == '!HEAT' ) then
228  c_heat = c_heat + 1
229  else if( header_name == '!FIXTEMP' ) then
230  c_fixtemp = c_fixtemp + 1
231  call fstr_setup_fixtemp( ctrl, c_fixtemp, p )
232  else if( header_name == '!CFLUX' ) then
233  c_cflux = c_cflux + 1
234  call fstr_setup_cflux( ctrl, c_cflux, p )
235  else if( header_name == '!DFLUX' ) then
236  c_dflux = c_dflux + 1
237  call fstr_setup_dflux( ctrl, c_dflux, p )
238  else if( header_name == '!SFLUX' ) then
239  c_sflux = c_sflux + 1
240  call fstr_setup_sflux( ctrl, c_sflux, p )
241  else if( header_name == '!FILM' ) then
242  c_film = c_film + 1
243  call fstr_setup_film( ctrl, c_film, p )
244  else if( header_name == '!SFILM' ) then
245  c_sfilm = c_sfilm + 1
246  call fstr_setup_sfilm( ctrl, c_sfilm, p )
247  else if( header_name == '!RADIATE' ) then
248  c_radiate = c_radiate + 1
249  call fstr_setup_radiate( ctrl, c_radiate, p )
250  else if( header_name == '!SRADIATE' ) then
251  c_sradiate = c_sradiate + 1
252  call fstr_setup_sradiate( ctrl, c_sradiate, p )
253  else if( header_name == '!WELD_LINE' ) then
254  c_weldline = c_weldline + 1
255 
256  !--------------- for eigen -------------------------
257 
258  else if( header_name == '!EIGEN' ) then
259  c_eigen = c_eigen + 1
260  call fstr_setup_eigen( ctrl, c_eigen, p )
261 
262  !--------------- for dynamic -------------------------
263 
264  else if( header_name == '!DYNAMIC' ) then
265  c_dynamic = c_dynamic + 1
266  call fstr_setup_dynamic( ctrl, c_eigen, p )
267  else if( header_name == '!VELOCITY' ) then
268  c_velocity = c_velocity + 1
269  call fstr_setup_velocity( ctrl, c_eigen, p )
270  else if( header_name == '!ACCELERATION' ) then
271  c_acceleration = c_acceleration + 1
272  call fstr_setup_acceleration( ctrl, c_eigen, p )
273  else if( header_name == '!FLOAD' ) then
274  c_fload = c_fload + 1
275  call fstr_setup_fload( ctrl , c_fload, p )
276  else if( header_name == '!FACCELERATION' ) then
277  ! acceleration input of the frequency response analysis
278  c_facc = c_facc + 1
279  call fstr_setup_facceleration( ctrl, c_facc, p )
280  else if( header_name == '!EIGENREAD' ) then
281  c_eigenread = c_eigenread + 1
282  call fstr_setup_eigenread( ctrl, c_eigenread, p )
283 
284  !--------------- for couple -------------------------
285 
286  else if( header_name == '!COUPLE' ) then
287  c_couple = c_couple + 1
288  call fstr_setup_couple( ctrl, c_couple, p )
289 
290  !--------------- for mpc -------------------------
291 
292  else if( header_name == '!MPC' ) then
293  c_mpc = c_mpc + 1
294  call fstr_setup_mpc( ctrl, c_mpc, p )
295 
296  !--------------------- for input -------------------------
297 
298  else if( header_name == '!INCLUDE' ) then
299  ctrl_list(ictrl) = ctrl
300  input_filename = ""
301  ierror = fstr_ctrl_get_param_ex( ctrl, 'INPUT ', '# ', 0, 'F', input_filename )
302  ctrl = fstr_ctrl_open( input_filename )
303  if( ctrl < 0 ) then
304  write(*,*) '### Error: Cannot open FSTR control file : ', input_filename
305  write(ilog,*) '### Error: Cannot open FSTR control file : ', input_filename
306  stop hecmw_exit_input
307  end if
308  ictrl = ictrl + 1
309  cycle
310 
311  !--------------------- END -------------------------
312 
313  else if( header_name == '!END' ) then
314  exit
315  end if
316 
317  ! next
318  if( fstr_ctrl_seek_next_header(ctrl) == 0 )then
319  if( ictrl == 1 )then
320  exit
321  else
322  ierror= fstr_ctrl_close( ctrl )
323  ictrl = ictrl - 1
324  ctrl = ctrl_list(ictrl)
325  if( fstr_ctrl_seek_next_header(ctrl) == 0 ) exit
326  endif
327  endif
328  end do
329 
330  ! -----
331  fstrsolid%n_contacts = c_contact
332  if( c_contact>0 ) then
333  allocate( fstrsolid%contacts( c_contact ) )
334  ! convert SURF_SURF contact to NODE_SURF contact
335  call fstr_convert_contact_type( p%MESH )
336  endif
337  call fstr_convert_rotation_dof( p )
338  fstrsolid%n_embeds = c_embed
339  if( c_embed>0 ) allocate( fstrsolid%embeds( c_embed ) )
340  if( c_weldline>0 ) allocate( fstrheat%weldline( c_weldline ) )
341  if( c_initial>0 ) allocate( g_initialcnd( c_initial ) )
342  if( c_istep>0 ) then
343  allocate( fstrsolid%step_ctrl( c_istep ) )
344  do i=1, c_istep
345  call init_stepinfo( fstrsolid%step_ctrl(i) )
346  if( p%PARAM%solution_type==kstdynamic ) then
347  fstrsolid%step_ctrl(i)%num_substep = fstrdynamic%n_step
348  fstrsolid%step_ctrl(i)%initdt = fstrdynamic%t_delta
349  fstrsolid%step_ctrl(i)%elapsetime = dble(fstrdynamic%n_step) * fstrdynamic%t_delta
350  fstrsolid%step_ctrl(i)%mindt = fstrdynamic%t_delta
351  fstrsolid%step_ctrl(i)%maxdt = fstrdynamic%t_delta
352  endif
353  end do
354  endif
355  if( c_localcoord>0 ) allocate( g_localcoordsys(c_localcoord) )
356  allocate( fstrparam%ainc(0:c_aincparam) )
357  do i=0,c_aincparam
358  call init_aincparam( fstrparam%ainc(i) )
359  end do
360  allocate( fstrparam%cnvparam(0:c_cnvparam) )
361  do i=0,c_cnvparam
362  call init_convergparam( fstrparam%cnvparam(i) )
363  end do
364  if( c_timepoints>0 ) allocate( fstrparam%timepoints(c_timepoints) )
365  allocate( fstrparam%contactparam(0:c_contactparam) )
366  do i=0,c_contactparam
367  call init_contactparam( fstrparam%contactparam(i) )
368  end do
369  if( c_contact_if>0 )then
370  allocate( fstrparam%contact_if( c_contact_if ) )
371  do i=1,c_contact_if
372  call init_contact_if( fstrparam%contact_if(i) )
373  end do
374  end if
375 
376  p%SOLID%is_33shell = 0
377  p%SOLID%is_33beam = 0
378 
379  do i=1,hecmesh%n_elem_type
380  n = hecmesh%elem_type_item(i)
381  if (n == 781 .or. n == 761)then
382  p%SOLID%is_33shell = 1
383  elseif (n == 641)then
384  p%SOLID%is_33beam = 1
385  endif
386  enddo
387 
388  n = c_material
389  if( hecmesh%material%n_mat>n ) n= hecmesh%material%n_mat
390  if( n==0 ) stop "material property not defined!"
391  allocate( fstrsolid%materials( n ) )
392  do i = 1, n
393  call initmaterial(fstrsolid%materials(i))
394  enddo
395 
396  ! for section control
397  allocate( fstrsolid%sections(hecmesh%section%n_sect) )
398  do i=1,hecmesh%section%n_sect
399  ! set default 361 element formulation
400  if( p%PARAM%solution_type==kststatic .or. p%PARAM%solution_type==kstdynamic ) then
401  if( p%PARAM%nlgeom ) then
402  fstrsolid%sections(i)%elemopt361 = kel361fbar
403  else
404  fstrsolid%sections(i)%elemopt361 = kel361ic
405  end if
406  else if( p%PARAM%solution_type==ksteigen ) then
407  fstrsolid%sections(i)%elemopt361 = kel361ic
408  else if( p%PARAM%solution_type==kststaticeigen ) then
409  fstrsolid%sections(i)%elemopt361 = kel361fbar
410  else
411  fstrsolid%sections(i)%elemopt361 = kel361fi
412  end if
413  fstrsolid%sections(i)%elemopt341 = kel341fi
414  fstrsolid%sections(i)%elemopt611 = kel611euler
415  ! INTERFACE sections are skipped in the loop below and keep this thickness
416  fstrsolid%sections(i)%thickness = 1.0d0
417  enddo
418 
419  if( hecmesh%section%n_sect >0 ) then
420  do i=1,hecmesh%section%n_sect
421  if( hecmesh%section%sect_type(i) == 4 ) cycle
422  cid = hecmesh%section%sect_mat_ID_item(i)
423  if( cid>n ) stop "Error in material property definition!"
424  if( fstrparam%nlgeom .or. fstrparam%solution_type==kststaticeigen ) &
425  fstrsolid%materials(cid)%nlgeom_flag = 1
426  nullify(shmat)
427  call fstr_get_prop(hecmesh,shmat,i,ee,pp,rho,alpha,thick,&
428  n_totlyr,alpha_over_mu, &
429  beam_radius,beam_angle1,beam_angle2,beam_angle3, &
430  beam_angle4,beam_angle5,beam_angle6)
431  fstrsolid%sections(i)%thickness = thick
432  fstrsolid%materials(cid)%name = hecmesh%material%mat_name(cid)
433  fstrsolid%materials(cid)%variables(m_youngs)=ee
434  fstrsolid%materials(cid)%variables(m_poisson)=pp
435  fstrsolid%materials(cid)%variables(m_density)=rho
436  fstrsolid%materials(cid)%variables(m_expansion)=alpha
437  fstrsolid%materials(cid)%variables(m_alpha_over_mu)= alpha_over_mu
438  fstrsolid%materials(cid)%variables(m_beam_radius)=beam_radius
439  fstrsolid%materials(cid)%variables(m_beam_angle1)=beam_angle1
440  fstrsolid%materials(cid)%variables(m_beam_angle2)=beam_angle2
441  fstrsolid%materials(cid)%variables(m_beam_angle3)=beam_angle3
442  fstrsolid%materials(cid)%variables(m_beam_angle4)=beam_angle4
443  fstrsolid%materials(cid)%variables(m_beam_angle5)=beam_angle5
444  fstrsolid%materials(cid)%variables(m_beam_angle6)=beam_angle6
445  fstrsolid%materials(cid)%mtype = elastic
446  if( hecmesh%section%sect_type(i) == 2 ) then
447  fstrsolid%materials(cid)%totallyr = n_totlyr
448  fstrsolid%materials(cid)%shell_var => shmat
449  endif
450  enddo
451  endif
452 
453  allocate( fstrsolid%output_ctrl( 4 ) )
454  call fstr_init_outctrl(fstrsolid%output_ctrl(1))
455  fstrsolid%output_ctrl( 1 )%filename = trim(logfilename)
456  fstrsolid%output_ctrl( 1 )%filenum = ilog
457  call fstr_init_outctrl(fstrsolid%output_ctrl(2))
458  call fstr_init_outctrl(fstrsolid%output_ctrl(3))
459  call fstr_init_outctrl(fstrsolid%output_ctrl(4))
460 
461  ! -----
462  rcode = fstr_ctrl_rewind( ctrl )
463 
464  c_istep = 0
465  c_heat = 0
466  c_material = 0
467  c_output = 0
468  c_contact = 0
469  c_contactparam = 0
470  c_contact_if = 0
471  c_embed = 0
472  c_initial = 0
473  c_localcoord = 0
474  c_section = 0
475  fstrheat%WL_tot = 0
476  c_elemopt = 0
477  c_aincparam = 0
478  c_timepoints = 0
479  c_cnvparam = 0
480  fstrsolid%elemopt361 = 0
481  fstrsolid%AutoINC_stat = 0
482  fstrsolid%CutBack_stat = 0
483  fstrsolid%NRstat_i(:) = 0
484  fstrsolid%NRstat_r(:) = 0.d0
485  ictrl = 1
486  do
487  rcode = fstr_ctrl_get_c_h_name( ctrl, header_name, hecmw_name_len )
488 
489  if( header_name == '!ORIENTATION' ) then
490  c_localcoord = c_localcoord + 1
491  if( fstr_setup_orientation( ctrl, hecmesh, c_localcoord, g_localcoordsys(c_localcoord) )/=0 ) then
492  write(*,*) '### Error: Fail in read in ORIENTATION definition : ', c_localcoord
493  write(ilog,*) '### Error: Fail in read in ORIENTATION definition : ', c_localcoord
494  stop hecmw_exit_input
495  endif
496 
497  ! ----- CONTACT condition setting
498  elseif( header_name == '!CONTACT' ) then
499  n = fstr_ctrl_get_data_line_n( ctrl )
500  if( .not. fstr_ctrl_get_contact( ctrl, n, fstrsolid%contacts(c_contact+1:c_contact+n) &
501  ,ee, pp, rho, alpha, p%PARAM%contact_algo, mname, k ) ) then
502  write(*,*) '### Error: Fail in read in contact condition : ', c_contact
503  write(ilog,*) '### Error: Fail in read in contact condition : ', c_contact
504  stop hecmw_exit_input
505  endif
506  cparam_id = 0
507  do i=1,size(fstrparam%contactparam)-1
508  if( hecmw_streqr( fstrparam%contactparam(i)%name, mname ) ) then
509  cparam_id = i; exit
510  endif
511  enddo
512  ! initialize contact condition (cdotp and mut are now obsolete - penalty is in tContact)
513  if( rho>0.d0 ) cgn = rho
514  if( alpha>0.d0 ) cgt = alpha
515  do i=1,n
516  fstrsolid%contacts(c_contact+i)%smoothing = k
517  if( .not. fstr_contact_check( fstrsolid%contacts(c_contact+i), p%MESH ) ) then
518  write(*,*) '### Error: Inconsistence in contact and surface definition : ' , i+c_contact
519  write(ilog,*) '### Error: Inconsistence in contact and surface definition : ', i+c_contact
520  stop hecmw_exit_model
521  else
522  isok = fstr_contact_init( fstrsolid%contacts(c_contact+i), p%MESH, fstrparam%contactparam(cparam_id))
523  ! !CONTACT_ALGO, FRICTION_CONE=FOLLOW gives up the symmetry of the ALagrange
524  ! friction terms; see getContactStiffness_Alag
525  fstrsolid%contacts(c_contact+i)%symmetric = .not. p%PARAM%fric_cone_follow
526  fstrsolid%contacts(c_contact+i)%eps_fric_band = p%PARAM%eps_fric_band
527  endif
528  if( fstrsolid%contacts(c_contact+i)%method == contacts2s ) then
529  ! Only the static path is wired for MORTAR=YES. The implicit dynamic solver calls
530  ! the shared scan / matrix connectivity / stiffness routines, so the pair would be
531  ! dispatched to the mortar code, but it never calls fstr_begin_lambda_txn /
532  ! fstr_commit_lambda_txn and the multipliers would not advance over the substeps.
533  ! The explicit solver applies the NODE-SURF scan to every pair regardless of the
534  ! method. Both would be silent, so this must be an error.
535  ! ELEMCHECK and NZPROF run no analysis at all (fstr_input_precheck returns before
536  ! the solver dispatch and never touches the contact pairs), so they are let through.
537  if( p%PARAM%solution_type /= kststatic .and. &
538  & p%PARAM%solution_type /= kstprecheck .and. &
539  & p%PARAM%solution_type /= kstnzprof ) then
540  write(*,*) '### Error: MORTAR=YES is supported only in static analysis : ', i+c_contact
541  write(ilog,*) '### Error: MORTAR=YES is supported only in static analysis : ', i+c_contact
542  write(*,*) ' Specify !SOLUTION, TYPE=STATIC or TYPE=NLSTATIC.'
543  write(ilog,*) ' Specify !SOLUTION, TYPE=STATIC or TYPE=NLSTATIC.'
544  stop hecmw_exit_model
545  endif
546  ! Restart is not supported. The restart file keeps the node-level contact state
547  ! only (contacts(i)%states over contacts(i)%slave), so the segment states in
548  ! slave_surf and the converged multipliers are not saved. A resumed run would
549  ! start with every segment free and without the warm start, and the initial scan
550  ! is skipped on restart, so the difference would be silent.
551  if( fstrsolid%restart_nout < 0 ) then
552  write(*,*) '### Error: MORTAR=YES does not support restart : ', i+c_contact
553  write(ilog,*) '### Error: MORTAR=YES does not support restart : ', i+c_contact
554  write(*,*) ' The contact state of mortar pairs is not saved in the restart file.'
555  write(ilog,*) ' The contact state of mortar pairs is not saved in the restart file.'
556  stop hecmw_exit_model
557  endif
558  if( p%PARAM%contact_algo == kcaslagrange ) then
559  write(*,*) '### Error: MORTAR=YES is not supported with !CONTACT_ALGO TYPE=SLAGRANGE : ', i+c_contact
560  write(ilog,*) '### Error: MORTAR=YES is not supported with !CONTACT_ALGO TYPE=SLAGRANGE : ', i+c_contact
561  stop hecmw_exit_model
562  endif
563  if( fstrsolid%contacts(c_contact+i)%surf_id1_sgrp <= 0 ) then
564  write(*,*) '### Error: MORTAR=YES requires !CONTACT_PAIR TYPE=SURF-SURF : ', i+c_contact
565  write(ilog,*) '### Error: MORTAR=YES requires !CONTACT_PAIR TYPE=SURF-SURF : ', i+c_contact
566  stop hecmw_exit_model
567  endif
568  ! Only finite sliding is implemented. With any other INTERACTION the per-integration
569  ! point tracking is skipped, and with it the activation of the slave segment, so the
570  ! assembly sees every segment as free and no contact force is produced at all
571  ! (a silent no-op). INTERACTION defaults to SSLID, so this must be an error.
572  if( fstrsolid%contacts(c_contact+i)%algtype /= contactfslid ) then
573  write(*,*) '### Error: MORTAR=YES is supported only with INTERACTION=FSLID : ', i+c_contact
574  write(ilog,*) '### Error: MORTAR=YES is supported only with INTERACTION=FSLID : ', i+c_contact
575  write(*,*) ' Specify INTERACTION=FSLID on !CONTACT (the default is SSLID).'
576  write(ilog,*) ' Specify INTERACTION=FSLID on !CONTACT (the default is SSLID).'
577  stop hecmw_exit_model
578  endif
579  if( fstrsolid%contacts(c_contact+i)%smoothing /= kcsnone ) then
580  write(*,*) '### Error: MORTAR=YES is not supported with SMOOTHING= : ', i+c_contact
581  write(ilog,*) '### Error: MORTAR=YES is not supported with SMOOTHING= : ', i+c_contact
582  stop hecmw_exit_model
583  endif
584  ! Visibility guard: the mortar integral of a slave segment needs every master face
585  ! it can project onto, so a rank owning slave faces must see the entire master
586  ! surface (owned + ghost), which !PARTITION, CONTACT_OWNER=SLAVE provides. Verified
587  ! by comparing the visible master count with the global owned-only count.
588  ! Serial (np=1) skips the block, so the numerical path is unchanged.
589  if( hecmw_comm_get_size() > 1 ) then
590  ss_nslav = size( fstrsolid%contacts(c_contact+i)%slave_surf )
591  ss_nmas_vis = size( fstrsolid%contacts(c_contact+i)%master )
592  ss_nmas_glob = fstrsolid%contacts(c_contact+i)%n_master_owned
593  call hecmw_allreduce_i1( p%MESH, ss_nmas_glob, hecmw_sum )
594  ! a slave-owning rank must see every master face; flag incomplete ghost
595  if( ss_nslav > 0 .and. ss_nmas_vis /= ss_nmas_glob ) then
596  ss_bad = 1
597  else
598  ss_bad = 0
599  endif
600  call hecmw_allreduce_i1( p%MESH, ss_bad, hecmw_max )
601  if( ss_bad /= 0 ) then
602  write(*,*) '### Error: MORTAR=YES contact pair has incomplete master ghost : ', i+c_contact
603  write(ilog,*) '### Error: MORTAR=YES contact pair has incomplete master ghost : ', i+c_contact
604  write(*,*) ' A rank owning slave faces cannot see the full master surface.'
605  write(ilog,*) ' A rank owning slave faces cannot see the full master surface.'
606  write(*,*) ' Re-partition the mesh with !PARTITION, CONTACT_OWNER=SLAVE,'
607  write(ilog,*) ' Re-partition the mesh with !PARTITION, CONTACT_OWNER=SLAVE,'
608  write(*,*) ' or run serial (np=1).'
609  write(ilog,*) ' or run serial (np=1).'
610  stop hecmw_exit_model
611  endif
612  endif
613  endif
614  enddo
615  c_contact = c_contact+n
616 
617  ! ----- EMBED condition setting
618  elseif( header_name == '!EMBED' ) then
619  n = fstr_ctrl_get_data_line_n( ctrl )
620  if( .not. fstr_ctrl_get_embed( ctrl, n, fstrsolid%embeds(c_embed+1:c_embed+n), mname, k ) ) then
621  write(*,*) '### Error: Fail in read in embed condition : ', c_embed
622  write(ilog,*) '### Error: Fail in read in embed condition : ', c_embed
623  stop hecmw_exit_input
624  endif
625  cparam_id = 0
626  do i=1,size(fstrparam%contactparam)-1
627  if( hecmw_streqr( fstrparam%contactparam(i)%name, mname ) ) then
628  cparam_id = i; exit
629  endif
630  enddo
631  do i=1,n
632  fstrsolid%embeds(c_embed+i)%smoothing = k
633  if( .not. fstr_contact_check( fstrsolid%embeds(c_embed+i), p%MESH ) ) then
634  write(*,*) '### Error: Inconsistence in contact and surface definition : ' , i+c_embed
635  write(ilog,*) '### Error: Inconsistence in contact and surface definition : ', i+c_embed
636  stop hecmw_exit_model
637  else
638  isok = fstr_embed_init( fstrsolid%embeds(c_embed+i), p%MESH, fstrparam%contactparam(cparam_id))
639  endif
640  enddo
641  c_embed = c_embed+n
642 
643  else if( header_name == '!ISTEP' ) then
644  c_istep = c_istep+1
645  if( .not. fstr_ctrl_get_istep( ctrl, hecmesh, fstrsolid%step_ctrl(c_istep), mname, mname2, mname3 ) ) then
646  write(*,*) '### Error: Fail in read in step definition : ' , c_istep
647  write(ilog,*) '### Error: Fail in read in step definition : ', c_istep
648  stop hecmw_exit_input
649  endif
650  call fstr_setup_step_convergence( fstrsolid%step_ctrl(c_istep), mname3, fstrparam%cnvparam, c_istep )
651  if( associated(fstrparam%timepoints) ) then
652  do i=1,size(fstrparam%timepoints)
653  if( hecmw_streqr( fstrparam%timepoints(i)%name, mname ) ) then
654  fstrsolid%step_ctrl(c_istep)%timepoint_id = i; exit
655  endif
656  enddo
657  endif
658  if( associated(fstrparam%ainc) ) then
659  do i=1,size(fstrparam%ainc)
660  if( hecmw_streqr( fstrparam%ainc(i)%name, mname2 ) ) then
661  fstrsolid%step_ctrl(c_istep)%AincParam_id = i; exit
662  endif
663  enddo
664  endif
665  else if( header_name == '!STEP' .and. version>=1 ) then
666  c_istep = c_istep+1
667  if( .not. fstr_ctrl_get_istep( ctrl, hecmesh, fstrsolid%step_ctrl(c_istep), mname, mname2, mname3 ) ) then
668  write(*,*) '### Error: Fail in read in step definition : ' , c_istep
669  write(ilog,*) '### Error: Fail in read in step definition : ', c_istep
670  stop hecmw_exit_input
671  endif
672  call fstr_setup_step_convergence( fstrsolid%step_ctrl(c_istep), mname3, fstrparam%cnvparam, c_istep )
673  ! For DYNAMIC fixed-increment: keep the !DYNAMIC time increment while preserving !STEP duration.
674  ! fstr_ctrl_get_ISTEP unconditionally sets initdt=1/num_substep which is wrong for DYNAMIC.
675  ! Only override initdt/mindt/maxdt; keep elapsetime and num_substep as-is.
676  if( p%PARAM%solution_type==kstdynamic .and. &
677  & fstrsolid%step_ctrl(c_istep)%inc_type == stepfixedinc ) then
678  fstrsolid%step_ctrl(c_istep)%initdt = fstrdynamic%t_delta
679  fstrsolid%step_ctrl(c_istep)%mindt = fstrdynamic%t_delta
680  fstrsolid%step_ctrl(c_istep)%maxdt = fstrdynamic%t_delta
681  endif
682  if( associated(fstrparam%timepoints) ) then
683  do i=1,size(fstrparam%timepoints)
684  if( hecmw_streqr( fstrparam%timepoints(i)%name, mname ) ) then
685  fstrsolid%step_ctrl(c_istep)%timepoint_id = i; exit
686  endif
687  enddo
688  endif
689  if( associated(fstrparam%ainc) ) then
690  do i=1,size(fstrparam%ainc)-1
691  if( hecmw_streqr( fstrparam%ainc(i)%name, mname2 ) ) then
692  fstrsolid%step_ctrl(c_istep)%AincParam_id = i; exit
693  endif
694  enddo
695  endif
696 
697  else if( header_name == '!HEAT' ) then
698  c_heat = c_heat + 1
699  call fstr_setup_heat( ctrl, c_heat, p )
700 
701  else if( header_name == '!WELD_LINE' ) then
702  fstrheat%WL_tot = fstrheat%WL_tot+1
703  if( fstr_ctrl_get_weldline( ctrl, hecmesh, hecmw_name_len, fstrheat%weldline(fstrheat%WL_tot) )/=0 ) then
704  write(*,*) '### Error: Fail in read in Weld Line definition : ' , fstrheat%WL_tot
705  write(ilog,*) '### Error: Fail in read in Weld Line definition : ', fstrheat%WL_tot
706  stop hecmw_exit_input
707  endif
708 
709  else if( header_name == '!INITIAL_CONDITION' .or. header_name == '!INITIAL CONDITION' ) then
710  c_initial = c_initial+1
711  if( fstr_setup_initial( ctrl, g_initialcnd(c_initial), p%MESH )/=0 ) then
712  write(*,*) '### Error: Fail in read in INITIAL CONDITION definition : ' ,c_initial
713  write(ilog,*) '### Error: Fail in read in INITIAL CONDITION definition : ', c_initial
714  stop hecmw_exit_input
715  endif
716 
717  else if( header_name == '!SECTION' ) then
718  c_section = c_section+1
719  if( fstr_ctrl_get_section( ctrl, hecmesh, fstrsolid%sections )/=0 ) then
720  write(*,*) '### Error: Fail in read in SECTION definition : ' , c_section
721  write(ilog,*) '### Error: Fail in read in SECTION definition : ', c_section
722  stop hecmw_exit_input
723  endif
724 
725  else if( header_name == '!ELEMOPT' ) then
726  c_elemopt = c_elemopt+1
727  if( fstr_ctrl_get_elemopt( ctrl, fstrsolid%elemopt361 )/=0 ) then
728  write(*,*) '### Error: Fail in read in ELEMOPT definition : ' , c_elemopt
729  write(ilog,*) '### Error: Fail in read in ELEMOPT definition : ', c_elemopt
730  stop hecmw_exit_input
731  endif
732 
733  !== following material properties ==
734  else if( header_name == '!MATERIAL' ) then
735  c_material = c_material+1
736  if( fstr_ctrl_get_material( ctrl, mname )/=0 ) then
737  write(*,*) '### Error: Fail in read in material definition : ' , c_material
738  write(ilog,*) '### Error: Fail in read in material definition : ', c_material
739  stop hecmw_exit_input
740  endif
741  cid = 0
742  if(cache < hecmesh%material%n_mat) then
743  if(hecmw_streqr( hecmesh%material%mat_name(cache), mname ))then
744  cid = cache
745  cache = cache + 1
746  endif
747  endif
748  if(cid == 0)then
749  do i=1,hecmesh%material%n_mat
750  if( hecmw_streqr( hecmesh%material%mat_name(i), mname ) ) then
751  cid = i
752  cache = i + 1
753  exit
754  endif
755  enddo
756  endif
757  if(cid == 0)then
758  write(*,*) '### Error: Fail in read in material definition : ' , c_material
759  write(ilog,*) '### Error: Fail in read in material definition : ', c_material
760  stop hecmw_exit_input
761  endif
762  fstrsolid%materials(cid)%name = hecmesh%material%mat_name(cid)
763  if(c_material>hecmesh%material%n_mat) call initmaterial( fstrsolid%materials(cid) )
764 
765  else if( header_name == '!ELASTIC' ) then
766  if( c_material >0 ) then
767  if( fstr_ctrl_get_elasticity( ctrl, &
768  fstrsolid%materials(cid)%mtype, &
769  fstrsolid%materials(cid)%nlgeom_flag, &
770  fstrsolid%materials(cid)%variables, &
771  fstrsolid%materials(cid)%dict)/=0 ) then
772  write(*,*) '### Error: Fail in read in elasticity definition : ' , cid
773  write(ilog,*) '### Error: Fail in read in elasticity definition : ', cid
774  stop hecmw_exit_input
775  endif
776  endif
777  else if( header_name == '!PLASTIC' ) then
778  if( cid >0 ) then
779  if( fstr_ctrl_get_plasticity( ctrl, &
780  fstrsolid%materials(cid)%mtype, &
781  fstrsolid%materials(cid)%nlgeom_flag, &
782  fstrsolid%materials(cid)%variables, &
783  fstrsolid%materials(cid)%table, &
784  fstrsolid%materials(cid)%dict)/=0 ) then
785  write(*,*) '### Error: Fail in read in plasticity definition : ' , cid
786  write(ilog,*) '### Error: Fail in read in plasticity definition : ', cid
787  stop hecmw_exit_input
788  endif
789  endif
790  else if( header_name == '!HYPERELASTIC' ) then
791  if( cid >0 ) then
792  if( fstr_ctrl_get_hyperelastic( ctrl, &
793  fstrsolid%materials(cid)%mtype, &
794  fstrsolid%materials(cid)%nlgeom_flag, &
795  fstrsolid%materials(cid)%variables )/=0 ) then
796  write(*,*) '### Error: Fail in read in elasticity definition : ' , cid
797  write(ilog,*) '### Error: Fail in read in elasticity definition : ', cid
798  stop hecmw_exit_input
799  endif
800  endif
801  else if( header_name == '!VISCOELASTIC' ) then
802  if( cid >0 ) then
803  if( fstr_ctrl_get_viscoelasticity( ctrl, &
804  fstrsolid%materials(cid)%mtype, &
805  fstrsolid%materials(cid)%nlgeom_flag, &
806  fstrsolid%materials(cid)%dict)/=0 ) then
807  write(*,*) '### Error: Fail in read in plasticity definition : ' , cid
808  write(ilog,*) '### Error: Fail in read in plasticity definition : ', cid
809  stop hecmw_exit_input
810  endif
811  endif
812  else if( header_name == '!TRS' ) then
813  if( cid >0 ) then
814  if( fstrsolid%materials(cid)%mtype/=viscoelastic ) then
815  write(*,*) '### WARNING: TRS can only be defined for viscoelastic material! It is ignored! '
816  write(ilog,*) '### WARNING: TRS can only be defined for viscoelastic material! It is ignored! '
817  else
818  if( fstr_ctrl_get_trs( ctrl, fstrsolid%materials(cid)%mtype, fstrsolid%materials(cid)%variables)/=0 ) then
819  write(*,*) '### Error: Fail in read in TRS definition : ' , cid
820  write(ilog,*) '### Error: Fail in read in TRS definition : ', cid
821  stop hecmw_exit_input
822  endif
823  endif
824  endif
825  else if( header_name == '!CREEP' ) then
826  if( cid >0 ) then
827  if( fstr_ctrl_get_viscoplasticity( ctrl, &
828  fstrsolid%materials(cid)%mtype, &
829  fstrsolid%materials(cid)%nlgeom_flag, &
830  fstrsolid%materials(cid)%dict)/=0 ) then
831  write(*,*) '### Error: Fail in read in plasticity definition : ' , cid
832  write(ilog,*) '### Error: Fail in read in plasticity definition : ', cid
833  stop hecmw_exit_input
834  endif
835  endif
836  else if( header_name == '!DENSITY' ) then
837  if( cid >0 ) then
838  if( fstr_ctrl_get_density( ctrl, fstrsolid%materials(cid)%variables )/=0 ) then
839  write(*,*) '### Error: Fail in read in density definition : ' , cid
840  write(ilog,*) '### Error: Fail in read in density definition : ', cid
841  stop hecmw_exit_input
842  endif
843  endif
844  else if( header_name == '!EXPANSION_COEF' .or. header_name == '!EXPANSION_COEFF' .or. &
845  header_name == '!EXPANSION') then
846  if( cid >0 ) then
847  if( fstr_ctrl_get_expansion_coeff( ctrl, fstrsolid%materials(cid)%variables, &
848  fstrsolid%materials(cid)%dict)/=0 ) then
849  write(*,*) '### Error: Fail in read in expansion coefficient definition : ' , cid
850  write(ilog,*) '### Error: Fail in read in expansion coefficient definition : ', cid
851  stop hecmw_exit_input
852  endif
853  endif
854  else if( header_name == '!DAMPING') then
855  if( cid >0 ) then
856  if( fstr_ctrl_get_rayleigh_damping( ctrl, fstrsolid%materials(cid)%variables, &
857  fstrsolid%materials(cid)%is_elem_Rayleigh_damping)/=0 ) then
858  write(*,*) '### Error: Fail in read in damping definition : ' , cid
859  write(ilog,*) '### Error: Fail in read in damping definition : ', cid
860  stop hecmw_exit_input
861  endif
862  endif
863  else if( header_name == '!FLUID' ) then
864  if( c_material >0 ) then
865  if( fstr_ctrl_get_fluid( ctrl, &
866  fstrsolid%materials(cid)%mtype, &
867  fstrsolid%materials(cid)%nlgeom_flag, &
868  fstrsolid%materials(cid)%variables, &
869  fstrsolid%materials(cid)%dict)/=0 ) then
870  write(*,*) '### Error: Fail in read in fluid definition : ' , cid
871  write(ilog,*) '### Error: Fail in read in fluid definition : ', cid
872  stop hecmw_exit_input
873  endif
874  endif
875  else if( header_name == '!SPRING_D' ) then
876  if( c_material >0 ) then
877  if( fstr_ctrl_get_spring_d( ctrl, &
878  fstrsolid%materials(cid)%mtype, &
879  fstrsolid%materials(cid)%nlgeom_flag, &
880  fstrsolid%materials(cid)%variables_i, &
881  fstrsolid%materials(cid)%dict)/=0 ) then
882  write(*,*) '### Error: Fail in read in spring_d definition : ' , cid
883  write(ilog,*) '### Error: Fail in read in spring_d definition : ', cid
884  stop hecmw_exit_input
885  endif
886  endif
887  else if( header_name == '!SPRING_A' ) then
888  if( c_material >0 ) then
889  if( fstr_ctrl_get_spring_a( ctrl, &
890  fstrsolid%materials(cid)%mtype, &
891  fstrsolid%materials(cid)%nlgeom_flag, &
892  fstrsolid%materials(cid)%variables_i, &
893  fstrsolid%materials(cid)%dict)/=0 ) then
894  write(*,*) '### Error: Fail in read in spring_a definition : ' , cid
895  write(ilog,*) '### Error: Fail in read in spring_a definition : ', cid
896  stop hecmw_exit_input
897  endif
898  endif
899  else if( header_name == '!DASHPOT_D' ) then
900  if( c_material >0 ) then
901  if( fstr_ctrl_get_dashpot_d( ctrl, &
902  fstrsolid%materials(cid)%mtype, &
903  fstrsolid%materials(cid)%nlgeom_flag, &
904  fstrsolid%materials(cid)%variables_i, &
905  fstrsolid%materials(cid)%dict)/=0 ) then
906  write(*,*) '### Error: Fail in read in spring_d definition : ' , cid
907  write(ilog,*) '### Error: Fail in read in spring_d definition : ', cid
908  stop hecmw_exit_input
909  endif
910  endif
911  else if( header_name == '!DASHPOT_A' ) then
912  if( c_material >0 ) then
913  if( fstr_ctrl_get_dashpot_a( ctrl, &
914  fstrsolid%materials(cid)%mtype, &
915  fstrsolid%materials(cid)%nlgeom_flag, &
916  fstrsolid%materials(cid)%variables_i, &
917  fstrsolid%materials(cid)%dict)/=0 ) then
918  write(*,*) '### Error: Fail in read in spring_a definition : ' , cid
919  write(ilog,*) '### Error: Fail in read in spring_a definition : ', cid
920  stop hecmw_exit_input
921  endif
922  endif
923  else if( header_name == '!USER_MATERIAL' ) then
924  if( cid >0 ) then
925  if( fstr_ctrl_get_usermaterial( ctrl, fstrsolid%materials(cid)%mtype, &
926  fstrsolid%materials(cid)%nlgeom_flag, fstrsolid%materials(cid)%nfstatus, &
927  fstrsolid%materials(cid)%variables(101:) )/=0 ) then
928  write(*,*) '### Error: Fail in read in user defined material : ' , cid
929  write(ilog,*) '### Error: Fail in read in user defined material : ', cid
930  stop hecmw_exit_input
931  endif
932  endif
933 
934 
935  ! == Following output control ==
936  else if( header_name == '!WRITE' ) then
937  call fstr_ctrl_get_output( ctrl, outctrl, islog, result, visual, femap )
938  if( islog == 1 ) then
939  c_output=1
940  outctrl%filename = trim(logfilename)
941  outctrl%filenum = ilog
942  call fstr_copy_outctrl(fstrsolid%output_ctrl(c_output), outctrl)
943  endif
944  if( femap == 1 ) then
945  c_output=2
946  write( outctrl%filename, '(a,i0,a)') 'utable.',myrank,'.dat'
947  outctrl%filenum = iutb
948  call fstr_copy_outctrl(fstrsolid%output_ctrl(c_output), outctrl)
949  open( unit=outctrl%filenum, file=outctrl%filename, status='REPLACE', iostat=ierror )
950  if( ierror /= 0 ) then
951  write(*,*) 'Warning: cannot open output file: ', trim(outctrl%filename)
952  endif
953  fstrsolid%output_ctrl(c_output)%outinfo%grp_id = 1
954  endif
955  if( result == 1 ) then
956  c_output=3
957  call fstr_copy_outctrl(fstrsolid%output_ctrl(c_output), outctrl)
958  endif
959  if( visual == 1 ) then
960  c_output=4
961  call fstr_copy_outctrl(fstrsolid%output_ctrl(c_output), outctrl)
962  endif
963 
964  else if( header_name == '!OUTPUT_RES' ) then
965  c_output=3
966  if( .not. fstr_ctrl_get_outitem( ctrl, hecmesh, fstrsolid%output_ctrl(c_output)%outinfo ) ) then
967  write(*,*) '### Error: Fail in read in node output definition : ' , c_output
968  write(ilog,*) '### Error: Fail in read in node output definition : ', c_output
969  stop hecmw_exit_input
970  endif
971  if( fstrsolid%output_ctrl(c_output)%outinfo%grp_id_name /= 'ALL' ) then
972  c_output=2
973  do i=1,hecmesh%node_group%n_grp
974  if( fstrsolid%output_ctrl(c_output)%outinfo%grp_id_name == hecmesh%node_group%grp_name(i) ) then
975  fstrsolid%output_ctrl(c_output)%outinfo%grp_id = i; exit
976  endif
977  enddo
978  endif
979  else if( header_name == '!OUTPUT_VIS' ) then
980  c_output=4
981  if( .not. fstr_ctrl_get_outitem( ctrl, hecmesh, fstrsolid%output_ctrl(c_output)%outinfo ) ) then
982  write(*,*) '### Error: Fail in read in element output definition : ' , c_output
983  write(ilog,*) '### Error: Fail in read in element output definition : ', c_output
984  stop hecmw_exit_input
985  endif
986  if( fstrsolid%output_ctrl(c_output)%outinfo%grp_id_name /= 'ALL' ) then
987  c_output=2
988  do i=1,hecmesh%node_group%n_grp
989  if( fstrsolid%output_ctrl(c_output)%outinfo%grp_id_name == hecmesh%node_group%grp_name(i) ) then
990  fstrsolid%output_ctrl(c_output)%outinfo%grp_id = i; exit
991  endif
992  enddo
993  endif
994  else if( header_name == '!AUTOINC_PARAM' ) then
995  c_aincparam = c_aincparam + 1
996  if( fstr_get_autoinc( ctrl, fstrparam%ainc(c_aincparam) ) /=0 ) then
997  write(*,*) '### Error: Fail in read in AUTOINC_PARAM definition : ' , c_aincparam
998  write(ilog,*) '### Error: Fail in read in AUTOINC_PARAM definition : ', c_aincparam
999  stop hecmw_exit_input
1000  endif
1001  else if( header_name == '!CONVERG_PARAM' ) then
1002  c_cnvparam = c_cnvparam + 1
1003  if( fstr_ctrl_get_convergparam( ctrl, fstrparam%cnvparam(c_cnvparam) ) /=0 ) then
1004  write(*,*) '### Error: Fail in read in CONVERG_PARAM definition : ' , c_cnvparam
1005  write(ilog,*) '### Error: Fail in read in CONVERG_PARAM definition : ', c_cnvparam
1006  stop hecmw_exit_input
1007  endif
1008  else if( header_name == '!TIME_POINTS' ) then
1009  c_timepoints = c_timepoints + 1
1010  if( fstr_ctrl_get_timepoints( ctrl, fstrparam%timepoints(c_timepoints) )/=0 ) then
1011  write(*,*) '### Error: Fail in read in TIME_POINTS definition : ' , c_timepoints
1012  write(ilog,*) '### Error: Fail in read in TIME_POINTS definition : ', c_timepoints
1013  stop hecmw_exit_input
1014  endif
1015  else if( header_name == '!CONTACT_PARAM' ) then
1016  c_contactparam = c_contactparam + 1
1017  if( fstr_ctrl_get_contactparam( ctrl, fstrparam%contactparam(c_contactparam) ) /=0 ) then
1018  write(*,*) '### Error: Fail in read in CONTACT_PARAM definition : ' , c_contactparam
1019  write(ilog,*) '### Error: Fail in read in CONTACT_PARAM definition : ', c_contactparam
1020  stop hecmw_exit_input
1021  endif
1022  else if( header_name == '!CONTACT_INTERFERENCE' ) then
1023  n = fstr_ctrl_get_data_line_n( ctrl )
1024  if( fstr_ctrl_get_contact_if( ctrl, n, fstrparam%contact_if(c_contact_if+1:c_contact_if+n) ) /= 0 ) then
1025  write(*,*) '### Error: Fail in read in CONTACT_INTERFERENCE definition : ' , c_contact_if
1026  write(ilog,*) '### Error: Fail in read in CONTACT_INTERFERENCE definition : ', c_contact_if
1027  stop hecmw_exit_input
1028  endif
1029  do i=1, n
1030  if( check_apply_contact_if(fstrparam%contact_if(c_contact_if+i), fstrsolid%contacts) /= 0) then
1031  write(*,*) '### Error:(INTERFERENCE) Inconsistence of contact_pair in CONTACTS: ' , i+c_contact_if
1032  write(ilog,*) '### Error:(INTERFERENCE) Inconsistence of contact_pair in CONTACTS: ', i+c_contact_if
1033  stop hecmw_exit_model
1034  end if
1035  end do
1036  c_contact_if = c_contact_if + n
1037  else if( header_name == '!ULOAD' ) then
1038  if( fstr_ctrl_get_userload( ctrl )/=0 ) then
1039  write(*,*) '### Error: Fail in read in ULOAD definition : '
1040  write(ilog,*) '### Error: Fail in read in ULOAD definition : '
1041  stop hecmw_exit_input
1042  endif
1043 
1044  else if( header_name == '!INCLUDE' ) then
1045  ctrl_list(ictrl) = ctrl
1046  input_filename = ""
1047  ierror = fstr_ctrl_get_param_ex( ctrl, 'INPUT ', '# ', 0, 'F', input_filename )
1048  ctrl = fstr_ctrl_open( input_filename )
1049  if( ctrl < 0 ) then
1050  write(*,*) '### Error: Cannot open FSTR control file : ', input_filename
1051  write(ilog,*) '### Error: Cannot open FSTR control file : ', input_filename
1052  stop hecmw_exit_input
1053  end if
1054  ictrl = ictrl + 1
1055  cycle
1056 
1057  else if( header_name == '!END' ) then
1058  exit
1059  endif
1060 
1061  ! next
1062  if( fstr_ctrl_seek_next_header(ctrl) == 0 )then
1063  if( ictrl == 1 )then
1064  exit
1065  else
1066  ierror= fstr_ctrl_close( ctrl )
1067  ictrl = ictrl - 1
1068  ctrl = ctrl_list(ictrl)
1069  if( fstr_ctrl_seek_next_header(ctrl) == 0 ) exit
1070  endif
1071  endif
1072 
1073  end do
1074 
1075  ! ----- material type judgement. in case of infinitive analysis, nlgeom_flag=0
1076  if( .not. p%PARAM%nlgeom ) then
1077  do i=1, c_material
1078  fstrsolid%materials(i)%nlgeom_flag = 0
1079  enddo
1080  endif
1081 
1082  if( fstrsolid%TEMP_ngrp_tot > 0 .or. fstrsolid%TEMP_irres > 0 ) then
1083  allocate ( fstrsolid%temperature( hecmesh%n_node ) ,stat=ierror )
1084  if( ierror /= 0 ) then
1085  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, TEMPERATURE>'
1086  write(idbg,*) ' rank = ', myrank,' ierror = ',ierror
1087  call flush(idbg)
1088  call hecmw_abort( hecmw_comm_get_comm())
1089  end if
1090  fstrsolid%temperature = ref_temp
1091  allocate ( fstrsolid%last_temp( hecmesh%n_node ) ,stat=ierror )
1092  if( ierror /= 0 ) then
1093  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, LAST_TEMP>'
1094  write(idbg,*) ' rank = ', myrank,' ierror = ',ierror
1095  call flush(idbg)
1096  call hecmw_abort( hecmw_comm_get_comm())
1097  end if
1098  fstrsolid%last_temp = 0.d0
1099  allocate ( fstrsolid%temp_bak( hecmesh%n_node ) ,stat=ierror )
1100  if( ierror /= 0 ) then
1101  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, TEMP_BAK>'
1102  write(idbg,*) ' rank = ', myrank,' ierror = ',ierror
1103  call flush(idbg)
1104  call hecmw_abort( hecmw_comm_get_comm())
1105  end if
1106  fstrsolid%temp_bak = 0.d0
1107  endif
1108 
1109  if( associated(fstrsolid%step_ctrl) ) then
1110  fstrsolid%nstep_tot = size(fstrsolid%step_ctrl)
1111  call setup_stepinfo_starttime( fstrsolid%step_ctrl )
1112  else
1113  if( p%PARAM%solution_type==kststatic .and. p%PARAM%nlgeom ) then
1114  write( *,* ) " ERROR: STEP not defined!"
1115  write( idbg,* ) "ERROR: STEP not defined!"
1116  call flush(idbg)
1117  call fstr_abort( hecmw_exit_model )
1118  endif
1119 
1120  if( myrank==0 ) write(*,*)"Step control not defined! Using default step=1"
1121  fstrsolid%nstep_tot = 1
1122  allocate( fstrsolid%step_ctrl(1) )
1123  call init_stepinfo( fstrsolid%step_ctrl(1) )
1124  if( p%PARAM%solution_type==kstdynamic ) then
1125  fstrsolid%step_ctrl(1)%num_substep = fstrdynamic%n_step
1126  fstrsolid%step_ctrl(1)%initdt = fstrdynamic%t_delta
1127  fstrsolid%step_ctrl(1)%elapsetime = dble(fstrdynamic%n_step) * fstrdynamic%t_delta
1128  fstrsolid%step_ctrl(1)%mindt = fstrdynamic%t_delta
1129  fstrsolid%step_ctrl(1)%maxdt = fstrdynamic%t_delta
1130  endif
1131  n = fstrsolid%BOUNDARY_ngrp_tot
1132  if( n>0 ) allocate( fstrsolid%step_ctrl(1)%Boundary(n) )
1133  do i = 1, n
1134  fstrsolid%step_ctrl(1)%Boundary(i) = fstrsolid%BOUNDARY_ngrp_GRPID(i)
1135  enddo
1136  n = fstrsolid%CLOAD_ngrp_tot + fstrsolid%DLOAD_ngrp_tot + fstrsolid%TEMP_ngrp_tot + fstrsolid%SPRING_ngrp_tot
1137  if( n>0 ) allocate( fstrsolid%step_ctrl(1)%Load(n) )
1138  n = 0
1139  do i = 1, fstrsolid%CLOAD_ngrp_tot
1140  n = n + 1
1141  fstrsolid%step_ctrl(1)%Load(n) = fstrsolid%CLOAD_ngrp_GRPID(i)
1142  enddo
1143  do i = 1, fstrsolid%DLOAD_ngrp_tot
1144  n = n + 1
1145  fstrsolid%step_ctrl(1)%Load(n) = fstrsolid%DLOAD_ngrp_GRPID(i)
1146  enddo
1147  do i = 1, fstrsolid%TEMP_ngrp_tot
1148  n = n + 1
1149  fstrsolid%step_ctrl(1)%Load(n) = fstrsolid%TEMP_ngrp_GRPID(i)
1150  enddo
1151  do i = 1, fstrsolid%SPRING_ngrp_tot
1152  n = n + 1
1153  fstrsolid%step_ctrl(1)%Load(n) = fstrsolid%SPRING_ngrp_GRPID(i)
1154  enddo
1155  n = fstrsolid%elemact%ELEMACT_egrp_tot
1156  if( n>0 ) allocate( fstrsolid%step_ctrl(1)%ElemActivation(n) )
1157  do i = 1, n
1158  fstrsolid%step_ctrl(1)%ElemActivation(i) = fstrsolid%elemact%ELEMACT_egrp_GRPID(i)
1159  enddo
1160  endif
1161 
1162  call fstr_element_init( hecmesh, fstrsolid, p%PARAM%solution_type )
1163  call fstr_check_shell_j2_inputs(hecmesh, fstrsolid, fstrparam)
1164  call fstr_check_up_inputs(hecmesh, fstrsolid)
1165  call fstr_check_shell_gauss_output(hecmesh, fstrsolid)
1166  if( p%PARAM%solution_type==kststatic .or. p%PARAM%solution_type==kstdynamic .or. &
1167  p%PARAM%solution_type==ksteigen .or. p%PARAM%solution_type==kststaticeigen ) &
1168  call fstr_solid_alloc( hecmesh, fstrsolid )
1169 
1170  if( p%PARAM%solution_type == kstheat) then
1171  p%PARAM%fg_irres = fstrsolid%output_ctrl(3)%frequency
1172  p%PARAM%fg_iwres = fstrsolid%output_ctrl(4)%frequency
1173  p%HEAT%elemact = p%SOLID%elemact
1174  endif
1175 
1176  n_totlyr = 1
1177  do i=1,hecmesh%section%n_sect
1178  cid = hecmesh%section%sect_mat_ID_item(i)
1179  n = fstrsolid%materials(cid)%totallyr
1180  if (n > n_totlyr)then
1181  n_totlyr = n
1182  endif
1183  enddo
1184  p%SOLID%max_lyr = n_totlyr
1185 
1186  call fstr_setup_post( ctrl, p )
1187  rcode = fstr_ctrl_close( ctrl )
1188 
1189  end subroutine fstr_setup
1190 
1191  subroutine fstr_check_up_inputs(hecMESH, fstrSOLID)
1192  type(hecmwst_local_mesh), intent(in) :: hecMESH
1193  type(fstr_solid), intent(in) :: fstrSOLID
1194  integer(kind=kint) :: i, isect, mtype
1195 
1196  do i = 1, hecmesh%n_elem
1197  if( hecmesh%elem_type(i) /= 361 ) cycle
1198  isect = hecmesh%section_ID(i)
1199  if( fstrsolid%sections(isect)%elemopt361 /= kel361up ) cycle
1200  if( .not.associated(fstrsolid%elements(i)%gausses) ) cycle
1201  mtype = fstrsolid%elements(i)%gausses(1)%pMaterial%mtype
1202  if( .not.iselastoplastic(mtype) .and. .not.iscreep(mtype) ) cycle
1203  write(*,*) '###ERROR### : Elastoplastic and creep materials are not supported by FORM361=UP'
1204  write(ilog,*) '###ERROR### : Elastoplastic and creep materials are not supported by FORM361=UP'
1205  call hecmw_abort(hecmw_comm_get_comm())
1206  enddo
1207  end subroutine fstr_check_up_inputs
1208 
1209  subroutine fstr_check_shell_gauss_output(hecMESH, fstrSOLID)
1211  type(hecmwst_local_mesh), intent(in) :: hecMESH
1212  type(fstr_solid), intent(in) :: fstrSOLID
1213  integer(kind=kint) :: i
1214 
1215  if( hecmesh%n_dof /= 6 ) return
1216  if( .not.any(fstrsolid%output_ctrl(3)%outinfo%on(9:10)) ) return
1217  do i=1,hecmesh%n_elem
1218  if( fstr_shell_output_point_count(fstrsolid%elements(i))>0 ) cycle
1219  write(*,*) '###ERROR### : ISTRAIN/ISTRESS require shell thickness-point output support; element type = ', &
1220  hecmesh%elem_type(i)
1221  call hecmw_abort(hecmw_comm_get_comm())
1222  enddo
1223  end subroutine fstr_check_shell_gauss_output
1224 
1225  subroutine fstr_check_shell_j2_inputs(hecMESH, fstrSOLID, fstrPARAM)
1228  use, intrinsic :: ieee_arithmetic, only: ieee_is_finite
1229  type(hecmwst_local_mesh), intent(in) :: hecMESH
1230  type(fstr_solid), intent(in) :: fstrSOLID
1231  type(fstr_param), intent(in) :: fstrPARAM
1232  type(tmaterial), pointer :: material
1233  integer(kind=kint) :: i, nn, ierr, isect, index, ilayer
1234  real(kind=kreal) :: elastic(2)
1235  logical :: missing
1236  character(len=160) :: message
1237 
1238  do i = 1, hecmesh%n_elem
1239  if( hecmesh%elem_type(i) /= 741 ) cycle
1240  if( .not.associated(fstrsolid%elements(i)%gausses) ) cycle
1241  material => fstrsolid%elements(i)%gausses(1)%pMaterial
1242  if( .not.iselastoplastic(material%mtype) ) cycle
1243  nn = hecmesh%elem_node_index(i)-hecmesh%elem_node_index(i-1)
1244  message = ''
1245  call checkplanestressj2material(material, ierr)
1246  if( ierr /= 0 ) then
1247  message = planestressj2errormessage(ierr)
1248  else if( .not.fstr_uses_plane_stress_j2_shell(741, nn, material) ) then
1249  message = 'Elastoplastic MITC4 shells require INFINITESIMAL material kinematics'
1250  else if( fstrparam%solution_type /= kststatic .or. .not.fstrparam%nlgeom ) then
1251  message = 'Elastoplastic MITC4 shells require !SOLUTION, TYPE=STATIC, NONLINEAR'
1252  else if( fstrsolid%TEMP_ngrp_tot > 0 .or. fstrsolid%TEMP_irres > 0 ) then
1253  message = 'Temperature loading is not supported in models with elastoplastic MITC4 shells'
1254  endif
1255  if( len_trim(message) == 0 .and. associated(material%shell_var) ) then
1256  ! The J2 return mapping uses the common elastic table, not layer-specific constants.
1257  call fetch_tabledata(mc_isoelastic, material%dict, elastic, missing)
1258  do ilayer = 1, material%totallyr
1259  if( .not.ieee_is_finite(material%shell_var(ilayer)%ee) .or. &
1260  .not.ieee_is_finite(material%shell_var(ilayer)%pp) ) then
1261  message = 'Invalid elastic properties in J2 shell layer'
1262  exit
1263  endif
1264  if( abs(material%shell_var(ilayer)%ee-elastic(1)) > 1.0d-12*elastic(1) .or. &
1265  abs(material%shell_var(ilayer)%pp-elastic(2)) > 1.0d-12 ) then
1266  message = 'J2 shell layers must share the !ELASTIC Young modulus and Poisson ratio'
1267  exit
1268  endif
1269  enddo
1270  endif
1271  if( len_trim(message) == 0 ) then
1272  isect = hecmesh%section_ID(i)
1273  index = hecmesh%section%sect_I_index(isect-1)
1274  if( hecmesh%section%sect_I_index(isect)-index /= 1 ) then
1275  message = 'Elastoplastic MITC4 shells require a SHELL section with 2 thickness integration points'
1276  else if( hecmesh%section%sect_I_item(index+1) /= numofshellthicknessquadpoints(741) ) then
1277  message = 'Elastoplastic MITC4 shells require 2 thickness integration points in !SECTION'
1278  endif
1279  endif
1280  if( len_trim(message) == 0 ) cycle
1281  write(*,*) '###ERROR### : ', trim(message)
1282  write(ilog,*) '###ERROR### : ', trim(message)
1283  call hecmw_abort(hecmw_comm_get_comm())
1284  enddo
1285  end subroutine fstr_check_shell_j2_inputs
1286 
1287 
1289  subroutine fstr_solid_init( hecMESH, fstrSOLID )
1290  use m_fstr
1291  type(hecmwst_local_mesh),target :: hecMESH
1292  type(fstr_solid) :: fstrSOLID
1293 
1294  fstrsolid%file_type = kbcffstr
1295 
1296  fstrsolid%BOUNDARY_ngrp_tot = 0
1297  fstrsolid%BOUNDARY_ngrp_rot = 0
1298  fstrsolid%CLOAD_ngrp_tot = 0
1299  fstrsolid%CLOAD_ngrp_rot = 0
1300  fstrsolid%DLOAD_ngrp_tot = 0
1301  fstrsolid%DLOAD_follow = 1
1302  fstrsolid%TEMP_ngrp_tot = 0
1303  fstrsolid%SPRING_ngrp_tot = 0
1304  fstrsolid%TEMP_irres = 0
1305  fstrsolid%TEMP_tstep = 1
1306  fstrsolid%TEMP_interval = 1
1307  fstrsolid%TEMP_rtype = 1
1308  fstrsolid%TEMP_factor = 1.d0
1309  fstrsolid%VELOCITY_ngrp_tot = 0
1310  fstrsolid%VELOCITY_ngrp_rot = 0
1311  fstrsolid%ACCELERATION_ngrp_tot = 0
1312  fstrsolid%COUPLE_ngrp_tot = 0
1313 
1314  fstrsolid%restart_nout= 0
1315  fstrsolid%is_smoothing_active = .false.
1316  fstrsolid%has_finite_rotation_kinematics = .false.
1317  fstrsolid%finite_rotation_state_ready = .false.
1318 
1319  end subroutine fstr_solid_init
1320 
1322  subroutine fstr_solid_alloc( hecMESH, fstrSOLID )
1323  use m_fstr
1326  type(hecmwst_local_mesh),target :: hecMESH
1327  type(fstr_solid) :: fstrSOLID
1328 
1329  integer :: ndof, ntotal, ierror
1330 
1331  ndof=hecmesh%n_dof
1332  ntotal=ndof*hecmesh%n_node
1333  fstrsolid%has_finite_rotation_kinematics = &
1334  fstr_has_finite_rotation_kinematics( hecmesh, fstrsolid )
1335  fstrsolid%finite_rotation_state_ready = .false.
1336 
1337  allocate ( fstrsolid%GL( ntotal ) ,stat=ierror )
1338  if( ierror /= 0 ) then
1339  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, GL>'
1340  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1341  call flush(idbg)
1342  call hecmw_abort( hecmw_comm_get_comm())
1343  end if
1344  allocate ( fstrsolid%GL0( ntotal ) ,stat=ierror )
1345  if( ierror /= 0 ) then
1346  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, GL0>'
1347  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1348  call flush(idbg)
1349  call hecmw_abort( hecmw_comm_get_comm())
1350  end if
1351  allocate ( fstrsolid%EFORCE( ntotal ) ,stat=ierror )
1352  if( ierror /= 0 ) then
1353  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, EFORCE>'
1354  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1355  call flush(idbg)
1356  call hecmw_abort( hecmw_comm_get_comm())
1357  end if
1358  ! allocate ( fstrSOLID%TOTAL_DISP( ntotal ) ,STAT=ierror )
1359  ! if( ierror /= 0 ) then
1360  ! write(idbg,*) 'stop due to allocation error <FSTR_SOLID, TOTAL_DISP>'
1361  ! write(idbg,*) ' rank = ', hecMESH%my_rank,' ierror = ',ierror
1362  ! call flush(idbg)
1363  ! call hecmw_abort( hecmw_comm_get_comm())
1364  ! end if
1365  allocate ( fstrsolid%unode( ntotal ) ,stat=ierror )
1366  if( ierror /= 0 ) then
1367  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, unode>'
1368  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1369  call flush(idbg)
1370  call hecmw_abort( hecmw_comm_get_comm())
1371  end if
1372  allocate ( fstrsolid%unode_bak( ntotal ) ,stat=ierror )
1373  if( ierror /= 0 ) then
1374  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, unode>'
1375  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1376  call flush(idbg)
1377  call hecmw_abort( hecmw_comm_get_comm())
1378  end if
1379  allocate ( fstrsolid%dunode( ntotal ) ,stat=ierror )
1380  if( ierror /= 0 ) then
1381  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, dunode>'
1382  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1383  call flush(idbg)
1384  call hecmw_abort( hecmw_comm_get_comm())
1385  end if
1386  allocate ( fstrsolid%ddunode( ntotal ) ,stat=ierror )
1387  if( ierror /= 0 ) then
1388  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, ddunode>'
1389  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1390  call flush(idbg)
1391  call hecmw_abort( hecmw_comm_get_comm())
1392  end if
1393  if( fstrsolid%has_finite_rotation_kinematics ) then
1394  allocate ( fstrsolid%shell_node_mode( hecmesh%n_node ) ,stat=ierror )
1395  if( ierror /= 0 ) then
1396  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, shell_node_mode>'
1397  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1398  call flush(idbg)
1399  call hecmw_abort( hecmw_comm_get_comm())
1400  end if
1401  call fstr_mark_finite_rotation_nodes( hecmesh, fstrsolid, ndof, fstrsolid%shell_node_mode )
1402  allocate ( fstrsolid%shell_rot_state( hecmesh%n_node ) ,stat=ierror )
1403  if( ierror /= 0 ) then
1404  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, shell_rot_state>'
1405  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1406  call flush(idbg)
1407  call hecmw_abort( hecmw_comm_get_comm())
1408  end if
1409  allocate ( fstrsolid%shell_ref_triad( 9*hecmesh%n_node ) ,stat=ierror )
1410  if( ierror /= 0 ) then
1411  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, shell_ref_triad>'
1412  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1413  call flush(idbg)
1414  call hecmw_abort( hecmw_comm_get_comm())
1415  end if
1416  allocate ( fstrsolid%shell_triad( 9*hecmesh%n_node ) ,stat=ierror )
1417  if( ierror /= 0 ) then
1418  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, shell_triad>'
1419  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1420  call flush(idbg)
1421  call hecmw_abort( hecmw_comm_get_comm())
1422  end if
1423  allocate ( fstrsolid%shell_triad_bak( 9*hecmesh%n_node ) ,stat=ierror )
1424  if( ierror /= 0 ) then
1425  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, shell_triad_bak>'
1426  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1427  call flush(idbg)
1428  call hecmw_abort( hecmw_comm_get_comm())
1429  end if
1430  allocate ( fstrsolid%shell_dtriad( 9*hecmesh%n_node ) ,stat=ierror )
1431  if( ierror /= 0 ) then
1432  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, shell_dtriad>'
1433  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1434  call flush(idbg)
1435  call hecmw_abort( hecmw_comm_get_comm())
1436  end if
1437  allocate ( fstrsolid%shell_drill( hecmesh%n_node ) ,stat=ierror )
1438  if( ierror /= 0 ) then
1439  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, shell_drill>'
1440  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1441  call flush(idbg)
1442  call hecmw_abort( hecmw_comm_get_comm())
1443  end if
1444  allocate ( fstrsolid%shell_drill_bak( hecmesh%n_node ) ,stat=ierror )
1445  if( ierror /= 0 ) then
1446  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, shell_drill_bak>'
1447  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1448  call flush(idbg)
1449  call hecmw_abort( hecmw_comm_get_comm())
1450  end if
1451  allocate ( fstrsolid%shell_ddrill( hecmesh%n_node ) ,stat=ierror )
1452  if( ierror /= 0 ) then
1453  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, shell_ddrill>'
1454  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1455  call flush(idbg)
1456  call hecmw_abort( hecmw_comm_get_comm())
1457  end if
1458  end if
1459  allocate ( fstrsolid%QFORCE( ntotal ) ,stat=ierror )
1460  if( ierror /= 0 ) then
1461  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, QFORCE>'
1462  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1463  call flush(idbg)
1464  call hecmw_abort( hecmw_comm_get_comm())
1465  end if
1466  allocate ( fstrsolid%DFORCE( ntotal ) ,stat=ierror )
1467  if( ierror /= 0 ) then
1468  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, DFORCE>'
1469  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1470  call flush(idbg)
1471  call hecmw_abort( hecmw_comm_get_comm())
1472  end if
1473  allocate ( fstrsolid%QFORCE_bak( ntotal ) ,stat=ierror )
1474  if( ierror /= 0 ) then
1475  write(idbg,*) 'stop due to allocation error <FSTR_SOLID, QFORCE_bak>'
1476  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
1477  call flush(idbg)
1478  call hecmw_abort( hecmw_comm_get_comm())
1479  end if
1480 
1481  fstrsolid%GL(:)=0.d0
1482  fstrsolid%GL0(:)=0.d0
1483  ! fstrSOLID%TOTAL_DISP(:)=0.d0
1484  fstrsolid%unode(:) = 0.d0
1485  fstrsolid%unode_bak(:) = 0.d0
1486  fstrsolid%dunode(:) = 0.d0
1487  fstrsolid%ddunode(:) = 0.d0
1488  if( associated(fstrsolid%shell_rot_state) ) fstrsolid%shell_rot_state(:) = 0
1489  if( associated(fstrsolid%shell_ref_triad) ) fstrsolid%shell_ref_triad(:) = 0.d0
1490  if( associated(fstrsolid%shell_triad) ) fstrsolid%shell_triad(:) = 0.d0
1491  if( associated(fstrsolid%shell_triad_bak) ) fstrsolid%shell_triad_bak(:) = 0.d0
1492  if( associated(fstrsolid%shell_dtriad) ) fstrsolid%shell_dtriad(:) = 0.d0
1493  if( associated(fstrsolid%shell_drill) ) fstrsolid%shell_drill(:) = 0.d0
1494  if( associated(fstrsolid%shell_drill_bak) ) fstrsolid%shell_drill_bak(:) = 0.d0
1495  if( associated(fstrsolid%shell_ddrill) ) fstrsolid%shell_ddrill(:) = 0.d0
1496  fstrsolid%QFORCE(:) = 0.d0
1497  fstrsolid%QFORCE_bak(:) = 0.d0
1498  ! DFORCE is assembled only by implicit dynamic analysis, but the convergence
1499  ! check reads it in every analysis type.
1500  fstrsolid%DFORCE(:) = 0.d0
1501  fstrsolid%FACTOR( 1:2 ) = 0.d0
1502 
1503  ! for MPC
1504  fstrsolid%n_fix_mpc = hecmesh%mpc%n_mpc
1505  if( fstrsolid%n_fix_mpc>0 ) then
1506  allocate( fstrsolid%mpc_const( fstrsolid%n_fix_mpc ) )
1507  fstrsolid%mpc_const(:) = hecmesh%mpc%mpc_const(:)
1508  endif
1509 
1510  ! initialize for linear static problems
1511  fstrsolid%FACTOR(2)=1.d0
1512  fstrsolid%FACTOR(1)=0.d0
1513  end subroutine fstr_solid_alloc
1514 
1515  subroutine fstr_smoothed_element_init( hecMESH, fstrSOLID )
1516  type(hecmwst_local_mesh),target :: hecMESH
1517  type(fstr_solid) :: fstrSOLID
1518 
1519  logical, allocatable :: is_selem_list(:)
1520  integer :: i, isect
1521 
1522  do isect=1,hecmesh%section%n_sect
1523  if( fstrsolid%sections(isect)%elemopt341 == kel341sesns ) fstrsolid%is_smoothing_active = .true.
1524  end do
1525  if( .not. fstrsolid%is_smoothing_active ) return
1526 
1527  allocate(is_selem_list(hecmesh%n_elem), stat=i)
1528  if( i /= 0 ) then
1529  write(*,*) 'Allocation error: is_selem_list'
1530  return
1531  endif
1532  is_selem_list(:) = .false.
1533 
1534  do i=1,hecmesh%n_elem
1535  isect= hecmesh%section_ID(i)
1536  if( hecmesh%elem_type(i) /= fe_tet4n ) cycle
1537  if( fstrsolid%sections(isect)%elemopt341 == kel341sesns ) is_selem_list(i) = .true.
1538  enddo
1539 
1540  call hecmw_create_smoothing_element_connectivity(hecmesh,is_selem_list)
1541 
1542  deallocate(is_selem_list)
1543 
1544  end subroutine
1545 
1546  subroutine fstr_smoothed_element_calcmaxcon( hecMESH, fstrSOLID )
1548  type(hecmwst_local_mesh),target :: hecMESH
1549  type(fstr_solid) :: fstrSOLID
1550 
1551  integer :: i, nodlocal(fstrSOLID%max_ncon), iiS, nn, con_stf
1552 
1553  if( fstrsolid%max_ncon_stf > 20 ) fstrsolid%max_ncon_stf = 20
1554 
1555  do i=1,hecmesh%elem_type_index(hecmesh%n_elem_type)
1556  if( hecmesh%elem_type(i) /= fe_nodesmooth_tet4n .and. hecmesh%elem_type(i) /= fe_edgesmooth_tet4n ) cycle
1557  iis = hecmesh%elem_node_index(i-1)
1558  nn = hecmesh%elem_node_index(i) - iis
1559  nodlocal(1:nn) = hecmesh%elem_node_item(iis+1:iis+nn)
1560  con_stf = return_nn_comp_c3d4_sesns(nn, nodlocal)
1561  if( con_stf > fstrsolid%max_ncon_stf ) fstrsolid%max_ncon_stf = con_stf
1562  enddo
1563  end subroutine
1564 
1566  subroutine fstr_element_init( hecMESH, fstrSOLID, solution_type )
1567  use elementinfo
1568  use mmechgauss
1570  use m_fstr
1571  type(hecmwst_local_mesh),target :: hecMESH
1572  type(fstr_solid) :: fstrSOLID
1573  integer(kind=kint), intent(in) :: solution_type
1574 
1575  integer :: i, j, ng, isect, ndof, id, nn, n_elem, nthick
1576 
1577  if( hecmesh%n_elem <=0 ) then
1578  stop "no element defined!"
1579  endif
1580 
1581  fstrsolid%maxn_gauss = 0
1582  fstrsolid%max_ncon = 0
1583 
1584  ! elemopt341 = kel341ES
1585  call fstr_smoothed_element_init( hecmesh, fstrsolid )
1586 
1587  ! number of elements
1588  n_elem = hecmesh%elem_type_index(hecmesh%n_elem_type)
1589  allocate( fstrsolid%elements(n_elem) )
1590 
1591  do i=1,n_elem
1592  fstrsolid%elements(i)%elemact_flag = kelact_undefined
1593  if( solution_type == kstheat) cycle !fstrSOLID is used only for elemact element in heat transfer analysis
1594 
1595  fstrsolid%elements(i)%etype = hecmesh%elem_type(i)
1596  if( hecmesh%elem_type(i)==301 ) fstrsolid%elements(i)%etype=111
1597  if (hecmw_is_etype_link(fstrsolid%elements(i)%etype)) cycle
1598  if (hecmw_is_etype_patch(fstrsolid%elements(i)%etype)) cycle
1599  ng = numofquadpoints( fstrsolid%elements(i)%etype )
1600  if( ng > fstrsolid%maxn_gauss ) fstrsolid%maxn_gauss = ng
1601  if(ng>0) allocate( fstrsolid%elements(i)%gausses( ng ) )
1602 
1603  isect= hecmesh%section_ID(i)
1604  ndof = getspacedimension( fstrsolid%elements(i)%etype )
1605  if (ndof == 2) then ! why do this???
1606  id=hecmesh%section%sect_opt(isect)
1607  if( id==0 ) then
1608  fstrsolid%elements(i)%iset=1
1609  else if( id==1) then
1610  fstrsolid%elements(i)%iset=0
1611  else if( id==2) then
1612  fstrsolid%elements(i)%iset=2
1613  endif
1614  endif
1615 
1616  if( isect<0 .or. isect>hecmesh%section%n_sect ) &
1617  stop "Error in element's section definition"
1618  id = hecmesh%section%sect_mat_ID_item(isect)
1619  fstrsolid%materials(id)%cdsys_ID = hecmesh%section%sect_orien_ID(isect)
1620  nn = hecmesh%elem_node_index(i)-hecmesh%elem_node_index(i-1)
1621  do j=1,ng
1622  fstrsolid%elements(i)%gausses(j)%pMaterial => fstrsolid%materials(id)
1623  call fstr_init_gauss( fstrsolid%elements(i)%gausses( j ) )
1624  enddo
1625  nthick = 0
1626  if( fstr_uses_finite_rotation_kinematics( fstrsolid%elements(i)%etype, nn, &
1627  fstrsolid%materials(id) ) .or. &
1628  fstr_uses_plane_stress_j2_shell(fstrsolid%elements(i)%etype, nn, &
1629  fstrsolid%materials(id)) ) then
1630  nthick = fstr_shell_num_thickness_points( fstrsolid%elements(i)%etype )
1631  endif
1632  if( nthick > 0 ) call fstr_init_shell_layer_gausses( fstrsolid%elements(i), ng, &
1633  fstrsolid%materials(id)%totallyr, nthick )
1634 
1635  allocate(fstrsolid%elements(i)%equiForces(nn*ndof))
1636  fstrsolid%elements(i)%equiForces = 0.0d0
1637  if( nn > fstrsolid%max_ncon ) fstrsolid%max_ncon = nn
1638 
1639  if( hecmesh%elem_type(i)==361 ) then
1640  if( fstrsolid%sections(isect)%elemopt361==kel361ic ) then
1641  allocate( fstrsolid%elements(i)%aux(3,3) )
1642  fstrsolid%elements(i)%aux = 0.0d0
1643  endif
1644  fstrsolid%elements(i)%p(1) = 0.0d0
1645  endif
1646 
1647  enddo
1648 
1649  fstrsolid%max_ncon_stf = fstrsolid%max_ncon
1650  if( fstrsolid%is_smoothing_active ) call fstr_smoothed_element_calcmaxcon( hecmesh, fstrsolid )
1651 
1652  call hecmw_allreduce_i1(hecmesh,fstrsolid%maxn_gauss,hecmw_max)
1653  end subroutine
1654 
1655  recursive subroutine fstr_solid_physic_val_finalize( phys )
1656  use m_fstr
1657  implicit none
1658  type(fstr_solid_physic_val) :: phys
1659  integer :: i
1660 
1661  if(associated(phys%STRESS)) deallocate(phys%STRESS)
1662  if(associated(phys%STRAIN)) deallocate(phys%STRAIN)
1663  if(associated(phys%MISES)) deallocate(phys%MISES)
1664 
1665  if(associated(phys%PSTRESS)) deallocate(phys%PSTRESS)
1666  if(associated(phys%PSTRAIN)) deallocate(phys%PSTRAIN)
1667  if(associated(phys%PSTRESS_VECT)) deallocate(phys%PSTRESS_VECT)
1668  if(associated(phys%PSTRAIN_VECT)) deallocate(phys%PSTRAIN_VECT)
1669 
1670  if(associated(phys%ESTRESS)) deallocate(phys%ESTRESS)
1671  if(associated(phys%ESTRAIN)) deallocate(phys%ESTRAIN)
1672  if(associated(phys%EMISES)) deallocate(phys%EMISES)
1673  if(associated(phys%EPLSTRAIN)) deallocate(phys%EPLSTRAIN)
1674 
1675  if(associated(phys%EPSTRESS)) deallocate(phys%EPSTRESS)
1676  if(associated(phys%EPSTRAIN)) deallocate(phys%EPSTRAIN)
1677  if(associated(phys%EPSTRESS_VECT)) deallocate(phys%EPSTRESS_VECT)
1678  if(associated(phys%EPSTRAIN_VECT)) deallocate(phys%EPSTRAIN_VECT)
1679  if(associated(phys%ENQM)) deallocate(phys%ENQM)
1680 
1681  if(associated(phys%LAYER)) then
1682  do i=1, size(phys%LAYER)
1683  call fstr_solid_physic_val_finalize(phys%LAYER(i))
1684  end do
1685  deallocate(phys%LAYER)
1686  end if
1687  if(associated(phys%PLUS)) then
1688  call fstr_solid_physic_val_finalize(phys%PLUS)
1689  deallocate(phys%PLUS)
1690  end if
1691  if(associated(phys%MINUS)) then
1692  call fstr_solid_physic_val_finalize(phys%MINUS)
1693  deallocate(phys%MINUS)
1694  end if
1695  end subroutine
1696 
1698  subroutine fstr_solid_finalize( fstrSOLID )
1700  implicit none
1701  type(fstr_solid) :: fstrSOLID
1702  integer :: i, j, ierror
1703  if( associated(fstrsolid%materials) ) then
1704  do j=1,size(fstrsolid%materials)
1705  call finalizematerial(fstrsolid%materials(j))
1706  enddo
1707  deallocate( fstrsolid%materials )
1708  endif
1709  if( .not. associated(fstrsolid%elements ) ) return
1710  do i=1,size(fstrsolid%elements)
1711  if( associated(fstrsolid%elements(i)%gausses) ) then
1712  do j=1,size(fstrsolid%elements(i)%gausses)
1713  call fstr_finalize_gauss(fstrsolid%elements(i)%gausses(j))
1714  enddo
1715  deallocate( fstrsolid%elements(i)%gausses )
1716  endif
1717  call fstr_finalize_shell_layer_gausses( fstrsolid%elements(i) )
1718  if(associated(fstrsolid%elements(i)%equiForces) ) then
1719  deallocate(fstrsolid%elements(i)%equiForces)
1720  endif
1721  if( associated(fstrsolid%elements(i)%aux) ) then
1722  deallocate(fstrsolid%elements(i)%aux)
1723  endif
1724  enddo
1725 
1726  deallocate( fstrsolid%elements )
1727  if( associated( fstrsolid%mpc_const ) ) then
1728  deallocate( fstrsolid%mpc_const )
1729  endif
1730  call free_stepinfo( fstrsolid%step_ctrl_restart )
1731  if( associated(fstrsolid%step_ctrl) ) then
1732  do i=1,size(fstrsolid%step_ctrl)
1733  call free_stepinfo( fstrsolid%step_ctrl(i) )
1734  enddo
1735  deallocate( fstrsolid%step_ctrl )
1736  endif
1737  if(associated(fstrsolid%output_ctrl) ) then
1738  do i=1,size(fstrsolid%output_ctrl)
1739  if( fstrsolid%output_ctrl(i)%filenum==iutb ) &
1740  close(fstrsolid%output_ctrl(i)%filenum)
1741  enddo
1742  deallocate(fstrsolid%output_ctrl)
1743  endif
1744  if( associated( fstrsolid%sections ) ) then
1745  deallocate( fstrsolid%sections )
1746  endif
1747 
1748  if( associated(fstrsolid%GL) ) then
1749  deallocate(fstrsolid%GL ,stat=ierror)
1750  if( ierror /= 0 ) then
1751  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, GL>'
1752  call flush(idbg)
1753  call hecmw_abort( hecmw_comm_get_comm())
1754  end if
1755  endif
1756  if( associated(fstrsolid%EFORCE) ) then
1757  deallocate(fstrsolid%EFORCE ,stat=ierror)
1758  if( ierror /= 0 ) then
1759  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, EFORCE>'
1760  call flush(idbg)
1761  call hecmw_abort( hecmw_comm_get_comm())
1762  end if
1763  endif
1764  if( associated(fstrsolid%unode) ) then
1765  deallocate(fstrsolid%unode ,stat=ierror)
1766  if( ierror /= 0 ) then
1767  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, unode>'
1768  call flush(idbg)
1769  call hecmw_abort( hecmw_comm_get_comm())
1770  end if
1771  endif
1772  if( associated(fstrsolid%unode_bak) ) then
1773  deallocate(fstrsolid%unode_bak ,stat=ierror)
1774  if( ierror /= 0 ) then
1775  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, unode_bak>'
1776  call flush(idbg)
1777  call hecmw_abort( hecmw_comm_get_comm())
1778  end if
1779  endif
1780  if( associated(fstrsolid%dunode) ) then
1781  deallocate(fstrsolid%dunode ,stat=ierror)
1782  if( ierror /= 0 ) then
1783  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, dunode>'
1784  call flush(idbg)
1785  call hecmw_abort( hecmw_comm_get_comm())
1786  end if
1787  endif
1788  if( associated(fstrsolid%ddunode) ) then
1789  deallocate(fstrsolid%ddunode ,stat=ierror)
1790  if( ierror /= 0 ) then
1791  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, ddunode>'
1792  call flush(idbg)
1793  call hecmw_abort( hecmw_comm_get_comm())
1794  end if
1795  endif
1796  if( associated(fstrsolid%shell_node_mode) ) then
1797  deallocate(fstrsolid%shell_node_mode ,stat=ierror)
1798  if( ierror /= 0 ) then
1799  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, shell_node_mode>'
1800  call flush(idbg)
1801  call hecmw_abort( hecmw_comm_get_comm())
1802  end if
1803  endif
1804  if( associated(fstrsolid%shell_rot_state) ) then
1805  deallocate(fstrsolid%shell_rot_state ,stat=ierror)
1806  if( ierror /= 0 ) then
1807  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, shell_rot_state>'
1808  call flush(idbg)
1809  call hecmw_abort( hecmw_comm_get_comm())
1810  end if
1811  endif
1812  if( associated(fstrsolid%shell_ref_triad) ) then
1813  deallocate(fstrsolid%shell_ref_triad ,stat=ierror)
1814  if( ierror /= 0 ) then
1815  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, shell_ref_triad>'
1816  call flush(idbg)
1817  call hecmw_abort( hecmw_comm_get_comm())
1818  end if
1819  endif
1820  if( associated(fstrsolid%shell_triad) ) then
1821  deallocate(fstrsolid%shell_triad ,stat=ierror)
1822  if( ierror /= 0 ) then
1823  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, shell_triad>'
1824  call flush(idbg)
1825  call hecmw_abort( hecmw_comm_get_comm())
1826  end if
1827  endif
1828  if( associated(fstrsolid%shell_triad_bak) ) then
1829  deallocate(fstrsolid%shell_triad_bak ,stat=ierror)
1830  if( ierror /= 0 ) then
1831  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, shell_triad_bak>'
1832  call flush(idbg)
1833  call hecmw_abort( hecmw_comm_get_comm())
1834  end if
1835  endif
1836  if( associated(fstrsolid%shell_dtriad) ) then
1837  deallocate(fstrsolid%shell_dtriad ,stat=ierror)
1838  if( ierror /= 0 ) then
1839  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, shell_dtriad>'
1840  call flush(idbg)
1841  call hecmw_abort( hecmw_comm_get_comm())
1842  end if
1843  endif
1844  if( associated(fstrsolid%shell_drill) ) then
1845  deallocate(fstrsolid%shell_drill ,stat=ierror)
1846  if( ierror /= 0 ) then
1847  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, shell_drill>'
1848  call flush(idbg)
1849  call hecmw_abort( hecmw_comm_get_comm())
1850  end if
1851  endif
1852  if( associated(fstrsolid%shell_drill_bak) ) then
1853  deallocate(fstrsolid%shell_drill_bak ,stat=ierror)
1854  if( ierror /= 0 ) then
1855  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, shell_drill_bak>'
1856  call flush(idbg)
1857  call hecmw_abort( hecmw_comm_get_comm())
1858  end if
1859  endif
1860  if( associated(fstrsolid%shell_ddrill) ) then
1861  deallocate(fstrsolid%shell_ddrill ,stat=ierror)
1862  if( ierror /= 0 ) then
1863  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, shell_ddrill>'
1864  call flush(idbg)
1865  call hecmw_abort( hecmw_comm_get_comm())
1866  end if
1867  endif
1868  if( associated(fstrsolid%QFORCE) ) then
1869  deallocate(fstrsolid%QFORCE ,stat=ierror)
1870  if( ierror /= 0 ) then
1871  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, QFORCE>'
1872  call flush(idbg)
1873  call hecmw_abort( hecmw_comm_get_comm())
1874  end if
1875  endif
1876  if( associated(fstrsolid%DFORCE) ) then
1877  deallocate(fstrsolid%DFORCE ,stat=ierror)
1878  if( ierror /= 0 ) then
1879  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, DFORCE>'
1880  call flush(idbg)
1881  call hecmw_abort( hecmw_comm_get_comm())
1882  end if
1883  endif
1884  if( associated(fstrsolid%temperature) ) then
1885  deallocate(fstrsolid%temperature ,stat=ierror)
1886  if( ierror /= 0 ) then
1887  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, temperature>'
1888  call flush(idbg)
1889  call hecmw_abort( hecmw_comm_get_comm())
1890  end if
1891  endif
1892  if( associated(fstrsolid%last_temp) ) then
1893  deallocate(fstrsolid%last_temp ,stat=ierror)
1894  if( ierror /= 0 ) then
1895  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, reftemp>'
1896  call flush(idbg)
1897  call hecmw_abort( hecmw_comm_get_comm())
1898  end if
1899  endif
1900  if( associated(fstrsolid%temp_bak) ) then
1901  deallocate(fstrsolid%temp_bak ,stat=ierror)
1902  if( ierror /= 0 ) then
1903  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, reftemp>'
1904  call flush(idbg)
1905  call hecmw_abort( hecmw_comm_get_comm())
1906  end if
1907  endif
1908 
1909  ! Allocated in in f str_setup_BOUNDARY */
1910  if( associated(fstrsolid%BOUNDARY_ngrp_GRPID) ) then
1911  deallocate(fstrsolid%BOUNDARY_ngrp_GRPID, stat=ierror)
1912  if( ierror /= 0 ) then
1913  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, BOUNDARY_ngrp_GRPID>'
1914  call flush(idbg)
1915  call hecmw_abort( hecmw_comm_get_comm())
1916  end if
1917  endif
1918  if( associated(fstrsolid%BOUNDARY_ngrp_ID) ) then
1919  deallocate(fstrsolid%BOUNDARY_ngrp_ID, stat=ierror)
1920  if( ierror /= 0 ) then
1921  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, BOUNDARY_ngrp_ID>'
1922  call flush(idbg)
1923  call hecmw_abort( hecmw_comm_get_comm())
1924  end if
1925  endif
1926  if( associated(fstrsolid%BOUNDARY_ngrp_type) ) then
1927  deallocate(fstrsolid%BOUNDARY_ngrp_type, stat=ierror)
1928  if( ierror /= 0 ) then
1929  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, BOUNDARY_ngrp_type>'
1930  call flush(idbg)
1931  call hecmw_abort( hecmw_comm_get_comm())
1932  end if
1933  endif
1934  if( associated(fstrsolid%BOUNDARY_ngrp_val) ) then
1935  deallocate(fstrsolid%BOUNDARY_ngrp_val, stat=ierror)
1936  if( ierror /= 0 ) then
1937  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, BOUNDARY_ngrp_val>'
1938  call flush(idbg)
1939  call hecmw_abort( hecmw_comm_get_comm())
1940  end if
1941  endif
1942  if( associated(fstrsolid%BOUNDARY_ngrp_amp) ) then
1943  deallocate(fstrsolid%BOUNDARY_ngrp_amp, stat=ierror)
1944  if( ierror /= 0 ) then
1945  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, BOUNDARY_ngrp_amp>'
1946  call flush(idbg)
1947  call hecmw_abort( hecmw_comm_get_comm())
1948  end if
1949  endif
1950  if( associated(fstrsolid%BOUNDARY_ngrp_istot) ) then
1951  deallocate(fstrsolid%BOUNDARY_ngrp_istot, stat=ierror)
1952  if( ierror /= 0 ) then
1953  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, BOUNDARY_ngrp_istot>'
1954  call flush(idbg)
1955  call hecmw_abort( hecmw_comm_get_comm())
1956  end if
1957  endif
1958  if( associated(fstrsolid%BOUNDARY_ngrp_rotID) ) then
1959  deallocate(fstrsolid%BOUNDARY_ngrp_rotID, stat=ierror)
1960  if( ierror /= 0 ) then
1961  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, BOUNDARY_ngrp_rotID>'
1962  call flush(idbg)
1963  call hecmw_abort( hecmw_comm_get_comm())
1964  end if
1965  endif
1966  if( associated(fstrsolid%BOUNDARY_ngrp_centerID) ) then
1967  deallocate(fstrsolid%BOUNDARY_ngrp_centerID, stat=ierror)
1968  if( ierror /= 0 ) then
1969  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, BOUNDARY_ngrp_centerID>'
1970  call flush(idbg)
1971  call hecmw_abort( hecmw_comm_get_comm())
1972  end if
1973  endif
1974 
1975  if(associated(fstrsolid%VELOCITY_ngrp_GRPID)) deallocate(fstrsolid%VELOCITY_ngrp_GRPID)
1976  if(associated(fstrsolid%VELOCITY_ngrp_ID)) deallocate(fstrsolid%VELOCITY_ngrp_ID)
1977  if(associated(fstrsolid%VELOCITY_ngrp_type)) deallocate(fstrsolid%VELOCITY_ngrp_type)
1978  if(associated(fstrsolid%VELOCITY_ngrp_amp)) deallocate(fstrsolid%VELOCITY_ngrp_amp)
1979  if(associated(fstrsolid%VELOCITY_ngrp_val)) deallocate(fstrsolid%VELOCITY_ngrp_val)
1980  if(associated(fstrsolid%VELOCITY_ngrp_rotID)) deallocate(fstrsolid%VELOCITY_ngrp_rotID)
1981  if(associated(fstrsolid%VELOCITY_ngrp_centerID)) deallocate(fstrsolid%VELOCITY_ngrp_centerID)
1982 
1983  if(associated(fstrsolid%ACCELERATION_ngrp_GRPID)) deallocate(fstrsolid%ACCELERATION_ngrp_GRPID)
1984  if(associated(fstrsolid%ACCELERATION_ngrp_ID)) deallocate(fstrsolid%ACCELERATION_ngrp_ID)
1985  if(associated(fstrsolid%ACCELERATION_ngrp_type)) deallocate(fstrsolid%ACCELERATION_ngrp_type)
1986  if(associated(fstrsolid%ACCELERATION_ngrp_amp)) deallocate(fstrsolid%ACCELERATION_ngrp_amp)
1987  if(associated(fstrsolid%ACCELERATION_ngrp_val)) deallocate(fstrsolid%ACCELERATION_ngrp_val)
1988 
1989  ! Allocated in in fstr_setup_CLOAD
1990  if( associated(fstrsolid%CLOAD_ngrp_GRPID) ) then
1991  deallocate(fstrsolid%CLOAD_ngrp_GRPID, stat=ierror)
1992  if( ierror /= 0 ) then
1993  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, CLOAD_ngrp_GRPID>'
1994  call flush(idbg)
1995  call hecmw_abort( hecmw_comm_get_comm())
1996  end if
1997  endif
1998  if( associated(fstrsolid%CLOAD_ngrp_ID) ) then
1999  deallocate(fstrsolid%CLOAD_ngrp_ID, stat=ierror)
2000  if( ierror /= 0 ) then
2001  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, CLOAD_ngrp_ID>'
2002  call flush(idbg)
2003  call hecmw_abort( hecmw_comm_get_comm())
2004  end if
2005  endif
2006  if( associated(fstrsolid%CLOAD_ngrp_DOF) ) then
2007  deallocate(fstrsolid%CLOAD_ngrp_DOF, stat=ierror)
2008  if( ierror /= 0 ) then
2009  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, CLOAD_ngrp_DOF>'
2010  call flush(idbg)
2011  call hecmw_abort( hecmw_comm_get_comm())
2012  end if
2013  endif
2014  if( associated(fstrsolid%CLOAD_ngrp_val) ) then
2015  deallocate(fstrsolid%CLOAD_ngrp_val, stat=ierror)
2016  if( ierror /= 0 ) then
2017  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, CLOAD_ngrp_val>'
2018  call flush(idbg)
2019  call hecmw_abort( hecmw_comm_get_comm())
2020  end if
2021  endif
2022  if( associated(fstrsolid%CLOAD_ngrp_amp) ) then
2023  deallocate(fstrsolid%CLOAD_ngrp_amp, stat=ierror)
2024  if( ierror /= 0 ) then
2025  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, CLOAD_ngrp_amp>'
2026  call flush(idbg)
2027  call hecmw_abort( hecmw_comm_get_comm())
2028  end if
2029  endif
2030  if( associated(fstrsolid%CLOAD_ngrp_rotID) ) then
2031  deallocate(fstrsolid%CLOAD_ngrp_rotID, stat=ierror)
2032  if( ierror /= 0 ) then
2033  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, CLOAD_ngrp_rotID>'
2034  call flush(idbg)
2035  call hecmw_abort( hecmw_comm_get_comm())
2036  end if
2037  endif
2038  if( associated(fstrsolid%CLOAD_ngrp_centerID) ) then
2039  deallocate(fstrsolid%CLOAD_ngrp_centerID, stat=ierror)
2040  if( ierror /= 0 ) then
2041  write(idbg,*) 'stop due to deallocation error <FSTR_SOLID, CLOAD_ngrp_centerID>'
2042  call flush(idbg)
2043  call hecmw_abort( hecmw_comm_get_comm())
2044  end if
2045  endif
2046 
2047  if(associated(fstrsolid%DLOAD_ngrp_GRPID)) deallocate(fstrsolid%DLOAD_ngrp_GRPID)
2048  if(associated(fstrsolid%DLOAD_ngrp_ID)) deallocate(fstrsolid%DLOAD_ngrp_ID)
2049  if(associated(fstrsolid%DLOAD_ngrp_LID)) deallocate(fstrsolid%DLOAD_ngrp_LID)
2050  if(associated(fstrsolid%DLOAD_ngrp_amp)) deallocate(fstrsolid%DLOAD_ngrp_amp)
2051  if(associated(fstrsolid%DLOAD_ngrp_params)) deallocate(fstrsolid%DLOAD_ngrp_params)
2052 
2053  if(associated(fstrsolid%TEMP_ngrp_GRPID)) deallocate(fstrsolid%TEMP_ngrp_GRPID)
2054  if(associated(fstrsolid%TEMP_ngrp_ID)) deallocate(fstrsolid%TEMP_ngrp_ID)
2055  if(associated(fstrsolid%TEMP_ngrp_val)) deallocate(fstrsolid%TEMP_ngrp_val)
2056 
2057  if(associated(fstrsolid%SPRING_ngrp_GRPID)) deallocate(fstrsolid%SPRING_ngrp_GRPID)
2058  if(associated(fstrsolid%SPRING_ngrp_ID)) deallocate(fstrsolid%SPRING_ngrp_ID)
2059  if(associated(fstrsolid%SPRING_ngrp_DOF)) deallocate(fstrsolid%SPRING_ngrp_DOF)
2060  if(associated(fstrsolid%SPRING_ngrp_amp)) deallocate(fstrsolid%SPRING_ngrp_amp)
2061  if(associated(fstrsolid%SPRING_ngrp_val)) deallocate(fstrsolid%SPRING_ngrp_val)
2062  if(associated(fstrsolid%SPRING_incremental)) deallocate(fstrsolid%SPRING_incremental)
2063 
2064  if(associated(fstrsolid%COUPLE_ngrp_ID)) deallocate(fstrsolid%COUPLE_ngrp_ID)
2065 
2066 ! if(associated(fstrSOLID%STRESS)) deallocate(fstrSOLID%STRESS)
2067 ! if(associated(fstrSOLID%STRAIN)) deallocate(fstrSOLID%STRAIN)
2068 ! if(associated(fstrSOLID%MISES)) deallocate(fstrSOLID%MISES)
2069 ! if(associated(fstrSOLID%PSTRESS)) deallocate(fstrSOLID%PSTRESS)
2070 ! if(associated(fstrSOLID%PSTRAIN)) deallocate(fstrSOLID%PSTRAIN)
2071 ! if(associated(fstrSOLID%PSTRESS_VECT)) deallocate(fstrSOLID%PSTRESS_VECT)
2072 ! if(associated(fstrSOLID%PSTRAIN_VECT)) deallocate(fstrSOLID%PSTRAIN_VECT)
2073 
2074 ! if(associated(fstrSOLID%ESTRESS)) deallocate(fstrSOLID%ESTRESS)
2075 ! if(associated(fstrSOLID%ESTRAIN)) deallocate(fstrSOLID%ESTRAIN)
2076 ! if(associated(fstrSOLID%EMISES)) deallocate(fstrSOLID%EMISES)
2077 ! if(associated(fstrSOLID%EPLSTRAIN)) deallocate(fstrSOLID%EPLSTRAIN)
2078 
2079 ! if(associated(fstrSOLID%EPSTRESS)) deallocate(fstrSOLID%EPLSTRAIN)
2080 ! if(associated(fstrSOLID%EPSTRAIN)) deallocate(fstrSOLID%EPLSTRAIN)
2081 ! if(associated(fstrSOLID%EPSTRESS_VECT)) deallocate(fstrSOLID%EPLSTRAIN)
2082 ! if(associated(fstrSOLID%EPSTRAIN_VECT)) deallocate(fstrSOLID%EPLSTRAIN)
2083 
2084  if(associated(fstrsolid%TNSTRAIN)) deallocate(fstrsolid%TNSTRAIN)
2085  if(associated(fstrsolid%TESTRAIN)) deallocate(fstrsolid%TESTRAIN)
2086 
2087  if(associated(fstrsolid%YIELD_RATIO)) deallocate(fstrsolid%YIELD_RATIO)
2088 
2089 ! if(associated(fstrSOLID%ENQM)) deallocate(fstrSOLID%ENQM)
2090  if(associated(fstrsolid%REACTION)) deallocate(fstrsolid%REACTION)
2091 
2092  if(associated(fstrsolid%CONT_NFORCE)) deallocate(fstrsolid%CONT_NFORCE)
2093  if(associated(fstrsolid%CONT_FRIC)) deallocate(fstrsolid%CONT_FRIC)
2094  if(associated(fstrsolid%CONT_RELVEL)) deallocate(fstrsolid%CONT_RELVEL)
2095  if(associated(fstrsolid%CONT_STATE)) deallocate(fstrsolid%CONT_STATE)
2096  if(associated(fstrsolid%CONT_SGRP_ID)) deallocate(fstrsolid%CONT_SGRP_ID)
2097  if(associated(fstrsolid%CONT_AREA)) deallocate(fstrsolid%CONT_AREA)
2098  if(associated(fstrsolid%CONT_NTRAC)) deallocate(fstrsolid%CONT_NTRAC)
2099  if(associated(fstrsolid%CONT_FTRAC)) deallocate(fstrsolid%CONT_FTRAC)
2100  if(associated(fstrsolid%EMBED_NFORCE)) deallocate(fstrsolid%EMBED_NFORCE)
2101 
2102  if(associated(fstrsolid%SOLID)) call fstr_solid_physic_val_finalize(fstrsolid%SOLID)
2103  if(associated(fstrsolid%SHELL)) call fstr_solid_physic_val_finalize(fstrsolid%SHELL)
2104  if(associated(fstrsolid%BEAM)) call fstr_solid_physic_val_finalize(fstrsolid%BEAM)
2105 
2106  if(associated(fstrsolid%is_rot)) deallocate(fstrsolid%is_rot)
2107  if(associated(fstrsolid%GL0)) deallocate(fstrsolid%GL0)
2108  if(associated(fstrsolid%QFORCE_bak)) deallocate(fstrsolid%QFORCE_bak)
2109 
2110  if(associated(fstrsolid%contacts)) then
2111 ! do i=1, size(fstrSOLID%contacts)
2112 ! call fstr_contact_finalize(fstrSOLID%contacts(i))
2113 ! end do
2114  deallocate(fstrsolid%contacts)
2115  end if
2116  if(associated(fstrsolid%embeds)) then
2117 ! do i=1, size(fstrSOLID%embeds)
2118 ! call fstr_contact_finalize(fstrSOLID%embeds(i))
2119 ! end do
2120  deallocate(fstrsolid%embeds)
2121  end if
2122  if(associated(fstrsolid%unode_bkup)) deallocate(fstrsolid%unode_bkup)
2123  if(associated(fstrsolid%QFORCE_bkup)) deallocate(fstrsolid%QFORCE_bkup)
2124  if(associated(fstrsolid%DFORCE_bkup)) deallocate(fstrsolid%DFORCE_bkup)
2125  if(associated(fstrsolid%last_temp_bkup)) deallocate(fstrsolid%last_temp_bkup)
2126  if(associated(fstrsolid%shell_triad_bkup)) deallocate(fstrsolid%shell_triad_bkup)
2127  if(associated(fstrsolid%shell_drill_bkup)) deallocate(fstrsolid%shell_drill_bkup)
2128  if(associated(fstrsolid%elements_bkup)) then
2129  do i=1,size(fstrsolid%elements_bkup)
2130  if( associated(fstrsolid%elements_bkup(i)%gausses) ) then
2131  do j=1,size(fstrsolid%elements_bkup(i)%gausses)
2132  call fstr_finalize_gauss(fstrsolid%elements_bkup(i)%gausses(j))
2133  enddo
2134  deallocate( fstrsolid%elements_bkup(i)%gausses )
2135  endif
2136  call fstr_finalize_shell_layer_gausses( fstrsolid%elements_bkup(i) )
2137  if(associated(fstrsolid%elements_bkup(i)%equiForces) ) then
2138  deallocate(fstrsolid%elements_bkup(i)%equiForces)
2139  endif
2140  if( associated(fstrsolid%elements_bkup(i)%aux) ) then
2141  deallocate(fstrsolid%elements_bkup(i)%aux)
2142  endif
2143  enddo
2144  deallocate(fstrsolid%elements_bkup)
2145  end if
2146  if(associated(fstrsolid%contacts_bkup)) then
2147 ! do i=1, size(fstrSOLID%contacts_bkup)
2148 ! call fstr_contact_finalize(fstrSOLID%contacts_bkup(i))
2149 ! end do
2150  deallocate(fstrsolid%contacts_bkup)
2151  end if
2152  if(associated(fstrsolid%embeds_bkup)) then
2153 ! do i=1, size(fstrSOLID%embeds_bkup)
2154 ! call fstr_contact_finalize(fstrSOLID%embeds_bkup(i))
2155 ! end do
2156  deallocate(fstrsolid%embeds_bkup)
2157  end if
2158 
2159  end subroutine
2160 
2162  subroutine fstr_heat_init( fstrHEAT )
2163  implicit none
2164  type(fstr_heat) :: fstrHEAT
2165 
2166  fstrheat%STEPtot = 0
2167  fstrheat%MATERIALtot = 0
2168  fstrheat%AMPLITUDEtot= 0
2169  fstrheat%T_FIX_tot = 0
2170  fstrheat%Q_NOD_tot = 0
2171  fstrheat%Q_VOL_tot = 0
2172  fstrheat%Q_SUF_tot = 0
2173  fstrheat%R_SUF_tot = 0
2174  fstrheat%H_SUF_tot = 0
2175  fstrheat%WL_tot = 0
2176  fstrheat%beta = -1.0d0
2177  end subroutine fstr_heat_init
2178 
2180  subroutine fstr_eigen_init( fstrEIG )
2181  implicit none
2182  type(fstr_eigen) :: fstrEIG
2183 
2184  fstreig%nget = 5
2185  fstreig%maxiter = 60
2186  fstreig%iter = 0
2187  !fstrEIG%sigma = 0.0d0
2188  fstreig%sigma = 0.01d0
2189  fstreig%tolerance = 1.0d-6
2190  fstreig%totalmass = 0.0d0
2191  end subroutine fstr_eigen_init
2192 
2194  subroutine fstr_dynamic_init( fstrDYNAMIC )
2195  use m_fstr
2196  type(fstr_dynamic) :: fstrDYNAMIC
2197  fstrdynamic%idx_eqa = 1
2198  fstrdynamic%idx_resp = 1
2199  fstrdynamic%n_step = 1
2200  fstrdynamic%t_start = 0.0
2201  fstrdynamic%t_curr = 0.0d0
2202  fstrdynamic%t_end = 1.0
2203  fstrdynamic%t_delta = 1.0
2204  fstrdynamic%gamma = 0.5
2205  fstrdynamic%beta = 0.25
2206  fstrdynamic%idx_mas = kmasslumped
2207  fstrdynamic%idx_dmp = 1
2208  fstrdynamic%ray_m = 0.0
2209  fstrdynamic%ray_k = 0.0
2210  fstrdynamic%restart_nout = 0
2211  fstrdynamic%nout = 100
2212  fstrdynamic%ngrp_monit = 0
2213  fstrdynamic%nout_monit = 1
2214  fstrdynamic%iout_list(1) = 0
2215  fstrdynamic%iout_list(2) = 0
2216  fstrdynamic%iout_list(3) = 0
2217  fstrdynamic%iout_list(4) = 0
2218  fstrdynamic%iout_list(5) = 0
2219  fstrdynamic%iout_list(6) = 0
2220 
2221  end subroutine fstr_dynamic_init
2222 
2223 
2225  subroutine fstr_dynamic_alloc( hecMESH, fstrDYNAMIC )
2226  use m_fstr
2227  type(hecmwst_local_mesh),target :: hecMESH
2228  type(fstr_dynamic) :: fstrDYNAMIC
2229 
2230  integer :: ierror, ndof,nnod
2231 
2232  ndof=hecmesh%n_dof
2233  nnod=hecmesh%n_node
2234  if(fstrdynamic%idx_eqa == 11) then
2235  allocate( fstrdynamic%DISP(ndof*nnod,3) ,stat=ierror )
2236  if( ierror /= 0 ) then
2237  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, DISP>'
2238  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
2239  call flush(idbg)
2240  call hecmw_abort( hecmw_comm_get_comm())
2241  end if
2242  allocate( fstrdynamic%VEL (ndof*nnod,1) ,stat=ierror )
2243  if( ierror /= 0 ) then
2244  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEL>'
2245  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
2246  call flush(idbg)
2247  call hecmw_abort( hecmw_comm_get_comm())
2248  end if
2249  allocate( fstrdynamic%ACC (ndof*nnod,1) ,stat=ierror )
2250  if( ierror /= 0 ) then
2251  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, ACC>'
2252  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
2253  call flush(idbg)
2254  call hecmw_abort( hecmw_comm_get_comm())
2255  end if
2256  else
2257  allocate( fstrdynamic%DISP(ndof*nnod,2) ,stat=ierror )
2258  if( ierror /= 0 ) then
2259  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, DISP>'
2260  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
2261  call flush(idbg)
2262  call hecmw_abort( hecmw_comm_get_comm())
2263  end if
2264  allocate( fstrdynamic%VEL (ndof*nnod,2) ,stat=ierror )
2265  if( ierror /= 0 ) then
2266  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEL>'
2267  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
2268  call flush(idbg)
2269  call hecmw_abort( hecmw_comm_get_comm())
2270  end if
2271  allocate( fstrdynamic%ACC (ndof*nnod,2) ,stat=ierror )
2272  if( ierror /= 0 ) then
2273  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, ACC>'
2274  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
2275  call flush(idbg)
2276  call hecmw_abort( hecmw_comm_get_comm())
2277  end if
2278  endif
2279 
2280 
2281  allocate( fstrdynamic%VEC1(ndof*nnod) ,stat=ierror )
2282  if( ierror /= 0 ) then
2283  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEC1>'
2284  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
2285  call flush(idbg)
2286  call hecmw_abort( hecmw_comm_get_comm())
2287  end if
2288  allocate( fstrdynamic%VEC2(ndof*nnod) ,stat=ierror )
2289  if( ierror /= 0 ) then
2290  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEC2>'
2291  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
2292  call flush(idbg)
2293  call hecmw_abort( hecmw_comm_get_comm())
2294  end if
2295  allocate( fstrdynamic%VEC3(ndof*nnod) ,stat=ierror )
2296  if( ierror /= 0 ) then
2297  write(idbg,*) 'stop due to allocation error <fstr_solve_LINEAR_DYNAMIC, VEC3>'
2298  write(idbg,*) ' rank = ', hecmesh%my_rank,' ierror = ',ierror
2299  call flush(idbg)
2300  call hecmw_abort( hecmw_comm_get_comm())
2301  end if
2302 
2303  end subroutine fstr_dynamic_alloc
2304 
2306  subroutine fstr_dynamic_finalize( fstrDYNAMIC )
2307  type(fstr_dynamic) :: fstrDYNAMIC
2308 
2309  integer :: ierror
2310  if( associated(fstrdynamic%DISP) ) &
2311  deallocate( fstrdynamic%DISP ,stat=ierror )
2312  if( ierror /= 0 ) then
2313  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, DISP>'
2314  call flush(idbg)
2315  call hecmw_abort( hecmw_comm_get_comm())
2316  end if
2317  if( associated(fstrdynamic%VEL) ) &
2318  deallocate( fstrdynamic%VEL ,stat=ierror )
2319  if( ierror /= 0 ) then
2320  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, VEL>'
2321  call flush(idbg)
2322  call hecmw_abort( hecmw_comm_get_comm())
2323  end if
2324  if( associated(fstrdynamic%ACC) ) &
2325  deallocate( fstrdynamic%ACC ,stat=ierror )
2326  if( ierror /= 0 ) then
2327  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, ACC>'
2328  call flush(idbg)
2329  call hecmw_abort( hecmw_comm_get_comm())
2330  end if
2331  if( associated(fstrdynamic%VEC1) ) &
2332  deallocate( fstrdynamic%VEC1 ,stat=ierror )
2333  if( ierror /= 0 ) then
2334  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, VEC1>'
2335  call flush(idbg)
2336  call hecmw_abort( hecmw_comm_get_comm())
2337  end if
2338  if( associated(fstrdynamic%VEC2) ) &
2339  deallocate( fstrdynamic%VEC2 ,stat=ierror )
2340  if( ierror /= 0 ) then
2341  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, VEC2>'
2342  call flush(idbg)
2343  call hecmw_abort( hecmw_comm_get_comm())
2344  end if
2345  if( associated(fstrdynamic%VEC3) ) &
2346  deallocate( fstrdynamic%VEC3 ,stat=ierror )
2347  if( ierror /= 0 ) then
2348  write(idbg,*) 'stop due to deallocation error <fstr_solve_LINEAR_DYNAMIC, VEC3>'
2349  call flush(idbg)
2350  call hecmw_abort( hecmw_comm_get_comm())
2351  end if
2352 
2353  end subroutine
2354 
2355 
2356  !-----------------------------------------------------------------------------!
2358 
2359  subroutine fstr_setup_post_phys_alloc(phys, NDOF, n_node, n_elem)
2360  implicit none
2361  type(fstr_solid_physic_val), pointer :: phys
2362  integer(kind=kint) :: NDOF, n_node, n_elem, mdof, istat
2363  mdof = (ndof*ndof+ndof)/2;
2364  allocate ( phys%STRAIN (mdof*n_node), stat=istat)
2365  if( istat /= 0 ) stop "Allocation error: phys%STRAIN"
2366  allocate ( phys%STRESS (mdof*n_node), stat=istat)
2367  if( istat /= 0 ) stop "Allocation error: phys%STRESS"
2368  allocate ( phys%MISES ( n_node), stat=istat)
2369  if( istat /= 0 ) stop "Allocation error: phys%MISES"
2370  allocate ( phys%ESTRAIN (mdof*n_elem), stat=istat)
2371  if( istat /= 0 ) stop "Allocation error: phys%ESTRAIN"
2372  allocate ( phys%ESTRESS (mdof*n_elem), stat=istat)
2373  if( istat /= 0 ) stop "Allocation error: phys%ESTRESS"
2374  allocate ( phys%EMISES ( n_elem), stat=istat)
2375  if( istat /= 0 ) stop "Allocation error: phys%EMISES"
2376  allocate ( phys%EPLSTRAIN ( n_elem), stat=istat)
2377  if( istat /= 0 ) stop "Allocation error: phys%EPLSTRAIN"
2378  allocate ( phys%ENQM (12*n_elem), stat=istat)
2379  if( istat /= 0 ) stop "Allocation error: phys%ENQM"
2380  end subroutine fstr_setup_post_phys_alloc
2381 
2382  subroutine fstr_setup_post( ctrl, P )
2383  implicit none
2384  integer(kind=kint) :: ctrl, i
2385  type(fstr_param_pack) :: P
2386  type(fstr_solid_physic_val), pointer :: phys => null()
2387 
2388  if( p%PARAM%solution_type == kststatic &
2389  .or. p%PARAM%solution_type == ksteigen &
2390  .or. p%PARAM%solution_type == kstdynamic &
2391  .or. p%PARAM%solution_type == kststaticeigen ) then
2392  ! Memory Allocation for Result Vectors ------------
2393  if( p%MESH%n_dof == 6 .or. p%SOLID%is_33shell == 1 ) then
2394  allocate ( p%SOLID%SHELL )
2395  call fstr_setup_post_phys_alloc(p%SOLID%SHELL,3, p%MESH%n_node,p%MESH%n_elem)
2396  allocate ( p%SOLID%SHELL%LAYER(p%SOLID%max_lyr) )
2397  do i=1,p%SOLID%max_lyr
2398  allocate ( p%SOLID%SHELL%LAYER(i)%PLUS )
2399  allocate ( p%SOLID%SHELL%LAYER(i)%MINUS )
2400  call fstr_setup_post_phys_alloc(p%SOLID%SHELL%LAYER(i)%PLUS , 3, p%MESH%n_node, p%MESH%n_elem)
2401  call fstr_setup_post_phys_alloc(p%SOLID%SHELL%LAYER(i)%MINUS, 3, p%MESH%n_node, p%MESH%n_elem)
2402  enddo
2403  phys => p%SOLID%SHELL
2404  else
2405  allocate ( p%SOLID%SOLID )
2406  phys => p%SOLID%SOLID
2407  call fstr_setup_post_phys_alloc(phys, p%MESH%n_dof, p%MESH%n_node, p%MESH%n_elem)
2408  end if
2409  p%SOLID%STRAIN => phys%STRAIN
2410  p%SOLID%STRESS => phys%STRESS
2411  p%SOLID%MISES => phys%MISES
2412  p%SOLID%ESTRAIN => phys%ESTRAIN
2413  p%SOLID%ESTRESS => phys%ESTRESS
2414  p%SOLID%EMISES => phys%EMISES
2415  p%SOLID%EPLSTRAIN => phys%EPLSTRAIN
2416  p%SOLID%ENQM => phys%ENQM
2417  allocate( p%SOLID%REACTION( p%MESH%n_dof*p%MESH%n_node ), stat=i )
2418  if( i /= 0 ) stop "Allocation error: REACTION"
2419  p%SOLID%REACTION = 0.d0
2420  end if
2421 
2422  if( p%PARAM%fg_visual == kon )then
2423  call fstr_setup_visualize( ctrl, p%MESH )
2424  end if
2425 
2426  call hecmw_barrier( p%MESH ) ! JP-7
2427 
2428  if( p%HEAT%STEPtot == 0 ) then ! No !HEAT Input
2429  if( p%PARAM%analysis_n == 0 ) then ! No !STATIC Input
2430  call reallocate_real( p%PARAM%dtime, 1)
2431  call reallocate_real( p%PARAM%etime, 1)
2432  call reallocate_real( p%PARAM%dtmin, 1)
2433  call reallocate_real( p%PARAM%delmax,1)
2434  call reallocate_integer( p%PARAM%itmax, 1)
2435  call reallocate_real( p%PARAM%eps, 1)
2436  p%PARAM%analysis_n = 1
2437  p%PARAM%dtime = 0
2438  p%PARAM%etime = 0
2439  p%PARAM%dtmin = 0
2440  p%PARAM%delmax = 0
2441  p%PARAM%itmax = 20
2442  p%PARAM%eps = 1.0e-6
2443  end if
2444  p%HEAT%STEPtot = 1
2445  call reallocate_real( p%HEAT%STEP_DLTIME, 1)
2446  call reallocate_real( p%HEAT%STEP_EETIME, 1)
2447  call reallocate_real( p%HEAT%STEP_DELMIN, 1)
2448  call reallocate_real( p%HEAT%STEP_DELMAX, 1)
2449  p%HEAT%STEP_DLTIME = 0
2450  p%HEAT%STEP_EETIME = 0
2451  p%HEAT%STEP_DELMIN = 0
2452  p%HEAT%STEP_DELMAX = 0
2453  end if
2454  end subroutine fstr_setup_post
2455 
2456  !*****************************************************************************!
2457  !* GENERAL HEADERS ***********************************************************!
2458  !*****************************************************************************!
2459 
2460  !-----------------------------------------------------------------------------!
2462  !-----------------------------------------------------------------------------!
2463 
2464  subroutine fstr_setup_solution( ctrl, counter, P )
2465  implicit none
2466  integer(kind=kint) :: ctrl
2467  integer(kind=kint) :: counter
2468  type(fstr_param_pack) :: P
2469 
2470  integer(kind=kint) :: rcode
2471 
2472  rcode = fstr_ctrl_get_solution( ctrl, p%PARAM%solution_type, p%PARAM%nlgeom )
2473  if( rcode /= 0 ) call fstr_ctrl_err_stop
2474 
2475  end subroutine fstr_setup_solution
2476 
2477  !-----------------------------------------------------------------------------!
2479  !-----------------------------------------------------------------------------!
2480 
2481  subroutine fstr_setup_nonlinear_solver( ctrl, counter, P )
2482  implicit none
2483  integer(kind=kint) :: ctrl
2484  integer(kind=kint) :: counter
2485  type(fstr_param_pack) :: P
2486 
2487  integer(kind=kint) :: rcode
2488 
2489  rcode = fstr_ctrl_get_nonlinear_solver( ctrl, p%PARAM%nlsolver_method )
2490  if( rcode /= 0 ) call fstr_ctrl_err_stop
2491 
2492  end subroutine fstr_setup_nonlinear_solver
2493 
2494  !-----------------------------------------------------------------------------!
2496  !-----------------------------------------------------------------------------!
2497 
2498  subroutine fstr_setup_solver( ctrl, counter, P )
2499  implicit none
2500  integer(kind=kint) :: ctrl
2501  integer(kind=kint) :: counter
2502  type(fstr_param_pack),target :: P
2503 
2504  integer(kind=kint) :: rcode
2505 
2506  if( counter >= 2 ) then
2507  write(ilog,*) '### Error : !SOLVER exists twice in FSTR control file.'
2508  stop hecmw_exit_input
2509  endif
2510 
2511  ! nier => svIarray(1)
2512  ! method => svIarray(2)
2513  ! precond => svIarray(3)
2514  ! nset => svIarray(4)
2515  ! iterpremax => svIarray(5)
2516  ! nrest => svIarray(6)
2517  ! scaling => svIarray(7)
2518  ! iterlog => svIarray(21)
2519  ! timelog => svIarray(22)
2520  ! steplog => svIarray(23)
2521  ! loglevel => svIarray(24)
2522  ! dumptype => svIarray(31)
2523  ! dumpexit => svIarray(32)
2524  ! usejad => svIarray(33)
2525  ! ncolor_in => svIarray(34)
2526  ! mpc_method => svIarray(13)
2527  ! estcond => svIarray(14)
2528  ! contact_elim=> svIarray(15)
2529  ! recompute_residual => svIarray(16)
2530  ! method2 => svIarray(8)
2531  ! recyclepre => svIarray(35)
2532  ! matvec_impl=> svIarray(36)
2533  ! precond_impl=> svIarray(37)
2534  ! solver_opt => svIarray(41:50)
2535  ! nBFGS => svIarray(60)
2536 
2537  ! resid => svRarray(1)
2538  ! sigma_diag => svRarray(2)
2539  ! omega => svRarray(3)
2540  ! thresh => svRarray(4)
2541  ! filter => svRarray(5)
2542  ! solver_ropt=> svRarray(41:50)
2543 
2544  rcode = fstr_ctrl_get_solver( ctrl, &
2545  sviarray(2), sviarray(3), sviarray(4), sviarray(21), sviarray(22), sviarray(23),&
2546  sviarray(1), sviarray(5), sviarray(6), sviarray(60), sviarray(7), &
2547  sviarray(31), sviarray(32), sviarray(33), sviarray(34), sviarray(13), sviarray(14), sviarray(8),&
2548  sviarray(35), sviarray(41:50), sviarray(15), &
2549  svrarray(1), svrarray(2), svrarray(3), &
2550  svrarray(4), svrarray(5), svrarray(41:50), sviarray(24), &
2551  sviarray(36), sviarray(37), sviarray(16) )
2552  if( rcode /= 0 ) call fstr_ctrl_err_stop
2553 
2554  if( sviarray(2) <= 100 ) then
2555  sviarray(99) = 1 ! indirect method
2556  else
2557  sviarray(99) = sviarray(2)-99 !2 ! direct method
2558  end if
2559 
2560  end subroutine fstr_setup_solver
2561 
2562  !* ----------------------------------------------------------------------------------------------- *!
2564  !* ----------------------------------------------------------------------------------------------- *!
2565 
2566  integer function fstr_setup_orientation( ctrl, hecMESH, cnt, coordsys )
2568  implicit none
2569  integer(kind=kint) :: ctrl
2570  type( hecmwst_local_mesh ) :: hecmesh
2571  integer :: cnt
2572  type( tlocalcoordsys ) :: coordsys
2573 
2574  character(len=HECMW_NAME_LEN) :: grp_id_name(1)
2575 
2576  integer :: nid, dtype
2577  character(len=HECMW_NAME_LEN) :: data_fmt
2578  real(kind=kreal) :: fdum, xyza(3), xyzb(3), xyzc(3), ff1(3), ff2(3), ff3(3)
2579 
2581 
2582  nid = 1
2583  coordsys%sys_type = 10
2584 
2585  nid = 1
2586  data_fmt = 'COORDINATES,NODES,LOCAL_NODES '
2587  if( fstr_ctrl_get_param_ex( ctrl, 'DEFINITION ', data_fmt, 0, 'P', nid )/=0 ) return
2588  dtype = nid-1
2589  coordsys%sys_type = coordsys%sys_type + dtype
2590 
2591  if( fstr_ctrl_get_param_ex( ctrl, 'NAME ', '# ', 1, 'S', grp_id_name(1) )/= 0) return
2592  coordsys%sys_name = grp_id_name(1)
2593 
2594  if( dtype==0 ) then
2595  data_fmt = "RRRRRRrrr "
2596  xyzc(:) = 0.d0
2597  if( fstr_ctrl_get_data_ex( ctrl, 1, data_fmt, xyza(1), xyza(2), &
2598  xyza(3), xyzb(1), xyzb(2), xyzb(3), xyzc(1), xyzc(2), xyzc(3) )/=0 ) return
2599  if( coordsys%sys_type==10 ) then
2600  ff1 = xyza-xyzc
2601  fdum = dsqrt( dot_product(ff1, ff1) )
2602  if( fdum==0.d0 ) return
2603  ff1 = ff1/fdum
2604  ff2 = xyzb-xyzc
2605  call cross_product(ff1,ff2,ff3)
2606  coordsys%CoordSys(1,:) = ff1
2607 
2608  fdum = dsqrt( dot_product(ff3, ff3) )
2609  if( fdum==0.d0 ) return
2610  coordsys%CoordSys(3,:) = ff3/fdum
2611 
2612  call cross_product(coordsys%CoordSys(3,:), coordsys%CoordSys(1,:), coordsys%CoordSys(2,:) )
2613  else
2614  coordsys%CoordSys(1,:) = xyza
2615  coordsys%CoordSys(2,:) = xyzb
2616  endif
2617 
2618  else
2619  coordsys%node_ID(3) = 0 ! global origin
2620  data_fmt = "IIi "
2621  if( fstr_ctrl_get_data_ex( ctrl, 1, data_fmt, coordsys%node_ID(1), &
2622  coordsys%node_ID(2), coordsys%node_ID(3) )/=0 ) return
2623  ! DEFINITION=LOCAL_NODES: three local node numbers (1..number of nodes of
2624  ! the element) defining the coordinate system of each element. All three
2625  ! are mandatory here, unlike the third node of DEFINITION=NODES.
2626  if( dtype==2 ) then
2627  if( maxval(coordsys%node_ID(1:3)) > 10 .or. minval(coordsys%node_ID(1:3)) < 1 ) then
2628  write(*,*) "!ORIENTATION, DEFINITION=LOCAL_NODES needs three local node numbers (1-10)!"
2629  write(idbg,*) "!ORIENTATION, DEFINITION=LOCAL_NODES needs three local node numbers (1-10)!"
2630  return
2631  endif
2633  return
2634  endif
2635  if( coordsys%node_ID(3) == 0 ) then
2636  nid = node_global_to_local( hecmesh, coordsys%node_ID(1:2), 2 )
2637  if( nid/=0 .and. nid/=2 ) then
2638  write(*,*) "We cannot define coordinate system using nodes in other CPU!"
2639  write(idbg,*) "We cannot define coordinate system using nodes in other CPU!"
2640  return
2641  endif
2642  else
2643  nid = node_global_to_local( hecmesh, coordsys%node_ID, 3 )
2644  if( nid/=0 .and. nid/=3 ) then
2645  write(*,*) "We cannot define coordinate system using nodes in other CPU!"
2646  write(idbg,*) "We cannot define coordinate system using nodes in other CPU!"
2647  return
2648  endif
2649  endif
2650  endif
2651 
2653  end function fstr_setup_orientation
2654 
2655 
2656  !-----------------------------------------------------------------------------!
2658  !-----------------------------------------------------------------------------!
2659 
2660  subroutine fstr_setup_step( ctrl, counter, P )
2661  implicit none
2662  integer(kind=kint) :: ctrl
2663  integer(kind=kint) :: counter
2664  type(fstr_param_pack) :: P
2665  character(HECMW_NAME_LEN) :: amp
2666  integer(kind=kint) :: amp_id
2667 
2668  integer(kind=kint) :: rcode, iproc
2669 
2670  amp = ' '
2671  rcode = fstr_ctrl_get_step( ctrl, amp, iproc )
2672  if( rcode /= 0 ) call fstr_ctrl_err_stop
2673  call amp_name_to_id( p%MESH, '!STEP', amp, amp_id )
2674  ! P%SOLID%NLSTATIC_ngrp_amp = amp_id;
2675 
2676  end subroutine fstr_setup_step
2677 
2679  subroutine fstr_setup_step_convergence( stepinfo, cpname, cnvparam, istep )
2680  implicit none
2681  type( step_info ), intent(inout) :: stepinfo
2682  character(len=*), intent(in) :: cpname
2683  type( tparamconverg ), intent(in) :: cnvparam(0:)
2684  integer(kind=kint), intent(in) :: istep
2685 
2686  integer(kind=kint) :: i, id
2687 
2688  id = 0
2689  if( len_trim(cpname) > 0 ) then
2690  do i=1,ubound(cnvparam,1)
2691  if( hecmw_streqr( cnvparam(i)%name, cpname ) ) then
2692  id = i; exit
2693  endif
2694  enddo
2695  if( id == 0 ) then
2696  write(*,*) '### Error: CONVERG_PARAM referred to by STEP is not defined before it : ', trim(cpname)
2697  write(ilog,*) '### Error: CONVERG_PARAM referred to by STEP is not defined before it : ', trim(cpname)
2698  stop hecmw_exit_input
2699  endif
2700  endif
2701 
2702  call setup_stepinfo_converg( stepinfo, cnvparam(id) )
2703 
2704  if( .not. any( stepinfo%cnv_check(kcnvresidual:kcnvcorrection, kcnvtranslation:kcnvrotation, :) ) ) then
2705  write(*,*) '### Error: RESIDUAL and CORRECTION are all SKIP in step : ', istep
2706  write(ilog,*) '### Error: RESIDUAL and CORRECTION are all SKIP in step : ', istep
2707  stop hecmw_exit_input
2708  endif
2709 
2710  end subroutine fstr_setup_step_convergence
2711 
2712  integer(kind=kint) function fstr_setup_initial( ctrl, cond, hecMESH )
2713  implicit none
2714  integer(kind=kint) :: ctrl
2715  type( tinitialcondition ) :: cond
2716  type(hecmwst_local_mesh) :: hecmesh
2717  integer, pointer :: grp_id(:), dof(:)
2718  real(kind=kreal), pointer :: temp(:)
2719  character(len=HECMW_NAME_LEN), pointer :: grp_id_name(:)
2720  character(len=HECMW_NAME_LEN) :: data_fmt, ss
2721  integer :: i,j,n, is, ie, gid, nid, rcode
2722 
2723  fstr_setup_initial = -1
2724 
2725  ss = 'TEMPERATURE,VELOCITY,ACCELERATION '
2726  rcode = fstr_ctrl_get_param_ex( ctrl, 'TYPE ', ss, 1, 'P', nid )
2727  if( nid==1 ) then
2728  cond%cond_name = "temperature"
2729  allocate( cond%intval(hecmesh%n_node) )
2730  allocate( cond%realval(hecmesh%n_node) )
2731  elseif( nid==2 ) then
2732  cond%cond_name = "velocity"
2733  allocate( cond%intval(hecmesh%n_node) )
2734  allocate( cond%realval(hecmesh%n_node) )
2735  elseif( nid==3 ) then
2736  cond%cond_name = "acceleration"
2737  allocate( cond%intval(hecmesh%n_node) )
2738  allocate( cond%realval(hecmesh%n_node) )
2739  else
2740  return
2741  endif
2742 
2743  cond%intval = -1
2744  cond%realval = 0.d0
2745 
2746  n = fstr_ctrl_get_data_line_n( ctrl )
2747  if( n<=0 ) return
2748  allocate( temp(n), grp_id_name(n), grp_id(n), dof(n) )
2749  dof = 0
2750  write(ss,*) hecmw_name_len
2751  if( nid==1 ) then
2752  write(data_fmt,'(a,a,a)') 'S',trim(adjustl(ss)),'R '
2753  fstr_setup_initial = &
2754  fstr_ctrl_get_data_array_ex( ctrl, data_fmt, grp_id_name, temp )
2755  else
2756  write(data_fmt,'(a,a,a)') 'S',trim(adjustl(ss)),'IR '
2757  fstr_setup_initial = &
2758  fstr_ctrl_get_data_array_ex( ctrl, data_fmt, grp_id_name, dof, temp )
2759  endif
2760 
2761  if( fstr_setup_initial /= 0 ) then
2762  if( associated(grp_id) ) deallocate( grp_id )
2763  if( associated(temp) ) deallocate( temp )
2764  if( associated(dof) ) deallocate( dof )
2765  if( associated(grp_id_name) ) deallocate( grp_id_name )
2766  return
2767  end if
2768 
2769  call node_grp_name_to_id_ex( hecmesh, '!INITIAL CONDITION', n, grp_id_name, grp_id )
2770  do i=1,n
2771  gid = grp_id(i)
2772  is = hecmesh%node_group%grp_index(gid-1) + 1
2773  ie = hecmesh%node_group%grp_index(gid )
2774  do j=is, ie
2775  nid = hecmesh%node_group%grp_item(j)
2776  cond%realval(nid) = temp(i)
2777  cond%intval(nid) = dof(i)
2778  enddo
2779  enddo
2780 
2781  if( associated(grp_id) ) deallocate( grp_id )
2782  if( associated(temp) ) deallocate( temp )
2783  if( associated(dof) ) deallocate( dof )
2784  if( associated(grp_id_name) ) deallocate( grp_id_name )
2785 end function fstr_setup_initial
2786 
2787  !-----------------------------------------------------------------------------!
2789  !-----------------------------------------------------------------------------!
2790 
2791  subroutine fstr_setup_write( ctrl, counter, P )
2792  implicit none
2793  integer(kind=kint) :: ctrl
2794  integer(kind=kint) :: counter
2795  type(fstr_param_pack) :: P
2796  integer(kind=kint) :: res, visual, neutral
2797 
2798  integer(kind=kint) :: rcode
2799 
2800  rcode = fstr_ctrl_get_write( ctrl, res, visual, neutral )
2801  if( rcode /= 0 ) call fstr_ctrl_err_stop
2802  if( res == 1 ) p%PARAM%fg_result = 1
2803  if( visual == 1 ) p%PARAM%fg_visual = 1
2804  if( neutral == 1 ) p%PARAM%fg_neutral = 1
2805 
2806  end subroutine fstr_setup_write
2807 
2808 
2809  !-----------------------------------------------------------------------------!
2811  !-----------------------------------------------------------------------------!
2812  subroutine fstr_setup_echo( ctrl, counter, P )
2813  implicit none
2814  integer(kind=kint) :: ctrl
2815  integer(kind=kint) :: counter
2816  type(fstr_param_pack) :: P
2817 
2818  integer(kind=kint) :: rcode
2819 
2820  rcode = fstr_ctrl_get_echo( ctrl, &
2821  p%PARAM%fg_echo )
2822  if( rcode /= 0 ) call fstr_ctrl_err_stop
2823 
2824  end subroutine fstr_setup_echo
2825 
2826 
2827  !-----------------------------------------------------------------------------!
2829  !-----------------------------------------------------------------------------!
2830  subroutine fstr_setup_restart( ctrl, nout, version )
2831  implicit none
2832  integer(kind=kint) :: ctrl
2833  integer(kind=kint) :: nout
2834  integer(kind=kint) :: version
2835 
2836  integer(kind=kint) :: rcode
2837  nout = 0
2838  rcode = fstr_ctrl_get_param_ex( ctrl, 'FREQUENCY ', '# ', 0, 'I', nout )
2839  if( rcode /= 0 ) call fstr_ctrl_err_stop
2840  rcode = fstr_ctrl_get_param_ex( ctrl, 'VERSION ', '# ', 0, 'I', version )
2841  if( rcode /= 0 ) call fstr_ctrl_err_stop
2842 
2843  end subroutine fstr_setup_restart
2844 
2845 
2846  !-----------------------------------------------------------------------------!
2848  !-----------------------------------------------------------------------------!
2849 
2850  subroutine fstr_setup_couple( ctrl, counter, P )
2851  use hecmw_setup_util, only &
2853  implicit none
2854  integer(kind=kint) :: ctrl
2855  integer(kind=kint) :: counter
2856  type(fstr_param_pack) :: P
2857  integer(kind=kint) :: rcode
2858  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
2859  integer(kind=kint) :: n, old_size, new_size
2860 
2861  if( p%SOLID%file_type /= kbcffstr ) return
2862 
2863  n = fstr_ctrl_get_data_line_n( ctrl )
2864  if( n == 0 ) return
2865  old_size = p%SOLID%COUPLE_ngrp_tot
2866  new_size = old_size + n
2867  p%SOLID%COUPLE_ngrp_tot = new_size
2868 
2869  call hecmw_expand_integer_array ( p%SOLID%COUPLE_ngrp_ID, old_size, new_size )
2870 
2871  allocate( grp_id_name(n))
2872  rcode = fstr_ctrl_get_couple( ctrl, &
2873  p%PARAM%fg_couple_type, &
2874  p%PARAM%fg_couple_first, &
2875  p%PARAM%fg_couple_window, &
2876  grp_id_name, hecmw_name_len )
2877  if( rcode /= 0 ) call fstr_ctrl_err_stop
2878 
2879  call surf_grp_name_to_id_ex( p%MESH, '!COUPLE', &
2880  n, grp_id_name, p%SOLID%COUPLE_ngrp_ID(old_size+1:))
2881 
2882  deallocate( grp_id_name )
2883  p%PARAM%fg_couple = 1
2884 
2885  end subroutine fstr_setup_couple
2886 
2887  !-----------------------------------------------------------------------------!
2889  !-----------------------------------------------------------------------------!
2890 
2891  subroutine fstr_setup_amplitude( ctrl, P )
2892  implicit none
2893  integer(kind=kint) :: ctrl
2894  type(fstr_param_pack) :: P
2895  real(kind=kreal), pointer :: val(:), table(:)
2896  character(len=HECMW_NAME_LEN) :: name
2897  integer :: nline, n, type_def, type_time, type_val, rcode
2898 
2899  nline = fstr_ctrl_get_data_line_n( ctrl )
2900  if( nline<=0 ) return
2901  allocate( val(nline*4) )
2902  allocate( table(nline*4) )
2903  rcode = fstr_ctrl_get_amplitude( ctrl, nline, name, type_def, type_time, type_val, &
2904  n, val, table )
2905  if( rcode /= 0 ) call fstr_ctrl_err_stop
2906 
2907  call append_new_amplitude( p%MESH%amp, name, type_def, type_time, type_val, n, val, table )
2908 
2909  if( associated(val) ) deallocate( val )
2910  if( associated(table) ) deallocate( table )
2911  end subroutine fstr_setup_amplitude
2912 
2913 
2915  subroutine fstr_setup_element_activation( ctrl, counter, P )
2916  use hecmw_setup_util, only &
2919  implicit none
2920  integer(kind=kint) :: ctrl
2921  integer(kind=kint) :: counter
2922  type(fstr_param_pack) :: P
2923 
2924  integer(kind=kint) :: rcode
2925  character(HECMW_NAME_LEN) :: amp
2926  integer(kind=kint) :: amp_id
2927  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
2928  integer(kind=kint) :: i, n, old_size, new_size
2929  integer(kind=kint) :: gid, mode, measure, state
2930  real(kind=kreal) :: eps
2931  real(kind=kreal), pointer :: thlow(:), thup(:)
2932 
2933  gid = 1
2934  rcode = fstr_ctrl_get_param_ex( ctrl, 'GRPID ', '# ', 0, 'I', gid )
2935 
2936  n = fstr_ctrl_get_data_line_n( ctrl )
2937  if( n == 0 ) return
2938  old_size = p%SOLID%elemact%ELEMACT_egrp_tot
2939  new_size = old_size + n
2940  p%SOLID%elemact%ELEMACT_egrp_tot = new_size
2941 
2942  call hecmw_expand_integer_array ( p%SOLID%elemact%ELEMACT_egrp_GRPID, old_size, new_size )
2943  call hecmw_expand_integer_array ( p%SOLID%elemact%ELEMACT_egrp_ID, old_size, new_size )
2944  call hecmw_expand_integer_array ( p%SOLID%elemact%ELEMACT_egrp_amp, old_size, new_size )
2945  call hecmw_expand_real_array ( p%SOLID%elemact%ELEMACT_egrp_eps, old_size, new_size )
2946  call hecmw_expand_integer_array ( p%SOLID%elemact%ELEMACT_egrp_depends, old_size, new_size )
2947  call hecmw_expand_real_array ( p%SOLID%elemact%ELEMACT_egrp_ts_lower, old_size, new_size )
2948  call hecmw_expand_real_array ( p%SOLID%elemact%ELEMACT_egrp_ts_upper, old_size, new_size )
2949  call hecmw_expand_integer_array ( p%SOLID%elemact%ELEMACT_egrp_state, old_size, new_size )
2950 
2951  allocate( grp_id_name(n), thlow(n), thup(n) )
2952  amp = ' '
2953  eps = 1.d-3
2954  rcode = fstr_ctrl_get_element_activation( ctrl, amp, eps, grp_id_name, mode, measure, state, thlow, thup )
2955  if( rcode /= 0 ) call fstr_ctrl_err_stop
2956 
2957  call amp_name_to_id( p%MESH, '!ELEMENT_ACTIVATION', amp, amp_id )
2958  do i=1,n
2959  p%SOLID%elemact%ELEMACT_egrp_amp(old_size+i) = amp_id
2960  p%SOLID%elemact%ELEMACT_egrp_eps(old_size+i) = eps
2961  end do
2962  p%SOLID%elemact%ELEMACT_egrp_GRPID(old_size+1:new_size) = gid
2963  p%SOLID%elemact%ELEMACT_egrp_depends(old_size+1:new_size) = measure
2964  p%SOLID%elemact%ELEMACT_egrp_ts_lower(old_size+1:new_size) = thlow(1:n)
2965  p%SOLID%elemact%ELEMACT_egrp_ts_upper(old_size+1:new_size) = thup(1:n)
2966  p%SOLID%elemact%ELEMACT_egrp_state(old_size+1:new_size) = state
2967 
2968  call elem_grp_name_to_id_ex( p%MESH, '!ELEMENT_ACTIVATION', n, grp_id_name, p%SOLID%elemact%ELEMACT_egrp_ID(old_size+1:))
2969 
2970  deallocate( grp_id_name )
2971  end subroutine fstr_setup_element_activation
2972 
2973 
2974  !*****************************************************************************!
2975  !* HEADERS FOR STATIC ANALYSIS ***********************************************!
2976  !*****************************************************************************!
2977 
2978  !-----------------------------------------------------------------------------!
2980  !-----------------------------------------------------------------------------!
2981 
2982  subroutine fstr_setup_static( ctrl, counter, P )
2983  implicit none
2984  integer(kind=kint) :: ctrl
2985  integer(kind=kint) :: counter
2986  type(fstr_param_pack) :: P
2987  integer(kind=kint) :: rcode
2988 
2989  integer :: nout, nout_monit,node_monit_1 ,elem_monit_1 ,intg_monit_1
2990  integer :: ipt, idx_elpl, iout_list(6)
2991  real(kind=kreal) :: sig_y0, h_dash
2992 
2993  if( counter > 1 ) then
2994  write(*,*)
2995  endif
2996 
2997  ipt = 0
2998  if( fstr_ctrl_get_param_ex( ctrl, 'TYPE ', 'INFINITESIMAL,NLGEOM,INFINITE ', 0, 'P', ipt )/=0 ) &
2999  return
3000  if( ipt == 2 ) p%PARAM%nlgeom = .true.
3001 
3002  ! for backward compatibility
3003  if( ipt == 3 ) then
3004  write(*,*) "Warning : !STATIC : parameter 'TYPE=INFINITE' is deprecated." &
3005  & // " Please use the replacement parameter 'TYPE=INFINITESIMAL'"
3006  endif
3007 
3008  rcode = fstr_ctrl_get_static( ctrl, &
3009  dt, etime, itmax, eps, p%SOLID%restart_nout, &
3010  idx_elpl, &
3011  iout_list, &
3012  sig_y0, h_dash, &
3013  nout, nout_monit, node_monit_1, &
3014  elem_monit_1, intg_monit_1 )
3015 
3016  if( rcode /= 0 ) call fstr_ctrl_err_stop
3017 
3018  end subroutine fstr_setup_static
3019 
3020 
3021  !-----------------------------------------------------------------------------!
3023  !-----------------------------------------------------------------------------!
3024 
3025  subroutine fstr_setup_boundary( ctrl, counter, P )
3026  use hecmw_setup_util, only &
3029  implicit none
3030  integer(kind=kint) :: ctrl
3031  integer(kind=kint) :: counter
3032  type(fstr_param_pack) :: P
3033 
3034  integer(kind=kint) :: rcode
3035  character(HECMW_NAME_LEN) :: amp, rotc_name(1)
3036  integer(kind=kint) :: amp_id, rotc_id(1), n_rotc
3037  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3038  integer(kind=kint),pointer :: dof_ids (:)
3039  integer(kind=kint),pointer :: dof_ide (:)
3040  real(kind=kreal),pointer :: val_ptr(:)
3041  integer(kind=kint) :: i, n, old_size, new_size
3042 
3043  integer(kind=kint) :: gid, istot
3044 
3045  gid = 1
3046  rcode = fstr_ctrl_get_param_ex( ctrl, 'GRPID ', '# ', 0, 'I', gid )
3047 
3048  istot = 0
3049  rcode = fstr_ctrl_get_param_ex( ctrl, 'TOTAL ', '# ', 0, 'E', istot )
3050  if( rcode /= 0 ) call fstr_ctrl_err_stop
3051 
3052  ! get center of torque load
3053  rotc_name = ' '
3054  rotc_id = -1
3055  n_rotc = -1
3056  rcode = fstr_ctrl_get_param_ex( ctrl, 'ROT_CENTER ', '# ', 0, 'S', rotc_name )
3057  if( rcode /= 0 ) call fstr_ctrl_err_stop
3058  if( rotc_name(1) /= ' ' ) then
3059  if( istot /= 0 ) then
3060  write(*,*) 'fstr control file error : !BOUNDARY : rotational boundary cannot be specified with total value'
3061  write(ilog,*) 'fstr control file error : !BOUNDARY : rotational boundary cannot be specified with total value'
3062  call fstr_ctrl_err_stop
3063  endif
3064  p%SOLID%BOUNDARY_ngrp_rot = p%SOLID%BOUNDARY_ngrp_rot + 1
3065  n_rotc = p%SOLID%BOUNDARY_ngrp_rot
3066  call node_grp_name_to_id_ex( p%MESH, '!BOUNDARY,ROT_CENTER=', 1, rotc_name, rotc_id)
3067  endif
3068 
3069 
3070  ! ENTIRE -----------------------------------------------
3071  p%SOLID%file_type = kbcffstr
3072 
3073  n = fstr_ctrl_get_data_line_n( ctrl )
3074  if( n == 0 ) return
3075  old_size = p%SOLID%BOUNDARY_ngrp_tot
3076  new_size = old_size + n
3077  p%SOLID%BOUNDARY_ngrp_tot = new_size
3078  call hecmw_expand_integer_array (p%SOLID%BOUNDARY_ngrp_GRPID, old_size, new_size )
3079  call hecmw_expand_integer_array (p%SOLID%BOUNDARY_ngrp_ID, old_size, new_size )
3080  call hecmw_expand_integer_array (p%SOLID%BOUNDARY_ngrp_type, old_size, new_size )
3081  call hecmw_expand_real_array (p%SOLID%BOUNDARY_ngrp_val, old_size, new_size )
3082  call hecmw_expand_integer_array (p%SOLID%BOUNDARY_ngrp_amp, old_size, new_size )
3083  call hecmw_expand_integer_array (p%SOLID%BOUNDARY_ngrp_istot, old_size, new_size )
3084  call hecmw_expand_integer_array (p%SOLID%BOUNDARY_ngrp_rotID, old_size, new_size )
3085  call hecmw_expand_integer_array (p%SOLID%BOUNDARY_ngrp_centerID, old_size, new_size )
3086 
3087  allocate( grp_id_name(n) )
3088  allocate( dof_ids(n) )
3089  allocate( dof_ide(n) )
3090  allocate( val_ptr(n) )
3091 
3092  amp = ' '
3093  val_ptr = 0.0d0
3094  rcode = fstr_ctrl_get_boundary( ctrl, amp, grp_id_name, hecmw_name_len, dof_ids, dof_ide, val_ptr)
3095  if( rcode /= 0 ) call fstr_ctrl_err_stop
3096  call amp_name_to_id( p%MESH, '!BOUNDARY', amp, amp_id )
3097  p%SOLID%BOUNDARY_ngrp_GRPID(old_size+1:new_size) = gid
3098  call node_grp_name_to_id_ex( p%MESH, '!BOUNDARY', n, grp_id_name, p%SOLID%BOUNDARY_ngrp_ID(old_size+1:))
3099  p%SOLID%BOUNDARY_ngrp_istot(old_size+1:new_size) = istot
3100 
3101  ! set up information about rotation ( default value is set if ROT_CENTER is not given.)
3102  p%SOLID%BOUNDARY_ngrp_rotID(old_size+1:) = n_rotc
3103  p%SOLID%BOUNDARY_ngrp_centerID(old_size+1:) = rotc_id(1)
3104 
3105  do i = 1, n
3106  if( (dof_ids(i) < 1).or.(6 < dof_ids(i)).or.(dof_ide(i) < 1).or.(6 < dof_ide(i)) ) then
3107  write(*,*) 'fstr control file error : !BOUNDARY : range of dof_ids and dof_ide is from 1 to 6'
3108  write(ilog,*) 'fstr control file error : !BOUNDARY : range of dof_ids and dof_ide is from 1 to 6'
3109  call fstr_ctrl_err_stop
3110  end if
3111  p%SOLID%BOUNDARY_ngrp_val(old_size+i) = val_ptr(i)
3112  p%SOLID%BOUNDARY_ngrp_type(old_size+i) = 10 * dof_ids(i) + dof_ide(i)
3113  p%SOLID%BOUNDARY_ngrp_amp(old_size+i) = amp_id
3114  end do
3115 
3116  deallocate( grp_id_name )
3117  deallocate( dof_ids )
3118  deallocate( dof_ide )
3119  deallocate( val_ptr )
3120  nullify( grp_id_name )
3121  nullify( dof_ids )
3122  nullify( dof_ide )
3123  nullify( val_ptr )
3124 
3125  end subroutine fstr_setup_boundary
3126 
3127 
3128  !-----------------------------------------------------------------------------!
3130  !-----------------------------------------------------------------------------!
3131 
3132  subroutine fstr_setup_cload( ctrl, counter, P )
3133  use hecmw_setup_util, only &
3136  implicit none
3137  integer(kind=kint) :: ctrl
3138  integer(kind=kint) :: counter
3139  type(fstr_param_pack) :: P
3140 
3141  integer(kind=kint) :: rcode
3142  character(HECMW_NAME_LEN) :: amp, rotc_name(1)
3143  integer(kind=kint) :: amp_id, rotc_id(1), n_rotc
3144  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3145  real(kind=kreal),pointer :: val_ptr(:)
3146  integer(kind=kint),pointer :: id_ptr(:)
3147  integer(kind=kint) :: i, n, old_size, new_size
3148  integer(kind=kint) :: gid, ngrp_id, nnode_grp
3149  character(len=HECMW_MSG_LEN) :: msg(2)
3150 
3151  if( p%SOLID%file_type /= kbcffstr ) return
3152  gid = 1
3153  rcode = fstr_ctrl_get_param_ex( ctrl, 'GRPID ', '# ', 0, 'I', gid )
3154  if( rcode /= 0 ) call fstr_ctrl_err_stop
3155 
3156  ! get center of torque load
3157  rotc_name = ' '
3158  rotc_id = -1
3159  n_rotc = -1
3160  rcode = fstr_ctrl_get_param_ex( ctrl, 'ROT_CENTER ', '# ', 0, 'S', rotc_name )
3161  if( rcode /= 0 ) call fstr_ctrl_err_stop
3162  if( rotc_name(1) /= ' ' ) then
3163  p%SOLID%CLOAD_ngrp_rot = p%SOLID%CLOAD_ngrp_rot + 1
3164  n_rotc = p%SOLID%CLOAD_ngrp_rot
3165  call node_grp_name_to_id_ex( p%MESH, '!CLOAD,ROT_CENTER=', 1, rotc_name, rotc_id)
3166  endif
3167 
3168  n = fstr_ctrl_get_data_line_n( ctrl )
3169  if( n == 0 ) return
3170  old_size = p%SOLID%CLOAD_ngrp_tot
3171  new_size = old_size + n
3172  p%SOLID%CLOAD_ngrp_tot = new_size
3173  ! Keiji Suemitsu (20140624) <
3174  call hecmw_expand_integer_array ( p%SOLID%CLOAD_ngrp_GRPID, old_size, new_size )
3175  call hecmw_expand_integer_array ( p%SOLID%CLOAD_ngrp_ID, old_size, new_size )
3176  call hecmw_expand_integer_array ( p%SOLID%CLOAD_ngrp_DOF, old_size, new_size )
3177  call hecmw_expand_real_array ( p%SOLID%CLOAD_ngrp_val, old_size, new_size )
3178  call hecmw_expand_integer_array ( p%SOLID%CLOAD_ngrp_amp, old_size, new_size )
3179  call hecmw_expand_integer_array ( p%SOLID%CLOAD_ngrp_rotID, old_size, new_size )
3180  call hecmw_expand_integer_array ( p%SOLID%CLOAD_ngrp_centerID, old_size, new_size )
3181  ! > Keiji Suemitsu (20140624)
3182 
3183  allocate( grp_id_name(n))
3184  allocate( id_ptr(n) )
3185  allocate( val_ptr(n) )
3186  amp = ' '
3187  id_ptr = 0
3188  val_ptr = 0.0d0
3189  rcode = fstr_ctrl_get_cload( ctrl, amp, grp_id_name, hecmw_name_len, id_ptr, val_ptr )
3190  if( rcode /= 0 ) call fstr_ctrl_err_stop
3191 
3192  ! set up information about torque load ( default value is set if ROT_CENTER is not given.)
3193  p%SOLID%CLOAD_ngrp_rotID(old_size+1:) = n_rotc
3194  p%SOLID%CLOAD_ngrp_centerID(old_size+1:) = rotc_id(1)
3195 
3196  call amp_name_to_id( p%MESH, '!CLOAD', amp, amp_id )
3197  do i=1,n
3198  p%SOLID%CLOAD_ngrp_amp(old_size+i) = amp_id
3199  p%SOLID%CLOAD_ngrp_DOF(old_size+i) = id_ptr(i)
3200  p%SOLID%CLOAD_ngrp_val(old_size+i) = val_ptr(i)
3201  end do
3202  p%SOLID%CLOAD_ngrp_GRPID(old_size+1:new_size) = gid
3203  call node_grp_name_to_id_ex( p%MESH, '!CLOAD', n, grp_id_name, p%SOLID%CLOAD_ngrp_ID(old_size+1:))
3204 
3205  deallocate( grp_id_name )
3206  deallocate( id_ptr )
3207  deallocate( val_ptr )
3208  nullify( grp_id_name )
3209  nullify( id_ptr )
3210  nullify( val_ptr )
3211 
3212  ! the refinement adds nodes to the group, so the load given to each node of the group
3213  ! sums up to more than intended before the refinement
3214  if( p%MESH%n_refine > 0 ) then
3215  do i=1,n
3216  ngrp_id = p%SOLID%CLOAD_ngrp_ID(old_size+i)
3217  nnode_grp = hecmw_ngrp_get_number(p%MESH, ngrp_id)
3218  if( nnode_grp > 1 .and. p%MESH%my_rank == 0 ) then
3219  msg(1) = ' ### Warning: !CLOAD on a refined mesh'
3220  write(msg(2),'(a,a,a,i0,a)') ' node group "', trim(p%MESH%node_group%grp_name(ngrp_id)), &
3221  '" now has ', nnode_grp, ' nodes; the same load is applied to each of them'
3222  write(*,'(/a/a/)') trim(msg(1)), trim(msg(2))
3223  write(ilog,'(/a/a/)') trim(msg(1)), trim(msg(2))
3224  endif
3225  enddo
3226  endif
3227 
3228  end subroutine fstr_setup_cload
3229 
3230  !-----------------------------------------------------------------------------!
3232  !-----------------------------------------------------------------------------!
3233  subroutine fstr_setup_fload( ctrl, counter, P )
3234  use hecmw_setup_util, only &
3237  implicit none
3238  !---- args
3239  integer(kind=kint) :: ctrl
3240  integer(kind=kint) :: counter
3241  type(fstr_param_pack) :: P
3242  !---- vals
3243  integer(kind=kint) :: rcode
3244  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3245  real(kind=kreal), pointer :: val_ptr(:)
3246  integer(kind=kint), pointer :: id_ptr(:)
3247  integer(kind=kint) :: i, n, old_size, new_size
3248  integer(kind=kint) :: gid, loadcase
3249  !---- body
3250 
3251  if( p%SOLID%file_type /= kbcffstr) return
3252 
3253  !read grpid
3254  gid = 1
3255  rcode = fstr_ctrl_get_param_ex( ctrl, 'GRPID ', '# ', 0, 'I', gid )
3256  !read loadcase (real=1:default, img=2)
3257  loadcase = kfloadcase_re
3258  rcode = fstr_ctrl_get_param_ex( ctrl, 'LOAD CASE ', '# ', 0, 'I', loadcase)
3259  !write(*,*) "loadcase=", loadcase
3260  !pause
3261 
3262  !read the num of dataline
3263  n = fstr_ctrl_get_data_line_n( ctrl )
3264  if( n == 0 ) return
3265  old_size = p%FREQ%FLOAD_ngrp_tot
3266  new_size = old_size + n
3267 
3268  !expand data array
3269  p%FREQ%FLOAD_ngrp_tot = new_size
3270  call hecmw_expand_integer_array( p%FREQ%FLOAD_ngrp_GRPID, old_size, new_size )
3271  call hecmw_expand_integer_array( p%FREQ%FLOAD_ngrp_ID, old_size, new_size )
3272  call hecmw_expand_integer_array( p%FREQ%FLOAD_ngrp_TYPE, old_size, new_size )
3273  call hecmw_expand_integer_array( p%FREQ%FLOAD_ngrp_DOF, old_size, new_size )
3274  call hecmw_expand_real_array ( p%FREQ%FLOAD_ngrp_valre, old_size, new_size )
3275  call hecmw_expand_real_array ( p%FREQ%FLOAD_ngrp_valim, old_size, new_size )
3276 
3277  !fill bc data
3278  allocate( grp_id_name(n) )
3279  allocate( id_ptr(n) )
3280  allocate( val_ptr(n) )
3281  id_ptr = 0
3282  val_ptr = 0.0d0
3283  rcode = fstr_ctrl_get_fload( ctrl, grp_id_name, hecmw_name_len, id_ptr, val_ptr)
3284  if( rcode /= 0 ) call fstr_ctrl_err_stop
3285  if(loadcase == kfloadcase_re) then
3286  do i = 1, n
3287  p%FREQ%FLOAD_ngrp_DOF(old_size+i) = id_ptr(i)
3288  p%FREQ%FLOAD_ngrp_valre(old_size+i) = val_ptr(i)
3289  enddo
3290  else if(loadcase == kfloadcase_im) then
3291  do i = 1, n
3292  p%FREQ%FLOAD_ngrp_DOF(old_size+i) = id_ptr(i)
3293  p%FREQ%FLOAD_ngrp_valim(old_size+i) = val_ptr(i)
3294  enddo
3295  else
3296  !error
3297  write(*,*) "Error this load set is not defined!"
3298  write(ilog,*) "Error this load set is not defined!"
3299  stop hecmw_exit_model
3300  end if
3301  p%FREQ%FLOAD_ngrp_GRPID(old_size+1:new_size) = gid
3302  call nodesurf_grp_name_to_id_ex( p%MESH, '!FLOAD', n, grp_id_name, &
3303  p%FREQ%FLOAD_ngrp_ID(old_size+1:), p%FREQ%FLOAD_ngrp_TYPE(old_size+1:))
3304 
3305  deallocate( grp_id_name )
3306  deallocate( id_ptr )
3307  deallocate( val_ptr )
3308  nullify( grp_id_name )
3309  nullify( id_ptr )
3310  nullify( val_ptr )
3311  return
3312 
3313  contains
3314 
3315  function fstr_ctrl_get_fload(ctrl, node_id, node_id_len, dof_id, value)
3316  integer(kind=kint) :: ctrl
3317  character(len=HECMW_NAME_LEN) :: node_id(:) !Node group name
3318  integer(kind=kint), pointer :: dof_id(:)
3319  integer(kind=kint) :: node_id_len
3320  real(kind=kreal), pointer :: value(:)
3321  integer(kind=kint) :: fstr_ctrl_get_fload !return value
3322  character(len=HECMW_NAME_LEN) :: data_fmt, ss
3323 
3324  write(ss,*) node_id_len
3325  write(data_fmt, '(a,a,a)') 'S', trim(adjustl(ss)), 'IR '
3326 
3327  fstr_ctrl_get_fload = fstr_ctrl_get_data_array_ex(ctrl, data_fmt, node_id, dof_id, value)
3328  end function
3329 
3330  end subroutine
3331 
3332  !-----------------------------------------------------------------------------!
3334  !-----------------------------------------------------------------------------!
3339  subroutine fstr_setup_facceleration( ctrl, counter, P )
3340  use hecmw_setup_util, only &
3343  implicit none
3344  !---- args
3345  integer(kind=kint) :: ctrl
3346  integer(kind=kint) :: counter
3347  type(fstr_param_pack) :: P
3348  !---- vals
3349  integer(kind=kint) :: rcode
3350  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3351  integer(kind=kint), pointer :: dof_ids(:)
3352  integer(kind=kint), pointer :: dof_ide(:)
3353  real(kind=kreal), pointer :: val_ptr(:)
3354  integer(kind=kint) :: i, n, old_size, new_size
3355  integer(kind=kint) :: loadcase
3356  !---- body
3357 
3358  !only the FrontISTR format is supported
3359  if( p%SOLID%file_type /= kbcffstr) return
3360 
3361  !read loadcase (real=1:default, img=2)
3362  loadcase = kfloadcase_re
3363  rcode = fstr_ctrl_get_param_ex( ctrl, 'LOAD CASE ', '# ', 0, 'I', loadcase)
3364  if( loadcase /= kfloadcase_re .and. loadcase /= kfloadcase_im ) then
3365  write(*,*) 'fstr control file error : !FACCELERATION : LOAD CASE must be 1 or 2'
3366  write(ilog,*) 'fstr control file error : !FACCELERATION : LOAD CASE must be 1 or 2'
3367  stop hecmw_exit_input
3368  end if
3369 
3370  !append the data lines of this header to the entries read so far
3371  n = fstr_ctrl_get_data_line_n( ctrl )
3372  if( n == 0 ) return
3373  old_size = p%FREQ%FACC_ngrp_tot
3374  new_size = old_size + n
3375 
3376  !the expanded part is zero, so the part not given by loadcase stays zero
3377  p%FREQ%FACC_ngrp_tot = new_size
3378  call hecmw_expand_integer_array( p%FREQ%FACC_ngrp_ID, old_size, new_size )
3379  call hecmw_expand_integer_array( p%FREQ%FACC_ngrp_type, old_size, new_size )
3380  call hecmw_expand_real_array ( p%FREQ%FACC_ngrp_valre, old_size, new_size )
3381  call hecmw_expand_real_array ( p%FREQ%FACC_ngrp_valim, old_size, new_size )
3382 
3383  !read the data lines into temporary arrays
3384  allocate( grp_id_name(n) )
3385  allocate( dof_ids(n) )
3386  allocate( dof_ide(n) )
3387  allocate( val_ptr(n) )
3388  val_ptr = 0.0d0
3389  rcode = fstr_ctrl_get_facceleration( ctrl, grp_id_name, hecmw_name_len, dof_ids, dof_ide, val_ptr )
3390  if( rcode /= 0 ) call fstr_ctrl_err_stop
3391  !node ID or node group name -> node group ID
3392  call node_grp_name_to_id_ex( p%MESH, '!FACCELERATION', n, grp_id_name, p%FREQ%FACC_ngrp_ID(old_size+1:) )
3393 
3394  do i = 1, n
3395  !check the range of the DOFs as !ACCELERATION does
3396  if( (dof_ids(i) < 1).or.(6 < dof_ids(i)).or.(dof_ide(i) < dof_ids(i)).or.(6 < dof_ide(i)) ) then
3397  write(*,*) 'fstr control file error : !FACCELERATION : range of dof_ids and dof_ide is from 1 to 6'
3398  write(ilog,*) 'fstr control file error : !FACCELERATION : range of dof_ids and dof_ide is from 1 to 6'
3399  stop hecmw_exit_input
3400  end if
3401  !encode the DOF range as !ACCELERATION does
3402  p%FREQ%FACC_ngrp_type(old_size+i) = 10 * dof_ids(i) + dof_ide(i)
3403  !store the amplitude in the part selected by loadcase
3404  if( loadcase == kfloadcase_re ) then
3405  p%FREQ%FACC_ngrp_valre(old_size+i) = val_ptr(i)
3406  else
3407  p%FREQ%FACC_ngrp_valim(old_size+i) = val_ptr(i)
3408  end if
3409  end do
3410 
3411  deallocate( grp_id_name )
3412  deallocate( dof_ids )
3413  deallocate( dof_ide )
3414  deallocate( val_ptr )
3415  return
3416 
3417  contains
3418 
3419  !read all data lines in the format of NODE_ID, DOF_idS, DOF_idE, Value
3420  function fstr_ctrl_get_facceleration(ctrl, node_id, node_id_len, dof_ids, dof_ide, value)
3421  integer(kind=kint) :: ctrl
3422  character(len=HECMW_NAME_LEN) :: node_id(:)
3423  integer(kind=kint) :: node_id_len
3424  integer(kind=kint), pointer :: dof_ids(:)
3425  integer(kind=kint), pointer :: dof_ide(:)
3426  real(kind=kreal), pointer :: value(:)
3427  integer(kind=kint) :: fstr_ctrl_get_facceleration
3428  character(len=HECMW_NAME_LEN) :: data_fmt, ss
3429 
3430  !format: string of node_id_len characters, two integers and a real
3431  write(ss,*) node_id_len
3432  write(data_fmt, '(a,a,a)') 'S', trim(adjustl(ss)), 'IIr '
3433 
3434  fstr_ctrl_get_facceleration = fstr_ctrl_get_data_array_ex(ctrl, data_fmt, node_id, dof_ids, dof_ide, value)
3435  end function
3436 
3437  end subroutine
3438 
3439  !-----------------------------------------------------------------------------!
3441  !-----------------------------------------------------------------------------!
3442  subroutine fstr_setup_eigenread( ctrl, counter, P )
3443  !---- args
3444  integer(kind=kint) :: ctrl
3445  integer(kind=kint) :: counter
3446  type(fstr_param_pack) :: P
3447  !---- vals
3448  integer(kind=kint) :: filename_len
3449  character(len=HECMW_NAME_LEN) :: datafmt, ss
3450  !---- body
3451 
3452  filename_len = hecmw_filename_len
3453  write(ss,*) filename_len
3454  write(datafmt, '(a,a,a)') 'F', trim(adjustl(ss)), ' '
3455 
3456  if( fstr_ctrl_get_data_ex( ctrl, 1, datafmt, p%FREQ%eigenlog_filename ) /= 0) return
3457  if( fstr_ctrl_get_data_ex( ctrl, 2, 'ii ', p%FREQ%start_mode, p%FREQ%end_mode ) /= 0) return
3458 
3459  return
3460 
3461  end subroutine
3462 
3463  !-----------------------------------------------------------------------------!
3465  !-----------------------------------------------------------------------------!
3466 
3467  subroutine fstr_expand_dload_array( array, old_size, new_size )
3468  implicit none
3469  real(kind=kreal), pointer :: array(:,:)
3470  integer(kind=kint) :: old_size, new_size, i, j
3471  real(kind=kreal), pointer :: temp(:,:)
3472 
3473  if( old_size >= new_size ) then
3474  return
3475  end if
3476 
3477  if( associated( array ) ) then
3478  allocate(temp(0:6, old_size))
3479  temp = array
3480  deallocate(array)
3481  allocate(array(0:6, new_size))
3482  array = 0
3483  do i=1,old_size
3484  do j=0,6
3485  array(j,i) = temp(j,i)
3486  end do
3487  end do
3488  deallocate(temp)
3489  else
3490  allocate(array(0:6, new_size))
3491  array = 0
3492  end if
3493  end subroutine fstr_expand_dload_array
3494 
3496  subroutine fstr_setup_dload( ctrl, counter, P )
3497  use hecmw_setup_util, only &
3499  implicit none
3500  integer(kind=kint) :: ctrl
3501  integer(kind=kint) :: counter
3502  type(fstr_param_pack) :: P
3503 
3504  integer(kind=kint) :: rcode
3505  character(HECMW_NAME_LEN) :: amp
3506  integer(kind=kint) :: amp_id
3507  integer(kind=kint) :: follow
3508  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3509  real(kind=kreal),pointer :: new_params(:,:)
3510  logical,pointer :: fg_surface(:)
3511  integer(kind=kint),pointer :: lid_ptr(:)
3512  integer(kind=kint) :: i, j, n, old_size, new_size
3513  integer(kind=kint) :: gid
3514 
3515  if( p%SOLID%file_type /= kbcffstr ) return
3516 
3517  gid = 1
3518  rcode = fstr_ctrl_get_param_ex( ctrl, 'GRPID ', '# ', 0, 'I', gid )
3519 
3520  n = fstr_ctrl_get_data_line_n( ctrl )
3521  if( n == 0 ) return
3522  old_size = p%SOLID%DLOAD_ngrp_tot
3523  new_size = old_size + n
3524  p%SOLID%DLOAD_ngrp_tot = new_size
3525  ! Keiji Suemitsu (20140624) <
3526  call hecmw_expand_integer_array ( p%SOLID%DLOAD_ngrp_GRPID, old_size, new_size )
3527  call hecmw_expand_integer_array ( p%SOLID%DLOAD_ngrp_ID, old_size, new_size )
3528  call hecmw_expand_integer_array ( p%SOLID%DLOAD_ngrp_LID, old_size, new_size )
3529  call hecmw_expand_integer_array ( p%SOLID%DLOAD_ngrp_amp, old_size, new_size )
3530  call fstr_expand_dload_array ( p%SOLID%DLOAD_ngrp_params, old_size, new_size )
3531  ! > Keiji Suemitsu (20140624)
3532 
3533  allocate( grp_id_name(n))
3534  allocate( lid_ptr(n) )
3535  allocate( new_params(0:6,n))
3536  allocate( fg_surface(n))
3537  new_params = 0
3538  amp = ' '
3539  follow = p%SOLID%DLOAD_follow
3540  if( .not. p%PARAM%nlgeom ) follow = 0
3541  rcode = fstr_ctrl_get_dload( ctrl, amp, follow, &
3542  grp_id_name, hecmw_name_len, &
3543  lid_ptr, new_params )
3544  if( rcode /= 0 ) call fstr_ctrl_err_stop
3545  call amp_name_to_id( p%MESH, '!DLOAD', amp, amp_id )
3546  p%SOLID%DLOAD_follow = follow
3547  do i=1,n
3548  p%SOLID%DLOAD_ngrp_amp(old_size+i) = amp_id
3549  p%SOLID%DLOAD_ngrp_LID(old_size+i) = lid_ptr(i)
3550  do j=0, 6
3551  p%SOLID%DLOAD_ngrp_params(j,old_size+i) = new_params(j,i)
3552  end do
3553  fg_surface(i) = ( lid_ptr(i) == 100 )
3554  end do
3555  p%SOLID%DLOAD_ngrp_GRPID(old_size+1:new_size) = gid
3556  call dload_grp_name_to_id_ex( p%MESH, n, grp_id_name, fg_surface, p%SOLID%DLOAD_ngrp_ID(old_size+1:))
3557  deallocate( grp_id_name )
3558  deallocate( lid_ptr )
3559  deallocate( new_params )
3560  deallocate( fg_surface )
3561  nullify( grp_id_name )
3562  nullify( lid_ptr )
3563  nullify( new_params )
3564  nullify( fg_surface )
3565  end subroutine fstr_setup_dload
3566 
3567 
3568  !-----------------------------------------------------------------------------!
3570  !-----------------------------------------------------------------------------!
3571 
3572  subroutine fstr_setup_temperature( ctrl, counter, P )
3573  use hecmw_setup_util, only &
3576  implicit none
3577  integer(kind=kint) :: ctrl
3578  integer(kind=kint) :: counter
3579  type(fstr_param_pack) :: P
3580 
3581  integer(kind=kint) :: rcode, gid
3582  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3583  real(kind=kreal),pointer :: val_ptr(:)
3584  integer(kind=kint) :: i, n, old_size, new_size
3585 
3586  if( p%SOLID%file_type /= kbcffstr ) return
3587 
3588  gid = 1
3589  rcode = fstr_ctrl_get_param_ex( ctrl, 'GRPID ', '# ', 0, 'I', gid )
3590 
3591  n = fstr_ctrl_get_data_line_n( ctrl )
3592  old_size = p%SOLID%TEMP_ngrp_tot
3593  if( n > 0 ) then
3594  new_size = old_size + n
3595  else
3596  new_size = old_size + 1
3597  endif
3598  call hecmw_expand_integer_array ( p%SOLID%TEMP_ngrp_GRPID, old_size, new_size )
3599  call hecmw_expand_integer_array ( p%SOLID%TEMP_ngrp_ID, old_size, new_size )
3600  call hecmw_expand_real_array ( p%SOLID%TEMP_ngrp_val,old_size, new_size )
3601 
3602  allocate( grp_id_name(n))
3603  allocate( val_ptr(n) )
3604  val_ptr = 0.0d0
3605 
3606  rcode = fstr_ctrl_get_temperature( ctrl, &
3607  p%SOLID%TEMP_irres, &
3608  p%SOLID%TEMP_tstep, &
3609  p%SOLID%TEMP_interval, &
3610  p%SOLID%TEMP_rtype, &
3611  grp_id_name, hecmw_name_len, &
3612  val_ptr )
3613  if( rcode /= 0 ) call fstr_ctrl_err_stop
3614  do i = 1, n
3615  p%SOLID%TEMP_ngrp_val(old_size+i) = val_ptr(i)
3616  enddo
3617  deallocate( val_ptr )
3618  nullify( val_ptr )
3619 
3620  p%SOLID%TEMP_ngrp_GRPID(old_size+1:new_size) = gid
3621  if( n > 0 ) then
3622  if( p%SOLID%TEMP_irres == 0 ) then
3623  p%SOLID%TEMP_ngrp_tot = new_size
3624  call node_grp_name_to_id_ex( p%MESH, '!TEMPERATURE', &
3625  n, grp_id_name, p%SOLID%TEMP_ngrp_ID(old_size+1:))
3626  endif
3627  deallocate( grp_id_name )
3628  endif
3629 
3630  end subroutine fstr_setup_temperature
3631 
3632 
3633  !-----------------------------------------------------------------------------!
3635  !-----------------------------------------------------------------------------!
3636 
3637  subroutine fstr_setup_spring( ctrl, counter, P )
3638  use hecmw_setup_util, only &
3641  implicit none
3642  integer(kind=kint) :: ctrl
3643  integer(kind=kint) :: counter
3644  type(fstr_param_pack) :: P
3645 
3646  integer(kind=kint) :: rcode, incremental
3647  character(HECMW_NAME_LEN) :: amp
3648  integer(kind=kint) :: amp_id
3649  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3650  real(kind=kreal),pointer :: val_ptr(:)
3651  integer(kind=kint),pointer :: id_ptr(:)
3652  integer(kind=kint) :: i, n, old_size, new_size
3653  integer(kind=kint) :: gid
3654 
3655  if( p%SOLID%file_type /= kbcffstr ) return
3656  gid = 1
3657  rcode = fstr_ctrl_get_param_ex( ctrl, 'GRPID ', '# ', 0, 'I', gid )
3658  n = fstr_ctrl_get_data_line_n( ctrl )
3659  if( n == 0 ) return
3660  old_size = p%SOLID%SPRING_ngrp_tot
3661  new_size = old_size + n
3662  p%SOLID%SPRING_ngrp_tot = new_size
3663  call hecmw_expand_integer_array ( p%SOLID%SPRING_ngrp_GRPID, old_size, new_size )
3664  call hecmw_expand_integer_array ( p%SOLID%SPRING_ngrp_ID, old_size, new_size )
3665  call hecmw_expand_integer_array ( p%SOLID%SPRING_ngrp_DOF, old_size, new_size )
3666  call hecmw_expand_real_array ( p%SOLID%SPRING_ngrp_val, old_size, new_size )
3667  call hecmw_expand_integer_array ( p%SOLID%SPRING_ngrp_amp, old_size, new_size )
3668  call hecmw_expand_integer_array ( p%SOLID%SPRING_incremental, old_size, new_size )
3669 
3670  allocate( grp_id_name(n))
3671  allocate( id_ptr(n) )
3672  allocate( val_ptr(n) )
3673  amp = ' '
3674  incremental = 0
3675  id_ptr = 0
3676  val_ptr = 0.0d0
3677  rcode = fstr_ctrl_get_spring( ctrl, amp, grp_id_name, hecmw_name_len, id_ptr, val_ptr, incremental )
3678  if( rcode /= 0 ) call fstr_ctrl_err_stop
3679 
3680  call amp_name_to_id( p%MESH, '!SPRING', amp, amp_id )
3681  do i=1,n
3682  p%SOLID%SPRING_ngrp_amp(old_size+i) = amp_id
3683  p%SOLID%SPRING_ngrp_DOF(old_size+i) = id_ptr(i)
3684  p%SOLID%SPRING_ngrp_val(old_size+i) = val_ptr(i)
3685  end do
3686  p%SOLID%SPRING_ngrp_GRPID(old_size+1:new_size) = gid
3687  call node_grp_name_to_id_ex( p%MESH, '!SPRING', n, grp_id_name, p%SOLID%SPRING_ngrp_ID(old_size+1:))
3688  p%SOLID%SPRING_incremental(old_size+1:new_size) = incremental
3689 
3690  deallocate( grp_id_name )
3691  deallocate( id_ptr )
3692  deallocate( val_ptr )
3693  nullify( grp_id_name )
3694  nullify( id_ptr )
3695  nullify( val_ptr )
3696 
3697  end subroutine fstr_setup_spring
3698 
3699 
3700  !-----------------------------------------------------------------------------!
3702  !-----------------------------------------------------------------------------!
3703 
3704  subroutine fstr_setup_reftemp( ctrl, counter, P )
3705  implicit none
3706  integer(kind=kint) :: ctrl
3707  integer(kind=kint) :: counter
3708  type(fstr_param_pack) :: P
3709 
3710  integer(kind=kint) :: rcode
3711 
3712  rcode = fstr_ctrl_get_reftemp( ctrl, p%PARAM%ref_temp )
3713  if( rcode /= 0 ) call fstr_ctrl_err_stop
3714 
3715  end subroutine fstr_setup_reftemp
3716 
3717 
3718  !*****************************************************************************!
3719  !* HEADERS FOR HEAT ANALYSIS *************************************************!
3720  !*****************************************************************************!
3721 
3722  !-----------------------------------------------------------------------------!
3724  !-----------------------------------------------------------------------------!
3725 
3726  subroutine fstr_setup_heat( ctrl, counter, P )
3727  implicit none
3728  integer(kind=kint) :: ctrl
3729  integer(kind=kint) :: counter
3730  type(fstr_param_pack) :: P
3731 
3732  integer(kind=kint) :: rcode
3733  integer(kind=kint) :: n
3734  character(len=HECMW_NAME_LEN) :: mName
3735  integer(kind=kint) :: i
3736 
3737  n = fstr_ctrl_get_data_line_n( ctrl )
3738 
3739  if( n == 0 ) return
3740 
3741  call reallocate_real( p%PARAM%dtime, n)
3742  call reallocate_real( p%PARAM%etime, n)
3743  call reallocate_real( p%PARAM%dtmin, n)
3744  call reallocate_real( p%PARAM%delmax,n)
3745  call reallocate_integer( p%PARAM%itmax, n)
3746  call reallocate_real( p%PARAM%eps, n)
3747  p%PARAM%analysis_n = n
3748 
3749  p%PARAM%dtime = 0
3750  p%PARAM%etime = 0
3751  p%PARAM%dtmin = 0
3752  p%PARAM%delmax = 0
3753  p%PARAM%itmax = 20
3754  p%PARAM%eps = 1.0e-6
3755  p%PARAM%timepoint_id = 0
3756 
3757  rcode = fstr_ctrl_get_heat( ctrl, &
3758  p%PARAM%dtime, &
3759  p%PARAM%etime, &
3760  p%PARAM%dtmin, &
3761  p%PARAM%delmax, &
3762  p%PARAM%itmax, &
3763  p%PARAM%eps, &
3764  mname, &
3765  p%HEAT%beta)
3766  if( rcode /= 0 ) then
3767  call fstr_ctrl_err_stop
3768  end if
3769 
3770  if( associated(p%PARAM%timepoints) ) then
3771  do i=1,size(p%PARAM%timepoints)
3772  if( hecmw_streqr( p%PARAM%timepoints(i)%name, mname ) ) then
3773  p%PARAM%timepoint_id = i; exit
3774  endif
3775  enddo
3776  endif
3777 
3778  call reallocate_real( p%HEAT%STEP_DLTIME, n)
3779  call reallocate_real( p%HEAT%STEP_EETIME, n)
3780  call reallocate_real( p%HEAT%STEP_DELMIN, n)
3781  call reallocate_real( p%HEAT%STEP_DELMAX, n)
3782  p%HEAT%STEPtot = n
3783 
3784  p%HEAT%STEP_DLTIME = p%PARAM%dtime
3785  p%HEAT%STEP_EETIME = p%PARAM%etime
3786  p%HEAT%STEP_DELMIN = p%PARAM%dtmin
3787  p%HEAT%STEP_DELMAX = p%PARAM%delmax
3788  p%HEAT%timepoint_id = p%PARAM%timepoint_id
3789 
3790  end subroutine fstr_setup_heat
3791 
3792  !-----------------------------------------------------------------------------!
3794  !-----------------------------------------------------------------------------!
3795 
3796  subroutine fstr_setup_fixtemp( ctrl, counter, P )
3797  use hecmw_setup_util, only &
3798  : get_grp_member &
3799  , get_grp_member_n &
3802  implicit none
3803  integer(kind=kint) :: ctrl
3804  integer(kind=kint) :: counter
3805  type(fstr_param_pack),target :: P
3806 
3807  integer(kind=kint) :: rcode
3808  character(HECMW_NAME_LEN) :: amp
3809  integer(kind=kint) :: amp_id
3810  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3811  real(kind=kreal),pointer :: value(:)
3812  integer(kind=kint) :: i, j, n, m, head, id, member_n, old_size, new_size
3813  integer(kind=kint),pointer :: member(:)
3814  integer(kind=kint) :: local_id, rtc
3815  ! ------------------------------------------------
3816 
3817  n = fstr_ctrl_get_data_line_n( ctrl )
3818  if( n == 0 ) return
3819 
3820  allocate( grp_id_name(n))
3821  allocate( value(n))
3822 
3823  amp = ' '
3824  rcode = fstr_ctrl_get_fixtemp( ctrl, amp, &
3825  grp_id_name, hecmw_name_len, value )
3826  if( rcode /= 0 ) call fstr_ctrl_err_stop
3827 
3828  call amp_name_to_id( p%MESH, '!FIXTEMP', amp, amp_id )
3829 
3830  m = 0
3831  do i = 1, n
3832  !rtc = get_local_member_index( P%MESH, 'node', grp_id_name(i), local_id )
3833  rtc = get_sorted_local_member_index( p%MESH, p%PARAM, 'node', grp_id_name(i), local_id )
3834  if( rtc > 0 ) then
3835  m = m + 1
3836  else if( rtc < 0 ) then
3837  m = m + get_grp_member_n( p%MESH, 'node_grp', grp_id_name(i) )
3838  end if
3839  end do
3840 
3841  if (m == 0) then
3842  deallocate( grp_id_name )
3843  deallocate( value )
3844  return
3845  endif
3846 
3847  ! JP-8
3848  old_size = p%HEAT%T_FIX_tot
3849  new_size = old_size + m
3850  call hecmw_expand_integer_array( p%HEAT%T_FIX_node, old_size, new_size )
3851  call hecmw_expand_integer_array( p%HEAT%T_FIX_ampl, old_size, new_size )
3852  call hecmw_expand_real_array( p%HEAT%T_FIX_val, old_size, new_size )
3853  p%HEAT%T_FIX_tot = new_size
3854 
3855  head = old_size + 1
3856  member => p%HEAT%T_FIX_node(head:)
3857  id = head
3858  do i = 1, n
3859  !rtc = get_local_member_index( P%MESH, 'node', grp_id_name(i), local_id )
3860  rtc = get_sorted_local_member_index( p%MESH, p%PARAM, 'node', grp_id_name(i), local_id )
3861  if( rtc > 0 ) then
3862  member(1) = local_id
3863  member_n = 1
3864  else if( rtc < 0 ) then
3865  member_n = get_grp_member( p%MESH, 'node_grp', grp_id_name(i), member )
3866  else
3867  cycle
3868  end if
3869  if( i<n ) then
3870  member => member( member_n+1 : )
3871  endif
3872  do j = 1, member_n
3873  p%HEAT%T_FIX_val (id) = value(i)
3874  p%HEAT%T_FIX_ampl (id) = amp_id
3875  id = id + 1
3876  end do
3877  end do
3878 
3879  deallocate( grp_id_name )
3880  deallocate( value )
3881  end subroutine fstr_setup_fixtemp
3882 
3883 
3884  !-----------------------------------------------------------------------------!
3886  !-----------------------------------------------------------------------------!
3887 
3888  subroutine fstr_setup_cflux( ctrl, counter, P )
3889  use hecmw_setup_util, only &
3890  : get_grp_member &
3891  , get_grp_member_n &
3894  implicit none
3895  integer(kind=kint) :: ctrl
3896  integer(kind=kint) :: counter
3897  type(fstr_param_pack) :: P
3898 
3899  integer(kind=kint) :: rcode
3900  character(HECMW_NAME_LEN) :: amp
3901  integer(kind=kint) :: amp_id
3902  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3903  real(kind=kreal),pointer :: value(:)
3904  integer(kind=kint) :: i, j, n, m, head, id, member_n, old_size, new_size
3905  integer(kind=kint),pointer :: member(:)
3906  integer(kind=kint) :: local_id, rtc
3907  ! ------------------------------------------------
3908 
3909  n = fstr_ctrl_get_data_line_n( ctrl )
3910  if( n == 0 ) return
3911 
3912  allocate( grp_id_name(n))
3913  allocate( value(n))
3914 
3915  amp = ' '
3916  rcode = fstr_ctrl_get_cflux( ctrl, amp, &
3917  grp_id_name, hecmw_name_len, value )
3918  if( rcode /= 0 ) call fstr_ctrl_err_stop
3919 
3920  call amp_name_to_id( p%MESH, '!CFLUX', amp, amp_id )
3921 
3922  m = 0
3923 
3924  do i = 1, n
3925  rtc = get_local_member_index( p%MESH, 'node', grp_id_name(i), local_id )
3926  if( rtc > 0 ) then
3927  m = m + 1
3928  else if( rtc < 0 ) then
3929  m = m + get_grp_member_n( p%MESH, 'node_grp', grp_id_name(i) )
3930  end if
3931  end do
3932 
3933  if (m == 0) then
3934  deallocate( grp_id_name )
3935  deallocate( value )
3936  return
3937  endif
3938 
3939  ! JP-9
3940  old_size = p%HEAT%Q_NOD_tot
3941  new_size = old_size + m
3942  call hecmw_expand_integer_array( p%HEAT%Q_NOD_node, old_size, new_size )
3943  call hecmw_expand_integer_array( p%HEAT%Q_NOD_ampl, old_size, new_size )
3944  call hecmw_expand_real_array( p%HEAT%Q_NOD_val, old_size, new_size )
3945  p%HEAT%Q_NOD_tot = new_size
3946 
3947  head = old_size + 1
3948  member => p%HEAT%Q_NOD_node(head:)
3949  id = head
3950  do i = 1, n
3951  rtc = get_local_member_index( p%MESH, 'node', grp_id_name(i), local_id )
3952  if( rtc > 0 ) then
3953  member(1) = local_id
3954  member_n = 1
3955  else if( rtc < 0 ) then
3956  member_n = get_grp_member( p%MESH, 'node_grp', grp_id_name(i), member )
3957  else
3958  cycle
3959  end if
3960  if( i<n ) member => member( member_n+1 : )
3961  do j = 1, member_n
3962  p%HEAT%Q_NOD_val (id) = value(i)
3963  p%HEAT%Q_NOD_ampl (id) = amp_id
3964  id = id + 1
3965  end do
3966  end do
3967 
3968  deallocate( grp_id_name )
3969  deallocate( value )
3970  end subroutine fstr_setup_cflux
3971 
3972 
3973  !-----------------------------------------------------------------------------!
3975  !-----------------------------------------------------------------------------!
3976 
3977 
3978  subroutine fstr_setup_dflux( ctrl, counter, P )
3979  use hecmw_setup_util, only &
3980  : get_grp_member &
3981  , get_grp_member_n &
3984  implicit none
3985  integer(kind=kint) :: ctrl
3986  integer(kind=kint) :: counter
3987  type(fstr_param_pack) :: P
3988 
3989  integer(kind=kint) :: rcode
3990  character(HECMW_NAME_LEN) :: amp
3991  integer(kind=kint) :: amp_id
3992  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
3993  integer(kind=kint),pointer :: load_type(:)
3994  real(kind=kreal),pointer :: value(:)
3995  integer(kind=kint) :: i, j, n, m, head, id, member_n, old_size, new_size
3996  integer(kind=kint),pointer :: member(:)
3997  integer(kind=kint) :: local_id, rtc
3998  ! ------------------------------------------------
3999 
4000  n = fstr_ctrl_get_data_line_n( ctrl )
4001  if( n == 0 ) return
4002 
4003  allocate( grp_id_name(n))
4004  allocate( load_type(n))
4005  allocate( value(n))
4006 
4007  amp = ' '
4008  rcode = fstr_ctrl_get_dflux( ctrl, amp, &
4009  grp_id_name, hecmw_name_len, load_type, value )
4010  if( rcode /= 0 ) call fstr_ctrl_err_stop
4011 
4012  call amp_name_to_id( p%MESH, '!DFLUX', amp, amp_id )
4013 
4014  m = 0
4015  do i = 1, n
4016  rtc = get_local_member_index( p%MESH, 'element', grp_id_name(i), local_id )
4017  if( rtc > 0 ) then
4018  m = m + 1
4019  else if( rtc < 0 ) then
4020  m = m + get_grp_member_n( p%MESH, 'elem_grp', grp_id_name(i) )
4021  end if
4022  end do
4023 
4024  if (m == 0) then
4025  deallocate( grp_id_name )
4026  deallocate( load_type )
4027  deallocate( value )
4028  return
4029  endif
4030 
4031  ! JP-10
4032  old_size = p%HEAT%Q_SUF_tot
4033  new_size = old_size + m
4034  call hecmw_expand_integer_array( p%HEAT%Q_SUF_elem, old_size, new_size )
4035  call hecmw_expand_integer_array( p%HEAT%Q_SUF_ampl, old_size, new_size )
4036  call hecmw_expand_integer_array( p%HEAT%Q_SUF_surf, old_size, new_size )
4037  call hecmw_expand_real_array( p%HEAT%Q_SUF_val, old_size, new_size )
4038  p%HEAT%Q_SUF_tot = new_size
4039 
4040  head = old_size + 1
4041  member => p%HEAT%Q_SUF_elem(head:)
4042  id = head
4043  do i = 1, n
4044  rtc = get_local_member_index( p%MESH, 'element', grp_id_name(i), local_id )
4045  if( rtc > 0 ) then
4046  member(1) = local_id
4047  member_n = 1
4048  else if( rtc < 0 ) then
4049  member_n = get_grp_member( p%MESH, 'elem_grp', grp_id_name(i), member )
4050  else
4051  cycle
4052  end if
4053  if( i<n ) member => member( member_n+1 : )
4054  do j = 1, member_n
4055  p%HEAT%Q_SUF_surf (id) = load_type(i)
4056  p%HEAT%Q_SUF_val (id) = value(i)
4057  p%HEAT%Q_SUF_ampl (id) = amp_id
4058  id = id + 1
4059  end do
4060  end do
4061 
4062  deallocate( grp_id_name )
4063  deallocate( load_type )
4064  deallocate( value )
4065  end subroutine fstr_setup_dflux
4066 
4067 
4068  !-----------------------------------------------------------------------------!
4070  !-----------------------------------------------------------------------------!
4071 
4072 
4073  subroutine fstr_setup_sflux( ctrl, counter, P )
4074  use hecmw_setup_util, only &
4075  : get_grp_member &
4076  , get_grp_member_n &
4079  implicit none
4080  integer(kind=kint) :: ctrl
4081  integer(kind=kint) :: counter
4082  type(fstr_param_pack) :: P
4083 
4084  integer(kind=kint) :: rcode
4085  character(HECMW_NAME_LEN) :: amp
4086  integer(kind=kint) :: amp_id
4087  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
4088  real(kind=kreal),pointer :: value(:)
4089  integer(kind=kint) :: i, j, n, m, head, id, member_n, old_size, new_size
4090  integer(kind=kint),pointer :: member1(:), member2(:)
4091  ! ------------------------------------------------
4092 
4093  n = fstr_ctrl_get_data_line_n( ctrl )
4094  if( n == 0 ) return
4095 
4096  allocate( grp_id_name(n))
4097  allocate( value(n))
4098 
4099  amp = ' '
4100  rcode = fstr_ctrl_get_sflux( ctrl, amp, &
4101  grp_id_name, hecmw_name_len, value )
4102  if( rcode /= 0 ) call fstr_ctrl_err_stop
4103 
4104  call amp_name_to_id( p%MESH, '!SFLUX', amp, amp_id )
4105 
4106  m = 0
4107  do i = 1, n
4108  m = m + get_grp_member_n( p%MESH, 'surf_grp', grp_id_name(i) )
4109  end do
4110 
4111  if (m == 0) then
4112  deallocate( grp_id_name )
4113  deallocate( value )
4114  return
4115  endif
4116 
4117  ! JP-11
4118  old_size = p%HEAT%Q_SUF_tot
4119  new_size = old_size + m
4120  call hecmw_expand_integer_array( p%HEAT%Q_SUF_elem, old_size, new_size )
4121  call hecmw_expand_integer_array( p%HEAT%Q_SUF_ampl, old_size, new_size )
4122  call hecmw_expand_integer_array( p%HEAT%Q_SUF_surf, old_size, new_size )
4123  call hecmw_expand_real_array( p%HEAT%Q_SUF_val, old_size, new_size )
4124  p%HEAT%Q_SUF_tot = new_size
4125 
4126  head = old_size + 1
4127  member1 => p%HEAT%Q_SUF_elem(head:)
4128  member2 => p%HEAT%Q_SUF_surf(head:)
4129  id = head
4130  do i = 1, n
4131  member_n = get_grp_member( p%MESH, 'surf_grp', grp_id_name(i), member1, member2 )
4132  if( i<n ) then
4133  member1 => member1( member_n+1 : )
4134  member2 => member2( member_n+1 : )
4135  end if
4136  do j = 1, member_n
4137  p%HEAT%Q_SUF_val (id) = value(i)
4138  p%HEAT%Q_SUF_ampl (id) = amp_id
4139  id = id + 1
4140  end do
4141  end do
4142 
4143  deallocate( grp_id_name )
4144  deallocate( value )
4145  end subroutine fstr_setup_sflux
4146 
4147 
4148  !-----------------------------------------------------------------------------!
4150  !-----------------------------------------------------------------------------!
4151 
4152 
4153  subroutine fstr_setup_film( ctrl, counter, P )
4154  use hecmw_setup_util, only &
4155  : get_grp_member &
4156  , get_grp_member_n &
4160  implicit none
4161  integer(kind=kint) :: ctrl
4162  integer(kind=kint) :: counter
4163  type(fstr_param_pack) :: P
4164 
4165  integer(kind=kint) :: rcode
4166  character(HECMW_NAME_LEN) :: amp1, amp2
4167  integer(kind=kint) :: amp_id1, amp_id2
4168  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
4169  integer(kind=kint),pointer :: load_type(:)
4170  real(kind=kreal),pointer :: value(:)
4171  real(kind=kreal),pointer :: shink(:)
4172  integer(kind=kint) :: i, j, n, m, head, id, member_n, old_size, new_size
4173  integer(kind=kint),pointer :: member(:)
4174  integer(kind=kint) :: local_id, rtc
4175  ! ------------------------------------------------
4176 
4177  n = fstr_ctrl_get_data_line_n( ctrl )
4178  if( n == 0 ) return
4179 
4180  allocate( grp_id_name(n))
4181  allocate( load_type(n))
4182  allocate( value(n))
4183  allocate( shink(n))
4184 
4185  amp1 = ' '
4186  amp2 = ' '
4187 
4188  rcode = fstr_ctrl_get_film( ctrl, amp1, amp2, &
4189  grp_id_name, hecmw_name_len, load_type, value, shink )
4190  if( rcode /= 0 ) call fstr_ctrl_err_stop
4191 
4192  call amp_name_to_id( p%MESH, '!FILM', amp1, amp_id1 )
4193  call amp_name_to_id( p%MESH, '!FILM', amp2, amp_id2 )
4194 
4195  m = 0
4196  do i = 1, n
4197  rtc = get_local_member_index( p%MESH, 'element', grp_id_name(i), local_id )
4198  if( rtc > 0 ) then
4199  m = m + 1
4200  else if( rtc < 0 ) then
4201  m = m + get_grp_member_n( p%MESH, 'elem_grp', grp_id_name(i) )
4202  end if
4203  end do
4204 
4205  if (m == 0) then
4206  deallocate( grp_id_name )
4207  deallocate( load_type )
4208  deallocate( value )
4209  deallocate( shink )
4210  return
4211  endif
4212 
4213  ! JP-12
4214  old_size = p%HEAT%H_SUF_tot
4215  new_size = old_size + m
4216  call hecmw_expand_integer_array( p%HEAT%H_SUF_elem, old_size, new_size )
4217  call hecmw_expand_integer_array2( p%HEAT%H_SUF_ampl, 2, old_size, new_size )
4218  call hecmw_expand_integer_array( p%HEAT%H_SUF_surf, old_size, new_size )
4219  call hecmw_expand_real_array2( p%HEAT%H_SUF_val, 2, old_size, new_size )
4220  p%HEAT%H_SUF_tot = new_size
4221 
4222  head = old_size + 1
4223  member => p%HEAT%H_SUF_elem(head:)
4224  id = head
4225  do i = 1, n
4226  rtc = get_local_member_index( p%MESH, 'element', grp_id_name(i), local_id )
4227  if( rtc > 0 ) then
4228  member(1) = local_id
4229  member_n = 1
4230  else if( rtc < 0 ) then
4231  member_n = get_grp_member( p%MESH, 'elem_grp', grp_id_name(i), member )
4232  else
4233  cycle
4234  end if
4235  if( i<n ) member => member( member_n+1 : )
4236  do j = 1, member_n
4237  p%HEAT%H_SUF_surf (id) = load_type(i)
4238  p%HEAT%H_SUF_val (id,1) = value(i)
4239  p%HEAT%H_SUF_val (id,2) = shink(i)
4240  p%HEAT%H_SUF_ampl (id,1) = amp_id1
4241  p%HEAT%H_SUF_ampl (id,2) = amp_id2
4242  id= id + 1
4243  end do
4244  end do
4245 
4246  deallocate( grp_id_name )
4247  deallocate( load_type )
4248  deallocate( value )
4249  deallocate( shink )
4250  end subroutine fstr_setup_film
4251 
4252 
4253  !-----------------------------------------------------------------------------!
4255  !-----------------------------------------------------------------------------!
4256 
4257 
4258  subroutine fstr_setup_sfilm( ctrl, counter, P )
4259  use hecmw_setup_util, only &
4260  : get_grp_member &
4261  , get_grp_member_n &
4265  implicit none
4266  integer(kind=kint) :: ctrl
4267  integer(kind=kint) :: counter
4268  type(fstr_param_pack) :: P
4269 
4270  integer(kind=kint) :: rcode
4271  character(HECMW_NAME_LEN) :: amp1, amp2
4272  integer(kind=kint) :: amp_id1, amp_id2
4273  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
4274  real(kind=kreal),pointer :: value(:)
4275  real(kind=kreal),pointer :: shink(:)
4276  integer(kind=kint) :: i, j, n, m, head, id, member_n, old_size, new_size
4277  integer(kind=kint),pointer :: member1(:), member2(:)
4278  ! ------------------------------------------------
4279 
4280  n = fstr_ctrl_get_data_line_n( ctrl )
4281  if( n == 0 ) return
4282 
4283  allocate( grp_id_name(n))
4284  allocate( value(n))
4285  allocate( shink(n))
4286 
4287  amp1 = ' '
4288  amp2 = ' '
4289  rcode = fstr_ctrl_get_sfilm( ctrl, amp1, amp2, &
4290  grp_id_name, hecmw_name_len, value, shink )
4291  if( rcode /= 0 ) call fstr_ctrl_err_stop
4292 
4293  call amp_name_to_id( p%MESH, '!SFILM', amp1, amp_id1 )
4294  call amp_name_to_id( p%MESH, '!SFILM', amp2, amp_id2 )
4295 
4296  m = 0
4297  do i = 1, n
4298  m = m + get_grp_member_n( p%MESH, 'surf_grp', grp_id_name(i) )
4299  end do
4300 
4301  if (m == 0) then
4302  deallocate( grp_id_name )
4303  deallocate( value )
4304  deallocate( shink )
4305  return
4306  endif
4307 
4308  ! JP-13
4309  old_size = p%HEAT%H_SUF_tot
4310  new_size = old_size + m
4311  call hecmw_expand_integer_array( p%HEAT%H_SUF_elem, old_size, new_size )
4312  call hecmw_expand_integer_array2( p%HEAT%H_SUF_ampl, 2, old_size, new_size )
4313  call hecmw_expand_integer_array( p%HEAT%H_SUF_surf, old_size, new_size )
4314  call hecmw_expand_real_array2( p%HEAT%H_SUF_val, 2, old_size, new_size )
4315  p%HEAT%H_SUF_tot = new_size
4316 
4317  head = old_size + 1
4318  member1 => p%HEAT%H_SUF_elem(head:)
4319  member2 => p%HEAT%H_SUF_surf(head:)
4320  id = head
4321  do i = 1, n
4322  member_n = get_grp_member( p%MESH, 'surf_grp', grp_id_name(i), member1, member2 )
4323  if( i<n ) then
4324  member1 => member1( member_n+1 : )
4325  member2 => member2( member_n+1 : )
4326  end if
4327  do j = 1, member_n
4328  p%HEAT%H_SUF_val (id,1) = value(i)
4329  p%HEAT%H_SUF_val (id,2) = shink(i)
4330  p%HEAT%H_SUF_ampl (id,1) = amp_id1
4331  p%HEAT%H_SUF_ampl (id,2) = amp_id2
4332  id = id + 1
4333  end do
4334  end do
4335 
4336  deallocate( grp_id_name )
4337  deallocate( value )
4338  deallocate( shink )
4339  end subroutine fstr_setup_sfilm
4340 
4341 
4342  !-----------------------------------------------------------------------------!
4344  !-----------------------------------------------------------------------------!
4345 
4346 
4347  subroutine fstr_setup_radiate( ctrl, counter, P )
4348  use hecmw_setup_util, only &
4349  : get_grp_member &
4350  , get_grp_member_n &
4354  implicit none
4355  integer(kind=kint) :: ctrl
4356  integer(kind=kint) :: counter
4357  type(fstr_param_pack) :: P
4358 
4359  integer(kind=kint) :: rcode
4360  character(HECMW_NAME_LEN) :: amp1, amp2
4361  integer(kind=kint) :: amp_id1, amp_id2
4362  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
4363  integer(kind=kint),pointer :: load_type(:)
4364  real(kind=kreal),pointer :: value(:)
4365  real(kind=kreal),pointer :: shink(:)
4366  integer(kind=kint) :: i, j, n, m, head, id, member_n, old_size, new_size
4367  integer(kind=kint),pointer :: member(:)
4368  integer(kind=kint) :: local_id, rtc
4369  ! ------------------------------------------------
4370 
4371  n = fstr_ctrl_get_data_line_n( ctrl )
4372  if( n == 0 ) return
4373 
4374  allocate( grp_id_name(n))
4375  allocate( load_type(n))
4376  allocate( value(n))
4377  allocate( shink(n))
4378 
4379  amp1 = ' '
4380  amp2 = ' '
4381  rcode = fstr_ctrl_get_radiate( ctrl, amp1, amp2, &
4382  grp_id_name, hecmw_name_len, load_type, value, shink )
4383  if( rcode /= 0 ) call fstr_ctrl_err_stop
4384 
4385  call amp_name_to_id( p%MESH, '!RADIATE', amp1, amp_id1 )
4386  call amp_name_to_id( p%MESH, '!RADIATE', amp2, amp_id2 )
4387 
4388  m = 0
4389  do i = 1, n
4390  rtc = get_local_member_index( p%MESH, 'element', grp_id_name(i), local_id )
4391  if( rtc > 0 ) then
4392  m = m + 1
4393  else if( rtc < 0 ) then
4394  m = m + get_grp_member_n( p%MESH, 'elem_grp', grp_id_name(i) )
4395  end if
4396  end do
4397 
4398  if (m == 0) then
4399  deallocate( grp_id_name )
4400  deallocate( load_type )
4401  deallocate( value )
4402  deallocate( shink )
4403  return
4404  endif
4405 
4406  ! JP-14
4407  old_size = p%HEAT%R_SUF_tot
4408  new_size = old_size + m
4409  call hecmw_expand_integer_array( p%HEAT%R_SUF_elem, old_size, new_size )
4410  call hecmw_expand_integer_array2( p%HEAT%R_SUF_ampl, 2, old_size, new_size )
4411  call hecmw_expand_integer_array( p%HEAT%R_SUF_surf, old_size, new_size )
4412  call hecmw_expand_real_array2( p%HEAT%R_SUF_val, 2, old_size, new_size )
4413  p%HEAT%R_SUF_tot = new_size
4414 
4415  head = old_size + 1
4416  member => p%HEAT%R_SUF_elem(head:)
4417  id = head
4418  do i = 1, n
4419  rtc = get_local_member_index( p%MESH, 'element', grp_id_name(i), local_id )
4420  if( rtc > 0 ) then
4421  member(1) = local_id
4422  member_n = 1
4423  else if( rtc < 0 ) then
4424  member_n = get_grp_member( p%MESH, 'elem_grp', grp_id_name(i), member )
4425  else
4426  cycle
4427  end if
4428  if( i<n ) member => member( member_n+1 : )
4429  do j = 1, member_n
4430  p%HEAT%R_SUF_surf (id) = load_type(i)
4431  p%HEAT%R_SUF_val (id,1) = value(i)
4432  p%HEAT%R_SUF_val (id,2) = shink(i)
4433  p%HEAT%R_SUF_ampl (id,1) = amp_id1
4434  p%HEAT%R_SUF_ampl (id,2) = amp_id2
4435  id = id + 1
4436  end do
4437  end do
4438 
4439  deallocate( grp_id_name )
4440  deallocate( load_type )
4441  deallocate( value )
4442  deallocate( shink )
4443  end subroutine fstr_setup_radiate
4444 
4445 
4446  !-----------------------------------------------------------------------------!
4448  !-----------------------------------------------------------------------------!
4449 
4450 
4451  subroutine fstr_setup_sradiate( ctrl, counter, P )
4452  use hecmw_setup_util, only &
4453  : get_grp_member &
4454  , get_grp_member_n &
4458  implicit none
4459  integer(kind=kint) :: ctrl
4460  integer(kind=kint) :: counter
4461  type(fstr_param_pack) :: P
4462 
4463  integer(kind=kint) :: rcode
4464  character(HECMW_NAME_LEN) :: amp1, amp2
4465  integer(kind=kint) :: amp_id1, amp_id2
4466  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
4467  real(kind=kreal),pointer :: value(:)
4468  real(kind=kreal),pointer :: shink(:)
4469  integer(kind=kint) :: i, j, n, m, head, id, member_n, old_size, new_size
4470  integer(kind=kint),pointer :: member1(:), member2(:)
4471  ! ------------------------------------------------
4472 
4473  n = fstr_ctrl_get_data_line_n( ctrl )
4474  if( n == 0 ) return
4475 
4476  allocate( grp_id_name(n))
4477  allocate( value(n))
4478  allocate( shink(n))
4479 
4480  amp1 = ' '
4481  amp2 = ' '
4482  rcode = fstr_ctrl_get_sradiate( ctrl, amp1, amp2, grp_id_name, hecmw_name_len, value, shink )
4483  if( rcode /= 0 ) call fstr_ctrl_err_stop
4484 
4485  call amp_name_to_id( p%MESH, '!SRADIATE', amp1, amp_id1 )
4486  call amp_name_to_id( p%MESH, '!SRADIATE', amp2, amp_id2 )
4487 
4488  m = 0
4489  do i = 1, n
4490  m = m + get_grp_member_n( p%MESH, 'surf_grp', grp_id_name(i) )
4491  end do
4492 
4493  if (m == 0) then
4494  deallocate( grp_id_name )
4495  deallocate( value )
4496  deallocate( shink )
4497  return
4498  endif
4499 
4500  ! JP-15
4501  old_size = p%HEAT%R_SUF_tot
4502  new_size = old_size + m
4503  call hecmw_expand_integer_array( p%HEAT%R_SUF_elem, old_size, new_size )
4504  call hecmw_expand_integer_array2( p%HEAT%R_SUF_ampl, 2, old_size, new_size )
4505  call hecmw_expand_integer_array( p%HEAT%R_SUF_surf, old_size, new_size )
4506  call hecmw_expand_real_array2( p%HEAT%R_SUF_val, 2, old_size, new_size )
4507  p%HEAT%R_SUF_tot = new_size
4508 
4509  head = old_size + 1
4510  member1 => p%HEAT%R_SUF_elem(head:)
4511  member2 => p%HEAT%R_SUF_surf(head:)
4512  id = head
4513  do i = 1, n
4514  member_n = get_grp_member( p%MESH, 'surf_grp', grp_id_name(i), member1, member2 )
4515  if( i<n ) then
4516  member1 => member1( member_n+1 : )
4517  member2 => member2( member_n+1 : )
4518  end if
4519  do j = 1, member_n
4520  p%HEAT%R_SUF_val (id,1) = value(i)
4521  p%HEAT%R_SUF_val (id,2) = shink(i)
4522  p%HEAT%R_SUF_ampl (id,1) = amp_id1
4523  p%HEAT%R_SUF_ampl (id,2) = amp_id2
4524  id = id + 1
4525  end do
4526  end do
4527 
4528  deallocate( grp_id_name )
4529  deallocate( value )
4530  deallocate( shink )
4531  end subroutine fstr_setup_sradiate
4532 
4533 
4534  !*****************************************************************************!
4535  !* HEADERS FOR EIGEN ANALYSIS ************************************************!
4536  !*****************************************************************************!
4537 
4538  !-----------------------------------------------------------------------------!
4540  !-----------------------------------------------------------------------------!
4541 
4542  subroutine fstr_setup_eigen( ctrl, counter, P )
4543  implicit none
4544  integer(kind=kint) :: ctrl
4545  integer(kind=kint) :: counter
4546  type(fstr_param_pack) :: P
4547 
4548  integer(kind=kint) :: rcode
4549 
4550  rcode = fstr_ctrl_get_eigen( ctrl, p%EIGEN%nget, p%EIGEN%tolerance, p%EIGEN%maxiter, p%EIGEN%sigma)
4551  if( rcode /= 0) call fstr_ctrl_err_stop
4552 
4553  end subroutine fstr_setup_eigen
4554 
4555 
4556  !*****************************************************************************!
4557  !* HEADERS FOR DYNAMIC ANALYSIS **********************************************!
4558  !*****************************************************************************!
4559 
4560  !-----------------------------------------------------------------------------!
4562  !-----------------------------------------------------------------------------!
4563 
4564  subroutine fstr_setup_dynamic( ctrl, counter, P )
4565  implicit none
4566  integer(kind=kint) :: ctrl
4567  integer(kind=kint) :: counter
4568  type(fstr_param_pack) :: P
4569  integer(kind=kint) :: rcode
4570  character(HECMW_NAME_LEN) :: grp_id_name(1)
4571  integer(kind=kint) :: grp_id(1)
4572 
4573  rcode = fstr_ctrl_get_dynamic( ctrl, &
4574  p%PARAM%nlgeom, &
4575  p%DYN%idx_eqa, &
4576  p%DYN%idx_resp,&
4577  p%DYN%n_step, &
4578  p%DYN%t_start, &
4579  p%DYN%t_end, &
4580  p%DYN%t_delta, &
4581  p%DYN%gamma, &
4582  p%DYN%beta, &
4583  p%DYN%idx_mas, &
4584  p%DYN%idx_dmp, &
4585  p%DYN%ray_m, &
4586  p%DYN%ray_k, &
4587  p%DYN%nout, &
4588  grp_id_name(1), hecmw_name_len, &
4589  p%DYN%nout_monit, &
4590  p%DYN%iout_list )
4591 
4592  if( rcode /= 0) call fstr_ctrl_err_stop
4593 
4594  if( p%DYN%idx_mas /= kmasslumped .and. p%DYN%idx_mas /= kmassconsistent ) then
4595  write(*,*) '### Error: !DYNAMIC mass matrix type must be 1 (lumped) or 2 (consistent)'
4596  write(ilog,*) '### Error: !DYNAMIC mass matrix type must be 1 (lumped) or 2 (consistent)'
4597  call flush(6)
4598  call flush(ilog)
4599  call fstr_ctrl_err_stop
4600  endif
4601  if( p%DYN%idx_mas == kmassconsistent .and. &
4602  (p%DYN%idx_eqa /= 1 .or. p%DYN%idx_resp /= 1) ) then
4603  write(*,*) '### Error: consistent mass matrix is available only for implicit transient analysis'
4604  write(ilog,*) '### Error: consistent mass matrix is available only for implicit transient analysis'
4605  call flush(6)
4606  call flush(ilog)
4607  call fstr_ctrl_err_stop
4608  endif
4609 
4610  if (p%DYN%idx_resp == 1) then
4611  call node_grp_name_to_id_ex( p%MESH, '!DYNAMIC', 1, grp_id_name, grp_id)
4612  p%DYN%ngrp_monit = grp_id(1)
4613  else
4614  read(grp_id_name,*) p%DYN%ngrp_monit
4615  endif
4616 
4617  end subroutine fstr_setup_dynamic
4618 
4619 
4620  !-----------------------------------------------------------------------------!
4622  !-----------------------------------------------------------------------------!
4623 
4624  subroutine fstr_setup_velocity( ctrl, counter, P )
4626  implicit none
4627  integer(kind=kint) :: ctrl
4628  integer(kind=kint) :: counter
4629  type(fstr_param_pack) :: P
4630 
4631  integer(kind=kint) :: rcode
4632  integer(kind=kint) :: vType
4633  character(HECMW_NAME_LEN) :: amp, rotc_name(1)
4634  integer(kind=kint) :: amp_id, rotc_id(1), n_rotc
4635  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
4636  integer(kind=kint),pointer :: dof_ids (:)
4637  integer(kind=kint),pointer :: dof_ide (:)
4638  real(kind=kreal),pointer :: val_ptr(:)
4639  integer(kind=kint) :: i, j, n, old_size, new_size
4640  integer(kind=kint) :: gid
4641 
4642  gid = 1
4643  rcode = fstr_ctrl_get_param_ex( ctrl, 'GRPID ', '# ', 0, 'I', gid )
4644 
4645  ! get center of rotation ( same syntax as !BOUNDARY,ROT_CENTER= )
4646  rotc_name = ' '
4647  rotc_id = -1
4648  n_rotc = -1
4649  rcode = fstr_ctrl_get_param_ex( ctrl, 'ROT_CENTER ', '# ', 0, 'S', rotc_name )
4650  if( rcode /= 0 ) call fstr_ctrl_err_stop
4651  if( rotc_name(1) /= ' ' ) then
4652  p%SOLID%VELOCITY_ngrp_rot = p%SOLID%VELOCITY_ngrp_rot + 1
4653  n_rotc = p%SOLID%VELOCITY_ngrp_rot
4654  call node_grp_name_to_id_ex( p%MESH, '!VELOCITY,ROT_CENTER=', 1, rotc_name, rotc_id)
4655  endif
4656 
4657  n = fstr_ctrl_get_data_line_n( ctrl )
4658  if( n == 0 ) return
4659  old_size = p%SOLID%VELOCITY_ngrp_tot
4660  new_size = old_size + n
4661  p%SOLID%VELOCITY_ngrp_tot = new_size
4662 
4663  call hecmw_expand_integer_array (p%SOLID%VELOCITY_ngrp_GRPID, old_size, new_size )
4664  call hecmw_expand_integer_array (p%SOLID%VELOCITY_ngrp_ID , old_size, new_size )
4665  call hecmw_expand_integer_array (p%SOLID%VELOCITY_ngrp_type, old_size, new_size )
4666  call hecmw_expand_real_array (p%SOLID%VELOCITY_ngrp_val , old_size, new_size )
4667  call hecmw_expand_integer_array (p%SOLID%VELOCITY_ngrp_amp , old_size, new_size )
4668  call hecmw_expand_integer_array (p%SOLID%VELOCITY_ngrp_rotID, old_size, new_size )
4669  call hecmw_expand_integer_array (p%SOLID%VELOCITY_ngrp_centerID, old_size, new_size )
4670 
4671  allocate( grp_id_name(n))
4672  allocate( dof_ids(n))
4673  allocate( dof_ide(n))
4674  allocate( val_ptr(n) )
4675 
4676  amp = ''
4677  val_ptr = 0.0d0
4678  rcode = fstr_ctrl_get_velocity( ctrl, vtype, amp, &
4679  grp_id_name, hecmw_name_len, &
4680  dof_ids, dof_ide, val_ptr )
4681  if( rcode /= 0 ) call fstr_ctrl_err_stop
4682  p%SOLID%VELOCITY_type = vtype
4683  if( vtype == kbcinitial ) p%DYN%VarInitialize = .true.
4684  call amp_name_to_id( p%MESH, '!VELOCITY', amp, amp_id )
4685  call node_grp_name_to_id_ex( p%MESH, '!VELOCITY', &
4686  n, grp_id_name, p%SOLID%VELOCITY_ngrp_ID(old_size+1:))
4687  p%SOLID%VELOCITY_ngrp_GRPID(old_size+1:new_size) = gid
4688 
4689  ! set up information about rotation ( default value is set if ROT_CENTER is not given.)
4690  p%SOLID%VELOCITY_ngrp_rotID(old_size+1:) = n_rotc
4691  p%SOLID%VELOCITY_ngrp_centerID(old_size+1:) = rotc_id(1)
4692 
4693  j = old_size+1
4694  do i = 1, n
4695  if( (dof_ids(i) < 1).or.(6 < dof_ids(i)).or.(dof_ide(i) < 1).or.(6 < dof_ide(i)) ) then
4696  write(ilog,*) 'fstr control file error : !VELOCITY : range of dof_ids and dof_ide is from 1 to 6'
4697  stop hecmw_exit_input
4698  end if
4699  p%SOLID%VELOCITY_ngrp_type(j) = 10 * dof_ids(i) + dof_ide(i)
4700  p%SOLID%VELOCITY_ngrp_amp(j) = amp_id
4701  p%SOLID%VELOCITY_ngrp_val(old_size+i) = val_ptr(i)
4702  j = j+1
4703  end do
4704 
4705  deallocate( grp_id_name )
4706  deallocate( dof_ids )
4707  deallocate( dof_ide )
4708  deallocate( val_ptr )
4709  nullify( grp_id_name )
4710  nullify( dof_ids )
4711  nullify( dof_ide )
4712  nullify( val_ptr )
4713 
4714  end subroutine fstr_setup_velocity
4715 
4716 
4717  !-----------------------------------------------------------------------------!
4719  !-----------------------------------------------------------------------------!
4720 
4721  subroutine fstr_setup_acceleration( ctrl, counter, P )
4723  implicit none
4724  integer(kind=kint) :: ctrl
4725  integer(kind=kint) :: counter
4726  type(fstr_param_pack) :: P
4727 
4728  integer(kind=kint) :: rcode
4729  integer(kind=kint) :: aType
4730  character(HECMW_NAME_LEN) :: amp
4731  integer(kind=kint) :: amp_id
4732  character(HECMW_NAME_LEN), pointer :: grp_id_name(:)
4733  integer(kind=kint),pointer :: dof_ids (:)
4734  integer(kind=kint),pointer :: dof_ide (:)
4735  real(kind=kreal),pointer :: val_ptr(:)
4736  integer(kind=kint) :: i, j, n, old_size, new_size
4737  integer(kind=kint) :: gid
4738 
4739  gid = 1
4740  rcode = fstr_ctrl_get_param_ex( ctrl, 'GRPID ', '# ', 0, 'I', gid )
4741 
4742  n = fstr_ctrl_get_data_line_n( ctrl )
4743  if( n == 0 ) return
4744  old_size = p%SOLID%ACCELERATION_ngrp_tot
4745  new_size = old_size + n
4746  p%SOLID%ACCELERATION_ngrp_tot = new_size
4747 
4748  call hecmw_expand_integer_array (p%SOLID%ACCELERATION_ngrp_GRPID, old_size, new_size )
4749  call hecmw_expand_integer_array (p%SOLID%ACCELERATION_ngrp_ID , old_size, new_size )
4750  call hecmw_expand_integer_array (p%SOLID%ACCELERATION_ngrp_type, old_size, new_size )
4751  call hecmw_expand_real_array (p%SOLID%ACCELERATION_ngrp_val , old_size, new_size )
4752  call hecmw_expand_integer_array (p%SOLID%ACCELERATION_ngrp_amp , old_size, new_size )
4753 
4754  allocate( grp_id_name(n))
4755  allocate( dof_ids(n))
4756  allocate( dof_ide(n))
4757  allocate( val_ptr(n))
4758 
4759  amp = ' '
4760  val_ptr = 0.0d0
4761  rcode = fstr_ctrl_get_acceleration( ctrl, atype, amp, &
4762  grp_id_name, hecmw_name_len, &
4763  dof_ids, dof_ide, val_ptr)
4764  if( rcode /= 0 ) call fstr_ctrl_err_stop
4765  p%SOLID%ACCELERATION_type = atype
4766  if( atype == kbcinitial )p%DYN%VarInitialize = .true.
4767  call amp_name_to_id( p%MESH, '!ACCELERATION', amp, amp_id )
4768  call node_grp_name_to_id_ex( p%MESH, '!ACCELERATION', &
4769  n, grp_id_name, p%SOLID%ACCELERATION_ngrp_ID(old_size+1:))
4770  p%SOLID%ACCELERATION_ngrp_GRPID(old_size+1:new_size) = gid
4771 
4772  j = old_size+1
4773  do i = 1, n
4774  if( (dof_ids(i) < 1).or.(6 < dof_ids(i)).or.(dof_ide(i) < 1).or.(6 < dof_ide(i)) ) then
4775  write(ilog,*) 'fstr control file error : !ACCELERATION : range of dof_ids and dof_ide is from 1 to 6'
4776  stop hecmw_exit_input
4777  end if
4778  p%SOLID%ACCELERATION_ngrp_type(j) = 10 * dof_ids(i) + dof_ide(i)
4779  p%SOLID%ACCELERATION_ngrp_amp(j) = amp_id
4780  p%SOLID%ACCELERATION_ngrp_val(old_size+i) = val_ptr(i)
4781  j = j+1
4782  end do
4783 
4784  deallocate( grp_id_name )
4785  deallocate( dof_ids )
4786  deallocate( dof_ide )
4787  deallocate( val_ptr )
4788  nullify( grp_id_name )
4789  nullify( dof_ids )
4790  nullify( dof_ide )
4791  nullify( val_ptr )
4792  end subroutine fstr_setup_acceleration
4793 
4794 
4795  !*****************************************************************************!
4796  !* MPC ***********************************************************************!
4797  !*****************************************************************************!
4798 
4799  !-----------------------------------------------------------------------------!
4801  !-----------------------------------------------------------------------------!
4802 
4803  subroutine fstr_setup_mpc( ctrl, counter, P )
4804  implicit none
4805  integer(kind=kint) :: ctrl
4806  integer(kind=kint) :: counter
4807  type(fstr_param_pack), target :: P
4808 
4809  integer(kind=kint) :: rcode
4810  ! integer(kind=kint) :: type
4811  ! integer(kind=kint),pointer :: node1_ptr(:)
4812  ! integer(kind=kint),pointer :: node2_ptr(:)
4813  ! integer(kind=kint),pointer :: dof_ptr(:)
4814  ! integer(kind=kint) :: n, old_size, new_size
4815  !
4816  ! rcode = fstr_ctrl_get_param_ex( ctrl, 'TYPE ', 'RIGID ', 1, 'P', type )
4817  ! if( rcode < 0 ) call fstr_ctrl_err_stop
4818  !
4819  ! n = fstr_ctrl_get_data_line_n( ctrl )
4820  ! if( n == 0 ) return
4821  ! old_size = P%MPC_RD%nmpc
4822  ! new_size = old_size + n
4823  ! P%MPC_RD%nmpc = new_size
4824  !
4825  ! call hecmw_expand_integer_array ( P%MPC_RD%node1, old_size, new_size )
4826  ! call hecmw_expand_integer_array ( P%MPC_RD%node2, old_size, new_size )
4827  ! call hecmw_expand_integer_array ( P%MPC_RD%dof, old_size, new_size )
4828  !
4829  ! node1_ptr => P%MPC_RD%node1(old_size+1:)
4830  ! node2_ptr => P%MPC_RD%node2(old_size+1:)
4831  ! dof_ptr => P%MPC_RD%dof(old_size+1:)
4832  !
4833  ! rcode = fstr_ctrl_get_MPC( ctrl, type, node1_ptr, node2_ptr, dof_ptr )
4834  ! if( rcode /= 0 ) call fstr_ctrl_err_stop
4835  !
4836  ! if( node_global_to_local( P%MESH, node1_ptr, n ) /= n ) then
4837  ! call fstr_setup_util_err_stop( '### Error : not exist node (!MPC)' )
4838  ! endif
4839  ! if( node_global_to_local( P%MESH, node2_ptr, n ) /= n ) then
4840  ! call fstr_setup_util_err_stop( '### Error : not exist node (!MPC)' )
4841  ! endif
4842 
4843  ! penalty => svRarray(11)
4844  rcode = fstr_ctrl_get_mpc( ctrl, svrarray(11))
4845  if( rcode /= 0) call fstr_ctrl_err_stop
4846  end subroutine fstr_setup_mpc
4847 
4848 
4849  !*****************************************************************************!
4850  !* IMPORTING NASTRAN BOUNDARY CONDITIONS *************************************!
4851  !*****************************************************************************!
4852 
4853  subroutine fstr_setup_solid_nastran( ctrl, hecMESH, fstrSOLID )
4854  implicit none
4855  integer(kind=kint) :: ctrl
4856  type (hecmwST_local_mesh) :: hecMESH
4857  type (fstr_solid ) :: fstrSOLID
4858  write(ilog,*) '### Error : In !BOUNDARY, TYPE=NASTRAN is not supported.'
4859  call fstr_abort( hecmw_exit_model )
4860  end subroutine fstr_setup_solid_nastran
4861 
4862  !-----------------------------------------------------------------------------!
4864  !-----------------------------------------------------------------------------!
4865 
4866  subroutine fstr_setup_contactalgo( ctrl, P )
4867  implicit none
4868  integer(kind=kint) :: ctrl
4869  ! integer(kind=kint) :: counter
4870  type(fstr_param_pack) :: P
4871 
4872  integer(kind=kint) :: rcode
4873 
4874 
4875  rcode = fstr_ctrl_get_contactalgo( ctrl, p%PARAM%contact_algo, p%PARAM%augiter, &
4876  p%PARAM%fric_cone_follow, p%PARAM%eps_fric_band )
4877  if( rcode /= 0 ) call fstr_ctrl_err_stop
4878 
4879  end subroutine fstr_setup_contactalgo
4880 
4881  !-----------------------------------------------------------------------------!
4883  !-----------------------------------------------------------------------------!
4884 
4885  subroutine fstr_setup_output_sstype( ctrl, P )
4886  implicit none
4887  integer(kind=kint) :: ctrl
4888  type(fstr_param_pack) :: P
4889 
4890  integer(kind=kint) :: rcode, nid
4891  character(len=HECMW_NAME_LEN) :: data_fmt
4892 
4893  data_fmt = 'SOLUTION,MATERIAL '
4894  rcode = fstr_ctrl_get_param_ex( ctrl, 'TYPE ', data_fmt, 0, 'P', nid )
4895  opsstype = nid
4896  if( rcode /= 0 ) call fstr_ctrl_err_stop
4897 
4898  end subroutine fstr_setup_output_sstype
4899 
4900  !-----------------------------------------------------------------------------!
4902  !-----------------------------------------------------------------------------!
4903 
4904  subroutine fstr_convert_contact_type( hecMESH )
4905  implicit none
4906  type(hecmwst_local_mesh), pointer :: hecMESH
4907  integer(kind=kint) :: n, i, sgrp_id, ngrp_id
4908  ! convert SURF_SURF to NODE_SURF
4909  n = hecmesh%contact_pair%n_pair
4910  do i = 1,n
4911  if( hecmesh%contact_pair%type(i) /= hecmw_contact_type_surf_surf ) cycle
4912  sgrp_id = hecmesh%contact_pair%slave_grp_id(i)
4913  call append_node_grp_from_surf_grp( hecmesh, sgrp_id, ngrp_id )
4914  ! change type of contact and slave group ID
4915  hecmesh%contact_pair%type(i) = hecmw_contact_type_node_surf
4916  hecmesh%contact_pair%slave_grp_id(i) = ngrp_id
4917  enddo
4918  end subroutine fstr_convert_contact_type
4919 
4920  !-----------------------------------------------------------------------------!
4922  !-----------------------------------------------------------------------------!
4923 
4931  implicit none
4932  type(fstr_param_pack) :: P
4933  type(hecmwst_local_mesh), pointer :: hecMESH
4934  integer(kind=kint), allocatable :: rot_node(:), n_rot(:), n_rot_all(:), n_explicit(:), rot_grp(:), src(:)
4935  integer(kind=kint), allocatable :: new_index(:), new_list(:)
4936  character(len=HECMW_NAME_LEN), allocatable :: new_name(:)
4937  logical, allocatable :: is_rot(:), in_all(:), is_explicit(:)
4938  integer(kind=kint) :: icel, is, ie, nn, i, j, k, m, n, ig, n_new, first_id, ids, ide
4939 
4940  hecmesh => p%MESH
4941  if( hecmesh%n_dof /= 3 ) return
4942 
4943  ! explicit dummy nodes are in ALL, and the generated ones are not
4944  allocate( in_all(hecmesh%n_node) )
4945  in_all = .false.
4946  ig = get_grp_id( hecmesh, 'node_grp', 'ALL' )
4947  if( ig > 0 ) then
4948  is = hecmesh%node_group%grp_index(ig-1)
4949  in_all(hecmesh%node_group%grp_item(is+1:hecmesh%node_group%grp_index(ig))) = .true.
4950  endif
4951 
4952  allocate( rot_node(hecmesh%n_node), is_explicit(hecmesh%n_node) )
4953  rot_node = 0
4954  is_explicit = .false.
4955  do icel = 1, hecmesh%n_elem
4956  if( .not. hecmw_is_etype_33struct(hecmesh%elem_type(icel)) ) cycle
4957  nn = hecmw_get_max_node(hecmesh%elem_type(icel))/2
4958  is = hecmesh%elem_node_index(icel-1)
4959  do j = 1, nn
4960  rot_node(hecmesh%elem_node_item(is+j)) = hecmesh%elem_node_item(is+nn+j)
4961  if( in_all(hecmesh%elem_node_item(is+nn+j)) ) is_explicit(hecmesh%elem_node_item(is+j)) = .true.
4962  enddo
4963  enddo
4964  ! a rank may hold an external translational node without its 641/761/781 element,
4965  ! so the conditions are converted on every rank by the counts over all the ranks
4966  n = count( rot_node > 0 )
4967  call hecmw_allreduce_i1( hecmesh, n, hecmw_max )
4968  if( n == 0 ) return
4969 
4970  allocate( n_rot(hecmesh%node_group%n_grp), n_rot_all(hecmesh%node_group%n_grp) )
4971  allocate( n_explicit(hecmesh%node_group%n_grp) )
4972  do ig = 1, hecmesh%node_group%n_grp
4973  is = hecmesh%node_group%grp_index(ig-1)
4974  n_rot(ig) = count( rot_node(hecmesh%node_group%grp_item(is+1:hecmesh%node_group%grp_index(ig))) > 0 )
4975  n_explicit(ig) = count( is_explicit(hecmesh%node_group%grp_item(is+1:hecmesh%node_group%grp_index(ig))) )
4976  enddo
4977  n_rot_all = n_rot
4978  call hecmw_allreduce_i( hecmesh, n_rot_all, hecmesh%node_group%n_grp, hecmw_max )
4979 
4980  do i = 1, p%SOLID%SPRING_ngrp_tot
4981  if( p%SOLID%SPRING_ngrp_DOF(i) > 3 .and. n_rot_all(p%SOLID%SPRING_ngrp_ID(i)) > 0 ) &
4982  call rotation_dof_err_stop( '!SPRING' )
4983  enddo
4984  do i = 1, p%SOLID%VELOCITY_ngrp_tot
4985  if( p%SOLID%VELOCITY_ngrp_rotID(i) > 0 ) cycle
4986  if( mod(p%SOLID%VELOCITY_ngrp_type(i), 10) > 3 .and. n_rot_all(p%SOLID%VELOCITY_ngrp_ID(i)) > 0 ) &
4987  call rotation_dof_err_stop( '!VELOCITY' )
4988  enddo
4989  do i = 1, p%SOLID%ACCELERATION_ngrp_tot
4990  if( mod(p%SOLID%ACCELERATION_ngrp_type(i), 10) > 3 .and. n_rot_all(p%SOLID%ACCELERATION_ngrp_ID(i)) > 0 ) &
4991  call rotation_dof_err_stop( '!ACCELERATION' )
4992  enddo
4993  do i = 1, p%FREQ%FLOAD_ngrp_tot
4994  if( p%FREQ%FLOAD_ngrp_TYPE(i) /= kfloadtype_node ) cycle
4995  if( p%FREQ%FLOAD_ngrp_DOF(i) > 3 .and. n_rot_all(p%FREQ%FLOAD_ngrp_ID(i)) > 0 ) &
4996  call rotation_dof_err_stop( '!FLOAD' )
4997  enddo
4998  !the rotational DOFs of !FACCELERATION are also not allowed (the end DOF is mod(type,10))
4999  do i = 1, p%FREQ%FACC_ngrp_tot
5000  if( mod(p%FREQ%FACC_ngrp_type(i), 10) > 3 .and. n_rot_all(p%FREQ%FACC_ngrp_ID(i)) > 0 ) &
5001  call rotation_dof_err_stop( '!FACCELERATION' )
5002  enddo
5003  do i = 1, hecmesh%mpc%n_mpc
5004  do j = hecmesh%mpc%mpc_index(i-1)+1, hecmesh%mpc%mpc_index(i)
5005  if( hecmesh%mpc%mpc_dof(j) > 3 .and. rot_node(hecmesh%mpc%mpc_item(j)) > 0 ) &
5006  call rotation_dof_err_stop( '!EQUATION' )
5007  enddo
5008  enddo
5009 
5010  ! node groups whose rotation is moved: rot_grp(ig) = -1, then the id of the dummy node group
5011  allocate( rot_grp(hecmesh%node_group%n_grp) )
5012  rot_grp = 0
5013  do i = 1, p%SOLID%BOUNDARY_ngrp_tot
5014  if( p%SOLID%BOUNDARY_ngrp_rotID(i) > 0 ) cycle
5015  ig = p%SOLID%BOUNDARY_ngrp_ID(i)
5016  if( mod(p%SOLID%BOUNDARY_ngrp_type(i), 10) <= 3 .or. n_rot_all(ig) == 0 ) cycle
5017  if( n_explicit(ig) > 0 ) call explicit_dummy_node_err_stop( '!BOUNDARY' )
5018  rot_grp(ig) = -1
5019  enddo
5020  do i = 1, p%SOLID%CLOAD_ngrp_tot
5021  if( p%SOLID%CLOAD_ngrp_rotID(i) > 0 .or. p%SOLID%CLOAD_ngrp_DOF(i) <= 3 ) cycle
5022  ig = p%SOLID%CLOAD_ngrp_ID(i)
5023  is = hecmesh%node_group%grp_index(ig-1)
5024  ie = hecmesh%node_group%grp_index(ig)
5025  if( any( rot_node(hecmesh%node_group%grp_item(is+1:ie)) == 0 .and. &
5026  hecmesh%node_group%grp_item(is+1:ie) <= hecmesh%nn_internal ) ) call fstr_setup_util_err_stop( &
5027  '### Error: !CLOAD : dof 4-6 is given to nodes without rotational dof' )
5028  if( n_explicit(ig) > 0 ) call explicit_dummy_node_err_stop( '!CLOAD' )
5029  rot_grp(ig) = -1
5030  enddo
5031 
5032  n_new = count( rot_grp == -1 )
5033  if( n_new == 0 ) return
5034  allocate( new_name(n_new), new_index(0:n_new), new_list(sum(n_rot, mask=rot_grp == -1)) )
5035  new_index(0) = 0
5036  k = 0
5037  m = 0
5038  do ig = 1, hecmesh%node_group%n_grp
5039  if( rot_grp(ig) /= -1 ) cycle
5040  k = k + 1
5041  write( new_name(k), '(a,i0)' ) 'FSTR_ROT_', ig
5042  do j = hecmesh%node_group%grp_index(ig-1)+1, hecmesh%node_group%grp_index(ig)
5043  if( rot_node(hecmesh%node_group%grp_item(j)) == 0 ) cycle
5044  m = m + 1
5045  new_list(m) = rot_node(hecmesh%node_group%grp_item(j))
5046  enddo
5047  new_index(k) = m
5048  rot_grp(ig) = k
5049  enddo
5050  call append_new_groups( hecmesh, 'node_grp', n_new, new_name, new_index, new_list, first_id )
5051  where( rot_grp > 0 ) rot_grp = rot_grp + first_id - 1
5052 
5053  ! split each !BOUNDARY entry into dof 1-3 of its nodes and dof 1-3 of their dummy nodes
5054  n = p%SOLID%BOUNDARY_ngrp_tot
5055  if( n > 0 ) then
5056  allocate( src(2*n), is_rot(2*n) )
5057  m = 0
5058  do i = 1, n
5059  ide = mod(p%SOLID%BOUNDARY_ngrp_type(i), 10)
5060  if( p%SOLID%BOUNDARY_ngrp_rotID(i) <= 0 .and. ide > 3 .and. rot_grp(p%SOLID%BOUNDARY_ngrp_ID(i)) > 0 ) then
5061  if( p%SOLID%BOUNDARY_ngrp_type(i)/10 <= 3 ) then
5062  m = m + 1
5063  src(m) = i
5064  is_rot(m) = .false.
5065  endif
5066  m = m + 1
5067  src(m) = i
5068  is_rot(m) = .true.
5069  else
5070  m = m + 1
5071  src(m) = i
5072  is_rot(m) = .false.
5073  endif
5074  enddo
5075  call remap_integer_array( p%SOLID%BOUNDARY_ngrp_GRPID, src, m )
5076  call remap_integer_array( p%SOLID%BOUNDARY_ngrp_ID, src, m )
5077  call remap_integer_array( p%SOLID%BOUNDARY_ngrp_type, src, m )
5078  call remap_integer_array( p%SOLID%BOUNDARY_ngrp_amp, src, m )
5079  call remap_real_array( p%SOLID%BOUNDARY_ngrp_val, src, m )
5080  call remap_integer_array( p%SOLID%BOUNDARY_ngrp_istot, src, m )
5081  call remap_integer_array( p%SOLID%BOUNDARY_ngrp_rotID, src, m )
5082  call remap_integer_array( p%SOLID%BOUNDARY_ngrp_centerID, src, m )
5083  p%SOLID%BOUNDARY_ngrp_tot = m
5084  do k = 1, m
5085  if( p%SOLID%BOUNDARY_ngrp_rotID(k) > 0 ) cycle
5086  ig = p%SOLID%BOUNDARY_ngrp_ID(k)
5087  ids = p%SOLID%BOUNDARY_ngrp_type(k)/10
5088  ide = mod(p%SOLID%BOUNDARY_ngrp_type(k), 10)
5089  if( ide <= 3 .or. rot_grp(ig) <= 0 ) cycle
5090  if( is_rot(k) ) then
5091  p%SOLID%BOUNDARY_ngrp_ID(k) = rot_grp(ig)
5092  p%SOLID%BOUNDARY_ngrp_type(k) = 10 * (max(ids, 4) - 3) + (ide - 3)
5093  else
5094  p%SOLID%BOUNDARY_ngrp_type(k) = 10 * ids + 3
5095  endif
5096  enddo
5097  endif
5098 
5099  do i = 1, p%SOLID%CLOAD_ngrp_tot
5100  if( p%SOLID%CLOAD_ngrp_rotID(i) > 0 .or. p%SOLID%CLOAD_ngrp_DOF(i) <= 3 ) cycle
5101  p%SOLID%CLOAD_ngrp_ID(i) = rot_grp(p%SOLID%CLOAD_ngrp_ID(i))
5102  p%SOLID%CLOAD_ngrp_DOF(i) = p%SOLID%CLOAD_ngrp_DOF(i) - 3
5103  enddo
5104  end subroutine fstr_convert_rotation_dof
5105 
5106  subroutine rotation_dof_err_stop( header_name )
5107  implicit none
5108  character(len=*) :: header_name
5109 
5110  call fstr_setup_util_err_stop( '### Error: '//header_name// &
5111  ' : dof 4-6 of beam/shell nodes in a mesh with solid elements is not supported' )
5112  end subroutine rotation_dof_err_stop
5113 
5114  subroutine explicit_dummy_node_err_stop( header_name )
5115  implicit none
5116  character(len=*) :: header_name
5117 
5118  call fstr_setup_util_err_stop( '### Error: '//header_name// &
5119  ' : dof 4-6 is given to beam/shell nodes with explicit dummy nodes; give it as dof 1-3 of the dummy nodes' )
5120  end subroutine explicit_dummy_node_err_stop
5121 
5122  subroutine remap_integer_array( array, src, n )
5123  implicit none
5124  integer(kind=kint), pointer :: array(:)
5125  integer(kind=kint), intent(in) :: src(:), n
5126  integer(kind=kint), pointer :: new_array(:)
5127 
5128  allocate( new_array(n) )
5129  new_array(1:n) = array(src(1:n))
5130  deallocate( array )
5131  array => new_array
5132  end subroutine remap_integer_array
5133 
5134  subroutine remap_real_array( array, src, n )
5135  implicit none
5136  real(kind=kreal), pointer :: array(:)
5137  integer(kind=kint), intent(in) :: src(:), n
5138  real(kind=kreal), pointer :: new_array(:)
5139 
5140  allocate( new_array(n) )
5141  new_array(1:n) = array(src(1:n))
5142  deallocate( array )
5143  array => new_array
5144  end subroutine remap_real_array
5145 
5146 end module m_fstr_setup
int fstr_ctrl_get_param_ex(int *ctrl, const char *param_name, const char *value_list, int *necessity, char *type, void *val)
int fstr_ctrl_get_data_array_ex(int *ctrl, const char *format,...)
int fstr_ctrl_open(char *filename)
int fstr_ctrl_get_c_h_name(int *ctrl, char *header_name, int *buff_size)
int fstr_ctrl_get_data_ex(int *ctrl, int *line_no, const char *format,...)
integer(kind=kint) function fstr_ctrl_get_fload(ctrl, node_id, node_id_len, dof_id, value)
integer(kind=kint) function fstr_ctrl_get_facceleration(ctrl, node_id, node_id_len, dof_ids, dof_ide, value)
This module encapsulate the basic functions of all elements provide by this software.
Definition: element.f90:43
integer function numofshellthicknessquadpoints(etype)
Obtains the number of through-thickness quadrature points of a shell element.
Definition: element.f90:490
integer function numofquadpoints(fetype)
Obtains the number of quadrature points of the element.
Definition: element.f90:451
integer(kind=kind(2)) function getspacedimension(etype)
Obtain the space dimension of the element.
Definition: element.f90:118
This module contains fstr control file data obtaining functions.
integer(kind=kint) function fstr_ctrl_get_element_activation(ctrl, amp, eps, grp_id_name, mode, measure, state, thlow, thup)
Read in !ELEMENT_ACTIVATION.
integer(kind=kint) function fstr_ctrl_get_contactparam(ctrl, contactparam)
Read in !CONTACT_PARAM !
integer(kind=kint) function fstr_ctrl_get_solution(ctrl, type, nlgeom)
Read in !SOLUTION.
integer(kind=kint) function fstr_ctrl_get_contact_if(ctrl, n, contact_if)
Read in contact interference.
integer(kind=kint) function fstr_ctrl_get_couple(ctrl, fg_type, fg_first, fg_window, surf_id, surf_id_len)
Read in !COUPLE.
integer(kind=kint) function fstr_get_autoinc(ctrl, aincparam)
Read in !AUTOINC_PARAM !
integer(kind=kint) function fstr_ctrl_get_amplitude(ctrl, nline, name, type_def, type_time, type_val, n, val, table)
Read in !AMPLITUDE.
logical function fstr_ctrl_get_outitem(ctrl, hecMESH, outinfo)
Read in !OUTPUT_RES & !OUTPUT_VIS.
integer(kind=kint) function fstr_ctrl_get_elemopt(ctrl, elemopt361)
Read in !ELEMOPT.
integer(kind=kint) function fstr_ctrl_get_timepoints(ctrl, tp)
Read in !TIME_POINTS.
integer(kind=kint) function fstr_ctrl_get_solver(ctrl, method, precond, nset, iterlog, timelog, steplog, nier, iterpremax, nrest, nBFGS, scaling, dumptype, dumpexit, usejad, ncolor_in, mpc_method, estcond, method2, recyclepre, solver_opt, contact_elim, resid, sigma_diag, omega, thresh, filter, solver_ropt, loglevel, matvec_impl, precond_impl, recompute_residual)
Read in !SOLVER.
integer(kind=kint) function fstr_ctrl_get_echo(ctrl, echo)
Read in !ECHO.
logical function fstr_ctrl_get_contact(ctrl, n, contact, np, tp, ntol, ttol, ctAlgo, cpname, smoothing)
Read in contact definition.
integer(kind=kint) function fstr_ctrl_get_nonlinear_solver(ctrl, method)
Read in !NONLINEAR_SOLVER.
logical function fstr_ctrl_get_istep(ctrl, hecMESH, steps, tpname, apname, cpname)
Read in !STEP and !ISTEP.
integer(kind=kint) function fstr_ctrl_get_convergparam(ctrl, cnvparam)
Read in !CONVERG_PARAM.
integer(kind=kint) function fstr_ctrl_get_contactalgo(ctrl, algo, augiter, conefollow, eps_fric_band)
Read in !CONTACT.
integer(kind=kint) function fstr_ctrl_get_mpc(ctrl, penalty)
Read in !MPC.
integer function fstr_ctrl_get_section(ctrl, hecMESH, sections)
Read in !SECTION.
integer(kind=kint) function fstr_ctrl_get_write(ctrl, res, visual, femap)
Read in !WRITE.
integer(kind=kint) function fstr_ctrl_get_step(ctrl, amp, iproc)
Read in !STEP.
logical function fstr_ctrl_get_embed(ctrl, n, embed, cpname, smoothing)
Read in contact definition.
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, idx_mas, idx_dmp, ray_m, ray_k, nout, node_id, node_id_len, nout_monit, iout_list)
Read in !DYNAMIC.
integer(kind=kint) function fstr_ctrl_get_velocity(ctrl, vType, amp, node_id, node_id_len, dof_ids, dof_ide, value)
Read in !VELOCITY.
integer(kind=kint) function fstr_ctrl_get_acceleration(ctrl, aType, amp, node_id, node_id_len, dof_ids, dof_ide, value)
Read in !ACCELERATION.
This module contains control file data obtaining functions for dynamic analysis.
integer(kind=kint) function fstr_ctrl_get_eigen(ctrl, nget, tolerance, maxiter, sigma)
Read in !EIGEN (struct)
This module contains control file data obtaining functions for heat conductive analysis.
integer(kind=kint) function fstr_ctrl_get_dflux(ctrl, amp, elem_grp_name, elem_grp_name_len, load_type, value)
Read in !DFLUX (heat)
integer(kind=kint) function fstr_ctrl_get_sflux(ctrl, amp, surface_grp_name, surface_grp_name_len, value)
Read in !SFLUX (heat)
integer(kind=kint) function fstr_ctrl_get_weldline(ctrl, hecMESH, grp_name_len, weldline)
Read in !WELD_LINE (heat)
integer(kind=kint) function fstr_ctrl_get_heat(ctrl, dt, etime, dtmin, deltmx, itmax, eps, tpname, beta)
Read in !HEAT.
integer(kind=kint) function fstr_ctrl_get_film(ctrl, amp1, amp2, elem_grp_name, elem_grp_name_len, load_type, value, sink)
Read in !FILM (heat)
integer(kind=kint) function fstr_ctrl_get_radiate(ctrl, amp1, amp2, elem_grp_name, elem_grp_name_len, load_type, value, sink)
Read in !RADIATE (heat)
integer(kind=kint) function fstr_ctrl_get_cflux(ctrl, amp, node_grp_name, node_grp_name_len, value)
Read in !CFLUX (heat)
integer(kind=kint) function fstr_ctrl_get_fixtemp(ctrl, amp, node_grp_name, node_grp_name_len, value)
Read in !FIXTEMP.
integer(kind=kint) function fstr_ctrl_get_sfilm(ctrl, amp1, amp2, surface_grp_name, surface_grp_name_len, value, sink)
Read in !SFILM (heat)
integer(kind=kint) function fstr_ctrl_get_sradiate(ctrl, amp1, amp2, surface_grp_name, surface_grp_name_len, value, sink)
Read in !SRADIATE (heat)
This module manages read in of various material properties.
integer function fstr_ctrl_get_dashpot_d(ctrl, mattype, nlgeom, matval_i, dict)
Read in !DASHPOT_D.
integer function fstr_ctrl_get_hyperelastic(ctrl, mattype, nlgeom, matval)
Read in !HYPERELASTIC.
integer function fstr_ctrl_get_viscoelasticity(ctrl, mattype, nlgeom, dict)
Read in !VISCOELASTIC.
integer function fstr_ctrl_get_viscoplasticity(ctrl, mattype, nlgeom, dict)
Read in !CREEP.
integer function fstr_ctrl_get_usermaterial(ctrl, mattype, nlgeom, nstatus, matval)
Read in !USER_MATERIAL.
integer function fstr_ctrl_get_expansion_coeff(ctrl, matval, dict)
Read in !EXPANSION_COEFF.
integer function fstr_ctrl_get_trs(ctrl, mattype, matval)
Read in !TRS.
integer function fstr_ctrl_get_elasticity(ctrl, mattype, nlgeom, matval, dict)
Read in !ELASTIC.
integer function fstr_ctrl_get_plasticity(ctrl, mattype, nlgeom, matval, mattable, dict)
Read in !PLASTIC.
integer function fstr_ctrl_get_dashpot_a(ctrl, mattype, nlgeom, matval_i, dict)
Read in !DASHPOT_A.
integer function fstr_ctrl_get_material(ctrl, matname)
Read in !MATERIAL.
integer function fstr_ctrl_get_density(ctrl, matval)
Read in !DENSITY.
integer function fstr_ctrl_get_spring_a(ctrl, mattype, nlgeom, matval_i, dict)
Read in !SPRING_A.
integer function fstr_ctrl_get_rayleigh_damping(ctrl, matval, is_RD)
Read in !DAMPING (element-wise Rayleigh damping)
integer function fstr_ctrl_get_fluid(ctrl, mattype, nlgeom, matval, dict)
Read in !FLUID.
integer function fstr_ctrl_get_spring_d(ctrl, mattype, nlgeom, matval_i, dict)
Read in !SPRING_D.
This module contains control file data obtaining functions for static analysis.
integer(kind=kint) function fstr_ctrl_get_static(ctrl, dtime, etime, itime, eps, restart_nout, idx_elpl, iout_list, sig_y0, h_dash, nout, nout_monit, node_monit_1, elem_monit_1, intg_monit_1)
Read in !STATIC.
integer(kind=kint) function fstr_ctrl_get_boundary(ctrl, amp, node_id, node_id_len, dof_ids, dof_ide, value)
Read in !BOUNDARY.
integer(kind=kint) function fstr_ctrl_get_reftemp(ctrl, value)
Read in !REFTEMP.
integer(kind=kint) function fstr_ctrl_get_spring(ctrl, amp, node_id, node_id_len, dof_id, value, incremental)
Read in !SPRING.
integer(kind=kint) function fstr_ctrl_get_dload(ctrl, amp, follow, element_id, element_id_len, load_type, params)
Read in !DLOAD.
integer(kind=kint) function fstr_ctrl_get_temperature(ctrl, irres, tstep, tintl, rtype, node_id, node_id_len, value)
Read in !TEMPERATURE.
integer(kind=kint) function fstr_ctrl_get_cload(ctrl, amp, node_id, node_id_len, dof_id, value)
Read in !CLOAD.
integer function fstr_ctrl_get_userload(ctrl)
Read in !ULOAD.
This module contains auxiliary functions in calculation setup.
subroutine fstr_ctrl_err_stop
subroutine dload_grp_name_to_id_ex(hecMESH, n, grp_id_name, fg_surface, grp_ID)
subroutine fstr_setup_visualize(ctrl, hecMESH)
subroutine nodesurf_grp_name_to_id_ex(hecMESH, header_name, n, grp_id_name, grp_ID, grp_TYPE)
integer(kind=kint) function get_local_member_index(hecMESH, type_name, name, local_id)
subroutine amp_name_to_id(hecMESH, header_name, aname, id)
subroutine append_new_amplitude(amp, name, type_def, type_time, type_val, np, val, table)
Append new amplitude table at the end of existing amplitude tables.
subroutine append_node_grp_from_surf_grp(hecMESH, sgrp_id, ngrp_id)
subroutine fstr_setup_util_err_stop(msg)
subroutine reallocate_real(array, n)
subroutine reallocate_integer(array, n)
integer(kind=kint) function get_sorted_local_member_index(hecMESH, hecPARAM, type_name, name, local_id)
This module contains auxiliary functions in calculation setup.
subroutine append_new_groups(hecMESH, grp_type_name, n, names, index, list, first_id)
Append n groups at once; group i holds list(index(i-1)+1:index(i)).
subroutine hecmw_expand_real_array2(array, column, old_size, new_size)
integer(kind=kint) function node_global_to_local(hecMESH, list, n)
subroutine hecmw_expand_integer_array(array, old_size, new_size)
subroutine node_grp_name_to_id_ex(hecMESH, header_name, n, grp_id_name, grp_ID)
subroutine hecmw_expand_real_array(array, old_size, new_size)
integer(kind=kint) function get_grp_member(hecMESH, grp_type_name, name, member1, member2)
subroutine hecmw_expand_integer_array2(array, column, old_size, new_size)
subroutine surf_grp_name_to_id_ex(hecMESH, header_name, n, grp_id_name, grp_ID)
integer(kind=kint) function get_grp_id(hecMESH, grp_type_name, name)
integer(kind=kint) function get_grp_member_n(hecMESH, grp_type_name, name)
logical function hecmw_streqr(s1, s2)
subroutine elem_grp_name_to_id_ex(hecMESH, header_name, n, grp_id_name, grp_ID)
This module provide functions for elastoplastic calculation.
character(len=128) function, public planestressj2errormessage(ierr)
subroutine, public checkplanestressj2material(matl, ierr)
Shared finite-rotation nodal kinematics and rotation algebra.
logical function, public fstr_has_finite_rotation_kinematics(hecMESH, fstrSOLID)
logical function, public fstr_uses_finite_rotation_kinematics(etype, nn, material)
subroutine, public fstr_mark_finite_rotation_nodes(hecMESH, fstrSOLID, ndof, shell_node_mode)
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_boundary(ctrl, counter, P)
Read in !BOUNDARY !
subroutine fstr_setup_eigenread(ctrl, counter, P)
Read in !EIGENREAD !
subroutine fstr_setup_static(ctrl, counter, P)
Read in !STATIC(old) !
subroutine fstr_setup_mpc(ctrl, counter, P)
Read in !MPC !
integer(kind=kint) function fstr_setup_initial(ctrl, cond, hecMESH)
subroutine fstr_setup_sradiate(ctrl, counter, P)
Read in !SRADIATE !
subroutine fstr_setup_radiate(ctrl, counter, P)
Read in !RADIATE !
subroutine fstr_setup_element_activation(ctrl, counter, P)
Read in !ELEMENT_ACTIVATION.
subroutine fstr_convert_rotation_dof(P)
Move dof 4-6 of 641/761/781 nodes to their rotational dummy nodes !
subroutine fstr_setup_fload(ctrl, counter, P)
Read in !FLOAD !
subroutine fstr_setup_contactalgo(ctrl, P)
Read in !CONTACT !
subroutine fstr_setup_dload(ctrl, counter, P)
Read in !DLOAD.
subroutine fstr_eigen_init(fstrEIG)
Initial setting of eigen ca;culation.
subroutine fstr_check_shell_j2_inputs(hecMESH, fstrSOLID, fstrPARAM)
subroutine fstr_setup_dflux(ctrl, counter, P)
Read in !DFLUX !
subroutine fstr_setup_post_phys_alloc(phys, NDOF, n_node, n_elem)
Initial setting of postprecessor.
subroutine fstr_solid_finalize(fstrSOLID)
Finalizer of fstr_solid.
subroutine fstr_setup_cflux(ctrl, counter, P)
Read in !CFLUX !
subroutine fstr_smoothed_element_calcmaxcon(hecMESH, fstrSOLID)
subroutine fstr_smoothed_element_init(hecMESH, fstrSOLID)
subroutine fstr_setup_amplitude(ctrl, P)
Read in !AMPLITUDE !
subroutine rotation_dof_err_stop(header_name)
subroutine fstr_check_up_inputs(hecMESH, fstrSOLID)
subroutine fstr_convert_contact_type(hecMESH)
Convert SURF-SURF contact to NODE-SURF contact !
subroutine remap_real_array(array, src, n)
subroutine fstr_setup_couple(ctrl, counter, P)
Read in !COUPLE !
subroutine fstr_check_shell_gauss_output(hecMESH, fstrSOLID)
subroutine fstr_solid_init(hecMESH, fstrSOLID)
Initializer of structure fstr_solid.
subroutine fstr_setup_step(ctrl, counter, P)
Read in !STEP !
subroutine fstr_dynamic_init(fstrDYNAMIC)
Initial setting of dynamic calculation.
subroutine fstr_setup_solid_nastran(ctrl, hecMESH, fstrSOLID)
subroutine fstr_setup_solver(ctrl, counter, P)
Read in !SOLVER !
subroutine remap_integer_array(array, src, n)
subroutine fstr_setup_restart(ctrl, nout, version)
Read in !RESTART !
subroutine fstr_setup_cload(ctrl, counter, P)
Read in !CLOAD !
subroutine fstr_heat_init(fstrHEAT)
Initial setting of heat analysis.
subroutine fstr_setup_output_sstype(ctrl, P)
Read in !OUTPUT_SSTYPE !
subroutine fstr_setup_write(ctrl, counter, P)
Read in !WRITE !
subroutine fstr_setup_eigen(ctrl, counter, P)
Read in !EIGEN !
subroutine fstr_setup_film(ctrl, counter, P)
Read in !FILM !
subroutine fstr_setup_solution(ctrl, counter, P)
Read in !SOLUTION !
subroutine fstr_setup_acceleration(ctrl, counter, P)
Read in !ACCELERATION !
subroutine fstr_setup_velocity(ctrl, counter, P)
Read in !VELOCITY !
subroutine fstr_setup_heat(ctrl, counter, P)
Read in !HEAT !
subroutine fstr_setup_temperature(ctrl, counter, P)
Read in !TEMPERATURE !
recursive subroutine fstr_solid_physic_val_finalize(phys)
subroutine fstr_setup_dynamic(ctrl, counter, P)
Read in !DYNAMIC !
subroutine fstr_setup_facceleration(ctrl, counter, P)
Read in !FACCELERATION !
subroutine fstr_setup_nonlinear_solver(ctrl, counter, P)
Read in !NONLINEAR_SOLVER !
subroutine explicit_dummy_node_err_stop(header_name)
subroutine fstr_setup(cntl_filename, hecMESH, fstrPARAM, fstrSOLID, fstrEIG, fstrHEAT, fstrDYNAMIC, fstrCPL, fstrFREQ)
Read in and initialize control data !
Definition: fstr_setup.f90:48
subroutine fstr_setup_step_convergence(stepinfo, cpname, cnvparam, istep)
Fix the convergence criteria of a step from !STEP and the !CONVERG_PARAM it refers to.
integer function fstr_setup_orientation(ctrl, hecMESH, cnt, coordsys)
Read in !ORIENTATION.
subroutine fstr_setup_fixtemp(ctrl, counter, P)
Read in !FIXTEMP !
subroutine fstr_element_init(hecMESH, fstrSOLID, solution_type)
Initialize elements info in static calculation.
subroutine fstr_setup_reftemp(ctrl, counter, P)
Read in !REFTEMP !
subroutine fstr_setup_echo(ctrl, counter, P)
Read in !ECHO !
subroutine fstr_setup_post(ctrl, P)
subroutine fstr_expand_dload_array(array, old_size, new_size)
Reset !DLOAD !
subroutine fstr_setup_sfilm(ctrl, counter, P)
Read in !SFILM !
subroutine fstr_dynamic_alloc(hecMESH, fstrDYNAMIC)
Initial setting of dynamic calculation.
subroutine fstr_setup_spring(ctrl, counter, P)
Read in !SPRING !
subroutine fstr_dynamic_finalize(fstrDYNAMIC)
Finalizer of fstr_solid.
subroutine fstr_setup_sflux(ctrl, counter, P)
Read in !SFLUX !
subroutine fstr_solid_alloc(hecMESH, fstrSOLID)
Initializer of structure fstr_solid.
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
integer(kind=kint), parameter iutb
Definition: m_fstr.F90:120
real(kind=kreal) eps
Definition: m_fstr.F90:153
integer(kind=kint) myrank
PARALLEL EXECUTION.
Definition: m_fstr.F90:107
integer(kind=kint), parameter kel341sesns
Definition: m_fstr.F90:82
integer(kind=kint), parameter kbcffstr
boundary condition file type (bcf)
Definition: m_fstr.F90:66
real(kind=kreal), dimension(100) svrarray
Definition: m_fstr.F90:129
integer(kind=kint), parameter kstdynamic
Definition: m_fstr.F90:41
integer(kind=kint), parameter kel361up
Definition: m_fstr.F90:88
real(kind=kreal) etime
Definition: m_fstr.F90:151
integer(kind=kint), parameter kel341fi
section control
Definition: m_fstr.F90:81
integer(kind=kint), parameter idbg
Definition: m_fstr.F90:122
integer(kind=kint), parameter kel361fi
Definition: m_fstr.F90:84
integer(kind=kint) opsstype
Definition: m_fstr.F90:143
integer(kind=kint), dimension(100) sviarray
SOLVER CONTROL.
Definition: m_fstr.F90:128
integer(kind=kint), parameter kmassconsistent
Definition: m_fstr.F90:74
integer(kind=kint), parameter kon
Definition: m_fstr.F90:33
integer(kind=kint), parameter kfloadcase_im
Definition: m_fstr.F90:97
integer(kind=kint) itmax
Definition: m_fstr.F90:152
integer(kind=kint), parameter kel361ic
Definition: m_fstr.F90:86
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 ilog
FILE HANDLER.
Definition: m_fstr.F90:118
real(kind=kreal) dt
ANALYSIS CONTROL for NLGEOM and HEAT.
Definition: m_fstr.F90:150
integer(kind=kint), parameter kststatic
Definition: m_fstr.F90:38
integer(kind=kint), parameter kbcinitial
Definition: m_fstr.F90:69
integer(kind=kint), parameter kfloadtype_node
Definition: m_fstr.F90:93
integer(kind=kint), parameter kstprecheck
solution type (st)
Definition: m_fstr.F90:37
integer(kind=kint), parameter kcaalagrange
Definition: m_fstr.F90:63
integer(kind=kint), parameter kststaticeigen
Definition: m_fstr.F90:43
integer(kind=kint), parameter kstheat
Definition: m_fstr.F90:40
real(kind=kreal), pointer ref_temp
REFTEMP.
Definition: m_fstr.F90:147
integer(kind=kint), parameter kstnzprof
Definition: m_fstr.F90:44
integer(kind=kint), parameter kel361fbar
Definition: m_fstr.F90:87
integer(kind=kint), parameter ksteigen
Definition: m_fstr.F90:39
type(tinitialcondition), dimension(:), pointer, save g_initialcnd
Definition: m_fstr.F90:162
integer(kind=kint), parameter kmasslumped
mass matrix type
Definition: m_fstr.F90:73
integer(kind=kint), parameter kel611euler
Definition: m_fstr.F90:90
integer(kind=kint), parameter kfloadcase_re
Definition: m_fstr.F90:96
This module manages step information.
Definition: m_out.f90:6
subroutine fstr_init_outctrl(outctrl)
Definition: m_out.f90:229
subroutine fstr_copy_outctrl(outctrl1, outctrl2)
Copy output control except outinfo, which may already hold !OUTPUT_RES / !OUTPUT_VIS settings.
Definition: m_out.f90:238
subroutine fstr_ctrl_get_output(ctrl, outctrl, islog, res, visual, femap)
Definition: m_out.f90:261
This module provides a function to fetch material properties from hecmw.
subroutine fstr_get_prop(hecMESH, shell_var, isect, ee, pp, rho, alpha, thick, n_totlyr, alpha_over_mu, beam_radius, beam_angle1, beam_angle2, beam_angle3, beam_angle4, beam_angle5, beam_angle6)
This module contains several strategy to free locking problem in Eight-node hexagonal element.
integer(kind=kint) function, public return_nn_comp_c3d4_sesns(nn, nodlocal)
This module manages step information.
Definition: m_step.f90:6
subroutine free_stepinfo(step)
Finalizer.
Definition: m_step.f90:192
subroutine init_stepinfo(stepinfo)
Initializer.
Definition: m_step.f90:90
integer(kind=kint), parameter kcnvresidual
Definition: m_step.f90:26
subroutine init_convergparam(cnvparam)
Initializer.
Definition: m_step.f90:222
integer(kind=kint), parameter kcnvtranslation
Definition: m_step.f90:28
integer, parameter stepfixedinc
Definition: m_step.f90:14
integer(kind=kint), parameter kcnvcorrection
Definition: m_step.f90:27
subroutine init_aincparam(aincparam)
Initializer.
Definition: m_step.f90:201
subroutine setup_stepinfo_converg(stepinfo, cnvparam)
Fix the convergence criteria of a step. For each criterion the built-in default is overridden by CONV...
Definition: m_step.f90:118
subroutine setup_stepinfo_starttime(stepinfos)
Definition: m_step.f90:144
integer(kind=kint), parameter kcnvrotation
Definition: m_step.f90:29
This module provides aux functions.
Definition: utilities.f90:6
subroutine cross_product(v1, v2, vn)
Definition: utilities.f90:383
This module manage the parameters for contact calculation.
subroutine, public init_contactparam(cparam)
subroutine, public init_contact_if(contact_if)
This module summarizes all information of material properties.
Definition: material.f90:6
integer(kind=kint), parameter m_youngs
Definition: material.f90:95
integer(kind=kint), parameter m_expansion
Definition: material.f90:107
integer(kind=kint), parameter m_beam_radius
Definition: material.f90:111
integer(kind=kint), parameter viscoelastic
Definition: material.f90:80
integer(kind=kint), parameter m_beam_angle6
Definition: material.f90:117
integer(kind=kint), parameter elastic
Definition: material.f90:68
integer(kind=kint), parameter m_beam_angle3
Definition: material.f90:114
integer(kind=kint), parameter m_density
Definition: material.f90:97
integer(kind=kint), parameter m_beam_angle4
Definition: material.f90:115
integer(kind=kint), parameter m_poisson
Definition: material.f90:96
integer(kind=kint), parameter m_beam_angle1
Definition: material.f90:112
integer(kind=kint), parameter m_beam_angle5
Definition: material.f90:116
integer(kind=kint), parameter m_beam_angle2
Definition: material.f90:113
integer(kind=kint), parameter m_alpha_over_mu
Definition: material.f90:109
subroutine initmaterial(material)
Initializer.
Definition: material.f90:191
This modules defines a structure to record history dependent parameter in static analysis.
Definition: mechgauss.f90:6
integer(kind=kint) function fstr_shell_num_thickness_points(etype)
Compatibility accessor for shell history allocation. The quadrature rule itself is defined in element...
Definition: mechgauss.f90:144
subroutine fstr_init_gauss(gauss)
Initializer.
Definition: mechgauss.f90:89
subroutine fstr_init_shell_layer_gausses(element, ng, nlayer, nthick)
Allocate shell history for every surface Gauss point, layer, and thickness point.
Definition: mechgauss.f90:151
subroutine fstr_finalize_shell_layer_gausses(element)
Release shell layer/thickness history.
Definition: mechgauss.f90:316
logical function fstr_uses_plane_stress_j2_shell(etype, nn, material)
Return whether the element and material are supported by the plane-stress J2 shell path.
Definition: mechgauss.f90:72
integer(kind=kint) function fstr_shell_output_point_count(element)
Number of shell thickness-point tensors available for result output.
Definition: mechgauss.f90:52
Data for coupling analysis.
Definition: m_fstr.F90:661
Data for DYNAMIC ANSLYSIS (fstrDYNAMIC)
Definition: m_fstr.F90:548
Package of data used by Lanczos eigenvalue solver.
Definition: m_fstr.F90:642
Data for HEAT ANSLYSIS (fstrHEAT)
Definition: m_fstr.F90:463
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.F90:165
Data for STATIC ANSLYSIS (fstrSOLID)
Definition: m_fstr.F90:226
Package of all data needs to initialize.
Definition: fstr_setup.f90:30
output control such as output filename, output frequency etc.
Definition: m_out.f90:29
Step control such as active boundary condition, convergent condition etc.
Definition: m_step.f90:35
Convergence criteria of !CONVERG_PARAM, indexed like step_infocnv_check.
Definition: m_step.f90:79