Skip to content

Commit 112eaae

Browse files
added proc DefineMaterialTestConditions
1 parent 8c61289 commit 112eaae

2 files changed

Lines changed: 184 additions & 55 deletions

File tree

kratos.gid/apps/CDEM/write/writeMDPA_Walls.tcl

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ proc DEM::write::WriteMDPAWalls { } {
66
set wall_properties [WriteWallProperties]
77

88
# Nodal coordinates (only for Walls <inefficient> )
9-
write::writeNodalCoordinatesOnGroups [GetWallsGroups]
9+
W "1"
10+
write::writeNodalCoordinatesOnGroups [DEM::write::GetWallsGroups]
1011
write::writeNodalCoordinatesOnGroups [GetWallsGroupsSmp]
1112
write::writeNodalCoordinatesOnGroups [GetNodesForGraphs]
1213

1314
# Nodal conditions and conditions
1415
CDEM::write::writeConditions $wall_properties
1516

1617
# SubmodelParts
17-
if {$::Model::SpatialDimension eq "2D"} {CDEM::write::writeWallConditionMeshes2D
18+
if {$::Model::SpatialDimension eq "2D"} {DEM::write::writeWallConditionMeshes2D
1819
} else {CDEM::write::writeWallConditionMeshes}
1920

2021

@@ -77,7 +78,7 @@ proc CDEM::write::GetNodesForGraphs { } {
7778

7879
# TODO: SHOULD NO LONGER BE REQUIRED SINCE NEW PROC IN DEM::
7980
proc CDEM::write::writeConditions { wall_properties } {
80-
foreach group [GetWallsGroups] {
81+
foreach group [DEM::write::GetWallsGroups] {
8182
set mid [dict get $wall_properties $group]
8283
if {$::Model::SpatialDimension eq "2D"} {
8384
set rigid_type "RigidEdge3D2N"
@@ -94,11 +95,11 @@ proc CDEM::write::writeConditions { wall_properties } {
9495
}
9596

9697

97-
## CANNOT BE REMOVED SINCE SLIGHTLY DIFFERENT FROM DEM::
98+
## under testing. CAN BE REMOVED IF DefineMaterialTestConditions WORKS AS EXPECTED
9899
proc CDEM::write::writeWallConditionMeshes { } {
99100
set i 0
100101
set cond "DEM-FEM-Wall"
101-
foreach group [GetWallsGroups] {
102+
foreach group [DEM::write::GetWallsGroups] {
102103
incr i
103104
write::WriteString "Begin SubModelPart $i // GUI DEM-FEM-Wall - $cond - group identifier: $group"
104105
write::WriteString " Begin SubModelPartData // DEM-FEM-Wall. Group name: $group"
@@ -299,30 +300,72 @@ proc CDEM::write::writeWallConditionMeshes { } {
299300
write::WriteString " IS_GHOST $is_ghost"
300301
write::WriteString " IDENTIFIER [write::transformGroupName $group]"
301302

302-
set material_analysis [write::getValue DEMTestMaterial Active]
303-
if {$material_analysis == "true"} {
304-
set is_material_test [write::getValueByNode [$group_node selectNodes "./value\[@n='MaterialTest'\]"]]
305-
if {$is_material_test == "true"} {
306-
set as_condition [write::getValueByNode [$group_node selectNodes "./value\[@n='DefineTopBot'\]"]]
307-
if {$as_condition eq "top"} {
308-
write::WriteString " TOP 1"
309-
write::WriteString " BOTTOM 0"
310-
} else {
311-
write::WriteString " TOP 0"
312-
write::WriteString " BOTTOM 1"
313-
}
314-
}
315-
} else {
316-
write::WriteString " TOP 0"
317-
write::WriteString " BOTTOM 0"
318-
}
319-
320-
set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
321-
if {$GraphPrint == "true" || $material_analysis == "true"} {
322-
set GraphPrintval 1
323-
} else {
324-
set GraphPrintval 0
325-
}
303+
# proc DEM::write::DefineMaterialTestConditions { } {
304+
# if CDEM:
305+
306+
# set material_analysis [write::getValue DEMTestMaterial Active]
307+
# if {$material_analysis == "true"} {
308+
# set is_material_test [write::getValueByNode [$group_node selectNodes "./value\[@n='MaterialTest'\]"]]
309+
# if {$is_material_test == "true"} {
310+
# set as_condition [write::getValueByNode [$group_node selectNodes "./value\[@n='DefineTopBot'\]"]]
311+
# if {$as_condition eq "top"} {
312+
# write::WriteString " TOP 1"
313+
# write::WriteString " BOTTOM 0"
314+
# } else {
315+
# write::WriteString " TOP 0"
316+
# write::WriteString " BOTTOM 1"
317+
# }
318+
# }
319+
# } else {
320+
# write::WriteString " TOP 0"
321+
# write::WriteString " BOTTOM 0"
322+
# }
323+
324+
# set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
325+
# if {$GraphPrint == "true" || $material_analysis == "true"} {
326+
# set GraphPrintval 1
327+
# } else {
328+
# set GraphPrintval 0
329+
# }
330+
# }
331+
332+
# else DEM:
333+
334+
# set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
335+
# if {$GraphPrint == "true"} {
336+
# set GraphPrintval 1
337+
# } else {
338+
# set GraphPrintval 0
339+
# }
340+
341+
342+
343+
344+
345+
# set material_analysis [write::getValue DEMTestMaterial Active]
346+
# if {$material_analysis == "true"} {
347+
# set is_material_test [write::getValueByNode [$group_node selectNodes "./value\[@n='MaterialTest'\]"]]
348+
# if {$is_material_test == "true"} {
349+
# set as_condition [write::getValueByNode [$group_node selectNodes "./value\[@n='DefineTopBot'\]"]]
350+
# if {$as_condition eq "top"} {
351+
# write::WriteString " TOP 1"
352+
# write::WriteString " BOTTOM 0"
353+
# } else {
354+
# write::WriteString " TOP 0"
355+
# write::WriteString " BOTTOM 1"
356+
# }
357+
# }
358+
# } else {
359+
# write::WriteString " TOP 0"
360+
# write::WriteString " BOTTOM 0"
361+
# }
362+
363+
# set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
364+
# if {$GraphPrint == "true" || $material_analysis == "true"} {
365+
# set GraphPrintval 1
366+
# } else {
367+
# set GraphPrintval 0
368+
# }
326369
write::WriteString " FORCE_INTEGRATION_GROUP $GraphPrintval"
327370
}
328371
write::WriteString " End SubModelPartData"
@@ -344,11 +387,12 @@ proc CDEM::write::writeWallConditionMeshes { } {
344387
}
345388
}
346389

347-
## CANNOT BE REMOVED SINCE SLIGHTLY DIFFERENT FROM DEM::
390+
## ## under testing. CAN BE REMOVED IF DefineMaterialTestConditions WORKS AS EXPECTED
348391
proc CDEM::write::writeWallConditionMeshes2D { } {
349392
set i 0
350393
set cond "DEM-FEM-Wall2D"
351-
foreach group [GetWallsGroups] {
394+
W "4"
395+
foreach group [DEM::write::GetWallsGroups] {
352396
incr i
353397
write::WriteString "Begin SubModelPart $i // GUI DEM-FEM-Wall2D - $cond - group identifier: $group"
354398
write::WriteString " Begin SubModelPartData // DEM-FEM-Wall. Group name: $group"

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

Lines changed: 109 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,10 @@ proc DEM::write::writeConditions { wall_properties } {
148148
proc DEM::write::GetWallsGroups { } {
149149
set groups [list ]
150150
if {$::Model::SpatialDimension eq "2D"} {set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-FEM-Wall2D'\]/group"
151-
} else { set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-FEM-Wall'\]/group"
152-
}
151+
} else { set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-FEM-Wall'\]/group"}
153152
foreach group [[customlib::GetBaseRoot] selectNodes $xp1] {
154-
set groupid [$group @n]
155-
lappend groups [write::GetWriteGroupName $groupid]
153+
set groupid [$group @n]
154+
lappend groups [write::GetWriteGroupName $groupid]
156155
}
157156
return $groups
158157
}
@@ -219,7 +218,6 @@ proc DEM::write::GetConditionsGroups { } {
219218
}
220219

221220
proc DEM::write::writeWallConditionMeshes { } {
222-
W "DEMwalls- proc DEM::write::writeWallConditionMeshes"
223221
set i 0
224222
set cond "DEM-FEM-Wall"
225223
foreach group [GetWallsGroups] {
@@ -423,14 +421,59 @@ proc DEM::write::writeWallConditionMeshes { } {
423421
write::WriteString " IS_GHOST $is_ghost"
424422
write::WriteString " IDENTIFIER [write::transformGroupName $group]"
425423

426-
427-
428-
set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
429-
if {$GraphPrint == "true"} {
430-
set GraphPrintval 1
431-
} else {
432-
set GraphPrintval 0
433-
}
424+
W "xxxxxxxxxxxxxxxxxxxxxx"
425+
W [apps::getActiveAppId]
426+
W "xxxxxxxxxxxxxxxxxxxxxx"
427+
DEM::DefineMaterialTestConditions
428+
429+
# proc DEM::write::DefineMaterialTestConditions { } {
430+
# if CDEM:
431+
432+
# set material_analysis [write::getValue DEMTestMaterial Active]
433+
# if {$material_analysis == "true"} {
434+
# set is_material_test [write::getValueByNode [$group_node selectNodes "./value\[@n='MaterialTest'\]"]]
435+
# if {$is_material_test == "true"} {
436+
# set as_condition [write::getValueByNode [$group_node selectNodes "./value\[@n='DefineTopBot'\]"]]
437+
# if {$as_condition eq "top"} {
438+
# write::WriteString " TOP 1"
439+
# write::WriteString " BOTTOM 0"
440+
# } else {
441+
# write::WriteString " TOP 0"
442+
# write::WriteString " BOTTOM 1"
443+
# }
444+
# }
445+
# } else {
446+
# write::WriteString " TOP 0"
447+
# write::WriteString " BOTTOM 0"
448+
# }
449+
450+
# set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
451+
# if {$GraphPrint == "true" || $material_analysis == "true"} {
452+
# set GraphPrintval 1
453+
# } else {
454+
# set GraphPrintval 0
455+
# }
456+
# }
457+
458+
# else DEM:
459+
460+
# set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
461+
# if {$GraphPrint == "true"} {
462+
# set GraphPrintval 1
463+
# } else {
464+
# set GraphPrintval 0
465+
# }
466+
467+
468+
469+
470+
471+
# set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
472+
# if {$GraphPrint == "true"} {
473+
# set GraphPrintval 1
474+
# } else {
475+
# set GraphPrintval 0
476+
# }
434477
write::WriteString " FORCE_INTEGRATION_GROUP $GraphPrintval"
435478
}
436479
write::WriteString " End SubModelPartData"
@@ -454,7 +497,6 @@ proc DEM::write::writeWallConditionMeshes { } {
454497

455498

456499
proc DEM::write::writeWallConditionMeshes2D { } {
457-
W "DEMwalls- proc DEM::write::writeWallConditionMeshes2d"
458500
set i 0
459501
set cond "DEM-FEM-Wall2D"
460502
foreach group [GetWallsGroups] {
@@ -653,16 +695,22 @@ proc DEM::write::writeWallConditionMeshes2D { } {
653695
set is_ghost [write::getValueByNode [$group_node selectNodes "./value\[@n='IsGhost'\]"]]
654696
write::WriteString " IS_GHOST $is_ghost"
655697
write::WriteString " IDENTIFIER [write::transformGroupName $group]"
656-
write::WriteString " TOP 0"
657-
write::WriteString " BOTTOM 0"
658-
659-
set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
660-
if {$GraphPrint == "true"} {
661-
set GraphPrintval 1
662-
} else {
663-
set GraphPrintval 0
664-
}
665-
write::WriteString " FORCE_INTEGRATION_GROUP $GraphPrintval"
698+
699+
W "xxxxxxxxxxxxxxxxxxxxxx"
700+
W [apps::getActiveAppId]
701+
W "xxxxxxxxxxxxxxxxxxxxxx"
702+
DEM::write::DefineMaterialTestConditions $group_node
703+
704+
# write::WriteString " TOP 0"
705+
# write::WriteString " BOTTOM 0"
706+
707+
# set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
708+
# if {$GraphPrint == "true"} {
709+
# set GraphPrintval 1
710+
# } else {
711+
# set GraphPrintval 0
712+
# }
713+
# write::WriteString " FORCE_INTEGRATION_GROUP $GraphPrintval"
666714
}
667715
write::WriteString " End SubModelPartData"
668716

@@ -683,3 +731,40 @@ proc DEM::write::writeWallConditionMeshes2D { } {
683731
}
684732
}
685733

734+
proc DEM::write::DefineMaterialTestConditions {group_node} {
735+
if {[apps::getActiveAppId] eq "CDEM"} {
736+
set material_analysis [write::getValue DEMTestMaterial Active]
737+
if {$material_analysis == "true"} {
738+
set is_material_test [write::getValueByNode [$group_node selectNodes "./value\[@n='MaterialTest'\]"]]
739+
if {$is_material_test == "true"} {
740+
set as_condition [write::getValueByNode [$group_node selectNodes "./value\[@n='DefineTopBot'\]"]]
741+
if {$as_condition eq "top"} {
742+
write::WriteString " TOP 1"
743+
write::WriteString " BOTTOM 0"
744+
} else {
745+
write::WriteString " TOP 0"
746+
write::WriteString " BOTTOM 1"
747+
}
748+
}
749+
} else {
750+
write::WriteString " TOP 0"
751+
write::WriteString " BOTTOM 0"
752+
}
753+
754+
set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
755+
if {$GraphPrint == "true" || $material_analysis == "true"} {
756+
set GraphPrintval 1
757+
} else {
758+
set GraphPrintval 0
759+
}
760+
} else {
761+
762+
set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]]
763+
if {$GraphPrint == "true"} {
764+
set GraphPrintval 1
765+
} else {
766+
set GraphPrintval 0
767+
}
768+
}
769+
write::WriteString " FORCE_INTEGRATION_GROUP $GraphPrintval"
770+
}

0 commit comments

Comments
 (0)