Skip to content

Commit 6053482

Browse files
committed
add benchmark
1 parent 88dee99 commit 6053482

7 files changed

Lines changed: 71 additions & 6 deletions

File tree

kratos.gid/apps/ShallowWater/app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"unique_names": {
2525
"parts": "SWParts",
2626
"materials": "SWMaterials",
27+
"benchmarks": "SWBenchmarks",
2728
"topography_data": "SWTopographicData",
2829
"initial_conditions": "SWInitialConditions",
2930
"conditions": "SWConditions",

kratos.gid/apps/ShallowWater/examples/DamBreak.tcl

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,57 @@ proc ::ShallowWater::examples::DamBreak::AssignGroups {args} {
5252
GiD_EntitiesGroups assign Body surfaces 1
5353

5454
GiD_Groups create Walls
55-
GiD_Groups edit color Left_Wall "#3b3b3bff"
56-
GiD_EntitiesGroups assign Left_Wall lines 1 3
55+
GiD_Groups edit color Walls "#3b3b3bff"
56+
GiD_EntitiesGroups assign Walls lines 1 3
5757

5858
GiD_Groups create Left
59-
GiD_Groups edit color Top_Wall "#3b3b3bff"
60-
GiD_EntitiesGroups assign Top_Wall lines 4
59+
GiD_Groups edit color Left "#3b3b3bff"
60+
GiD_EntitiesGroups assign Left lines 4
6161

6262
GiD_Groups create Right
63-
GiD_Groups edit color Right_Wall "#3b3b3bff"
64-
GiD_EntitiesGroups assign Right_Wall lines 2
63+
GiD_Groups edit color Right "#3b3b3bff"
64+
GiD_EntitiesGroups assign Right lines 2
6565
}
6666

6767
proc ::ShallowWater::examples::DamBreak::TreeAssignation {args} {
6868

69+
# Parts
70+
set parts [spdAux::getRoute "SWParts"]
71+
set part_node [customlib::AddConditionGroupOnXPath $parts Body]
72+
set props [list Element Element2D Material Concrete MANNING 0.01]
73+
spdAux::SetValuesOnBaseNode $part_node $props
74+
75+
# Nodal Conditions
76+
set nodal_conditions [spdAux::getRoute "SWBenchmarks"]
77+
set benchmark_cond "$nodal_conditions/condition\[@n='DamBreakBenchmark'\]"
78+
GiD_Groups create "Body//Benchmark" ### Creo que no hace falta
79+
GiD_Groups edit state "Body//Benchmark" hidden ### Creo que no hace falta
80+
spdAux::AddIntervalGroup Body "Body//Benchmark" ### Creo que no hace falta
81+
set benchmark_node [customlib::AddConditionGroupOnXPath $thermalnodcond Body]
82+
$benchmark_node setAttribute ov surface
83+
set props [list value 303.15 Interval Initial] ### Con los valores por defecto de Kratos ya va bien
84+
spdAux::SetValuesOnBaseNode $thermalnodNode $props
85+
86+
# Conditions
87+
set boundary_conditions [spdAux::getRoute "SWConditions"]
88+
set flow_rate_cond "$boundary_conditions/condition\[@n='ImposedFlowRate'\]"
89+
set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond Walls]
90+
$flow_rate_node setAttribute ov line
91+
set props [list value 303.15 Interval Total] ### que es esto? ASIGNAR: Y impuesto, X libre
92+
spdAux::SetValuesOnBaseNode $flow_rate_node $props
93+
94+
set flow_rate_cond "$boundary_conditions/condition\[@n='ImposedFlowRate'\]"
95+
set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond Right]
96+
$flow_rate_node setAttribute ov line
97+
set props [list value 303.15 Interval Total] ### que es esto? ASIGNAR: X impuesto, Y libre
98+
spdAux::SetValuesOnBaseNode $flow_rate_node $props
99+
100+
set flow_rate_cond "$boundary_conditions/condition\[@n='ImposedFlowRate'\]"
101+
set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond Left]
102+
$flow_rate_node setAttribute ov line
103+
set props [list value 303.15 Interval Total] ### que es esto? ASIGNAR: Y impuesto, X libre
104+
spdAux::SetValuesOnBaseNode $flow_rate_node $props
105+
106+
# Refresh
107+
spdAux::RequestRefresh
69108
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<container n="Benchmarks" pn="Benchmarks" un="SWBenchmarks" icon="topography" open_window="1">
3+
<dynamicnode command="spdAux::injectNodalConditions" args="App ShallowWater Type Benchmark"/>
4+
</container>

kratos.gid/apps/ShallowWater/xml/Main.spd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<container n="ShallowWater" pn="Shallow Water" icon="app" prefix="SW" tree_state="open" open_window="0">
33
<include n="Parts" active="1" path="apps/ShallowWater/xml/Parts.spd"/>
4+
<include n="Benchmarks" active="0" path="apps/ShallowWater/xml/Benchmarks.spd"/>
45
<include n="TopographicData" active="1" path="apps/ShallowWater/xml/TopographicData.spd"/>
56
<include n="InitialConditions" active="1" path="apps/ShallowWater/xml/InitialConditions.spd"/>
67
<include n="BoundaryConditions" active="1" path="apps/ShallowWater/xml/BoundaryConditions.spd"/>

kratos.gid/apps/ShallowWater/xml/NodalConditions.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,15 @@
2525
<parameter n="TOPOGRAPHY" pn="Topography" v="Yes"/>
2626
</outputs>
2727
</NodalConditionItem>
28+
<NodalConditionItem
29+
n="DamBreakBenchmark"
30+
pn="Dam Break benchmark"
31+
ProcessName="DamBreakBenchmark"
32+
App="ShallowWater"
33+
Type="Benchmark"
34+
ImplementedInApplication="ShallowWaterApplication"
35+
Interval="False">
36+
<outputs>
37+
</outputs>
38+
</NodalConditionItem>
2839
</NodalConditionList>

kratos.gid/apps/ShallowWater/xml/Processes.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,12 @@
3131
</inputs>
3232
</Process>
3333

34+
<Process n="DamBreakBenchmark" pn="Dam break benchmark" python_module="dam_break_benchmark" kratos_module="KratosMultiphysics.ShallowWaterApplication.benchmarks" help="">
35+
<inputs>
36+
<parameter n="left_height" pn="Left height" v="1.0" />
37+
<parameter n="right_height" pn="Right height" v="1.0" />
38+
<parameter n="dam_position" pn="Dam position" v="1.0" />
39+
</inputs>
40+
</Process>
41+
3442
</ProcessList>

kratos.gid/apps/ShallowWater/xml/XmlController.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ proc ::ShallowWater::xml::getUniqueName {name} {
2121

2222
proc ::ShallowWater::xml::CustomTree {args} {
2323
# Set the nodal conditions active
24+
gid_groups_conds::setAttributes "[spdAux::getRoute [GetUniqueName benchmarks]]/condition" [list state normal]
2425
gid_groups_conds::setAttributes "[spdAux::getRoute [GetUniqueName topography_data]]/condition" [list state normal]
2526
gid_groups_conds::setAttributes "[spdAux::getRoute [GetUniqueName initial_conditions]]/condition" [list state normal]
2627

0 commit comments

Comments
 (0)