@@ -10,7 +10,7 @@ proc ::Dam::examples::ThermoMechaDam2D::Init {args} {
1010 set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
1111 if { $retval == " cancel" } { return }
1212 }
13-
13+
1414 DrawGeometry
1515 AssignGroups
1616 AssignMeshSizes
@@ -24,15 +24,18 @@ proc ::Dam::examples::ThermoMechaDam2D::Init {args} {
2424proc ::Dam::examples::ThermoMechaDam2D::DrawGeometry {args} {
2525
2626 Kratos::ResetModel
27+
28+ # Dam #
2729 GiD_Layers create Dam
2830 GiD_Layers edit to_use Dam
2931
3032 # Geometry creation
3133 # # Points ##
32- set coordinates [list 0 0 0 10 0 0 3 30 0 0 30 0 ]
34+ set dam_coordinates [list { 0 0 0} { 10 0 0} { 3 30 0} { 0 30 0} ]
3335 set damPoints [list ]
34- foreach {x y z} $coordinates {
35- lappend damPoints [GiD_Geometry create point append Dam $x $y $z ]
36+ foreach point $dam_coordinates {
37+ lassign $point x y z
38+ lappend damPoints [GiD_Geometry create point append Dam $x $y $z ]
3639 }
3740
3841 # # Lines ##
@@ -44,36 +47,44 @@ proc ::Dam::examples::ThermoMechaDam2D::DrawGeometry {args} {
4447 }
4548 lappend damLines [GiD_Geometry create line append stline Dam $initial [lindex $damPoints 0]]
4649
47- # # Surface ##
50+ # # Surface ##
4851 GiD_Process Mescape Geometry Create NurbsSurface {*}$damLines escape escape
4952
50- # ~ # Soil #
51- GiD_Layers create Soil
52- GiD_Layers edit color Soil " #999900ff"
53- GiD_Layers edit to_use Soil
54-
55- # ~ # Geometry creation
56- # ~ ## Points ##
57- set soil_coordinates [list -5 0 0 -5 -5 0 15 -5 0 15 0 0 ]
58- set soilPoints [list ]
59- foreach {x y z} $soil_coordinates {
60- lappend soilPoints [GiD_Geometry create point append Soil $x $y $z ]
53+
54+ # Ground #
55+ GiD_Layers create Ground
56+ GiD_Layers edit color Ground " #999900ff"
57+ GiD_Layers edit to_use Ground
58+
59+ # Geometry creation
60+ # # Points ##
61+ set ground_coordinates [list {-5 0 0} {-5 -5 0} {15 -5 0} {15 0 0} ]
62+ set groundPoints [list ]
63+ foreach point $ground_coordinates {
64+ lassign $point x y z
65+ lappend groundPoints [GiD_Geometry create point append Ground $x $y $z ]
6166 }
6267
6368 # # Lines ##
64- set soilLines [list ]
69+ set groundLines [list ]
6570 set initial [lindex $damPoints 0]
66- foreach point [lrange $soilPoints 0 end] {
67- lappend soilLines [GiD_Geometry create line append stline Soil $initial $point ]
71+ foreach point [lrange $groundPoints 0 end] {
72+ lappend groundLines [GiD_Geometry create line append stline Ground $initial $point ]
6873 set initial $point
6974 }
70- lappend soilLines [GiD_Geometry create line append stline Soil $initial [lindex $damPoints 1]]
71-
75+ lappend groundLines [GiD_Geometry create line append stline Ground $initial [lindex $damPoints 1]]
7276
73- lappend soilLines 1
77+ lappend groundLines 1
7478
7579 # # Surface ##
76- GiD_Process Mescape Geometry Create NurbsSurface {*}$soilLines escape escape
80+ GiD_Process Mescape Geometry Create NurbsSurface {*}$groundLines escape escape
81+
82+ # Swap normals of hydrostatic pressure and heat flux surfaces to point outside the volume
83+ GiD_Process Mescape Utilities SwapNormals Lines Select 2 escape escape
84+ GiD_Process Mescape Utilities SwapNormals Lines Select 3 escape escape
85+ GiD_Process Mescape Utilities SwapNormals Lines Select 4 escape escape
86+ GiD_Process Mescape Utilities SwapNormals Lines Select 5 escape escape
87+ GiD_Process Mescape Utilities SwapNormals Lines Select 9 escape escape
7788
7889 GiD_Process 'Zoom Frame
7990
@@ -86,52 +97,36 @@ proc ::Dam::examples::ThermoMechaDam2D::AssignGroups {args} {
8697 GiD_Groups edit color Dam " #26d1a8ff"
8798 GiD_EntitiesGroups assign Dam surfaces 1
8899
89- GiD_Groups create Soil
90- GiD_Groups edit color Soil " #e0210fff"
91- GiD_EntitiesGroups assign Soil surfaces 2
100+ GiD_Groups create Ground
101+ GiD_Groups edit color Ground " #e0210fff"
102+ GiD_EntitiesGroups assign Ground surfaces 2
92103
93104 GiD_Groups create Displacement
94105 GiD_Groups edit color Displacement " #3b3b3bff"
95106 GiD_EntitiesGroups assign Displacement lines 7
96107
97- GiD_Groups create Initial
98- GiD_Groups edit color Initial " #26d1a8ff"
99- GiD_EntitiesGroups assign Initial surfaces {1 2}
100-
101- GiD_Groups create Bofang
102- GiD_Groups edit color Bofang " #42eb71ff"
103- GiD_EntitiesGroups assign Bofang lines {4 5}
104-
105- GiD_Groups create Uniform
106- GiD_Groups edit color Uniform " #3b3b3bff"
107- GiD_EntitiesGroups assign Uniform lines {3 2 9}
108+ GiD_Groups create UniformTemperature
109+ GiD_Groups edit color UniformTemperature " #3b3b3bff"
110+ GiD_EntitiesGroups assign UniformTemperature lines {2 3 4 5 9}
108111
109- GiD_Groups create Thermal_Parameters_1
110- GiD_Groups edit color Initial " #26d1a8ff"
111- GiD_EntitiesGroups assign Thermal_Parameters_1 surfaces 1
112-
113- GiD_Groups create Thermal_Parameters_2
114- GiD_Groups edit color Initial " #26d1a8ff"
115- GiD_EntitiesGroups assign Thermal_Parameters_2 surfaces 2
116-
117- GiD_Groups create Hydrostatic
118- GiD_Groups edit color Hydrostatic " #26d1a8fe"
119- GiD_EntitiesGroups assign Hydrostatic lines {4 5}
112+ GiD_Groups create Water
113+ GiD_Groups edit color Water " #26d1a8fe"
114+ GiD_EntitiesGroups assign Water lines {4 5}
120115
121116}
122117
123118proc ::Dam::examples::ThermoMechaDam2D::AssignMeshSizes {args} {
124119
125120 set dam_mesh_size 0.25
126- GiD_Process Mescape Meshing AssignSizes Surfaces $dam_mesh_size [GiD_EntitiesGroups get Dam surfaces] escape escape
127- GiD_Process Mescape Meshing AssignSizes Surfaces $dam_mesh_size [GiD_EntitiesGroups get Soil surfaces] escape escape
121+ GiD_Process Mescape Meshing AssignSizes Surfaces $dam_mesh_size 1:end escape escape
122+ GiD_Process Mescape Meshing AssignSizes Lines $dam_mesh_size 1:end escape escape
128123 # #Kratos::BeforeMeshGeneration $dam_mesh_size
129124}
130125
131126# Tree assign
132127proc ::Dam::examples::ThermoMechaDam2D::TreeAssignation {args} {
133128
134- set nd $::Model::SpatialDimension
129+ set nd $::Model::SpatialDimension
135130 set root [customlib::GetBaseRoot]
136131
137132 # Set Type of problem strategy set
@@ -143,64 +138,86 @@ proc ::Dam::examples::ThermoMechaDam2D::TreeAssignation {args} {
143138 set props [list Element SmallDisplacementElement2D ConstitutiveLaw ThermalLinearElastic2DPlaneStrain Material " Concrete-Dam" DENSITY 2400 YOUNG_MODULUS 1.962e10 POISSON_RATIO 0.20 THERMAL_EXPANSION 1e-05]
144139 spdAux::SetValuesOnBaseNode $damNode $props
145140
146- # Soil Part
147- set soilNode [customlib::AddConditionGroupOnXPath $damParts Soil]
148- set props_soil [list Element SmallDisplacementElement2D ConstitutiveLaw ThermalLinearElastic2DPlaneStrain Material Soil DENSITY 3000 YOUNG_MODULUS 4.9e10 POISSON_RATIO 0.25 THERMAL_EXPANSION 1e-05]
149- spdAux::SetValuesOnBaseNode $soilNode $props_soil
150-
151- # Dirichlet Conditions
141+ # Ground Part
142+ set groundNode [customlib::AddConditionGroupOnXPath $damParts Ground]
143+ set props_ground [list Element SmallDisplacementElement2D ConstitutiveLaw ThermalLinearElastic2DPlaneStrain Material Ground DENSITY 3000 YOUNG_MODULUS 4.9e10 POISSON_RATIO 0.25 THERMAL_EXPANSION 1e-05]
144+ spdAux::SetValuesOnBaseNode $groundNode $props_ground
152145
153- # Displacements
154- set damDirichletConditions [spdAux::getRoute " DamNodalConditions" ]
155- set displacement " $damDirichletConditions /condition\[ @n='DISPLACEMENT'\] "
156- set displacemnetnode [customlib::AddConditionGroupOnXPath $displacement Displacement]
157146
158- # Surface Temperature
159- set initial " $damDirichletConditions /condition\[ @n='INITIALTEMPERATURE'\] "
160- set initialnode [customlib::AddConditionGroupOnXPath $initial Initial]
161- set props_initial [list is_fixed 0 value 7.5 ]
162- spdAux::SetValuesOnBaseNode $initialnode $props_initial
147+ # Dirichlet Conditions
148+ set damDirichletConditions [spdAux::getRoute " DamNodalConditions" ]
163149
164- # Bofang Temperature
165- set bofang " $damDirichletConditions /condition\[ @n='BOFANGTEMPERATURE'\] "
166- set bofangnode [customlib::AddConditionGroupOnXPath $bofang Bofang]
167- set props_bofang [list is_fixed 1 Gravity_Direction Y Reservoir_Bottom_Coordinate_in_Gravity_Direction 0.0 Surface_Temp 15.19 Bottom_Temp 9.35 Height_Dam 30.0 Temperature_Amplitude 6.51 Day_Ambient_Temp 201 Water_level 20.0 Month 7 ]
168- spdAux::SetValuesOnBaseNode $bofangnode $props_bofang
150+ # Displacements
151+ set displacement " $damDirichletConditions /condition\[ @n='DISPLACEMENT'\] "
152+ set displacemnetnode [customlib::AddConditionGroupOnXPath $displacement Displacement]
169153
170- # Uniform Temperature
171- set uniform " $damDirichletConditions /condition\[ @n='INITIALTEMPERATURE'\] "
172- set uniformnode [customlib::AddConditionGroupOnXPath $uniform Uniform ]
173- set props_uniform [list is_fixed 1 value 10.0 ]
174- spdAux::SetValuesOnBaseNode $uniformnode $props_uniform
154+ # Surface Temperature
155+ set temperature_base " $damDirichletConditions /condition\[ @n='INITIALTEMPERATURE'\] "
156+ set dam_temperature [customlib::AddConditionGroupOnXPath $temperature_base Dam ]
157+ set props_dam_temperature [list is_fixed false value 7.5 ]
158+ spdAux::SetValuesOnBaseNode $dam_temperature $props_dam_temperature
175159
160+ set ground_temperature [customlib::AddConditionGroupOnXPath $temperature_base Ground]
161+ set props_ground_temperature [list is_fixed false value 7.5 ]
162+ spdAux::SetValuesOnBaseNode $ground_temperature $props_ground_temperature
176163
177- # Thermal Load Conditions
164+ # Bofang Temperature
165+ set bofang_temperature " $damDirichletConditions /condition\[ @n='BOFANGTEMPERATURE'\] "
166+ set bofang_temperature_node [customlib::AddConditionGroupOnXPath $bofang_temperature Water]
167+ set props_bofang_temperature [list is_fixed 1 Gravity_Direction Y Reservoir_Bottom_Coordinate_in_Gravity_Direction 0.0 Surface_Temp 15.19 Bottom_Temp 9.35 Height_Dam 30.0 Temperature_Amplitude 6.51 Day_Ambient_Temp 201 Water_level 20.0 Month 7 ]
168+ spdAux::SetValuesOnBaseNode $bofang_temperature_node $props_bofang_temperature
178169
179- # Thermal Parameters 1
180- set damThermalLoadConditions [spdAux::getRoute " DamThermalLoads" ]
181- set thermalparameter " $damThermalLoadConditions /condition\[ @n='ThermalParameters2D'\] "
182- set thermalparameternode1 [customlib::AddConditionGroupOnXPath $thermalparameter Thermal_Parameters_1]
170+ # Uniform Temperature
171+ set uniform_temperature " $damDirichletConditions /condition\[ @n='INITIALTEMPERATURE'\] "
172+ set uniform_temperature_node [customlib::AddConditionGroupOnXPath $uniform_temperature UniformTemperature]
173+ set props_uniform_temperature [list is_fixed true value 10.0 ]
174+ spdAux::SetValuesOnBaseNode $uniform_temperature_node $props_uniform_temperature
183175
184- # Thermal Parameters 2
185- set thermalparameternode2 [customlib::AddConditionGroupOnXPath $thermalparameter Thermal_Parameters_2]
186- set props_thermal_2 [list ThermalDensity 3000 ]
187- spdAux::SetValuesOnBaseNode $thermalparameternode2 $props_thermal_2
188176
189- # Load Conditions
177+ # Load Conditions
190178
191- # Hydrostatic Load
179+ # Hydrostatic Load
192180 set damLoadConditions [spdAux::getRoute " DamLoads" ]
193- set hydro " $damLoadConditions /condition\[ @n='HydroLinePressure2D'\] "
194- set hydronode [customlib::AddConditionGroupOnXPath $hydro Hydrostatic]
195- set props_hydro [list Modify 0 Gravity_Direction Y Reservoir_Bottom_Coordinate_in_Gravity_Direction 0.0 Spe_weight 10000 Water_level 20.0]
196- spdAux::SetValuesOnBaseNode $hydronode $props_hydro
181+ set hydrostatic_load " $damLoadConditions /condition\[ @n='HydroLinePressure2D'\] "
182+ set hydrostatic_load_node [customlib::AddConditionGroupOnXPath $hydrostatic_load Water]
183+ set props_hydrostatic_load [list Modify 0 Gravity_Direction Y Reservoir_Bottom_Coordinate_in_Gravity_Direction 0.0 Spe_weight 10000 Water_level 20.0]
184+ spdAux::SetValuesOnBaseNode $hydrostatic_load_node $props_hydrostatic_load
185+
186+ # Thermal Load Conditions
187+
188+ # Thermal Parameters Dam
189+ set damThermalLoadConditions [spdAux::getRoute " DamThermalLoads" ]
190+ set thermal_parameters " $damThermalLoadConditions /condition\[ @n='ThermalParameters2D'\] "
191+ set dam_thermal_node [customlib::AddConditionGroupOnXPath $thermal_parameters Dam]
192+ set props_dam_thermal [list ThermalDensity 2400 Conductivity 1.0 SpecificHeat 1000.0]
193+ spdAux::SetValuesOnBaseNode $dam_thermal_node $props_dam_thermal
194+
195+ # Thermal Parameters Ground
196+ set ground_thermal_node [customlib::AddConditionGroupOnXPath $thermal_parameters Ground]
197+ set props_ground_thermal [list ThermalDensity 3000 Conductivity 1.0 SpecificHeat 1000.0]
198+ spdAux::SetValuesOnBaseNode $ground_thermal_node $props_ground_thermal
199+
200+
201+ # Reference temperature
202+
203+ # Reference temperature Dam
204+ set dam_reference_temperature " $damThermalLoadConditions /condition\[ @n='NodalReferenceTemperature2D'\] "
205+ set dam_reference_temperature_node [customlib::AddConditionGroupOnXPath $dam_reference_temperature Dam]
206+ set props_dam_reference_temperature [list initial_value 7.5 ]
207+ spdAux::SetValuesOnBaseNode $dam_reference_temperature_node $props_dam_reference_temperature
208+
209+ # Reference temperature Ground
210+ set ground_reference_temperature " $damThermalLoadConditions /condition\[ @n='NodalReferenceTemperature2D'\] "
211+ set ground_reference_temperature_node [customlib::AddConditionGroupOnXPath $ground_reference_temperature Ground]
212+ set props_ground_reference_temperature [list initial_value 7.5 ]
213+ spdAux::SetValuesOnBaseNode $ground_reference_temperature_node $props_ground_reference_temperature
197214
198215
199216 # Solution
200217 spdAux::SetValueOnTreeItem v " Days" DamTimeScale
201218
202219 # Results
203- set results [list REACTION No TEMPERATURE Yes POSITIVE_FACE_PRESSURE Yes]]
220+ set results [list REACTION No TEMPERATURE Yes POSITIVE_FACE_PRESSURE Yes]
204221 set nodal_path [spdAux::getRoute " NodalResults" ]
205222 spdAux::SetValuesOnBasePath $nodal_path $results
206223
0 commit comments