Skip to content

Commit 04eea32

Browse files
Print Wave as condition with process
1 parent 3fcbc86 commit 04eea32

3 files changed

Lines changed: 52 additions & 24 deletions

File tree

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

Lines changed: 17 additions & 2 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
@@ -20,7 +20,7 @@ proc PfemFluid::write::Init { } {
2020

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]
@@ -59,6 +59,8 @@ proc PfemFluid::write::writeMeshes { } {
5959
}
6060
# Solo Malla , no en conditions
6161
writeNodalConditions [GetAttribute nodal_conditions_un]
62+
writeWaveMonitorMesh
63+
6264

6365
}
6466

@@ -89,6 +91,19 @@ proc PfemFluid::write::GetPartsUN { } {
8991
return $lista
9092
}
9193

94+
95+
proc PfemFluid::write::writeWaveMonitorMesh { } {
96+
97+
set xp1 "[spdAux::getRoute "WaveMonitor"]/group"
98+
set groups_wave_height [[customlib::GetBaseRoot] selectNodes $xp1]
99+
foreach group $groups_wave_height {
100+
set groupid [$group @n]
101+
set groupid [::write::GetWriteGroupName $groupid]
102+
::write::writeGroupSubModelPart WaveMonitor $groupid "nodal"
103+
}
104+
}
105+
106+
92107
# Custom files (Copy python scripts, write materials file...)
93108
proc PfemFluid::write::writeCustomFilesEvent { } {
94109
# Write the fluid materials json file

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

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ proc PfemFluid::write::GetPFEM_OutputProcesses { } {
161161
set resultList [dict create]
162162

163163
set output_process_list [GetPFEM_OutputProcessList]
164-
dict set resultList output_list $output_process_list
164+
dict lappend resultList output_list $output_process_list
165165

166166
return $resultList
167167
}
@@ -170,36 +170,49 @@ proc PfemFluid::write::GetPFEM_OutputProcesses { } {
170170
proc PfemFluid::write::GetPFEM_OutputProcessList { } {
171171

172172
set resultList [list]
173-
dict set resultList "python_module" "wave_height_output_process"
174-
dict set resultList "kratos_module" "KratosMultiphysics.PfemFluidDynamicsApplication"
175173

176-
set parametersWave [GetPFEM_OutputParameters]
177-
dict set resultList Parameters $parametersWave
174+
set xp1 "[spdAux::getRoute "WaveMonitor"]/group"
175+
set groups_wave_height [[customlib::GetBaseRoot] selectNodes $xp1]
176+
foreach group $groups_wave_height {
177+
set process [dict create]
178+
dict set process "python_module" "wave_height_output_process"
179+
dict set process "kratos_module" "KratosMultiphysics.PfemFluidDynamicsApplication"
180+
set parameters [GetPFEM_WaveParameters $group]
181+
dict set process Parameters $parameters
178182

179-
# lappend resultList [write::GetRestartProcess Restart]
183+
lappend resultList $process
184+
}
180185
return $resultList
181186
}
182187

183188

184-
proc PfemFluid::write::GetPFEM_OutputParameters { } {
185-
189+
proc PfemFluid::write::GetPFEM_WaveParameters { group } {
190+
186191
set parametersWave [dict create]
187-
dict set parametersWave "model_part_name" "PfemFluidModelPart"
188-
dict set parametersWave "coordinates" [write::getValue WaveMonitor Coordinates]
192+
193+
set group_id [::write::getSubModelPartId WaveMonitor [$group @n]]
194+
dict set parametersWave model_part_name [write::GetModelPartNameWithParent $group_id PfemFluidModelPart]
195+
196+
set coordinates [list ]
197+
foreach node [GiD_EntitiesGroups get [$group @n] nodes ] {
198+
set coords [GiD_Mesh get node $node coordinates]
199+
lappend coordinates $coords
200+
}
201+
dict set parametersWave "coordinates" $coordinates
189202

190203
set WaveCalculationSetting [dict create]
191-
dict set WaveCalculationSetting "mean_water_level" [write::getValue WaveMonitor MeanWaterLevel]
192-
dict set WaveCalculationSetting "relative_search_radius" [write::getValue WaveMonitor RelativeSearchRadius]
204+
dict set WaveCalculationSetting "mean_water_level" [write::getValueByNodeChild $group MeanWaterLevel]
205+
dict set WaveCalculationSetting "relative_search_radius" [write::getValueByNodeChild $group RelativeSearchRadius]
193206
dict set parametersWave wave_calculation_settings $WaveCalculationSetting
194207

195208
set OutputFileSettings [dict create]
196209
dict set OutputFileSettings "file_name" "pfem_<i>"
197210
dict set OutputFileSettings "output_path" "gauges"
198211
dict set parametersWave output_file_settings $OutputFileSettings
199212

200-
dict set parametersWave "time_between_outputs" [write::getValue WaveMonitor TimeBetweenOutputs]
201-
202-
return $parametersWave
213+
dict set parametersWave "time_between_outputs" [write::getValueByNodeChild $group TimeBetweenOutputs]
214+
215+
return $parametersWave
203216
}
204217

205218

kratos.gid/apps/PfemFluid/xml/Results.spd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
<value n="BodyOutput" pn="Body output" v="Yes" values="Yes,No" help="The interior of the volume is printed" icon="data"/>
1010
<value n="NodeOutput" pn="Node output" v="Yes" values="Yes,No" help="The nodes are printed as a separate layer" icon="data"/>
1111
<value n="SkinOutput" pn="Skin output" v="No" values="Yes,No" help="" state="hidden" icon="data"/>
12-
<container n="WaveMonitor" pn="Wave Monitor" un="WaveMonitor" icon="select" help="Activate the results you want to set wave gauges" open_window="0">
13-
<value n="UseWaveMonitor" pn="Add Wave Gauges" type="bool" values="true,false" v="false" icon="data" />
14-
<value n="Coordinates" pn="Coordinates" icon="data" fieldtype="vector" dimensions="3" format="%.6g" v="0.0,0.0,0.0" state="[getStateFromXPathValue {string(../value[@n='UseWaveMonitor']/@v)} true]" help="Coordinates of the wave gauges"/>
15-
<value n="MeanWaterLevel" pn="Mean Level" icon="data" v="0" state="[getStateFromXPathValue {string(../value[@n='UseWaveMonitor']/@v)} true]" help="Water Level"/>
16-
<value n="RelativeSearchRadius" pn="Relative Search Radius" icon="data" v="2" state="[getStateFromXPathValue {string(../value[@n='UseWaveMonitor']/@v)} true]" help="Relative versus element size"/>
17-
<value n="TimeBetweenOutputs" pn="Output Time" icon="data" v="0.01" state="[getStateFromXPathValue {string(../value[@n='UseWaveMonitor']/@v)} true]" help="Time between following measures"/>
18-
</container>
12+
<condition n="WaveMonitor" pn="Wave Monitor" ov="point" ovm="node" un="WaveMonitor" icon="select" help="Activate the results you want to set wave gauges" >
13+
<!-- <value n="UseWaveMonitor" pn="Add Wave Gauges" type="bool" values="true,false" v="false" icon="data" /> -->
14+
<!-- <value n="Coordinates" pn="Coordinates" icon="data" fieldtype="vector" dimensions="3" format="%.6g" v="0.0,0.0,0.0" help="Coordinates of the wave gauges"/> -->
15+
<value n="MeanWaterLevel" pn="Mean Level" icon="data" v="0" help="Water Level"/>
16+
<value n="RelativeSearchRadius" pn="Relative Search Radius" icon="data" v="2" help="Relative versus element size"/>
17+
<value n="TimeBetweenOutputs" pn="Output Time" icon="data" v="0.01" help="Time between following measures"/>
18+
</condition>
1919
<container n="OnElement" pn="Elemental Results" un="ElementResults" icon="select" help="Activate the results you want to see in the elements" open_window="0">
2020
<!--<dynamicnode command="spdAux::injectElementOutputs" args=""/>-->
2121
<!--<dynamicnode command="spdAux::injectConstitutiveLawOutputs" args=""/>-->

0 commit comments

Comments
 (0)