Skip to content

Commit 8d5cabe

Browse files
hotfix pfemfluid
1 parent 4a96d9c commit 8d5cabe

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

kratos.gid/apps/PfemFluid/write/write.tcl

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace eval ::PfemFluid::write {
22
namespace path ::PfemFluid
33
Kratos::AddNamespace [namespace current]
4-
4+
55
variable writeAttributes
66
variable remesh_domains_dict
77
variable bodies_list
@@ -16,11 +16,11 @@ proc PfemFluid::write::Init { } {
1616
set bodies_list [list ]
1717
variable Names
1818
set Names [dict create DeltaTime DeltaTime]
19-
20-
19+
20+
2121
SetAttribute materials_un [::PfemFluid::GetUniqueName materials]
2222
SetAttribute nodal_conditions_un [::PfemFluid::GetUniqueName nodal_conditions]
23-
23+
2424
SetAttribute main_launch_file [::PfemFluid::GetAttribute main_launch_file]
2525
SetAttribute materials_file [::PfemFluid::GetWriteProperty materials_file]
2626
SetAttribute properties_location [::PfemFluid::GetWriteProperty properties_location]
@@ -33,20 +33,20 @@ proc PfemFluid::write::writeModelPartEvent { } {
3333
# Validation
3434
set err [Validate]
3535
if {$err ne ""} {error $err}
36-
36+
3737
# Init data
3838
write::initWriteConfiguration [GetAttributes]
39-
39+
4040
set parts_un_list [GetPartsUN]
4141
foreach part_un $parts_un_list {
4242
write::initWriteData $part_un [GetAttribute materials_un]
4343
}
44-
44+
4545
write::writeModelPartData
4646
write::WriteString "Begin Properties 0"
4747
write::WriteString "End Properties"
4848
# write::writeMaterials "PfemFluid"
49-
49+
5050
write::writeNodalCoordinates
5151
foreach part_un $parts_un_list {
5252
write::initWriteData $part_un [GetAttribute materials_un]
@@ -56,16 +56,16 @@ proc PfemFluid::write::writeModelPartEvent { } {
5656
}
5757

5858
proc PfemFluid::write::writeMeshes { } {
59-
59+
6060
foreach part_un [GetPartsUN] {
6161
write::initWriteData $part_un [GetAttribute materials_un]
6262
write::writePartSubModelPart
6363
}
6464
# Solo Malla , no en conditions
6565
writeNodalConditions [GetAttribute nodal_conditions_un]
6666
#writeWaveMonitorMesh
67-
68-
67+
68+
6969
}
7070

7171

@@ -97,7 +97,7 @@ proc PfemFluid::write::GetPartsUN { } {
9797

9898

9999
proc PfemFluid::write::writeWaveMonitorMesh { } {
100-
100+
101101
set xp1 "[spdAux::getRoute "WaveMonitor"]/group"
102102
set groups_wave_height [[customlib::GetBaseRoot] selectNodes $xp1]
103103
foreach group $groups_wave_height {
@@ -111,7 +111,7 @@ proc PfemFluid::write::writeWaveMonitorMesh { } {
111111
proc ::PfemFluid::write::Validate {} {
112112
set err ""
113113
set root [customlib::GetBaseRoot]
114-
114+
115115

116116
return $err
117117
}
@@ -132,10 +132,18 @@ proc PfemFluid::write::WriteMaterialsFile { {write_const_law True} {include_mode
132132

133133
proc PfemFluid::write::writePropertiesJsonFile { {fname "materials.json"} {write_claw_name "True"} {model_part_name ""}} {
134134
set mats_json [dict create properties [list ] ]
135-
foreach parts_un [PfemFluid::write::GetPartsUN] {
136-
foreach property [dict get [write::getPropertiesList $parts_un $write_claw_name $model_part_name] properties ] {
135+
set parts_uns [PfemFluid::write::GetPartsUN]
136+
set ids [list ]
137+
foreach parts_un $parts_uns {
138+
set properties_dict [write::getPropertiesList $parts_un $write_claw_name $model_part_name]
139+
set properties [dict get $properties_dict properties ]
140+
foreach property $properties {
137141
if {$property ne "\[\]"} {
138-
dict lappend mats_json properties $property
142+
set property_id [dict get $property properties_id]
143+
if {$property_id ni $ids} {
144+
lappend ids $property_id
145+
dict lappend mats_json properties $property
146+
}
139147
}
140148
}
141149
}

0 commit comments

Comments
 (0)