FrontISTR  5.9.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)
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 
25  integer(kind=kint) :: i, cid
26  real(kind=kreal), allocatable :: elem_vol(:), elem_asp(:)
27  type(hecmwst_result_data) :: fstrresult
28 
29  ! Density check for eigen/dynamic analysis
30  if(fstrpr%solution_type == ksteigen .or. &
31  fstrpr%solution_type == kststaticeigen .or. &
32  fstrpr%solution_type == kstdynamic) then
33  do i = 1, hecmesh%section%n_sect
34  if(hecmesh%section%sect_type(i) == 4) cycle
35  cid = hecmesh%section%sect_mat_ID_item(i)
36  if(fstrsolid%materials(cid)%variables(m_density) == 0.0d0) then
37  write(*,*) "*** error: density is not assigned or set to zero"
38  call hecmw_abort(hecmw_comm_get_comm())
39  endif
40  enddo
41  endif
42 
43  if(fstrpr%solution_type == kstprecheck) then
44  if(myrank == 0) write(*,*) ' **** Start Precheck ****'
45 
46  ! Allocate element quality arrays
47  allocate(elem_vol(hecmesh%n_elem))
48  allocate(elem_asp(hecmesh%n_elem))
49 
50  ! Mesh quality check
51  call precheck_mesh_quality(hecmesh, hecmat, elem_vol, elem_asp)
52 
53  ! Write result file
54  if(iresult == 1) then
55  call precheck_write_result(hecmesh, elem_vol, elem_asp)
56  endif
57 
58  ! Build visualization result data and output
59  call precheck_make_result(hecmesh, fstrresult, elem_vol, elem_asp)
60  if(ivisual == 1) then
61  call fstr2hecmw_mesh_conv(hecmesh)
62  call hecmw_visualize_init
63  call hecmw_visualize_by_addfname(hecmesh, fstrresult, 0, '_precheck')
64  call hecmw_visualize_finalize
65  call hecmw2fstr_mesh_conv(hecmesh)
66  endif
67  call hecmw_result_free(fstrresult)
68 
69  deallocate(elem_vol)
70  deallocate(elem_asp)
71 
72  if(myrank == 0) write(*,*) ' **** End Precheck ****'
73  endif
74 
75  if(fstrpr%solution_type == kstnzprof) then
76  call hecmw_nonzero_profile(hecmesh, hecmat)
77  endif
78  end subroutine fstr_input_precheck
79 
80  subroutine fstr_get_thickness(hecMESH, mid, thick)
81  use hecmw
82  use m_fstr
83  implicit none
84  type(hecmwst_local_mesh) :: hecMESH
85  integer(kind=kint) :: mid, ihead
86  real(kind=kreal) :: thick
87 
88  ihead = hecmesh%section%sect_R_index(mid-1)
89  thick = hecmesh%section%sect_R_item(ihead+1)
90  end subroutine fstr_get_thickness
91 
93  subroutine hecmw_nonzero_profile(hecMESH, hecMAT)
94  use hecmw_util
95  implicit none
96  type(hecmwst_local_mesh) :: hecmesh
97  type(hecmwst_matrix) :: hecMAT
98 
99  integer(kind=kint) :: i, j, in, jS, jE, ftype, n, ndof, nnz, fio
100  real(kind=kreal) :: rnum, dens, cond
101  character :: fileid*3
102 
103  fio = 70 + hecmesh%my_rank
104  write(fileid,"(i3.3)")hecmesh%my_rank
105 
106  ftype = 4
107 
108  n = hecmat%N
109  ndof = 3*n
110  nnz = 9*n + 9*2*hecmat%indexL(n)
111  dens = 100*dble(nnz)/dble(9*n*n)
112  rnum = (7.21d0+0.01*dlog10(dble(hecmat%N)))*10.0d0/dble(hecmat%N)
113  cond = 1.0d0
114 
115  open(fio,file='nonzero.dat.'//fileid, status='replace')
116  do i= 1, n
117  js= hecmat%indexL(i-1) + 1
118  je= hecmat%indexL(i )
119  write(fio,"(i0,a,i0)")i," ",i
120  do j= js, je
121  in = hecmat%itemL(j)
122  write(fio,"(i0,a,i0)")i, " ",in
123  write(fio,"(i0,a,i0)")in," ",i
124  enddo
125  enddo
126  close(fio)
127 
128  open(fio,file='nonzero.plt.'//fileid, status='replace')
129  if(ftype == 4)then
130  write(fio,"(a)")'set terminal png size 1500,1500'
131  else
132  write(fio,"(a)")'set terminal postscript eps enhanced color solid "TimesNewRomanPSMT" 20'
133  endif
134 
135  write(fio,"(a)")'unset key'
136  write(fio,"(a)")'unset xtics'
137  write(fio,"(a)")'unset ytics'
138  write(fio,"(a)")'set size ratio 1.0'
139  write(fio,"(a)")'set border lw 1.0'
140  write(fio,"(a,i0,a)")'set xrange[0.5:',n,'.5]'
141  write(fio,"(a,i0,a)")'set yrange[0.5:',n,'.5] reverse '
142 
143  if(ftype == 4)then
144  write(fio,"(a)")'set out "image.'//fileid//'.png"'
145  else
146  write(fio,"(a)")'set out "image.'//fileid//'.eps"'
147  write(fio,"(a)" )'set label 1 "Name" at graph 1.1,0.9'
148  write(fio,"(a)")'set label 2 "N" at graph 1.1,0.85'
149  write(fio,"(a)")'set label 3 "Non-Zero Elem." at graph 1.1,0.8'
150  write(fio,"(a)")'set label 4 "Density [%]" at graph 1.1,0.75'
151  write(fio,"(a)")'set label 9 "Condition Num." at graph 1.1,0.7'
152  write(fio,"(a)" )'set label 5 ": matrix" at graph 1.4,0.9'
153  write(fio,"(a,i0,a)")'set label 6 ": ',ndof,'" at graph 1.4,0.85'
154  write(fio,"(a,i0,a)")'set label 7 ": ',nnz,'" at graph 1.4,0.8'
155  write(fio,"(a,1pe9.2,a)")'set label 8 ": ',dens,'" at graph 1.4,0.75'
156  write(fio,"(a,1pe9.2,a)")'set label 10 ": ',cond,'" at graph 1.4,0.7'
157  endif
158 
159  write(fio,"(a,f12.5,a)")'plot "nonzero.dat.'//fileid//'" pointtype 5 pointsize ',rnum,' linecolor rgb "#F96566"'
160  close(fio)
161 
162  write(*,*)''
163  write(*,*)' ### Command recommendation'
164  write(*,*)' gnuplot -persist "nonzero.plt"'
165  end subroutine hecmw_nonzero_profile
166 
167 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)
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), pointer iresult
Definition: m_fstr.F90:124
integer(kind=kint) myrank
PARALLEL EXECUTION.
Definition: m_fstr.F90:98
integer(kind=kint), parameter kstdynamic
Definition: m_fstr.F90:42
integer(kind=kint), parameter kstprecheck
solution type (st)
Definition: m_fstr.F90:38
integer(kind=kint), parameter kststaticeigen
Definition: m_fstr.F90:44
integer(kind=kint), parameter kstnzprof
Definition: m_fstr.F90:45
type(fstr_param), target fstrpr
GLOBAL VARIABLE INITIALIZED IN FSTR_SETUP.
Definition: m_fstr.F90:212
integer(kind=kint), parameter ksteigen
Definition: m_fstr.F90:40
integer(kind=kint), pointer ivisual
Definition: m_fstr.F90:125
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...