Challenge

Week - 11 - Element quality check

Report week 11 Element quality check

Objective:finish element quality check task

Problem Statement:

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

Tcl command explanation:

set a .window
catch {destroy $a}
toplevel $a -class TopLevel

wm title $a "Quality Check"
wm geometry $a 330x885+100+50; update
wm resizable $a 0 0
wm deiconify $a

label $a.01 -text "2D Elements Quality Check" -bg grey -font {times 10 bold}; place $a.01 -x 0 -y 0 -width 315 -height 50
button $a.02 -text "Min length" -command {min_length $min_l} -bg white -font {times 10}; place $a.02 -x 05 -y 55 -width 150 -height 50
button $a.03 -text "Max length" -command {max_length $max_l} -bg white -font {times 10}; place $a.03 -x 05 -y 110 -width 150 -height 50
button $a.04 -text "Warpage" -command {warpage $w} -bg white -font {times 10}; place $a.04 -x 05 -y 165 -width 150 -height 50
button $a.05 -text "Skew" -command {skew $s} -bg white -font {times 10}; place $a.05 -x 05 -y 220 -width 150 -height 50
button $a.06 -text "Aspect" -command {aspect $as} -bg white -font {times 10}; place $a.06 -x 05 -y 275 -width 150 -height 50
button $a.07 -text "Jacobian" -command {jacobian $j} -bg white -font {times 10}; place $a.07 -x 05 -y 330 -width 150 -height 50
button $a.08 -text "Min quad angle" -command {min_quad_angle $min_qa} -bg white -font {times 10}; place $a.08 -x 05 -y 385 -width 150 -height 50
button $a.09 -text "Max quad angle" -command {max_quad_angle $max_qa} -bg white -font {times 10}; place $a.09 -x 05 -y 440 -width 150 -height 50
button $a.10 -text "Min tria angle" -command {min_tria_angle $min_ta} -bg white -font {times 10}; place $a.10 -x 05 -y 495 -width 150 -height 50
button $a.11 -text "Max tria angle" -command {max_tria_angle $max_ta} -bg white -font {times 10}; place $a.11 -x 05 -y 550 -width 150 -height 50

entry $a.12 -textvariable min_l -bg white -font {times 10}; place $a.12 -x 165 -y 55 -width 150 -height 50
entry $a.13 -textvariable max_l -bg white -font {times 10}; place $a.13 -x 165 -y 110 -width 150 -height 50
entry $a.14 -textvariable w -bg white -font {times 10}; place $a.14 -x 165 -y 165 -width 150 -height 50
entry $a.15 -textvariable s -bg white -font {times 10}; place $a.15 -x 165 -y 220 -width 150 -height 50
entry $a.16 -textvariable as -bg white -font {times 10}; place $a.16 -x 165 -y 275 -width 150 -height 50
entry $a.17 -textvariable j -bg white -font {times 10}; place $a.17 -x 165 -y 330 -width 150 -height 50
entry $a.18 -textvariable min_qa -bg white -font {times 10}; place $a.18 -x 165 -y 385 -width 150 -height 50
entry $a.19 -textvariable max_qa -bg white -font {times 10}; place $a.19 -x 165 -y 440 -width 150 -height 50
entry $a.20 -textvariable min_ta -bg white -font {times 10}; place $a.20 -x 165 -y 495 -width 150 -height 50
entry $a.21 -textvariable max_ta -bg white -font {times 10}; place $a.21 -x 165 -y 550 -width 150 -height 50

label $a.22 -text "3D Elements Quality Check" -bg grey -font {times 10 bold}; place $a.22 -x 0 -y 605 -width 315 -height 50
button $a.23 -text "Warpage" -command {warpage_3d $war} -bg white -font {times 10}; place $a.23 -x 05 -y 660 -width 150 -height 50
button $a.24 -text "Tetra collapse" -command {tetcollapse $tet} -bg white -font {times 10}; place $a.24 -x 05 -y 715 -width 150 -height 50
button $a.25 -text "Volume skew " -command {volumeskew $vs} -bg white -font {times 10}; place $a.25 -x 05 -y 770 -width 150 -height 50
entry $a.26 -textvariable war -bg white -font {times 10}; place $a.26 -x 165 -y 660 -width 150 -height 50
entry $a.27 -textvariable tet -bg white -font {times 10}; place $a.27 -x 165 -y 715 -width 150 -height 50
entry $a.28 -textvariable vs -bg white -font {times 10}; place $a.28 -x 165 -y 770 -width 150 -height 50
button $a.29 -text "Clear nodes" -command {clear} -font {times 10}; place $a.29 -x 80 -y 825 -width 150 -height 50

proc min_length {min_l} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestlength elements 1 $min_l 2 1 2 0 " 2D Min Length "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc max_length {max_l} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestlength elements 1 $max_l 2 0 2 0 " 2D Max Length "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc warpage {w} {
*nodecleartempmark
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestwarpage elements 1 $w 2 2 0 " 2D Warpage "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc skew {s} {
*nodecleartempmark
*nodecleartempmark
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestskew elements 1 $s 2 2 0 " 2D Skew "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc aspect {as} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestaspect elements 1 $as 2 2 0 " 2D Aspect Ratio "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc jacobian {j} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestjacobian elements 1 $j 2 2 0 " 2D Jacobian "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc min_quad_angle {min_qa} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestinterangle elements 1 $min_qa 0 2 1 2 0 " 2D Quad Min Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc max_quad_angle {max_qa} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestinterangle elements 1 $max_qa 0 2 0 2 0 " 2D Quad Max Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc min_tria_angle {min_ta} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestinterangle elements 1 $min_ta 1 2 1 2 0 " 2D Tria Min Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc max_tria_angle {max_ta} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestinterangle elements 1 $max_ta 1 2 0 2 0 " 2D Tria Max Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc warpage_3d {war} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestwarpage elements 1 $war 2 4 0 " 3D Warpage "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc tetcollapse {tet} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtesttetracollapse elements 1 $tet 2 0 " 3D Tetra Collapse "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc volumeskew {vs} {
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestvolumetricskew elements 1 $vs 2 0 " 3D Volumetric Skew "
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}

proc clear {} {
*nodecleartempmark
}

Conclusion: the task is finished by above code

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.