Skip to content

Commit 6f6d75b

Browse files
fixed inactive inlet bug
1 parent 0e7e091 commit 6f6d75b

4 files changed

Lines changed: 21 additions & 9 deletions

File tree

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ proc CDEM::xml::Init { } {
88
variable dir
99
Model::InitVariables dir $CDEM::dir
1010
Model::ForgetElements
11-
Model::ForgetMaterials
1211
Model::ForgetConstitutiveLaws
1312
Model::getElements ElementsC.xml
14-
Model::ForgetConditions
1513
Model::getConditions Conditions.xml
16-
Model::getConditions "../../DEM/xml/Conditions.xml"
1714
Model::getConstitutiveLaws ConstitutiveLawsC.xml
18-
Model::getMaterials "../../DEM/xml/Materials.xml"
1915
Model::getProcesses "../../Common/xml/Processes.xml"
2016
Model::getProcesses Processes.xml
2117
}

kratos.gid/apps/DEM/write/writeMDPA_Inlet.tcl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ proc DEM::write::GetInletConditionXpath { } {
3333
return $xp1
3434
}
3535

36-
proc DEM::write::GetInletGroups { } {
36+
# That can be all or active / All by default
37+
proc DEM::write::GetInletGroups { {that all}} {
3738
set groups [list ]
3839

3940
foreach group [[customlib::GetBaseRoot] selectNodes [DEM::write::GetInletConditionXpath]/group] {
4041
set groupid [$group @n]
42+
if {$that eq "active"} {
43+
set active_inlet [write::getValueByNodeChild $group SetActive]
44+
if {[write::isBooleanFalse $active_inlet]} {continue}
45+
}
4146
lappend groups [write::GetWriteGroupName $groupid]
4247
}
4348
return $groups
@@ -127,6 +132,11 @@ proc DEM::write::writeInletMeshes { } {
127132
set mid [write::AddSubmodelpart $condition_name $groupid]
128133
set props [DEM::write::FindPropertiesBySubmodelpart $inletProperties $mid]
129134
if {$props eq ""} {W "Error printing inlet $groupid"}
135+
set is_active [dict get $props Material Variables SetActive]
136+
if {[write::isBooleanFalse $is_active]} {
137+
continue
138+
}
139+
130140
set group_real_name [write::GetWriteGroupName $groupid]
131141
set gdict [dict create]
132142
set f "%10i\n"
@@ -135,10 +145,6 @@ proc DEM::write::writeInletMeshes { } {
135145
write::WriteString "Begin SubModelPart $mid // Group $groupid // Subtree Inlet"
136146
write::WriteString " Begin SubModelPartData"
137147

138-
set is_active [dict get $props Material Variables SetActive]
139-
if {$is_active=="No"} {
140-
continue
141-
}
142148

143149
if {[write::isBooleanTrue $is_active]} {
144150
set motion_type [dict get $props Material Variables InletMotionType]

kratos.gid/apps/DEM/write/writeMaterials.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ proc DEM::write::getDEMMaterialsDict { } {
5252
set gnodes [[customlib::GetBaseRoot] selectNodes "//condition/group"]
5353
foreach gnode $gnodes {
5454
set mat_child [$gnode selectNodes "value\[@n='Material'\]"]
55+
set active_group_node [$gnode selectNodes "value\[@n='SetActive'\]"]
56+
if {$active_group_node ne ""} {
57+
if {[write::isBooleanFalse [write::getValueByNode $active_group_node]]} {
58+
continue
59+
}
60+
}
5561
if {$mat_child ne ""} {
5662
set mat_name [write::getValueByNode $mat_child]
5763
set group_name [write::GetWriteGroupName [$gnode @n]]

kratos.gid/scripts/Writing/Writing.tcl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,10 @@ proc write::getValueByNode { node {what noforce} } {
485485
}
486486
return [getFormattedValue [get_domnode_attribute $node v]]
487487
}
488+
proc write::getValueByNodeChild { parent_node child_name {what noforce} } {
489+
set node [$parent_node find n $child_name]
490+
return [write::getValueByNode $node $what]
491+
}
488492
proc write::getValueByXPath { xpath { it "" }} {
489493
set root [customlib::GetBaseRoot]
490494
set node [$root selectNodes $xpath]

0 commit comments

Comments
 (0)