Week - 11 - Element quality check
Aim:
To creat a macro in order to check element qality of both 2d and 3D
Procedure:
Create a button for each criteria
set addsub .window
catch {destroy $addsub}
toplevel $addsub -class toplevel
wm title $addsub "Element_Qality"
wm geometry $addsub 1000x700+200+200; update
wm resizable $addsub 0 0
wm deiconify $addsub
label $addsub.01 -text "2D" -bg red -font {times 10 bold}; place $addsub.01 -x 50 -y 5 -width 250 -height 30
entry $addsub.02 -textvariable w; place $addsub.02 -x 300 -y 50 -width 50 -height 40
button $addsub.03 -text "Warpage" -command {warpage $w} -bg yellow -font {times 20 bold}; place $addsub.03 -x 20 -y 50 -width 200 -height 40
entry $addsub.04 -textvariable a; place $addsub.04 -x 300 -y 100 -width 50 -height 40
button $addsub.05 -text "Aspect" -command {aspect $a} -bg yellow -font {times 20 bold}; place $addsub.05 -x 20 -y 100 -width 200 -height 40
entry $addsub.06 -textvariable s; place $addsub.06 -x 300 -y 150 -width 50 -height 40
button $addsub.07 -text "Skew" -command {skew $s} -bg yellow -font {times 20 bold}; place $addsub.07 -x 20 -y 150 -width 200 -height 40
entry $addsub.08 -textvariable j; place $addsub.08 -x 300 -y 200 -width 50 -height 40
button $addsub.09 -text "Jacobian" -command {jacobian $j} -bg yellow -font {times 20 bold}; place $addsub.09 -x 20 -y 200 -width 200 -height 40
entry $addsub.10 -textvariable min_l; place $addsub.10 -x 300 -y 250 -width 50 -height 40
button $addsub.11 -text "MinLength" -command {minlength $min_l} -bg yellow -font {times 20 bold}; place $addsub.11 -x 20 -y 250 -width 200 -height 40
entry $addsub.12 -textvariable max_l; place $addsub.12 -x 300 -y 300 -width 50 -height 40
button $addsub.13 -text "MaxLength" -command {maxlength $max_l} -bg yellow -font {times 20 bold}; place $addsub.13 -x 20 -y 300 -width 200 -height 40
entry $addsub.14 -textvariable min_a_t; place $addsub.14 -x 300 -y 350 -width 50 -height 40
button $addsub.15 -text "MinAngleTria" -command {minangletria $min_a_t} -bg yellow -font {times 20 bold}; place $addsub.15 -x 20 -y 350 -width 200 -height 40
entry $addsub.16 -textvariable max_a_t; place $addsub.16 -x 300 -y 400 -width 50 -height 40
button $addsub.17 -text "MaxAngleTria" -command {maxangletria $max_a_t} -bg yellow -font {times 20 bold}; place $addsub.17 -x 20 -y 400 -width 200 -height 40
entry $addsub.18 -textvariable min_a_q; place $addsub.18 -x 300 -y 450 -width 50 -height 40
button $addsub.19 -text "MinAngleQuad" -command {minanglequad $min_a_q} -bg yellow -font {times 20 bold}; place $addsub.19 -x 20 -y 450 -width 200 -height 40
entry $addsub.20 -textvariable max_a_q; place $addsub.20 -x 300 -y 500 -width 50 -height 40
button $addsub.21 -text "MaxAngleQuad" -command {maxanglequad $max_a_q} -bg yellow -font {times 20 bold}; place $addsub.21 -x 20 -y 500 -width 200 -height 40
label $addsub.22 -text "3D" -bg red -font {times 10 bold}; place $addsub.22 -x 550 -y 5 -width 250 -height 30
entry $addsub.23 -textvariable 3D_w; place $addsub.23 -x 775 -y 50 -width 50 -height 40
button $addsub.24 -text "3D_Warpage" -command {3D_warpage $3D_w} -bg yellow -font {times 20 bold}; place $addsub.24 -x 500 -y 50 -width 200 -height 40
entry $addsub.25 -textvariable 3D_a; place $addsub.25 -x 775 -y 100 -width 50 -height 40
button $addsub.26 -text "3D_Aspect" -command {3D_aspect $3D_a} -bg yellow -font {times 20 bold}; place $addsub.26 -x 500 -y 100 -width 200 -height 40
entry $addsub.27 -textvariable 3D_s; place $addsub.27 -x 775 -y 150 -width 50 -height 40
button $addsub.28 -text "3D_Skew" -command {3D_skew $3D_s} -bg yellow -font {times 20 bold}; place $addsub.28 -x 500 -y 150 -width 200 -height 40
entry $addsub.29 -textvariable 3D_j; place $addsub.29 -x 775 -y 200 -width 50 -height 40
button $addsub.30 -text "3D_Jacobian" -command {3D_jacobian $3D_j} -bg yellow -font {times 20 bold}; place $addsub.30 -x 500 -y 200 -width 200 -height 40
entry $addsub.31 -textvariable 3D_tet; place $addsub.31 -x 775 -y 250 -width 50 -height 40
button $addsub.32 -text "3D_Tetra" -command {3D_tetra $3D_tet} -bg yellow -font {times 20 bold}; place $addsub.32 -x 500 -y 250 -width 200 -height 40
On pressing the button the elements should be highlighted using temp nodes
*nodemarkaddtempmark 1
Entry boxes next to the buttons will accept the quality criteria value
*elementtestwarpage elements 1 $warp 2 2 0 " 2D Warpage "
Entire procedure to create a macro
set addsub .window
catch {destroy $addsub}
toplevel $addsub -class toplevel
wm title $addsub "Element_Qality"
wm geometry $addsub 1000x700+200+200; update
wm resizable $addsub 0 0
wm deiconify $addsub
label $addsub.01 -text "2D" -bg red -font {times 10 bold}; place $addsub.01 -x 50 -y 5 -width 250 -height 30
entry $addsub.02 -textvariable w; place $addsub.02 -x 300 -y 50 -width 50 -height 40
button $addsub.03 -text "Warpage" -command {warpage $w} -bg yellow -font {times 20 bold}; place $addsub.03 -x 20 -y 50 -width 200 -height 40
entry $addsub.04 -textvariable a; place $addsub.04 -x 300 -y 100 -width 50 -height 40
button $addsub.05 -text "Aspect" -command {aspect $a} -bg yellow -font {times 20 bold}; place $addsub.05 -x 20 -y 100 -width 200 -height 40
entry $addsub.06 -textvariable s; place $addsub.06 -x 300 -y 150 -width 50 -height 40
button $addsub.07 -text "Skew" -command {skew $s} -bg yellow -font {times 20 bold}; place $addsub.07 -x 20 -y 150 -width 200 -height 40
entry $addsub.08 -textvariable j; place $addsub.08 -x 300 -y 200 -width 50 -height 40
button $addsub.09 -text "Jacobian" -command {jacobian $j} -bg yellow -font {times 20 bold}; place $addsub.09 -x 20 -y 200 -width 200 -height 40
entry $addsub.10 -textvariable min_l; place $addsub.10 -x 300 -y 250 -width 50 -height 40
button $addsub.11 -text "MinLength" -command {minlength $min_l} -bg yellow -font {times 20 bold}; place $addsub.11 -x 20 -y 250 -width 200 -height 40
entry $addsub.12 -textvariable max_l; place $addsub.12 -x 300 -y 300 -width 50 -height 40
button $addsub.13 -text "MaxLength" -command {maxlength $max_l} -bg yellow -font {times 20 bold}; place $addsub.13 -x 20 -y 300 -width 200 -height 40
entry $addsub.14 -textvariable min_a_t; place $addsub.14 -x 300 -y 350 -width 50 -height 40
button $addsub.15 -text "MinAngleTria" -command {minangletria $min_a_t} -bg yellow -font {times 20 bold}; place $addsub.15 -x 20 -y 350 -width 200 -height 40
entry $addsub.16 -textvariable max_a_t; place $addsub.16 -x 300 -y 400 -width 50 -height 40
button $addsub.17 -text "MaxAngleTria" -command {maxangletria $max_a_t} -bg yellow -font {times 20 bold}; place $addsub.17 -x 20 -y 400 -width 200 -height 40
entry $addsub.18 -textvariable min_a_q; place $addsub.18 -x 300 -y 450 -width 50 -height 40
button $addsub.19 -text "MinAngleQuad" -command {minanglequad $min_a_q} -bg yellow -font {times 20 bold}; place $addsub.19 -x 20 -y 450 -width 200 -height 40
entry $addsub.20 -textvariable max_a_q; place $addsub.20 -x 300 -y 500 -width 50 -height 40
button $addsub.21 -text "MaxAngleQuad" -command {maxanglequad $max_a_q} -bg yellow -font {times 20 bold}; place $addsub.21 -x 20 -y 500 -width 200 -height 40
label $addsub.22 -text "3D" -bg red -font {times 10 bold}; place $addsub.22 -x 550 -y 5 -width 250 -height 30
entry $addsub.23 -textvariable 3D_w; place $addsub.23 -x 775 -y 50 -width 50 -height 40
button $addsub.24 -text "3D_Warpage" -command {3D_warpage $3D_w} -bg yellow -font {times 20 bold}; place $addsub.24 -x 500 -y 50 -width 200 -height 40
entry $addsub.25 -textvariable 3D_a; place $addsub.25 -x 775 -y 100 -width 50 -height 40
button $addsub.26 -text "3D_Aspect" -command {3D_aspect $3D_a} -bg yellow -font {times 20 bold}; place $addsub.26 -x 500 -y 100 -width 200 -height 40
entry $addsub.27 -textvariable 3D_s; place $addsub.27 -x 775 -y 150 -width 50 -height 40
button $addsub.28 -text "3D_Skew" -command {3D_skew $3D_s} -bg yellow -font {times 20 bold}; place $addsub.28 -x 500 -y 150 -width 200 -height 40
entry $addsub.29 -textvariable 3D_j; place $addsub.29 -x 775 -y 200 -width 50 -height 40
button $addsub.30 -text "3D_Jacobian" -command {3D_jacobian $3D_j} -bg yellow -font {times 20 bold}; place $addsub.30 -x 500 -y 200 -width 200 -height 40
entry $addsub.31 -textvariable 3D_tet; place $addsub.31 -x 775 -y 250 -width 50 -height 40
button $addsub.32 -text "3D_Tetra" -command {3D_tetra $3D_tet} -bg yellow -font {times 20 bold}; place $addsub.32 -x 500 -y 250 -width 200 -height 40
proc warpage {w} {
set warp $w;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestwarpage elements 1 $warp 2 2 0 " 2D Warpage "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc aspect {a} {
set asp $a;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestaspect elements 1 $asp 2 2 0 " 2D Aspect Ratio "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc skew {s} {
set skw $s;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestskew elements 1 $skw 2 2 0 " 2D Skew "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc jacobian {j} {
set jacob $j;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestjacobian elements 1 $jacob 2 2 0 " 2D Jacobian "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc minlength {min_l} {
set mnl $min_l;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestlength elements 1 $mn1 2 1 2 0 " 2D Length < "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc maxlength {max_l} {
set mxl $max_l;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestlength elements 1 $mxl 2 0 2 0 " 2D Length > "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc minangletria {min_a_t} {
set mnat $min_a_t;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestinterangle elements 1 $mnat 1 2 1 2 0 " 2D Tria Min Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc maxangletria {max_a_t} {
set mxat $max_a_t;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestinterangle elements 1 $mxat 1 2 0 2 0 " 2D Tria Max Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc maxanglequad {max_a_q} {
set mxaq $max_a_q;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestinterangle elements 1 $mxaq 1 2 0 2 0 " 2D Quad Max Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc minanglequad {min_a_q} {
set mnaq $min_a_q;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestinterangle elements 1 $mnaq 1 2 1 2 0 " 2D Quad Min Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc 3D_warpage {3D_w} {
set 3Dwarp $3D_w;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestwarpage elements 1 $3Dwarp 2 4 0 " 3D Warpage "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc 3D_aspect {3D_a} {
set 3Daspt $3D_a;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestaspect elements 1 $3Daspt 2 4 0 " 3D Aspect Ratio "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc 3D_skew {3D_s} {
set 3Dskw $3D_s;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestskew elements 1 $3Dskw 2 4 0 " 3D Skew "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc 3D_jacobian {3D_j} {
set 3Djacob $3D_j;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtestjacobian elements 1 $3Djacob 2 4 0 " 3D Jacobian "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
proc 3D_tetra {3D_tet} {
set 3Dtet $3D_tet;
*clearmarkall 1; *clearmarkall 2;
*nodecleartempmark
*createmark elements 1 "displayed"
*elementtesttetracollapse elements 1 $3Dtet 2 0 " 3D Tetra Collapse "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall2
}
Snippets:

GUI after running the macro

The created macro tested on 2D elements
The created macro tested on 3D elements
* The macro has attached below
Conclusion:
This helps to check element qality with ease.