20 subroutine precheck_get_thickness(hecMESH, mid, thick)
21 type(hecmwST_local_mesh) :: hecMESH
22 integer(kind=kint) :: mid, ihead
23 real(kind=kreal) :: thick
25 ihead = hecmesh%section%sect_R_index(mid-1)
26 thick = hecmesh%section%sect_R_item(ihead+1)
27 end subroutine precheck_get_thickness
34 type(hecmwst_matrix) :: hecmat
35 type(hecmwst_local_mesh) :: hecmesh
36 real(kind=kreal),
intent(out) :: elem_vol(:)
37 real(kind=kreal),
intent(out) :: elem_asp(:)
40 real(kind=kreal),
parameter :: aspect_warn_threshold = 50.0d0
43 integer(kind=kint) :: nelem, mid, j, isect, icel, iis
44 integer(kind=kint) :: ndof2, nelem_wo_mpc
45 integer(kind=kint) :: ie, ia, jelem, ic_type, nn, js, je, itype
46 integer(kind=kint) :: nodlocal(20), ntotsum(1)
47 integer(kind=kint) :: nonzero
48 integer(kind=kint) :: ntotbuf(2)
51 integer(kind=kint),
parameter :: etype_code_max = 999
52 integer(kind=kint) :: etype_count(etype_code_max), i_etype
53 real(kind=kreal) :: ntdof2
54 real(kind=kreal) :: al, almin, almax, aa, thick, vol, avvol
55 real(kind=kreal) :: tvol, tvmax, tvmin, tlmax, tlmin, asp, aspmax
56 real(kind=kreal) :: xx(20), yy(20), zz(20)
57 real(kind=kreal) :: totsum(1), totmax(3), totmin(2)
71 ndof2 = hecmesh%n_dof**2
74 write(
ilog,
"(a)")
'### Mesh Summary (local) ###'
75 write(
ilog,
"(a,i12)")
' Num of node:',hecmesh%n_node
76 write(
ilog,
"(a,i12)")
' Num of DOF :',hecmesh%n_node*hecmesh%n_dof
77 write(
ilog,
"(a,i12)")
' Num of elem:',hecmesh%n_elem
79 do itype = 1, hecmesh%n_elem_type
80 js = hecmesh%elem_type_index(itype-1)
81 je = hecmesh%elem_type_index(itype )
82 ic_type = hecmesh%elem_type_item(itype)
83 if(.not. (hecmw_is_etype_link(ic_type) .or. hecmw_is_etype_patch(ic_type))) &
84 nelem_wo_mpc = nelem_wo_mpc + je-js
86 write(
ilog,
"(a,i12)")
' ** w/o MPC/Patch:',nelem_wo_mpc
87 do itype = 1, hecmesh%n_elem_type
88 js = hecmesh%elem_type_index(itype-1)
89 je = hecmesh%elem_type_index(itype )
90 ic_type = hecmesh%elem_type_item(itype)
91 write(
ilog,
"(a,i4,a,i12)")
' Num of ',ic_type,
':',je-js
93 nonzero = ndof2*(hecmat%NP + hecmat%NPU + hecmat%NPL)
94 write(
ilog,
"(a,i12)")
' Num of NZ :',nonzero
95 ntdof2 = dble(hecmesh%n_node*hecmesh%n_dof)**2
96 write(
ilog,
"(a,1pe12.5,a)")
' Sparsity :',100.0d0*dble(nonzero)/dble(ntdof2),
"[%]"
99 ntotsum(1) = hecmesh%nn_internal
100 call hecmw_allreduce_i(hecmesh, ntotsum, 1, hecmw_sum)
101 ntotbuf(1) = hecmesh%n_elem
102 ntotbuf(2) = nelem_wo_mpc
103 call hecmw_allreduce_i(hecmesh, ntotbuf, 2, hecmw_sum)
105 do itype = 1, hecmesh%n_elem_type
106 ic_type = hecmesh%elem_type_item(itype)
107 if( ic_type .ge. 1 .and. ic_type .le. etype_code_max )
then
108 etype_count(ic_type) = etype_count(ic_type) + hecmesh%elem_type_index(itype) - hecmesh%elem_type_index(itype-1)
110 write(
ilog,
"(a,i6,a)")
' %%% WARNING %%% Element type ', ic_type,
' is out of range for Mesh Summary count'
113 call hecmw_allreduce_i(hecmesh, etype_count, etype_code_max, hecmw_sum)
114 if( hecmesh%my_rank .eq. 0 )
then
115 write(*,
"(a)")
'### Mesh Summary ###'
116 write(*,
"(a,i12)")
' Num of node :',ntotsum(1)
117 write(*,
"(a,i12)")
' Num of DOF :',ntotsum(1)*hecmesh%n_dof
118 write(*,
"(a,i12)")
' Num of elem :',ntotbuf(1)
119 write(*,
"(a,i12)")
' ** w/o MPC/Patch :',ntotbuf(2)
120 do i_etype = 1, etype_code_max
121 if( etype_count(i_etype) .gt. 0 )
then
122 write(*,
"(a,i5,a,i12)")
' Num of ',i_etype,
':',etype_count(i_etype)
128 if( hecmesh%n_dof .eq. 3 )
then
129 do ie = 1, hecmesh%n_elem
130 ia = hecmesh%elem_ID(ie*2)
131 if( ia.ne.hecmesh%my_rank ) cycle
132 jelem = hecmesh%global_elem_ID(ie)
133 ic_type = hecmesh%elem_type(ie)
134 if (.not. (hecmw_is_etype_rod(ic_type) .or. hecmw_is_etype_solid(ic_type) &
135 & .or. hecmw_is_etype_beam(ic_type) .or. hecmw_is_etype_shell(ic_type)))
then
136 write(
ilog,*) jelem,
' This Element cannot be checked. Type=',ic_type
142 nn = hecmw_get_max_node(ic_type)
143 js = hecmesh%elem_node_index(ie-1)
144 je = hecmesh%elem_node_index(ie)
146 nodlocal(j) = hecmesh%elem_node_item (js+j)
147 xx(j) = hecmesh%node(3*nodlocal(j)-2)
148 yy(j) = hecmesh%node(3*nodlocal(j)-1)
149 zz(j) = hecmesh%node(3*nodlocal(j) )
152 if ( ic_type.eq.111 )
then
153 isect = hecmesh%section_ID(ie)
154 mid = hecmesh%section%sect_mat_ID_item(isect)
155 call precheck_get_thickness( hecmesh,mid,aa )
156 al = sqrt( (xx(2)-xx(1))**2+(yy(2)-yy(1))**2+(zz(2)-zz(1))**2 )
160 elseif( hecmw_is_etype_solid(ic_type) )
then
162 elseif( ic_type.eq.641 )
then
164 elseif( ic_type.eq.761 .or. ic_type.eq.781 )
then
170 if( vol.le.0.0 )
then
171 write(
ilog,*)
' %%% ERROR %%% Volume of Element no.=',jelem,
' is zero or negative.'
176 if( vol.gt.tvmax ) tvmax = vol
177 if( vol.lt.tvmin ) tvmin = vol
178 if( almax.gt.tlmax ) tlmax = almax
179 if( almin.lt.tlmin ) tlmin = almin
182 if( asp.gt.aspmax ) aspmax = asp
183 if( asp.gt.aspect_warn_threshold )
then
184 write(
ilog,*)
' %%% WARNING %%% Aspect ratio of Element no.=',jelem, &
185 &
' exceeds ',aspect_warn_threshold
186 write(
ilog,*)
' Maximum length =',almax
187 write(
ilog,*)
' Minimum length =',almin
192 elseif( hecmesh%n_dof .eq. 2 )
then
193 do ie = 1, hecmesh%n_elem
194 ia = hecmesh%elem_ID(ie*2)
195 if( ia.ne.hecmesh%my_rank ) cycle
196 jelem = hecmesh%global_elem_ID(ie)
197 ic_type = hecmesh%elem_type(ie)
198 if (.not. (hecmw_is_etype_rod(ic_type) .or. hecmw_is_etype_surface(ic_type)))
then
199 write(
ilog,*) jelem,
' This Element cannot be checked. Type=',ic_type
205 nn = hecmw_get_max_node(ic_type)
206 js = hecmesh%elem_node_index(ie-1)
208 nodlocal(j) = hecmesh%elem_node_item (js+j)
209 xx(j) = hecmesh%node(3*nodlocal(j)-2)
210 yy(j) = hecmesh%node(3*nodlocal(j)-1)
213 isect = hecmesh%section_ID(ie)
214 mid = hecmesh%section%sect_mat_ID_item(isect)
215 call precheck_get_thickness( hecmesh,mid,aa )
217 if ( ic_type.eq.111 )
then
218 al = sqrt( (xx(2)-xx(1))**2+(yy(2)-yy(1))**2 )
220 if( al.gt.tlmax ) tlmax = al
221 if( al.lt.tlmin ) tlmin = al
223 elseif( hecmw_is_etype_surface(ic_type) )
then
229 if( vol.le.0.0 )
then
230 write(
ilog,*)
' %%% ERROR %%% Volume of Element no.=',jelem,
' is zero or negative.'
235 if( vol.gt.tvmax ) tvmax = vol
236 if( vol.lt.tvmin ) tvmin = vol
237 if( almax.gt.tlmax ) tlmax = almax
238 if( almin.lt.tlmin ) tlmin = almin
241 if( asp.gt.aspmax ) aspmax = asp
242 if( asp.gt.aspect_warn_threshold )
then
243 write(
ilog,*)
' %%% WARNING %%% Aspect ratio of Element no.=',jelem, &
244 &
' exceeds ',aspect_warn_threshold
245 write(
ilog,*)
' Maximum length =',almax
246 write(
ilog,*)
' Minimum length =',almin
251 elseif( hecmesh%n_dof .eq. 6 )
then
252 do ie = 1, hecmesh%n_elem
253 ia = hecmesh%elem_ID(ie*2)
254 if( ia.ne.hecmesh%my_rank ) cycle
255 jelem = hecmesh%global_elem_ID(ie)
256 ic_type = hecmesh%elem_type(ie)
257 if (.not. (hecmw_is_etype_beam(ic_type) .or. hecmw_is_etype_shell(ic_type)))
then
258 write(
ilog,*) jelem,
' This Element cannot be checked. Type=',ic_type
264 nn = hecmw_get_max_node(ic_type)
265 js = hecmesh%elem_node_index(ie-1)
267 nodlocal(j) = hecmesh%elem_node_item (js+j)
268 xx(j) = hecmesh%node(3*nodlocal(j)-2)
269 yy(j) = hecmesh%node(3*nodlocal(j)-1)
270 zz(j) = hecmesh%node(3*nodlocal(j) )
273 isect = hecmesh%section_ID(ie)
274 mid = hecmesh%section%sect_mat_ID_item(isect)
275 call precheck_get_thickness( hecmesh,mid,aa )
277 if ( ic_type.eq.111 )
then
278 al = sqrt( (xx(2)-xx(1))**2+(yy(2)-yy(1))**2+(zz(2)-zz(1))**2 )
280 if( al.gt.tlmax ) tlmax = al
281 if( al.lt.tlmin ) tlmin = al
283 elseif( ic_type.eq.731 .or. ic_type.eq.741 )
then
287 if( vol.le.0.0 )
then
288 write(
ilog,*)
' %%% ERROR %%% Volume of Element no.=',jelem,
' is zero or negative.'
293 if( vol.gt.tvmax ) tvmax = vol
294 if( vol.lt.tvmin ) tvmin = vol
295 if( almax.gt.tlmax ) tlmax = almax
296 if( almin.lt.tlmin ) tlmin = almin
299 if( asp.gt.aspmax ) aspmax = asp
300 if( asp.gt.aspect_warn_threshold )
then
301 write(
ilog,*)
' %%% WARNING %%% Aspect ratio of Element no.=',jelem, &
302 &
' exceeds ',aspect_warn_threshold
303 write(
ilog,*)
' Maximum length =',almax
304 write(
ilog,*)
' Minimum length =',almin
311 write(
ilog,*)
'### Local Summary ###'
312 write(
ilog,*)
' Total volume = ',tvol
313 write(
ilog,*)
' Average volume of elements = ',avvol
314 write(
ilog,*)
' Maximum volume of elements = ',tvmax
315 write(
ilog,*)
' Minimum volume of elements = ',tvmin
316 write(
ilog,*)
' Maximum edge length = ',tlmax
317 write(
ilog,*)
' Minimum edge length = ',tlmin
318 write(
ilog,*)
' Maximum aspect ratio = ',aspmax
322 call hecmw_allreduce_r(hecmesh,totsum,1,hecmw_sum)
324 call hecmw_allreduce_i(hecmesh,ntotsum,1,hecmw_sum)
328 call hecmw_allreduce_r(hecmesh,totmax,3,hecmw_max)
331 call hecmw_allreduce_r(hecmesh,totmin,2,hecmw_min)
332 if( hecmesh%my_rank .eq. 0 )
then
333 avvol = totsum(1) / ntotsum(1)
334 write(
ilog,*)
'### Global Summary ###'
335 write(
ilog,*)
' Total volume = ',totsum(1)
336 write(*,*)
' Total volume = ',totsum(1)
337 write(
ilog,*)
' Average volume of elements = ',avvol
338 write(*,*)
' Average volume of elements = ',avvol
339 write(
ilog,*)
' Maximum volume of elements = ',totmax(1)
340 write(*,*)
' Maximum volume of elements = ',totmax(1)
341 write(
ilog,*)
' Minimum volume of elements = ',totmin(1)
342 write(*,*)
' Minimum volume of elements = ',totmin(1)
343 write(
ilog,*)
' Maximum edge length = ',totmax(2)
344 write(*,*)
' Maximum edge length = ',totmax(2)
345 write(
ilog,*)
' Minimum edge length = ',totmin(2)
346 write(*,*)
' Minimum edge length = ',totmin(2)
347 write(
ilog,*)
' Maximum aspect ratio = ',totmax(3)
348 write(*,*)
' Maximum aspect ratio = ',totmax(3)
This module defines common data and basic structures for analysis.
integer(kind=kint), parameter ilog
FILE HANDLER.
This module provides unified element quality check functions using the elementInfo common API.
subroutine, public precheck_calc_vol_asp(ic_type, nn, xx, yy, zz, thick, vol, almax, almin)
Calculate volume and edge lengths (for aspect ratio) for any supported element type.
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...