Skip to content

Commit 064636e

Browse files
migrate shallow water
1 parent 1fdc088 commit 064636e

3 files changed

Lines changed: 12 additions & 40 deletions

File tree

kratos.gid/apps/ShallowWater/app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"materials_file": "TopographyMaterials.json",
4040
"properties_location": "json",
4141
"model_part_name": "main_model_part",
42-
"output_model_part_name": "main_model_part"
42+
"output_model_part_name": "main_model_part",
43+
"write_mdpa_mode": "geometries"
4344
},
4445
"main_launch_file": "../../exec/MainKratos.py",
4546
"description": "Tools for the simulation of free surface flows under the shallow water assumptions."

kratos.gid/apps/ShallowWater/write/write.tcl

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ proc ::ShallowWater::write::Init { } {
2222
SetAttribute properties_location [GetWriteProperty properties_location]
2323
SetAttribute materials_file [GetWriteProperty materials_file]
2424
SetAttribute model_part_name [GetWriteProperty model_part_name]
25+
SetAttribute write_mdpa_mode [GetWriteProperty write_mdpa_mode]
2526
}
2627

2728
proc ::ShallowWater::write::writeModelPartEvent { } {
@@ -32,57 +33,25 @@ proc ::ShallowWater::write::writeModelPartEvent { } {
3233
# Init data
3334
::write::initWriteConfiguration [GetAttributes]
3435

35-
# Headers
36-
::write::writeModelPartData
37-
::write::WriteString "Begin Properties 0"
38-
::write::WriteString "End Properties"
39-
::write::WriteString ""
40-
4136
# Nodal Coordinates
4237
::write::writeNodalCoordinates
4338

44-
# Element connectivities
45-
::write::writeElementConnectivities
39+
# Get the list of groups in the spd
40+
set lista [spdAux::GetListOfSubModelParts]
4641

47-
# Conditions connectivities
48-
writeConditions
42+
# Write the geometries
43+
set ret [::write::writeGeometryConnectivities $lista]
4944

50-
# SubmodelParts
51-
writeSubModelParts
45+
foreach group $lista {
46+
write::writeGroupSubModelPartAsGeometry [$group @n]
47+
}
5248
}
5349

5450
proc ::ShallowWater::write::Validate {} {
5551
set err ""
5652
return $err
5753
}
5854

59-
proc ::ShallowWater::write::writeConditions { } {
60-
variable ConditionsDictGroupIterators
61-
set ConditionsDictGroupIterators [::write::writeConditions [GetAttribute conditions_un] ]
62-
}
63-
64-
proc ::ShallowWater::write::writeSubModelParts {} {
65-
::write::writePartSubModelPart
66-
::write::writeNodalConditions [GetAttribute topography_data_un]
67-
::write::writeNodalConditions [GetAttribute initial_conditions_un]
68-
WriteConditionsSubModelParts
69-
}
70-
71-
proc ::ShallowWater::write::WriteConditionsSubModelParts { } {
72-
variable ConditionsDictGroupIterators
73-
set root [customlib::GetBaseRoot]
74-
set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group"
75-
foreach group [$root selectNodes $xp1] {
76-
set groupid [$group @n]
77-
set groupid [write::GetWriteGroupName $groupid]
78-
if {$groupid in [dict keys $ConditionsDictGroupIterators]} {
79-
::write::writeGroupSubModelPart [[$group parent] @n] $groupid "Conditions" [dict get $ConditionsDictGroupIterators $groupid]
80-
} else {
81-
::write::writeGroupSubModelPart [[$group parent] @n] $groupid "nodal"
82-
}
83-
}
84-
}
85-
8655
proc ::ShallowWater::write::writeCustomFilesEvent { } {
8756
write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] false [GetAttribute model_part_name]
8857
write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file]

kratos.gid/apps/ShallowWater/write/writeProjectParameters.tcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ proc ::ShallowWater::write::getParametersDict { } {
2525
# Output processes
2626
dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict]
2727

28+
set projectParametersDict [::write::GetModelersDict $projectParametersDict]
29+
2830
return $projectParametersDict
2931
}
3032

0 commit comments

Comments
 (0)