Skip to content

Commit

Permalink
[Dam/FreeSurf] Change in Dam joints and improvements in both apps exa…
Browse files Browse the repository at this point in the history
…mples (#947)

* Minor fix in 2D joints

* Add FreeSurface to Fluid Launcher

* Typo

* Use Poromechanics joints

* Remove density from joints

* Fix Dam examples

* Update Dam examples

* Add FreeSurface3D example and improve others

* Update new example image

* Add FreeSruface to fluid apps again

* Minor changes

* Minors

* Replace MINIMUM by INITIAL for joint width (Poro)
  • Loading branch information
joaquinirazabal authored Sep 21, 2023
1 parent b2d81d9 commit 7bd2e03
Show file tree
Hide file tree
Showing 12 changed files with 488 additions and 258 deletions.
201 changes: 109 additions & 92 deletions kratos.gid/apps/Dam/examples/ThermoMechaDam2D.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ proc ::Dam::examples::ThermoMechaDam2D::Init {args} {
set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
if { $retval == "cancel" } { return }
}

DrawGeometry
AssignGroups
AssignMeshSizes
Expand All @@ -24,15 +24,18 @@ proc ::Dam::examples::ThermoMechaDam2D::Init {args} {
proc ::Dam::examples::ThermoMechaDam2D::DrawGeometry {args} {

Kratos::ResetModel

# Dam #
GiD_Layers create Dam
GiD_Layers edit to_use Dam

# Geometry creation
## Points ##
set coordinates [list 0 0 0 10 0 0 3 30 0 0 30 0 ]
set dam_coordinates [list {0 0 0} {10 0 0} {3 30 0} {0 30 0} ]
set damPoints [list ]
foreach {x y z} $coordinates {
lappend damPoints [GiD_Geometry create point append Dam $x $y $z]
foreach point $dam_coordinates {
lassign $point x y z
lappend damPoints [GiD_Geometry create point append Dam $x $y $z]
}

## Lines ##
Expand All @@ -44,36 +47,44 @@ proc ::Dam::examples::ThermoMechaDam2D::DrawGeometry {args} {
}
lappend damLines [GiD_Geometry create line append stline Dam $initial [lindex $damPoints 0]]

## Surface ##
## Surface ##
GiD_Process Mescape Geometry Create NurbsSurface {*}$damLines escape escape

#~ # Soil #
GiD_Layers create Soil
GiD_Layers edit color Soil "#999900ff"
GiD_Layers edit to_use Soil

#~ # Geometry creation
#~ ## Points ##
set soil_coordinates [list -5 0 0 -5 -5 0 15 -5 0 15 0 0 ]
set soilPoints [list ]
foreach {x y z} $soil_coordinates {
lappend soilPoints [GiD_Geometry create point append Soil $x $y $z]

# Ground #
GiD_Layers create Ground
GiD_Layers edit color Ground "#999900ff"
GiD_Layers edit to_use Ground

# Geometry creation
## Points ##
set ground_coordinates [list {-5 0 0} {-5 -5 0} {15 -5 0} {15 0 0} ]
set groundPoints [list ]
foreach point $ground_coordinates {
lassign $point x y z
lappend groundPoints [GiD_Geometry create point append Ground $x $y $z]
}

## Lines ##
set soilLines [list ]
set groundLines [list ]
set initial [lindex $damPoints 0]
foreach point [lrange $soilPoints 0 end] {
lappend soilLines [GiD_Geometry create line append stline Soil $initial $point]
foreach point [lrange $groundPoints 0 end] {
lappend groundLines [GiD_Geometry create line append stline Ground $initial $point]
set initial $point
}
lappend soilLines [GiD_Geometry create line append stline Soil $initial [lindex $damPoints 1]]

lappend groundLines [GiD_Geometry create line append stline Ground $initial [lindex $damPoints 1]]

lappend soilLines 1
lappend groundLines 1

## Surface ##
GiD_Process Mescape Geometry Create NurbsSurface {*}$soilLines escape escape
GiD_Process Mescape Geometry Create NurbsSurface {*}$groundLines escape escape

# Swap normals of hydrostatic pressure and heat flux surfaces to point outside the volume
GiD_Process Mescape Utilities SwapNormals Lines Select 2 escape escape
GiD_Process Mescape Utilities SwapNormals Lines Select 3 escape escape
GiD_Process Mescape Utilities SwapNormals Lines Select 4 escape escape
GiD_Process Mescape Utilities SwapNormals Lines Select 5 escape escape
GiD_Process Mescape Utilities SwapNormals Lines Select 9 escape escape

GiD_Process 'Zoom Frame

Expand All @@ -86,52 +97,36 @@ proc ::Dam::examples::ThermoMechaDam2D::AssignGroups {args} {
GiD_Groups edit color Dam "#26d1a8ff"
GiD_EntitiesGroups assign Dam surfaces 1

GiD_Groups create Soil
GiD_Groups edit color Soil "#e0210fff"
GiD_EntitiesGroups assign Soil surfaces 2
GiD_Groups create Ground
GiD_Groups edit color Ground "#e0210fff"
GiD_EntitiesGroups assign Ground surfaces 2

GiD_Groups create Displacement
GiD_Groups edit color Displacement "#3b3b3bff"
GiD_EntitiesGroups assign Displacement lines 7

GiD_Groups create Initial
GiD_Groups edit color Initial "#26d1a8ff"
GiD_EntitiesGroups assign Initial surfaces {1 2}

GiD_Groups create Bofang
GiD_Groups edit color Bofang "#42eb71ff"
GiD_EntitiesGroups assign Bofang lines {4 5}

GiD_Groups create Uniform
GiD_Groups edit color Uniform "#3b3b3bff"
GiD_EntitiesGroups assign Uniform lines {3 2 9}
GiD_Groups create UniformTemperature
GiD_Groups edit color UniformTemperature "#3b3b3bff"
GiD_EntitiesGroups assign UniformTemperature lines {2 3 4 5 9}

GiD_Groups create Thermal_Parameters_1
GiD_Groups edit color Initial "#26d1a8ff"
GiD_EntitiesGroups assign Thermal_Parameters_1 surfaces 1

GiD_Groups create Thermal_Parameters_2
GiD_Groups edit color Initial "#26d1a8ff"
GiD_EntitiesGroups assign Thermal_Parameters_2 surfaces 2

GiD_Groups create Hydrostatic
GiD_Groups edit color Hydrostatic "#26d1a8fe"
GiD_EntitiesGroups assign Hydrostatic lines {4 5}
GiD_Groups create Water
GiD_Groups edit color Water "#26d1a8fe"
GiD_EntitiesGroups assign Water lines {4 5}

}

proc ::Dam::examples::ThermoMechaDam2D::AssignMeshSizes {args} {

set dam_mesh_size 0.25
GiD_Process Mescape Meshing AssignSizes Surfaces $dam_mesh_size [GiD_EntitiesGroups get Dam surfaces] escape escape
GiD_Process Mescape Meshing AssignSizes Surfaces $dam_mesh_size [GiD_EntitiesGroups get Soil surfaces] escape escape
GiD_Process Mescape Meshing AssignSizes Surfaces $dam_mesh_size 1:end escape escape
GiD_Process Mescape Meshing AssignSizes Lines $dam_mesh_size 1:end escape escape
##Kratos::BeforeMeshGeneration $dam_mesh_size
}

# Tree assign
proc ::Dam::examples::ThermoMechaDam2D::TreeAssignation {args} {

set nd $::Model::SpatialDimension
set nd $::Model::SpatialDimension
set root [customlib::GetBaseRoot]

# Set Type of problem strategy set
Expand All @@ -143,64 +138,86 @@ proc ::Dam::examples::ThermoMechaDam2D::TreeAssignation {args} {
set props [list Element SmallDisplacementElement2D ConstitutiveLaw ThermalLinearElastic2DPlaneStrain Material "Concrete-Dam" DENSITY 2400 YOUNG_MODULUS 1.962e10 POISSON_RATIO 0.20 THERMAL_EXPANSION 1e-05]
spdAux::SetValuesOnBaseNode $damNode $props

#Soil Part
set soilNode [customlib::AddConditionGroupOnXPath $damParts Soil]
set props_soil [list Element SmallDisplacementElement2D ConstitutiveLaw ThermalLinearElastic2DPlaneStrain Material Soil DENSITY 3000 YOUNG_MODULUS 4.9e10 POISSON_RATIO 0.25 THERMAL_EXPANSION 1e-05]
spdAux::SetValuesOnBaseNode $soilNode $props_soil

# Dirichlet Conditions
# Ground Part
set groundNode [customlib::AddConditionGroupOnXPath $damParts Ground]
set props_ground [list Element SmallDisplacementElement2D ConstitutiveLaw ThermalLinearElastic2DPlaneStrain Material Ground DENSITY 3000 YOUNG_MODULUS 4.9e10 POISSON_RATIO 0.25 THERMAL_EXPANSION 1e-05]
spdAux::SetValuesOnBaseNode $groundNode $props_ground

# Displacements
set damDirichletConditions [spdAux::getRoute "DamNodalConditions"]
set displacement "$damDirichletConditions/condition\[@n='DISPLACEMENT'\]"
set displacemnetnode [customlib::AddConditionGroupOnXPath $displacement Displacement]

# Surface Temperature
set initial "$damDirichletConditions/condition\[@n='INITIALTEMPERATURE'\]"
set initialnode [customlib::AddConditionGroupOnXPath $initial Initial]
set props_initial [list is_fixed 0 value 7.5 ]
spdAux::SetValuesOnBaseNode $initialnode $props_initial
# Dirichlet Conditions
set damDirichletConditions [spdAux::getRoute "DamNodalConditions"]

# Bofang Temperature
set bofang "$damDirichletConditions/condition\[@n='BOFANGTEMPERATURE'\]"
set bofangnode [customlib::AddConditionGroupOnXPath $bofang Bofang]
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 ]
spdAux::SetValuesOnBaseNode $bofangnode $props_bofang
# Displacements
set displacement "$damDirichletConditions/condition\[@n='DISPLACEMENT'\]"
set displacemnetnode [customlib::AddConditionGroupOnXPath $displacement Displacement]

# Uniform Temperature
set uniform "$damDirichletConditions/condition\[@n='INITIALTEMPERATURE'\]"
set uniformnode [customlib::AddConditionGroupOnXPath $uniform Uniform]
set props_uniform [list is_fixed 1 value 10.0 ]
spdAux::SetValuesOnBaseNode $uniformnode $props_uniform
# Surface Temperature
set temperature_base "$damDirichletConditions/condition\[@n='INITIALTEMPERATURE'\]"
set dam_temperature [customlib::AddConditionGroupOnXPath $temperature_base Dam]
set props_dam_temperature [list is_fixed false value 7.5 ]
spdAux::SetValuesOnBaseNode $dam_temperature $props_dam_temperature

set ground_temperature [customlib::AddConditionGroupOnXPath $temperature_base Ground]
set props_ground_temperature [list is_fixed false value 7.5 ]
spdAux::SetValuesOnBaseNode $ground_temperature $props_ground_temperature

# Thermal Load Conditions
# Bofang Temperature
set bofang_temperature "$damDirichletConditions/condition\[@n='BOFANGTEMPERATURE'\]"
set bofang_temperature_node [customlib::AddConditionGroupOnXPath $bofang_temperature Water]
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 ]
spdAux::SetValuesOnBaseNode $bofang_temperature_node $props_bofang_temperature

# Thermal Parameters 1
set damThermalLoadConditions [spdAux::getRoute "DamThermalLoads"]
set thermalparameter "$damThermalLoadConditions/condition\[@n='ThermalParameters2D'\]"
set thermalparameternode1 [customlib::AddConditionGroupOnXPath $thermalparameter Thermal_Parameters_1]
# Uniform Temperature
set uniform_temperature "$damDirichletConditions/condition\[@n='INITIALTEMPERATURE'\]"
set uniform_temperature_node [customlib::AddConditionGroupOnXPath $uniform_temperature UniformTemperature]
set props_uniform_temperature [list is_fixed true value 10.0 ]
spdAux::SetValuesOnBaseNode $uniform_temperature_node $props_uniform_temperature

# Thermal Parameters 2
set thermalparameternode2 [customlib::AddConditionGroupOnXPath $thermalparameter Thermal_Parameters_2]
set props_thermal_2 [list ThermalDensity 3000 ]
spdAux::SetValuesOnBaseNode $thermalparameternode2 $props_thermal_2

# Load Conditions
# Load Conditions

# Hydrostatic Load
# Hydrostatic Load
set damLoadConditions [spdAux::getRoute "DamLoads"]
set hydro "$damLoadConditions/condition\[@n='HydroLinePressure2D'\]"
set hydronode [customlib::AddConditionGroupOnXPath $hydro Hydrostatic]
set props_hydro [list Modify 0 Gravity_Direction Y Reservoir_Bottom_Coordinate_in_Gravity_Direction 0.0 Spe_weight 10000 Water_level 20.0]
spdAux::SetValuesOnBaseNode $hydronode $props_hydro
set hydrostatic_load "$damLoadConditions/condition\[@n='HydroLinePressure2D'\]"
set hydrostatic_load_node [customlib::AddConditionGroupOnXPath $hydrostatic_load Water]
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]
spdAux::SetValuesOnBaseNode $hydrostatic_load_node $props_hydrostatic_load

# Thermal Load Conditions

# Thermal Parameters Dam
set damThermalLoadConditions [spdAux::getRoute "DamThermalLoads"]
set thermal_parameters "$damThermalLoadConditions/condition\[@n='ThermalParameters2D'\]"
set dam_thermal_node [customlib::AddConditionGroupOnXPath $thermal_parameters Dam]
set props_dam_thermal [list ThermalDensity 2400 Conductivity 1.0 SpecificHeat 1000.0]
spdAux::SetValuesOnBaseNode $dam_thermal_node $props_dam_thermal

# Thermal Parameters Ground
set ground_thermal_node [customlib::AddConditionGroupOnXPath $thermal_parameters Ground]
set props_ground_thermal [list ThermalDensity 3000 Conductivity 1.0 SpecificHeat 1000.0]
spdAux::SetValuesOnBaseNode $ground_thermal_node $props_ground_thermal


# Reference temperature

# Reference temperature Dam
set dam_reference_temperature "$damThermalLoadConditions/condition\[@n='NodalReferenceTemperature2D'\]"
set dam_reference_temperature_node [customlib::AddConditionGroupOnXPath $dam_reference_temperature Dam]
set props_dam_reference_temperature [list initial_value 7.5 ]
spdAux::SetValuesOnBaseNode $dam_reference_temperature_node $props_dam_reference_temperature

# Reference temperature Ground
set ground_reference_temperature "$damThermalLoadConditions/condition\[@n='NodalReferenceTemperature2D'\]"
set ground_reference_temperature_node [customlib::AddConditionGroupOnXPath $ground_reference_temperature Ground]
set props_ground_reference_temperature [list initial_value 7.5 ]
spdAux::SetValuesOnBaseNode $ground_reference_temperature_node $props_ground_reference_temperature


# Solution
spdAux::SetValueOnTreeItem v "Days" DamTimeScale

# Results
set results [list REACTION No TEMPERATURE Yes POSITIVE_FACE_PRESSURE Yes]]
set results [list REACTION No TEMPERATURE Yes POSITIVE_FACE_PRESSURE Yes]
set nodal_path [spdAux::getRoute "NodalResults"]
spdAux::SetValuesOnBasePath $nodal_path $results

Expand Down
Loading

0 comments on commit 7bd2e03

Please sign in to comment.