|
| 1 | +namespace eval ::MPM::examples::CantileverBeam { |
| 2 | + namespace path ::MPM::examples |
| 3 | + Kratos::AddNamespace [namespace current] |
| 4 | + |
| 5 | +} |
| 6 | +proc ::MPM::examples::CantileverBeam::Init {args} { |
| 7 | + if {![Kratos::IsModelEmpty]} { |
| 8 | + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" |
| 9 | + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] |
| 10 | + if { $retval == "cancel" } { return } |
| 11 | + } |
| 12 | + DrawGeometry$::Model::SpatialDimension |
| 13 | + AssignGroups$::Model::SpatialDimension |
| 14 | + TreeAssignation$::Model::SpatialDimension |
| 15 | + |
| 16 | + GiD_Process 'Redraw |
| 17 | + GidUtils::UpdateWindow GROUPS |
| 18 | + GidUtils::UpdateWindow LAYER |
| 19 | + GiD_Process 'Zoom Frame |
| 20 | +} |
| 21 | + |
| 22 | + |
| 23 | +# Draw Geometry |
| 24 | +proc ::MPM::examples::CantileverBeam::DrawGeometry3D {args} { |
| 25 | + # DrawCantileverBeamGeometry2D |
| 26 | + # GiD_Process Mescape Utilities Copy Surfaces Duplicate DoExtrude Volumes MaintainLayers Translation FNoJoin 0.0,0.0,0.0 FNoJoin 0.0,0.0,1.0 1 escape escape escape |
| 27 | + # GiD_Layers edit opaque Fluid 0 |
| 28 | + |
| 29 | + # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate objaxes x -150 y -30 escape escape |
| 30 | +} |
| 31 | +proc ::MPM::examples::CantileverBeam::DrawGeometry2D {args} { |
| 32 | + Kratos::ResetModel |
| 33 | + GiD_Layers create HyperelasticBeam |
| 34 | + GiD_Layers edit to_use HyperelasticBeam |
| 35 | + GiD_Layers edit color HyperelasticBeam "#e1aa72" |
| 36 | + |
| 37 | + # HyperelasticBeam square |
| 38 | + ## Points ## |
| 39 | + set coordinates [list {0 0 0} {0 1 0} {10 1 0} {10 0 0}] |
| 40 | + set material_points [list ] |
| 41 | + foreach point $coordinates { |
| 42 | + lappend material_points [GiD_Geometry create point append HyperelasticBeam {*}$point] |
| 43 | + } |
| 44 | + |
| 45 | + ## Lines ## |
| 46 | + set material_lines [list ] |
| 47 | + set initial [lindex $material_points 0] |
| 48 | + foreach point [lrange $material_points 1 end] { |
| 49 | + lappend material_lines [GiD_Geometry create line append stline HyperelasticBeam $initial $point] |
| 50 | + set initial $point |
| 51 | + } |
| 52 | + lappend material_lines [GiD_Geometry create line append stline HyperelasticBeam $initial [lindex $material_points 0]] |
| 53 | + |
| 54 | + ## Surface ## |
| 55 | + GiD_Process Mescape Geometry Create NurbsSurface {*}$material_lines escape escape |
| 56 | + |
| 57 | + |
| 58 | + # Grid creation |
| 59 | + GiD_Layers create Grid |
| 60 | + GiD_Layers edit to_use Grid |
| 61 | + GiD_Layers edit color Grid "#fddda0" |
| 62 | + |
| 63 | + ## Points ## |
| 64 | + set coordinates [list {0 -4 0} {0 2 0} {12 2 0} {12 -4 0}] |
| 65 | + set grid_points [list ] |
| 66 | + foreach point $coordinates { |
| 67 | + lappend grid_points [GiD_Geometry create point append Grid {*}$point] |
| 68 | + } |
| 69 | + |
| 70 | + ## Lines ## |
| 71 | + set grid_lines [list ] |
| 72 | + set initial [lindex $grid_points 0] |
| 73 | + foreach point [lrange $grid_points 1 end] { |
| 74 | + lappend grid_lines [GiD_Geometry create line append stline Grid $initial $point] |
| 75 | + set initial $point |
| 76 | + } |
| 77 | + lappend grid_lines [GiD_Geometry create line append stline Grid $initial [lindex $grid_points 0]] |
| 78 | + |
| 79 | + ## Surface ## |
| 80 | + GiD_Process Mescape Geometry Create NurbsSurface {*}$grid_lines escape escape |
| 81 | +} |
| 82 | + |
| 83 | + |
| 84 | +# Group assign |
| 85 | +proc ::MPM::examples::CantileverBeam::AssignGroups2D {args} { |
| 86 | + # Create the groups |
| 87 | + GiD_Groups create HyperelasticBeam |
| 88 | + GiD_Groups edit color HyperelasticBeam "#26d1a8ff" |
| 89 | + GiD_EntitiesGroups assign HyperelasticBeam surfaces 1 |
| 90 | + |
| 91 | + GiD_Groups create Grid |
| 92 | + GiD_Groups edit color Grid "#e0210fff" |
| 93 | + GiD_EntitiesGroups assign Grid surfaces 2 |
| 94 | + |
| 95 | + GiD_Groups create FixedDisplacement |
| 96 | + GiD_Groups edit color FixedDisplacement "#3b3b3bff" |
| 97 | + GiD_EntitiesGroups assign FixedDisplacement lines 5 |
| 98 | +} |
| 99 | + |
| 100 | +proc ::MPM::examples::CantileverBeam::AssignGroups3D {args} { |
| 101 | + |
| 102 | +} |
| 103 | + |
| 104 | +# Tree assign |
| 105 | +proc ::MPM::examples::CantileverBeam::TreeAssignation3D {args} { |
| 106 | + TreeAssignation2D |
| 107 | +} |
| 108 | + |
| 109 | +proc ::MPM::examples::CantileverBeam::TreeAssignation2D {args} { |
| 110 | + set nd $::Model::SpatialDimension |
| 111 | + set root [customlib::GetBaseRoot] |
| 112 | + |
| 113 | + set condtype line |
| 114 | + if {$nd eq "3D"} { set condtype surface } |
| 115 | + |
| 116 | + # StageInfo |
| 117 | + spdAux::SetValueOnTreeItem v "Dynamic" MPMSoluType |
| 118 | + |
| 119 | + # Parts |
| 120 | + set mpm_parts_route [spdAux::getRoute "MPMParts"] |
| 121 | + |
| 122 | + # Erase Intervals |
| 123 | + ErasePreviousIntervals |
| 124 | + |
| 125 | + ## Hyperelastic beam |
| 126 | + set mpm_solid_parts_route "${mpm_parts_route}/condition\[@n='Parts_Material_domain'\]" |
| 127 | + set mpm_solid_part [customlib::AddConditionGroupOnXPath $mpm_solid_parts_route HyperelasticBeam] |
| 128 | + $mpm_solid_part setAttribute ov surface |
| 129 | + set constitutive_law_name "HyperElasticNeoHookeanPlaneStrain${nd}Law" |
| 130 | + set props [list Element UpdatedLagrangian$nd ConstitutiveLaw $constitutive_law_name Material HyperelasticBeam DENSITY 1000 YOUNG_MODULUS 90000000 POISSON_RATIO 0.49 THICKNESS 0.1 PARTICLES_PER_ELEMENT 6] |
| 131 | + spdAux::SetValuesOnBaseNode $mpm_solid_part $props |
| 132 | + |
| 133 | + ## Grid |
| 134 | + set mpm_grid_parts_route "${mpm_parts_route}/condition\[@n='Parts_Grid'\]" |
| 135 | + set mpm_grid_part [customlib::AddConditionGroupOnXPath $mpm_grid_parts_route Grid] |
| 136 | + $mpm_grid_part setAttribute ov surface |
| 137 | + set props [list Element GRID$nd ] |
| 138 | + spdAux::SetValuesOnBaseNode $mpm_grid_part $props |
| 139 | + |
| 140 | + # Fix Displacement |
| 141 | + ## Create interval subgroup |
| 142 | + GiD_Groups clone FixedDisplacement Total |
| 143 | + GiD_Groups edit parent Total FixedDisplacement |
| 144 | + spdAux::AddIntervalGroup FixedDisplacement "FixedDisplacement" |
| 145 | + GiD_Groups edit state "FixedDisplacement" hidden |
| 146 | + |
| 147 | + ## Assign boundary condition |
| 148 | + set mpm_bc_route [spdAux::getRoute "MPMNodalConditions"] |
| 149 | + set mpm_displacement_route "${mpm_bc_route}/condition\[@n='DISPLACEMENT'\]" |
| 150 | + set mpm_displacement [customlib::AddConditionGroupOnXPath $mpm_displacement_route "FixedDisplacement"] |
| 151 | + $mpm_displacement setAttribute ov $condtype |
| 152 | + set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0] |
| 153 | + spdAux::SetValuesOnBaseNode $mpm_displacement $props |
| 154 | + |
| 155 | + # Set gravity On |
| 156 | + spdAux::SetValueOnTreeItem v "On" ActivateGravity |
| 157 | + |
| 158 | + # Solution strategy parameters |
| 159 | + spdAux::SetValueOnTreeItem v "0.01" MPTimeParameters DeltaTime |
| 160 | + spdAux::SetValueOnTreeItem v "10" MPTimeParameters EndTime |
| 161 | + spdAux::SetValueOnTreeItem v "wtep" GiDOptions OutputControlType |
| 162 | + spdAux::SetValueOnTreeItem v "0.1" GiDOptions OutputDeltaTime |
| 163 | + spdAux::SetValueOnTreeItem v "time" VtkOptions OutputControlType |
| 164 | + spdAux::SetValueOnTreeItem v "0.1" VtkOptions OutputDeltaTime |
| 165 | +} |
0 commit comments