Skip to content

Commit 1eb53aa

Browse files
committed
initial example shallow water
1 parent 48f231b commit 1eb53aa

3 files changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
namespace eval ::ShallowWater::examples::DamBreak {
2+
namespace path ::ShallowWater::examples
3+
Kratos::AddNamespace [namespace current]
4+
}
5+
6+
proc ::ShallowWater::examples::DamBreak::Init {args} {
7+
if {![Kratos::IsModelEmpty]} {
8+
set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
9+
set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
10+
if { $retval == "cancel" } { return }
11+
}
12+
DrawGeometry
13+
AssignGroups
14+
TreeAssignation
15+
16+
GiD_Process 'Redraw
17+
GidUtils::UpdateWindow GROUPS
18+
GidUtils::UpdateWindow LAYER
19+
GiD_Process 'Zoom Frame
20+
}
21+
22+
proc ::ShallowWater::examples::DamBreak::DrawGeometry {args} {
23+
Kratos::ResetModel
24+
GiD_Layers create main_layer
25+
GiD_Layers edit to_use main_layer
26+
27+
# Geometry creation
28+
## Points ##
29+
set coordinates [list 0 0 0 10 0 0 10 1 0 0 1 0]
30+
set geom_points [list ]
31+
foreach {x y z} $coordinates {
32+
lappend geom_points [GiD_Geometry create point append main_layer $x $y $z]
33+
}
34+
35+
## Lines ##
36+
set geom_lines [list ]
37+
set initial [lindex $geom_points 0]
38+
foreach point [lrange $geom_points 1 end] {
39+
lappend geom_lines [GiD_Geometry create line append stline main_layer $initial $point]
40+
set initial $point
41+
}
42+
lappend geom_lines [GiD_Geometry create line append stline main_layer $initial [lindex $geom_points 0]]
43+
44+
## Surface ##
45+
GiD_Process Mescape Geometry Create NurbsSurface {*}$geom_lines escape escape
46+
}
47+
48+
proc ::ShallowWater::examples::DamBreak::AssignGroups {args} {
49+
# Create and assign the groups
50+
GiD_Groups create Body
51+
GiD_Groups edit color Body "#26d1a8ff"
52+
GiD_EntitiesGroups assign Body surfaces 1
53+
54+
GiD_Groups create Walls
55+
GiD_Groups edit color Left_Wall "#3b3b3bff"
56+
GiD_EntitiesGroups assign Left_Wall lines 1 3
57+
58+
GiD_Groups create Left
59+
GiD_Groups edit color Top_Wall "#3b3b3bff"
60+
GiD_EntitiesGroups assign Top_Wall lines 4
61+
62+
GiD_Groups create Right
63+
GiD_Groups edit color Right_Wall "#3b3b3bff"
64+
GiD_EntitiesGroups assign Right_Wall lines 2
65+
}
66+
67+
proc ::ShallowWater::examples::DamBreak::TreeAssignation {args} {
68+
69+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace eval ::ShallowWater::examples {
2+
namespace path ::ShallowWater
3+
Kratos::AddNamespace [namespace current]
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Group id="ShallowWater" name="Shallow water examples">
3+
<Example id="DamBreak" app="ShallowWater" logo="more.png" name="Dam break" dim="2D" cmd="::ShallowWater::examples::DamBreak::Init">
4+
<Description></Description>
5+
</Example>
6+
</Group>

0 commit comments

Comments
 (0)