Challenge

Week - 11 - Element quality check

AIM:

To check the element quality by using Tcl/Tk commands

OBJECTIVE:

  • Create element quality check macro for 2D and 3D elements.
  • Create a button for each criterion.
  • On pressing the button the elements should be highlighted using temp nodes.
  • Entry boxes next to the buttons will accept the quality criteria value.

PROCEDURE:

To check elements quality criteria hypermesh provides various commands. Using this command failing elements can be easily identified.

STEPS TO IDENTIFY AND CREATE TEMP NODES:

  • Create a mark for displayed elements.
  • Use element test command for respected quality criteria and save failed elements on separate mark ID.
  • Create temp nodes for displayed nodes.

TCL_MODIFY COMMANDS:

*elementtestwarpage - Check warpage for elements.

*elementtestaspect - Check aspect ratio of elements.

*elementtestskew - Check skew anlge of elements.

*elementtestlength - Check Min/Max length with respect to selection.

*elementtestinterangle - Check Min/Max angle for Quad/Tria with respect to selection.

*elementtesttetcollapse - Check tet collapse for 3D elements.

CODE:

*clearmarkall 1 ; *clearmarkall 2
*unmaskall2
*nodecleartempmark
# $min_l
proc min_length {} {
*unmaskall2
*nodecleartempmark
# *clearmarkall 1 ; *clearmarkall 2
set min_l [hm_getstring "2D length <" ]
*createmark elems 1 "displayed"
*elementtestlength elems 1 $min_l 2 1 2 0 "2D length <"
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2

}
# $max_l
proc max_length {} {
*unmaskall2
*nodecleartempmark
set max_l [hm_getstring "2D length >" ]
*createmark elems 1 "displayed"
*createmark elems 2
*elementtestlength elems 1 $max_l 2 0 2 0 "2D length >"
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
# $warp
proc warpage {} {
*unmaskall2
*nodecleartempmark
set warp [hm_getstring "warpangle" ]
*createmark elems 1 "displayed"
*createmark elems 2
*elementtestwarpage elems 1 $warp 2 2 0 "Warpage"
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
}
# $asp_r
proc aspect_ratio {} {
*unmaskall2
*nodecleartempmark
set asp_r [hm_getstring "Aspect Ratio" ]
*createmark elems 1 "displayed"
*createmark elems 2
*elementtestaspect elems 1 $asp_r 2 2 0 "Aspect ratio "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
}
# $skew
proc skewness {} {
*unmaskall2
*nodecleartempmark
set skew [hm_getstring "Skew" ]
*createmark elems 1 "displayed"
*createmark elems 2
*elementtestskew elems 1 $skew 2 2 0 "Skewness"
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
}
# $jac
proc jacobian {} {
*unmaskall2
*nodecleartempmark
set jac [hm_getstring "Jacobian" ]
*createmark elems 1 "displayed"
*createmark elems 2
*elementtestjackobian elems 1 $jac 2 2 0 "jacobian"
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
}
# $min_t_
proc min_t_angle {} {
*unmaskall2
*nodecleartempmark
set min_t [hm_getstring "minimum tria angle" ]
*createmark elems 1 "displayed"
*createmark elems 2
*elementtestinterangle elems 1 $min_t 1 2 1 2 0 "minimum tria angle"
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
}
# $max_t
proc max_t_angle {} {
*unmaskall2
*nodecleartempmark
set max_t [hm_getstring "maximum tria angle" ]
*createmark elems 1 "displayed"
*createmark elems 2
*elementtestinterangle elems 1 $max_t 1 2 0 2 0 "maximum tria angle"
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
}
# $min_q
proc min_q_angle {} {
*unmaskall2
*nodecleartempmark
set min_q [hm_getstring "minimum quad angle" ]
*createmark elems 1 "displayed"
*createmark elems 2
*elementtestinterangle elems 1 $min_q 0 2 1 2 0 "minimum quad angle"
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
}
# $max_q
proc max_q_angle {} {
*unmaskall2
*nodecleartempmark
set max_q [hm_getstring "maximum maximum angle" ]
*createmark elems 1 "displayed"
*createmark elems 2
*elementtestinterangle elems 1 $max_q 1 2 0 2 0 "maximum quad angle"
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
}
# #GUI
set a .element
catch [destroy $a]
toplevel $a
wm title $a "QUALITY CHECK WIZARD"
wm geometry $a 400x600+100+300;
wm resizable $a 0 0
wm deiconify $a
set C "min_length max_length warpage aspect_ratio skewness jacobian min_t_angle max_t_angle min_q_angle max_q_angle "
set R [llength $C]
set L " Min_length Max_length Warpage Aspectratio Skewness Jacobian Min_t_angle Max_t_angle Min_q_angle Max_q_angle "
set n 0
set a1 10
set a2 5
# puts $R
set b1 140
set b2 5
set n 0
# button loop
for {set i 1} {$i <= $R} {incr i} {

button $a.$i -text [lindex $L $n ] -bg grey -command [lindex $C $n ] ; place $a.$i -x $a1 -y $a2 -width 120 -height 40;
set n [expr {$n+1}]
set a2 [expr {$a2+55}]
}

OUTPUT:

RESULTS:

  • Element quality has been checked for 2D & 3D elements.
  • For each criteria button is created.
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.