FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
fstr_setup_util.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2019 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
6 
8  use m_fstr
9  use hecmw
11 
16  integer(kind=kint) :: first = 0
17  integer(kind=kint) :: last = 0
18  end type fstr_card_slot
19 
22  type(fstr_card_slot) :: slot
23  integer(kind=kint) :: version = 0
24  integer(kind=kint) :: cid = 0
25  integer(kind=kint) :: cache = 1
26  end type fstr_card_state
27 
30  type(hecmwst_local_mesh), pointer :: mesh
31  type(hecmwst_matrix), pointer :: mat
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  type(fstr_card_state) :: state
40  end type fstr_param_pack
41 
42  integer(kind=kint), parameter :: fstr_card_max = 100
43 
45  abstract interface
46  subroutine fstr_card_reader( ctrl, P )
47  import :: kint, fstr_param_pack
48  integer(kind=kint) :: ctrl
49  type(fstr_param_pack) :: P
50  end subroutine fstr_card_reader
51  end interface
52 
55  type fstr_card
56  character(len=HECMW_NAME_LEN) :: name = ''
57  integer(kind=kint) :: version_min = -huge(0_kint)
58  integer(kind=kint) :: version_max = huge(0_kint)
59  procedure(fstr_card_reader), pointer, nopass :: first => null()
60  procedure(fstr_card_reader), pointer, nopass :: second => null()
61  logical :: by_line = .false.
62  integer(kind=kint) :: seq = 0
63  end type fstr_card
64 
69  integer(kind=kint) :: n_card = 0
70  type(fstr_card) :: card(fstr_card_max)
71  integer(kind=kint) :: n_seq = 0
72  character(len=HECMW_NAME_LEN) :: seq_name(fstr_card_max) = ''
73  end type fstr_card_table
74 
75 contains
76  !------------------------------------------------------------------------------
77 
78  subroutine fstr_ctrl_err_stop
79  implicit none
80  character(len=256) :: msg
81 
82  call fstr_ctrl_get_err_msg( msg, 256 )
83  write(*,*) msg
84  write(imsg,*) msg
85  call fstr_abort( hecmw_exit_input )
86  end subroutine fstr_ctrl_err_stop
87 
88  !------------------------------------------------------------------------------
89 
90  subroutine fstr_setup_util_err_stop( msg )
91  implicit none
92  character(*) :: msg
93 
94  write(*,*) msg
95  write(imsg,*) msg
96  call fstr_abort( hecmw_exit_input )
97  end subroutine fstr_setup_util_err_stop
98 
102  subroutine fstr_card_add( T, name, first, second, by_line, seq, version_min, version_max )
103  implicit none
104  type(fstr_card_table) :: T
105  character(len=*), intent(in) :: name
106  procedure(fstr_card_reader), optional :: first, second
107  logical, intent(in), optional :: by_line
108  character(len=*), intent(in), optional :: seq
109  integer(kind=kint), intent(in), optional :: version_min, version_max
110 
111  type(fstr_card) :: card
112  character(len=HECMW_NAME_LEN) :: seq_name
113 
114  card%name = name
115  if( present(first) ) card%first => first
116  if( present(second) ) card%second => second
117  if( present(by_line) ) card%by_line = by_line
118  if( present(version_min) ) card%version_min = version_min
119  if( present(version_max) ) card%version_max = version_max
120  seq_name = name
121  if( present(seq) ) seq_name = seq
122  card%seq = fstr_card_seq( t, seq_name )
123  if( card%seq == 0 ) then
124  if( t%n_seq == size(t%seq_name) ) call fstr_setup_util_err_stop( '### Error: the card table is full' )
125  t%n_seq = t%n_seq + 1
126  t%seq_name(t%n_seq) = seq_name
127  card%seq = t%n_seq
128  endif
129  call fstr_card_append( t, card )
130  end subroutine fstr_card_add
131 
133  subroutine fstr_card_alias( T, alias, name )
134  implicit none
135  type(fstr_card_table) :: T
136  character(len=*), intent(in) :: alias, name
137 
138  type(fstr_card) :: card
139 
140  card = t%card( fstr_card_index( t, name ) )
141  card%name = alias
142  call fstr_card_append( t, card )
143  end subroutine fstr_card_alias
144 
146  subroutine fstr_card_append( T, card )
147  implicit none
148  type(fstr_card_table) :: T
149  type(fstr_card), intent(in) :: card
150 
151  integer(kind=kint) :: i
152 
153  do i = 1, t%n_card
154  if( t%card(i)%name == card%name .and. t%card(i)%version_min <= card%version_max .and. &
155  card%version_min <= t%card(i)%version_max ) &
156  call fstr_setup_util_err_stop( '### Error: '//trim(card%name)//' : added twice to the card table' )
157  enddo
158  if( t%n_card == size(t%card) ) call fstr_setup_util_err_stop( '### Error: the card table is full' )
159  t%n_card = t%n_card + 1
160  t%card(t%n_card) = card
161  end subroutine fstr_card_append
162 
164  integer(kind=kint) function fstr_card_index( T, name )
165  implicit none
166  type(fstr_card_table), intent(in) :: t
167  character(len=*), intent(in) :: name
168 
169  integer(kind=kint) :: i
170 
171  fstr_card_index = 0
172  do i = 1, t%n_card
173  if( t%card(i)%name == name ) then
174  fstr_card_index = i
175  return
176  endif
177  enddo
178  call fstr_setup_util_err_stop( '### Error: '//trim(name)//' : not in the card table' )
179  end function fstr_card_index
180 
182  integer(kind=kint) function fstr_card_find( T, name, version )
183  implicit none
184  type(fstr_card_table), intent(in) :: t
185  character(len=*), intent(in) :: name
186  integer(kind=kint), intent(in) :: version
187 
188  integer(kind=kint) :: i
189 
190  fstr_card_find = 0
191  do i = 1, t%n_card
192  if( t%card(i)%name == name .and. t%card(i)%version_min <= version .and. &
193  version <= t%card(i)%version_max ) then
194  fstr_card_find = i
195  return
196  endif
197  enddo
198  end function fstr_card_find
199 
201  integer(kind=kint) function fstr_card_seq( T, seq )
202  implicit none
203  type(fstr_card_table), intent(in) :: t
204  character(len=*), intent(in) :: seq
205 
206  integer(kind=kint) :: i
207 
208  fstr_card_seq = 0
209  do i = 1, t%n_seq
210  if( t%seq_name(i) == seq ) then
211  fstr_card_seq = i
212  return
213  endif
214  enddo
215  end function fstr_card_seq
216 
219  integer(kind=kint) function fstr_card_total( T, total, seq )
220  implicit none
221  type(fstr_card_table), intent(in) :: t
222  integer(kind=kint), intent(in) :: total(:)
223  character(len=*), intent(in) :: seq
224 
225  integer(kind=kint) :: i
226 
227  i = fstr_card_seq( t, seq )
228  if( i == 0 ) call fstr_setup_util_err_stop( '### Error: '//trim(seq)//' : not in the card table' )
229  fstr_card_total = total(i)
230  end function fstr_card_total
231 
232  subroutine append_node_grp_from_surf_grp( hecMESH, sgrp_id, ngrp_id )
235  implicit none
236  type(hecmwst_local_mesh), pointer :: hecMESH
237  integer(kind=kint), intent(in) :: sgrp_id
238  integer(kind=kint), intent(out) :: ngrp_id
239  integer(kind=kint) :: is, ie, nnode, i, ic, isurf, ic_type, stype, nn, j0, j, ndup, new_nnode
240  integer(kind=kint) :: snode(20)
241  integer(kind=kint), allocatable :: node(:)
242  character(len=HECMW_NAME_LEN) :: grp_name
243  is= hecmesh%surf_group%grp_index(sgrp_id-1) + 1
244  ie= hecmesh%surf_group%grp_index(sgrp_id )
245  ! count num of nodes on surface incl duplication
246  nnode = 0
247  do i=is,ie
248  ic = hecmesh%surf_group%grp_item(2*i-1)
249  isurf = hecmesh%surf_group%grp_item(2*i)
250  ic_type = hecmesh%elem_type(ic)
251  call getsubface( ic_type, isurf, stype, snode )
252  nnode = nnode + getnumberofnodes( stype )
253  enddo
254  ! extract nodes on surface incl duplication
255  allocate( node(nnode) )
256  nnode = 0
257  do i=is,ie
258  ic = hecmesh%surf_group%grp_item(2*i-1)
259  isurf = hecmesh%surf_group%grp_item(2*i)
260  ic_type = hecmesh%elem_type(ic)
261  call getsubface( ic_type, isurf, stype, snode )
262  nn = getnumberofnodes( stype )
263  j0 = hecmesh%elem_node_index(ic-1)
264  do j=1,nn
265  node(nnode+j) = hecmesh%elem_node_item(j0+snode(j))
266  enddo
267  nnode = nnode + nn
268  enddo
269  ! sort and uniq node list
270  call hecmw_qsort_int_array(node, 1, nnode)
271  call hecmw_uniq_int_array(node, 1, nnode, ndup)
272  new_nnode = nnode - ndup
273  ! append node group
274  write( grp_name, '(a,a)') 'FSTR_S2N_',trim(hecmesh%surf_group%grp_name(sgrp_id))
275  call append_new_group(hecmesh, 'node_grp', grp_name, new_nnode, node, ngrp_id)
276  deallocate(node)
277  end subroutine append_node_grp_from_surf_grp
278 
279  subroutine append_intersection_node_grp( hecMESH, ngrp_id1, ngrp_id2 )
282  implicit none
283  type(hecmwst_local_mesh), pointer :: hecMESH
284  integer(kind=kint), intent(in) :: ngrp_id1, ngrp_id2
285  integer(kind=kint) :: nnode1, nnode2, nnode, is, i, nisect, ngrp_id
286  integer(kind=kint), allocatable :: node(:), isect(:)
287  character(len=HECMW_NAME_LEN) :: grp_name
288  nnode1 = hecmesh%node_group%grp_index(ngrp_id1) - hecmesh%node_group%grp_index(ngrp_id1-1)
289  nnode2 = hecmesh%node_group%grp_index(ngrp_id2) - hecmesh%node_group%grp_index(ngrp_id2-1)
290  nnode = nnode1 + nnode2
291  allocate( node(nnode) )
292  is= hecmesh%node_group%grp_index(ngrp_id1-1)
293  do i=1,nnode1
294  node(i) = hecmesh%node_group%grp_item(is+i)
295  enddo
296  is= hecmesh%node_group%grp_index(ngrp_id2-1)
297  do i=1,nnode2
298  node(nnode1+i) = hecmesh%node_group%grp_item(is+i)
299  enddo
300  call hecmw_qsort_int_array(node, 1, nnode)
301  allocate( isect(nnode) )
302  nisect = 0
303  do i=1,nnode-1
304  if( node(i) == node(i+1) ) then
305  nisect = nisect + 1
306  isect(nisect) = node(i)
307  endif
308  enddo
309  write( grp_name, '(a,a,a,a)') &
310  'FSTR_ISCT_',trim(hecmesh%node_group%grp_name(ngrp_id1)),'_AND_',trim(hecmesh%node_group%grp_name(ngrp_id2))
311  call append_new_group(hecmesh, 'node_grp', grp_name, nisect, isect, ngrp_id)
312  deallocate(node)
313  deallocate(isect)
314  end subroutine append_intersection_node_grp
315 
316  !------------------------------------------------------------------------------
317  ! JP-3
318  ! JP-4
319  ! type_name : 'node', 'element'
320  ! name : group name
321  ! local_id : local id (set only when return value > 0)
322  ! return : -1 if name is not a number
323  ! 0 if name is a number and a node with ID=name is not in myrank
324  ! >0 if name is a number and a node with ID=name is in myrank
325 
326  function get_local_member_index( hecMESH, type_name, name, local_id )
328  implicit none
329  integer(kind=kint) :: get_local_member_index
330  type (hecmwst_local_mesh),target :: hecmesh
331  character(len=*) :: type_name
332  character(len=*) :: name
333  integer(kind=kint) :: local_id
334  integer(kind=kint) :: i, n, no, fg
335  integer(kind=kint),pointer :: global_item(:)
336 
337  if( .not. hecmw_str2index(name, no) ) then
339  return
340  end if
341 
342  if( type_name == 'node' ) then
343  fg = 1
344  n = hecmesh%n_node
345  global_item => hecmesh%global_node_ID
346  else if( type_name == 'element' ) then
347  fg = 2
348  n = hecmesh%n_elem
349  global_item => hecmesh%global_elem_ID
350  else
351  stop 'assert in get_local_member_index: unknown type_name'
352  end if
353 
354  do i = 1, n
355  if( no == global_item(i)) then
356  local_id = i
357  get_local_member_index = local_id
358  return
359  end if
360  end do
361  local_id = 0
363  return
364  end function get_local_member_index
365 
366  !-----------------------------------------------------------------------------!
367  !
368 
369  function get_sorted_local_member_index( hecMESH, hecPARAM, type_name, name, local_id )
372  implicit none
373  integer(kind=kint) :: get_sorted_local_member_index
374  type (hecmwst_local_mesh),target :: hecmesh
375  type(fstr_param), target :: hecparam
376  character(len=*) :: type_name
377  character(len=*) :: name
378  integer(kind=kint) :: local_id, idx
379  integer(kind=kint) :: n, no, fg
380 
381  if( .not. hecmw_str2index(name, no) ) then
383  return
384  end if
385 
386  if( type_name == 'node' ) then
387  fg = 1
388  n = hecmesh%nn_internal
389  ! item => hecMESH%global_node_ID
390  ! else if( type_name == 'element' ) then
391  ! fg = 2
392  ! n = hecMESH%n_elem
393  ! item => hecMESH%global_elem_ID
394  else
395  stop 'assert in get_sorted_local_member_index: unknown type_name'
396  end if
397 
398  call hecmw_bsearch_int_array(hecparam%global_local_ID(1,:), 1, n, no, idx)
399  if(idx > 0)then
400  get_sorted_local_member_index = hecparam%global_local_ID(2,idx)
402  return
403  endif
404 
406  return
407  end function get_sorted_local_member_index
408  !-----------------------------------------------------------------------------!
409 
410  !Find node/surf group from name or nodeid
411 
412  subroutine nodesurf_grp_name_to_id_ex(hecMESH, header_name, n, grp_id_name, grp_ID, grp_TYPE)
414  use m_fstr
415  implicit none
416  type (hecmwST_local_mesh),target :: hecMESH
417  character(len=*) :: header_name
418  integer(kind=kint) :: n
419  character(len=HECMW_NAME_LEN) :: grp_id_name(:)
420  integer(kind=kint) :: grp_ID(:)
421  integer(kind=kint) :: grp_TYPE(:)
422 
423  integer(kind=kint) :: i, id
424  integer(kind=kint) :: no, no_count, exist_n
425  integer(kind=kint),pointer :: no_list(:)
426  character(HECMW_NAME_LEN) :: name
427  character(len=256) :: msg
428 
429  allocate( no_list( n ))
430  no_count = 0
431  do i = 1, n
432  if( hecmw_str2index( grp_id_name(i), no )) then
433  no_count = no_count + 1
434  no_list(no_count) = no
435  grp_id(i) = hecmesh%node_group%n_grp + no_count
436  grp_type(i) = kfloadtype_node
437  else
438  !Find node group
439  grp_id(i) = -1
440  do id = 1, hecmesh%node_group%n_grp
441  if (hecmw_streqr(hecmesh%node_group%grp_name(id), grp_id_name(i))) then
442  grp_id(i) = id
443  grp_type(i) = kfloadtype_node
444  exit
445  end if
446  end do
447  !Find surf group
448  if (grp_id(i) == -1) then
449  do id = 1, hecmesh%surf_group%n_grp
450  if (hecmw_streqr(hecmesh%surf_group%grp_name(id), grp_id_name(i))) then
451  grp_id(i) = id
452  grp_type(i) = kfloadtype_surf
453  exit
454  end if
455  end do
456  end if
457 
458  !not found => exit
459  if( grp_id(i) == -1 ) then
460  write(msg,*) '### Error: ', header_name,' : Node group "',grp_id_name(i),'" does not exist.'
461  call fstr_setup_util_err_stop(msg)
462  end if
463  end if
464  end do
465  if( no_count > 0 ) then
466  name = 'node_grp'
467  exist_n = append_single_group( hecmesh, name, no_count, no_list )
468  end if
469 
470  deallocate( no_list )
471 
472  end subroutine nodesurf_grp_name_to_id_ex
473 
474  !------------------------------------------------------------------------------
475 
476  subroutine dload_grp_name_to_id_ex( hecMESH, n, grp_id_name, fg_surface, grp_ID )
478  implicit none
479  type (hecmwST_local_mesh),target :: hecMESH
480  integer(kind=kint) :: n
481  integer(kind=kint),save :: casha = 1, cashb = 1
482  character(HECMW_NAME_LEN) :: grp_id_name(:)
483  logical :: fg_surface(:)
484  integer(kind=kint) :: grp_ID(:)
485  integer(kind=kint) :: i, id
486  integer(kind=kint) :: no, no_count, exist_n
487  integer(kind=kint),pointer :: no_list(:)
488  character(HECMW_NAME_LEN) :: name
489  character(len=256) :: msg
490 
491  allocate( no_list( n ))
492  no_count = 0
493  do i = 1, n
494  if( fg_surface(i) ) then
495  grp_id(i) = -1
496  if(casha < hecmesh%surf_group%n_grp)then
497  if(hecmw_streqr(hecmesh%surf_group%grp_name(casha), grp_id_name(i))) then
498  grp_id(i) = casha
499  casha = casha + 1
500  cycle
501  end if
502  endif
503  do id = 1, hecmesh%surf_group%n_grp
504  if(hecmw_streqr(hecmesh%surf_group%grp_name(id), grp_id_name(i))) then
505  grp_id(i) = id
506  casha = id + 1
507  exit
508  end if
509  end do
510  if( grp_id(i) == -1 ) then
511  write(msg,*) '### Error: !DLOAD : Surface group "',&
512  grp_id_name(i),'" does not exist.'
513  call fstr_setup_util_err_stop(msg)
514  end if
515  else
516  if( hecmw_str2index( grp_id_name(i), no )) then
517  no_count = no_count + 1
518  no_list(no_count) = no
519  grp_id(i) = hecmesh%elem_group%n_grp + no_count
520  else
521  grp_id(i) = -1
522  if(cashb < hecmesh%surf_group%n_grp)then
523  if(hecmw_streqr(hecmesh%surf_group%grp_name(cashb), grp_id_name(i))) then
524  grp_id(i) = cashb
525  cashb = cashb + 1
526  cycle
527  end if
528  endif
529  do id = 1, hecmesh%elem_group%n_grp
530  if(hecmw_streqr(hecmesh%elem_group%grp_name(id), grp_id_name(i))) then
531  grp_id(i) = id
532  cashb = cashb + 1
533  exit
534  end if
535  end do
536  if( grp_id(i) == -1 ) then
537  write(msg,*) '### Error: !DLOAD : Element group "',&
538  grp_id_name(i),'" does not exist.'
539  call fstr_setup_util_err_stop(msg)
540  end if
541  end if
542  end if
543  end do
544 
545  if( no_count > 0 ) then
546  name = 'elem_grp'
547  exist_n = append_single_group( hecmesh, name, no_count, no_list )
548  ! if( exist_n < no_count ) then
549  ! write(*,*) '### Warning: !DLOAD : following elements are not exist'
550  ! if( hecMESH%my_rank == 0 ) then
551  ! write(imsg,*) '### Warning: !DLOAD : following elements are not exist'
552  ! end if
553  ! do i=1, no_count
554  ! if( no_list(i)<0 ) then
555  ! write(*,*) -no_list(i)
556  ! if( hecMESH%my_rank == 0 ) then
557  ! write(imsg,*) -no_list(i)
558  ! endif
559  ! end if
560  ! end do
561  ! end if
562  end if
563 
564  deallocate( no_list )
565  end subroutine dload_grp_name_to_id_ex
566 
567  !------------------------------------------------------------------------------
568  ! JP-7
569 
571  subroutine append_new_amplitude( amp, name, type_def, type_time, type_val, np, val, table )
572  use hecmw_setup_util, only &
577  , hecmw_streqr
578  type( hecmwst_amplitude ), intent(inout) :: amp
579  character(len=HECMW_NAME_LEN), intent(in) :: name
580  integer(kind=kint), intent(in) :: type_def
581  integer(kind=kint), intent(in) :: type_time
582  integer(kind=kint), intent(in) :: type_val
583  integer(kind=kint), intent(in) :: np
584  real(kind=kreal), intent(in) :: val(:)
585  real(kind=kreal), intent(in) :: table(:)
586 
587  ! type(fstr_str_arr) :: amp_name
588  integer(kind=kint) :: n_amp, new_size, old_size, i
589 
590  do i=1,amp%n_amp
591  if( hecmw_streqr(amp%amp_name(i), name) ) then
592  write(*,*) 'Error: AMPLITUDE with NAME=',trim(name),' already exists'
593  call fstr_ctrl_err_stop
594  endif
595  enddo
596 
597  n_amp = amp%n_amp
598  new_size = n_amp+1
599  amp%n_amp = new_size
600  call hecmw_expand_index_array( amp%amp_index, n_amp+1, new_size+1 )
601  ! amp_name%s => amp%amp_name
602  ! call hecmw_expand_name_array( amp_name, n_amp, new_size )
603  ! amp%amp_name => amp_name%s
604  call hecmw_expand_char_array( amp%amp_name, n_amp, new_size )
605  call hecmw_expand_integer_array( amp%amp_type_definition, n_amp, new_size )
606  call hecmw_expand_integer_array( amp%amp_type_time, n_amp, new_size )
607  call hecmw_expand_integer_array( amp%amp_type_value, n_amp, new_size )
608  old_size = amp%amp_index( n_amp )
609  new_size = old_size+np
610  call hecmw_expand_real_array( amp%amp_val, old_size, new_size )
611  call hecmw_expand_real_array( amp%amp_table, old_size, new_size )
612 
613  amp%amp_index(amp%n_amp) = amp%amp_index(amp%n_amp-1)+np
614  amp%amp_name(amp%n_amp) = name
615  amp%amp_type_definition(amp%n_amp) = type_def
616  amp%amp_type_time(amp%n_amp) = type_time
617  amp%amp_type_value(amp%n_amp) = type_val
618  do i=1,np
619  amp%amp_val(old_size+i) = val(i)
620  amp%amp_table(old_size+i) = table(i)
621  enddo
622  end subroutine append_new_amplitude
623 
624 
625  subroutine amp_name_to_id( hecMESH, header_name, aname, id )
626  implicit none
627  type (hecmwST_local_mesh) :: hecMESH
628  character(len=*) :: header_name
629  character(len=HECMW_NAME_LEN)::aname
630  integer(kind=kint) :: id
631  character(len=256) :: msg
632 
633  id = 0
634  if( aname .eq. ' ' ) return
635  call get_amp_id( hecmesh, aname, id )
636  if( id == 0 ) then
637  write(msg,*) '### Error: ', header_name,' : Amplitude group "',&
638  aname,'" does not exist.'
639  call fstr_setup_util_err_stop(msg)
640  end if
641  end subroutine amp_name_to_id
642 
643 
644  !GET AMPLITUDE INDEX
645 
646  subroutine get_amp_id( hecMESH, aname, id )
647  use hecmw_setup_util, only: hecmw_streqr
648  implicit none
649  type (hecmwST_local_mesh) :: hecMESH
650  character(len=HECMW_NAME_LEN)::aname
651  integer(kind=kint) :: id
652 
653  integer(kind=kint) :: i
654 
655  id = 0
656  if( aname .eq. ' ' ) return
657 
658  do i = 1, hecmesh%amp%n_amp
659  if( hecmw_streqr(hecmesh%amp%amp_name(i), aname)) then
660  id = i
661  return
662  end if
663  end do
664  end subroutine get_amp_id
665 
666  !------------------------------------------------------------------------------
667 
668  subroutine reallocate_integer( array, n )
669  implicit none
670  integer(kind=kint),pointer :: array(:)
671  integer(kind=kint) :: n;
672 
673  if( associated( array )) deallocate(array)
674  allocate( array(n));
675  end subroutine reallocate_integer
676 
677  subroutine reallocate_real( array, n )
678  implicit none
679  real(kind=kreal),pointer :: array(:)
680  integer(kind=kint) :: n;
681 
682  if( associated( array )) deallocate(array)
683  allocate( array(n));
684  end subroutine reallocate_real
685 
686  !-----------------------------------------------------------------------------!
687  ! FSTR_SETUP_VISUALIZE !
688  ! 1) Seeking header to 'WRITE' !
689  ! 2) If parameter 'VISUAL' exists, then 'hecmw_vis.ini' is opened. !
690  ! 3) All following lines under the header are written to the opened file !
691  !-----------------------------------------------------------------------------!
692 
693  subroutine fstr_setup_visualize( ctrl, hecMESH )
694  implicit none
695  integer(kind=kint) :: ctrl
696  type (hecmwST_local_mesh) :: hecMESH
697  integer(kind=kint) :: rcode
698  character(HECMW_FILENAME_LEN) :: vis_filename = 'hecmw_vis.ini'
699  logical :: is_exit
700 
701  rcode = fstr_ctrl_seek_header( ctrl, '!VISUAL ' )
702  if(rcode == 0) return
703 
704  if(hecmesh%my_rank == 0)then
705  call fstr_setup_visualize_main( ctrl, vis_filename )
706  endif
707 
708  call hecmw_barrier( hecmesh )
709 
710  inquire(file = vis_filename, exist = is_exit)
711 
712  if(.not. is_exit)then
713  call fstr_setup_visualize_main( ctrl, vis_filename )
714  endif
715  end subroutine fstr_setup_visualize
716 
717  subroutine fstr_setup_visualize_main( ctrl, vis_filename )
718  implicit none
719  integer(kind=kint) :: ctrl
720  integer(kind=kint) :: rcode
721  integer(kind=kint) :: i, start_n, end_n
722  character(HECMW_FILENAME_LEN) :: vis_filename
723  integer(kind=kint), parameter :: buffsize = 127
724  character( buffsize ) :: buff
725  character( buffsize ) :: head
726  character( buffsize ) :: msg
727 
728  start_n = fstr_ctrl_get_c_h_pos( ctrl )
729  end_n = fstr_ctrl_get_rec_number( ctrl )
730 
731  open ( ifvs, file = trim(vis_filename), status = 'replace', err = 1000)
732  do i=start_n, end_n
733  rcode = fstr_ctrl_get_line( ctrl, i, buff, buffsize )
734  if( rcode /= 0 ) exit
735  read( buff, *) head
736  if( head == '!END') exit
737  write( ifvs, '(a)') buff
738  end do
739  close( ifvs );
740 
741  return
742 
743  1000 write(msg,*) 'Error: cannot create file:"', trim(vis_filename), '" for visualization'
744  call fstr_setup_util_err_stop(msg)
745  end subroutine fstr_setup_visualize_main
746 
747  !******************************************************************************
748 
749 end module fstr_setup_util
void fstr_ctrl_get_err_msg(char *f_buff, int *len)
int fstr_ctrl_get_line(int *ctrl, int *rec_no, char *buff, int *buff_size)
int fstr_ctrl_seek_header(int *ctrl, const char *header_name)
Reader of a card, called at the header of the card with the places of the card in PSTATEslot.
void version(char *arg)
show version and revision of FrontISTR
Definition: main.c:253
This module contains auxiliary functions in calculation setup.
integer(kind=kint) function fstr_card_seq(T, seq)
Index of the sequence named seq in the table T, or 0 if there is none.
subroutine fstr_ctrl_err_stop
integer(kind=kint), parameter fstr_card_max
rows and sequences of a card table
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)
subroutine fstr_setup_visualize_main(ctrl, vis_filename)
integer(kind=kint) function get_local_member_index(hecMESH, type_name, name, local_id)
integer(kind=kint) function fstr_card_index(T, name)
Index of the first row of the card name in the table T. Stops if the card is not in it.
subroutine fstr_card_add(T, name, first, second, by_line, seq, version_min, version_max)
Adds a card to the table T, read by first in the first reading and by second in the second reading....
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)
integer(kind=kint) function fstr_card_find(T, name, version)
Index of the row of the card name for !VERSION version in the table T, or 0 if there is none.
subroutine fstr_card_alias(T, alias, name)
Adds alias to the table T as another name of the card name.
integer(kind=kint) function fstr_card_total(T, total, seq)
Total of the sequence named seq, from the totals of the sequences of the table T. Stops if the sequen...
subroutine reallocate_real(array, n)
subroutine append_intersection_node_grp(hecMESH, ngrp_id1, ngrp_id2)
subroutine reallocate_integer(array, n)
integer(kind=kint) function get_sorted_local_member_index(hecMESH, hecPARAM, type_name, name, local_id)
subroutine get_amp_id(hecMESH, aname, id)
subroutine fstr_card_append(T, card)
Appends card to the table T. Stops if the table has a row of the same name for !VERSION in the range ...
subroutine, public hecmw_bsearch_int_array(array, istart, iend, val, idx)
recursive subroutine, public hecmw_qsort_int_array(array, istart, iend)
subroutine, public hecmw_uniq_int_array(array, istart, iend, ndup)
This module contains auxiliary functions in calculation setup.
integer(kind=kint) function append_single_group(hecMESH, grp_type_name, no_count, no_list)
logical function hecmw_str2index(s, x)
subroutine hecmw_expand_integer_array(array, old_size, new_size)
subroutine hecmw_expand_real_array(array, old_size, new_size)
subroutine append_new_group(hecMESH, grp_type_name, name, count, list, grp_id)
subroutine hecmw_expand_char_array(array, old_size, new_size)
logical function hecmw_streqr(s1, s2)
subroutine hecmw_expand_index_array(array, old_size, new_size)
Definition: hecmw.f90:6
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
integer(kind=kint), parameter imsg
Definition: m_fstr.F90:121
integer(kind=kint), parameter kfloadtype_surf
Definition: m_fstr.F90:94
integer(kind=kint), parameter ifvs
Definition: m_fstr.F90:123
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:692
integer(kind=kint), parameter kfloadtype_node
Definition: m_fstr.F90:93
Places of a card in its sequence, from first to last. A card counted one by one has one place (first ...
State of reading the cards: the places of the card being read, and what is carried from one card to t...
Table of the cards of the control file, not changed after the cards are added. Each card is counted i...
A row of the card table: the readers of a card in the first and the second reading of the control fil...
Package of all data needs to initialize.
Data for coupling analysis.
Definition: m_fstr.F90:642
Data for DYNAMIC ANSLYSIS (fstrDYNAMIC)
Definition: m_fstr.F90:525
Package of data used by Lanczos eigenvalue solver.
Definition: m_fstr.F90:623
Data for HEAT ANSLYSIS (fstrHEAT)
Definition: m_fstr.F90:440
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.F90:142