FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
fstr_precheck.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 !-------------------------------------------------------------------------------
7 
8  use hecmw
9  use m_fstr
13 
14  implicit none
15 
16 contains
17 
19  subroutine fstr_input_precheck(hecMESH, hecMAT, fstrSOLID, fstrPARAM)
20  implicit none
21  type(hecmwst_local_mesh), intent(inout) :: hecMESH
22  type(hecmwst_matrix), intent(in) :: hecMAT
23  type(fstr_solid), intent(in) :: fstrSOLID
24  type(fstr_param), intent(in) :: fstrPARAM
25 
26  integer(kind=kint) :: i, cid
27  real(kind=kreal), allocatable :: elem_vol(:), elem_asp(:)
28  type(hecmwst_result_data) :: fstrresult
29 
30  ! Density check for eigen/dynamic analysis
31  if(fstrparam%solution_type == ksteigen .or. &
32  fstrparam%solution_type == kststaticeigen .or. &
33  fstrparam%solution_type == kstdynamic) then
34  do i = 1, hecmesh%section%n_sect
35  if(hecmesh%section%sect_type(i) == 4) cycle
36  cid = hecmesh%section%sect_mat_ID_item(i)
37  if(fstrsolid%materials(cid)%variables(m_density) == 0.0d0) then
38  write(*,*) "*** error: density is not assigned or set to zero"
39  call hecmw_abort(hecmw_comm_get_comm())
40  endif
41  enddo
42  endif
43 
44  if(fstrparam%solution_type == kstprecheck) then
45  if(myrank == 0) write(*,*) ' **** Start Precheck ****'
46 
47  ! Allocate element quality arrays
48  allocate(elem_vol(hecmesh%n_elem))
49  allocate(elem_asp(hecmesh%n_elem))
50 
51  ! Mesh quality check
52  call precheck_mesh_quality(hecmesh, hecmat, elem_vol, elem_asp)
53 
54  ! Write result file
55  if(fstrparam%fg_result == 1) then
56  call precheck_write_result(hecmesh, elem_vol, elem_asp)
57  endif
58 
59  ! Build visualization result data and output
60  call precheck_make_result(hecmesh, fstrresult, elem_vol, elem_asp)
61  if(fstrparam%fg_visual == 1) then
62  call fstr2hecmw_mesh_conv(hecmesh)
63  call hecmw_visualize_init
64  call hecmw_visualize_by_addfname(hecmesh, fstrresult, 0, '_precheck')
65  call hecmw_visualize_finalize
66  call hecmw2fstr_mesh_conv(hecmesh)
67  endif
68  call hecmw_result_free(fstrresult)
69 
70  deallocate(elem_vol)
71  deallocate(elem_asp)
72 
73  if(myrank == 0) write(*,*) ' **** End Precheck ****'
74  endif
75 
76  if(fstrparam%solution_type == kstnzprof) then
77  call hecmw_nonzero_profile(hecmesh, hecmat)
78  endif
79  end subroutine fstr_input_precheck
80 
81  subroutine fstr_get_thickness(hecMESH, mid, thick)
82  use hecmw
83  use m_fstr
84  implicit none
85  type(hecmwst_local_mesh) :: hecMESH
86  integer(kind=kint) :: mid, ihead
87  real(kind=kreal) :: thick
88 
89  ihead = hecmesh%section%sect_R_index(mid-1)
90  thick = hecmesh%section%sect_R_item(ihead+1)
91  end subroutine fstr_get_thickness
92 
94  subroutine hecmw_nonzero_profile(hecMESH, hecMAT)
95  use hecmw_util
96  implicit none
97  type(hecmwst_local_mesh) :: hecmesh
98  type(hecmwst_matrix) :: hecMAT
99 
100  integer(kind=kint) :: i, j, in, jS, jE, ftype, n, ndof, nnz, fio
101  real(kind=kreal) :: rnum, dens, cond
102  character :: fileid*3
103 
104  fio = 70 + hecmesh%my_rank
105  write(fileid,"(i3.3)")hecmesh%my_rank
106 
107  ftype = 4
108 
109  n = hecmat%N
110  ndof = 3*n
111  nnz = 9*n + 9*2*hecmat%indexL(n)
112  dens = 100*dble(nnz)/dble(9*n*n)
113  rnum = (7.21d0+0.01*dlog10(dble(hecmat%N)))*10.0d0/dble(hecmat%N)
114  cond = 1.0d0
115 
116  open(fio,file='nonzero.dat.'//fileid, status='replace')
117  do i= 1, n
118  js= hecmat%indexL(i-1) + 1
119  je= hecmat%indexL(i )
120  write(fio,"(i0,a,i0)")i," ",i
121  do j= js, je
122  in = hecmat%itemL(j)
123  write(fio,"(i0,a,i0)")i, " ",in
124  write(fio,"(i0,a,i0)")in," ",i
125  enddo
126  enddo
127  close(fio)
128 
129  open(fio,file='nonzero.plt.'//fileid, status='replace')
130  if(ftype == 4)then
131  write(fio,"(a)")'set terminal png size 1500,1500'
132  else
133  write(fio,"(a)")'set terminal postscript eps enhanced color solid "TimesNewRomanPSMT" 20'
134  endif
135 
136  write(fio,"(a)")'unset key'
137  write(fio,"(a)")'unset xtics'
138  write(fio,"(a)")'unset ytics'
139  write(fio,"(a)")'set size ratio 1.0'
140  write(fio,"(a)")'set border lw 1.0'
141  write(fio,"(a,i0,a)")'set xrange[0.5:',n,'.5]'
142  write(fio,"(a,i0,a)")'set yrange[0.5:',n,'.5] reverse '
143 
144  if(ftype == 4)then
145  write(fio,"(a)")'set out "image.'//fileid//'.png"'
146  else
147  write(fio,"(a)")'set out "image.'//fileid//'.eps"'
148  write(fio,"(a)" )'set label 1 "Name" at graph 1.1,0.9'
149  write(fio,"(a)")'set label 2 "N" at graph 1.1,0.85'
150  write(fio,"(a)")'set label 3 "Non-Zero Elem." at graph 1.1,0.8'
151  write(fio,"(a)")'set label 4 "Density [%]" at graph 1.1,0.75'
152  write(fio,"(a)")'set label 9 "Condition Num." at graph 1.1,0.7'
153  write(fio,"(a)" )'set label 5 ": matrix" at graph 1.4,0.9'
154  write(fio,"(a,i0,a)")'set label 6 ": ',ndof,'" at graph 1.4,0.85'
155  write(fio,"(a,i0,a)")'set label 7 ": ',nnz,'" at graph 1.4,0.8'
156  write(fio,"(a,1pe9.2,a)")'set label 8 ": ',dens,'" at graph 1.4,0.75'
157  write(fio,"(a,1pe9.2,a)")'set label 10 ": ',cond,'" at graph 1.4,0.7'
158  endif
159 
160  write(fio,"(a,f12.5,a)")'plot "nonzero.dat.'//fileid//'" pointtype 5 pointsize ',rnum,' linecolor rgb "#F96566"'
161  close(fio)
162 
163  write(*,*)''
164  write(*,*)' ### Command recommendation'
165  write(*,*)' gnuplot -persist "nonzero.plt"'
166  end subroutine hecmw_nonzero_profile
167 
168 end module m_fstr_precheck
I/O and Utility.
Definition: hecmw_util_f.F90:7
integer(kind=4), parameter kreal
Definition: hecmw.f90:6
This module provides the entry point for ELEMCHECK (pre-analysis input validation)
subroutine hecmw_nonzero_profile(hecMESH, hecMAT)
Non-zero profile output for gnuplot visualization.
subroutine fstr_get_thickness(hecMESH, mid, thick)
subroutine fstr_input_precheck(hecMESH, hecMAT, fstrSOLID, fstrPARAM)
Main entry point (called from fistr_main)
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
integer(kind=kint) myrank
PARALLEL EXECUTION.
Definition: m_fstr.F90:107
integer(kind=kint), parameter kstdynamic
Definition: m_fstr.F90:41
integer(kind=kint), parameter kstprecheck
solution type (st)
Definition: m_fstr.F90:37
integer(kind=kint), parameter kststaticeigen
Definition: m_fstr.F90:43
integer(kind=kint), parameter kstnzprof
Definition: m_fstr.F90:44
integer(kind=kint), parameter ksteigen
Definition: m_fstr.F90:39
HECMW to FSTR Mesh Data Converter. Converting Connectivity of Element Type 232, 342 and 352.
subroutine fstr2hecmw_mesh_conv(hecMESH)
subroutine hecmw2fstr_mesh_conv(hecMESH)
This module constructs result data for ELEMCHECK visualization/result output.
subroutine, public precheck_make_result(hecMESH, fstrRESULT, elem_vol, elem_asp)
Build hecmwST_result_data for visualization via hecmw_visualize.
subroutine, public precheck_write_result(hecMESH, elem_vol, elem_asp)
Write check results to result file via hecmw_result_add/write interface.
This module provides mesh quality check functions for ELEMCHECK.
subroutine, public precheck_mesh_quality(hecMESH, hecMAT, elem_vol, elem_asp)
Mesh quality check (element volume, aspect ratio) Returns per-element volume and aspect ratio in elem...
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.F90:142