diff --git a/.gitignore b/.gitignore index cd4439db9..3b81eceae 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,11 @@ *.lnk # Kratos execution folder -kratos.gid/exec/* -!kratos.gid/exec/README.md +kratos.gid/exec/Kratos* +# !kratos.gid/exec/README.md +!kratos.gid/exec/MainKratos.py *.orig .vscode/ custom_tools/* +.DS_Store diff --git a/README.md b/README.md index 9fe9c0b62..74c0c66b3 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,39 @@ -# GiDInterface +# KratosMultiphysics <-> GiD Interface -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/07a116949d2a437eb99b1423a18ecdb6)](https://app.codacy.com/app/jginternational/GiDInterface?utm_source=github.com&utm_medium=referral&utm_content=KratosMultiphysics/GiDInterface&utm_campaign=badger) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/36d3d305c87e4bb398bc87ea2e3b890e)](https://www.codacy.com/gh/KratosMultiphysics/GiDInterface/dashboard?utm_source=github.com&utm_medium=referral&utm_content=KratosMultiphysics/GiDInterface&utm_campaign=Badge_Grade) -The interface of Kratos with [GiD](http://www.gidhome.com). +The user interface of Kratos with [GiD](http://www.gidhome.com). -If you need the latest release, launch your GiD, navigate to Data > Problemtype > Internet retrieve and download Kratos there. If you need the developer version, you are on the right place +If you need the latest stable release, launch your GiD, navigate to Data > Problemtype > Internet retrieve and download Kratos there. +Available for Linux. Windows, and macOS. + +If you need the developer version, you are on the right place. ## First steps -* Install the latest GiD developer version -> [Developer version](http://www.gidhome.com/download/developer-versions) -* Navigate to GiD's problemtype folder and delete kratos.gid -* Create there a link to our [kratos.gid](./kratos.gid/) -* Navigate to kratos.gid/exec/ -* Create there a symbolic link to the kratos installation folder (where runkratos is located) - * Unix : `ln -s ~/Kratos Kratos` or maybe `ln -s ~/Kratos/bin/Release Kratos` if that's the destination folder - * Windows : `mklink /J Kratos C:\kratos` or maybe `mklink /J Kratos C:\kratos\bin\Release` (choose actual Kratos installation folder) +* 1- Clone this repository, or install a stable [release](https://github.com/KratosMultiphysics/GiDInterface/releases) +* 2- Install the latest GiD developer version -> [Developer version](http://www.gidhome.com/download/developer-versions) +* 3- Navigate to GiD's problemtype folder and delete any previous kratos.gid + * Create there a link to our [kratos.gid](./kratos.gid/) downloaded in step 1 + * Windows: Simple shortcut to kratos.gid folder +* 4- Navigate to kratos.gid/exec/ + * Create there a symbolic link to the kratos installation folder (where runkratos is located) + * Unix : `ln -s ~/Kratos Kratos` or maybe `ln -s ~/Kratos/bin/Release Kratos` if that's the destination folder + * Windows : `mklink /J Kratos C:\kratos\bin\Release` (choose actual Kratos installation folder) + +### Step by step video +https://www.youtube.com/watch?v=zZq7ypDdudo + +## Launch modea +In Kratos preferences, select the execution mode: +* Pip packages: Kratos will be installed via `pip install` +* local compiled: If you are a developer and build your applications, use this one ## Usage * Run GiD * Go to: Data / Problem type / kratos * kratos top menu / Developer mode (recommended) + +### Examples * [Fluid dynamics example](https://github.com/KratosMultiphysics/Kratos/wiki/Running-an-example-from-GiD#3-set-a-fluid-dynamics-problem) * [Structural mechanics example](https://github.com/KratosMultiphysics/Kratos/wiki/Running-an-example-from-GiD#4-set-a-structural-mechanics-problem) * [Fluid-Structure interaction example](https://github.com/KratosMultiphysics/Kratos/wiki/Running-an-example-from-GiD#5-set-a-fluid-structure-interaction-problem) diff --git a/kratos.gid/apps/Buoyancy/app.json b/kratos.gid/apps/Buoyancy/app.json new file mode 100644 index 000000000..4919dff10 --- /dev/null +++ b/kratos.gid/apps/Buoyancy/app.json @@ -0,0 +1,44 @@ +{ + "id": "Buoyancy", + "name": "Buoyancy", + "prefix": "Buoyancy_", + "themed": false, + "kratos_name": "Buoyancyapplication", + "python_packages": [ + "KratosFluidDynamicsApplication", + "KratosConvectionDiffusionApplication" + ], + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/HeatedSquare.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script": "::Buoyancy::Init", + "requeriments": { + "apps": [ + "Fluid", + "ConvectionDiffusion" + ], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "write": { + "coordinates": "all", + "properties_location": "json", + "model_part_name": "ThermalModelPart" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} \ No newline at end of file diff --git a/kratos.gid/apps/Buoyancy/examples/HeatedSquare.tcl b/kratos.gid/apps/Buoyancy/examples/HeatedSquare.tcl index 05222050b..df1393d01 100644 --- a/kratos.gid/apps/Buoyancy/examples/HeatedSquare.tcl +++ b/kratos.gid/apps/Buoyancy/examples/HeatedSquare.tcl @@ -1,12 +1,16 @@ +namespace eval ::Buoyancy::examples::HeatedSquare { + namespace path ::Buoyancy::examples + Kratos::AddNamespace [namespace current] +} -proc ::Buoyancy::examples::HeatedSquare {args} { +proc ::Buoyancy::examples::HeatedSquare::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawSquareGeometry$::Model::SpatialDimension - AssignSquareGeometryMeshSizes$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignMeshSizes$::Model::SpatialDimension AssignGroups$::Model::SpatialDimension TreeAssignation$::Model::SpatialDimension @@ -18,14 +22,14 @@ proc ::Buoyancy::examples::HeatedSquare {args} { # Draw Geometry -proc Buoyancy::examples::DrawSquareGeometry3D {args} { +proc ::Buoyancy::examples::HeatedSquare::DrawGeometry3D {args} { # DrawSquareGeometry2D # 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 # GiD_Layers edit opaque Fluid 0 - # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate obj x -150 y -30 escape escape + # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate objaxes x -150 y -30 escape escape } -proc Buoyancy::examples::DrawSquareGeometry2D {args} { +proc ::Buoyancy::examples::HeatedSquare::DrawGeometry2D {args} { Kratos::ResetModel GiD_Layers create Fluid GiD_Layers edit to_use Fluid @@ -53,18 +57,18 @@ proc Buoyancy::examples::DrawSquareGeometry2D {args} { } # Mesh sizes assign -proc Buoyancy::examples::AssignSquareGeometryMeshSizes2D {args} { +proc ::Buoyancy::examples::HeatedSquare::AssignMeshSizes2D {args} { set default_mesh_size 0.0125 GiD_Process Mescape Meshing AssignSizes Surfaces $default_mesh_size 1 escape escape GiD_Process Mescape Meshing AssignSizes Lines $default_mesh_size 1 2 3 4 escape escape } -proc Buoyancy::examples::AssignSquareGeometryMeshSizes3D {args} { +proc ::Buoyancy::examples::HeatedSquare::AssignMeshSizes3D {args} { # To be implemented } # Group assign -proc Buoyancy::examples::AssignGroups2D {args} { +proc ::Buoyancy::examples::HeatedSquare::AssignGroups2D {args} { # Create the groups GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -91,7 +95,7 @@ proc Buoyancy::examples::AssignGroups2D {args} { GiD_EntitiesGroups assign Pressure point 1 } -proc Buoyancy::examples::AssignGroups3D {args} { +proc ::Buoyancy::examples::HeatedSquare::AssignGroups3D {args} { # Create the groups # GiD_Groups create Fluid # GiD_Groups edit color Fluid "#26d1a8ff" @@ -115,11 +119,11 @@ proc Buoyancy::examples::AssignGroups3D {args} { } # Tree assign -proc Buoyancy::examples::TreeAssignation3D {args} { +proc ::Buoyancy::examples::HeatedSquare::TreeAssignation3D {args} { # TreeAssignationCylinderInFlow2D # AddCuts } -proc Buoyancy::examples::TreeAssignation2D {args} { +proc ::Buoyancy::examples::HeatedSquare::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -133,7 +137,7 @@ proc Buoyancy::examples::TreeAssignation2D {args} { # Fluid Parts set fluidParts [spdAux::getRoute "FLParts"] set fluidNode [customlib::AddConditionGroupOnXPath $fluidParts Fluid] - set props [list Element Monolithic$nd ConstitutiveLaw Newtonian DENSITY 1.2039 DYNAMIC_VISCOSITY 0.000587 CONDUCTIVITY 0.83052 SPECIFIC_HEAT 1004.84] + set props [list Element QSVMS$nd ConstitutiveLaw Newtonian2DLaw DENSITY 1.2039 DYNAMIC_VISCOSITY 0.000587 CONDUCTIVITY 0.83052 SPECIFIC_HEAT 1004.84] spdAux::SetValuesOnBaseNode $fluidNode $props set fluidConditions [spdAux::getRoute "FLBC"] @@ -189,18 +193,3 @@ proc Buoyancy::examples::TreeAssignation2D {args} { spdAux::RequestRefresh } - -proc Buoyancy::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} - -proc Buoyancy::examples::AddCuts { } { - # Cuts - set results "[spdAux::getRoute Results]/container\[@n='GiDOutput'\]" - set cp [[customlib::GetBaseRoot] selectNodes "$results/container\[@n = 'CutPlanes'\]/blockdata\[@name = 'CutPlane'\]"] - [$cp selectNodes "./value\[@n = 'point'\]"] setAttribute v "0.0,0.5,0.0" -} \ No newline at end of file diff --git a/kratos.gid/apps/Buoyancy/examples/examples.tcl b/kratos.gid/apps/Buoyancy/examples/examples.tcl index ef9796d92..23dd2d340 100644 --- a/kratos.gid/apps/Buoyancy/examples/examples.tcl +++ b/kratos.gid/apps/Buoyancy/examples/examples.tcl @@ -1,15 +1,19 @@ -namespace eval Buoyancy::examples { - -} - -proc Buoyancy::examples::Init { } { - uplevel #0 [list source [file join $::Buoyancy::dir examples HeatedSquare.tcl]] +namespace eval ::Buoyancy::examples { + namespace path ::Buoyancy + Kratos::AddNamespace [namespace current] } -proc Buoyancy::examples::UpdateMenus { } { - GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Heated square" ] 8 PRE [list ::Buoyancy::examples::HeatedSquare] "" "" insertafter = - GiDMenu::UpdateMenus +proc ::Buoyancy::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} + } } -Buoyancy::examples::Init \ No newline at end of file +proc ::Buoyancy::examples::AddCuts { } { + # Cuts + set results "[spdAux::getRoute Results]/container\[@n='GiDOutput'\]" + set cp [[customlib::GetBaseRoot] selectNodes "$results/container\[@n = 'CutPlanes'\]/blockdata\[@name = 'CutPlane'\]"] + [$cp selectNodes "./value\[@n = 'point'\]"] setAttribute v "0.0,0.5,0.0" +} \ No newline at end of file diff --git a/kratos.gid/apps/Buoyancy/examples/examples.xml b/kratos.gid/apps/Buoyancy/examples/examples.xml new file mode 100644 index 000000000..8d8fa9641 --- /dev/null +++ b/kratos.gid/apps/Buoyancy/examples/examples.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/Buoyancy/images/HeatedSquare2D.png b/kratos.gid/apps/Buoyancy/images/HeatedSquare2D.png new file mode 100644 index 000000000..e7a5736a4 Binary files /dev/null and b/kratos.gid/apps/Buoyancy/images/HeatedSquare2D.png differ diff --git a/kratos.gid/apps/Buoyancy/python/KratosFluid.py b/kratos.gid/apps/Buoyancy/python/KratosFluid.py deleted file mode 100644 index 422e49f08..000000000 --- a/kratos.gid/apps/Buoyancy/python/KratosFluid.py +++ /dev/null @@ -1,32 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -from KratosMultiphysics.FluidDynamicsApplication.fluid_dynamics_analysis import FluidDynamicsAnalysis - -import sys -import time - -class FluidDynamicsAnalysisWithFlush(FluidDynamicsAnalysis): - - def __init__(self,model,project_parameters,flush_frequency=10.0): - super(FluidDynamicsAnalysisWithFlush,self).__init__(model,project_parameters) - self.flush_frequency = flush_frequency - self.last_flush = time.time() - - def FinalizeSolutionStep(self): - super(FluidDynamicsAnalysisWithFlush,self).FinalizeSolutionStep() - - if self.parallel_type == "OpenMP": - now = time.time() - if now - self.last_flush > self.flush_frequency: - sys.stdout.flush() - self.last_flush = now - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = FluidDynamicsAnalysisWithFlush(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/Buoyancy/python/MainKratos.py b/kratos.gid/apps/Buoyancy/python/MainKratos.py deleted file mode 100644 index 83f349e7c..000000000 --- a/kratos.gid/apps/Buoyancy/python/MainKratos.py +++ /dev/null @@ -1,34 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -import KratosMultiphysics.FluidDynamicsApplication -from KratosMultiphysics.ConvectionDiffusionApplication.convection_diffusion_analysis import ConvectionDiffusionAnalysis - -import sys -import time - -class ConvectionDiffusionAnalysisWithFlush(ConvectionDiffusionAnalysis): - - def __init__(self,model,project_parameters,flush_frequency=10.0): - super(ConvectionDiffusionAnalysisWithFlush,self).__init__(model,project_parameters) - - self.flush_frequency = flush_frequency - self.last_flush = time.time() - - def FinalizeSolutionStep(self): - super(ConvectionDiffusionAnalysisWithFlush,self).FinalizeSolutionStep() - - if self.parallel_type == "OpenMP": - now = time.time() - if now - self.last_flush > self.flush_frequency: - sys.stdout.flush() - self.last_flush = now - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = ConvectionDiffusionAnalysisWithFlush(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/Buoyancy/start.tcl b/kratos.gid/apps/Buoyancy/start.tcl index 8daea4f34..81d2a1183 100644 --- a/kratos.gid/apps/Buoyancy/start.tcl +++ b/kratos.gid/apps/Buoyancy/start.tcl @@ -1,64 +1,24 @@ namespace eval ::Buoyancy { # Variable declaration - variable id variable dir - variable prefix - variable attributes - variable kratos_name + variable _app + Kratos::AddNamespace [namespace current] + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::Buoyancy::Init { } { +proc ::Buoyancy::Init { app } { # Variable initialization - variable id variable dir - variable prefix - variable kratos_name - variable attributes - - set id "Buoyancy" - - set kratos_name Buoyancyapplication + variable _app #W "Sourced FSI" set dir [apps::getMyDir "Buoyancy"] - set prefix Buoyancy_ - - apps::LoadAppById "Fluid" - apps::LoadAppById "ConvectionDiffusion" + set _app $app - # Intervals - dict set attributes UseIntervals 1 - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 + ::Buoyancy::xml::Init + ::Buoyancy::write::Init - set ::Model::ValidSpatialDimensions [list 2D 3D] - LoadMyFiles - #::spdAux::CreateDimensionWindow } - -proc ::Buoyancy::LoadMyFiles { } { - variable id - variable dir - - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - if {[apps::getActiveAppId] eq $id} { - uplevel #0 [list source [file join $dir examples examples.tcl]] - } -} - -proc ::Buoyancy::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value -} - -proc ::Buoyancy::CustomToolbarItems { } { - variable dir - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Buoyancy::examples::HeatedSquare] [= "Example\nBuoyancy driven cavity flow (Ra = 1e6 - Pr = 0.71)"] -} - -::Buoyancy::Init diff --git a/kratos.gid/apps/Buoyancy/write/write.tcl b/kratos.gid/apps/Buoyancy/write/write.tcl index 852392158..39b6d9bed 100644 --- a/kratos.gid/apps/Buoyancy/write/write.tcl +++ b/kratos.gid/apps/Buoyancy/write/write.tcl @@ -1,20 +1,26 @@ -namespace eval Buoyancy::write { +namespace eval ::Buoyancy::write { + namespace path ::Buoyancy::write + Kratos::AddNamespace [namespace current] + variable writeAttributes } -proc Buoyancy::write::Init { } { - Fluid::write::Init - Fluid::write::SetAttribute thermal_bc_un "CNVDFFBC" +proc ::Buoyancy::write::Init { } { + # Start Fluid write variables + # Add thermal unique names to Fluid write variables + Fluid::write::SetAttribute thermal_bc_un [ConvectionDiffusion::write::GetAttribute conditions_un] Fluid::write::SetAttribute thermal_initial_cnd_un [ConvectionDiffusion::write::GetAttribute nodal_conditions_un] } # Events -proc Buoyancy::write::writeModelPartEvent { } { +proc ::Buoyancy::write::writeModelPartEvent { } { # Validation set err [Validate] if {$err ne ""} {error $err} + # Start Fluid write variables Fluid::write::Init + # Start Fluid write conditions map from scratch Fluid::write::InitConditionsMap # Init data @@ -25,7 +31,7 @@ proc Buoyancy::write::writeModelPartEvent { } { Fluid::write::writeProperties # Nodal coordinates (1: Print only Fluid nodes | 0: the whole mesh ) - if {[Fluid::write::GetAttribute writeCoordinatesByGroups]} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} + if {[Fluid::write::GetAttribute writeCoordinatesByGroups] ne "all"} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} # Element connectivities (Groups on FLParts) write::writeElementConnectivities @@ -44,29 +50,31 @@ proc Buoyancy::write::writeModelPartEvent { } { # Custom SubmodelParts #write::writeBasicSubmodelParts [Fluid::write::getLastConditionId] } -proc Buoyancy::write::writeCustomFilesEvent { } { - # Materials - Buoyancy::write::WriteMaterialsFile False - # Main python script - set orig_name "MainKratos.py" - write::CopyFileIntoModel [file join "python" $orig_name ] +proc ::Buoyancy::write::writeCustomFilesEvent { } { + # Materials + Buoyancy::write::WriteMaterialsFile True + write::SetConfigurationAttribute main_launch_file [ConvectionDiffusion::write::GetAttribute main_launch_file] } -proc Buoyancy::write::Validate {} { +proc ::Buoyancy::write::Validate {} { set err "" - return $err } -proc Buoyancy::write::WriteMaterialsFile {{write_const_law True} {include_modelpart_name True} } { +proc ::Buoyancy::write::WriteMaterialsFile {{write_const_law True} {include_modelpart_name True} } { + # Note: This will generate 2 quasi identical files for materials. The difference is the model_part_name + + # Write fluid material file Fluid::write::WriteMaterialsFile $write_const_law $include_modelpart_name + + # Write Buoyancy materials file set model_part_name "" if {[write::isBooleanTrue $include_modelpart_name]} {set model_part_name [GetModelPartName]} write::writePropertiesJsonFile [GetAttribute parts_un] "BuoyancyMaterials.json" $write_const_law $model_part_name } -proc Buoyancy::write::writeSubModelParts { } { +proc ::Buoyancy::write::writeSubModelParts { } { set BCUN [GetAttribute thermal_bc_un] set root [customlib::GetBaseRoot] @@ -86,7 +94,7 @@ proc Buoyancy::write::writeSubModelParts { } { } } -proc Buoyancy::write::writeBoussinesqSubModelPart { } { +proc ::Buoyancy::write::writeBoussinesqSubModelPart { } { set groupid "_Boussinesq_hidden_" GiD_Groups create $groupid GiD_EntitiesGroups assign $groupid nodes [GiD_Mesh list node] @@ -94,25 +102,23 @@ proc Buoyancy::write::writeBoussinesqSubModelPart { } { GiD_Groups delete $groupid } -proc Buoyancy::write::GetModelPartName { } { - return ThermalModelPart +proc ::Buoyancy::write::GetModelPartName { } { + return [Fluid::GetWriteProperty model_part_name] } -proc Buoyancy::write::GetAttribute {att} { +proc ::Buoyancy::write::GetAttribute {att} { return [Fluid::write::GetAttribute $att] } -proc Buoyancy::write::GetAttributes {} { +proc ::Buoyancy::write::GetAttributes {} { return [Fluid::write::GetAttributes] } -proc Buoyancy::write::AddAttributes {configuration} { +proc ::Buoyancy::write::AddAttributes {configuration} { variable writeAttributes set writeAttributes [dict merge $writeAttributes $configuration] } -proc Buoyancy::write::AddValidApps {appid} { +proc ::Buoyancy::write::AddValidApps {appid} { AddAttribute validApps $appid } - -Buoyancy::write::Init \ No newline at end of file diff --git a/kratos.gid/apps/Buoyancy/write/writeProjectParameters.tcl b/kratos.gid/apps/Buoyancy/write/writeProjectParameters.tcl index d19840b77..daaef610a 100644 --- a/kratos.gid/apps/Buoyancy/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/Buoyancy/write/writeProjectParameters.tcl @@ -2,6 +2,9 @@ proc ::Buoyancy::write::getParametersDict { } { set projectParametersDict [dict create] + # Analysis stage field + dict set projectParametersDict analysis_stage "KratosMultiphysics.ConvectionDiffusionApplication.convection_diffusion_analysis" + # problem data dict set projectParametersDict problem_data [::Buoyancy::write::GetProblemData_Dict] @@ -20,13 +23,13 @@ proc ::Buoyancy::write::getParametersDict { } { return $projectParametersDict } -proc Buoyancy::write::writeParametersEvent { } { +proc ::Buoyancy::write::writeParametersEvent { } { set projectParametersDict [getParametersDict] write::SetParallelismConfiguration write::WriteJSON $projectParametersDict } -proc Buoyancy::write::GetProblemData_Dict { } { +proc ::Buoyancy::write::GetProblemData_Dict { } { set problemDataDict [dict create ] # problem name @@ -52,7 +55,7 @@ proc Buoyancy::write::GetProblemData_Dict { } { # dict set problemDataDict model_part_name "ThermalModelPart" } -proc Buoyancy::write::GetRestart_Dict { } { +proc ::Buoyancy::write::GetRestart_Dict { } { set restartDict [dict create] dict set restartDict SaveRestart False @@ -61,7 +64,7 @@ proc Buoyancy::write::GetRestart_Dict { } { dict set restartDict Restart_Step 0 } -proc Buoyancy::write::GetSolverSettings_Dict { } { +proc ::Buoyancy::write::GetSolverSettings_Dict { } { set settings [dict create] dict set settings solver_type "ThermallyCoupled" @@ -93,7 +96,7 @@ proc Buoyancy::write::GetSolverSettings_Dict { } { return $settings } -proc Buoyancy::write::GetProcesses_Dict { } { +proc ::Buoyancy::write::GetProcesses_Dict { } { set constraints_process_list [list ] write::SetConfigurationAttributes [Fluid::write::GetAttributes] lappend constraints_process_list {*}[write::getConditionsParametersDict [Fluid::write::GetAttribute conditions_un] ] @@ -105,7 +108,7 @@ proc Buoyancy::write::GetProcesses_Dict { } { return [dict create "constraints_process_list" $constraints_process_list] } -proc Buoyancy::write::GetBoussinesqProcess { } { +proc ::Buoyancy::write::GetBoussinesqProcess { } { set process [dict create] dict set process python_module apply_boussinesq_force_process dict set process kratos_module KratosMultiphysics.FluidDynamicsApplication diff --git a/kratos.gid/apps/Buoyancy/xml/ConstitutiveLaws.xml b/kratos.gid/apps/Buoyancy/xml/ConstitutiveLaws.xml index c5f0136fb..0e5f5dec1 100644 --- a/kratos.gid/apps/Buoyancy/xml/ConstitutiveLaws.xml +++ b/kratos.gid/apps/Buoyancy/xml/ConstitutiveLaws.xml @@ -1,7 +1,7 @@ - - + + @@ -11,4 +11,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/Buoyancy/xml/Main.spd b/kratos.gid/apps/Buoyancy/xml/Main.spd index f6c9f74d3..e65c726bf 100644 --- a/kratos.gid/apps/Buoyancy/xml/Main.spd +++ b/kratos.gid/apps/Buoyancy/xml/Main.spd @@ -4,7 +4,7 @@ - + @@ -13,7 +13,7 @@ - + diff --git a/kratos.gid/apps/Buoyancy/xml/Materials.xml b/kratos.gid/apps/Buoyancy/xml/Materials.xml index a53ca0264..8bc7d5c8d 100644 --- a/kratos.gid/apps/Buoyancy/xml/Materials.xml +++ b/kratos.gid/apps/Buoyancy/xml/Materials.xml @@ -3,17 +3,19 @@ - + + - + + diff --git a/kratos.gid/apps/Buoyancy/xml/Parts.spd b/kratos.gid/apps/Buoyancy/xml/Parts.spd deleted file mode 100644 index 869f991de..000000000 --- a/kratos.gid/apps/Buoyancy/xml/Parts.spd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/kratos.gid/apps/Buoyancy/xml/Procs.spd b/kratos.gid/apps/Buoyancy/xml/Procs.spd index e8a6eb6d3..7c699398c 100644 --- a/kratos.gid/apps/Buoyancy/xml/Procs.spd +++ b/kratos.gid/apps/Buoyancy/xml/Procs.spd @@ -142,4 +142,9 @@ } ]]> + + + \ No newline at end of file diff --git a/kratos.gid/apps/Buoyancy/xml/XmlController.tcl b/kratos.gid/apps/Buoyancy/xml/XmlController.tcl index d2f41667b..35fa45d52 100644 --- a/kratos.gid/apps/Buoyancy/xml/XmlController.tcl +++ b/kratos.gid/apps/Buoyancy/xml/XmlController.tcl @@ -1,12 +1,14 @@ -namespace eval Buoyancy::xml { +namespace eval ::Buoyancy::xml { + namespace path ::Buoyancy + Kratos::AddNamespace [namespace current] # Namespace variables declaration variable dir } -proc Buoyancy::xml::Init { } { +proc ::Buoyancy::xml::Init { } { # Namespace variables initialization variable dir - Model::InitVariables dir $Buoyancy::dir + Model::InitVariables dir $::Buoyancy::dir Model::ForgetSolutionStrategy stationary @@ -16,6 +18,7 @@ proc Buoyancy::xml::Init { } { Model::ForgetMaterials Model::getMaterials Materials.xml + Model::ForgetSolvers Model::getSolvers "../../Common/xml/Solvers.xml" [Model::getCondition "Outlet2D"] setAttribute ElementType "Point,Line" @@ -30,11 +33,11 @@ proc Buoyancy::xml::Init { } { } -proc Buoyancy::xml::getUniqueName {name} { - return ${::Buoyancy::prefix}${name} +proc ::Buoyancy::xml::getUniqueName {name} { + return [::Buoyancy::GetAttribute prefix]${name} } -proc Buoyancy::xml::CustomTree { args } { +proc ::Buoyancy::xml::CustomTree { args } { spdAux::parseRoutes apps::setActiveAppSoft Fluid @@ -51,7 +54,4 @@ proc Buoyancy::xml::CustomTree { args } { # Hide Fluid gravity -> Boussinesq spdAux::SetValueOnTreeItem state hidden FLGravity - } - -Buoyancy::xml::Init diff --git a/kratos.gid/apps/CDEM/app.json b/kratos.gid/apps/CDEM/app.json new file mode 100644 index 000000000..95a593122 --- /dev/null +++ b/kratos.gid/apps/CDEM/app.json @@ -0,0 +1,42 @@ +{ + "id": "CDEM", + "name": "CDEM", + "prefix": "DEM", + "themed": false, + "kratos_name": "DEMApplication", + "python_packages": [ + "KratosDEMApplication","numpy" + ], + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/ContinuumDrop2D.tcl", + "examples/ContSpheresDrop3D.tcl", + "write/write.tcl", + "write/writeMDPA_Parts.tcl", + "write/writeMDPA_Walls.tcl", + "write/writeMDPA_Inlet.tcl", + "write/writeProjectParameters.tcl", + "xml/XmlController.tcl", + "xml/BulkGroup.tcl" + ], + "start_script": "::CDEM::Init", + "requeriments": { + "apps": [ + "DEM" + ], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "main_launch_file": "python/MainKratos.py", + "examples": "examples/examples.xml" +} \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/examples/ContSpheresDrop3D.tcl b/kratos.gid/apps/CDEM/examples/ContSpheresDrop3D.tcl index c5c6bddac..8e27e5299 100644 --- a/kratos.gid/apps/CDEM/examples/ContSpheresDrop3D.tcl +++ b/kratos.gid/apps/CDEM/examples/ContSpheresDrop3D.tcl @@ -1,20 +1,25 @@ -proc ::CDEM::examples::ContSpheresDrop3D {args} { +namespace eval ::CDEM::examples::ContSpheresDrop3D { + namespace path ::CDEM::examples + Kratos::AddNamespace [namespace current] +} + +proc ::CDEM::examples::ContSpheresDrop3D::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to discard your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawGeometryContSpheres - AssignToTreeContSpheres - AssignMeshSizeContSpheres + DrawGeometry + AssignToTree + AssignMeshSize GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS GidUtils::UpdateWindow LAYER } -proc ::CDEM::examples::DrawGeometryContSpheres { } { +proc ::CDEM::examples::ContSpheresDrop3D::DrawGeometry { } { Kratos::ResetModel # Draw floor surface @@ -35,18 +40,18 @@ proc ::CDEM::examples::DrawGeometryContSpheres { } { GiD_EntitiesGroups assign "Body" -also_lower_entities volumes 1 } -proc ::CDEM::examples::AssignToTreeContSpheres { } { +proc ::CDEM::examples::ContSpheresDrop3D::AssignToTree { } { # Material set DEMmaterials [spdAux::getRoute "DEMMaterials"] - set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e7 PARTICLE_MATERIAL 2 ] - set material_node [[customlib::GetBaseRoot] selectNodes "$DEMmaterials/blockdata\[@name = 'DEMCont-DefaultMaterial' \]"] + set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e7 ] + set material_node [[customlib::GetBaseRoot] selectNodes "$DEMmaterials/blockdata\[@name = 'DEM-DefaultMaterial' \]"] spdAux::SetValuesOnBaseNode $material_node $props # Parts set DEMParts [spdAux::getRoute "DEMParts"] set DEMPartsNode [customlib::AddConditionGroupOnXPath $DEMParts Body] $DEMPartsNode setAttribute ov volume - set props [list Material "DEMCont-DefaultMaterial"] + set props [list Material "DEM-DefaultMaterial"] spdAux::SetValuesOnBaseNode $DEMPartsNode $props # DEM FEM Walls @@ -59,7 +64,7 @@ proc ::CDEM::examples::AssignToTreeContSpheres { } { set DEMInlet "$DEMConditions/condition\[@n='Inlet'\]" set inletNode [customlib::AddConditionGroupOnXPath $DEMInlet "Inlet"] $inletNode setAttribute ov surface - set props [list Material "DEMCont-DefaultMaterial" ParticleDiameter 0.13 InVelocityModulus 2.3 InDirectionVector "0.0,0.0,-1.0"] + set props [list Material "DEM-DefaultMaterial" ParticleDiameter 0.13 InVelocityModulus 2.3 InDirectionVector "0.0,0.0,-1.0"] spdAux::SetValuesOnBaseNode $inletNode $props # DEM custom submodelpart @@ -105,17 +110,8 @@ proc ::CDEM::examples::AssignToTreeContSpheres { } { spdAux::RequestRefresh } -proc ::CDEM::::examples::AssignMeshSizeContSpheres { } { +proc ::CDEM::::examples::ContSpheresDrop3D::AssignMeshSize { } { GiD_Process Mescape Meshing AssignSizes Volumes 0.2 1:end escape escape escape GiD_Process Mescape Meshing AssignSizes Surfaces 0.2 1:end escape escape escape GiD_Process Mescape Meshing AssignSizes Lines 0.2 1:end escape escape escape } - - -proc DEM::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/examples/ContinuumDrop2D.tcl b/kratos.gid/apps/CDEM/examples/ContinuumDrop2D.tcl index 649d34fbd..5fe80362b 100644 --- a/kratos.gid/apps/CDEM/examples/ContinuumDrop2D.tcl +++ b/kratos.gid/apps/CDEM/examples/ContinuumDrop2D.tcl @@ -1,25 +1,27 @@ +namespace eval ::CDEM::examples::ContinuumDrop2D { + namespace path ::CDEM::examples + Kratos::AddNamespace [namespace current] +} -proc ::CDEM::examples::ContinuumDrop2D {args} { +proc ::CDEM::examples::ContinuumDrop2D::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to discard your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawGeometryContinuumDrop - AssignToTreeContinuumDrop - AssignMeshSizeContinuumDrop + DrawGeometry + AssignToTree + AssignMeshSize GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS GidUtils::UpdateWindow LAYER GiD_Process 'Zoom Frame - MeshGenerationOKDo 1.0 - } -proc ::CDEM::examples::DrawGeometryContinuumDrop { } { +proc ::CDEM::examples::ContinuumDrop2D::DrawGeometry { } { Kratos::ResetModel GiD_Groups create "Box" @@ -50,39 +52,39 @@ proc ::CDEM::examples::DrawGeometryContinuumDrop { } { } -proc ::CDEM::examples::AssignToTreeContinuumDrop { } { +proc ::CDEM::examples::ContinuumDrop2D::AssignToTree { } { # Material set DEMmaterials [spdAux::getRoute "DEMMaterials"] - set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e7 PARTICLE_MATERIAL 2 ] - set material_node [[customlib::GetBaseRoot] selectNodes "$DEMmaterials/blockdata\[@name = 'DEMCont-DefaultMaterial' \]"] + set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e7 ] + set material_node [[customlib::GetBaseRoot] selectNodes "$DEMmaterials/blockdata\[@name = 'DEM-DefaultMaterial' \]"] spdAux::SetValuesOnBaseNode $material_node $props # Parts set DEMParts [spdAux::getRoute "DEMParts"] set DEMPartsNode [customlib::AddConditionGroupOnXPath $DEMParts LowPart] $DEMPartsNode setAttribute ov surface - set props [list Material "DEMCont-DefaultMaterial"] + set props [list Material "DEM-DefaultMaterial"] spdAux::SetValuesOnBaseNode $DEMPartsNode $props # Parts set DEMParts [spdAux::getRoute "DEMParts"] set DEMPartsNode [customlib::AddConditionGroupOnXPath $DEMParts MidPart] $DEMPartsNode setAttribute ov surface - set props [list Material "DEMCont-DefaultMaterial"] + set props [list Material "DEM-DefaultMaterial"] spdAux::SetValuesOnBaseNode $DEMPartsNode $props # Parts set DEMParts [spdAux::getRoute "DEMParts"] set DEMPartsNode [customlib::AddConditionGroupOnXPath $DEMParts TopPart] $DEMPartsNode setAttribute ov surface - set props [list Material "DEMCont-DefaultMaterial"] + set props [list Material "DEM-DefaultMaterial"] spdAux::SetValuesOnBaseNode $DEMPartsNode $props # Parts set DEMParts [spdAux::getRoute "DEMParts"] set DEMPartsNode [customlib::AddConditionGroupOnXPath $DEMParts Sand] $DEMPartsNode setAttribute ov surface - set props [list Material "DEMCont-DefaultMaterial"] + set props [list Material "DEM-DefaultMaterial"] spdAux::SetValuesOnBaseNode $DEMPartsNode $props # DEM FEM Walls @@ -121,17 +123,8 @@ proc ::CDEM::examples::AssignToTreeContinuumDrop { } { spdAux::RequestRefresh } -proc ::CDEM::examples::AssignMeshSizeContinuumDrop { } { +proc ::CDEM::examples::ContinuumDrop2D::AssignMeshSize { } { GiD_Process Mescape Meshing AssignSizes Volumes 0.2 1:end escape escape escape GiD_Process Mescape Meshing AssignSizes Surfaces 0.6 1:end escape escape escape GiD_Process Mescape Meshing AssignSizes Lines 0.6 1:end escape escape escape } - - -proc ::CDEM::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/examples/examples.tcl b/kratos.gid/apps/CDEM/examples/examples.tcl index 72ee4ba92..6bab9fc9b 100644 --- a/kratos.gid/apps/CDEM/examples/examples.tcl +++ b/kratos.gid/apps/CDEM/examples/examples.tcl @@ -1,22 +1,19 @@ -namespace eval CDEM::examples { +namespace eval ::CDEM::examples { + namespace path ::CDEM + Kratos::AddNamespace [namespace current] } -proc CDEM::examples::Init { } { - uplevel #0 [list source [file join $::CDEM::dir examples ContinuumDrop2D.tcl]] - uplevel #0 [list source [file join $::CDEM::dir examples ContSpheresDrop3D.tcl]] -} - proc CDEM::examples::UpdateMenus { } { GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter = - if {$::Model::SpatialDimension eq "2D"} { - GiDMenu::InsertOption "Kratos" [list "Stone block and sand" ] 8 PRE [list ::CDEM::examples::ContinuumDrop2D] "" "" insertafter = - } - if {$::Model::SpatialDimension eq "3D"} { - GiDMenu::InsertOption "Kratos" [list "Stone block and sand" ] 8 PRE [list ::CDEM::examples::ContSpheresDrop3D] "" "" insertafter = - } GiDMenu::InsertOption "Kratos" [list "Bulk groups" ] 8 PRE [list ::CDEM::xml::BulkGroup] "" "" insertafter = GiDMenu::UpdateMenus } -CDEM::examples::Init \ No newline at end of file +proc ::CDEM::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} + } +} diff --git a/kratos.gid/apps/CDEM/examples/examples.xml b/kratos.gid/apps/CDEM/examples/examples.xml new file mode 100644 index 000000000..7b3b74a15 --- /dev/null +++ b/kratos.gid/apps/CDEM/examples/examples.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/images/CirclesDrop2D.png b/kratos.gid/apps/CDEM/images/CirclesDrop2D.png new file mode 100644 index 000000000..c9b7dd92e Binary files /dev/null and b/kratos.gid/apps/CDEM/images/CirclesDrop2D.png differ diff --git a/kratos.gid/apps/CDEM/images/SpheresDrop3D.png b/kratos.gid/apps/CDEM/images/SpheresDrop3D.png new file mode 100644 index 000000000..cabe5e860 Binary files /dev/null and b/kratos.gid/apps/CDEM/images/SpheresDrop3D.png differ diff --git a/kratos.gid/apps/CDEM/images/material-relation.png b/kratos.gid/apps/CDEM/images/material-relation.png new file mode 100644 index 000000000..fe736f449 Binary files /dev/null and b/kratos.gid/apps/CDEM/images/material-relation.png differ diff --git a/kratos.gid/apps/DEM/python/KratosDEMAnalysis.py b/kratos.gid/apps/CDEM/python/MainKratos.py similarity index 56% rename from kratos.gid/apps/DEM/python/KratosDEMAnalysis.py rename to kratos.gid/apps/CDEM/python/MainKratos.py index 4f31eace5..60cd76126 100644 --- a/kratos.gid/apps/DEM/python/KratosDEMAnalysis.py +++ b/kratos.gid/apps/CDEM/python/MainKratos.py @@ -1,21 +1,19 @@ -import KratosMultiphysics -from KratosMultiphysics.DEMApplication.DEM_analysis_stage import DEMAnalysisStage - import time import sys -""" model = KratosMultiphysics.Model() -solution = Main.Solution(model) -solution.Run() """ + +import KratosMultiphysics +from KratosMultiphysics.DEMApplication.DEM_analysis_stage import DEMAnalysisStage +from KratosMultiphysics import Logger class DEMAnalysisStageWithFlush(DEMAnalysisStage): def __init__(self, model, project_parameters, flush_frequency=10.0): - super(DEMAnalysisStageWithFlush,self).__init__(model, project_parameters) + super().__init__(model, project_parameters) self.flush_frequency = flush_frequency self.last_flush = time.time() def FinalizeSolutionStep(self): - super(DEMAnalysisStageWithFlush,self).FinalizeSolutionStep() + super().FinalizeSolutionStep() if self.parallel_type == "OpenMP": now = time.time() @@ -24,10 +22,9 @@ def FinalizeSolutionStep(self): self.last_flush = now if __name__ == "__main__": - from KratosMultiphysics import Logger Logger.GetDefaultOutput().SetSeverity(Logger.Severity.INFO) - with open("ProjectParametersDEM.json",'r') as parameter_file: - project_parameters = KratosMultiphysics.Parameters(parameter_file.read()) + with open("ProjectParametersDEM.json", 'r') as parameter_file: + parameters = KratosMultiphysics.Parameters(parameter_file.read()) - model = KratosMultiphysics.Model() - DEMAnalysisStageWithFlush(model, project_parameters).Run() + global_model = KratosMultiphysics.Model() + DEMAnalysisStageWithFlush(global_model, parameters).Run() diff --git a/kratos.gid/apps/CDEM/start.tcl b/kratos.gid/apps/CDEM/start.tcl index 84c8ccb53..e6e9447dd 100644 --- a/kratos.gid/apps/CDEM/start.tcl +++ b/kratos.gid/apps/CDEM/start.tcl @@ -1,48 +1,28 @@ namespace eval ::CDEM { + Kratos::AddNamespace [namespace current] # Variable declaration variable dir - variable prefix - variable attributes - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::CDEM::Init { } { +proc ::CDEM::Init { app } { # Variable initialization variable dir - variable prefix - variable kratos_name - variable attributes - - set attributes [dict create] - set kratos_name DEMapplication - set dir [apps::getMyDir "CDEM"] - set prefix CDEM_ - set ::spdAux::TreeVisibility 0 - - apps::LoadAppById "DEM" + variable _app + set _app $app + + CDEM::xml::Init + CDEM::write::Init - # Intervals - dict set attributes UseIntervals 1 - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - set ::Model::ValidSpatialDimensions [list 2D 3D] - - LoadMyFiles } -proc ::CDEM::LoadMyFiles { } { - variable dir - - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir xml BulkGroup.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeMDPA_Parts.tcl]] - uplevel #0 [list source [file join $dir write writeMDPA_Walls.tcl]] - uplevel #0 [list source [file join $dir write writeMDPA_Inlet.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - uplevel #0 [list source [file join $dir examples examples.tcl]] +proc ::CDEM::CustomToolbarItems { } { + ::DEM::CustomToolbarItems } proc ::CDEM::BeforeMeshGeneration {elementsize} { @@ -53,22 +33,6 @@ proc ::CDEM::AfterMeshGeneration {fail} { ::DEM::AfterMeshGeneration $fail } -proc ::CDEM::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value +proc ::CDEM::AfterSaveModel {filespd} { + ::DEM::AfterSaveModel $filespd } - -proc ::CDEM::CustomToolbarItems { } { - variable dir - if {$::Model::SpatialDimension eq "2D"} { - Kratos::ToolbarAddItem "Example" [file join $dir images drop.png] [list -np- ::CDEM::examples::ContinuumDrop2D] [= "Example2D\nRocks fall"] - } - if {$::Model::SpatialDimension eq "3D"} { - Kratos::ToolbarAddItem "Example" [file join $dir images drop.png] [list -np- ::CDEM::examples::ContSpheresDrop3D] [= "Example3D\nContinuum spheres drop"] - } - Kratos::ToolbarAddItem "Bulk grouping" [file join $dir images stone.png] [list -np- ::CDEM::xml::BulkGroup] [= "Plugin\nBulk grouping"] -} - -::CDEM::Init diff --git a/kratos.gid/apps/CDEM/write/write.tcl b/kratos.gid/apps/CDEM/write/write.tcl index 24b05b98f..98b7d975c 100644 --- a/kratos.gid/apps/CDEM/write/write.tcl +++ b/kratos.gid/apps/CDEM/write/write.tcl @@ -1,4 +1,8 @@ namespace eval ::CDEM::write { + + namespace path ::CDEM + Kratos::AddNamespace [namespace current] + variable writeAttributes variable inletProperties variable last_property_id @@ -7,7 +11,7 @@ namespace eval ::CDEM::write { proc ::CDEM::write::Init { } { DEM::write::Init - SetAttribute partscont_un DEMParts + SetAttribute partscont_un [::DEM::GetUniqueName parts] } # Events @@ -17,6 +21,7 @@ proc CDEM::write::writeModelPartEvent { } { proc CDEM::write::writeCustomFilesEvent { } { DEM::write::writeCustomFilesEvent + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] } # Attributes block @@ -34,6 +39,4 @@ proc CDEM::write::AddAttributes {configuration} { proc CDEM::write::AddValidApps {appid} { DEM::write::AddAttribute validApps $appid -} - -CDEM::write::Init \ No newline at end of file +} \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/write/writeMDPA_Inlet.tcl b/kratos.gid/apps/CDEM/write/writeMDPA_Inlet.tcl index 687d7ace6..800234201 100644 --- a/kratos.gid/apps/CDEM/write/writeMDPA_Inlet.tcl +++ b/kratos.gid/apps/CDEM/write/writeMDPA_Inlet.tcl @@ -1,39 +1,8 @@ -proc DEM::write::DefineInletConditions {inletProperties groupid mid contains_clusters} { - set inlet_element_type SphericContinuumParticle3D - if {[dict get $inletProperties $groupid InletElementType] eq "Cluster3D"} { - set contains_clusters 1 - if {[dict get $inletProperties $groupid ClusterType] eq "FromFile"} { - set custom_file_name [dict get $inletProperties $groupid ClusterFilename] - set only_name [file tail $custom_file_name] - write::WriteString " CLUSTER_FILE_NAME $only_name" - - } else { - set cluster_file_name [dict get $inletProperties $groupid ClusterType] - lassign [GetClusterFileNameAndReplaceInletElementType $cluster_file_name] inlet_element_type cluster_file_name - write::WriteString " CLUSTER_FILE_NAME $cluster_file_name" - } +# Overwritten to add CylinderContinuumParticle +proc DEM::write::GetInletElementType {} { + set elem_name SphericContinuumParticle3D + if {$::Model::SpatialDimension eq "2D"} { + set elem_name CylinderContinuumParticle2D } - - if {[dict get $inletProperties $groupid InletElementType] eq "SphericParticle3D"} { - dict set inletProperties $groupid InletElementType SphericContinuumParticle3D - } - - write::WriteString " IDENTIFIER $mid" - write::WriteString " INJECTOR_ELEMENT_TYPE SphericContinuumParticle3D" - write::WriteString " ELEMENT_TYPE [dict get $inletProperties $groupid InletElementType]" - write::WriteString " CONTAINS_CLUSTERS $contains_clusters" - # Change to SphericSwimmingParticle3D in FLUIDDEM interface + return $elem_name } - -proc DEM::write::DefineInletConditions2D {inletProperties groupid mid contains_clusters} { - set inlet_element_type CylinderContinuumParticle2D - - if {[dict get $inletProperties $groupid InletElementType] eq "CylinderParticle2D"} { - dict set inletProperties $groupid InletElementType CylinderContinuumParticle2D - } - write::WriteString " IDENTIFIER $mid" - write::WriteString " INJECTOR_ELEMENT_TYPE [dict get $inletProperties $groupid InletElementType]" - write::WriteString " ELEMENT_TYPE [dict get $inletProperties $groupid InletElementType]" - write::WriteString " CONTAINS_CLUSTERS 0" - # Change to SphericSwimmingParticle3D in FLUIDDEM interface -} \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/write/writeMDPA_Parts.tcl b/kratos.gid/apps/CDEM/write/writeMDPA_Parts.tcl index c82581f89..b048448d4 100644 --- a/kratos.gid/apps/CDEM/write/writeMDPA_Parts.tcl +++ b/kratos.gid/apps/CDEM/write/writeMDPA_Parts.tcl @@ -1,91 +1,37 @@ +# Overwrite DEM function proc DEM::write::WriteMDPAParts { } { - variable last_property_id - - # Prepare properties - write::processMaterials "" $last_property_id; - set last_property_id [expr $last_property_id + [dict size $::write::mat_dict]] - # Headers write::writeModelPartData - + + # Process properties + DEM::write::processPartMaterials + # Materials - CDEM::write::writeMaterialsParts - + DEM::write::writeMaterialsParts + # Nodal coordinates (only for DEM Parts ) - write::writeNodalCoordinatesOnParts - write::writeNodalCoordinatesOnGroups [GetDEMGroupsCustomSubmodelpart] - write::writeNodalCoordinatesOnGroups [DEM::write::GetDEMGroupsInitialC] - write::writeNodalCoordinatesOnGroups [DEM::write::GetDEMGroupsBoundayC] - write::writeNodalCoordinatesOnGroups [DEM::write::GetNodesForGraphs] - + WriteNodalCoordinatesParts + # Element connectivities write::writeElementConnectivities - + # Begin NodalData RADIUS - CDEM::write::writeSphereRadius - + DEM::write::writeSphereRadius + # Begin NodalData COHESIVE_GROUP CDEM::write::writeCohesiveGroups - + # Begin NodalData SKIN_SPHERE CDEM::write::writeSkinSphereNodes - + # SubmodelParts write::writePartSubModelPart - DEM::write::writeDEMConditionMeshes - + DEM::write::writeDEMConditionMeshes + # CustomSubmodelParts - CDEM::write::WriteCustomDEMSmp -} - -## TODO: proc under revision. This works but the proc is different from the DEM::write version. -proc CDEM::write::WriteCustomDEMSmp { } { - set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-CustomSmp'\]/group" - foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { - set group_id [$group @n] - set group_raw [write::GetWriteGroupName $group_id] - set good_name [write::transformGroupName $group_raw] - set destination_mdpa [write::getValueByNode [$group selectNodes "./value\[@n='WhatMdpa'\]"]] - if {$destination_mdpa == "DEM"} { - write::WriteString "Begin SubModelPart $good_name \/\/ Custom SubModelPart. Group name: $group_id" - write::WriteString "Begin SubModelPartData" - write::WriteString "End SubModelPartData" - write::WriteString "Begin SubModelPartNodes" - GiD_WriteCalculationFile nodes -sorted [dict create [write::GetWriteGroupName $group_id] [subst "%10i\n"]] - write::WriteString "End SubModelPartNodes" - write::WriteString "End SubModelPart" - write::WriteString "" - } - } -} - -proc CDEM::write::GetDEMGroupsCustomSubmodelpart { } { - set groups [list ] - set xp2 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-CustomSmp'\]/group" - foreach group [[customlib::GetBaseRoot] selectNodes $xp2] { - set destination_mdpa [write::getValueByNode [$group selectNodes "./value\[@n='WhatMdpa'\]"]] - if {$destination_mdpa == "DEM"} { - set groupid [$group @n] - lappend groups [write::GetWriteGroupName $groupid] - } - } - return $groups -} - -proc CDEM::write::writeSphereRadius { } { - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute [GetAttribute partscont_un]]/group" - foreach group [$root selectNodes $xp1] { - set groupid [$group @n] - set grouppid [write::GetWriteGroupName $groupid] - write::WriteString "Begin NodalData RADIUS // GUI group identifier: $grouppid" - GiD_WriteCalculationFile connectivities [dict create $groupid "%.0s %10d 0 %10g\n"] - write::WriteString "End NodalData" - write::WriteString "" - } + DEM::write::WriteCustomDEMSmp } - proc CDEM::write::writeCohesiveGroups { } { set root [customlib::GetBaseRoot] if {$::Model::SpatialDimension eq "3D"} { @@ -97,12 +43,12 @@ proc CDEM::write::writeCohesiveGroups { } { foreach group [$root selectNodes $xp1] { incr cohesive_group set groupid [$group @n] - set grouppid [write::GetWriteGroupName $groupid] - write::WriteString "Begin NodalData COHESIVE_GROUP // GUI group identifier: $grouppid" + set group_id [write::GetWriteGroupName $groupid] + write::WriteString "Begin NodalData COHESIVE_GROUP // GUI group identifier: $group_id" GiD_WriteCalculationFile connectivities [dict create $groupid "%.0s %10d 0 $cohesive_group\n"] write::WriteString "End NodalData" write::WriteString "" - + } } @@ -110,63 +56,18 @@ proc CDEM::write::writeSkinSphereNodes { } { # Write Skin Sphere set number 1 set list_of_active_dem_elements "" - if {[GiD_Groups exists SKIN_SPHERE_DO_NOT_DELETE]} { + if {[GiD_Groups exists SKIN_SPHERE_DO_NOT_DELETE]} { if {$::Model::SpatialDimension eq "2D"} { set skin_element_ids [GiD_EntitiesGroups get SKIN_SPHERE_DO_NOT_DELETE all_mesh -element_type circle] ; # Get the ids of elements in SKIN_SPHERE } else { set skin_element_ids [GiD_EntitiesGroups get SKIN_SPHERE_DO_NOT_DELETE all_mesh -element_type sphere] } - } else { - set skin_element_ids [list] - } + } else { + set skin_element_ids [list] + } write::WriteString "Begin NodalData SKIN_SPHERE" GiD_WriteCalculationFile connectivities [dict create SKIN_SPHERE_DO_NOT_DELETE "%.0s %10d 0 $number\n"] write::WriteString "End NodalData" - write::WriteString "" -} - - -proc CDEM::write::writeMaterialsParts { } { - variable partsProperties - set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'PartsCont'\]/group" - set partsProperties $::write::mat_dict - set printable [list PARTICLE_DENSITY \ - YOUNG_MODULUS \ - POISSON_RATIO \ - FRICTION \ - COEFFICIENT_OF_RESTITUTION \ - PARTICLE_MATERIAL \ - ROLLING_FRICTION \ - ROLLING_FRICTION_WITH_WALLS \ - CONTACT_SIGMA_MIN \ - CONTACT_TAU_ZERO \ - CONTACT_INTERNAL_FRICC \ - ConstitutiveLaw \ - SHEAR_ENERGY_COEF \ - LOOSE_MATERIAL_YOUNG_MODULUS \ - FRACTURE_ENERGY \ - INTERNAL_FRICTION_ANGLE] - - foreach group [dict keys $partsProperties] { - write::WriteString "Begin Properties [dict get $partsProperties $group MID]" - foreach {prop val} [dict get $partsProperties $group] { - if {$prop in $printable} { - if {$prop eq "ConstitutiveLaw"} { - write::WriteString " DEM_CONTINUUM_CONSTITUTIVE_LAW_NAME $val" - } elseif {$prop eq "FRICTION"} { - set propvalue [expr {tan($val)}] - write::WriteString " FRICTION $propvalue" - } else { - write::WriteString " $prop $val" - } - } - } - if {$::Model::SpatialDimension eq "2D"} { - write::WriteString " DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME DEM_D_Linear_viscous_Coulomb2D" - } else { - write::WriteString " DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME DEM_D_Linear_viscous_Coulomb"} - - write::WriteString "End Properties\n" - } + write::WriteString "" } diff --git a/kratos.gid/apps/CDEM/write/writeMDPA_Walls.tcl b/kratos.gid/apps/CDEM/write/writeMDPA_Walls.tcl index 53762efca..128395aaf 100644 --- a/kratos.gid/apps/CDEM/write/writeMDPA_Walls.tcl +++ b/kratos.gid/apps/CDEM/write/writeMDPA_Walls.tcl @@ -1,66 +1,27 @@ -proc DEM::write::WriteMDPAWalls { } { - # Headers - write::writeModelPartData - - # Material - set wall_properties [WriteWallProperties] - - # Nodal coordinates (only for Walls ) - write::writeNodalCoordinatesOnGroups [DEM::write::GetWallsGroups] - write::writeNodalCoordinatesOnGroups [GetWallsGroupsSmp] - - # Nodal conditions and conditions - DEM::write::writeConditions $wall_properties - - # SubmodelParts - DEM::write::writeWallConditionMeshes - - # CustomSubmodelParts - WriteWallCustomSmp -} - - -proc CDEM::write::WriteWallCustomSmp { } { - set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-CustomSmp'\]/group" - set i $DEM::write::last_property_id - foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { - incr i - set groupid [$group @n] - set destination_mdpa [write::getValueByNode [$group selectNodes "./value\[@n='WhatMdpa'\]"]] - if {$destination_mdpa == "FEM"} { - write::WriteString "Begin SubModelPart $groupid \/\/ Custom SubModelPart. Group name: $groupid" - write::WriteString "Begin SubModelPartData // DEM-FEM-Wall. Group name: $groupid" - write::WriteString "End SubModelPartData" - write::WriteString "Begin SubModelPartNodes" - GiD_WriteCalculationFile nodes -sorted [dict create [write::GetWriteGroupName $groupid] [subst "%10i\n"]] - write::WriteString "End SubModelPartNodes" - write::WriteString "End SubModelPart" - write::WriteString "" - } - } -} - -proc DEM::write::DefineFEMExtraConditions {group_node} { +# Overwritten to add TOP BOTTOM params +proc DEM::write::DefineFEMExtraConditions {props} { set material_analysis [write::getValue DEMTestMaterial Active] if {$material_analysis == "true"} { - set is_material_test [write::getValueByNode [$group_node selectNodes "./value\[@n='MaterialTest'\]"]] + set is_material_test [dict get $props Material Variables MaterialTest] if {$is_material_test == "true"} { - set as_condition [write::getValueByNode [$group_node selectNodes "./value\[@n='DefineTopBot'\]"]] + set as_condition [dict get $props Material Variables DefineTopBot] if {$as_condition eq "top"} { write::WriteString " TOP 1" write::WriteString " BOTTOM 0" } else { write::WriteString " TOP 0" - write::WriteString " BOTTOM 1"} + write::WriteString " BOTTOM 1" + } } } else { - write::WriteString " TOP 0" - write::WriteString " BOTTOM 0"} - set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]] - if {$GraphPrint == "true" || $material_analysis == "true"} { - set GraphPrintval 1 - } else { - set GraphPrintval 0 + write::WriteString " TOP 0" + write::WriteString " BOTTOM 0" } + + set GraphPrint [dict get $props Material Variables GraphPrint] + set GraphPrintval 0 + if {[write::isBooleanTrue $GraphPrint]} { + set GraphPrintval 1 + } write::WriteString " FORCE_INTEGRATION_GROUP $GraphPrintval" } \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/write/writeProjectParameters.tcl b/kratos.gid/apps/CDEM/write/writeProjectParameters.tcl index ddc75e773..22ab82d53 100644 --- a/kratos.gid/apps/CDEM/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/CDEM/write/writeProjectParameters.tcl @@ -2,26 +2,10 @@ # Project Parameters proc CDEM::write::getParametersDict { } { + # Get the DEM original json and set project_parameters_dict [DEM::write::getParametersDict] - set ElementType SphericContPartDEMElement3D - if {$ElementType eq "SphericPartDEMElement3D" || $ElementType eq "CylinderPartDEMElement2D"} { - set dem_strategy "sphere_strategy" - } elseif {$ElementType eq "SphericContPartDEMElement3D" || $ElementType eq "CylinderContPartDEMElement3D"} { - set dem_strategy "continuum_sphere_strategy" - } elseif {$ElementType eq "ThermalSphericPartDEMElement3D"} { - set dem_strategy "thermal_sphere_strategy" - } elseif {$ElementType eq "ThermalSphericContPartDEMElement3D"} { - set dem_strategy "thermal_continuum_sphere_strategy" - } elseif {$ElementType eq "SinteringSphericConPartDEMElement3D"} { - set dem_strategy "thermal_continuum_sphere_strategy" - } elseif {$ElementType eq "IceContPartDEMElement3D"} { - set dem_strategy "ice_continuum_sphere_strategy" - } - - dict set project_parameters_dict "solver_settings" "strategy" $dem_strategy - dict set project_parameters_dict "ElementType" $ElementType - + # Add advanced options dict set project_parameters_dict "DeltaOption" [write::getValue AdvOptions DeltaOption] dict set project_parameters_dict "SearchTolerance" [write::getValue AdvOptions TangencyAbsoluteTolerance] dict set project_parameters_dict "CoordinationNumber" [write::getValue AdvOptions TangencyCoordinationNumber] @@ -31,13 +15,13 @@ proc CDEM::write::getParametersDict { } { dict set project_parameters_dict "ComputeStressTensorOption" [write::getValue AdvOptions ComputeStressTensorOption] dict set project_parameters_dict "MaxAmplificationRatioOfSearchRadius" 1000 + # Add material testing set material_test_parameters_dict [dict create] set material_analysis [write::getValue DEMTestMaterial Active] if {$material_analysis == "true"} { dict set material_test_parameters_dict "TestType" [write::getValue DEMTestMaterial TestType] dict set material_test_parameters_dict "ConfinementPressure" [write::getValue DEMTestMaterial ConfinementPressure] dict set material_test_parameters_dict "LoadingVelocity" [write::getValue DEMTestMaterial LoadVelocity] - dict set material_test_parameters_dict "MeshType" [write::getValue DEMTestMaterial Meshtype] dict set material_test_parameters_dict "SpecimenLength" [write::getValue DEMTestMaterial Specimenlength] dict set material_test_parameters_dict "SpecimenDiameter" [write::getValue DEMTestMaterial Specimendiameter] set SpecimenDiameter [write::getValue DEMTestMaterial Specimendiameter] @@ -51,6 +35,10 @@ proc CDEM::write::getParametersDict { } { return $project_parameters_dict } +proc DEM::write::GetDemStrategyName { } { + return continuum_sphere_strategy +} + proc CDEM::write::GetTimeSettings { } { return [DEM::write::GetTimeSettings] } @@ -61,5 +49,6 @@ proc CDEM::write::GetGravity { } { proc CDEM::write::writeParametersEvent { } { write::SetParallelismConfiguration - write::WriteJSON [CDEM::write::getParametersDict] + set cdem_parameters [CDEM::write::getParametersDict] + write::WriteJSON $cdem_parameters } diff --git a/kratos.gid/apps/CDEM/xml/AdvancedSettings.spd b/kratos.gid/apps/CDEM/xml/AdvancedSettings.spd new file mode 100644 index 000000000..76a67775b --- /dev/null +++ b/kratos.gid/apps/CDEM/xml/AdvancedSettings.spd @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/xml/Conditions.xml b/kratos.gid/apps/CDEM/xml/Conditions.xml index 1008ba5c8..8fbd6236f 100644 --- a/kratos.gid/apps/CDEM/xml/Conditions.xml +++ b/kratos.gid/apps/CDEM/xml/Conditions.xml @@ -1,12 +1,12 @@ - + - + diff --git a/kratos.gid/apps/CDEM/xml/ConstitutiveLawsC.xml b/kratos.gid/apps/CDEM/xml/ConstitutiveLawsC.xml index d6641b6f3..bdfd30432 100644 --- a/kratos.gid/apps/CDEM/xml/ConstitutiveLawsC.xml +++ b/kratos.gid/apps/CDEM/xml/ConstitutiveLawsC.xml @@ -1,10 +1,10 @@ - + - - + + @@ -12,8 +12,8 @@ - - + + @@ -21,21 +21,21 @@ - + - + - + @@ -43,16 +43,16 @@ - + - + - - + + @@ -61,26 +61,19 @@ - + - - + + + + - - \ No newline at end of file + diff --git a/kratos.gid/apps/CDEM/xml/ElementsC.xml b/kratos.gid/apps/CDEM/xml/ElementsC.xml index 7e022da47..cf3035529 100644 --- a/kratos.gid/apps/CDEM/xml/ElementsC.xml +++ b/kratos.gid/apps/CDEM/xml/ElementsC.xml @@ -12,7 +12,9 @@ - + + + @@ -26,7 +28,9 @@ - + + + diff --git a/kratos.gid/apps/CDEM/xml/Main.spd b/kratos.gid/apps/CDEM/xml/Main.spd index 91fbacfd3..8cffd07aa 100644 --- a/kratos.gid/apps/CDEM/xml/Main.spd +++ b/kratos.gid/apps/CDEM/xml/Main.spd @@ -1,11 +1,12 @@ - + - + - - + + + diff --git a/kratos.gid/apps/CDEM/xml/MaterialRelations.xml b/kratos.gid/apps/CDEM/xml/MaterialRelations.xml new file mode 100644 index 000000000..2b83ac5c3 --- /dev/null +++ b/kratos.gid/apps/CDEM/xml/MaterialRelations.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/xml/Materials.spd b/kratos.gid/apps/CDEM/xml/Materials.spd deleted file mode 100644 index 4bf435d87..000000000 --- a/kratos.gid/apps/CDEM/xml/Materials.spd +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/kratos.gid/apps/CDEM/xml/MaterialsC.xml b/kratos.gid/apps/CDEM/xml/MaterialsC.xml deleted file mode 100644 index 181e60698..000000000 --- a/kratos.gid/apps/CDEM/xml/MaterialsC.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/xml/PartsCont.spd b/kratos.gid/apps/CDEM/xml/PartsCont.spd deleted file mode 100644 index e1d8ae59a..000000000 --- a/kratos.gid/apps/CDEM/xml/PartsCont.spd +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/CDEM/xml/SolutionStrategy.spd b/kratos.gid/apps/CDEM/xml/SolutionStrategy.spd index 510b9b5e0..5c6db3687 100644 --- a/kratos.gid/apps/CDEM/xml/SolutionStrategy.spd +++ b/kratos.gid/apps/CDEM/xml/SolutionStrategy.spd @@ -26,29 +26,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/kratos.gid/apps/CDEM/xml/TestMaterial.spd b/kratos.gid/apps/CDEM/xml/TestMaterial.spd new file mode 100644 index 000000000..0cf8be561 --- /dev/null +++ b/kratos.gid/apps/CDEM/xml/TestMaterial.spd @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/CDEM/xml/XmlController.tcl b/kratos.gid/apps/CDEM/xml/XmlController.tcl index 055e662f3..ebd34510d 100644 --- a/kratos.gid/apps/CDEM/xml/XmlController.tcl +++ b/kratos.gid/apps/CDEM/xml/XmlController.tcl @@ -1,38 +1,46 @@ -namespace eval CDEM::xml { +namespace eval ::CDEM::xml { # Namespace variables declaration - variable dir + namespace path ::CDEM + Kratos::AddNamespace [namespace current] } -proc CDEM::xml::Init { } { +proc ::CDEM::xml::Init { } { # Namespace variables initialization - variable dir - Model::InitVariables dir $CDEM::dir + Model::InitVariables dir $::CDEM::dir Model::ForgetElements - Model::ForgetMaterials - Model::ForgetConstitutiveLaws - Model::ForgetElement SphericPartDEMElement3D Model::getElements ElementsC.xml - Model::ForgetConditions Model::getConditions Conditions.xml - Model::getConditions "../../DEM/xml/Conditions.xml" Model::getConstitutiveLaws ConstitutiveLawsC.xml - Model::getMaterials MaterialsC.xml + Model::getMaterialRelations MaterialRelations.xml Model::getProcesses "../../Common/xml/Processes.xml" Model::getProcesses Processes.xml + + ApplyPatches } -proc CDEM::xml::getUniqueName {name} { - return ${::CDEM::prefix}${name} +proc ::CDEM::xml::getUniqueName {name} { + return [::CDEM::GetAttribute prefix]${name} } -proc CDEM::xml::CustomTree { args } { - DEM::xml::CustomTree args +proc ::CDEM::xml::CustomTree { args } { + DEM::xml::CustomTree {*}$args + + set root [customlib::GetBaseRoot] + if {[$root selectNodes "[spdAux::getRoute DEMStratSection]/container\[@n='AdvOptions'\]"] eq ""} { + gid_groups_conds::addF [spdAux::getRoute DEMStratSection] include [list n AdvOptions active 1 path {apps/CDEM/xml/AdvancedSettings.spd}] + } + if {[$root selectNodes "[spdAux::getRoute DEMStratSection]/container\[@n='TestMaterial'\]"] eq ""} { + gid_groups_conds::addF [spdAux::getRoute DEMStratSection] include [list n TestMaterial active 1 path {apps/CDEM/xml/TestMaterial.spd}] + } gid_groups_conds::addF [spdAux::getRoute BondElem] value [list n TypeOfFailure pn "Type of failure" v No values {Yes,No} icon "black1" help "Displays different numbers for different types of failure. 2: tension. 4: shear or combination of stresses. 6: neighbour not found by search. 8: less bonds than minimum"] spdAux::SetValueOnTreeItem state {[getStateFromXPathValue {string(../value[@n='ContactMeshOption']/@v)} Yes]} BondElem TypeOfFailure + + customlib::ProcessIncludes $::Kratos::kratos_private(Path) + spdAux::parseRoutes } -proc CDEM::xml::ProcGetElements { domNode args } { +proc ::CDEM::xml::ProcGetElements { domNode args } { set elems [Model::GetElements] set names [list ] set pnames [list ] @@ -52,4 +60,11 @@ proc CDEM::xml::ProcGetElements { domNode args } { return $diction } -CDEM::xml::Init +proc ::CDEM::xml::ApplyPatches { } { + catch { + if {[spdAux::getRoute DEMROOT] eq ""} { + [[customlib::GetBaseRoot] selectNodes "container\[@n='CDEM'\]"] setAttribute un DEMROOT + spdAux::parseRoutes + } + } +} diff --git a/kratos.gid/apps/Common/xml/GenericSubModelPart.spd b/kratos.gid/apps/Common/xml/GenericSubModelPart.spd index 958be1fda..e4573d07a 100644 --- a/kratos.gid/apps/Common/xml/GenericSubModelPart.spd +++ b/kratos.gid/apps/Common/xml/GenericSubModelPart.spd @@ -1,5 +1,6 @@ + \ No newline at end of file diff --git a/kratos.gid/apps/Common/xml/Processes.xml b/kratos.gid/apps/Common/xml/Processes.xml index e890d009b..366d7cd4b 100644 --- a/kratos.gid/apps/Common/xml/Processes.xml +++ b/kratos.gid/apps/Common/xml/Processes.xml @@ -2,64 +2,56 @@ - - + + - - + + - + - + - + - + - + - + + - - + + - + - + diff --git a/kratos.gid/apps/Common/xml/Results.spd b/kratos.gid/apps/Common/xml/Results.spd index 03c0ded25..0c0bda286 100644 --- a/kratos.gid/apps/Common/xml/Results.spd +++ b/kratos.gid/apps/Common/xml/Results.spd @@ -14,6 +14,7 @@ + @@ -23,7 +24,6 @@ - diff --git a/kratos.gid/apps/Common/xml/Solvers.xml b/kratos.gid/apps/Common/xml/Solvers.xml index 2b574c9e5..ccff2e8d6 100644 --- a/kratos.gid/apps/Common/xml/Solvers.xml +++ b/kratos.gid/apps/Common/xml/Solvers.xml @@ -7,7 +7,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -25,7 +25,7 @@ - + @@ -51,7 +51,7 @@ - + diff --git a/kratos.gid/apps/Common/xml/TimeParametersWithSubstepping.spd b/kratos.gid/apps/Common/xml/TimeParametersWithSubstepping.spd new file mode 100644 index 000000000..723304ff0 --- /dev/null +++ b/kratos.gid/apps/Common/xml/TimeParametersWithSubstepping.spd @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/kratos.gid/apps/ConjugateHeatTransfer/app.json b/kratos.gid/apps/ConjugateHeatTransfer/app.json new file mode 100644 index 000000000..6000f89b4 --- /dev/null +++ b/kratos.gid/apps/ConjugateHeatTransfer/app.json @@ -0,0 +1,45 @@ +{ + "id": "ConjugateHeatTransfer", + "name": "ConjugateHeatTransfer", + "prefix": "CHT", + "themed": false, + "kratos_name": "ConvectionDiffusionApplication", + "python_packages": [ + "KratosConvectionDiffusionApplication", + "KratosFluidDynamicsApplication" + ], + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/HeatedSquare.tcl", + "examples/CylinderCooling.tcl", + "examples/BFS.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script": "::ConjugateHeatTransfer::Init", + "requeriments": { + "apps": [ + "Buoyancy" + ], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "write": { + "coordinates": "groups", + "properties_location": "json", + "model_part_name": "ThermalModelPart" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} \ No newline at end of file diff --git a/kratos.gid/apps/ConjugateHeatTransfer/examples/BFS.tcl b/kratos.gid/apps/ConjugateHeatTransfer/examples/BFS.tcl index ddec77420..6c66eb2b1 100644 --- a/kratos.gid/apps/ConjugateHeatTransfer/examples/BFS.tcl +++ b/kratos.gid/apps/ConjugateHeatTransfer/examples/BFS.tcl @@ -1,13 +1,18 @@ +namespace eval ::ConjugateHeatTransfer::examples::BFS { + namespace path ::ConjugateHeatTransfer::examples + Kratos::AddNamespace [namespace current] -proc ::ConjugateHeatTransfer::examples::BFS {args} { +} + +proc ::ConjugateHeatTransfer::examples::BFS::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawBFSGeometry$::Model::SpatialDimension - AssignBFSGroups$::Model::SpatialDimension - TreeAssignationBFS$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignGroups$::Model::SpatialDimension + TreeAssignation$::Model::SpatialDimension GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -17,15 +22,15 @@ proc ::ConjugateHeatTransfer::examples::BFS {args} { # Draw Geometry -proc ConjugateHeatTransfer::examples::DrawBFSGeometry3D {args} { +proc ::ConjugateHeatTransfer::examples::BFS::DrawGeometry3D {args} { # DrawSquareGeometry2D # 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 # GiD_Layers edit opaque Fluid 0 - # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate obj x -150 y -30 escape escape + # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate objaxes x -150 y -30 escape escape } -proc ConjugateHeatTransfer::examples::DrawBFSGeometry2D {args} { +proc ::ConjugateHeatTransfer::examples::BFS::DrawGeometry2D {args} { Kratos::ResetModel GiD_Layers create Fluid GiD_Layers create HeatSource @@ -72,7 +77,7 @@ proc ConjugateHeatTransfer::examples::DrawBFSGeometry2D {args} { # Group assign -proc ConjugateHeatTransfer::examples::AssignBFSGroups2D {args} { +proc ::ConjugateHeatTransfer::examples::BFS::AssignGroups2D {args} { # Create the groups for the fluid GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -123,7 +128,7 @@ proc ConjugateHeatTransfer::examples::AssignBFSGroups2D {args} { GiD_Groups edit color Heating_Bottom_Wall "#3b3b3bff" GiD_EntitiesGroups assign Heating_Bottom_Wall lines 9 } -proc ConjugateHeatTransfer::examples::AssignBFSGroups3D {args} { +proc ::ConjugateHeatTransfer::examples::BFS::AssignGroups3D {args} { # Create the groups # GiD_Groups create Fluid # GiD_Groups edit color Fluid "#26d1a8ff" @@ -147,11 +152,11 @@ proc ConjugateHeatTransfer::examples::AssignBFSGroups3D {args} { } # Tree assign -proc ConjugateHeatTransfer::examples::TreeAssignationBFS3D {args} { +proc ::ConjugateHeatTransfer::examples::BFS::TreeAssignation3D {args} { # TreeAssignationCylinderInFlow2D # AddCuts } -proc ConjugateHeatTransfer::examples::TreeAssignationBFS2D {args} { +proc ::ConjugateHeatTransfer::examples::BFS::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -165,7 +170,7 @@ proc ConjugateHeatTransfer::examples::TreeAssignationBFS2D {args} { # Fluid parts set parts [spdAux::getRoute "FLParts"] set fluidNode [customlib::AddConditionGroupOnXPath $parts Fluid] - set props [list Element Monolithic$nd ConstitutiveLaw Newtonian DENSITY 1.0 DYNAMIC_VISCOSITY 0.001875 CONDUCTIVITY 1.0 SPECIFIC_HEAT 0.002640845] + set props [list Element Monolithic$nd ConstitutiveLaw Newtonian2DLaw DENSITY 1.0 DYNAMIC_VISCOSITY 0.001875 CONDUCTIVITY 1.0 SPECIFIC_HEAT 0.002640845] spdAux::SetValuesOnBaseNode $fluidNode $props # Fluid boundary conditions diff --git a/kratos.gid/apps/ConjugateHeatTransfer/examples/cylinder_cooling.tcl b/kratos.gid/apps/ConjugateHeatTransfer/examples/CylinderCooling.tcl similarity index 89% rename from kratos.gid/apps/ConjugateHeatTransfer/examples/cylinder_cooling.tcl rename to kratos.gid/apps/ConjugateHeatTransfer/examples/CylinderCooling.tcl index 2bb2d86b9..a0614c8b7 100644 --- a/kratos.gid/apps/ConjugateHeatTransfer/examples/cylinder_cooling.tcl +++ b/kratos.gid/apps/ConjugateHeatTransfer/examples/CylinderCooling.tcl @@ -1,12 +1,17 @@ +namespace eval ::ConjugateHeatTransfer::examples::CylinderCooling { + namespace path ::ConjugateHeatTransfer::examples + Kratos::AddNamespace [namespace current] -proc ::ConjugateHeatTransfer::examples::CylinderCooling {args} { +} + +proc ::ConjugateHeatTransfer::examples::CylinderCooling::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawCylinderCoolingGeometry$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension AssignGroups$::Model::SpatialDimension TreeAssignation$::Model::SpatialDimension AssignMeshSizes$::Model::SpatialDimension @@ -19,7 +24,7 @@ proc ::ConjugateHeatTransfer::examples::CylinderCooling {args} { # Draw Geometry -proc ConjugateHeatTransfer::examples::DrawCylinderCoolingGeometry2D {args} { +proc ::ConjugateHeatTransfer::examples::CylinderCooling::DrawGeometry2D {args} { Kratos::ResetModel GiD_Layers create Fluid GiD_Layers create Cylinder @@ -63,12 +68,12 @@ proc ConjugateHeatTransfer::examples::DrawCylinderCoolingGeometry2D {args} { GiD_Process Mescape Geometry Create Object CirclePNR $circle_center_x $circle_center_y $circle_center_z 0.0 0.0 1.0 $center_radius escape } -proc ConjugateHeatTransfer::examples::DrawCylinderCoolingGeometry3D {args} { +proc ::ConjugateHeatTransfer::examples::CylinderCooling::DrawGeometry3D {args} { # To be implemented } # Groups assign -proc ConjugateHeatTransfer::examples::AssignGroups2D {args} { +proc ::ConjugateHeatTransfer::examples::CylinderCooling::AssignGroups2D {args} { # Create the groups for the fluid GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -104,12 +109,12 @@ proc ConjugateHeatTransfer::examples::AssignGroups2D {args} { GiD_EntitiesGroups assign Solid_Interface lines 6 } -proc ConjugateHeatTransfer::examples::AssignGroups3D {args} { +proc ::ConjugateHeatTransfer::examples::CylinderCooling::AssignGroups3D {args} { # To be implemented } # Tree assign -proc ConjugateHeatTransfer::examples::TreeAssignation2D {args} { +proc ::ConjugateHeatTransfer::examples::CylinderCooling::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -123,7 +128,7 @@ proc ConjugateHeatTransfer::examples::TreeAssignation2D {args} { ## Fluid parts set parts [spdAux::getRoute "FLParts"] set fluidNode [customlib::AddConditionGroupOnXPath $parts Fluid] - set props [list Element Monolithic$nd ConstitutiveLaw Newtonian DENSITY 1.0 DYNAMIC_VISCOSITY 0.00125 CONDUCTIVITY 0.625 SPECIFIC_HEAT 1000.0] + set props [list Element Monolithic$nd ConstitutiveLaw Newtonian2DLaw DENSITY 1.0 DYNAMIC_VISCOSITY 0.00125 CONDUCTIVITY 0.625 SPECIFIC_HEAT 1000.0] spdAux::SetValuesOnBaseNode $fluidNode $props ## Thermal parts @@ -211,12 +216,12 @@ proc ConjugateHeatTransfer::examples::TreeAssignation2D {args} { spdAux::RequestRefresh } -proc ConjugateHeatTransfer::examples::TreeAssignation3D {args} { +proc ::ConjugateHeatTransfer::examples::CylinderCooling::TreeAssignation3D {args} { # TODO: To be implemented } # Assign mesh settings and sizes -proc ConjugateHeatTransfer::examples::AssignMeshSizes2D {args} { +proc ::ConjugateHeatTransfer::examples::CylinderCooling::AssignMeshSizes2D {args} { # Assign centered structured triangular mesh in the solid cylinder GiD_Process Mescape Meshing ElemType Triangle 2 escape escape GiD_Process MEscape Meshing CenterStruct Assign 0.0 0.5 10 110 2 escape escape @@ -231,6 +236,6 @@ proc ConjugateHeatTransfer::examples::AssignMeshSizes2D {args} { GiD_Process Mescape Meshing Structured Lines 120 6 escape escape } -proc ConjugateHeatTransfer::examples::AssignMeshSizes3D {args} { +proc ::ConjugateHeatTransfer::examples::CylinderCooling::AssignMeshSizes3D {args} { # To be implemented } \ No newline at end of file diff --git a/kratos.gid/apps/ConjugateHeatTransfer/examples/HeatedSquare.tcl b/kratos.gid/apps/ConjugateHeatTransfer/examples/HeatedSquare.tcl index c6c824f1c..eb6ffc407 100644 --- a/kratos.gid/apps/ConjugateHeatTransfer/examples/HeatedSquare.tcl +++ b/kratos.gid/apps/ConjugateHeatTransfer/examples/HeatedSquare.tcl @@ -1,11 +1,15 @@ +namespace eval ::ConjugateHeatTransfer::examples::HeatedSquare { + namespace path ::ConjugateHeatTransfer::examples + Kratos::AddNamespace [namespace current] +} -proc ::ConjugateHeatTransfer::examples::HeatedSquare {args} { +proc ::ConjugateHeatTransfer::examples::HeatedSquare::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawSquareGeometry$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension AssignGroups$::Model::SpatialDimension TreeAssignation$::Model::SpatialDimension @@ -15,17 +19,16 @@ proc ::ConjugateHeatTransfer::examples::HeatedSquare {args} { GiD_Process 'Zoom Frame } - # Draw Geometry -proc ConjugateHeatTransfer::examples::DrawSquareGeometry3D {args} { +proc ::ConjugateHeatTransfer::examples::HeatedSquare::DrawGeometry3D {args} { # DrawSquareGeometry2D # 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 # GiD_Layers edit opaque Fluid 0 - # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate obj x -150 y -30 escape escape + # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate objaxes x -150 y -30 escape escape } -proc ConjugateHeatTransfer::examples::DrawSquareGeometry2D {args} { +proc ::ConjugateHeatTransfer::examples::HeatedSquare::DrawGeometry2D {args} { Kratos::ResetModel GiD_Layers create Fluid GiD_Layers create HeatSource @@ -72,7 +75,7 @@ proc ConjugateHeatTransfer::examples::DrawSquareGeometry2D {args} { # Group assign -proc ConjugateHeatTransfer::examples::AssignGroups2D {args} { +proc ::ConjugateHeatTransfer::examples::HeatedSquare::AssignGroups2D {args} { # Create the groups for the fluid GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -119,7 +122,7 @@ proc ConjugateHeatTransfer::examples::AssignGroups2D {args} { GiD_Groups edit color Heating_Left_Wall "#3b3b3bff" GiD_EntitiesGroups assign Heating_Left_Wall lines 8 } -proc ConjugateHeatTransfer::examples::AssignGroups3D {args} { +proc ::ConjugateHeatTransfer::examples::HeatedSquare::AssignGroups3D {args} { # Create the groups # GiD_Groups create Fluid # GiD_Groups edit color Fluid "#26d1a8ff" @@ -143,11 +146,11 @@ proc ConjugateHeatTransfer::examples::AssignGroups3D {args} { } # Tree assign -proc ConjugateHeatTransfer::examples::TreeAssignation3D {args} { +proc ::ConjugateHeatTransfer::examples::HeatedSquare::TreeAssignation3D {args} { # TreeAssignationCylinderInFlow2D # AddCuts } -proc ConjugateHeatTransfer::examples::TreeAssignation2D {args} { +proc ::ConjugateHeatTransfer::examples::HeatedSquare::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -161,16 +164,9 @@ proc ConjugateHeatTransfer::examples::TreeAssignation2D {args} { # Fluid Parts set parts [spdAux::getRoute "FLParts"] set fluidNode [customlib::AddConditionGroupOnXPath $parts Fluid] - set props [list Element Monolithic$nd Material Water ConstitutiveLaw Newtonian] - foreach {prop val} $props { - set propnode [$fluidNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Fluid $prop" - } - } - + set props [list Element Monolithic$nd Material Water ConstitutiveLaw Newtonian2DLaw] + spdAux::SetValuesOnBaseNode $fluidNode $props + # Fluid conditions set fluid_conditions [spdAux::getRoute "FLBC"] set fluid_noslip "$fluid_conditions/condition\[@n='NoSlip$nd'\]" diff --git a/kratos.gid/apps/ConjugateHeatTransfer/examples/examples.tcl b/kratos.gid/apps/ConjugateHeatTransfer/examples/examples.tcl index 4691a7fa4..8b7683d5c 100644 --- a/kratos.gid/apps/ConjugateHeatTransfer/examples/examples.tcl +++ b/kratos.gid/apps/ConjugateHeatTransfer/examples/examples.tcl @@ -1,19 +1,5 @@ -namespace eval ConjugateHeatTransfer::examples { +namespace eval ::ConjugateHeatTransfer::examples { + namespace path ::ConjugateHeatTransfer + Kratos::AddNamespace [namespace current] } - -proc ConjugateHeatTransfer::examples::Init { } { - uplevel #0 [list source [file join $::ConjugateHeatTransfer::dir examples HeatedSquare.tcl]] - uplevel #0 [list source [file join $::ConjugateHeatTransfer::dir examples cylinder_cooling.tcl]] - uplevel #0 [list source [file join $::ConjugateHeatTransfer::dir examples BFS.tcl]] -} - -proc ConjugateHeatTransfer::examples::UpdateMenus { } { - GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Heated square" ] 8 PRE [list ::ConjugateHeatTransfer::examples::HeatedSquare] "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Cylinder cooling" ] 8 PRE [list ::ConjugateHeatTransfer::examples::CylinderCooling] "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "BFS" ] 8 PRE [list ::ConjugateHeatTransfer::examples::BFS] "" "" insertafter = - GiDMenu::UpdateMenus -} - -ConjugateHeatTransfer::examples::Init \ No newline at end of file diff --git a/kratos.gid/apps/ConjugateHeatTransfer/examples/examples.xml b/kratos.gid/apps/ConjugateHeatTransfer/examples/examples.xml new file mode 100644 index 000000000..e6ccdce49 --- /dev/null +++ b/kratos.gid/apps/ConjugateHeatTransfer/examples/examples.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/ConjugateHeatTransfer/images/BFS2D.png b/kratos.gid/apps/ConjugateHeatTransfer/images/BFS2D.png new file mode 100644 index 000000000..2c427e8f1 Binary files /dev/null and b/kratos.gid/apps/ConjugateHeatTransfer/images/BFS2D.png differ diff --git a/kratos.gid/apps/ConjugateHeatTransfer/images/CylinderCooling2D.png b/kratos.gid/apps/ConjugateHeatTransfer/images/CylinderCooling2D.png new file mode 100644 index 000000000..b159a58f0 Binary files /dev/null and b/kratos.gid/apps/ConjugateHeatTransfer/images/CylinderCooling2D.png differ diff --git a/kratos.gid/apps/ConjugateHeatTransfer/images/HeatedSquare2D.png b/kratos.gid/apps/ConjugateHeatTransfer/images/HeatedSquare2D.png new file mode 100644 index 000000000..855e5845a Binary files /dev/null and b/kratos.gid/apps/ConjugateHeatTransfer/images/HeatedSquare2D.png differ diff --git a/kratos.gid/apps/ConjugateHeatTransfer/python/KratosConjugateHeatTransfer.py b/kratos.gid/apps/ConjugateHeatTransfer/python/KratosConjugateHeatTransfer.py deleted file mode 100644 index 83f349e7c..000000000 --- a/kratos.gid/apps/ConjugateHeatTransfer/python/KratosConjugateHeatTransfer.py +++ /dev/null @@ -1,34 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -import KratosMultiphysics.FluidDynamicsApplication -from KratosMultiphysics.ConvectionDiffusionApplication.convection_diffusion_analysis import ConvectionDiffusionAnalysis - -import sys -import time - -class ConvectionDiffusionAnalysisWithFlush(ConvectionDiffusionAnalysis): - - def __init__(self,model,project_parameters,flush_frequency=10.0): - super(ConvectionDiffusionAnalysisWithFlush,self).__init__(model,project_parameters) - - self.flush_frequency = flush_frequency - self.last_flush = time.time() - - def FinalizeSolutionStep(self): - super(ConvectionDiffusionAnalysisWithFlush,self).FinalizeSolutionStep() - - if self.parallel_type == "OpenMP": - now = time.time() - if now - self.last_flush > self.flush_frequency: - sys.stdout.flush() - self.last_flush = now - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = ConvectionDiffusionAnalysisWithFlush(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/ConjugateHeatTransfer/python/MainKratos.py b/kratos.gid/apps/ConjugateHeatTransfer/python/MainKratos.py deleted file mode 100644 index 83f349e7c..000000000 --- a/kratos.gid/apps/ConjugateHeatTransfer/python/MainKratos.py +++ /dev/null @@ -1,34 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -import KratosMultiphysics.FluidDynamicsApplication -from KratosMultiphysics.ConvectionDiffusionApplication.convection_diffusion_analysis import ConvectionDiffusionAnalysis - -import sys -import time - -class ConvectionDiffusionAnalysisWithFlush(ConvectionDiffusionAnalysis): - - def __init__(self,model,project_parameters,flush_frequency=10.0): - super(ConvectionDiffusionAnalysisWithFlush,self).__init__(model,project_parameters) - - self.flush_frequency = flush_frequency - self.last_flush = time.time() - - def FinalizeSolutionStep(self): - super(ConvectionDiffusionAnalysisWithFlush,self).FinalizeSolutionStep() - - if self.parallel_type == "OpenMP": - now = time.time() - if now - self.last_flush > self.flush_frequency: - sys.stdout.flush() - self.last_flush = now - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = ConvectionDiffusionAnalysisWithFlush(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/ConjugateHeatTransfer/start.tcl b/kratos.gid/apps/ConjugateHeatTransfer/start.tcl index ce5fb5351..eb8a9f5dc 100644 --- a/kratos.gid/apps/ConjugateHeatTransfer/start.tcl +++ b/kratos.gid/apps/ConjugateHeatTransfer/start.tcl @@ -1,67 +1,25 @@ namespace eval ::ConjugateHeatTransfer { + Kratos::AddNamespace [namespace current] + # Variable declaration - variable id variable dir - variable prefix - variable attributes - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::ConjugateHeatTransfer::Init { } { +proc ::ConjugateHeatTransfer::Init { app } { # Variable initialization - variable id variable dir - variable prefix - variable kratos_name - variable attributes - - set kratos_name ConvectionDiffusionApplication + variable _app - set id ConjugateHeatTransfer + + set _app $app set dir [apps::getMyDir "ConjugateHeatTransfer"] - set prefix ConjugateHeatTransfer - - apps::LoadAppById "Buoyancy" - - # Intervals - dict set attributes UseIntervals 1 - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - - set ::Model::ValidSpatialDimensions [list 2D 3D] - LoadMyFiles -} - -proc ::ConjugateHeatTransfer::LoadMyFiles { } { - variable id - variable dir + ::ConjugateHeatTransfer::xml::Init + ::ConjugateHeatTransfer::write::Init - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - if {[apps::getActiveAppId] eq $id} { - uplevel #0 [list source [file join $dir examples examples.tcl]] - } } - -proc ::ConjugateHeatTransfer::CustomToolbarItems { } { - variable dir - if {$::Model::SpatialDimension eq "2D"} { - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::ConjugateHeatTransfer::examples::HeatedSquare] [= "Example\nSquare heat source"] - Kratos::ToolbarAddItem "ExampleCylinderCooling" "example.png" [list -np- ::ConjugateHeatTransfer::examples::CylinderCooling] [= "Example\nCylinder cooling (Re = 100 - Pr = 2)"] - Kratos::ToolbarAddItem "ExampleBFS" "example.png" [list -np- ::ConjugateHeatTransfer::examples::BFS] [= "Example\nBackward Facing Step (BFS)"] - } -} - -proc ::ConjugateHeatTransfer::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value -} -proc ::ConjugateHeatTransfer::CustomMenus { } { - ConjugateHeatTransfer::examples::UpdateMenus -} - -::ConjugateHeatTransfer::Init diff --git a/kratos.gid/apps/ConjugateHeatTransfer/write/write.tcl b/kratos.gid/apps/ConjugateHeatTransfer/write/write.tcl index 0f97f56c7..b9bd51d83 100644 --- a/kratos.gid/apps/ConjugateHeatTransfer/write/write.tcl +++ b/kratos.gid/apps/ConjugateHeatTransfer/write/write.tcl @@ -1,4 +1,6 @@ -namespace eval ConjugateHeatTransfer::write { +namespace eval ::ConjugateHeatTransfer::write { + namespace path ::ConjugateHeatTransfer + Kratos::AddNamespace [namespace current] # Namespace variables declaration variable ConjugateHeatTransferConditions variable writeCoordinatesByGroups @@ -7,16 +9,17 @@ namespace eval ConjugateHeatTransfer::write { variable solid_domain_solver_settings } -proc ConjugateHeatTransfer::write::Init { } { +proc ::ConjugateHeatTransfer::write::Init { } { # Namespace variables initialization variable ConjugateHeatTransferConditions set ConjugateHeatTransferConditions(temp) 0 unset ConjugateHeatTransferConditions(temp) - SetAttribute main_script_file "MainKratos.py" - #SetAttribute materials_file "ConjugateHeatTransferMaterials.json" - SetAttribute properties_location json - SetAttribute model_part_name ThermalModelPart + SetAttribute main_launch_file [::ConjugateHeatTransfer::GetAttribute main_launch_file] + SetAttribute properties_location [::ConjugateHeatTransfer::GetWriteProperty properties_location] + SetAttribute model_part_name [::ConjugateHeatTransfer::GetWriteProperty model_part_name] + + SetAttribute coordinates [::ConjugateHeatTransfer::GetWriteProperty coordinates] SetAttribute fluid_mdpa_suffix Fluid SetAttribute solid_mdpa_suffix Solid @@ -28,7 +31,7 @@ proc ConjugateHeatTransfer::write::Init { } { } # Events -proc ConjugateHeatTransfer::write::writeModelPartEvent { } { +proc ::ConjugateHeatTransfer::write::writeModelPartEvent { } { # Validation set err [Validate] if {$err ne ""} {error $err} @@ -36,29 +39,24 @@ proc ConjugateHeatTransfer::write::writeModelPartEvent { } { set filename [Kratos::GetModelName] # Buoyancy mdpa - Fluid::write::SetAttribute thermal_initial_cnd_un "Buoyancy_CNVDFFNodalConditions" - Fluid::write::SetAttribute thermal_bc_un "Buoyancy_CNVDFFBC" + ::ConjugateHeatTransfer::write::PrepareBuoyancy write::writeAppMDPA Buoyancy write::RenameFileInModel "$filename.mdpa" "${filename}_[GetAttribute fluid_mdpa_suffix].mdpa" # Convection diffusion mdpa ConvectionDiffusion::write::Init - ConvectionDiffusion::write::SetCoordinatesByGroups 1 + ConvectionDiffusion::write::SetAttribute writeCoordinatesByGroups [GetAttribute coordinates] write::writeAppMDPA ConvectionDiffusion write::RenameFileInModel "$filename.mdpa" "${filename}_[GetAttribute solid_mdpa_suffix].mdpa" } -proc ConjugateHeatTransfer::write::writeCustomFilesEvent { } { +proc ::ConjugateHeatTransfer::write::writeCustomFilesEvent { } { # Materials - WriteMaterialsFile False True - - # Main python script - set orig_name [GetAttribute main_script_file] - write::CopyFileIntoModel [file join "python" $orig_name ] - write::RenameFileInModel $orig_name "MainKratos.py" + WriteMaterialsFile + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] } -proc ConjugateHeatTransfer::write::Validate {} { +proc ::ConjugateHeatTransfer::write::Validate {} { set err "" set root [customlib::GetBaseRoot] @@ -66,53 +64,48 @@ proc ConjugateHeatTransfer::write::Validate {} { } -proc ConjugateHeatTransfer::write::PrepareBuoyancy { } { +proc ::ConjugateHeatTransfer::write::PrepareBuoyancy { } { Buoyancy::write::Init Fluid::write::SetAttribute thermal_bc_un Buoyancy_CNVDFFBC Fluid::write::SetAttribute thermal_initial_cnd_un Buoyancy_CNVDFFNodalConditions - Fluid::write::SetCoordinatesByGroups 1 + Fluid::write::SetCoordinatesByGroups [GetAttribute coordinates] } -proc ConjugateHeatTransfer::write::WriteMaterialsFile { {write_const_law True} {include_modelpart_name True} } { +proc ::ConjugateHeatTransfer::write::WriteMaterialsFile { {write_const_law True} {include_modelpart_name True} } { Buoyancy::write::WriteMaterialsFile $write_const_law $include_modelpart_name - ConvectionDiffusion::write::WriteMaterialsFile $write_const_law $include_modelpart_name + ConvectionDiffusion::write::WriteMaterialsFile False $include_modelpart_name } -proc Buoyancy::write::GetModelPartName { } { - return FluidThermalModelPart -} -proc ConjugateHeatTransfer::write::GetAttribute {att} { +proc ::ConjugateHeatTransfer::write::GetAttribute {att} { variable writeAttributes return [dict get $writeAttributes $att] } -proc ConjugateHeatTransfer::write::GetAttributes {} { +proc ::ConjugateHeatTransfer::write::GetAttributes {} { variable writeAttributes return $writeAttributes } -proc ConjugateHeatTransfer::write::SetAttribute {att val} { +proc ::ConjugateHeatTransfer::write::SetAttribute {att val} { variable writeAttributes dict set writeAttributes $att $val } -proc ConjugateHeatTransfer::write::AddAttribute {att val} { +proc ::ConjugateHeatTransfer::write::AddAttribute {att val} { variable writeAttributes dict lappend writeAttributes $att $val } -proc ConjugateHeatTransfer::write::AddAttributes {configuration} { +proc ::ConjugateHeatTransfer::write::AddAttributes {configuration} { variable writeAttributes set writeAttributes [dict merge $writeAttributes $configuration] } -proc ConjugateHeatTransfer::write::AddValidApps {appid} { +proc ::ConjugateHeatTransfer::write::AddValidApps {appid} { AddAttribute validApps $appid } -proc ConjugateHeatTransfer::write::SetCoordinatesByGroups {value} { +proc ::ConjugateHeatTransfer::write::SetCoordinatesByGroups {value} { SetAttribute writeCoordinatesByGroups $value -} - -ConjugateHeatTransfer::write::Init +} \ No newline at end of file diff --git a/kratos.gid/apps/ConjugateHeatTransfer/write/writeProjectParameters.tcl b/kratos.gid/apps/ConjugateHeatTransfer/write/writeProjectParameters.tcl index 81ca1f93d..84880b5b2 100644 --- a/kratos.gid/apps/ConjugateHeatTransfer/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/ConjugateHeatTransfer/write/writeProjectParameters.tcl @@ -4,6 +4,9 @@ proc ::ConjugateHeatTransfer::write::getParametersDict { } { set projectParametersDict [dict create] + # Analysis stage field + dict set projectParametersDict analysis_stage "KratosMultiphysics.ConvectionDiffusionApplication.convection_diffusion_analysis" + # Set the problem data section dict set projectParametersDict problem_data [write::GetDefaultProblemDataDict] @@ -20,16 +23,15 @@ proc ::ConjugateHeatTransfer::write::getParametersDict { } { dict set projectParametersDict processes [ConjugateHeatTransfer::write::GetProcessList] return $projectParametersDict - } -proc ConjugateHeatTransfer::write::writeParametersEvent { } { +proc ::ConjugateHeatTransfer::write::writeParametersEvent { } { set projectParametersDict [getParametersDict] write::SetParallelismConfiguration write::WriteJSON $projectParametersDict } -proc ConjugateHeatTransfer::write::GetSolverSettingsDict {} { +proc ::ConjugateHeatTransfer::write::GetSolverSettingsDict {} { set solver_settings_dict [dict create] dict set solver_settings_dict solver_type "conjugate_heat_transfer" set nDim [expr [string range [write::getValue nDim] 0 0]] @@ -68,7 +70,7 @@ proc ConjugateHeatTransfer::write::GetSolverSettingsDict {} { return $solver_settings_dict } -proc ConjugateHeatTransfer::write::GetProcessList { } { +proc ::ConjugateHeatTransfer::write::GetProcessList { } { set processes [dict create] # Get and add fluid processes @@ -104,9 +106,9 @@ proc write::GetDefaultOutputProcessDict { {appid ""} } { return $outputProcessesDict } -proc ConjugateHeatTransfer::write::GetOutputProcessesList { } { +proc ::ConjugateHeatTransfer::write::GetOutputProcessesList { } { set output_process [dict create] - + set need_gid [write::getValue EnableGiDOutput] if {[write::isBooleanTrue $need_gid]} { # Set a different output_name for the fluid and solid domains @@ -129,7 +131,7 @@ proc ConjugateHeatTransfer::write::GetOutputProcessesList { } { lappend gid_output_processes_list $solid_output dict set output_process gid_output_processes $gid_output_processes_list } - + set need_vtk [write::getValue EnableVtkOutput] if {[write::isBooleanTrue $need_vtk]} { # Set a different output_name for the fluid and solid domains @@ -154,22 +156,22 @@ proc ConjugateHeatTransfer::write::GetOutputProcessesList { } { return $output_process } -proc ConjugateHeatTransfer::write::InitExternalProjectParameters { } { +proc ::ConjugateHeatTransfer::write::InitExternalProjectParameters { } { # Buoyancy section apps::setActiveAppSoft Buoyancy write::initWriteConfiguration [Buoyancy::write::GetAttributes] - ConvectionDiffusion::write::SetAttribute nodal_conditions_un Buoyancy_CNVDFFNodalConditions - ConvectionDiffusion::write::SetAttribute conditions_un Buoyancy_CNVDFFBC - ConvectionDiffusion::write::SetAttribute thermal_bc_un Buoyancy_CNVDFFBC - ConvectionDiffusion::write::SetAttribute model_part_name FluidThermalModelPart + ::ConvectionDiffusion::write::SetAttribute nodal_conditions_un Buoyancy_CNVDFFNodalConditions + ::ConvectionDiffusion::write::SetAttribute conditions_un Buoyancy_CNVDFFBC + ::ConvectionDiffusion::write::SetAttribute thermal_bc_un Buoyancy_CNVDFFBC + ::ConvectionDiffusion::write::SetAttribute model_part_name FluidThermalModelPart set ConjugateHeatTransfer::write::fluid_domain_solver_settings [Buoyancy::write::getParametersDict] # Heating section apps::setActiveAppSoft ConvectionDiffusion - ConvectionDiffusion::write::SetAttribute nodal_conditions_un CNVDFFNodalConditions - ConvectionDiffusion::write::SetAttribute conditions_un CNVDFFBC - ConvectionDiffusion::write::SetAttribute model_part_name ThermalModelPart - ConvectionDiffusion::write::SetAttribute thermal_bc_un CNVDFFBC + ::ConvectionDiffusion::write::SetAttribute nodal_conditions_un CNVDFFNodalConditions + ::ConvectionDiffusion::write::SetAttribute conditions_un CNVDFFBC + ::ConvectionDiffusion::write::SetAttribute model_part_name ThermalModelPart + ::ConvectionDiffusion::write::SetAttribute thermal_bc_un CNVDFFBC write::initWriteConfiguration [ConvectionDiffusion::write::GetAttributes] set ConjugateHeatTransfer::write::solid_domain_solver_settings [ConvectionDiffusion::write::getParametersDict] diff --git a/kratos.gid/apps/ConjugateHeatTransfer/xml/Main.spd b/kratos.gid/apps/ConjugateHeatTransfer/xml/Main.spd index e34dca924..29b8e7002 100644 --- a/kratos.gid/apps/ConjugateHeatTransfer/xml/Main.spd +++ b/kratos.gid/apps/ConjugateHeatTransfer/xml/Main.spd @@ -6,7 +6,7 @@ - + diff --git a/kratos.gid/apps/ConjugateHeatTransfer/xml/Processes.xml b/kratos.gid/apps/ConjugateHeatTransfer/xml/Processes.xml deleted file mode 100644 index d71f2875a..000000000 --- a/kratos.gid/apps/ConjugateHeatTransfer/xml/Processes.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/kratos.gid/apps/ConjugateHeatTransfer/xml/XmlController.tcl b/kratos.gid/apps/ConjugateHeatTransfer/xml/XmlController.tcl index de94a0812..ca2a967f9 100644 --- a/kratos.gid/apps/ConjugateHeatTransfer/xml/XmlController.tcl +++ b/kratos.gid/apps/ConjugateHeatTransfer/xml/XmlController.tcl @@ -1,4 +1,6 @@ -namespace eval ConjugateHeatTransfer::xml { +namespace eval ::ConjugateHeatTransfer::xml { + namespace path ::ConjugateHeatTransfer + Kratos::AddNamespace [namespace current] # Namespace variables declaration variable dir } @@ -8,16 +10,13 @@ proc ConjugateHeatTransfer::xml::Init { } { variable dir Model::InitVariables dir $ConjugateHeatTransfer::dir - Model::getProcesses Processes.xml Model::getConditions Conditions.xml - Model::getMaterials "../../ConvectionDiffusion/xml/Materials.xml" - Model::getConstitutiveLaws "../../ConvectionDiffusion/xml/ConstitutiveLaws.xml" } proc ConjugateHeatTransfer::xml::getUniqueName {name} { - return ${::ConjugateHeatTransfer::prefix}${name} + return [::ConjugateHeatTransfer::GetAttribute prefix]${name} } proc ::ConjugateHeatTransfer::xml::MultiAppEvent {args} { @@ -44,6 +43,4 @@ proc ConjugateHeatTransfer::xml::CustomTree { args } { if {$result_node ne "" } {$result_node delete} set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute CNVDFFBC]/condition\[@n = 'FluidThermalInterface3D'\]"] if {$result_node ne "" } {$result_node delete} -} - -ConjugateHeatTransfer::xml::Init +} \ No newline at end of file diff --git a/kratos.gid/apps/ConvectionDiffusion/app.json b/kratos.gid/apps/ConvectionDiffusion/app.json new file mode 100644 index 000000000..840ade938 --- /dev/null +++ b/kratos.gid/apps/ConvectionDiffusion/app.json @@ -0,0 +1,48 @@ +{ + "id": "ConvectionDiffusion", + "name": "Convection Diffusion", + "prefix": "CNVDFF", + "themed": false, + "kratos_name": "ConvectionDiffusionApplication", + "python_packages": [ + "KratosConvectionDiffusionApplication" + ], + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/HeatedSquare.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script":"::ConvectionDiffusion::Init", + "requeriments":{ + "apps":[], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "unique_names": { + "parts": "CNVDFFParts", + "nodal_conditions": "CNVDFFNodalConditions", + "conditions": "CNVDFFBC", + "materials": "CNVDFFMaterials" + }, + "write": { + "coordinates": "all", + "materials_file": "ConvectionDiffusionMaterials.json", + "properties_location": "json", + "model_part_name": "ThermalModelPart", + "output_model_part_name": "" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} diff --git a/kratos.gid/apps/ConvectionDiffusion/examples/HeatedSquare.tcl b/kratos.gid/apps/ConvectionDiffusion/examples/HeatedSquare.tcl index db97ece31..e948740f3 100644 --- a/kratos.gid/apps/ConvectionDiffusion/examples/HeatedSquare.tcl +++ b/kratos.gid/apps/ConvectionDiffusion/examples/HeatedSquare.tcl @@ -1,11 +1,16 @@ +namespace eval ::ConvectionDiffusion::examples::HeatedSquare { + namespace path ::ConvectionDiffusion::examples + Kratos::AddNamespace [namespace current] -proc ::ConvectionDiffusion::examples::HeatedSquare {args} { +} + +proc ::ConvectionDiffusion::examples::HeatedSquare::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawSquareGeometry$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension AssignGroups$::Model::SpatialDimension TreeAssignation$::Model::SpatialDimension @@ -17,15 +22,15 @@ proc ::ConvectionDiffusion::examples::HeatedSquare {args} { # Draw Geometry -proc ConvectionDiffusion::examples::DrawSquareGeometry3D {args} { +proc ::ConvectionDiffusion::examples::HeatedSquare::DrawGeometry3D {args} { # DrawSquareGeometry2D # 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 # GiD_Layers edit opaque Fluid 0 - # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate obj x -150 y -30 escape escape + # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate objaxes x -150 y -30 escape escape } -proc ConvectionDiffusion::examples::DrawSquareGeometry2D {args} { +proc ::ConvectionDiffusion::examples::HeatedSquare::DrawGeometry2D {args} { Kratos::ResetModel GiD_Layers create Fluid GiD_Layers edit to_use Fluid @@ -54,7 +59,7 @@ proc ConvectionDiffusion::examples::DrawSquareGeometry2D {args} { # Group assign -proc ConvectionDiffusion::examples::AssignGroups2D {args} { +proc ::ConvectionDiffusion::examples::HeatedSquare::AssignGroups2D {args} { # Create the groups GiD_Groups create Body GiD_Groups edit color Body "#26d1a8ff" @@ -77,7 +82,7 @@ proc ConvectionDiffusion::examples::AssignGroups2D {args} { GiD_EntitiesGroups assign Bottom_Wall lines 4 } -proc ConvectionDiffusion::examples::AssignGroups3D {args} { +proc ::ConvectionDiffusion::examples::HeatedSquare::AssignGroups3D {args} { # Create the groups # GiD_Groups create Fluid # GiD_Groups edit color Fluid "#26d1a8ff" @@ -101,11 +106,11 @@ proc ConvectionDiffusion::examples::AssignGroups3D {args} { } # Tree assign -proc ConvectionDiffusion::examples::TreeAssignation3D {args} { +proc ::ConvectionDiffusion::examples::HeatedSquare::TreeAssignation3D {args} { # TreeAssignationCylinderInFlow2D # AddCuts } -proc ConvectionDiffusion::examples::TreeAssignation2D {args} { +proc ::ConvectionDiffusion::examples::HeatedSquare::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] diff --git a/kratos.gid/apps/ConvectionDiffusion/examples/examples.tcl b/kratos.gid/apps/ConvectionDiffusion/examples/examples.tcl index e46658a79..3391b8373 100644 --- a/kratos.gid/apps/ConvectionDiffusion/examples/examples.tcl +++ b/kratos.gid/apps/ConvectionDiffusion/examples/examples.tcl @@ -1,18 +1,5 @@ -namespace eval ConvectionDiffusion::examples { +namespace eval ::ConvectionDiffusion::examples { + namespace path ::ConvectionDiffusion + Kratos::AddNamespace [namespace current] } - -proc ConvectionDiffusion::examples::Init { } { - uplevel #0 [list source [file join $::ConvectionDiffusion::dir examples HeatedSquare.tcl]] - #uplevel #0 [list source [file join $::FSI::dir examples HorizontalFlexibleBar.tcl]] -} - -proc ConvectionDiffusion::examples::UpdateMenus { } { - GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter = - if {$::Model::SpatialDimension eq "2D"} { - GiDMenu::InsertOption "Kratos" [list "Cylinder in air flow" ] 8 PRE [list ::ConvectionDiffusion::examples::HeatedSquare] "" "" insertafter = - } - GiDMenu::UpdateMenus -} - -ConvectionDiffusion::examples::Init \ No newline at end of file diff --git a/kratos.gid/apps/ConvectionDiffusion/examples/examples.xml b/kratos.gid/apps/ConvectionDiffusion/examples/examples.xml new file mode 100644 index 000000000..69eb772c9 --- /dev/null +++ b/kratos.gid/apps/ConvectionDiffusion/examples/examples.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/ConvectionDiffusion/images/HeatedSquare2D.png b/kratos.gid/apps/ConvectionDiffusion/images/HeatedSquare2D.png new file mode 100644 index 000000000..505987ac7 Binary files /dev/null and b/kratos.gid/apps/ConvectionDiffusion/images/HeatedSquare2D.png differ diff --git a/kratos.gid/apps/ConvectionDiffusion/python/KratosConvectionDiffusion.py b/kratos.gid/apps/ConvectionDiffusion/python/KratosConvectionDiffusion.py deleted file mode 100644 index ba1fa63f7..000000000 --- a/kratos.gid/apps/ConvectionDiffusion/python/KratosConvectionDiffusion.py +++ /dev/null @@ -1,34 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -import KratosMultiphysics.ConvectionDiffusionApplication - -from KratosMultiphysics.ConvectionDiffusionApplication.convection_diffusion_analysis import ConvectionDiffusionAnalysis - -import sys -import time - -class ConvectionDiffusionAnalysisWithFlush(ConvectionDiffusionAnalysis): - - def __init__(self,model,project_parameters,flush_frequency=10.0): - super(ConvectionDiffusionAnalysisWithFlush,self).__init__(model,project_parameters) - self.flush_frequency = flush_frequency - self.last_flush = time.time() - - def FinalizeSolutionStep(self): - super(ConvectionDiffusionAnalysisWithFlush,self).FinalizeSolutionStep() - - if self.parallel_type == "OpenMP": - now = time.time() - if now - self.last_flush > self.flush_frequency: - sys.stdout.flush() - self.last_flush = now - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = ConvectionDiffusionAnalysisWithFlush(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/ConvectionDiffusion/start.tcl b/kratos.gid/apps/ConvectionDiffusion/start.tcl index 5d4260ffe..aacd3fbfe 100644 --- a/kratos.gid/apps/ConvectionDiffusion/start.tcl +++ b/kratos.gid/apps/ConvectionDiffusion/start.tcl @@ -1,66 +1,23 @@ namespace eval ::ConvectionDiffusion { + Kratos::AddNamespace [namespace current] # Variable declaration - variable id variable dir - variable prefix - variable attributes - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::ConvectionDiffusion::Init { } { +proc ::ConvectionDiffusion::Init { app } { # Variable initialization - variable id + variable _app variable dir - variable prefix - variable attributes - variable kratos_name - set id ConvectionDiffusion - set kratos_name "ConvectionDiffusionApplication" + set _app $app set dir [apps::getMyDir "ConvectionDiffusion"] - set attributes [dict create] - - set prefix CNVDFF - set ::Model::ValidSpatialDimensions [list 2D 3D] - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - - dict set attributes UseIntervals 1 - - LoadMyFiles - #::spdAux::CreateDimensionWindow -} - -proc ::ConvectionDiffusion::LoadMyFiles { } { - variable id - variable dir - - #uplevel #0 [list source [file join $dir examples examples.tcl]] - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - if {[apps::getActiveAppId] eq $id} { - uplevel #0 [list source [file join $dir examples examples.tcl]] - } + + # XML init event + ::ConvectionDiffusion::xml::Init + ::ConvectionDiffusion::write::Init } - -proc ::ConvectionDiffusion::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value -} - -proc ::ConvectionDiffusion::CustomToolbarItems { } { - variable dir - if {$::Model::SpatialDimension eq "2D"} { - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::ConvectionDiffusion::examples::HeatedSquare] [= "Example\nSquare heat flow"] - } -} - -proc ::ConvectionDiffusion::CustomMenus { } { - #ConvectionDiffusion::examples::UpdateMenus -} - -::ConvectionDiffusion::Init diff --git a/kratos.gid/apps/ConvectionDiffusion/write/write.tcl b/kratos.gid/apps/ConvectionDiffusion/write/write.tcl index 4c2cff0b4..57b29657c 100644 --- a/kratos.gid/apps/ConvectionDiffusion/write/write.tcl +++ b/kratos.gid/apps/ConvectionDiffusion/write/write.tcl @@ -1,31 +1,34 @@ -namespace eval ConvectionDiffusion::write { +namespace eval ::ConvectionDiffusion::write { + namespace path ::ConvectionDiffusion + Kratos::AddNamespace [namespace current] # Namespace variables declaration variable ConvectionDiffusionConditions variable writeCoordinatesByGroups variable writeAttributes } -proc ConvectionDiffusion::write::Init { } { +proc ::ConvectionDiffusion::write::Init { } { # Namespace variables inicialization variable ConvectionDiffusionConditions set ConvectionDiffusionConditions(temp) 0 unset ConvectionDiffusionConditions(temp) - SetAttribute parts_un CNVDFFParts - SetAttribute nodal_conditions_un CNVDFFNodalConditions - SetAttribute conditions_un CNVDFFBC - SetAttribute materials_un FLMaterials - SetAttribute writeCoordinatesByGroups 0 + SetAttribute parts_un [::ConvectionDiffusion::GetUniqueName parts] + SetAttribute nodal_conditions_un [::ConvectionDiffusion::GetUniqueName nodal_conditions] + SetAttribute conditions_un [::ConvectionDiffusion::GetUniqueName conditions] + SetAttribute materials_un [::ConvectionDiffusion::GetUniqueName materials] + + SetAttribute writeCoordinatesByGroups [::ConvectionDiffusion::GetWriteProperty coordinates] SetAttribute validApps [list "ConvectionDiffusion"] - SetAttribute main_script_file "KratosConvectionDiffusion.py" - SetAttribute materials_file "ConvectionDiffusionMaterials.json" - SetAttribute properties_location json - SetAttribute model_part_name ThermalModelPart - SetAttribute output_model_part_name "thermal_computing_domain" + SetAttribute main_launch_file [::ConvectionDiffusion::GetAttribute main_launch_file] + SetAttribute materials_file [::ConvectionDiffusion::GetWriteProperty materials_file] + SetAttribute properties_location [::ConvectionDiffusion::GetWriteProperty properties_location] + SetAttribute model_part_name [::ConvectionDiffusion::GetWriteProperty model_part_name] + SetAttribute output_model_part_name [::ConvectionDiffusion::GetWriteProperty output_model_part_name] } # Events -proc ConvectionDiffusion::write::writeModelPartEvent { } { +proc ::ConvectionDiffusion::write::writeModelPartEvent { } { # Validation set err [Validate] if {$err ne ""} {error $err} @@ -37,44 +40,37 @@ proc ConvectionDiffusion::write::writeModelPartEvent { } { write::writeModelPartData writeProperties - # Materials (write materials in *.mdpa) - # write::writeMaterials [GetAttribute validApps] - # Nodal coordinates (1: Print only Fluid nodes | 0: the whole mesh ) - if {[GetAttribute writeCoordinatesByGroups]} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} + if {[GetAttribute writeCoordinatesByGroups] ne "all"} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} # Element connectivities (Groups on CNVDFFParts) write::writeElementConnectivities - + # Nodal conditions and conditions writeConditions - + # Custom SubmodelParts write::writeBasicSubmodelParts [getLastConditionId] - + # SubmodelParts writeMeshes - + } -proc ConvectionDiffusion::write::writeCustomFilesEvent { } { +proc ::ConvectionDiffusion::write::writeCustomFilesEvent { } { # Materials WriteMaterialsFile False - - # Main python script - set orig_name [GetAttribute main_script_file] - write::CopyFileIntoModel [file join "python" $orig_name ] - write::RenameFileInModel $orig_name "MainKratos.py" + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] } -proc ConvectionDiffusion::write::Validate {} { - set err "" +proc ::ConvectionDiffusion::write::Validate {} { + set err "" set root [customlib::GetBaseRoot] return $err } -proc ConvectionDiffusion::write::getLastConditionId { } { +proc ::ConvectionDiffusion::write::getLastConditionId { } { variable ConvectionDiffusionConditions set top 1 # Kratos::PrintArray ConvectionDiffusionConditions @@ -86,30 +82,30 @@ proc ConvectionDiffusion::write::getLastConditionId { } { return $top } -proc ConvectionDiffusion::write::WriteMaterialsFile { {write_const_law True} {include_modelpart_name True} } { +proc ::ConvectionDiffusion::write::WriteMaterialsFile { {write_const_law True} {include_modelpart_name True} } { set model_part_name "" if {[write::isBooleanTrue $include_modelpart_name]} {set model_part_name [GetAttribute model_part_name]} write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] $write_const_law $model_part_name } # MDPA Blocks -proc ConvectionDiffusion::write::writeProperties { } { +proc ::ConvectionDiffusion::write::writeProperties { } { # Begin Properties write::WriteString "Begin Properties 0" write::WriteString "End Properties" write::WriteString "" } -proc ConvectionDiffusion::write::writeConditions { } { +proc ::ConvectionDiffusion::write::writeConditions { } { writeBoundaryConditions } -proc ConvectionDiffusion::write::writeBoundaryConditions { } { +proc ::ConvectionDiffusion::write::writeBoundaryConditions { } { variable ConvectionDiffusionConditions set BCUN [GetAttribute conditions_un] # Write the conditions - set dict_group_intervals [write::writeConditions $BCUN] + set dict_group_intervals [::write::writeConditions $BCUN] set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute $BCUN]/condition/group" @@ -133,15 +129,15 @@ proc ConvectionDiffusion::write::writeBoundaryConditions { } { } } -proc ConvectionDiffusion::write::writeMeshes { } { +proc ::ConvectionDiffusion::write::writeMeshes { } { write::writePartSubModelPart write::writeNodalConditions [GetAttribute nodal_conditions_un] writeConditionsMesh } -proc ConvectionDiffusion::write::writeConditionsMesh { } { +proc ::ConvectionDiffusion::write::writeConditionsMesh { } { variable ConvectionDiffusionConditions - + set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group" set grouped_conditions [list ] @@ -176,42 +172,40 @@ proc ConvectionDiffusion::write::writeConditionsMesh { } { set end $ConvectionDiffusionConditions($groupid,final) dict set groups_dict $groupid what "Conditions" dict set groups_dict $groupid iniend [list $ini $end] - } + } write::writeConditionGroupedSubmodelParts $condid $groups_dict } } -proc ConvectionDiffusion::write::GetAttribute {att} { +proc ::ConvectionDiffusion::write::GetAttribute {att} { variable writeAttributes return [dict get $writeAttributes $att] } -proc ConvectionDiffusion::write::GetAttributes {} { +proc ::ConvectionDiffusion::write::GetAttributes {} { variable writeAttributes return $writeAttributes } -proc ConvectionDiffusion::write::SetAttribute {att val} { +proc ::ConvectionDiffusion::write::SetAttribute {att val} { variable writeAttributes dict set writeAttributes $att $val } -proc ConvectionDiffusion::write::AddAttribute {att val} { +proc ::ConvectionDiffusion::write::AddAttribute {att val} { variable writeAttributes dict lappend writeAttributes $att $val } -proc ConvectionDiffusion::write::AddAttributes {configuration} { +proc ::ConvectionDiffusion::write::AddAttributes {configuration} { variable writeAttributes set writeAttributes [dict merge $writeAttributes $configuration] } -proc ConvectionDiffusion::write::AddValidApps {appid} { +proc ::ConvectionDiffusion::write::AddValidApps {appid} { AddAttribute validApps $appid } -proc ConvectionDiffusion::write::SetCoordinatesByGroups {value} { +proc ::ConvectionDiffusion::write::SetCoordinatesByGroups {value} { SetAttribute writeCoordinatesByGroups $value } - -ConvectionDiffusion::write::Init diff --git a/kratos.gid/apps/ConvectionDiffusion/write/writeProjectParameters.tcl b/kratos.gid/apps/ConvectionDiffusion/write/writeProjectParameters.tcl index 378c7a8ed..4d9da36b6 100644 --- a/kratos.gid/apps/ConvectionDiffusion/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/ConvectionDiffusion/write/writeProjectParameters.tcl @@ -1,8 +1,11 @@ # Project Parameters proc ::ConvectionDiffusion::write::getParametersDict { } { - + set projectParametersDict [dict create] + # Analysis stage field + dict set projectParametersDict analysis_stage "KratosMultiphysics.ConvectionDiffusionApplication.convection_diffusion_analysis" + # Set the problem data section dict set projectParametersDict problem_data [ConvectionDiffusion::write::GetProblemDataDict] @@ -15,7 +18,7 @@ proc ::ConvectionDiffusion::write::getParametersDict { } { dict set processes constraints_process_list [write::getConditionsParametersDict [GetAttribute conditions_un]] # dict set processes fluxes_process_list [write::getConditionsParametersDict [GetAttribute conditions_un]] dict set processes list_other_processes [ConvectionDiffusion::write::getBodyForceProcessDictList] - + dict set projectParametersDict processes $processes # Output configuration dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict] @@ -32,7 +35,7 @@ proc ::ConvectionDiffusion::write::getParametersDict { } { return $projectParametersDict } -proc ConvectionDiffusion::write::GetProblemDataDict { } { +proc ::ConvectionDiffusion::write::GetProblemDataDict { } { # First section -> Problem data set problem_data_dict [dict create] @@ -67,18 +70,18 @@ proc ConvectionDiffusion::write::GetProblemDataDict { } { return $problem_data_dict } -proc ConvectionDiffusion::write::writeParametersEvent { } { +proc ::ConvectionDiffusion::write::writeParametersEvent { } { set projectParametersDict [getParametersDict] write::SetParallelismConfiguration write::WriteJSON $projectParametersDict } # Body force SubModelParts and Process collection -proc ConvectionDiffusion::write::getBodyForceProcessDictList {} { +proc ::ConvectionDiffusion::write::getBodyForceProcessDictList {} { set ret [list ] set model_part_name [GetAttribute model_part_name] - + foreach partgroup [write::getPartsSubModelPartId] { set value [write::getValue CNVDFFBodyForce BodyForceValue] set pdict [dict create] @@ -97,7 +100,7 @@ proc ConvectionDiffusion::write::getBodyForceProcessDictList {} { return $ret } -proc ConvectionDiffusion::write::GetSolverSettingsDict {} { +proc ::ConvectionDiffusion::write::GetSolverSettingsDict {} { set solverSettingsDict [dict create] set currentStrategyId [write::getValue CNVDFFSolStrat] set currentAnalysisTypeId [write::getValue CNVDFFAnalysisType] diff --git a/kratos.gid/apps/ConvectionDiffusion/xml/NodalConditions.xml b/kratos.gid/apps/ConvectionDiffusion/xml/NodalConditions.xml index 539214c74..53723ad10 100644 --- a/kratos.gid/apps/ConvectionDiffusion/xml/NodalConditions.xml +++ b/kratos.gid/apps/ConvectionDiffusion/xml/NodalConditions.xml @@ -1,7 +1,8 @@ - + diff --git a/kratos.gid/apps/ConvectionDiffusion/xml/Parts.spd b/kratos.gid/apps/ConvectionDiffusion/xml/Parts.spd index 1213b35e5..675e23aee 100644 --- a/kratos.gid/apps/ConvectionDiffusion/xml/Parts.spd +++ b/kratos.gid/apps/ConvectionDiffusion/xml/Parts.spd @@ -1,17 +1,13 @@ - - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/ConvectionDiffusion/xml/XmlController.tcl b/kratos.gid/apps/ConvectionDiffusion/xml/XmlController.tcl index e253fd60f..65741c008 100644 --- a/kratos.gid/apps/ConvectionDiffusion/xml/XmlController.tcl +++ b/kratos.gid/apps/ConvectionDiffusion/xml/XmlController.tcl @@ -1,12 +1,12 @@ -namespace eval ConvectionDiffusion::xml { +namespace eval ::ConvectionDiffusion::xml { + namespace path ::ConvectionDiffusion + Kratos::AddNamespace [namespace current] # Namespace variables declaration - variable dir } -proc ConvectionDiffusion::xml::Init { } { +proc ::ConvectionDiffusion::xml::Init { } { # Namespace variables inicialization - variable dir - Model::InitVariables dir $ConvectionDiffusion::dir + Model::InitVariables dir $::ConvectionDiffusion::dir Model::getSolutionStrategies Strategies.xml Model::getElements Elements.xml @@ -19,11 +19,11 @@ proc ConvectionDiffusion::xml::Init { } { Model::getSolvers "../../Common/xml/Solvers.xml" } -proc ConvectionDiffusion::xml::getUniqueName {name} { - return ${::ConvectionDiffusion::prefix}${name} +proc ::ConvectionDiffusion::xml::getUniqueName {name} { + return [::ConvectionDiffusion::GetAttribute prefix]${name} } -proc ConvectionDiffusion::xml::CustomTree { args } { +proc ::ConvectionDiffusion::xml::CustomTree { args } { set root [customlib::GetBaseRoot] # Output control in output settings @@ -42,5 +42,3 @@ proc ConvectionDiffusion::xml::CustomTree { args } { # Make line_search appear only with non-linear strategy [$root selectNodes "[spdAux::getRoute CNVDFFStratParams]/value\[@n='line_search'\]"] setAttribute state "\[checkStateByUniqueName CNVDFFAnalysisType non_linear\]" } - -ConvectionDiffusion::xml::Init diff --git a/kratos.gid/apps/DEM/app.json b/kratos.gid/apps/DEM/app.json new file mode 100644 index 000000000..3dc664a50 --- /dev/null +++ b/kratos.gid/apps/DEM/app.json @@ -0,0 +1,56 @@ +{ + "id": "DEM", + "name": "DEM", + "prefix": "DEM", + "themed": false, + "kratos_name": "DEMApplication", + "python_packages": [ + "KratosDEMApplication" + ], + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "xml/XmlController.tcl", + "xml/material_relations/MaterialRelations.tcl", + "xml/material_relations/material_relations_window.tcl", + "write/write.tcl", + "write/writeMDPA_Parts.tcl", + "write/writeMDPA_Inlet.tcl", + "write/writeMDPA_Walls.tcl", + "write/writeMDPA_Clusters.tcl", + "write/writeMaterials.tcl", + "write/writeProjectParameters.tcl", + "write/write_utils.tcl", + "examples/examples.tcl", + "examples/SpheresDrop.tcl", + "examples/CirclesDrop.tcl" + ], + "start_script": "::DEM::Init", + "requeriments": { + "apps": [], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false, + "import_files": true + }, + "unique_names": { + "parts": "DEMParts", + "nodal_conditions": "DEMNodalConditions", + "conditions": "DEMConditions", + "materials": "DEMMaterials" + }, + "write": { + "coordinates": "groups", + "materials_file": "MaterialsDEM.json", + "properties_location": "json" + }, + "main_launch_file": "python/MainKratos.py", + "examples": "examples/examples.xml" +} \ No newline at end of file diff --git a/kratos.gid/apps/DEM/clusters/ballast1cluster3D.clu b/kratos.gid/apps/DEM/clusters/ballast1cluster3D.clu new file mode 100644 index 000000000..29eaf1129 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast1cluster3D.clu @@ -0,0 +1,70 @@ +// +// Cluster Name: "ballast1cluster3D" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast1cluster3D + +Begin centers_and_radii +-0.391509 0.121909 0.312726 0.020672 +0.32244 0.0194959 -0.223296 0.155162 +-0.597913 -0.0218138 0.0715206 0.141522 +-0.386056 0.0107947 0.205741 0.155502 +0.076734 -0.00152028 0.201627 0.204192 +0.0399966 -0.0141627 0.0607252 0.223678 +-0.073462 0.00808046 -0.285236 0.19253 +-0.179392 0.0112557 -0.292201 0.172583 +0.0370542 0.00571689 -0.257455 0.189502 +-0.254678 -0.00156899 -0.316746 0.159412 +0.581015 -0.0133864 0.0271691 0.178333 +0.677032 0.00940693 -0.0712051 0.07655 +0.458127 0.00613206 -0.153953 0.147031 +0.117395 0.010611 -0.0984031 0.206146 +0.293181 0.00465454 -0.104456 0.190871 +-0.410011 -0.0090003 -0.204786 0.171714 +-0.230455 0.0264941 0.301984 0.181904 +-0.366031 -0.00631125 0.138699 0.146873 +0.448987 -0.00517788 -0.0375493 0.16173 +0.210208 0.00186764 0.15805 0.231182 +-0.535813 -0.0026309 0.20185 0.119456 +-0.571997 -0.0208803 -0.145339 0.137786 +-0.473596 0.00427741 -0.0902718 0.185702 +-0.177961 -0.0105985 0.00572166 0.220965 +-0.264394 0.00448218 -0.188039 0.200797 +-0.209478 -0.010723 0.176448 0.20641 +-0.0406276 0.00586815 0.250243 0.219153 +-0.408289 0.00191977 0.0435214 0.17522 +0.353919 -0.00560961 0.106462 0.220325 +0.20636 -0.000988455 0.036157 0.198387 +0.744337 0.000201125 -0.200293 0.050396 +-0.0595921 -0.012055 0.111434 0.196537 +0.164177 0.0155469 -0.231341 0.179728 +-0.318262 0.0013035 -0.0650001 0.178625 +-0.352455 -0.00638649 -0.233854 0.174406 +0.103332 0.04051 0.289115 0.157729 +0.4534 0.00983033 -0.293496 0.068093 +0.461944 -0.0167005 0.0811677 0.198215 +-0.0859944 -0.00208583 -0.123915 0.222955 +0.684749 0.0109885 -0.111364 0.073831 +0.614846 0.00824974 -0.139422 0.115712 +0.757795 -0.00126356 -0.032324 0.039945 +0.689458 -0.00511365 -0.240005 0.031858 +0.77106 0.00753955 -0.0992681 0.065943 +0.562333 -0.00469108 -0.259015 0.103893 +End centers_and_radii + +Particle_center_and_diameter +0.0490832 -0.00794099 -0.00919655 1.58736 + +Size +1.58736 + +Volume +0.336957 + +Inertia per unit mass +0.0557004 +0.163885 +0.128787 diff --git a/kratos.gid/apps/DEM/clusters/ballast1cluster3Dred.clu b/kratos.gid/apps/DEM/clusters/ballast1cluster3Dred.clu new file mode 100644 index 000000000..fa684e2ca --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast1cluster3Dred.clu @@ -0,0 +1,41 @@ +// +// Cluster Name: "ballast1cluster3Dred" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast1cluster3Dred + +Begin centers_and_radii +-0.107798 0.000160179 -0.253314 0.243881 +0.0894718 0.00304854 -0.241901 0.201758 +0.00323314 -0.0143897 0.0114748 0.305104 +0.197429 0.00302985 -0.175922 0.219562 +-0.177717 0.00104305 0.223284 0.246409 +-0.387721 0.00387426 0.176879 0.235631 +-0.299173 0.00113467 -0.197854 0.255704 +-0.467055 0.00389621 -0.0151576 0.282432 +0.0293598 0.00821798 0.247492 0.233336 +0.249656 0.00373876 0.152894 0.271182 +0.304149 0.00477271 -0.0121604 0.210524 +0.420662 0.000254436 0.030821 0.189946 +0.52362 -0.00449429 0.0634398 0.238928 +0.682015 0.0099566 -0.10572 0.172699 +0.39367 0.0125154 -0.169214 0.211831 +0.550248 -0.000781109 -0.217874 0.149196 +End centers_and_radii + +Particle_center_and_diameter +0.052784 0.00663793 -0.0561278 1.60778 + +Size +1.60778 + +Volume +0.447517 + +Inertia per unit mass +0.0607464 +0.180337 +0.151556 diff --git a/kratos.gid/apps/DEM/clusters/ballast2cluster3D.clu b/kratos.gid/apps/DEM/clusters/ballast2cluster3D.clu new file mode 100644 index 000000000..9eca2d723 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast2cluster3D.clu @@ -0,0 +1,58 @@ +// +// Cluster Name: "ballast2cluster3D" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast2cluster3D + +Begin centers_and_radii +-0.375967 -0.471924 0.0260517 0.148733 +0.0709963 0.0398698 -0.0637747 0.344678 +-0.192031 0.434668 -0.0257211 0.255659 +-0.0691877 0.249483 -0.0266048 0.28148 +-0.281868 -0.528909 0.030916 0.15725 +-0.222339 -0.317592 0.0512094 0.297355 +-0.135636 0.524702 0.0284116 0.217683 +0.0190753 0.0851424 0.248283 0.125977 +0.373584 -0.222064 0.0464191 0.190703 +0.257848 -0.156554 0.0471495 0.280329 +-0.229639 -0.0276446 -0.124509 0.215576 +0.0320867 -0.0174643 -0.0727716 0.372309 +-0.0188959 0.46726 0.0446652 0.259056 +0.18977 0.0125946 -0.0162874 0.374545 +-0.047566 -0.111675 -0.0626154 0.339278 +0.0877974 -0.0554946 0.0194054 0.384481 +0.130006 -0.294666 -0.0112559 0.274594 +-0.0426479 -0.445478 -0.0105365 0.226771 +-0.133266 -0.251138 0.0138137 0.31103 +-0.0776371 0.34918 0.112339 0.275784 +0.267589 0.022582 -0.00761729 0.309647 +-0.178269 0.0997999 -0.127151 0.21707 +-0.197275 -0.139203 -0.0610197 0.260999 +-0.0622261 0.00426448 -0.112256 0.300888 +0.217611 0.15121 -0.0320724 0.25598 +-0.299872 0.288397 -0.13547 0.146572 +-0.188569 -0.481859 0.00616044 0.195571 +-0.312446 -0.204489 -0.0113604 0.192388 +-0.314981 0.411969 -0.063746 0.165185 +-0.0714403 -0.141515 0.107541 0.275272 +0.418352 -0.117933 0.0343298 0.193322 +0.0503389 0.236549 0.00207174 0.293912 +-0.10245 0.359172 0.367849 0.039266 +End centers_and_radii + +Particle_center_and_diameter +-0.137388 0.0191417 0.0384549 1.78886 + +Size +1.78886 + +Volume +0.588813 + +Inertia per unit mass +0.132218 +0.0905154 +0.160795 diff --git a/kratos.gid/apps/DEM/clusters/ballast2cluster3Dred.clu b/kratos.gid/apps/DEM/clusters/ballast2cluster3Dred.clu new file mode 100644 index 000000000..1299cf8bc --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast2cluster3Dred.clu @@ -0,0 +1,39 @@ +// +// Cluster Name: "ballast2cluster3Dred" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast2cluster3Dred + +Begin centers_and_radii +-0.154193 0.378012 0.024577 0.357566 +-0.0919402 0.412506 0.0534622 0.322589 +-0.149874 0.361236 0.261489 0.143528 +-0.240387 0.209824 -0.130104 0.169683 +-0.368108 0.383057 -0.0810069 0.150759 +-0.349569 0.354657 -0.0935731 0.149564 +0.0978064 -0.0998804 -0.00250299 0.418638 +0.333895 -0.0885239 0.0645126 0.299802 +0.0245505 0.0243762 -0.086595 0.420935 +0.14683 0.0255291 -0.00222333 0.453786 +-0.144095 -0.31449 0.0232671 0.391308 +-0.18106 -0.112023 -0.101565 0.274281 +-0.0173798 -0.334179 -0.00643049 0.327102 +0.162134 -0.361289 0.0340567 0.199307 +End centers_and_radii + +Particle_center_and_diameter +-0.120556 0.0156518 0.0369123 1.73904 + +Size +1.73904 + +Volume +0.741066 + +Inertia per unit mass +0.147014 +0.107941 +0.172624 diff --git a/kratos.gid/apps/DEM/clusters/ballast3cluster3D.clu b/kratos.gid/apps/DEM/clusters/ballast3cluster3D.clu new file mode 100644 index 000000000..7cd10fdda --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast3cluster3D.clu @@ -0,0 +1,68 @@ +// +// Cluster Name: "ballast3cluster3D" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast3cluster3D + +Begin centers_and_radii +0.300212 -0.0734065 0.0924264 0.423948 +-0.455629 -0.0107929 -0.0240297 0.357812 +0.330277 0.36288 0.377762 0.041519 +0.00984493 -0.0524572 -0.331477 0.363435 +0.274653 -0.613871 0.251885 0.162124 +-0.562098 -0.1946 -0.117133 0.284758 +-0.171931 -0.311709 -0.416039 0.157085 +-0.399984 0.250659 0.0792511 0.317212 +0.0364667 0.0632792 0.154751 0.505934 +-0.50428 -0.482242 -0.113723 0.246213 +-0.15252 -0.283646 0.0955107 0.328157 +-0.693658 -0.202603 -0.165678 0.249119 +0.139552 0.565541 -0.169401 0.249428 +-0.308357 0.0408168 0.0695852 0.329662 +0.203636 0.283069 -0.126836 0.381627 +-0.597019 0.159956 -0.0192977 0.233132 +-0.181914 0.658134 0.212508 0.211288 +0.405984 -0.0162588 -0.119676 0.41701 +-0.0845538 0.291961 0.179176 0.418231 +0.10223 -0.336877 0.232977 0.289032 +0.0766694 -0.587622 0.224277 0.169991 +0.118464 0.373955 0.273371 0.255457 +-0.674618 -0.366776 -0.188518 0.249474 +0.343855 -0.345617 0.23852 0.325893 +-0.405247 -0.292902 -0.0657991 0.332234 +0.413527 0.048428 -0.336621 0.299024 +0.551098 -0.202597 -0.165092 0.289954 +0.103263 0.304628 -0.130505 0.40086 +-0.334022 -0.560391 -0.0352164 0.236031 +-0.25634 -0.0447681 0.0500079 0.345723 +-0.258262 0.456269 0.161508 0.332815 +-0.029834 -0.0824655 -0.189651 0.348808 +0.448828 -0.610876 0.271506 0.220961 +-0.0249299 0.565596 0.230047 0.254481 +0.466912 -0.200293 -0.0464351 0.318738 +0.300347 0.192938 -0.389451 0.295372 +-0.646756 -0.0479872 -0.109602 0.259937 +0.016539 0.540081 0.0199567 0.241836 +0.213393 0.481904 -0.195306 0.249171 +0.166441 -0.130483 0.218904 0.360297 +0.441965 0.327557 -0.0748802 0.181715 +-0.101263 -0.660089 0.0864341 0.135446 +0.126861 0.184044 -0.391843 0.243484 +End centers_and_radii + +Particle_center_and_diameter +-0.0642318 -0.0700491 0.0748349 2.08018 + +Size +2.08018 + +Volume +1.59545 + +Inertia per unit mass +0.206606 +0.228968 +0.274673 diff --git a/kratos.gid/apps/DEM/clusters/ballast3cluster3Dred.clu b/kratos.gid/apps/DEM/clusters/ballast3cluster3Dred.clu new file mode 100644 index 000000000..60444dc79 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast3cluster3Dred.clu @@ -0,0 +1,40 @@ +// +// Cluster Name: "ballast3cluster3Dred" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast3cluster3Dred + +Begin centers_and_radii +0.083053 0.00996922 -0.00716374 0.796798 +0.11161 -0.617265 0.19799 0.332304 +0.314002 -0.162683 -0.181224 0.507776 +0.218085 -0.203464 0.0708133 0.448938 +0.00236387 0.537211 0.217782 0.331402 +0.109472 0.498256 0.225914 0.363151 +-0.290383 0.275539 0.131003 0.359215 +-0.210068 0.43256 0.162709 0.333722 +-0.721106 0.0978873 -0.0477696 0.375983 +-0.601921 -0.236345 0.00397883 0.393856 +-0.510172 0.364728 0.078482 0.282557 +-0.359412 0.21806 0.0975699 0.412038 +-0.246017 -0.0158606 0.0403955 0.504291 +-0.436411 -0.0579409 0.0264118 0.41735 +-0.323301 -0.431875 0.134615 0.235157 +End centers_and_radii + +Particle_center_and_diameter +-0.118357 -0.0171821 -0.00128425 2.02657 + +Size +2.02657 + +Volume +2.43859 + +Inertia per unit mass +0.255656 +0.296336 +0.317386 diff --git a/kratos.gid/apps/DEM/clusters/ballast4cluster3D.clu b/kratos.gid/apps/DEM/clusters/ballast4cluster3D.clu new file mode 100644 index 000000000..2ae59f044 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast4cluster3D.clu @@ -0,0 +1,54 @@ +// +// Cluster Name: "ballast4cluster3D" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast4cluster3D + +Begin centers_and_radii +-0.00109994 -0.233328 0.0763927 0.343889 +-0.0429182 -0.00385907 -0.208747 0.343504 +-0.0432192 -0.197813 -0.232535 0.375064 +0.243764 -0.125683 -0.198045 0.227838 +0.0310333 -0.210478 0.224766 0.301032 +-0.0105032 0.212678 0.124887 0.433485 +0.0661404 -0.339481 0.399467 0.232885 +-0.146966 -0.244722 -0.424395 0.201071 +-0.0425809 0.0952005 -0.428654 0.175775 +0.0188687 0.125614 -0.0492073 0.477571 +0.0364967 -0.466726 0.365354 0.20973 +0.00751906 -0.433763 0.269785 0.250653 +-0.104003 -0.0948991 -0.383963 0.222536 +0.154198 -0.209981 -0.221039 0.244465 +-0.0705998 0.140252 0.128532 0.421175 +-0.0391735 -0.0103087 0.00357088 0.414231 +-0.0394073 0.251106 0.525912 0.047803 +-0.0239141 0.400183 -0.0450103 0.258038 +0.0178074 -0.430212 0.044343 0.263474 +-0.125561 -0.309449 -0.386291 0.20377 +-0.0239865 0.426168 -0.171987 0.206013 +0.301317 -0.0108882 -0.137282 0.251268 +-0.0189531 -0.0362506 -0.126116 0.392997 +-0.0155046 -0.506725 0.14549 0.207835 +-0.127789 0.506202 -0.314507 0.033922 +0.00142557 0.289934 -0.222683 0.296245 +-0.0120559 0.388997 0.0438636 0.285736 +0.0470118 0.0612303 -0.11466 0.407137 +0.0313301 0.183126 -0.327917 0.237066 +End centers_and_radii + +Particle_center_and_diameter +0.0170688 -0.0546222 0.0439234 1.47682 + +Size +1.47682 + +Volume +0.811589 + +Inertia per unit mass +0.174393 +0.121555 +0.141408 diff --git a/kratos.gid/apps/DEM/clusters/ballast4cluster3Dred.clu b/kratos.gid/apps/DEM/clusters/ballast4cluster3Dred.clu new file mode 100644 index 000000000..6327d0392 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast4cluster3Dred.clu @@ -0,0 +1,33 @@ +// +// Cluster Name: "ballast4cluster3Dred" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast4cluster3Dred + +Begin centers_and_radii +0.020307 -0.334034 0.360569 0.333544 +-0.0458056 -0.533224 0.236876 0.203982 +-0.000158373 -0.424996 0.0788982 0.275699 +-0.0424899 -0.237408 -0.0903079 0.359061 +-0.00883499 -0.132442 -0.132698 0.524797 +-0.0124107 -0.21698 0.120965 0.375648 +-0.00468602 0.165645 0.0260379 0.558958 +0.0597916 0.0265269 -0.102825 0.503916 +End centers_and_radii + +Particle_center_and_diameter +0.000829841 -0.0171758 0.102435 1.57368 + +Size +1.57368 + +Volume +1.08527 + +Inertia per unit mass +0.195912 +0.147269 +0.170305 diff --git a/kratos.gid/apps/DEM/clusters/ballast5cluster3D.clu b/kratos.gid/apps/DEM/clusters/ballast5cluster3D.clu new file mode 100644 index 000000000..34d08d1cd --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast5cluster3D.clu @@ -0,0 +1,70 @@ +// +// Cluster Name: "ballast5cluster3D" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast5cluster3D + +Begin centers_and_radii +0.109892 0.104903 0.257468 0.204898 +-0.00845298 0.021039 0.165903 0.248121 +-0.333047 -0.107997 0.230305 0.129997 +0.0652302 0.147211 0.436277 0.110971 +0.368946 -0.0694876 0.028562 0.101141 +-0.0348807 0.0430708 0.45313 0.18327 +-0.286994 -0.0227369 -0.485387 0.076334 +-0.179855 -0.0174906 0.496349 0.126306 +-0.205289 -0.0120177 -0.602916 0.158541 +-0.0702458 0.0146171 -0.480648 0.203504 +0.0500256 0.0297763 -0.244075 0.211509 +0.0590472 0.103445 0.106469 0.207299 +-0.102271 0.0354861 -0.287844 0.154789 +-0.289995 -0.0367832 -0.0481094 0.084444 +0.36557 -0.0897608 -0.105415 0.090622 +-0.152972 -0.024656 0.322623 0.205679 +-0.0165157 -0.0460956 0.28836 0.219614 +-0.287499 -0.0842975 0.451826 0.096091 +-0.180861 -0.0147241 0.0580864 0.156978 +-0.171073 -0.0328863 0.257086 0.233531 +-0.34088 -0.142156 0.326816 0.094059 +-0.0879095 -0.0773951 -0.612569 0.101306 +0.297868 0.113778 0.337223 0.049709 +0.346903 -0.0918317 0.142643 0.116412 +-0.229776 -0.00170652 -0.39933 0.113252 +0.270344 -0.00599108 0.247013 0.162797 +-0.0240087 0.0424401 -0.089417 0.213357 +-0.312723 -0.0549011 0.0968509 0.124343 +0.278706 -0.131963 0.220921 0.139851 +-0.220678 0.0172846 -0.288378 0.097662 +0.202711 -0.0343256 0.00793019 0.168403 +0.377988 -0.122382 -0.212363 0.077644 +0.245203 -0.0639276 -0.156769 0.150284 +0.0423793 0.0298051 -0.39699 0.199167 +0.0719394 -0.15559 0.304775 0.124836 +0.080398 0.0351771 -0.105283 0.209622 +0.21003 -0.0244171 0.143489 0.186548 +0.158898 -0.0641874 -0.43867 0.138241 +0.289167 -0.0835321 -0.387513 0.085285 +0.00747391 -0.0784147 -0.532446 0.13044 +0.206863 -0.0549034 -0.332361 0.128303 +-0.210478 0.000655474 -0.155255 0.112418 +0.120226 -0.121031 0.243571 0.15351 +-0.142169 0.0172032 0.578331 0.114211 +0.338727 -0.100983 -0.300739 0.073588 +End centers_and_radii + +Particle_center_and_diameter +-0.174911 0.00204536 -0.0344193 1.45605 + +Size +1.45605 + +Volume +0.303842 + +Inertia per unit mass +0.124182 +0.148323 +0.0519441 diff --git a/kratos.gid/apps/DEM/clusters/ballast5cluster3Dred.clu b/kratos.gid/apps/DEM/clusters/ballast5cluster3Dred.clu new file mode 100644 index 000000000..9465a50ea --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast5cluster3Dred.clu @@ -0,0 +1,41 @@ +// +// Cluster Name: "ballast5cluster3Dred" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast5cluster3Dred + +Begin centers_and_radii +0.0395176 0.044821 0.14742 0.2834 +0.109399 0.114554 0.291388 0.256438 +-0.0285607 -0.0387681 0.301992 0.280519 +0.252963 -0.0344048 0.162878 0.258047 +-0.112658 -0.0100875 0.426895 0.292647 +-0.298844 -0.126933 0.315151 0.15559 +-0.25587 -0.0537429 0.203047 0.212721 +-0.215788 -0.0298604 0.0960331 0.198934 +0.175795 -0.026821 -0.138356 0.277919 +0.136587 -0.0231969 -0.345634 0.269304 +0.000119519 -0.0480425 -0.473743 0.175251 +-0.163044 0.00951019 -0.494853 0.266284 +-0.0515371 0.0371588 -0.269873 0.268772 +-0.232049 -0.0101798 -0.087189 0.150139 +-0.0407652 0.0426868 -0.0590586 0.216597 +-0.06285 0.039694 -0.0797194 0.194041 +End centers_and_radii + +Particle_center_and_diameter +-0.137132 -0.000568419 -0.0208205 1.7312 + +Size +1.7312 + +Volume +0.454967 + +Inertia per unit mass +0.147326 +0.172878 +0.0661541 diff --git a/kratos.gid/apps/DEM/clusters/ballast6cluster3D.clu b/kratos.gid/apps/DEM/clusters/ballast6cluster3D.clu new file mode 100644 index 000000000..72f54bd7d --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast6cluster3D.clu @@ -0,0 +1,69 @@ +// +// Cluster Name: "ballast6cluster3D" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast6cluster3D + +Begin centers_and_radii +-0.0164969 -0.115357 -0.43598 0.187781 +0.0916539 0.181949 -0.0597184 0.264401 +0.109925 0.229436 -0.248611 0.207506 +-0.118587 0.112791 0.447556 0.179643 +0.0519597 -0.057053 0.122592 0.343981 +0.0102312 -0.20098 0.0548355 0.27095 +0.0194962 -0.0130762 0.150349 0.377743 +0.0154136 -0.138254 -0.0342706 0.326901 +0.0227386 0.243014 0.58948 0.065563 +-0.068895 0.210001 -0.413258 0.226106 +-0.0706984 0.113858 0.478042 0.186755 +0.161837 -0.19932 -0.26402 0.161458 +-0.0539059 -0.0145198 -0.483718 0.165767 +-0.0203155 -0.238153 -0.29467 0.163999 +0.0605882 0.0247419 0.37739 0.234043 +-0.0102796 0.328559 0.481008 0.137725 +-0.0451168 -0.215112 -0.399679 0.123157 +0.00837117 0.0224785 -0.212911 0.315835 +-0.150683 -0.0486509 0.241304 0.242484 +0.0351883 -0.0964943 -0.264584 0.274473 +-0.0197652 -0.00496713 -0.035221 0.347929 +0.03642 -0.300895 0.0048761 0.271708 +-0.18718 0.282292 0.484905 0.040709 +-0.242808 0.131338 -0.197429 0.130733 +-0.124779 0.034138 0.343823 0.211292 +0.150526 0.247345 -0.163951 0.206535 +-0.0176755 -0.2919 -0.153015 0.201208 +-0.200842 -0.231012 0.16563 0.16917 +0.0890442 0.0511167 0.514751 0.135061 +0.033458 0.295028 0.366597 0.155623 +-0.194588 0.180914 -0.32207 0.15392 +0.128133 0.282655 0.0933683 0.140006 +0.0203635 0.144016 0.585072 0.123088 +-0.232341 0.0368285 -0.022372 0.201459 +-0.021801 0.069099 -0.246298 0.289651 +-0.0899916 0.114474 -0.461281 0.192456 +-0.253123 -0.175039 0.228614 0.144829 +-0.270725 0.00283003 0.152494 0.139493 +0.0737607 0.29801 -0.395975 0.133983 +-0.135587 -0.330067 0.0891189 0.164085 +0.0824665 0.253241 0.234056 0.171098 +-0.0582755 0.187748 0.427673 0.212894 +0.151942 -0.268836 -0.149419 0.168465 +-0.316736 0.122046 -0.121845 0.060335 +End centers_and_radii + +Particle_center_and_diameter +-0.0186918 0.0660083 0.0290177 1.49764 + +Size +1.49764 + +Volume +0.505783 + +Inertia per unit mass +0.139177 +0.118401 +0.0807452 diff --git a/kratos.gid/apps/DEM/clusters/ballast6cluster3Dred.clu b/kratos.gid/apps/DEM/clusters/ballast6cluster3Dred.clu new file mode 100644 index 000000000..b84aa96ff --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ballast6cluster3Dred.clu @@ -0,0 +1,32 @@ +// +// Cluster Name: "ballast6cluster3Dred" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast6cluster3Dred + +Begin centers_and_radii +-0.0303337 -0.0213725 0.088663 0.435549 +0.00036587 -0.161336 0.0404878 0.41811 +0.00407157 0.0669912 0.30078 0.406646 +0.017895 0.149712 0.361658 0.310327 +-0.0377896 0.128338 -0.315442 0.363907 +0.0162742 -0.0344683 -0.22665 0.421836 +0.0759905 0.14631 -0.127003 0.350781 +End centers_and_radii + +Particle_center_and_diameter +-0.0151677 0.0947392 0.0137883 1.44517 + +Size +1.44517 + +Volume +0.705137 + +Inertia per unit mass +0.160048 +0.143685 +0.0978421 diff --git a/kratos.gid/apps/DEM/clusters/beadcluster3D.clu b/kratos.gid/apps/DEM/clusters/beadcluster3D.clu new file mode 100644 index 000000000..7b1b8bad9 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/beadcluster3D.clu @@ -0,0 +1,30 @@ +// +// Cluster Name: "beadcluster3D" +// Author: Joaquin Irazabal +// Date: 2018-02-15 +// + +Name +beadcluster3D + +Begin centers_and_radii +-0.4 0.0 0.0 0.1 +-0.2 0.0 0.0 0.1 +0.0 0.0 0.0 0.1 +0.2 0.0 0.0 0.1 +0.4 0.0 0.0 0.1 +End centers_and_radii + +Particle_center_and_diameter // Needed by the mesher, KRATOS skips it. Centre of the cluster and distance between the farthest points +0.0 0.0 0.0 1.0 + +Size +1.0 + +Volume +0.03141592 + +Inertia per unit mass +0.005 +0.085833333 +0.085833333 diff --git a/kratos.gid/apps/DEM/clusters/capsulecluster3D.clu b/kratos.gid/apps/DEM/clusters/capsulecluster3D.clu new file mode 100644 index 000000000..b44f39591 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/capsulecluster3D.clu @@ -0,0 +1,30 @@ +// +// Cluster Name: "capsulecluster3D" +// Author: Salva Latorre +// Date: $Date: 2016-9-5 +// + +Name +capsulecluster3D + +Begin centers_and_radii +-0.4650 0.0 0.0 0.35 +-0.2325 0.0 0.0 0.35 +0.0 0.0 0.0 0.35 +0.2325 0.0 0.0 0.35 +0.4650 0.0 0.0 0.35 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +0.000000 0.000000 0.000000 1.630000 + +Size +1.630000 + +Volume +0.89541 + +Inertia per unit mass +0.06125 // 54.9223 +0.319 // 326.3578 +0.319 // 326.3578 diff --git a/kratos.gid/apps/DEM/clusters/corn3cluster3D.clu b/kratos.gid/apps/DEM/clusters/corn3cluster3D.clu new file mode 100644 index 000000000..abe5f2748 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/corn3cluster3D.clu @@ -0,0 +1,29 @@ +// +// Cluster Name: "corn3cluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: $Date: 2016-5-3 +// + +Name +corn3cluster3D + +Begin centers_and_radii +0.0 0.815 0.0 2.340 +0.0 -0.870 0.0 1.872 +0.0 -2.643 0.0 0.732 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +0.000000 -0.110000 0.000000 6.530000 + +Size +6.530000 + +Volume +86.355672439 + +// http://mathworld.wolfram.com/Ellipsoid.html +Inertia per unit mass +3.0074256 +3.0074256 +3.0074256 diff --git a/kratos.gid/apps/DEM/clusters/cornkernelcluster3D.clu b/kratos.gid/apps/DEM/clusters/cornkernelcluster3D.clu new file mode 100644 index 000000000..58c52324e --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/cornkernelcluster3D.clu @@ -0,0 +1,47 @@ +// +// Cluster Name: "cornkernelcluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: $Date: 2016-5-3 +// + +Name +cornkernelcluster3D + +Begin centers_and_radii +0.0001184481 0.0028742315 0 0.0012156 +-0.0012089142 0.0027671858 0 0.0012156 +0.0012959633 0.0027671858 0 0.0012156 +-0.0012662419 0.001054454 0 0.0012156 +0.0016812842 0.0013542331 0 0.0012156 +0.0013791833 -0.0001562715 0 0.0012156 +-0.0009297152 -0.0007820502 0 0.0012156 +0.0001492149 0.0008579158 0 0.0012156 +0.0007749936 -0.0017099298 0 0.0012156 +-0.0006038371 -0.0017596235 0 0.0012156 +-0.0013178076 0.0019345727 0 0.0012156 +-0.0010954379 0.0002540786 0 0.0012156 +-0.0005899915 0.0028577966 0 0.0012156 +0.0015061284 0.0020850032 0 0.0012156 +0.0015662398 0.0006596393 0 0.0012156 +0.0012126826 -0.0009194373 0 0.0012156 +0.0006956271 0.0028815373 0 0.0012156 +-0.000382275 -0.00274055 0 0.0008104 +0.000492665 -0.00266845 0 0.0008104 +-0.000112185 -0.0031041 0 0.0008104 +-0.000118455 -0.0037859 0 0.0003039 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +0.000000 0.000000 0.000000 0.00818309 + +// corn_kernel_design_05.gid +Size +0.00818309 + +Volume +0.000000109 + +Inertia per unit mass +0.000006101 +0.000002875 +0.000007926 diff --git a/kratos.gid/apps/DEM/clusters/cubecluster3D.clu b/kratos.gid/apps/DEM/clusters/cubecluster3D.clu new file mode 100644 index 000000000..c41e61fa4 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/cubecluster3D.clu @@ -0,0 +1,51 @@ +// +// Cluster Name: "cubecluster3D" +// Author: Joaquin Irazabal +// Date: 2018-02-15 +// + +Name +cubecluster3D + +Begin centers_and_radii +0.25 0.25 0.25 0.25 +0.25 0.25 0.00 0.25 +0.25 0.25 -0.25 0.25 +0.25 0.00 0.25 0.25 +0.25 0.00 0.00 0.25 +0.25 0.00 -0.25 0.25 +0.25 -0.25 0.25 0.25 +0.25 -0.25 0.00 0.25 +0.25 -0.25 -0.25 0.25 +0.00 0.25 0.25 0.25 +0.00 0.25 0.00 0.25 +0.00 0.25 -0.25 0.25 +0.00 0.00 0.25 0.25 +0.00 0.00 -0.25 0.25 +0.00 -0.25 0.25 0.25 +0.00 -0.25 0.00 0.25 +0.00 -0.25 -0.25 0.25 +-0.25 0.25 0.25 0.25 +-0.25 0.25 0.00 0.25 +-0.25 0.25 -0.25 0.25 +-0.25 0.00 0.25 0.25 +-0.25 0.00 0.00 0.25 +-0.25 0.00 -0.25 0.25 +-0.25 -0.25 0.25 0.25 +-0.25 -0.25 0.00 0.25 +-0.25 -0.25 -0.25 0.25 +End centers_and_radii + +Particle_center_and_diameter // Needed by the mesher, KRATOS skips it. Centre of the cluster and distance between the farthest points +0.0 0.0 0.0 1.414213562 + +Size +1.0 + +Volume +1.0 + +Inertia per unit mass +0.16666666666 +0.16666666666 +0.16666666666 diff --git a/kratos.gid/apps/DEM/clusters/cuboidcluster3D.clu b/kratos.gid/apps/DEM/clusters/cuboidcluster3D.clu new file mode 100644 index 000000000..7db7468a5 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/cuboidcluster3D.clu @@ -0,0 +1,313 @@ +// +// Cluster Name: "cuboidcluster3D" +// Author: Joaquin Irazabal +// Date: 2018-02-15 +// + +Name +cuboidcluster3D + +Begin centers_and_radii +-0.0 -0.0 -0.25 0.1 +-0.0 -0.0 -0.254895 0.1 +-0.0 -0.0 -0.270371 0.1 +-0.0 -0.0 -0.29643 0.1 +-0.0 -0.0 -0.31498 0.1 +-0.0 -0.0 -0.29643 0.1 +-0.0 -0.0 -0.270371 0.1 +-0.0 -0.0 -0.254895 0.1 +0.0 -0.0 -0.25 0.1 +0.0 -0.0 -0.254895 0.1 +0.0 -0.0 -0.270371 0.1 +0.0 -0.0 -0.29643 0.1 +0.0 -0.0 -0.31498 0.1 +0.0 -0.0 -0.29643 0.1 +0.0 -0.0 -0.270371 0.1 +0.0 -0.0 -0.254895 0.1 +0.0 0.0 -0.25 0.1 +0.0 0.0 -0.254895 0.1 +0.0 0.0 -0.270371 0.1 +0.0 0.0 -0.29643 0.1 +0.0 0.0 -0.31498 0.1 +0.0 0.0 -0.29643 0.1 +0.0 0.0 -0.270371 0.1 +0.0 0.0 -0.254895 0.1 +0.0 0.0 -0.25 0.1 +-0.0 0.0 -0.254895 0.1 +-0.0 0.0 -0.270371 0.1 +-0.0 0.0 -0.29643 0.1 +-0.0 0.0 -0.31498 0.1 +-0.0 0.0 -0.29643 0.1 +-0.0 0.0 -0.270371 0.1 +-0.0 0.0 -0.254895 0.1 +-0.206933 -0.0 -0.24979 0.1 +-0.206909 -0.030868 -0.254655 0.1 +-0.206656 -0.0642 -0.270008 0.1 +-0.203711 -0.102087 -0.295743 0.1 +-0.183897 -0.137923 -0.313932 0.1 +-0.136115 -0.152783 -0.295743 0.1 +-0.0856 -0.154992 -0.270008 0.1 +-0.041157 -0.155182 -0.254655 0.1 +0.0 -0.1552 -0.24979 0.1 +0.041157 -0.155182 -0.254655 0.1 +0.0856 -0.154992 -0.270008 0.1 +0.136115 -0.152783 -0.295743 0.1 +0.183897 -0.137923 -0.313932 0.1 +0.203711 -0.102087 -0.295743 0.1 +0.206656 -0.0642 -0.270008 0.1 +0.206909 -0.030868 -0.254655 0.1 +0.206933 0.0 -0.24979 0.1 +0.206909 0.030868 -0.254655 0.1 +0.206656 0.0642 -0.270008 0.1 +0.203711 0.102087 -0.295743 0.1 +0.183897 0.137923 -0.313932 0.1 +0.136115 0.152783 -0.295743 0.1 +0.0856 0.154992 -0.270008 0.1 +0.041157 0.155182 -0.254655 0.1 +0.0 0.1552 -0.24979 0.1 +-0.041157 0.155182 -0.254655 0.1 +-0.0856 0.154992 -0.270008 0.1 +-0.136115 0.152783 -0.295743 0.1 +-0.183897 0.137923 -0.313932 0.1 +-0.203711 0.102087 -0.295743 0.1 +-0.206656 0.0642 -0.270008 0.1 +-0.206909 0.030868 -0.254655 0.1 +-0.445449 -0.0 -0.222725 0.1 +-0.441022 -0.065794 -0.224831 0.1 +-0.426033 -0.132351 -0.230567 0.1 +-0.394974 -0.197935 -0.237516 0.1 +-0.340646 -0.255485 -0.240873 0.1 +-0.263913 -0.296231 -0.237516 0.1 +-0.176469 -0.319525 -0.230567 0.1 +-0.087725 -0.330767 -0.224831 0.1 +0.0 -0.334087 -0.222725 0.1 +0.087725 -0.330767 -0.224831 0.1 +0.176469 -0.319525 -0.230567 0.1 +0.263913 -0.296231 -0.237516 0.1 +0.340646 -0.255485 -0.240873 0.1 +0.394974 -0.197935 -0.237516 0.1 +0.426033 -0.132351 -0.230567 0.1 +0.441022 -0.065794 -0.224831 0.1 +0.445449 0.0 -0.222725 0.1 +0.441022 0.065794 -0.224831 0.1 +0.426033 0.132351 -0.230567 0.1 +0.394974 0.197935 -0.237516 0.1 +0.340646 0.255485 -0.240873 0.1 +0.263913 0.296231 -0.237516 0.1 +0.176469 0.319525 -0.230567 0.1 +0.087725 0.330767 -0.224831 0.1 +0.0 0.334087 -0.222725 0.1 +-0.087725 0.330767 -0.224831 0.1 +-0.176469 0.319525 -0.230567 0.1 +-0.263913 0.296231 -0.237516 0.1 +-0.340646 0.255485 -0.240873 0.1 +-0.394974 0.197935 -0.237516 0.1 +-0.426033 0.132351 -0.230567 0.1 +-0.441022 0.065794 -0.224831 0.1 +-0.49958 -0.0 -0.103466 0.1 +-0.490026 -0.073104 -0.103476 0.1 +-0.461697 -0.143431 -0.103499 0.1 +-0.415609 -0.208276 -0.103522 0.1 +-0.353479 -0.265109 -0.103532 0.1 +-0.277701 -0.311707 -0.103522 0.1 +-0.191241 -0.346273 -0.103499 0.1 +-0.097472 -0.36752 -0.103476 0.1 +0.0 -0.374685 -0.103466 0.1 +0.097472 -0.36752 -0.103476 0.1 +0.191241 -0.346273 -0.103499 0.1 +0.277701 -0.311707 -0.103522 0.1 +0.353479 -0.265109 -0.103532 0.1 +0.415609 -0.208276 -0.103522 0.1 +0.461697 -0.143431 -0.103499 0.1 +0.490026 -0.073104 -0.103476 0.1 +0.49958 0.0 -0.103466 0.1 +0.490026 0.073104 -0.103476 0.1 +0.461697 0.143431 -0.103499 0.1 +0.415609 0.208276 -0.103522 0.1 +0.353479 0.265109 -0.103532 0.1 +0.277701 0.311707 -0.103522 0.1 +0.191241 0.346273 -0.103499 0.1 +0.097472 0.36752 -0.103476 0.1 +0.0 0.374685 -0.103466 0.1 +-0.097472 0.36752 -0.103476 0.1 +-0.191241 0.346273 -0.103499 0.1 +-0.277701 0.311707 -0.103522 0.1 +-0.353479 0.265109 -0.103532 0.1 +-0.415609 0.208276 -0.103522 0.1 +-0.461697 0.143431 -0.103499 0.1 +-0.490026 0.073104 -0.103476 0.1 +-0.5 -0.0 0.0 0.1 +-0.490393 -0.073159 0.0 0.1 +-0.46194 -0.143506 0.0 0.1 +-0.415735 -0.208339 0.0 0.1 +-0.353553 -0.265165 0.0 0.1 +-0.277785 -0.311801 0.0 0.1 +-0.191342 -0.346455 0.0 0.1 +-0.097545 -0.367794 0.0 0.1 +0.0 -0.375 0.0 0.1 +0.097545 -0.367794 0.0 0.1 +0.191342 -0.346455 0.0 0.1 +0.277785 -0.311801 0.0 0.1 +0.353553 -0.265165 0.0 0.1 +0.415735 -0.208339 0.0 0.1 +0.46194 -0.143506 0.0 0.1 +0.490393 -0.073159 0.0 0.1 +0.5 0.0 0.0 0.1 +0.490393 0.073159 0.0 0.1 +0.46194 0.143506 0.0 0.1 +0.415735 0.208339 0.0 0.1 +0.353553 0.265165 0.0 0.1 +0.277785 0.311801 0.0 0.1 +0.191342 0.346455 0.0 0.1 +0.097545 0.367794 0.0 0.1 +0.0 0.375 0.0 0.1 +-0.097545 0.367794 0.0 0.1 +-0.191342 0.346455 0.0 0.1 +-0.277785 0.311801 0.0 0.1 +-0.353553 0.265165 0.0 0.1 +-0.415735 0.208339 0.0 0.1 +-0.46194 0.143506 0.0 0.1 +-0.490393 0.073159 0.0 0.1 +-0.49958 -0.0 0.103466 0.1 +-0.490026 -0.073104 0.103476 0.1 +-0.461697 -0.143431 0.103499 0.1 +-0.415609 -0.208276 0.103522 0.1 +-0.353479 -0.265109 0.103532 0.1 +-0.277701 -0.311707 0.103522 0.1 +-0.191241 -0.346273 0.103499 0.1 +-0.097472 -0.36752 0.103476 0.1 +0.0 -0.374685 0.103466 0.1 +0.097472 -0.36752 0.103476 0.1 +0.191241 -0.346273 0.103499 0.1 +0.277701 -0.311707 0.103522 0.1 +0.353479 -0.265109 0.103532 0.1 +0.415609 -0.208276 0.103522 0.1 +0.461697 -0.143431 0.103499 0.1 +0.490026 -0.073104 0.103476 0.1 +0.49958 0.0 0.103466 0.1 +0.490026 0.073104 0.103476 0.1 +0.461697 0.143431 0.103499 0.1 +0.415609 0.208276 0.103522 0.1 +0.353479 0.265109 0.103532 0.1 +0.277701 0.311707 0.103522 0.1 +0.191241 0.346273 0.103499 0.1 +0.097472 0.36752 0.103476 0.1 +0.0 0.374685 0.103466 0.1 +-0.097472 0.36752 0.103476 0.1 +-0.191241 0.346273 0.103499 0.1 +-0.277701 0.311707 0.103522 0.1 +-0.353479 0.265109 0.103532 0.1 +-0.415609 0.208276 0.103522 0.1 +-0.461697 0.143431 0.103499 0.1 +-0.490026 0.073104 0.103476 0.1 +-0.445449 -0.0 0.222725 0.1 +-0.441022 -0.065794 0.224831 0.1 +-0.426033 -0.132351 0.230567 0.1 +-0.394974 -0.197935 0.237516 0.1 +-0.340646 -0.255485 0.240873 0.1 +-0.263913 -0.296231 0.237516 0.1 +-0.176469 -0.319525 0.230567 0.1 +-0.087725 -0.330767 0.224831 0.1 +0.0 -0.334087 0.222725 0.1 +0.087725 -0.330767 0.224831 0.1 +0.176469 -0.319525 0.230567 0.1 +0.263913 -0.296231 0.237516 0.1 +0.340646 -0.255485 0.240873 0.1 +0.394974 -0.197935 0.237516 0.1 +0.426033 -0.132351 0.230567 0.1 +0.441022 -0.065794 0.224831 0.1 +0.445449 0.0 0.222725 0.1 +0.441022 0.065794 0.224831 0.1 +0.426033 0.132351 0.230567 0.1 +0.394974 0.197935 0.237516 0.1 +0.340646 0.255485 0.240873 0.1 +0.263913 0.296231 0.237516 0.1 +0.176469 0.319525 0.230567 0.1 +0.087725 0.330767 0.224831 0.1 +0.0 0.334087 0.222725 0.1 +-0.087725 0.330767 0.224831 0.1 +-0.176469 0.319525 0.230567 0.1 +-0.263913 0.296231 0.237516 0.1 +-0.340646 0.255485 0.240873 0.1 +-0.394974 0.197935 0.237516 0.1 +-0.426033 0.132351 0.230567 0.1 +-0.441022 0.065794 0.224831 0.1 +-0.206933 -0.0 0.24979 0.1 +-0.206909 -0.030868 0.254655 0.1 +-0.206656 -0.0642 0.270008 0.1 +-0.203711 -0.102087 0.295743 0.1 +-0.183897 -0.137923 0.313932 0.1 +-0.136115 -0.152783 0.295743 0.1 +-0.0856 -0.154992 0.270008 0.1 +-0.041157 -0.155182 0.254655 0.1 +0.0 -0.1552 0.24979 0.1 +0.041157 -0.155182 0.254655 0.1 +0.0856 -0.154992 0.270008 0.1 +0.136115 -0.152783 0.295743 0.1 +0.183897 -0.137923 0.313932 0.1 +0.203711 -0.102087 0.295743 0.1 +0.206656 -0.0642 0.270008 0.1 +0.206909 -0.030868 0.254655 0.1 +0.206933 0.0 0.24979 0.1 +0.206909 0.030868 0.254655 0.1 +0.206656 0.0642 0.270008 0.1 +0.203711 0.102087 0.295743 0.1 +0.183897 0.137923 0.313932 0.1 +0.136115 0.152783 0.295743 0.1 +0.0856 0.154992 0.270008 0.1 +0.041157 0.155182 0.254655 0.1 +0.0 0.1552 0.24979 0.1 +-0.041157 0.155182 0.254655 0.1 +-0.0856 0.154992 0.270008 0.1 +-0.136115 0.152783 0.295743 0.1 +-0.183897 0.137923 0.313932 0.1 +-0.203711 0.102087 0.295743 0.1 +-0.206656 0.0642 0.270008 0.1 +-0.206909 0.030868 0.254655 0.1 +-0.0 -0.0 0.25 0.1 +-0.0 -0.0 0.254895 0.1 +-0.0 -0.0 0.270371 0.1 +-0.0 -0.0 0.29643 0.1 +-0.0 -0.0 0.31498 0.1 +-0.0 -0.0 0.29643 0.1 +-0.0 -0.0 0.270371 0.1 +-0.0 -0.0 0.254895 0.1 +0.0 -0.0 0.25 0.1 +0.0 -0.0 0.254895 0.1 +0.0 -0.0 0.270371 0.1 +0.0 -0.0 0.29643 0.1 +0.0 -0.0 0.31498 0.1 +0.0 -0.0 0.29643 0.1 +0.0 -0.0 0.270371 0.1 +0.0 -0.0 0.254895 0.1 +0.0 0.0 0.25 0.1 +0.0 0.0 0.254895 0.1 +0.0 0.0 0.270371 0.1 +0.0 0.0 0.29643 0.1 +0.0 0.0 0.31498 0.1 +0.0 0.0 0.29643 0.1 +0.0 0.0 0.270371 0.1 +0.0 0.0 0.254895 0.1 +0.0 0.0 0.25 0.1 +-0.0 0.0 0.254895 0.1 +-0.0 0.0 0.270371 0.1 +-0.0 0.0 0.29643 0.1 +-0.0 0.0 0.31498 0.1 +-0.0 0.0 0.29643 0.1 +-0.0 0.0 0.270371 0.1 +-0.0 0.0 0.254895 0.1 +End centers_and_radii + +Particle_center_and_diameter +0.0 0.0 0.0 1.220363 + +Size +1.0 + +Volume +0.1963495408297271 + +Inertia per unit mass +0.040625 +0.0625 +0.078125 diff --git a/kratos.gid/apps/DEM/clusters/diablo1block3D.clu b/kratos.gid/apps/DEM/clusters/diablo1block3D.clu new file mode 100644 index 000000000..327d4af43 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/diablo1block3D.clu @@ -0,0 +1,1504 @@ +// +// Cluster Name: "diablo1block3D" +// Author: Joaquín Irazábal +// Date: $Date: 2016-5-3 +// + +Name +diablo1block3D + +Begin centers_and_radii +-0.34416 0.23 0.14712 0.02 +-0.34893 0.23 0.12706 0.02 +-0.31983 0.23 0.14043 0.02 +-0.34416 0.20444 0.14712 0.02 +-0.31738 0.20334 0.13976 0.02 +-0.3537 0.23 0.107 0.02 +-0.34888 0.19371 0.12725 0.02 +-0.31565 0.23 0.11345 0.02 +-0.3537 0.20444 0.107 0.02 +-0.2955 0.23 0.13375 0.02 +-0.34416 0.17889 0.14712 0.02 +-0.33155 0.23 0.095926 0.02 +-0.29257 0.19969 0.13294 0.02 +-0.32241 0.20784 0.091353 0.02 +-0.30805 0.17699 0.1372 0.02 +-0.3537 0.17889 0.107 0.02 +-0.34865 0.16559 0.12824 0.02 +-0.33188 0.18733 0.096091 0.02 +-0.29102 0.23 0.10382 0.02 +-0.30941 0.23 0.084854 0.02 +-0.27117 0.23 0.12706 0.02 +-0.34416 0.15333 0.14712 0.02 +-0.30957 0.18692 0.084931 0.02 +-0.32235 0.14915 0.14113 0.02 +-0.26853 0.19984 0.12634 0.02 +-0.28024 0.17829 0.12955 0.02 +-0.29834 0.20835 0.079318 0.02 +-0.32701 0.16587 0.093654 0.02 +-0.3537 0.15333 0.107 0.02 +-0.29215 0.15656 0.13283 0.02 +-0.34869 0.14056 0.12806 0.02 +-0.28727 0.23 0.073782 0.02 +-0.26714 0.23 0.090031 0.02 +-0.3319 0.14469 0.096101 0.02 +-0.24684 0.23 0.12038 0.02 +-0.28736 0.18735 0.073828 0.02 +-0.34416 0.12778 0.14712 0.02 +-0.29872 0.16586 0.079507 0.02 +-0.30387 0.13473 0.13605 0.02 +-0.25615 0.17839 0.12294 0.02 +-0.2762 0.20835 0.068246 0.02 +-0.24443 0.20021 0.11971 0.02 +-0.26805 0.15674 0.12621 0.02 +-0.24623 0.23 0.10141 0.02 +-0.3537 0.12778 0.107 0.02 +-0.30961 0.14407 0.084953 0.02 +-0.26512 0.23 0.062711 0.02 +-0.34865 0.11552 0.12824 0.02 +-0.27979 0.13491 0.12943 0.02 +-0.31991 0.11574 0.14045 0.02 +-0.27639 0.16572 0.068342 0.02 +-0.24437 0.23 0.07654 0.02 +-0.32105 0.1229 0.090675 0.02 +-0.26512 0.1867 0.062711 0.02 +-0.28736 0.14469 0.073826 0.02 +-0.22251 0.23 0.11369 0.02 +-0.24403 0.15715 0.1196 0.02 +-0.23207 0.17886 0.11632 0.02 +-0.34416 0.10222 0.14712 0.02 +-0.29258 0.11315 0.13294 0.02 +-0.25405 0.20835 0.057175 0.02 +-0.22042 0.20028 0.11312 0.02 +-0.25569 0.1353 0.12281 0.02 +-0.22385 0.23 0.0904 0.02 +-0.29893 0.12333 0.079614 0.02 +-0.3537 0.10222 0.107 0.02 +-0.3325 0.10164 0.096396 0.02 +-0.24298 0.23 0.051639 0.02 +-0.32807 0.091408 0.1427 0.02 +-0.26849 0.11391 0.12632 0.02 +-0.34924 0.091011 0.12577 0.02 +-0.25406 0.16527 0.057177 0.02 +-0.26549 0.14393 0.062893 0.02 +-0.30398 0.091705 0.13608 0.02 +-0.24278 0.18678 0.051537 0.02 +-0.3103 0.10184 0.085299 0.02 +-0.22223 0.23 0.065468 0.02 +-0.21993 0.1573 0.11298 0.02 +-0.27667 0.12276 0.068483 0.02 +-0.208 0.17887 0.1097 0.02 +-0.23158 0.13543 0.11618 0.02 +-0.19818 0.23 0.107 0.02 +-0.23191 0.20835 0.046103 0.02 +-0.34416 0.076667 0.14712 0.02 +-0.27988 0.091912 0.12945 0.02 +-0.2444 0.11458 0.11971 0.02 +-0.19633 0.20069 0.1065 0.02 +-0.28796 0.10167 0.07413 0.02 +-0.20147 0.23 0.079297 0.02 +-0.3537 0.076667 0.107 0.02 +-0.31922 0.071641 0.14027 0.02 +-0.32174 0.080015 0.091018 0.02 +-0.22084 0.23 0.040567 0.02 +-0.24324 0.14396 0.051768 0.02 +-0.23175 0.16533 0.046026 0.02 +-0.34848 0.066463 0.12895 0.02 +-0.25591 0.092621 0.12287 0.02 +-0.25434 0.12229 0.057318 0.02 +-0.22139 0.18718 0.040843 0.02 +-0.29178 0.07018 0.13272 0.02 +-0.19596 0.15784 0.10639 0.02 +-0.20749 0.13592 0.10956 0.02 +-0.29921 0.080114 0.079754 0.02 +-0.20008 0.23 0.054396 0.02 +-0.26578 0.10096 0.06304 0.02 +-0.21909 0.11497 0.11275 0.02 +-0.18395 0.17948 0.10309 0.02 +-0.20977 0.20835 0.035031 0.02 +-0.17385 0.23 0.10032 0.02 +-0.26769 0.070961 0.12611 0.02 +-0.34416 0.051111 0.14712 0.02 +-0.33292 0.058437 0.09661 0.02 +-0.17242 0.20046 0.099927 0.02 +-0.23146 0.092088 0.11615 0.02 +-0.27689 0.080165 0.068595 0.02 +-0.17916 0.23 0.068053 0.02 +-0.3537 0.051111 0.107 0.02 +-0.22094 0.14376 0.040617 0.02 +-0.23224 0.12221 0.046271 0.02 +-0.31078 0.058293 0.085538 0.02 +-0.21036 0.16548 0.035329 0.02 +-0.30316 0.048773 0.13585 0.02 +-0.19869 0.23 0.029495 0.02 +-0.24354 0.10099 0.051916 0.02 +-0.3495 0.042062 0.12466 0.02 +-0.24295 0.071296 0.11931 0.02 +-0.18378 0.13627 0.10305 0.02 +-0.19917 0.18708 0.029735 0.02 +-0.17189 0.158 0.09978 0.02 +-0.19499 0.11454 0.10613 0.02 +-0.27907 0.048946 0.12923 0.02 +-0.28847 0.058804 0.074382 0.02 +-0.17794 0.23 0.043324 0.02 +-0.25464 0.079323 0.057468 0.02 +-0.20738 0.093123 0.10953 0.02 +-0.15999 0.17906 0.096511 0.02 +-0.18762 0.20835 0.023959 0.02 +-0.3276 0.037407 0.093948 0.02 +-0.14952 0.23 0.093633 0.02 +-0.25506 0.049694 0.12264 0.02 +-0.34416 0.025556 0.14712 0.02 +-0.3185 0.027153 0.14007 0.02 +-0.14833 0.20089 0.093307 0.02 +-0.21854 0.070993 0.1126 0.02 +-0.20939 0.12237 0.034845 0.02 +-0.19864 0.14427 0.029469 0.02 +-0.26613 0.058369 0.063215 0.02 +-0.22146 0.10176 0.04088 0.02 +-0.15567 0.23 0.058995 0.02 +-0.3537 0.025556 0.107 0.02 +-0.18815 0.16536 0.024226 0.02 +-0.2991 0.037034 0.079697 0.02 +-0.29093 0.027246 0.13249 0.02 +-0.17655 0.23 0.018424 0.02 +-0.34905 0.018635 0.12658 0.02 +-0.15989 0.13633 0.096484 0.02 +-0.17167 0.11452 0.099719 0.02 +-0.23189 0.079732 0.046096 0.02 +-0.23099 0.049597 0.11602 0.02 +-0.17692 0.18694 0.018607 0.02 +-0.18336 0.092668 0.10293 0.02 +-0.14779 0.15791 0.093158 0.02 +-0.26704 0.027346 0.12593 0.02 +-0.24416 0.059211 0.052229 0.02 +-0.27681 0.036434 0.068554 0.02 +-0.33245 0.015831 0.096376 0.02 +-0.1558 0.23 0.032253 0.02 +-0.13675 0.23 0.070796 0.02 +-0.19553 0.071445 0.10628 0.02 +-0.13594 0.17967 0.089901 0.02 +-0.16548 0.20835 0.012888 0.02 +-0.31055 0.015585 0.085423 0.02 +-0.32631 0.004974 0.14221 0.02 +-0.19943 0.10168 0.029864 0.02 +-0.18753 0.12263 0.023916 0.02 +-0.12519 0.23 0.086947 0.02 +-0.243 0.028094 0.11932 0.02 +-0.17647 0.14429 0.018385 0.02 +-0.30229 0.00526 0.13561 0.02 +-0.12441 0.20074 0.086734 0.02 +-0.21051 0.080068 0.035403 0.02 +-0.34416 0 0.14712 0.02 +-0.20693 0.049096 0.10941 0.02 +-0.25448 0.037152 0.05739 0.02 +-0.16589 0.16521 0.013092 0.02 +-0.13487 0.23 0.045909 0.02 +-0.28821 0.015287 0.074252 0.02 +-0.3537 0 0.107 0.02 +-0.27825 0.006241 0.12901 0.02 +-0.1476 0.11483 0.093106 0.02 +-0.22209 0.058721 0.041193 0.02 +-0.15926 0.093129 0.096311 0.02 +-0.15441 0.23 0.007352 0.02 +-0.13549 0.13644 0.089777 0.02 +-0.17145 0.071565 0.099659 0.02 +-0.15461 0.18678 0.007454 0.02 +-0.12371 0.15813 0.08654 0.02 +-0.21949 0.027802 0.11286 0.02 +-0.25423 0.006236 0.12241 0.02 +-0.32031 -0.004552 0.090303 0.02 +-0.26613 0.015923 0.063215 0.02 +-0.23351 0.03732 0.046903 0.02 +-0.13365 0.23 0.021181 0.02 +-0.18331 0.049927 0.10292 0.02 +-0.11432 0.23 0.05984 0.02 +-0.3194 -0.014913 0.14032 0.02 +-0.11163 0.17976 0.083223 0.02 +-0.17724 0.10128 0.018767 0.02 +-0.34892 -0.016908 0.1271 0.02 +-0.16556 0.12254 0.012928 0.02 +-0.18864 0.079833 0.02447 0.02 +-0.14333 0.20835 0.001816 0.02 +-0.29901 -0.006581 0.079653 0.02 +-0.15433 0.14409 0.007312 0.02 +-0.29009 -0.014693 0.13226 0.02 +-0.23103 0.006658 0.11603 0.02 +-0.10085 0.23 0.080261 0.02 +-0.19976 0.0583 0.030029 0.02 +-0.19541 0.02833 0.10624 0.02 +-0.10049 0.20105 0.080161 0.02 +-0.24386 0.015586 0.052077 0.02 +-0.34416 -0.025556 0.14712 0.02 +-0.14359 0.16595 0.001944 0.02 +-0.13575 0.093235 0.089851 0.02 +-0.12353 0.11474 0.086492 0.02 +-0.11314 0.23 0.035041 0.02 +-0.27667 -0.006038 0.068484 0.02 +-0.26601 -0.015203 0.12564 0.02 +-0.21119 0.038384 0.035743 0.02 +-0.14737 0.071394 0.093042 0.02 +-0.11177 0.13653 0.083261 0.02 +-0.3537 -0.025556 0.107 0.02 +-0.13226 0.23 -0.00372 0.02 +-0.33233 -0.025494 0.096316 0.02 +-0.15963 0.049902 0.096412 0.02 +-0.099625 0.15809 0.079923 0.02 +-0.13226 0.1867 -0.00372 0.02 +-0.34888 -0.033429 0.12725 0.02 +-0.20695 0.006476 0.10941 0.02 +-0.31042 -0.026846 0.085356 0.02 +-0.24317 -0.01562 0.11937 0.02 +-0.25526 -0.005894 0.057777 0.02 +-0.32632 -0.037351 0.14222 0.02 +-0.15493 0.10078 0.007612 0.02 +-0.22159 0.016279 0.040943 0.02 +-0.16647 0.079387 0.013383 0.02 +-0.14395 0.12233 0.002123 0.02 +-0.17139 0.028224 0.099642 0.02 +-0.11151 0.23 0.010109 0.02 +-0.092358 0.23 0.048847 0.02 +-0.30249 -0.037029 0.13567 0.02 +-0.087796 0.17985 0.076672 0.02 +-0.17743 0.058241 0.018864 0.02 +-0.1332 0.14386 -0.003251 0.02 +-0.12119 0.20835 -0.009256 0.02 +-0.28815 -0.027418 0.074223 0.02 +-0.27841 -0.036536 0.12905 0.02 +-0.18918 0.036652 0.024737 0.02 +-0.11166 0.093552 0.083231 0.02 +-0.21909 -0.015038 0.11275 0.02 +-0.076523 0.23 0.073575 0.02 +-0.12349 0.071781 0.08648 0.02 +-0.099544 0.11502 0.079901 0.02 +-0.18316 0.00689 0.10288 0.02 +-0.076435 0.20171 0.07355 0.02 +-0.1214 0.16505 -0.009153 0.02 +-0.23218 -0.00571 0.046241 0.02 +-0.34416 -0.051111 0.14712 0.02 +-0.13555 0.050144 0.089794 0.02 +-0.090755 0.23 0.023938 0.02 +-0.087675 0.13677 0.076639 0.02 +-0.26585 -0.027616 0.063072 0.02 +-0.20154 0.015921 0.03092 0.02 +-0.25467 -0.037157 0.12253 0.02 +-0.32114 -0.04661 0.090721 0.02 +-0.3537 -0.051111 0.107 0.02 +-0.11012 0.23 -0.014792 0.02 +-0.14731 0.028441 0.093027 0.02 +-0.075601 0.15831 0.073321 0.02 +-0.10992 0.18678 -0.014893 0.02 +-0.14414 0.079647 0.002219 0.02 +-0.19526 -0.015309 0.1062 0.02 +-0.29946 -0.048525 0.079878 0.02 +-0.13261 0.10084 -0.003545 0.02 +-0.31405 -0.058737 0.13884 0.02 +-0.1552 0.057957 0.007747 0.02 +-0.2306 -0.036927 0.11591 0.02 +-0.071566 0.23 0.04252 0.02 +-0.24355 -0.027117 0.051923 0.02 +-0.21188 -0.005548 0.036086 0.02 +-0.12166 0.12254 -0.009019 0.02 +-0.16882 0.036349 0.01456 0.02 +-0.28997 -0.058368 0.13223 0.02 +-0.15907 0.006771 0.096258 0.02 +-0.064349 0.18027 0.070229 0.02 +-0.089365 0.23 -0.000962 0.02 +-0.27747 -0.047519 0.068883 0.02 +-0.11086 0.14441 -0.014419 0.02 +-0.099048 0.20835 -0.020327 0.02 +-0.26597 -0.057518 0.12563 0.02 +-0.099795 0.0718 0.07997 0.02 +-0.087587 0.093347 0.076615 0.02 +-0.17925 0.014274 0.019773 0.02 +-0.34882 -0.069746 0.12754 0.02 +-0.33174 -0.066249 0.096018 0.02 +-0.11147 0.050118 0.083177 0.02 +-0.075445 0.11494 0.073278 0.02 +-0.20657 -0.036071 0.10931 0.02 +-0.052192 0.23 0.066889 0.02 +-0.17117 -0.014781 0.099583 0.02 +-0.099048 0.16513 -0.020327 0.02 +-0.05237 0.20192 0.066938 0.02 +-0.22189 -0.027279 0.041095 0.02 +-0.1236 0.028547 0.086512 0.02 +-0.063589 0.13666 0.070021 0.02 +-0.25516 -0.048422 0.057731 0.02 +-0.30985 -0.067399 0.085075 0.02 +-0.069085 0.23 0.012836 0.02 +-0.34416 -0.076667 0.14712 0.02 +-0.18966 -0.005073 0.024977 0.02 +-0.24233 -0.058595 0.11914 0.02 +-0.087976 0.23 -0.025863 0.02 +-0.3537 -0.076667 0.107 0.02 +-0.32531 -0.079326 0.14194 0.02 +-0.13549 0.006809 0.089779 0.02 +-0.13146 0.060716 -0.004121 0.02 +-0.052007 0.15895 0.066838 0.02 +-0.14648 0.037183 0.00339 0.02 +-0.08818 0.18678 -0.025761 0.02 +-0.11027 0.10106 -0.014716 0.02 +-0.30161 -0.080118 0.13543 0.02 +-0.28767 -0.069655 0.073984 0.02 +-0.1173 0.08114 -0.0112 0.02 +-0.18273 -0.036651 0.10276 0.02 +-0.21838 -0.057789 0.11256 0.02 +-0.23285 -0.048848 0.046574 0.02 +-0.19967 -0.026332 0.029984 0.02 +-0.15703 0.01515 0.008664 0.02 +-0.27764 -0.079261 0.12884 0.02 +-0.048486 0.23 0.029036 0.02 +-0.097341 0.11863 -0.021181 0.02 +-0.1473 -0.014976 0.093023 0.02 +-0.040114 0.18059 0.06357 0.02 +-0.067222 0.23 -0.012034 0.02 +-0.075767 0.072094 0.073367 0.02 +-0.26689 -0.069493 0.063594 0.02 +-0.087765 0.050501 0.076664 0.02 +-0.063592 0.093537 0.070021 0.02 +-0.076904 0.20835 -0.031399 0.02 +-0.25366 -0.07847 0.12225 0.02 +-0.087 0.14072 -0.026352 0.02 +-0.16786 -0.006559 0.014077 0.02 +-0.099691 0.0288 0.079941 0.02 +-0.34836 -0.093174 0.12946 0.02 +-0.051416 0.11502 0.066676 0.02 +-0.3203 -0.089459 0.090296 0.02 +-0.19434 -0.057303 0.10595 0.02 +-0.027861 0.23 0.060203 0.02 +-0.076727 0.16536 -0.031488 0.02 +-0.15869 -0.035888 0.096155 0.02 +-0.11142 0.006985 0.083164 0.02 +-0.21053 -0.048756 0.035415 0.02 +-0.039867 0.13736 0.063502 0.02 +-0.028142 0.20237 0.06028 0.02 +-0.24469 -0.069669 0.052496 0.02 +-0.30024 -0.089861 0.080266 0.02 +-0.17993 -0.027426 0.020116 0.02 +-0.046707 0.23 0.001826 0.02 +-0.22968 -0.079831 0.11566 0.02 +-0.31289 -0.10027 0.13853 0.02 +-0.12253 0.037824 -0.008587 0.02 +-0.34416 -0.10222 0.14712 0.02 +-0.10927 0.057834 -0.015215 0.02 +-0.065833 0.23 -0.036935 0.02 +-0.027187 0.23 0.039959 0.02 +-0.3537 -0.10222 0.107 0.02 +-0.1232 -0.014657 0.086402 0.02 +-0.027907 0.15903 0.060216 0.02 +-0.13437 0.015103 -0.002664 0.02 +-0.28891 -0.10133 0.13194 0.02 +-0.27823 -0.090537 0.069265 0.02 +-0.065833 0.1867 -0.036935 0.02 +-0.095246 0.077176 -0.022228 0.02 +-0.17113 -0.05728 0.099571 0.02 +-0.084926 0.098122 -0.027388 0.02 +-0.2067 -0.078735 0.10935 0.02 +-0.22262 -0.069582 0.041461 0.02 +-0.19076 -0.048503 0.02553 0.02 +-0.26499 -0.1005 0.12536 0.02 +-0.14553 -0.006248 0.002914 0.02 +-0.063886 0.050698 0.070102 0.02 +-0.075211 0.11955 -0.032246 0.02 +-0.051735 0.0722 0.066763 0.02 +-0.33402 -0.10871 0.097156 0.02 +-0.075669 0.028902 0.07334 0.02 +-0.016011 0.18077 0.056947 0.02 +-0.13468 -0.03663 0.089557 0.02 +-0.039576 0.09368 0.063422 0.02 +-0.045079 0.23 -0.023106 0.02 +-0.025696 0.23 0.015047 0.02 +-0.25593 -0.091231 0.058114 0.02 +-0.15762 -0.026994 0.008956 0.02 +-0.054761 0.20835 -0.042471 0.02 +-0.24252 -0.10053 0.11919 0.02 +-0.08734 0.007433 0.076547 0.02 +-0.027668 0.11581 0.06015 0.02 +-0.31209 -0.11103 0.086195 0.02 +-0.34938 -0.11757 0.12517 0.02 +-0.062642 0.14015 -0.03853 0.02 +-0.18271 -0.079166 0.10275 0.02 +-0.054939 0.16536 -0.042382 0.02 +-0.32555 -0.12152 0.14201 0.02 +-0.09925 -0.013907 0.07982 0.02 +-0.20043 -0.070279 0.030361 0.02 +-0.015789 0.13755 0.056886 0.02 +-0.14705 -0.057674 0.092954 0.02 +-0.00353 0.23 0.053517 0.02 +-0.28977 -0.11184 0.075032 0.02 +-0.10037 0.035336 -0.019667 0.02 +-0.11338 0.015038 -0.01316 0.02 +-0.004037 0.20246 0.053656 0.02 +-0.23359 -0.091276 0.046944 0.02 +-0.30148 -0.12217 0.13539 0.02 +-0.21879 -0.10033 0.11267 0.02 +-0.16856 -0.048748 0.014427 0.02 +-0.024324 0.23 -0.009277 0.02 +-0.087566 0.053803 -0.026069 0.02 +-0.077121 0.075858 -0.031291 0.02 +-0.34416 -0.12778 0.14712 0.02 +-0.27778 -0.12157 0.12888 0.02 +-0.043689 0.23 -0.048007 0.02 +-0.12417 -0.006834 -0.007768 0.02 +-0.066304 0.097687 -0.036699 0.02 +-0.005008 0.23 0.029013 0.02 +-0.1106 -0.035923 0.082938 0.02 +-0.00381 0.15925 0.053594 0.02 +-0.3537 -0.12778 0.107 0.02 +-0.26747 -0.11238 0.063882 0.02 +-0.043486 0.18678 -0.048109 0.02 +-0.03963 0.050889 0.063437 0.02 +-0.051611 0.029196 0.066729 0.02 +-0.027632 0.072579 0.06014 0.02 +-0.13535 -0.028437 -0.002178 0.02 +-0.25377 -0.12217 0.12228 0.02 +-0.15866 -0.079553 0.096147 0.02 +-0.19471 -0.10028 0.10605 0.02 +-0.21207 -0.091573 0.036183 0.02 +-0.17825 -0.069014 0.019272 0.02 +-0.053134 0.11759 -0.043284 0.02 +-0.32487 -0.13143 0.092586 0.02 +-0.063257 0.007526 0.069929 0.02 +-0.015643 0.094268 0.056846 0.02 +-0.12329 -0.056986 0.086427 0.02 +-0.043982 0.14363 -0.04786 0.02 +-0.24531 -0.11219 0.052802 0.02 +0.008062 0.18084 0.050332 0.02 +-0.022935 0.23 -0.034178 0.02 +-0.14637 -0.046838 0.003334 0.02 +-0.003394 0.23 0.004104 0.02 +-0.07515 -0.014106 0.073197 0.02 +-0.003657 0.11595 0.053552 0.02 +-0.032618 0.20835 -0.053543 0.02 +-0.23048 -0.12208 0.11588 0.02 +-0.30262 -0.13365 0.08146 0.02 +-0.34863 -0.14212 0.12835 0.02 +-0.31882 -0.1426 0.14016 0.02 +-0.07807 0.034478 -0.030816 0.02 +-0.089734 0.013407 -0.024984 0.02 +-0.087349 -0.035641 0.07655 0.02 +-0.032618 0.16513 -0.053543 0.02 +-0.17085 -0.10086 0.099494 0.02 +0.008316 0.13764 0.050262 0.02 +-0.065265 0.054872 -0.037219 0.02 +-0.27904 -0.13376 0.069667 0.02 +-0.18835 -0.091269 0.024323 0.02 +-0.22324 -0.11192 0.041769 0.02 +-0.13459 -0.078972 0.08953 0.02 +-0.28912 -0.14352 0.13199 0.02 +-0.10166 -0.007674 -0.019023 0.02 +-0.054922 0.07622 -0.04239 0.02 +0.020801 0.23 0.046831 0.02 +0.020002 0.20258 0.047051 0.02 +-0.15632 -0.069088 0.00831 0.02 +-0.20658 -0.12197 0.10931 0.02 +-0.00242 0.23 -0.020318 0.02 +-0.11314 -0.028532 -0.013283 0.02 +-0.26611 -0.14359 0.12567 0.02 +-0.044151 0.094765 -0.047776 0.02 +-0.021546 0.23 -0.059078 0.02 +-0.34416 -0.15333 0.14712 0.02 +-0.099344 -0.0573 0.079846 0.02 +0.016958 0.23 0.018269 0.02 +0.020296 0.15933 0.04697 0.02 +-0.20213 -0.10835 0.031212 0.02 +-0.027505 0.029282 0.060105 0.02 +-0.015514 0.050968 0.05681 0.02 +-0.021749 0.18678 -0.058977 0.02 +-0.25625 -0.13433 0.058275 0.02 +-0.3537 -0.15333 0.107 0.02 +-0.039485 0.007589 0.063397 0.02 +-0.003526 0.072655 0.053516 0.02 +-0.12477 -0.049686 -0.007467 0.02 +-0.031457 0.11816 -0.054123 0.02 +-0.24205 -0.14377 0.11906 0.02 +-0.14697 -0.10034 0.092932 0.02 +-0.18254 -0.12158 0.10271 0.02 +-0.051427 -0.014143 0.066679 0.02 +-0.16734 -0.090701 0.013821 0.02 +0.008439 0.094333 0.050228 0.02 +-0.11158 -0.078792 0.083209 0.02 +-0.021648 0.14348 -0.059028 0.02 +-0.13784 -0.069763 -0.000933 0.02 +-0.23406 -0.1337 0.047181 0.02 +0.032141 0.18098 0.043715 0.02 +-0.000792 0.23 -0.045249 0.02 +0.018334 0.23 -0.006489 0.02 +-0.063334 -0.035871 0.069951 0.02 +0.020417 0.11603 0.046937 0.02 +-0.32556 -0.16515 0.14201 0.02 +-0.218 -0.14341 0.11245 0.02 +-0.010474 0.20835 -0.064614 0.02 +-0.067937 0.012567 -0.035883 0.02 +-0.32499 -0.1623 0.092646 0.02 +-0.30171 -0.16476 0.13545 0.02 +-0.34921 -0.16663 0.12588 0.02 +-0.056105 0.032157 -0.041799 0.02 +-0.045087 0.05386 -0.047308 0.02 +-0.079526 -0.008771 -0.030088 0.02 +-0.18001 -0.11108 0.020154 0.02 +-0.010678 0.16513 -0.064512 0.02 +-0.07526 -0.057162 0.073228 0.02 +-0.090796 -0.029261 -0.024453 0.02 +-0.27767 -0.1652 0.12885 0.02 +0.03242 0.13771 0.043638 0.02 +-0.15847 -0.12225 0.096093 0.02 +-0.20979 -0.13154 0.035042 0.02 +-0.032703 0.074276 -0.0535 0.02 +-0.12293 -0.10053 0.086326 0.02 +-0.14771 -0.091065 0.004005 0.02 +-0.29853 -0.16507 0.079416 0.02 +0.044109 0.20268 0.040426 0.02 +0.045132 0.23 0.040145 0.02 +-0.19423 -0.14342 0.10592 0.02 +0.019963 0.23 -0.03142 0.02 +-0.10246 -0.050448 -0.018623 0.02 +-0.021462 0.09585 -0.05912 0.02 +-0.25364 -0.1649 0.12224 0.02 +-0.27175 -0.16128 0.066021 0.02 +-0.003403 0.029353 0.053482 0.02 +-0.01538 0.00768 0.056773 0.02 +0.008584 0.051042 0.050188 0.02 +0.000598 0.23 -0.07015 0.02 +-0.087186 -0.078881 0.076505 0.02 +-0.34416 -0.17889 0.14712 0.02 +0.044295 0.15932 0.040375 0.02 +-0.027352 -0.014073 0.060063 0.02 +-0.19283 -0.13095 0.026566 0.02 +0.02057 0.072731 0.046895 0.02 +0.042291 0.23 0.010986 0.02 +0.000598 0.1867 -0.07015 0.02 +-0.3537 -0.17889 0.107 0.02 +-0.11565 -0.072464 -0.012029 0.02 +-0.23021 -0.16493 0.11581 0.02 +-0.009192 0.1165 -0.065255 0.02 +-0.039236 -0.035673 0.063329 0.02 +-0.1351 -0.12209 0.089672 0.02 +0.032544 0.094422 0.043604 0.02 +-0.15785 -0.11253 0.009073 0.02 +-0.22274 -0.15151 0.041517 0.02 +-0.17098 -0.14348 0.09953 0.02 +-0.24405 -0.16105 0.052175 0.02 +-0.098894 -0.099966 0.079722 0.02 +-0.12558 -0.090377 -0.00706 0.02 +0.056247 0.18108 0.037091 0.02 +-0.051156 -0.057215 0.066604 0.02 +0.021352 0.23 -0.056321 0.02 +-0.057305 -0.009384 -0.041199 0.02 +0.040717 0.23 -0.017591 0.02 +-0.033902 0.032263 -0.052901 0.02 +0.044523 0.11612 0.040313 0.02 +-0.04445 0.011027 -0.047626 0.02 +0.00224 0.13796 -0.070972 0.02 +-0.20613 -0.16507 0.10919 0.02 +-0.33192 -0.18694 0.096109 0.02 +-0.32275 -0.18965 0.14124 0.02 +-0.28948 -0.18647 0.13209 0.02 +0.011669 0.20835 -0.075686 0.02 +-0.068484 -0.030339 -0.035609 0.02 +-0.17093 -0.13165 0.015614 0.02 +-0.021344 0.052896 -0.059179 0.02 +-0.30961 -0.18678 0.084956 0.02 +-0.080556 -0.051346 -0.029573 0.02 +-0.20333 -0.15322 0.031812 0.02 +-0.34898 -0.19388 0.12686 0.02 +-0.063245 -0.078833 0.069926 0.02 +-0.2654 -0.1867 0.12548 0.02 +0.011669 0.16505 -0.075686 0.02 +-0.010461 0.074123 -0.064621 0.02 +0.05652 0.13779 0.037016 0.02 +-0.14698 -0.1437 0.092936 0.02 +-0.28727 -0.1867 0.073782 0.02 +-0.093521 -0.071099 -0.023091 0.02 +-0.11044 -0.12189 0.082894 0.02 +-0.13566 -0.11191 -0.002023 0.02 +0.008726 0.007755 0.050149 0.02 +0.020698 0.029429 0.046859 0.02 +0.068215 0.20278 0.033802 0.02 +0.069463 0.23 0.033459 0.02 +-0.18323 -0.16516 0.1029 0.02 +-0.24275 -0.18611 0.11925 0.02 +-0.003264 -0.013933 0.053444 0.02 +0.032684 0.051118 0.043566 0.02 +0.042106 0.23 -0.042492 0.02 +0.001909 0.094909 -0.070806 0.02 +0.022741 0.23 -0.081222 0.02 +-0.015138 -0.035605 0.056707 0.02 +-0.075253 -0.1005 0.073226 0.02 +-0.26533 -0.18678 0.062812 0.02 +0.044655 0.072813 0.040276 0.02 +0.068386 0.15948 0.033755 0.02 +0.063145 0.23 -0.001876 0.02 +-0.18243 -0.15294 0.021366 0.02 +0.022741 0.1867 -0.081222 0.02 +-0.1494 -0.13134 0.004849 0.02 +-0.34416 -0.20444 0.14712 0.02 +-0.10416 -0.092832 -0.017773 0.02 +-0.21879 -0.18625 0.11267 0.02 +-0.3537 -0.20444 0.107 0.02 +0.01308 0.11612 -0.076391 0.02 +-0.027107 -0.057268 0.059996 0.02 +0.05665 0.094511 0.03698 0.02 +-0.123 -0.14314 0.086346 0.02 +-0.024759 0.010227 -0.057472 0.02 +-0.22054 -0.17781 0.040419 0.02 +-0.24298 -0.1867 0.051639 0.02 +-0.15916 -0.16524 0.096284 0.02 +-0.048393 -0.031656 -0.045655 0.02 +-0.035172 -0.011679 -0.052265 0.02 +-0.30167 -0.20804 0.13544 0.02 +0.022638 0.14364 -0.081171 0.02 +-0.11684 -0.11314 -0.01143 0.02 +-0.087528 -0.12188 0.076599 0.02 +-0.011763 0.030356 -0.06397 0.02 +-0.32242 -0.20775 0.09136 0.02 +-0.039175 -0.078898 0.063312 0.02 +0.080353 0.18118 0.030467 0.02 +0.068628 0.11618 0.033689 0.02 +0.043495 0.23 -0.067393 0.02 +-0.000972 0.052076 -0.069366 0.02 +0.063028 0.23 -0.028836 0.02 +-0.27757 -0.20818 0.12882 0.02 +-0.058331 -0.053805 -0.040686 0.02 +-0.19477 -0.18676 0.10607 0.02 +0.033813 0.20835 -0.086758 0.02 +-0.29834 -0.20835 0.079318 0.02 +-0.15991 -0.15314 0.010105 0.02 +-0.071426 -0.074031 -0.034138 0.02 +-0.25355 -0.20805 0.12222 0.02 +0.082468 0.23 0.009784 0.02 +0.011733 0.072488 -0.075718 0.02 +-0.051155 -0.10042 0.066604 0.02 +0.034016 0.16513 -0.08686 0.02 +0.032829 0.007832 0.043526 0.02 +0.080524 0.13788 0.03042 0.02 +0.020842 -0.013858 0.04682 0.02 +0.044799 0.029507 0.040237 0.02 +-0.2762 -0.20835 0.068246 0.02 +-0.12739 -0.13414 -0.006158 0.02 +-0.13452 -0.16507 0.089512 0.02 +-0.19554 -0.17895 0.027918 0.02 +-0.081851 -0.092358 -0.028926 0.02 +-0.098969 -0.14354 0.079743 0.02 +0.008854 -0.035544 0.050114 0.02 +0.056771 0.051206 0.036947 0.02 +-0.22955 -0.20692 0.11563 0.02 +0.02284 0.094056 -0.081271 0.02 +0.092321 0.20289 0.027178 0.02 +-0.17115 -0.18675 0.099577 0.02 +0.093794 0.23 0.026773 0.02 +0.064418 0.23 -0.053736 0.02 +-0.003128 -0.057243 0.053407 0.02 +0.068755 0.072893 0.033654 0.02 +-0.25405 -0.20835 0.057175 0.02 +0.044885 0.23 -0.092294 0.02 +-0.063213 -0.12206 0.069917 0.02 +0.083931 0.23 -0.015167 0.02 +0.092492 0.15958 0.027131 0.02 +-0.094624 -0.11538 -0.022539 0.02 +-0.16954 -0.17305 0.014918 0.02 +0.045088 0.18678 -0.092395 0.02 +-0.026093 -0.030878 -0.056805 0.02 +-0.13761 -0.15251 -0.001046 0.02 +-0.002442 0.010507 -0.06863 0.02 +-0.34416 -0.23 0.14712 0.02 +-0.013513 -0.011159 -0.063095 0.02 +-0.015106 -0.078939 0.056698 0.02 +-0.34893 -0.23 0.12706 0.02 +-0.31983 -0.23 0.14043 0.02 +-0.20702 -0.20826 0.10943 0.02 +0.035318 0.11468 -0.08751 0.02 +0.08075 0.094576 0.030358 0.02 +-0.3537 -0.23 0.107 0.02 +-0.31565 -0.23 0.11345 0.02 +-0.036791 -0.052769 -0.051456 0.02 +-0.2955 -0.23 0.13375 0.02 +-0.11131 -0.16499 0.083135 0.02 +-0.33155 -0.23 0.095926 0.02 +0.010043 0.030496 -0.074873 0.02 +-0.1472 -0.1862 0.092997 0.02 +-0.23191 -0.20835 0.046103 0.02 +-0.049272 -0.072425 -0.045215 0.02 +0.044975 0.14346 -0.092339 0.02 +-0.29102 -0.23 0.10382 0.02 +-0.30941 -0.23 0.084854 0.02 +-0.10523 -0.13424 -0.017237 0.02 +0.021355 0.052016 -0.080529 0.02 +-0.074939 -0.14311 0.07314 0.02 +-0.27117 -0.23 0.12706 0.02 +-0.027063 -0.10047 0.059984 0.02 +0.092663 0.11628 0.027084 0.02 +0.065639 0.23 -0.078465 0.02 +0.10446 0.18129 0.023843 0.02 +0.085342 0.23 -0.040082 0.02 +-0.18294 -0.20841 0.10282 0.02 +-0.28727 -0.23 0.073782 0.02 +0.055956 0.20835 -0.097829 0.02 +-0.20919 -0.20558 0.034744 0.02 +-0.26714 -0.23 0.090031 0.02 +-0.059603 -0.094395 -0.04005 0.02 +-0.24684 -0.23 0.12038 0.02 +0.044948 -0.013778 0.040196 0.02 +0.033686 0.072323 -0.086694 0.02 +0.056934 0.007906 0.036902 0.02 +-0.24623 -0.23 0.10141 0.02 +0.032957 -0.035459 0.043491 0.02 +0.068905 0.029603 0.033613 0.02 +0.10483 0.23 -0.001455 0.02 +-0.03911 -0.12206 0.063294 0.02 +-0.15093 -0.1785 0.005612 0.02 +0.055996 0.16509 -0.097849 0.02 +-0.26512 -0.23 0.062711 0.02 +0.10463 0.13799 0.023796 0.02 +-0.072413 -0.11483 -0.033645 0.02 +0.020978 -0.057154 0.046782 0.02 +-0.11639 -0.15584 -0.011658 0.02 +-0.12321 -0.18664 0.086403 0.02 +0.080877 0.051302 0.030323 0.02 +-0.24437 -0.23 0.07654 0.02 +-0.086596 -0.16497 0.076343 0.02 +-0.22251 -0.23 0.11369 0.02 +0.045173 0.093739 -0.092438 0.02 +-0.18554 -0.20371 0.022919 0.02 +0.11643 0.20299 0.020554 0.02 +-0.15871 -0.20812 0.09616 0.02 +-0.22385 -0.23 0.0904 0.02 +0.009 -0.078849 0.050074 0.02 +0.11813 0.23 0.020087 0.02 +0.092834 0.072983 0.027037 0.02 +0.086652 0.23 -0.065033 0.02 +-0.24298 -0.23 0.051639 0.02 +-0.004037 -0.03359 -0.067833 0.02 +0.067028 0.23 -0.10337 0.02 +-0.051158 -0.14371 0.066605 0.02 +0.008735 -0.013128 -0.074219 0.02 +-0.083533 -0.13634 -0.028085 0.02 +0.10624 0.23 -0.02641 0.02 +0.019677 0.008105 -0.07969 0.02 +-0.22223 -0.23 0.065468 0.02 +0.1166 0.15969 0.020507 0.02 +-0.014541 -0.05462 -0.062581 0.02 +0.067028 0.1867 -0.10337 0.02 +-0.002978 -0.10054 0.053365 0.02 +-0.19818 -0.23 0.107 0.02 +-0.027241 -0.07513 -0.056231 0.02 +0.057384 0.11429 -0.098543 0.02 +0.1048 0.094684 0.023749 0.02 +-0.20147 -0.23 0.079297 0.02 +0.03231 0.028686 -0.086006 0.02 +-0.04037 -0.095299 -0.049666 0.02 +-0.12929 -0.17974 -0.005209 0.02 +-0.099184 -0.18621 0.079802 0.02 +-0.22084 -0.23 0.040567 0.02 +-0.13558 -0.20807 0.089802 0.02 +0.067312 0.14356 -0.10351 0.02 +0.043542 0.050008 -0.091622 0.02 +-0.09605 -0.15686 -0.021826 0.02 +-0.16373 -0.20471 0.012014 0.02 +-0.015018 -0.1221 0.056674 0.02 +-0.063554 -0.16505 0.070011 0.02 +-0.20008 -0.23 0.054396 0.02 +0.11677 0.11639 0.02046 0.02 +0.087782 0.23 -0.089536 0.02 +0.12857 0.18139 0.017218 0.02 +-0.17385 -0.23 0.10032 0.02 +-0.050799 -0.11648 -0.044452 0.02 +0.069048 -0.013679 0.033573 0.02 +0.10754 0.23 -0.051351 0.02 +0.057058 -0.035368 0.036868 0.02 +0.081039 0.008009 0.030278 0.02 +0.0781 0.20835 -0.1089 0.02 +-0.17916 -0.23 0.068053 0.02 +0.045084 -0.057064 0.040158 0.02 +0.055977 0.070752 -0.09784 0.02 +0.093005 0.029682 0.02699 0.02 +-0.19869 -0.23 0.029495 0.02 +0.1272 0.23 -0.012789 0.02 +-0.027055 -0.14369 0.059981 0.02 +0.07833 0.16516 -0.10902 0.02 +0.033106 -0.078759 0.04345 0.02 +0.10497 0.051383 0.023702 0.02 +0.12874 0.13809 0.017171 0.02 +-0.061209 -0.13642 -0.039247 0.02 +-0.10756 -0.17874 -0.016071 0.02 +-0.17794 -0.23 0.043324 0.02 +-0.11084 -0.20807 0.083004 0.02 +-0.14203 -0.20453 0.001166 0.02 +0.067409 0.092036 -0.10356 0.02 +-0.075147 -0.18666 0.073197 0.02 +0.01826 -0.032737 -0.078982 0.02 +-0.14952 -0.23 0.093633 0.02 +0.021128 -0.10045 0.046741 0.02 +0.11694 0.073085 0.020413 0.02 +0.14053 0.20309 0.01393 0.02 +0.007619 -0.054661 -0.073661 0.02 +0.030985 -0.01332 -0.085344 0.02 +0.14246 0.23 0.013402 0.02 +-0.018071 -0.094345 -0.060816 0.02 +0.042009 0.008396 -0.090856 0.02 +-0.15567 -0.23 0.058995 0.02 +0.10884 0.23 -0.076287 0.02 +0.089171 0.23 -0.11444 0.02 +-0.003493 -0.076291 -0.068105 0.02 +-0.17655 -0.23 0.018424 0.02 +-0.038974 -0.16529 0.063257 0.02 +-0.073793 -0.1588 -0.032955 0.02 +0.12851 0.23 -0.037753 0.02 +0.1407 0.15979 0.013883 0.02 +0.008999 -0.12182 0.050074 0.02 +0.089375 0.18678 -0.11454 0.02 +0.12891 0.094787 0.017125 0.02 +0.079692 0.1129 -0.1097 0.02 +0.054612 0.02836 -0.097157 0.02 +-0.1558 -0.23 0.032253 0.02 +-0.13675 -0.23 0.070796 0.02 +-0.028621 -0.11633 -0.055541 0.02 +-0.087542 -0.20808 0.076603 0.02 +0.065888 0.04993 -0.1028 0.02 +-0.12519 -0.23 0.086947 0.02 +0.089248 0.14347 -0.11448 0.02 +-0.003007 -0.1435 0.053373 0.02 +0.081164 -0.035292 0.030244 0.02 +0.093154 -0.013604 0.026949 0.02 +-0.13487 -0.23 0.045909 0.02 +-0.051107 -0.18638 0.066591 0.02 +0.14088 0.11649 0.013836 0.02 +0.069175 -0.056979 0.033538 0.02 +-0.12119 -0.20835 -0.009256 0.02 +0.10514 0.008084 0.023654 0.02 +-0.039279 -0.13736 -0.050212 0.02 +-0.15441 -0.23 0.007352 0.02 +0.10993 0.23 -0.10061 0.02 +0.15267 0.18149 0.010594 0.02 +0.12963 0.23 -0.061524 0.02 +0.057209 -0.078678 0.036827 0.02 +0.11711 0.029784 0.020366 0.02 +-0.08818 -0.18678 -0.025761 0.02 +0.10024 0.20835 -0.11997 0.02 +0.078295 0.070248 -0.109 0.02 +-0.13365 -0.23 0.021181 0.02 +-0.11432 -0.23 0.05984 0.02 +0.045234 -0.10036 0.040117 0.02 +0.026839 -0.055763 -0.083271 0.02 +0.12908 0.051486 0.017078 0.02 +-0.01487 -0.16524 0.056633 0.02 +0.14948 0.23 -0.024137 0.02 +0.10028 0.16509 -0.11999 0.02 +-0.050986 -0.15853 -0.044358 0.02 +0.15284 0.13819 0.010547 0.02 +0.040244 -0.035824 -0.089973 0.02 +0.016237 -0.076834 -0.07797 0.02 +-0.10085 -0.23 0.080261 0.02 +0.089758 0.091701 -0.11473 0.02 +0.033131 -0.12178 0.043443 0.02 +-0.062893 -0.20817 0.069829 0.02 +0.053207 -0.015524 -0.096455 0.02 +-0.11314 -0.23 0.035041 0.02 +0.14105 0.073187 0.013789 0.02 +0.005896 -0.098207 -0.072799 0.02 +0.064131 0.005893 -0.10192 0.02 +0.16464 0.20319 0.007306 0.02 +-0.13226 -0.23 -0.00372 0.02 +-0.006313 -0.11568 -0.066695 0.02 +-0.099048 -0.20835 -0.020327 0.02 +0.16679 0.23 0.006716 0.02 +0.10047 0.12186 -0.12009 0.02 +0.11131 0.23 -0.12551 0.02 +-0.026879 -0.18691 0.059933 0.02 +0.021099 -0.14344 0.046749 0.02 +0.16481 0.15989 0.007259 0.02 +0.11131 0.1867 -0.12551 0.02 +0.076872 0.026395 -0.10829 0.02 +0.15301 0.094889 0.0105 0.02 +-0.11151 -0.23 0.010109 0.02 +-0.092358 -0.23 0.048847 0.02 +-0.065833 -0.1867 -0.036935 0.02 +-0.017101 -0.13752 -0.061301 0.02 +0.10528 -0.035187 0.023618 0.02 +0.093272 -0.056907 0.026917 0.02 +0.14078 0.23 -0.082985 0.02 +0.088085 0.047882 -0.11389 0.02 +0.11726 -0.013497 0.020326 0.02 +-0.076523 -0.23 0.073575 0.02 +0.11158 0.14355 -0.12564 0.02 +0.081312 -0.078568 0.030203 0.02 +0.12924 0.008184 0.017032 0.02 +0.009095 -0.16512 0.050048 0.02 +0.15639 0.23 -0.053749 0.02 +-0.090755 -0.23 0.023938 0.02 +0.16498 0.11659 0.007212 0.02 +-0.038792 -0.20787 0.063207 0.02 +-0.028312 -0.15909 -0.055696 0.02 +-0.11012 -0.23 -0.014792 0.02 +0.069324 -0.10015 0.033497 0.02 +0.14122 0.029881 0.013742 0.02 +0.17678 0.18159 0.00397 0.02 +0.049145 -0.055037 -0.094424 0.02 +0.17322 0.23 -0.017504 0.02 +0.10058 0.068582 -0.12014 0.02 +-0.076904 -0.20835 -0.031399 0.02 +0.038416 -0.076913 -0.089059 0.02 +-0.071566 -0.23 0.04252 0.02 +0.057248 -0.12178 0.036816 0.02 +0.12427 0.20771 -0.13198 0.02 +0.15318 0.051588 0.010453 0.02 +-0.089365 -0.23 -0.000962 0.02 +0.13727 0.23 -0.11162 0.02 +-0.002782 -0.18683 0.053311 0.02 +0.028099 -0.097822 -0.083901 0.02 +0.064337 -0.037183 -0.10202 0.02 +0.17695 0.13829 0.003923 0.02 +0.075491 -0.015541 -0.1076 0.02 +0.11177 0.090122 -0.12574 0.02 +-0.043893 -0.18678 -0.047905 0.02 +0.045192 -0.14342 0.040129 0.02 +0.086471 0.006214 -0.11309 0.02 +-0.052192 -0.23 0.066889 0.02 +0.16515 0.07329 0.007165 0.02 +0.017297 -0.11966 -0.0785 0.02 +-0.069085 -0.23 0.012836 0.02 +0.004469 -0.13935 -0.072086 0.02 +0.18875 0.20329 0.000682 0.02 +0.12885 0.16542 -0.13428 0.02 +-0.087976 -0.23 -0.025863 0.02 +0.19112 0.23 0.00003 0.02 +0.13346 0.23 -0.13658 0.02 +-0.014764 -0.20852 0.056604 0.02 +0.099205 0.026228 -0.11945 0.02 +0.033198 -0.16505 0.043425 0.02 +0.17712 0.094991 0.003876 0.02 +0.18892 0.15999 0.000635 0.02 +0.13366 0.18678 -0.13668 0.02 +0.11737 -0.056811 0.020294 0.02 +0.12938 -0.035137 0.016993 0.02 +0.18358 0.23 -0.034721 0.02 +-0.007175 -0.16065 -0.066264 0.02 +-0.054761 -0.20835 -0.042471 0.02 +0.10542 -0.078498 0.02358 0.02 +0.14137 -0.013455 0.013699 0.02 +-0.048486 -0.23 0.029036 0.02 +-0.067222 -0.23 -0.012034 0.02 +0.11044 0.047835 -0.12507 0.02 +0.093431 -0.10018 0.026873 0.02 +0.15335 0.008279 0.010408 0.02 +0.12901 0.11699 -0.13436 0.02 +0.17254 0.23 -0.076358 0.02 +0.071368 -0.054003 -0.10554 0.02 +0.021315 -0.18666 0.04669 0.02 +0.17254 0.20444 -0.076358 0.02 +0.081353 -0.12181 0.030192 0.02 +0.060694 -0.07582 -0.1002 0.02 +0.18909 0.11669 0.000588 0.02 +0.16532 0.029989 0.007118 0.02 +-0.027861 -0.23 0.060203 0.02 +0.17254 0.17889 -0.076358 0.02 +0.13613 0.14141 -0.13792 0.02 +-0.021546 -0.1867 -0.059078 0.02 +-0.046707 -0.23 0.001826 0.02 +0.050213 -0.097826 -0.094958 0.02 +0.20088 0.1817 -0.002654 0.02 +0.16689 0.23 -0.10012 0.02 +0.17254 0.15333 -0.076358 0.02 +0.12419 0.069853 -0.13195 0.02 +0.085396 -0.036426 -0.11255 0.02 +-0.065833 -0.23 -0.036935 0.02 +0.16782 0.18704 -0.096215 0.02 +0.069271 -0.14344 0.033512 0.02 +-0.027187 -0.23 0.039959 0.02 +0.17729 0.05169 0.003829 0.02 +0.039153 -0.11947 -0.089428 0.02 +0.16749 0.16559 -0.097596 0.02 +0.16407 0.20835 -0.11201 0.02 +0.097552 -0.015841 -0.11863 0.02 +0.009413 -0.20839 0.049961 0.02 +0.026256 -0.13962 -0.082979 0.02 +0.17254 0.12778 -0.076358 0.02 +0.19022 0.23 -0.058763 0.02 +0.20106 0.13839 -0.002701 0.02 +0.16125 0.23 -0.12389 0.02 +0.13411 0.089781 -0.13691 0.02 +0.057298 -0.16501 0.036802 0.02 +-0.032618 -0.20835 -0.053543 0.02 +0.16754 0.14056 -0.097422 0.02 +0.10862 0.003671 -0.12416 0.02 +-0.045079 -0.23 -0.023106 0.02 +-0.025696 -0.23 0.015047 0.02 +0.18926 0.073392 0.000541 0.02 +0.16133 0.17868 -0.12354 0.02 +0.16312 0.15312 -0.116 0.02 +0.015147 -0.16114 -0.077425 0.02 +0.17254 0.10222 -0.076358 0.02 +0.21285 0.2034 -0.005943 0.02 +0.16749 0.11552 -0.097596 0.02 +0.14148 -0.056763 0.013671 0.02 +0.12146 0.024104 -0.13058 0.02 +0.12945 -0.078426 0.016975 0.02 +-0.00353 -0.23 0.053517 0.02 +0.15346 -0.035075 0.010377 0.02 +0.1556 0.23 -0.14765 0.02 +0.0453 -0.18666 0.040099 0.02 +0.21545 0.23 -0.006656 0.02 +0.1556 0.20444 -0.14765 0.02 +0.16251 0.12819 -0.11857 0.02 +0.20123 0.095093 -0.002748 0.02 +0.077679 -0.077895 -0.10869 0.02 +0.11749 -0.10012 0.020261 0.02 +-0.024324 -0.23 -0.009277 0.02 +0.16548 -0.013404 0.007076 0.02 +0.21302 0.1601 -0.00599 0.02 +0.1556 0.17889 -0.14765 0.02 +0.067083 -0.09838 -0.10339 0.02 +0.000801 -0.18678 -0.070252 0.02 +-0.043689 -0.23 -0.048007 0.02 +0.20767 0.23 -0.041182 0.02 +0.17254 0.076667 -0.076358 0.02 +-0.005008 -0.23 0.029013 0.02 +0.10538 -0.12168 0.02359 0.02 +0.16745 0.090521 -0.09779 0.02 +0.13267 0.046134 -0.13618 0.02 +0.17746 0.008389 0.003782 0.02 +0.1556 0.15333 -0.14765 0.02 +0.16247 0.10319 -0.11876 0.02 +0.05808 -0.11974 -0.098891 0.02 +0.092701 -0.060705 -0.1162 0.02 +0.19642 0.23 -0.082921 0.02 +0.033177 -0.20827 0.04343 0.02 +0.093376 -0.14336 0.026888 0.02 +0.18943 0.030091 0.000494 0.02 +0.19604 0.18693 -0.082817 0.02 +0.21319 0.1168 -0.006037 0.02 +0.1556 0.12778 -0.14765 0.02 +-0.022935 -0.23 -0.034178 0.02 +-0.003394 -0.23 0.004104 0.02 +-0.010474 -0.20835 -0.064614 0.02 +0.1674 0.065522 -0.097981 0.02 +0.17254 0.051111 -0.076358 0.02 +0.04837 -0.14126 -0.094036 0.02 +0.16242 0.078192 -0.11895 0.02 +0.22499 0.1818 -0.009278 0.02 +0.081397 -0.16505 0.03018 0.02 +0.2014 0.051793 -0.002795 0.02 +0.1556 0.10222 -0.14765 0.02 +0.036574 -0.16188 -0.088138 0.02 +0.020801 -0.23 0.046831 0.02 +0.1947 0.11621 -0.082449 0.02 +-0.00242 -0.23 -0.020318 0.02 +0.2141 0.23 -0.065325 0.02 +0.22516 0.1385 -0.009325 0.02 +0.069295 -0.18666 0.033506 0.02 +0.11207 -0.043463 -0.12589 0.02 +0.20628 0.20775 -0.085628 0.02 +0.16736 0.040523 -0.098173 0.02 +-0.021546 -0.23 -0.059078 0.02 +0.12357 -0.019183 -0.13164 0.02 +0.016958 -0.23 0.018269 0.02 +0.17254 0.025556 -0.076358 0.02 +0.16238 0.053193 -0.11914 0.02 +0.21336 0.073494 -0.006084 0.02 +0.20439 0.16385 -0.08511 0.02 +0.1556 0.076667 -0.14765 0.02 +0.022537 -0.18678 -0.08112 0.02 +0.15356 -0.07835 0.010351 0.02 +0.16557 -0.056689 0.007049 0.02 +0.096866 -0.080976 -0.11828 0.02 +0.14156 -0.10003 0.013648 0.02 +0.17757 -0.035005 0.003753 0.02 +0.23696 0.2035 -0.012567 0.02 +0.13605 0.001683 -0.13788 0.02 +0.089144 -0.098976 -0.11442 0.02 +0.12948 -0.12162 0.016966 0.02 +0.057298 -0.20835 0.036802 0.02 +0.18958 -0.013335 0.000453 0.02 +0.20667 0.13791 -0.085736 0.02 +-0.000792 -0.23 -0.045249 0.02 +0.018334 -0.23 -0.006489 0.02 +0.23978 0.23 -0.013342 0.02 +0.22533 0.095196 -0.009372 0.02 +0.080099 -0.11829 -0.1099 0.02 +0.16731 0.015524 -0.098364 0.02 +0.19489 0.072907 -0.082499 0.02 +0.16233 0.028194 -0.11933 0.02 +0.23713 0.1602 -0.012614 0.02 +0.011669 -0.20835 -0.075686 0.02 +0.11748 -0.1433 0.020265 0.02 +0.1556 0.051111 -0.14765 0.02 +0.20157 0.008492 -0.002842 0.02 +0.17254 0 -0.076358 0.02 +0.070513 -0.14025 -0.10511 0.02 +0.10547 -0.16498 0.023564 0.02 +0.20515 0.095899 -0.085318 0.02 +0.21354 0.030193 -0.00613 0.02 +0.11283 -0.071465 -0.12627 0.02 +0.045132 -0.23 0.040145 0.02 +0.22031 0.23 -0.089483 0.02 +0.23745 0.23 -0.043773 0.02 +0.05846 -0.16113 -0.099081 0.02 +0.019963 -0.23 -0.03142 0.02 +0.2201 0.18677 -0.089426 0.02 +0.2373 0.1169 -0.012661 0.02 +0.000598 -0.23 -0.07015 0.02 +0.1556 0.025556 -0.14765 0.02 +0.16228 0.003194 -0.11952 0.02 +0.16727 -0.009476 -0.098556 0.02 +0.093402 -0.18658 0.026881 0.02 +0.042291 -0.23 0.010986 0.02 +0.2255 0.051895 -0.009419 0.02 +0.2491 0.1819 -0.015902 0.02 +0.17254 -0.025556 -0.076358 0.02 +0.044885 -0.1867 -0.092294 0.02 +0.19507 0.029606 -0.082549 0.02 +0.13624 -0.038333 -0.13797 0.02 +0.21881 0.11632 -0.089073 0.02 +0.021352 -0.23 -0.056321 0.02 +0.23798 0.23 -0.071888 0.02 +0.040717 -0.23 -0.017591 0.02 +0.081418 -0.20827 0.030174 0.02 +0.24927 0.1386 -0.015949 0.02 +0.17766 -0.07838 0.003728 0.02 +0.1112 -0.096211 -0.12545 0.02 +0.23747 0.073596 -0.012708 0.02 +0.16557 -0.10001 0.007049 0.02 +0.18966 -0.056632 0.00043 0.02 +0.1556 0 -0.14765 0.02 +0.033813 -0.20835 -0.086758 0.02 +0.20703 0.051311 -0.085836 0.02 +0.15358 -0.12169 0.010345 0.02 +0.23225 0.20835 -0.092765 0.02 +0.20167 -0.034958 -0.002871 0.02 +0.16224 -0.021805 -0.11972 0.02 +0.16722 -0.034475 -0.098748 0.02 +0.10178 -0.11868 -0.12074 0.02 +0.14159 -0.14324 0.013641 0.02 +0.23208 0.16509 -0.092718 0.02 +0.21371 -0.013108 -0.006177 0.02 +0.26106 0.2036 -0.019191 0.02 +0.09063 -0.14013 -0.11517 0.02 +0.069463 -0.23 0.033459 0.02 +0.17254 -0.051111 -0.076358 0.02 +0.23077 0.13802 -0.09236 0.02 +0.042106 -0.23 -0.042492 0.02 +0.24944 0.095298 -0.015996 0.02 +0.12958 -0.165 0.016941 0.02 +0.21899 0.073016 -0.089123 0.02 +0.13608 -0.063368 -0.13789 0.02 +0.26411 0.23 -0.020028 0.02 +0.22567 0.008594 -0.009466 0.02 +0.022741 -0.23 -0.081222 0.02 +0.26124 0.1603 -0.019238 0.02 +0.063145 -0.23 -0.001876 0.02 +0.080678 -0.16184 -0.11019 0.02 +0.1556 -0.025556 -0.14765 0.02 +0.1175 -0.18663 0.020259 0.02 +0.19525 -0.013694 -0.082599 0.02 +0.23764 0.030296 -0.012755 0.02 +0.16219 -0.046804 -0.11991 0.02 +0.24419 0.23 -0.096046 0.02 +0.26106 0.23 -0.050874 0.02 +0.067232 -0.18678 -0.10347 0.02 +0.16718 -0.059474 -0.098939 0.02 +0.20545 0.006694 -0.085402 0.02 +0.23096 0.094721 -0.09241 0.02 +0.24419 0.1867 -0.096046 0.02 +0.26141 0.117 -0.019285 0.02 +0.043495 -0.23 -0.067393 0.02 +0.063028 -0.23 -0.028836 0.02 +0.13266 -0.087879 -0.13618 0.02 +0.10541 -0.20826 0.023582 0.02 +0.24961 0.051997 -0.016043 0.02 +0.17254 -0.076667 -0.076358 0.02 +0.2732 0.182 -0.022526 0.02 +0.055956 -0.20835 -0.097829 0.02 +0.082468 -0.23 0.009784 0.02 +0.21918 0.029716 -0.089173 0.02 +0.18994 -0.099812 0.000353 0.02 +0.20191 -0.07811 -0.002936 0.02 +0.1556 -0.051111 -0.14765 0.02 +0.17768 -0.12162 0.003723 0.02 +0.24292 0.11643 -0.095697 0.02 +0.21388 -0.056409 -0.006224 0.02 +0.093794 -0.23 0.026773 0.02 +0.27337 0.1387 -0.022573 0.02 +0.16215 -0.071803 -0.1201 0.02 +0.064418 -0.23 -0.053736 0.02 +0.16566 -0.14329 0.007024 0.02 +0.26158 0.073699 -0.019332 0.02 +0.22585 -0.034707 -0.009513 0.02 +0.23114 0.051421 -0.09246 0.02 +0.044885 -0.23 -0.092294 0.02 +0.11295 -0.14028 -0.12633 0.02 +0.16713 -0.084473 -0.099131 0.02 +0.083931 -0.23 -0.015167 0.02 +0.2654 0.23 -0.077627 0.02 +0.15359 -0.16492 0.010343 0.02 +0.12928 -0.11599 -0.13449 0.02 +0.23781 -0.013005 -0.012802 0.02 +0.25815 0.20771 -0.099884 0.02 +0.10289 -0.16086 -0.1213 0.02 +0.2563 0.16509 -0.099374 0.02 +0.2056 -0.03365 -0.085444 0.02 +0.19543 -0.056995 -0.082649 0.02 +0.28539 0.20482 -0.025877 0.02 +0.17254 -0.10222 -0.076358 0.02 +0.14165 -0.18661 0.013623 0.02 +0.24978 0.008696 -0.01609 0.02 +0.2431 0.073126 -0.095747 0.02 +0.27355 0.0954 -0.02262 0.02 +0.28844 0.23 -0.026714 0.02 +0.065639 -0.23 -0.078465 0.02 +0.092548 -0.18299 -0.11613 0.02 +0.1556 -0.076667 -0.14765 0.02 +0.085342 -0.23 -0.040082 0.02 +0.21936 -0.013585 -0.089223 0.02 +0.259 0.14032 -0.10012 0.02 +0.12951 -0.20831 0.016958 0.02 +0.1621 -0.096802 -0.12029 0.02 +0.26175 0.030398 -0.019379 0.02 +0.10483 -0.23 -0.001455 0.02 +0.28218 0.23 -0.060432 0.02 +0.28847 0.15867 -0.026723 0.02 +0.0781 -0.20835 -0.1089 0.02 +0.26807 0.23 -0.10261 0.02 +0.16708 -0.10947 -0.099322 0.02 +0.23132 0.00812 -0.09251 0.02 +0.26828 0.18677 -0.10267 0.02 +0.25719 0.096044 -0.099619 0.02 +0.11813 -0.23 0.020087 0.02 +0.086652 -0.23 -0.065033 0.02 +0.28856 0.11998 -0.026746 0.02 +0.067028 -0.23 -0.10337 0.02 +0.21405 -0.099709 -0.006271 0.02 +0.24328 0.029825 -0.095797 0.02 +0.20208 -0.12141 -0.002983 0.02 +0.22602 -0.078008 -0.00956 0.02 +0.10624 -0.23 -0.02641 0.02 +0.17254 -0.12778 -0.076358 0.02 +0.18977 -0.14325 0.0004 0.02 +0.23798 -0.056306 -0.012849 0.02 +0.13519 -0.13886 -0.13745 0.02 +0.1556 -0.10222 -0.14765 0.02 +0.29519 0.13969 -0.028568 0.02 +0.27803 0.051733 -0.023853 0.02 +0.17769 -0.16495 0.003719 0.02 +0.16081 -0.11598 -0.12573 0.02 +0.24995 -0.034605 -0.016137 0.02 +0.2686 0.11656 -0.10275 0.02 +0.12491 -0.16095 -0.13231 0.02 +0.25524 0.05153 -0.099084 0.02 +0.16575 -0.18649 0.007 0.02 +0.19562 -0.10031 -0.0827 0.02 +0.20757 -0.078596 -0.085984 0.02 +0.26192 -0.012903 -0.019426 0.02 +0.087782 -0.23 -0.089536 0.02 +0.11383 -0.18256 -0.12676 0.02 +0.10754 -0.23 -0.051351 0.02 +0.21954 -0.056886 -0.089273 0.02 +0.29119 0.0752 -0.02747 0.02 +0.1538 -0.2082 0.010285 0.02 +0.2315 -0.035181 -0.09256 0.02 +0.1272 -0.23 -0.012789 0.02 +0.27389 0.008799 -0.022714 0.02 +0.26721 0.073235 -0.10237 0.02 +0.10024 -0.20835 -0.11997 0.02 +0.16306 -0.13765 -0.11628 0.02 +0.24346 -0.013476 -0.095847 0.02 +0.17254 -0.15333 -0.076358 0.02 +0.31277 0.23 -0.0334 0.02 +0.1556 -0.12778 -0.14765 0.02 +0.31277 0.20444 -0.0334 0.02 +0.30583 0.23 -0.058657 0.02 +0.30662 0.19397 -0.055782 0.02 +0.14246 -0.23 0.013402 0.02 +0.10884 -0.23 -0.076287 0.02 +0.31277 0.17889 -0.0334 0.02 +0.29889 0.23 -0.083914 0.02 +0.30009 0.20456 -0.079549 0.02 +0.089171 -0.23 -0.11444 0.02 +0.30128 0.1793 -0.075239 0.02 +0.30699 0.16663 -0.054449 0.02 +0.12851 -0.23 -0.037753 0.02 +0.29632 0.1918 -0.093283 0.02 +0.31277 0.15333 -0.0334 0.02 +0.29195 0.23 -0.10917 0.02 +0.29195 0.20444 -0.10917 0.02 +0.30123 0.1543 -0.075423 0.02 +0.30694 0.14163 -0.054641 0.02 +0.2575 0.006839 -0.099703 0.02 +0.29195 0.17889 -0.10917 0.02 +0.22619 -0.12131 -0.009607 0.02 +0.23815 -0.099607 -0.012896 0.02 +0.21422 -0.14301 -0.006318 0.02 +0.31277 0.12778 -0.0334 0.02 +0.25012 -0.077905 -0.016184 0.02 +0.16767 -0.16157 -0.096847 0.02 +0.29128 0.027994 -0.027493 0.02 +0.29195 0.15333 -0.10917 0.02 +0.30117 0.1293 -0.075612 0.02 +0.26739 0.029934 -0.10242 0.02 +0.20225 -0.16471 -0.00303 0.02 +0.26209 -0.056204 -0.019473 0.02 +0.30688 0.11663 -0.054831 0.02 +0.10993 -0.23 -0.10061 0.02 +0.12963 -0.23 -0.061524 0.02 +0.31277 0.10222 -0.0334 0.02 +0.19028 -0.18641 0.000259 0.02 +0.29195 0.12778 -0.10917 0.02 +0.27406 -0.034502 -0.022761 0.02 +0.20591 -0.12286 -0.085528 0.02 +0.30112 0.1043 -0.075802 0.02 +0.13617 -0.18253 -0.13793 0.02 +0.21972 -0.10019 -0.089323 0.02 +0.1556 -0.15333 -0.14765 0.02 +0.30683 0.091634 -0.055021 0.02 +0.19581 -0.1436 -0.082751 0.02 +0.17254 -0.17889 -0.076358 0.02 +0.23168 -0.078482 -0.09261 0.02 +0.14948 -0.23 -0.024137 0.02 +0.17832 -0.20812 0.003547 0.02 +0.16208 -0.16765 -0.1204 0.02 +0.29195 0.10222 -0.10917 0.02 +0.24365 -0.056777 -0.095897 0.02 +0.28708 -0.012832 -0.02634 0.02 +0.31277 0.076667 -0.0334 0.02 +0.1251 -0.20631 -0.1324 0.02 +0.30107 0.079305 -0.075992 0.02 +0.30678 0.066635 -0.05521 0.02 +0.16679 -0.23 0.006716 0.02 +0.25765 -0.033504 -0.099745 0.02 +0.11131 -0.23 -0.12551 0.02 +0.29195 0.076667 -0.10917 0.02 +0.16606 -0.18554 -0.10363 0.02 +0.31277 0.051111 -0.0334 0.02 +0.2685 -0.013139 -0.10273 0.02 +0.30102 0.054306 -0.076182 0.02 +0.14078 -0.23 -0.082985 0.02 +0.30673 0.041636 -0.0554 0.02 +0.29195 0.051111 -0.10917 0.02 +0.15639 -0.23 -0.053749 0.02 +0.25029 -0.12121 -0.016231 0.02 +0.1556 -0.17889 -0.14765 0.02 +0.23833 -0.14291 -0.012942 0.02 +0.26226 -0.099505 -0.01952 0.02 +0.16068 -0.18897 -0.12627 0.02 +0.17254 -0.20444 -0.076358 0.02 +0.22636 -0.16461 -0.009654 0.02 +0.31277 0.025556 -0.0334 0.02 +0.17322 -0.23 -0.017504 0.02 +0.30097 0.029306 -0.076371 0.02 +0.20129 -0.16544 -0.084258 0.02 +0.21439 -0.18631 -0.006365 0.02 +0.30668 0.016636 -0.05559 0.02 +0.13727 -0.23 -0.11162 0.02 +0.27837 -0.077461 -0.023947 0.02 +0.29195 0.025556 -0.10917 0.02 +0.23186 -0.12178 -0.09266 0.02 +0.20242 -0.20801 -0.003077 0.02 +0.21991 -0.14349 -0.089376 0.02 +0.24383 -0.10008 -0.095947 0.02 +0.29145 -0.05364 -0.02754 0.02 +0.25579 -0.078373 -0.099234 0.02 +0.31277 0 -0.0334 0.02 +0.30091 0.004307 -0.076561 0.02 +0.16407 -0.20835 -0.11201 0.02 +0.19604 -0.18693 -0.082817 0.02 +0.26775 -0.056668 -0.10252 0.02 +0.19112 -0.23 0.00003 0.02 +0.13346 -0.23 -0.13658 0.02 +0.30662 -0.008363 -0.05578 0.02 +0.18358 -0.23 -0.034721 0.02 +0.29195 0 -0.10917 0.02 +0.1556 -0.20444 -0.14765 0.02 +0.17254 -0.23 -0.076358 0.02 +0.30086 -0.020692 -0.076751 0.02 +0.31277 -0.025556 -0.0334 0.02 +0.16689 -0.23 -0.10012 0.02 +0.30657 -0.033362 -0.05597 0.02 +0.26243 -0.14281 -0.019567 0.02 +0.2744 -0.1211 -0.022855 0.02 +0.29195 -0.025556 -0.10917 0.02 +0.25046 -0.16451 -0.016278 0.02 +0.2385 -0.18621 -0.012989 0.02 +0.19022 -0.23 -0.058763 0.02 +0.16125 -0.23 -0.12389 0.02 +0.22653 -0.20791 -0.009701 0.02 +0.30081 -0.045691 -0.076941 0.02 +0.31277 -0.051111 -0.0334 0.02 +0.29154 -0.10085 -0.027564 0.02 +0.24402 -0.14337 -0.096001 0.02 +0.23208 -0.16509 -0.092718 0.02 +0.26793 -0.099971 -0.10257 0.02 +0.30652 -0.058361 -0.05616 0.02 +0.25795 -0.12271 -0.099829 0.02 +0.2201 -0.18677 -0.089426 0.02 +0.1556 -0.23 -0.14765 0.02 +0.21545 -0.23 -0.006656 0.02 +0.20628 -0.20775 -0.085628 0.02 +0.29195 -0.051111 -0.10917 0.02 +0.20767 -0.23 -0.041182 0.02 +0.29973 -0.06848 -0.080852 0.02 +0.19642 -0.23 -0.082921 0.02 +0.31277 -0.076667 -0.0334 0.02 +0.30647 -0.083361 -0.05635 0.02 +0.29195 -0.076667 -0.10917 0.02 +0.2141 -0.23 -0.065325 0.02 +0.2626 -0.18611 -0.019614 0.02 +0.28888 -0.14199 -0.026835 0.02 +0.25064 -0.20781 -0.016325 0.02 +0.3007 -0.09569 -0.077321 0.02 +0.31277 -0.10222 -0.0334 0.02 +0.26812 -0.14326 -0.10262 0.02 +0.28204 -0.16491 -0.024955 0.02 +0.23978 -0.23 -0.013342 0.02 +0.24419 -0.1867 -0.096046 0.02 +0.30642 -0.10836 -0.056539 0.02 +0.29195 -0.10222 -0.10917 0.02 +0.23225 -0.20835 -0.092765 0.02 +0.22031 -0.23 -0.089483 0.02 +0.23745 -0.23 -0.043773 0.02 +0.26294 -0.16534 -0.1012 0.02 +0.30065 -0.12069 -0.077511 0.02 +0.31277 -0.12778 -0.0334 0.02 +0.30636 -0.13336 -0.056729 0.02 +0.29195 -0.12778 -0.10917 0.02 +0.23798 -0.23 -0.071888 0.02 +0.28671 -0.186 -0.026238 0.02 +0.27474 -0.20771 -0.022949 0.02 +0.3006 -0.14569 -0.0777 0.02 +0.26411 -0.23 -0.020028 0.02 +0.31277 -0.15333 -0.0334 0.02 +0.26828 -0.18677 -0.10267 0.02 +0.25815 -0.20771 -0.099884 0.02 +0.30631 -0.15836 -0.056919 0.02 +0.24419 -0.23 -0.096046 0.02 +0.26106 -0.23 -0.050874 0.02 +0.29195 -0.15333 -0.10917 0.02 +0.30055 -0.17069 -0.07789 0.02 +0.31277 -0.17889 -0.0334 0.02 +0.2654 -0.23 -0.077627 0.02 +0.30626 -0.18336 -0.057109 0.02 +0.29195 -0.17889 -0.10917 0.02 +0.28844 -0.23 -0.026714 0.02 +0.28218 -0.23 -0.060432 0.02 +0.3005 -0.19569 -0.07808 0.02 +0.26807 -0.23 -0.10261 0.02 +0.31277 -0.20444 -0.0334 0.02 +0.30485 -0.2087 -0.062232 0.02 +0.29195 -0.20444 -0.10917 0.02 +0.31277 -0.23 -0.0334 0.02 +0.30583 -0.23 -0.058657 0.02 +0.29889 -0.23 -0.083914 0.02 +0.29195 -0.23 -0.10917 0.02 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +-0.026105 0.000000 0.018975 0.722000 + +Size +0.722000 + +Volume +0.048176 + +Inertia per unit mass +0.022713 +0.038785 +0.057704 diff --git a/kratos.gid/apps/DEM/clusters/ellipsoidcluster3D.clu b/kratos.gid/apps/DEM/clusters/ellipsoidcluster3D.clu new file mode 100644 index 000000000..566ace34f --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ellipsoidcluster3D.clu @@ -0,0 +1,196 @@ +// +// Cluster Name: "ellipsoidcluster3D" +// Author: Joaquin Irazabal +// Date: 2018-02-15 +// +// http://mathworld.wolfram.com/Ellipsoid.html + +Name +ellipsoidcluster3D + +Begin centers_and_radii +0.0 0.0 -0.25 0.1 +-0.191342 -0.0 -0.23097 0.1 +-0.184822 -0.037142 -0.23097 0.1 +-0.165707 -0.071753 -0.23097 0.1 +-0.135299 -0.101474 -0.23097 0.1 +-0.095671 -0.12428 -0.23097 0.1 +-0.049523 -0.138616 -0.23097 0.1 +0.0 -0.143506 -0.23097 0.1 +0.049523 -0.138616 -0.23097 0.1 +0.095671 -0.12428 -0.23097 0.1 +0.135299 -0.101474 -0.23097 0.1 +0.165707 -0.071753 -0.23097 0.1 +0.184822 -0.037142 -0.23097 0.1 +0.191342 0.0 -0.23097 0.1 +0.184822 0.037142 -0.23097 0.1 +0.165707 0.071753 -0.23097 0.1 +0.135299 0.101474 -0.23097 0.1 +0.095671 0.12428 -0.23097 0.1 +0.049523 0.138616 -0.23097 0.1 +0.0 0.143506 -0.23097 0.1 +-0.049523 0.138616 -0.23097 0.1 +-0.095671 0.12428 -0.23097 0.1 +-0.135299 0.101474 -0.23097 0.1 +-0.165707 0.071753 -0.23097 0.1 +-0.184822 0.037142 -0.23097 0.1 +-0.353553 -0.0 -0.176777 0.1 +-0.341506 -0.06863 -0.176777 0.1 +-0.306186 -0.132583 -0.176777 0.1 +-0.25 -0.1875 -0.176777 0.1 +-0.176777 -0.22964 -0.176777 0.1 +-0.091506 -0.25613 -0.176777 0.1 +0.0 -0.265165 -0.176777 0.1 +0.091506 -0.25613 -0.176777 0.1 +0.176777 -0.22964 -0.176777 0.1 +0.25 -0.1875 -0.176777 0.1 +0.306186 -0.132583 -0.176777 0.1 +0.341506 -0.06863 -0.176777 0.1 +0.353553 0.0 -0.176777 0.1 +0.341506 0.06863 -0.176777 0.1 +0.306186 0.132583 -0.176777 0.1 +0.25 0.1875 -0.176777 0.1 +0.176777 0.22964 -0.176777 0.1 +0.091506 0.25613 -0.176777 0.1 +0.0 0.265165 -0.176777 0.1 +-0.091506 0.25613 -0.176777 0.1 +-0.176777 0.22964 -0.176777 0.1 +-0.25 0.1875 -0.176777 0.1 +-0.306186 0.132583 -0.176777 0.1 +-0.341506 0.06863 -0.176777 0.1 +-0.46194 -0.0 -0.095671 0.1 +-0.4462 -0.089669 -0.095671 0.1 +-0.400052 -0.173227 -0.095671 0.1 +-0.326641 -0.244981 -0.095671 0.1 +-0.23097 -0.300039 -0.095671 0.1 +-0.119559 -0.33465 -0.095671 0.1 +0.0 -0.346455 -0.095671 0.1 +0.119559 -0.33465 -0.095671 0.1 +0.23097 -0.300039 -0.095671 0.1 +0.326641 -0.244981 -0.095671 0.1 +0.400052 -0.173227 -0.095671 0.1 +0.4462 -0.089669 -0.095671 0.1 +0.46194 0.0 -0.095671 0.1 +0.4462 0.089669 -0.095671 0.1 +0.400052 0.173227 -0.095671 0.1 +0.326641 0.244981 -0.095671 0.1 +0.23097 0.300039 -0.095671 0.1 +0.119559 0.33465 -0.095671 0.1 +0.0 0.346455 -0.095671 0.1 +-0.119559 0.33465 -0.095671 0.1 +-0.23097 0.300039 -0.095671 0.1 +-0.326641 0.244981 -0.095671 0.1 +-0.400052 0.173227 -0.095671 0.1 +-0.4462 0.089669 -0.095671 0.1 +-0.5 -0.0 0.0 0.1 +-0.482963 -0.097057 0.0 0.1 +-0.433013 -0.1875 0.0 0.1 +-0.353553 -0.265165 0.0 0.1 +-0.25 -0.32476 0.0 0.1 +-0.12941 -0.362222 0.0 0.1 +0.0 -0.375 0.0 0.1 +0.12941 -0.362222 0.0 0.1 +0.25 -0.32476 0.0 0.1 +0.353553 -0.265165 0.0 0.1 +0.433013 -0.1875 0.0 0.1 +0.482963 -0.097057 0.0 0.1 +0.5 0.0 0.0 0.1 +0.482963 0.097057 0.0 0.1 +0.433013 0.1875 0.0 0.1 +0.353553 0.265165 0.0 0.1 +0.25 0.32476 0.0 0.1 +0.12941 0.362222 0.0 0.1 +0.0 0.375 0.0 0.1 +-0.12941 0.362222 0.0 0.1 +-0.25 0.32476 0.0 0.1 +-0.353553 0.265165 0.0 0.1 +-0.433013 0.1875 0.0 0.1 +-0.482963 0.097057 0.0 0.1 +-0.46194 -0.0 0.095671 0.1 +-0.4462 -0.089669 0.095671 0.1 +-0.400052 -0.173227 0.095671 0.1 +-0.326641 -0.244981 0.095671 0.1 +-0.23097 -0.300039 0.095671 0.1 +-0.119559 -0.33465 0.095671 0.1 +0.0 -0.346455 0.095671 0.1 +0.119559 -0.33465 0.095671 0.1 +0.23097 -0.300039 0.095671 0.1 +0.326641 -0.244981 0.095671 0.1 +0.400052 -0.173227 0.095671 0.1 +0.4462 -0.089669 0.095671 0.1 +0.46194 0.0 0.095671 0.1 +0.4462 0.089669 0.095671 0.1 +0.400052 0.173227 0.095671 0.1 +0.326641 0.244981 0.095671 0.1 +0.23097 0.300039 0.095671 0.1 +0.119559 0.33465 0.095671 0.1 +0.0 0.346455 0.095671 0.1 +-0.119559 0.33465 0.095671 0.1 +-0.23097 0.300039 0.095671 0.1 +-0.326641 0.244981 0.095671 0.1 +-0.400052 0.173227 0.095671 0.1 +-0.4462 0.089669 0.095671 0.1 +-0.353553 -0.0 0.176777 0.1 +-0.341506 -0.06863 0.176777 0.1 +-0.306186 -0.132583 0.176777 0.1 +-0.25 -0.1875 0.176777 0.1 +-0.176777 -0.22964 0.176777 0.1 +-0.091506 -0.25613 0.176777 0.1 +0.0 -0.265165 0.176777 0.1 +0.091506 -0.25613 0.176777 0.1 +0.176777 -0.22964 0.176777 0.1 +0.25 -0.1875 0.176777 0.1 +0.306186 -0.132583 0.176777 0.1 +0.341506 -0.06863 0.176777 0.1 +0.353553 0.0 0.176777 0.1 +0.341506 0.06863 0.176777 0.1 +0.306186 0.132583 0.176777 0.1 +0.25 0.1875 0.176777 0.1 +0.176777 0.22964 0.176777 0.1 +0.091506 0.25613 0.176777 0.1 +0.0 0.265165 0.176777 0.1 +-0.091506 0.25613 0.176777 0.1 +-0.176777 0.22964 0.176777 0.1 +-0.25 0.1875 0.176777 0.1 +-0.306186 0.132583 0.176777 0.1 +-0.341506 0.06863 0.176777 0.1 +-0.191342 -0.0 0.23097 0.1 +-0.184822 -0.037142 0.23097 0.1 +-0.165707 -0.071753 0.23097 0.1 +-0.135299 -0.101474 0.23097 0.1 +-0.095671 -0.12428 0.23097 0.1 +-0.049523 -0.138616 0.23097 0.1 +0.0 -0.143506 0.23097 0.1 +0.049523 -0.138616 0.23097 0.1 +0.095671 -0.12428 0.23097 0.1 +0.135299 -0.101474 0.23097 0.1 +0.165707 -0.071753 0.23097 0.1 +0.184822 -0.037142 0.23097 0.1 +0.191342 0.0 0.23097 0.1 +0.184822 0.037142 0.23097 0.1 +0.165707 0.071753 0.23097 0.1 +0.135299 0.101474 0.23097 0.1 +0.095671 0.12428 0.23097 0.1 +0.049523 0.138616 0.23097 0.1 +0.0 0.143506 0.23097 0.1 +-0.049523 0.138616 0.23097 0.1 +-0.095671 0.12428 0.23097 0.1 +-0.135299 0.101474 0.23097 0.1 +-0.165707 0.071753 0.23097 0.1 +-0.184822 0.037142 0.23097 0.1 +0.0 0.0 0.25 0.1 +End centers_and_radii + +Particle_center_and_diameter +0.0 0.0 0.0 1.2 + +Size +1.0 + +Volume +0.1963495408297271 + +Inertia per unit mass +0.040625 +0.0625 +0.078125 diff --git a/kratos.gid/apps/DEM/clusters/linecluster3D.clu b/kratos.gid/apps/DEM/clusters/linecluster3D.clu new file mode 100644 index 000000000..51c533d35 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/linecluster3D.clu @@ -0,0 +1,35 @@ +// +// Cluster Name: "linecluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: $Date: 2016-4-28 +// + +Name +linecluster3D + +Begin centers_and_radii +-0.45 0.0 0.0 0.1 +-0.35 0.0 0.0 0.1 +-0.25 0.0 0.0 0.1 +-0.15 0.0 0.0 0.1 +-0.05 0.0 0.0 0.1 + 0.05 0.0 0.0 0.1 + 0.15 0.0 0.0 0.1 + 0.25 0.0 0.0 0.1 + 0.35 0.0 0.0 0.1 + 0.45 0.0 0.0 0.1 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +0.000000 0.000000 0.000000 1.100000 + +Size +1.100000 + +Volume +0.0345575 + +Inertia per unit mass +0.005 +0.01 +0.01 diff --git a/kratos.gid/apps/DEM/clusters/pillcluster3D.clu b/kratos.gid/apps/DEM/clusters/pillcluster3D.clu new file mode 100644 index 000000000..e1c5a46c7 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/pillcluster3D.clu @@ -0,0 +1,82 @@ +// +// Cluster Name: "pillcluster3D" +// Author: Joaquin Irazabal +// Date: 2018-02-15 +// + +Name +pillcluster3D + +Begin centers_and_radii +0.4 0.0 0.0 0.1 +0.380423 0.123607 0.0 0.1 +0.323607 0.235114 0.0 0.1 +0.235114 0.323607 0.0 0.1 +0.123607 0.380423 0.0 0.1 +0.0 0.4 0.0 0.1 +-0.123607 0.380423 0.0 0.1 +-0.235114 0.323607 0.0 0.1 +-0.323607 0.235114 0.0 0.1 +-0.380423 0.123607 0.0 0.1 +-0.4 0.0 0.0 0.1 +-0.380423 -0.123607 0.0 0.1 +-0.323607 -0.235114 0.0 0.1 +-0.235114 -0.323607 0.0 0.1 +-0.123607 -0.380423 0.0 0.1 +-0.0 -0.4 0.0 0.1 +0.123607 -0.380423 0.0 0.1 +0.235114 -0.323607 0.0 0.1 +0.323607 -0.235114 0.0 0.1 +0.380423 -0.123607 0.0 0.1 +0.31 0.0 0.0 0.1 +0.286403 0.118632 0.0 0.1 +0.219203 0.219203 0.0 0.1 +0.118632 0.286403 0.0 0.1 +0.0 0.31 0.0 0.1 +-0.118632 0.286403 0.0 0.1 +-0.219203 0.219203 0.0 0.1 +-0.286403 0.118632 0.0 0.1 +-0.31 0.0 0.0 0.1 +-0.286403 -0.118632 0.0 0.1 +-0.219203 -0.219203 0.0 0.1 +-0.118632 -0.286403 0.0 0.1 +-0.0 -0.31 0.0 0.1 +0.118632 -0.286403 0.0 0.1 +0.219203 -0.219203 0.0 0.1 +0.286403 -0.118632 0.0 0.1 +0.22 0.0 0.0 0.1 +0.190526 0.11 0.0 0.1 +0.11 0.190526 0.0 0.1 +0.0 0.22 0.0 0.1 +-0.11 0.190526 0.0 0.1 +-0.190526 0.11 0.0 0.1 +-0.22 0.0 0.0 0.1 +-0.190526 -0.11 0.0 0.1 +-0.11 -0.190526 0.0 0.1 +-0.0 -0.22 0.0 0.1 +0.11 -0.190526 0.0 0.1 +0.190526 -0.11 0.0 0.1 +0.13 0.0 0.0 0.1 +0.091924 0.091924 0.0 0.1 +0.0 0.13 0.0 0.1 +-0.091924 0.091924 0.0 0.1 +-0.13 0.0 0.0 0.1 +-0.091924 -0.091924 0.0 0.1 +-0.0 -0.13 0.0 0.1 +0.091924 -0.091924 0.0 0.1 +0.0 0.0 0.0 0.1 +End centers_and_radii + +Particle_center_and_diameter +0.0 0.0 0.0 1.000001 + +Size +1.0 + +Volume +0.15707963267948966 + +Inertia per unit mass +0.06333333308 +0.06333333308 +0.125 diff --git a/kratos.gid/apps/DEM/clusters/ringcluster3D.clu b/kratos.gid/apps/DEM/clusters/ringcluster3D.clu new file mode 100644 index 000000000..7688e75d2 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/ringcluster3D.clu @@ -0,0 +1,47 @@ +// +// Cluster Name: "ringcluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: 2018-02-15 +// + +// http://mathworld.wolfram.com/Torus.html + +Name +ringcluster3D + +Begin centers_and_radii +0.45 0.0 0.0 0.1 +0.427975 0.139058 0.0 0.1 +0.364058 0.264503 0.0 0.1 +0.264503 0.364058 0.0 0.1 +0.139058 0.427975 0.0 0.1 +0.0 0.45 0.0 0.1 +-0.139058 0.427975 0.0 0.1 +-0.264503 0.364058 0.0 0.1 +-0.364058 0.264503 0.0 0.1 +-0.427975 0.139058 0.0 0.1 +-0.45 0.0 0.0 0.1 +-0.427975 -0.139058 0.0 0.1 +-0.364058 -0.264503 0.0 0.1 +-0.264503 -0.364058 0.0 0.1 +-0.139058 -0.427975 0.0 0.1 +-0.0 -0.45 0.0 0.1 +0.139058 -0.427975 0.0 0.1 +0.264503 -0.364058 0.0 0.1 +0.364058 -0.264503 0.0 0.1 +0.427975 -0.139058 0.0 0.1 +End centers_and_radii + +Particle_center_and_diameter +0.0 0.0 0.0 1.1 + +Size +1.0 + +Volume +0.08882643960980423 + +Inertia per unit mass +0.10750000000000001 +0.10750000000000001 +0.21000000000000002 diff --git a/kratos.gid/apps/DEM/clusters/rock1cluster3D.clu b/kratos.gid/apps/DEM/clusters/rock1cluster3D.clu new file mode 100644 index 000000000..bfc6f689d --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/rock1cluster3D.clu @@ -0,0 +1,111 @@ +// +// Cluster Name: "rock1cluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: $Date: 2016-5-3 +// + +Name +rock1cluster3D + +Begin centers_and_radii +-0.40590893 -0.1111421392 0.1764247306 0.15 +0.4734444113 0.0733408405 -0.0253764245 0.15 +0.401367626 0.0618007332 -0.1905514351 0.15 +0.4351699476 0.2327955013 -0.052449426 0.15 +0.5036787439 0.2216587223 0.0713291243 0.15 +0.5443247541 0.043943148 0.1471509075 0.15 +0.460264855 -0.0820534269 0.0190541556 0.15 +0.3347237547 0.1822050568 -0.2325618454 0.15 +0.5646031088 -0.0963236338 0.1687025873 0.15 +0.328780871 -0.1812875111 -0.1314949436 0.15 +0.2688478113 0.0462115013 -0.3385974663 0.15 +0.3480440586 0.3549110844 -0.1700670686 0.15 +0.4267853559 0.3765731285 0.0639396607 0.15 +0.4360494642 0.292704974 0.1792397459 0.15 +0.4824625547 0.0497414612 0.2965393509 0.15 +0.3834672644 -0.2492731699 0.1230322886 0.15 +0.2679400602 -0.1300308826 -0.2899694681 0.15 +0.1949276392 0.2116299343 -0.3262431064 0.15 +0.3209657164 0.4725577236 -0.064112953 0.15 +0.3708844801 0.1675811443 0.3289292238 0.15 +0.4377691191 -0.1408024624 0.3519534943 0.15 +0.4323379541 -0.2571581362 0.2562588148 0.15 +0.2482549795 -0.3259639942 0.0257422204 0.15 +0.1967921144 -0.2813636574 -0.1130588014 0.15 +0.0651245376 0.1588365505 -0.3841709682 0.15 +0.1459672737 0.4473857586 -0.2722556289 0.15 +0.2992995995 0.446245985 0.0957607775 0.15 +0.3447016207 0.0012927395 0.4105814963 0.15 +0.3102501558 -0.3806503376 0.2843609694 0.15 +0.1993804918 -0.3921627851 0.1670145901 0.15 +0.128981347 -0.1621527779 -0.27579261 0.15 +0.0968052815 -0.0045189163 -0.3575991726 0.15 +0.1291622601 0.507337608 -0.1274835733 0.15 +0.2226009794 0.3606399357 0.2735047112 0.15 +0.221544635 0.1670334454 0.4025374674 0.15 +0.304454841 -0.1984779129 0.4340827545 0.15 +0.0716768551 -0.4515603392 0.0933399455 0.15 +0.0512112783 -0.3753743124 -0.0763709158 0.15 +-0.1096965713 0.1483970882 -0.3842044998 0.15 +-0.067511457 0.3022654194 -0.3536750293 0.15 +-0.0331960923 0.4242045994 -0.2518808023 0.15 +0.1031348652 0.5025729267 0.0421980447 0.15 +0.1930046961 -0.031802121 0.4588169602 0.15 +0.1777827748 -0.3578805523 0.3892411503 0.15 +0.0916415321 -0.4052962418 0.2629057116 0.15 +-0.0855454576 -0.3854616682 -0.1388619945 0.15 +-0.0179865767 -0.2755697668 -0.2295049755 0.15 +-0.0791099072 -0.1535058554 -0.3264959675 0.15 +-0.0519204636 0.4674975048 -0.1087571407 0.15 +0.0364614851 0.4186752384 0.135306405 0.15 +0.0416160521 0.3365337849 0.2929608677 0.15 +0.0415515875 0.1268384872 0.4263161232 0.15 +0.1214497115 -0.2187592034 0.4442278786 0.15 +-0.0743732856 -0.4477699724 0.2126608021 0.15 +-0.1236146716 -0.456402153 0.0544437111 0.15 +-0.1744168873 -0.0524970467 -0.352893359 0.15 +-0.2886909052 0.1308492828 -0.34010084 0.15 +-0.2329027674 0.3008109188 -0.2470686722 0.15 +-0.0879464755 0.3997502399 0.0465273808 0.15 +-0.0455796986 0.2361313179 0.3729528527 0.15 +-0.0100626007 -0.0892245106 0.4491511227 0.15 +0.0004674743 -0.3250208876 0.3641619593 0.15 +-0.2723078096 -0.4095986271 -0.0964428589 0.15 +-0.2275727468 -0.2482080553 -0.2454536598 0.15 +-0.2126167919 0.2774759441 -0.1095172979 0.15 +-0.1259296493 0.3036115795 0.1600684953 0.15 +-0.1229696261 0.0681019699 0.4201537352 0.15 +-0.2398387802 -0.4158826733 0.1859613516 0.15 +-0.3492557676 -0.1216195807 -0.3114316721 0.15 +-0.3845537672 0.0112756527 -0.2551817131 0.15 +-0.36950179 0.1858364109 -0.1022651838 0.15 +-0.265094874 0.2332186687 0.1021734217 0.15 +-0.2116164917 0.2560663113 0.2892519562 0.15 +-0.1532823032 -0.1348304447 0.3477543272 0.15 +-0.3378754974 -0.4201678431 0.050405237 0.15 +-0.4267853559 -0.3765731285 -0.0639396607 0.15 +-0.3716675497 -0.2724713198 -0.1814023636 0.15 +-0.4312976259 0.0390803707 -0.1255976599 0.15 +-0.2487496326 0.0554953987 0.3274052864 0.15 +-0.287021073 -0.2006571901 0.2199215365 0.15 +-0.4622705526 -0.1538768515 -0.1712294548 0.15 +-0.4278863508 0.0608352638 0.0131495072 0.15 +-0.3568963682 0.1010752472 0.1547839623 0.15 +-0.3929164709 -0.2400098112 0.0748674296 0.15 +-0.4530466223 -0.0924430916 0 0.15 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +0.000000 0.000000 0.000000 1.494178 + +Size +1.145500 + +Volume +0.787012332 + +// http://mathworld.wolfram.com/Ellipsoid.html +Inertia per unit mass +0.131216567 +0.131216567 +0.131216567 diff --git a/kratos.gid/apps/DEM/clusters/rock2cluster3D.clu b/kratos.gid/apps/DEM/clusters/rock2cluster3D.clu new file mode 100644 index 000000000..c54a5bd12 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/rock2cluster3D.clu @@ -0,0 +1,102 @@ +// +// Cluster Name: "rock2cluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: $Date: 2016-5-3 +// + +Name +rock2cluster3D + +Begin centers_and_radii +-0.1619931598 -0.4210210303 -0.0279282649 0.15 +0.234035799 0.409935402 -0.0542426398 0.15 +0.0818516709 0.4465934733 0.0357973409 0.15 +0.286721881 0.3912542755 0.1022784869 0.15 +0.3802989603 0.3524274879 -0.1014043647 0.15 +0.2705754816 0.3738449156 -0.2322953583 0.15 +0.0602626795 0.3933437538 -0.1633696375 0.15 +0.1755805227 0.4074007398 0.2075794245 0.15 +0.4182059083 0.3178619272 0.0812524905 0.15 +0.1100043578 0.3130248445 -0.283943528 0.15 +-0.0638945533 0.3941405817 -0.0697501968 0.15 +-0.0905297692 0.4240905801 0.1332673962 0.15 +0.3473971508 0.361615558 0.2431735582 0.15 +0.4727146995 0.2126744946 -0.0845041693 0.15 +0.3648242014 0.2631450762 -0.3280773681 0.15 +-0.0717147108 0.3022908879 -0.2885950604 0.15 +-0.1485393809 0.2905045063 -0.1601994968 0.15 +-0.0254248956 0.3534415402 0.2873782285 0.15 +0.4966141205 0.1730976465 0.0964354765 0.15 +0.4277658283 0.1335393497 -0.2684614826 0.15 +0.2173284563 0.220200542 -0.4466190791 0.15 +0.0022746614 0.1758843531 -0.3774624836 0.15 +-0.2206925719 0.3559802304 0.0227015734 0.15 +-0.156982611 0.2818763788 0.3110978178 0.15 +0.1191642354 0.2778110696 0.4724905969 0.15 +0.2704471523 0.2539340186 0.4299905918 0.15 +0.3849687082 0.2101915758 0.3142086438 0.15 +0.4577103304 0.0382905995 -0.106551356 0.15 +0.3329876761 0.0909023008 -0.4177643872 0.15 +0.1074996806 0.1066532863 -0.5240151135 0.15 +-0.1614031729 0.1414013719 -0.3553209762 0.15 +-0.2374536583 0.1608381307 -0.1885128538 0.15 +-0.0730598706 -0.000656618 -0.4223074797 0.15 +-0.2903290972 0.223142279 -0.0183822093 0.15 +-0.2478976904 0.1393408588 0.3568086204 0.15 +-0.120619552 0.1532353151 0.4567801929 0.15 +0.0326616512 0.1201991072 0.499468063 0.15 +0.1790968095 0.1007328345 0.4593715673 0.15 +0.3399383579 0.0603647228 0.3845291014 0.15 +0.4376125394 0.0391220515 0.2091362003 0.15 +0.4523159651 -0.0831524985 0.0282535829 0.15 +0.3944618931 -0.1356678105 -0.181711269 0.15 +0.3224848392 -0.0980536491 -0.3674559456 0.15 +0.1260959585 -0.0624590941 -0.5130103993 0.15 +-0.2141216865 -0.0685546002 -0.4199251627 0.15 +-0.3079352168 0.0136252818 -0.281620273 0.15 +-0.3457014757 0.1635796654 0.1817710692 0.15 +-0.011343348 -0.1430946209 -0.5007845579 0.15 +-0.3949742416 -0.0613350916 -0.1813986 0.15 +-0.3847341754 0.0646392625 -0.0007347169 0.15 +-0.3152622079 -0.0319304576 0.3773071036 0.15 +-0.1304695396 -0.043294959 0.4571618225 0.15 +0.1269902982 -0.0816809181 0.4057737688 0.15 +0.2514971493 -0.1172115781 0.2951436383 0.15 +0.3430793256 -0.2220837364 0.1607249672 0.15 +0.3252268058 -0.2852446108 -0.041657989 0.15 +0.2255498451 -0.2555447785 -0.260269422 0.15 +0.1296438447 -0.2160341377 -0.3952676787 0.15 +-0.2075958832 -0.2290663076 -0.4044829449 0.15 +-0.4059948966 -0.0094298157 0.2062789045 0.15 +0.0487823414 -0.1577880817 0.295250694 0.15 +-0.464287935 -0.2182276228 -0.2699290391 0.15 +-0.4966141205 -0.1730976465 -0.0964354765 0.15 +-0.4723168792 -0.0985535781 0.0872494348 0.15 +-0.3720747023 -0.1569171204 0.2684518141 0.15 +-0.1644005838 -0.2361823495 0.336788987 0.15 +0.1279489327 -0.2717948903 0.2277676996 0.15 +0.2017404242 -0.3811752999 0.0098967377 0.15 +0.0623775125 -0.3131245774 -0.2061173103 0.15 +-0.1612882158 -0.3300740435 -0.235885503 0.15 +-0.3111377381 -0.3099831084 -0.2494312675 0.15 +-0.4462739548 -0.2656576031 0.1166848599 0.15 +-0.2827697098 -0.3247636403 0.1557065222 0.15 +-0.1048760116 -0.3807891914 0.1807097135 0.15 +-0.0076130627 -0.3991340864 0.0673725453 0.15 +-0.2959903049 -0.3493588246 -0.0911648022 0.15 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +-0.058445 0.071694 -0.013378 1.462682 + +Size +0.93513 + +Volume +0.640298554 + +// http://mathworld.wolfram.com/Ellipsoid.html +Inertia per unit mass +0.11435522 +0.11435522 +0.11435522 diff --git a/kratos.gid/apps/DEM/clusters/rock3refinedcluster3D.clu b/kratos.gid/apps/DEM/clusters/rock3refinedcluster3D.clu new file mode 100644 index 000000000..6ec770e02 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/rock3refinedcluster3D.clu @@ -0,0 +1,408 @@ +// +// Cluster Name: "rock3refinedcluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: $Date: 2017-01-27 +// + +Name +rock3refinedcluster3D + +Begin centers_and_radii +0.08734580846786 -0.52101849582672 -0.00605756406475 0.05 +0.08231812677383 -0.50620172168732 0.01825879163063 0.05 +0.15511124689102 -0.49266544776917 0.00642679652206 0.05 +0.08374225120544 -0.46099843494415 -0.07981821568737 0.05 +0.06124402521133 -0.47308233634949 0.07901877448849 0.05 +-0.0170487698555 -0.52690339355469 0.0002952475145 0.05 +0.14441217687607 -0.46088838264465 -0.07548814956036 0.05 +-0.01704686281204 -0.51053476280212 0.02728475274616 0.05 +0.12312599618912 -0.47161121124268 0.08872280111504 0.05 +0.02788987487793 -0.4581373135376 -0.08551499859627 0.05 +-0.00732380174637 -0.47562053173065 0.0831466727932 0.05 +0.20434530836105 -0.43241002593994 0.00410300590485 0.05 +-0.02430741428375 -0.46107976240158 -0.08233859280664 0.05 +0.15307309419632 -0.41654787414551 0.08932526641743 0.05 +-0.08069038572311 -0.5158399987793 0.02880716961433 0.05 +-0.06096881500244 -0.4680846905899 -0.07660906471009 0.05 +0.08521635606766 -0.43153199134827 0.14315039396851 0.05 +0.13773410799026 -0.40985733001709 -0.13022102765156 0.05 +0.05503373819351 -0.43201050033569 0.14416697304245 0.05 +-0.06251832754135 -0.47553765480042 0.09418113040901 0.05 +0.08013869394302 -0.40097837406158 -0.15357886730999 0.05 +0.21521537660599 -0.39939115768433 -0.08207843405743 0.05 +-0.08487062498093 -0.47961411911011 -0.08170287033503 0.05 +-0.00153211076736 -0.43393852127075 0.14813663298603 0.05 +-0.11968032623291 -0.47320613525391 -0.02406218929387 0.05 +0.12708720355988 -0.3537461917305 0.12438358681921 0.05 +0.16998467611313 -0.33708463115692 0.08019595713421 0.05 +0.09448530241013 -0.37273466316223 0.16640191452393 0.05 +-0.05346376466751 -0.43440066146851 0.15499782063435 0.05 +0.23882592542648 -0.34436627929688 -0.0166020481041 0.05 +-0.03156605871201 -0.39525613124847 -0.16497243312778 0.05 +0.19246617574692 -0.35027501506805 -0.15400448985043 0.05 +0.03732664104462 -0.35036786424637 -0.18140744904641 0.05 +0.06651342466354 -0.36842283790588 0.19542936601284 0.05 +-0.16073440290451 -0.45873644302368 0.00590587329895 0.05 +-0.13606711362839 -0.4413309368515 0.10368241233261 0.05 +0.24368133752823 -0.32737364803314 -0.0883425646594 0.05 +-0.10488886014938 -0.40926598762512 -0.15351337693468 0.05 +-0.01005794584274 -0.3906218567276 0.2069332314101 0.05 +-0.15867026674271 -0.43057227172852 -0.07693154820208 0.05 +-0.11364449396133 -0.41991483882904 0.15734938805466 0.05 +0.10110131292343 -0.29094450931549 0.15944190722099 0.05 +0.10621934080124 -0.30547959724426 -0.19784246496503 0.05 +-0.07028416606903 -0.34960643741608 -0.18308668010161 0.05 +-0.08187696405411 -0.37917157051086 0.20878553747555 0.05 +-0.16649613740921 -0.39801673557281 -0.13054474422592 0.05 +0.21138539766312 -0.25032797992706 0.08660639908997 0.05 +0.07581510858536 -0.29199044319153 0.2069120598904 0.05 +-0.19683854963303 -0.39106897895813 0.01242537454079 0.05 +0.22064886125565 -0.27632320713043 -0.16550350945026 0.05 +-0.13481482175827 -0.38236149799347 0.19120331146626 0.05 +-0.18636459020615 -0.39884494865417 0.12961057255222 0.05 +-0.03298291254044 -0.33191328552246 0.23733455300091 0.05 +-0.03567947198868 -0.28994688720703 -0.21265998326855 0.05 +-0.20113162229538 -0.36806137371063 -0.08121719451937 0.05 +0.27285306344986 -0.23856255477905 -0.02066943162907 0.05 +0.05529325502396 -0.24964585432053 -0.21264025395046 0.05 +0.27093457773209 -0.23216641048431 -0.08247632306082 0.05 +0.16065637304306 -0.22566998748779 0.17196437077446 0.05 +-0.21452200738907 -0.34808652378082 0.07576581663717 0.05 +-0.22434574445724 -0.32907314159393 -0.03544933731448 0.05 +0.06551405443192 -0.23111268951416 0.22945805541607 0.05 +0.14626598203659 -0.20934482143402 -0.21262052463238 0.05 +-0.16084302492142 -0.30819053897858 -0.1975246758393 0.05 +0.22285920408249 -0.19340662628174 0.13842728463552 0.05 +-0.21068702245712 -0.33108769462585 -0.15339194355875 0.05 +-0.21785003660202 -0.32849856529236 0.14527527613907 0.05 +0.2715146367836 -0.17759183273315 0.03325579913607 0.05 +0.25724725008011 -0.19378247276306 -0.15350946856831 0.05 +-0.14058776014328 -0.31117267818451 0.24248644329586 0.05 +-0.22803325136185 -0.30655326271057 -0.12266747506322 0.05 +-0.24267942457199 -0.29732809890747 0.02192106072212 0.05 +-0.03566993677139 -0.20977005239487 -0.22794610172061 0.05 +-0.17737470788956 -0.3134157585907 0.21420717716045 0.05 +0.14992353246689 -0.18379898107529 0.20985311279858 0.05 +-0.07249693243027 -0.24739613899231 0.2576695380756 0.05 +-0.09825171323776 -0.21889187828064 -0.22037844800599 0.05 +0.05530279024124 -0.16946901950836 -0.22792637240253 0.05 +-0.00046515968323 -0.20920751430511 0.25839989781715 0.05 +-0.25185293928146 -0.26707730422974 -0.08332404916975 0.05 +0.15294981178284 -0.15375208112717 0.2246892138699 0.05 +-0.26069311868668 -0.27092651252747 0.08958914604681 0.05 +0.07156661306381 -0.17101888961792 0.25913025755871 0.05 +-0.00177823856354 -0.18938455244064 0.27300236222694 0.05 +0.13745305746078 -0.12937936384837 -0.21265532014999 0.05 +0.05089632795334 -0.12948629071554 -0.22794377016133 0.05 +0.30988609926224 -0.12595211540222 -0.0100521164082 0.05 +0.27017621011734 -0.11662111068726 0.0871810299012 0.05 +0.23433301050186 -0.13648527263641 0.19024817018108 0.05 +0.22400978696823 -0.1292724369812 -0.19736687013865 0.05 +0.28453291002274 -0.12752320137024 -0.13001924922369 0.05 +-0.07512309019089 -0.20775021526337 0.28687446689518 0.05 +0.32647149728775 -0.13054673931122 -0.04679583688259 0.05 +-0.12107731502533 -0.17204050868988 -0.22780273245812 0.05 +-0.25384691213608 -0.24692319221497 0.14935915845051 0.05 +-0.25493488042831 -0.24504515171051 -0.16411775560707 0.05 +-0.20649422849655 -0.21448779979706 -0.21237324474358 0.05 +-0.29637270986557 -0.24325050462723 -0.01210628743361 0.05 +-0.03566040155411 -0.1295932175827 -0.24323222017267 0.05 +-0.21578105337143 -0.23264158214569 0.23272625733845 0.05 +0.05792032657623 -0.08692657674789 -0.23165061289739 0.05 +0.32143523389816 -0.08633209568024 -0.0769141480396 0.05 +-0.30353620077133 -0.21335445976257 0.03390301595455 0.05 +-0.29102853841782 -0.19558486721039 0.09229820640329 0.05 +0.02229051717758 -0.11810081748962 0.30158601943508 0.05 +-0.1801333257103 -0.20205149265289 0.29086169285442 0.05 +-0.08215094263077 -0.16378261322021 0.31978354634113 0.05 +0.10778975135803 -0.11220471588135 0.30553179651993 0.05 +0.27194892620087 -0.06731219776154 0.15114101296709 0.05 +0.22192205114365 -0.05694288734436 -0.18658606694278 0.05 +0.29234304758072 -0.06962583877563 -0.15310312826345 0.05 +0.32144127286911 -0.06234542226791 0.05982288351488 0.05 +0.3421373825264 -0.06331141923904 0.01794101692692 0.05 +0.35043008153915 -0.06560873119354 -0.00043084331028 0.05 +0.15150105470657 -0.04425993591309 -0.2200690056221 0.05 +0 0 0 0.05 +0.19328898553848 -0.10630861427307 0.30947757360477 0.05 +-0.12669689533234 -0.08695661268234 -0.23533566516888 0.05 +-0.29894912557602 -0.17615837173462 0.13105323567112 0.05 +-0.17167813070297 -0.15445415122986 0.28866718118992 0.05 +-0.21211380880356 -0.12940390378952 -0.21990617745433 0.05 +0.24664575712204 -0.06510229196548 0.24446422090176 0.05 +-0.0890349192365 -0.06152630737305 -0.24145859581997 0.05 +0.35833755777359 -0.04514098999023 -0.02380904685551 0.05 +-0.00726245851517 -0.08792956241608 0.31945605119854 0.05 +-0.35006599515915 -0.18917291034698 -0.04613363558933 0.05 +-0.03548455625534 -0.04012073781967 -0.24848299862682 0.05 +-0.32584241132736 -0.18287267444611 -0.15076726641872 0.05 +-0.25450945081711 -0.15515347995758 0.22931337375011 0.05 +0.07225175815582 -0.08129452119827 0.33554057967533 0.05 +-0.32821016469955 -0.14424654220581 0.03523725435608 0.05 +0.21738638666153 0.00154226842244 -0.17634263047209 0.05 +-0.0934671795845 -0.10751696468353 0.338583913522 0.05 +-0.28928168661118 -0.13885954174042 -0.19223762240905 0.05 +-0.17068090589523 -0.12304808551788 0.31125863491047 0.05 +0.058096171875 0.00254590301514 -0.23690139135153 0.05 +0.15176597482681 -0.07465947998047 0.35162510815212 0.05 +0.32638774629593 -0.0017433555603 -0.0898425769255 0.05 +-0.30377148225784 -0.13304043701172 0.17345327087711 0.05 +0.27372164228439 -0.01800328483582 0.21510099603298 0.05 +-0.33376816339493 -0.12909810142517 0.07891288804596 0.05 +-0.00320808412552 -0.06076174186707 0.35550388054997 0.05 +0.32075004907608 0.01176041915894 -0.12099650421776 0.05 +0.33299644647598 0.00126127086639 0.12969788343796 0.05 +0.37438866579056 -0.00067072307587 0.04593415026203 0.05 +0.10198435350418 -0.04441440643311 0.35589235197681 0.05 +-0.3449258773613 -0.12303410053253 -0.12401224874754 0.05 +-0.36452980733871 -0.11892847434998 -0.04351817411762 0.05 +-0.24210238500595 -0.09965883319855 0.28035900381786 0.05 +-0.21773338911057 -0.04432000778198 -0.22743911016509 0.05 +-0.16922066682816 -0.08569053447723 0.33868152172726 0.05 +-0.09700029542923 -0.07364366149902 0.36982436570011 0.05 +-0.35303351369858 -0.11092739406586 0.11759316800411 0.05 +0.28327171861649 0.04734447275798 -0.13261625532207 0.05 +0.08495604463577 -0.02721637069702 0.36648630353153 0.05 +-0.14240943691889 0.00654060283661 -0.23968497146727 0.05 +-0.33787013441086 -0.11098071182251 0.19667658196896 0.05 +0.04601139640808 0.05828504863739 -0.24068508300244 0.05 +0.00557782400131 -0.02813993595123 0.37275976517796 0.05 +0.12733150377274 0.06721835533142 -0.22763638892392 0.05 +0.16254283632278 0.00101343467712 0.34105157817226 0.05 +0.20127335270564 0.07586112925212 -0.1813875526733 0.05 +0.25895850374222 0.00628068870544 0.29868027162243 0.05 +-0.36858720121384 -0.08203783111572 0.0267725404208 0.05 +-0.03530871095657 0.04935174194336 -0.25373377708097 0.05 +0.12138462713242 0.0075904302597 0.34583524555103 0.05 +-0.35100076429367 -0.08065268188477 -0.15057594395256 0.05 +0.35423503053665 0.06043055198669 0.049436046534 0.05 +0.32346162649155 0.06617107063293 0.12548850074203 0.05 +0.27521520163854 0.08450390317281 -0.13513871642268 0.05 +-0.16099670084 -0.05295923248291 0.36574120448948 0.05 +0.36043244501114 0.06613912765503 -0.02658202558754 0.05 +-0.22868649320602 -0.06090810745239 0.32288064546398 0.05 +0.28044397047043 0.06481293785095 0.19680084206005 0.05 +0.03164829996109 0.01223233295441 0.37207010436596 0.05 +-0.30009462301254 -0.05992542385101 0.25470448693256 0.05 +0.19492909588496 0.1003008446757 -0.190217725305 0.05 +-0.37199961709976 -0.05654789096832 0.06740013868675 0.05 +-0.0885631378746 -0.03067622428894 0.39501016706074 0.05 +0.21948747179031 0.01295859867096 0.35790745376049 0.05 +-0.11554633277893 0.06197962749481 -0.24582256209776 0.05 +-0.38914354047775 -0.06177358734131 -0.04795741490685 0.05 +0.24624448339462 0.06594667518616 0.26377899255444 0.05 +0.34915705057144 0.09314667709351 -0.08888988017206 0.05 +0.04623630834579 0.11452161476135 -0.23512285750417 0.05 +-0.14875213102341 -0.02052987903595 0.38387648597385 0.05 +-0.2095187994194 -0.03168377891541 0.35614046834255 0.05 +-0.06351388368607 0.01256495311737 0.38604855698124 0.05 +-0.27039909582138 0.02520563175201 -0.20122213104468 0.05 +-0.3329995454216 -0.0080620262146 -0.16912120008986 0.05 +0.20961073480606 0.07571391609192 0.30748162425854 0.05 +-0.26866273275375 -0.02520952529907 0.30549375124134 0.05 +-0.18822157377243 -0.01319658180237 0.3744300077116 0.05 +0.26252668799718 0.13338333401998 -0.15279906168609 0.05 +0.04606451551437 0.07212343002319 0.3515751502882 0.05 +0.30289344766617 0.13007117034912 0.1034555828627 0.05 +0.14166682889938 0.08315424613953 0.33415254715359 0.05 +0.33360892526627 0.12905519294739 0.01748306022629 0.05 +0.17759242868423 0.07737733474731 0.33718595865314 0.05 +-0.3731629930687 -0.01045949768066 0.10169909667252 0.05 +-0.19578395460129 0.07460751304626 -0.23791134711456 0.05 +-0.35347372289658 -0.00902031555176 0.1761788588641 0.05 +-0.11213669799805 0.10845252841949 -0.23865993628452 0.05 +-0.13769453683853 0.01488908287048 0.38533824384213 0.05 +-0.23225330015182 -0.00149170528412 0.34600438695637 0.05 +-0.39096572050095 -0.00216838787079 0.01720710936939 0.05 +0.2641849152565 0.1383788873291 0.18238424859432 0.05 +-0.04688613340378 0.0648696723938 0.37020239558727 0.05 +-0.18991931921005 0.01261652275085 0.37081504283306 0.05 +-0.32172923643112 0.0057783416748 0.23757390078083 0.05 +0.35288261888504 0.14403343009949 -0.06020911952923 0.05 +-0.28106280607224 0.02532100788116 0.29149441554668 0.05 +-0.41269203092575 0.00051013412476 -0.05375145989262 0.05 +-0.12238479196548 0.05859740646362 0.37397288748791 0.05 +0.22871346992493 0.17183915668488 -0.17373174558683 0.05 +0.04622188632965 0.16951868209839 -0.23734620959546 0.05 +0.22413001016617 0.15169815559387 0.24664592581593 0.05 +-0.18294685049057 0.0511198890686 0.36324613800854 0.05 +-0.03485888708115 0.16182487419128 -0.24260932608441 0.05 +-0.23700469892502 0.04016694389343 0.33710184945499 0.05 +0.12730265974045 0.17721249000549 -0.2320830931065 0.05 +0.24202332216263 0.1802923651886 0.15202464989622 0.05 +-0.36787841672897 0.04762070270538 -0.11437830590844 0.05 +0.33012428010941 0.16646582336426 -0.11538039806717 0.05 +0.30522607965469 0.18418559440613 -0.00458299944614 0.05 +0.04938952524185 0.13532586967468 0.33428863329792 0.05 +0.26154787145615 0.19338596664429 0.09190095196861 0.05 +-0.03638960729599 0.11972418823242 0.35818441415852 0.05 +0.19753597131729 0.1577482509613 0.28691484854038 0.05 +0.04652745031357 0.19711971935272 -0.20982735507774 0.05 +-0.11191178606033 0.16468909454346 -0.23309771078625 0.05 +0.20881080953598 0.18561762512207 0.21688811458546 0.05 +-0.33101558454514 0.07424120178223 0.18487839206623 0.05 +0.17288536867142 0.15372168762207 0.32057496889904 0.05 +-0.10996588659286 0.10523002227783 0.36626628125324 0.05 +0.21277535423279 0.20210520771027 -0.18649140082881 0.05 +-0.30444887998581 0.07906951797485 0.23604078277668 0.05 +-0.3615154073143 0.07874690979004 0.10504076434513 0.05 +0.1325021342659 0.15281774902344 0.33774086014629 0.05 +-0.16939277750015 0.09345593597412 0.35728136519566 0.05 +-0.3230648025322 0.09473127128601 -0.17500515192427 0.05 +-0.26273770765305 0.08495449516296 0.28876092429485 0.05 +-0.25522109586716 0.12746893009186 -0.20526707030703 0.05 +-0.21912584867477 0.08888205116272 0.33057917536961 0.05 +0.32308959409714 0.2005540662384 -0.08412279811186 0.05 +0.04693277650833 0.22234744102478 -0.18467845965643 0.05 +-0.11339673723221 0.19267757946014 -0.20950450742985 0.05 +-0.03424775911331 0.21702694869995 -0.18757161704899 0.05 +0.12811331212997 0.22766793334961 -0.18178530226387 0.05 +0.2782240924263 0.22780047286987 -0.0208689458004 0.05 +-0.18896468503952 0.16755331489563 -0.22358609548808 0.05 +0.21318068042755 0.22733292938232 -0.1613425054075 0.05 +-0.39047259084702 0.09334119552612 0.01553184797413 0.05 +0.22889412256241 0.24102057487488 0.07839819513382 0.05 +0.04706595170975 0.24241811988831 -0.16466492689957 0.05 +-0.15373062688828 0.12711461730957 0.35669265849667 0.05 +0.18115319665909 0.23051356002808 0.20059371692974 0.05 +-0.11309117324829 0.22027861671448 -0.18198565291214 0.05 +0.29824804872513 0.22699792541504 -0.14089970855112 0.05 +-0.10588902498245 0.14814072494507 0.36625912793324 0.05 +-0.17973483308792 0.13767487045288 0.33884760566517 0.05 +-0.41325444982529 0.09258823120117 -0.05519790157974 0.05 +0.04468258441925 0.26063888713837 -0.14642156682621 0.05 +0.2970179262352 0.2404600630188 -0.10319249644421 0.05 +-0.0307404678154 0.17439848846436 0.36352136776463 0.05 +0.05023386873245 0.19753521644592 0.33887737270649 0.05 +0.12334657754898 0.26410946784973 -0.14529858211716 0.05 +0.20389266365051 0.25158551616669 -0.16924535922684 0.05 +-0.21669023633957 0.14949234199524 0.30451691924389 0.05 +0.15343670381546 0.23285636291504 0.25139198057659 0.05 +-0.03398140871048 0.257168306427 -0.14754455153526 0.05 +0.11164654809952 0.19466654632568 0.35111866463322 0.05 +-0.11563898330688 0.24125609474182 -0.16334202420273 0.05 +-0.36395634347916 0.13645928916931 -0.11391034753962 0.05 +0.24623923902512 0.26845577880859 -0.02345065975433 0.05 +-0.24829677999496 0.16168947410583 0.26185526866505 0.05 +0.04432803325653 0.27914730010986 -0.12832019150179 0.05 +0.20150929636002 0.26980628341675 -0.15100199915348 0.05 +0.12460228620529 0.21850363601685 0.32910778359455 0.05 +-0.19193458738327 0.223530284729 -0.17639968877529 0.05 +0.13889954992294 0.23584231620789 0.28733908656727 0.05 +0.20110675127029 0.28090384605408 0.07025246735161 0.05 +-0.11778667181015 0.18143102905273 0.35697602226986 0.05 +-0.24978443281174 0.20154517261505 -0.18816562744442 0.05 +-0.11550580810547 0.26132677360535 -0.14332849144587 0.05 +0.26873694852829 0.27386971626282 -0.105397089098 0.05 +-0.3573763284111 0.15998203453064 0.10977407004353 0.05 +0.15270424020767 0.27619376655579 0.18616339370464 0.05 +0.10767870580673 0.29538259674072 -0.11364260280991 0.05 +-0.31465823713303 0.18033034713745 -0.17262279349949 0.05 +-0.28788525403976 0.18561714836121 0.21182673686382 0.05 +-0.03469051103592 0.29418513237 -0.11134180088642 0.05 +-0.13842580854416 0.20547074211121 0.33100854763424 0.05 +0.27967201517105 0.27550309898376 -0.1567054161898 0.05 +-0.11170944080353 0.2806394026947 -0.12764744771473 0.05 +0.20795915571213 0.30891895011902 -0.01412968187656 0.05 +-0.36340910146713 0.17844841308594 -0.11440512364746 0.05 +-0.02883302705765 0.22242896713257 0.37110463691723 0.05 +-0.15536178472519 0.22448507781982 0.30168293538357 0.05 +-0.38919789121628 0.17345068786621 0.01529085608437 0.05 +0.03390063747406 0.31537031921387 -0.09412826650884 0.05 +0.05876010110855 0.25083723999023 0.33168707464977 0.05 +0.05956749563217 0.27736882316589 0.26481160891033 0.05 +-0.31230764715195 0.20576959171295 0.15208708280411 0.05 +0.06158737249374 0.28377251617432 0.24855199715755 0.05 +-0.19703020750046 0.26548524078369 -0.13911243135647 0.05 +0.23045718305588 0.31015678024292 -0.08664218011202 0.05 +0.17104777338028 0.32151449539185 0.07257845011528 0.05 +-0.11206399196625 0.2991478156662 -0.10954607239031 0.05 +0.24772315721512 0.3018015460968 -0.15470222699146 0.05 +0.1342721884346 0.31101749252319 0.17058406845337 0.05 +0.06223338346481 0.27813179946899 0.2970803508395 0.05 +-0.22583379457474 0.23748626712799 0.2372870180357 0.05 +-0.16877751760483 0.24957255233765 0.27523636137165 0.05 +-0.41215996580124 0.17656647903442 -0.05618745379543 0.05 +-0.03982164983749 0.25182524742126 0.35032239627789 0.05 +-0.34335367895126 0.21944635116577 0.09929036038021 0.05 +0.21199644617081 0.32434009811401 -0.13033141376312 0.05 +-0.31060418058395 0.23553703033447 -0.15274515940075 0.05 +0.05497811609268 0.30839212936401 0.24755197455814 0.05 +-0.03987743085861 0.33535804168701 -0.07461393020777 0.05 +-0.11171937332153 0.32070010837555 -0.09401871687421 0.05 +-0.0503239765358 0.27079333732605 0.32975908184361 0.05 +0.10177465818405 0.34692712081909 -0.07968684554232 0.05 +-0.26723896589279 0.25155714889526 0.19440009556469 0.05 +0.16030245756149 0.35150068778992 0.00103601995171 0.05 +0.18208327764511 0.34823280990601 -0.05696425242897 0.05 +-0.18943747289658 0.3041104989624 -0.1077503438942 0.05 +0.1203556977272 0.34454061485291 0.16095904563126 0.05 +0.18968626260757 0.35188591056824 -0.09042699307468 0.05 +-0.05567672967911 0.29048038261414 0.31526345572941 0.05 +0.02901411672592 0.36306054954529 -0.05622875123866 0.05 +-0.36834151044846 0.23757661331177 -0.08629153763351 0.05 +-0.38416138944626 0.23346232597351 0.00712937946053 0.05 +-0.16378233510971 0.28935538589478 0.26274729920757 0.05 +0.13399503145218 0.364639740448 0.07595574016777 0.05 +0.05314020296097 0.33721391281128 0.24390597350086 0.05 +-0.21113843553543 0.29204296634674 0.2255644283416 0.05 +0.10312079248428 0.37606293075562 -0.03308159560307 0.05 +-0.31007990255356 0.27607870826721 -0.1204647356385 0.05 +-0.33464866125107 0.27318620010376 0.08463020790585 0.05 +0.10885670244217 0.37107680671692 0.14342761396282 0.05 +-0.05300273691177 0.31643905815125 0.30755240751377 0.05 +-0.24910679670334 0.30190881729126 0.17663211398747 0.05 +-0.04374642473221 0.37919397827148 -0.03277065693501 0.05 +-0.11974925790787 0.36429925373077 -0.05761992775992 0.05 +-0.18874823560715 0.3472150843811 -0.076695632862 0.05 +0.05593155836105 0.36629171684265 0.2175350285416 0.05 +0.08369167482376 0.3949029309082 0.01700283593273 0.05 +-0.28116499181747 0.31040215316772 0.1236744418634 0.05 +0.03084622926712 0.39595625457764 -0.0113004861256 0.05 +-0.2937285941124 0.31432589508057 -0.09680828813581 0.05 +-0.35728320112228 0.28486890724182 -0.07620401517569 0.05 +-0.36712370428085 0.28307549179077 0.00300292335743 0.05 +0.0731253827095 0.39832734527588 0.09653840894772 0.05 +-0.15503790517807 0.33252878379822 0.25672876111851 0.05 +-0.04133020067215 0.3464268397522 0.2995728790456 0.05 +0.06145801137924 0.39173183547974 0.1685909458223 0.05 +-0.12168375484467 0.38621722202301 -0.03669829112354 0.05 +-0.26368662069321 0.34219018379211 -0.07894080906921 0.05 +-0.29744891805649 0.3289007925415 0.08309680146137 0.05 +-0.22768132238388 0.34761810623169 0.16271867582096 0.05 +-0.02856119390488 0.37645435142517 0.25490322231503 0.05 +-0.04142833395004 0.41584957839966 0.01048062335186 0.05 +-0.32788183538437 0.32726645629883 -0.06524295120003 0.05 +-0.33474639722824 0.3279110369873 0.00219673265499 0.05 +-0.12404586654663 0.40580200210571 -0.01843683141993 0.05 +-0.00968861509323 0.40505603027344 0.1881568624641 0.05 +-0.15993261032104 0.38061997001648 0.17654641836754 0.05 +-0.0124622508812 0.42102942626953 0.10350398314888 0.05 +-0.1385713000679 0.37580261932373 0.2403964047163 0.05 +-0.19962108495712 0.39324046577454 -0.04062592531208 0.05 +-0.20629462461472 0.38211191368103 0.14775923766758 0.05 +-0.23469288549423 0.38222252220154 0.08605218985359 0.05 +-0.28397851659775 0.36733773017883 -0.06130297176567 0.05 +-0.12288682115555 0.4241298021698 0.00318880872351 0.05 +-0.09218389825821 0.41362183380127 0.19037416091412 0.05 +-0.28626506170273 0.37784410934448 0.0019868923201 0.05 +-0.16166237819672 0.41423574287415 0.10008052822271 0.05 +-0.14648858963013 0.43932949474335 0.05500293034349 0.05 +-0.0886318708992 0.44624896354675 0.11410886659184 0.05 +-0.20434530836105 0.43241002593994 -0.00410300590485 0.05 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +0.000000 0.000000 0.000000 1.00 + +Size +1.00 + +Volume // Ideal spherical TODO +0.5235987755982989 + +// Ideal spherical TODO +Inertia per unit mass +0.1 +0.1 +0.1 diff --git a/kratos.gid/apps/DEM/clusters/singlespherecluster3D.clu b/kratos.gid/apps/DEM/clusters/singlespherecluster3D.clu new file mode 100644 index 000000000..e4254dbb1 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/singlespherecluster3D.clu @@ -0,0 +1,26 @@ +// +// Cluster Name: "ballast1cluster3Dred" +// Author: Joaquin Irazabal +// Date: 2016-10-26 +// + +Name +ballast1cluster3Dred + +Begin centers_and_radii +0.0 0.0 0.0 0.5 +End centers_and_radii + +Particle_center_and_diameter +0.0 0.0 0.0 1.0 + +Size +1.0 + +Volume +0.523598667 + +Inertia per unit mass +0.1 +0.1 +0.1 diff --git a/kratos.gid/apps/DEM/clusters/soybean3cluster3D.clu b/kratos.gid/apps/DEM/clusters/soybean3cluster3D.clu new file mode 100644 index 000000000..be24ab58b --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/soybean3cluster3D.clu @@ -0,0 +1,28 @@ +// +// Cluster Name: "soybean3cluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: $Date: 2016-4-28 +// + +Name +soybean3cluster3D + +Begin centers_and_radii + 0.0 0.0 0.0 1.715 + 1.0 0.0 0.0 1.425 +-1.0 0.0 0.0 1.425 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +0.000000 0.000000 0.000000 4.850000 + +Size +4.850000 + +Volume +30.6783119968 + +Inertia per unit mass +1.25437 +2.535125 +2.613005 diff --git a/kratos.gid/apps/DEM/clusters/soybeancluster3D.clu b/kratos.gid/apps/DEM/clusters/soybeancluster3D.clu new file mode 100644 index 000000000..531954b73 --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/soybeancluster3D.clu @@ -0,0 +1,38 @@ +// +// Cluster Name: "soybeancluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: $Date: 2016-4-28 +// + +Name +soybeancluster3D + +Begin centers_and_radii + 0.0 0.0 0.0 4.53 + 3.0 0.0 0.0 3.53 +-3.0 0.0 0.0 3.53 + 0.0 2.0 0.0 3.53 + 0.0 -2.0 0.0 3.53 + 2.2 1.3 0.0 3.53 + 2.2 -1.3 0.0 3.53 +-2.2 1.3 0.0 3.53 +-2.2 -1.3 0.0 3.53 + 1.7 0.0 0.75 3.53 + 1.7 0.0 -0.75 3.53 +-1.7 0.0 0.75 3.53 +-1.7 0.0 -0.75 3.53 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +0.000000 0.000000 0.000000 13.060000 + +Size +13.060000 + +Volume +86.3799435501 + +Inertia per unit mass +2.571725 +3.17117 +3.690805 diff --git a/kratos.gid/apps/DEM/clusters/tetrahedral3D.clu b/kratos.gid/apps/DEM/clusters/tetrahedral3D.clu new file mode 100644 index 000000000..74be6c7ea --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/tetrahedral3D.clu @@ -0,0 +1,29 @@ +// +// Cluster Name: "tetrahedral3D" +// Author: Joaquin Irazabal +// Date: 2019-11-04 +// + +Name +Round_robin_test_Particle + +Begin centers_and_radii +-4.2758e-06 0.0005292 0.0018230 0.0031 +-0.0015465 -0.0010421 -0.0003600 0.0031 + 0.0015535 -0.0010334 -0.0003553 0.0031 +-2.6753e-06 0.0015465 -0.0011044 0.0031 +End centers_and_radii + +Particle_center_and_diameter +-0.0003695 -3.1822e-06 0.0009011 0.0100 + +Size +0.0100 + +Volume +3.322e-07 + +Inertia per unit mass +7.745e-06 +7.745e-06 +7.745e-06 diff --git a/kratos.gid/apps/DEM/clusters/wheat5cluster3D.clu b/kratos.gid/apps/DEM/clusters/wheat5cluster3D.clu new file mode 100644 index 000000000..94aba933d --- /dev/null +++ b/kratos.gid/apps/DEM/clusters/wheat5cluster3D.clu @@ -0,0 +1,30 @@ +// +// Cluster Name: "wheat5cluster3D" +// Author: Miguel Angel Celigueta - Salva Latorre +// Date: $Date: 2016-4-28 +// + +Name +wheat5cluster3D + +Begin centers_and_radii + 0.0 0.0 0.0 1.715 + 1.0 0.0 0.0 1.595 +-1.0 0.0 0.0 1.595 + 1.83 0.0 0.0 1.252 +-1.83 0.0 0.0 1.252 +End centers_and_radii + +Particle_center_and_diameter //Needed by the mesher, KRATOS skips it +0.000000 0.000000 0.000000 6.164000 + +Size +6.164000 + +Volume +30.6783119968 + +Inertia per unit mass +1.25437 +2.535125 +2.613005 diff --git a/kratos.gid/apps/DEM/examples/CirclesDrop.tcl b/kratos.gid/apps/DEM/examples/CirclesDrop.tcl index 984675fbb..4d32ff0ae 100644 --- a/kratos.gid/apps/DEM/examples/CirclesDrop.tcl +++ b/kratos.gid/apps/DEM/examples/CirclesDrop.tcl @@ -1,25 +1,27 @@ +namespace eval ::DEM::examples::CirclesDrop { + namespace path ::DEM::examples + Kratos::AddNamespace [namespace current] +} -proc ::DEM::examples::CirclesDrop {args} { +proc ::DEM::examples::CirclesDrop::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to discard your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawGeometryCirclesDrop - AssignToTreeCirclesDrop - AssignMeshSizeCirclesDrop + DrawGeometry + AssignToTree + AssignMeshSize GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS GidUtils::UpdateWindow LAYER GiD_Process 'Zoom Frame - MeshGenerationOKDo 1.0 - } -proc ::DEM::examples::DrawGeometryCirclesDrop { } { +proc ::DEM::examples::CirclesDrop::DrawGeometry { } { Kratos::ResetModel GiD_Groups create "Box" @@ -42,10 +44,10 @@ proc ::DEM::examples::DrawGeometryCirclesDrop { } { } -proc ::DEM::examples::AssignToTreeCirclesDrop { } { +proc ::DEM::examples::CirclesDrop::AssignToTree { } { # Material set DEMmaterials [spdAux::getRoute "DEMMaterials"] - set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e7 PARTICLE_MATERIAL 2 ] + set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e7 ] set material_node [[customlib::GetBaseRoot] selectNodes "$DEMmaterials/blockdata\[@name = 'DEM-DefaultMaterial' \]"] spdAux::SetValuesOnBaseNode $material_node $props @@ -74,19 +76,11 @@ proc ::DEM::examples::AssignToTreeCirclesDrop { } { set change_list [list EndTime 5 DeltaTime 5e-5 NeighbourSearchFrequency 50] set xpath [spdAux::getRoute DEMTimeParameters] spdAux::SetValuesOnBasePath $xpath $change_list - + spdAux::RequestRefresh } -proc ::DEM::examples::AssignMeshSizeCirclesDrop { } { +proc ::DEM::examples::CirclesDrop::AssignMeshSize { } { GiD_Process Mescape Meshing AssignSizes Surfaces 0.6 1:end escape escape escape GiD_Process Mescape Meshing AssignSizes Lines 0.6 1:end escape escape escape } - -proc ::DEM::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} \ No newline at end of file diff --git a/kratos.gid/apps/DEM/examples/SpheresDrop.tcl b/kratos.gid/apps/DEM/examples/SpheresDrop.tcl index 85417d099..40244bdea 100644 --- a/kratos.gid/apps/DEM/examples/SpheresDrop.tcl +++ b/kratos.gid/apps/DEM/examples/SpheresDrop.tcl @@ -1,21 +1,26 @@ +namespace eval ::DEM::examples::SpheresDrop { + namespace path ::DEM::examples + Kratos::AddNamespace [namespace current] -proc ::DEM::examples::SpheresDrop {args} { +} + +proc ::DEM::examples::SpheresDrop::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to discard your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawGeometrySpheresDrop - AssignToTreeSpheresDrop - AssignMeshSizeSpheresDrop + DrawGeometry + AssignToTree + AssignMeshSize GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS GidUtils::UpdateWindow LAYER } -proc ::DEM::examples::DrawGeometrySpheresDrop { } { +proc ::DEM::examples::SpheresDrop::DrawGeometry { } { Kratos::ResetModel # Draw floor surface @@ -35,15 +40,15 @@ proc ::DEM::examples::DrawGeometrySpheresDrop { } { # Group assignation GiD_EntitiesGroups assign "Floor" surfaces 1 - GiD_EntitiesGroups assign "Inlet" -also_lower_entities surfaces 2 - GiD_EntitiesGroups assign "ClusterInlet" -also_lower_entities surfaces 3 - GiD_EntitiesGroups assign "Body" -also_lower_entities volumes 1 + GiD_EntitiesGroups assign "Inlet" surfaces 2 + GiD_EntitiesGroups assign "ClusterInlet" surfaces 3 + GiD_EntitiesGroups assign "Body" volumes 1 } -proc ::DEM::examples::AssignToTreeSpheresDrop { } { +proc ::DEM::examples::SpheresDrop::AssignToTree { } { # Material set DEMmaterials [spdAux::getRoute "DEMMaterials"] - set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e6 PARTICLE_MATERIAL 2 ] + set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e6] set material_node [[customlib::GetBaseRoot] selectNodes "$DEMmaterials/blockdata\[@name = 'DEM-DefaultMaterial' \]"] spdAux::SetValuesOnBaseNode $material_node $props @@ -90,17 +95,9 @@ proc ::DEM::examples::AssignToTreeSpheresDrop { } { spdAux::RequestRefresh } -proc DEM::examples::AssignMeshSizeSpheresDrop { } { +proc ::DEM::examples::SpheresDrop::AssignMeshSize { } { GiD_Process Mescape Meshing AssignSizes Volumes 0.2 1:end escape escape escape GiD_Process Mescape Meshing AssignSizes Surfaces 0.2 1:end escape escape escape GiD_Process Mescape Meshing AssignSizes Lines 0.2 1:end escape escape escape } - -proc DEM::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} \ No newline at end of file diff --git a/kratos.gid/apps/DEM/examples/examples.tcl b/kratos.gid/apps/DEM/examples/examples.tcl index cd64a1d24..ff16088bd 100644 --- a/kratos.gid/apps/DEM/examples/examples.tcl +++ b/kratos.gid/apps/DEM/examples/examples.tcl @@ -1,19 +1,12 @@ -namespace eval DEM::examples { - -} - -proc DEM::examples::Init { } { - uplevel #0 [list source [file join $::DEM::dir examples SpheresDrop.tcl]] - uplevel #0 [list source [file join $::DEM::dir examples CirclesDrop.tcl]] +namespace eval ::DEM::examples { + namespace path ::DEM + Kratos::AddNamespace [namespace current] } -proc DEM::examples::UpdateMenus { } { - if {$::Model::SpatialDimension eq "3D"} { - GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Spheres drop" ] 8 PRE [list ::DEM::examples::SpheresDrop] "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Circles drop" ] 8 PRE [list ::DEM::examples::CirclesDrop] "" "" insertafter = +proc ::DEM::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} } - GiDMenu::UpdateMenus -} - -DEM::examples::Init \ No newline at end of file +} \ No newline at end of file diff --git a/kratos.gid/apps/DEM/examples/examples.xml b/kratos.gid/apps/DEM/examples/examples.xml new file mode 100644 index 000000000..46c1e3be8 --- /dev/null +++ b/kratos.gid/apps/DEM/examples/examples.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/DEM/images/CirclesDrop.png b/kratos.gid/apps/DEM/images/CirclesDrop.png new file mode 100644 index 000000000..9e528ec56 Binary files /dev/null and b/kratos.gid/apps/DEM/images/CirclesDrop.png differ diff --git a/kratos.gid/apps/DEM/images/SpheresDrop.png b/kratos.gid/apps/DEM/images/SpheresDrop.png new file mode 100644 index 000000000..8888126b0 Binary files /dev/null and b/kratos.gid/apps/DEM/images/SpheresDrop.png differ diff --git a/kratos.gid/apps/DEM/images/drop.png b/kratos.gid/apps/DEM/images/drop.png index f473a22eb..eb9ebee00 100644 Binary files a/kratos.gid/apps/DEM/images/drop.png and b/kratos.gid/apps/DEM/images/drop.png differ diff --git a/kratos.gid/apps/DEM/images/material-relation-16.png b/kratos.gid/apps/DEM/images/material-relation-16.png new file mode 100644 index 000000000..859af3e55 Binary files /dev/null and b/kratos.gid/apps/DEM/images/material-relation-16.png differ diff --git a/kratos.gid/apps/DEM/images/material-relation.png b/kratos.gid/apps/DEM/images/material-relation.png new file mode 100644 index 000000000..fe736f449 Binary files /dev/null and b/kratos.gid/apps/DEM/images/material-relation.png differ diff --git a/kratos.gid/apps/CDEM/python/KratosDEMAnalysis.py b/kratos.gid/apps/DEM/python/MainKratos.py similarity index 56% rename from kratos.gid/apps/CDEM/python/KratosDEMAnalysis.py rename to kratos.gid/apps/DEM/python/MainKratos.py index 4f31eace5..81be65482 100644 --- a/kratos.gid/apps/CDEM/python/KratosDEMAnalysis.py +++ b/kratos.gid/apps/DEM/python/MainKratos.py @@ -1,21 +1,20 @@ -import KratosMultiphysics -from KratosMultiphysics.DEMApplication.DEM_analysis_stage import DEMAnalysisStage import time import sys -""" model = KratosMultiphysics.Model() -solution = Main.Solution(model) -solution.Run() """ + +import KratosMultiphysics +from KratosMultiphysics.DEMApplication.DEM_analysis_stage import DEMAnalysisStage +from KratosMultiphysics import Logger class DEMAnalysisStageWithFlush(DEMAnalysisStage): def __init__(self, model, project_parameters, flush_frequency=10.0): - super(DEMAnalysisStageWithFlush,self).__init__(model, project_parameters) + super(DEMAnalysisStageWithFlush, self).__init__(model, project_parameters) self.flush_frequency = flush_frequency self.last_flush = time.time() def FinalizeSolutionStep(self): - super(DEMAnalysisStageWithFlush,self).FinalizeSolutionStep() + super(DEMAnalysisStageWithFlush, self).FinalizeSolutionStep() if self.parallel_type == "OpenMP": now = time.time() @@ -24,10 +23,9 @@ def FinalizeSolutionStep(self): self.last_flush = now if __name__ == "__main__": - from KratosMultiphysics import Logger Logger.GetDefaultOutput().SetSeverity(Logger.Severity.INFO) - with open("ProjectParametersDEM.json",'r') as parameter_file: - project_parameters = KratosMultiphysics.Parameters(parameter_file.read()) + with open("ProjectParametersDEM.json", 'r') as parameter_file: + parameters = KratosMultiphysics.Parameters(parameter_file.read()) - model = KratosMultiphysics.Model() - DEMAnalysisStageWithFlush(model, project_parameters).Run() + global_model = KratosMultiphysics.Model() + DEMAnalysisStageWithFlush(global_model, parameters).Run() diff --git a/kratos.gid/apps/DEM/start.tcl b/kratos.gid/apps/DEM/start.tcl index 5b66a0d4f..223af9429 100644 --- a/kratos.gid/apps/DEM/start.tcl +++ b/kratos.gid/apps/DEM/start.tcl @@ -1,65 +1,33 @@ namespace eval ::DEM { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir - variable attributes - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::DEM::Init { } { +proc ::DEM::Init { app } { # Variable initialization + variable _app variable dir - variable attributes - variable kratos_name + set _app $app set dir [apps::getMyDir "DEM"] - set attributes [dict create] - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - dict set attributes UseIntervals 1 - - set kratos_name DEMApplication - - set ::Model::ValidSpatialDimensions [list 2D 3D] GiD_Set CalcWithoutMesh 1 - LoadMyFiles -} - -proc ::DEM::LoadMyFiles { } { - variable dir - - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeMDPA_Parts.tcl]] - uplevel #0 [list source [file join $dir write writeMDPA_Inlet.tcl]] - uplevel #0 [list source [file join $dir write writeMDPA_Walls.tcl]] - uplevel #0 [list source [file join $dir write writeMDPA_Clusters.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - uplevel #0 [list source [file join $dir write write_utils.tcl]] - uplevel #0 [list source [file join $dir examples examples.tcl]] -} - -proc ::DEM::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value + ::DEM::xml::Init + ::DEM::write::Init } proc ::DEM::CustomToolbarItems { } { variable dir - if {$::Model::SpatialDimension eq "3D"} { - Kratos::ToolbarAddItem "Example3D" [file join $dir images drop.png] [list -np- ::DEM::examples::SpheresDrop] [= "Example3D\nSpheres drop"] - } - if {$::Model::SpatialDimension eq "2D"} { - Kratos::ToolbarAddItem "Example2D" [file join $dir images drop.png] [list -np- ::DEM::examples::CirclesDrop] [= "Example2D\nCircles drop"] - } -} - -proc ::DEM::CustomMenus { } { - DEM::examples::UpdateMenus + + Kratos::ToolbarAddItem "MaterialRelations" "material-relation.png" [list -np- DEM::xml::ShowMaterialRelationWindow] [= "Material relations"] } proc ::DEM::BeforeMeshGeneration {elementsize} { @@ -166,6 +134,33 @@ proc ::DEM::AfterMeshGeneration { fail } { # } } +proc ::DEM::AfterSaveModel { filespd } { + + # GiD bug detected in versions prev to 15.0.1 + # Spheres disapear in groups after load. Fixing it by removing the limitation in the prj file. + # GiD Team -> @jginternationa and @escolano + # Fixed in any 15.1.X (developer) and 15.0.1 and later (official) + if {[GidUtils::VersionCmp "15.0.0"] <= 0} { + ::DEM::PatchMissingSpheresInGroup $filespd + } +} +proc ::DEM::PatchMissingSpheresInGroup {filespd} { + set prj_file [file join [file dirname $filespd] [file rootname $filespd].prj] + if {[file exists $prj_file]} { + dom parse [tDOM::xmlReadFile $prj_file] doc -::DEM::Init + set grlist [$doc getElementsByTagName group] + foreach group $grlist { + if {[$group hasAttribute allowed_element_types]} { + $group removeAttribute allowed_element_types + } + if {[$group hasAttribute allowed_types]} { + $group removeAttribute allowed_types + } + } + set fp [open $prj_file w] + puts $fp [$doc asXML] + close $fp + } +} diff --git a/kratos.gid/apps/DEM/write/write.tcl b/kratos.gid/apps/DEM/write/write.tcl index 2ad9f1657..26d7b63e5 100644 --- a/kratos.gid/apps/DEM/write/write.tcl +++ b/kratos.gid/apps/DEM/write/write.tcl @@ -1,27 +1,42 @@ -namespace eval DEM::write { +namespace eval ::DEM::write { + namespace path ::DEM + Kratos::AddNamespace [namespace current] + variable writeAttributes + variable partsProperties variable inletProperties + variable wallsProperties + variable phantomwallsProperties variable last_property_id variable delete_previous_mdpa variable restore_ov } -proc DEM::write::Init { } { +proc ::DEM::write::Init { } { variable writeAttributes set writeAttributes [dict create] SetAttribute validApps [list "DEM"] - SetAttribute writeCoordinatesByGroups 1 - SetAttribute properties_location mdpa - SetAttribute parts_un DEMParts - SetAttribute materials_un DEMMaterials - SetAttribute conditions_un DEMConditions - SetAttribute nodal_conditions_un DEMNodalConditions - SetAttribute materials_file "DEMMaterials.json" - SetAttribute main_script_file "KratosDEMAnalysis.py" + SetAttribute writeCoordinatesByGroups [::DEM::GetWriteProperty coordinates] + SetAttribute properties_location [::DEM::GetWriteProperty properties_location] + SetAttribute parts_un [::DEM::GetUniqueName parts] + SetAttribute materials_un [::DEM::GetUniqueName materials] + SetAttribute conditions_un [::DEM::GetUniqueName conditions] + SetAttribute nodal_conditions_un [::DEM::GetUniqueName nodal_conditions] + SetAttribute materials_file [::DEM::GetWriteProperty materials_file] + SetAttribute main_launch_file [::DEM::GetAttribute main_launch_file] + + variable partsProperties + set partsProperties [dict create] variable inletProperties set inletProperties [dict create] + variable wallsProperties + set wallsProperties [dict create] + + variable phantomwallsProperties + set phantomwallsProperties [dict create] + variable last_property_id set last_property_id 0 @@ -33,7 +48,7 @@ proc DEM::write::Init { } { } # MDPA Blocks -proc DEM::write::writeModelPartEvent { } { +proc ::DEM::write::writeModelPartEvent { } { # Validation set err [Validate] @@ -53,6 +68,7 @@ proc DEM::write::writeModelPartEvent { } { catch {file delete -force [file join [write::GetConfigurationAttribute dir] "[Kratos::GetModelName].mdpa"]} } + # MDPA Parts write::OpenFile "[Kratos::GetModelName]DEM.mdpa" WriteMDPAParts write::CloseFile @@ -67,61 +83,68 @@ proc DEM::write::writeModelPartEvent { } { WriteMDPAWalls write::CloseFile - # MDPA Walls + # MDPA Clusters write::OpenFile "[Kratos::GetModelName]DEM_Clusters.mdpa" WriteMDPAClusters write::CloseFile -} -proc DEM::write::writeCustomFilesEvent { } { - set orig_name [GetAttribute main_script_file] - write::CopyFileIntoModel [file join "python" $orig_name ] +} - write::RenameFileInModel $orig_name "MainKratos.py" +proc ::DEM::write::writeCustomFilesEvent { } { write::RenameFileInModel "ProjectParameters.json" "ProjectParametersDEM.json" + DEM::write::writeMaterialsFile + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] +} + +proc ::DEM::write::writeMaterialsFile {} { + # Materials + set materials [DEM::write::getDEMMaterialsDict] + write::OpenFile [GetAttribute materials_file] + write::WriteJSON $materials + write::CloseFile } # Attributes block -proc DEM::write::GetAttribute {att} { +proc ::DEM::write::GetAttribute {att} { variable writeAttributes return [dict get $writeAttributes $att] } -proc DEM::write::GetAttributes {} { +proc ::DEM::write::GetAttributes {} { variable writeAttributes return $writeAttributes } -proc DEM::write::SetAttribute {att val} { +proc ::DEM::write::SetAttribute {att val} { variable writeAttributes dict set writeAttributes $att $val } -proc DEM::write::AddAttribute {att val} { +proc ::DEM::write::AddAttribute {att val} { variable writeAttributes dict append writeAttributes $att $val] } -proc DEM::write::AddAttributes {configuration} { +proc ::DEM::write::AddAttributes {configuration} { variable writeAttributes set writeAttributes [dict merge $writeAttributes $configuration] } # MultiApp events -proc DEM::write::AddValidApps {appList} { +proc ::DEM::write::AddValidApps {appList} { AddAttribute validApps $appList } -proc DEM::write::SetCoordinatesByGroups {value} { +proc ::DEM::write::SetCoordinatesByGroups {value} { SetAttribute writeCoordinatesByGroups $value } -proc DEM::write::ApplyConfiguration { } { +proc ::DEM::write::ApplyConfiguration { } { variable writeAttributes write::SetConfigurationAttributes $writeAttributes } -proc DEM::write::Validate {} { +proc ::DEM::write::Validate {} { set err "" set root [customlib::GetBaseRoot] @@ -131,7 +154,24 @@ proc DEM::write::Validate {} { set err "Empty mesh detected (0 nodes present). A mesh is necessary to run the case." } + # Validation of Material relations + if {$err eq ""} { + set err [DEM::xml::MaterialRelationsValidation] + } + return $err } -DEM::write::Init \ No newline at end of file +proc ::DEM::write::FindPropertiesBySubmodelpart {props subid } { + + set result "" + if {$props eq ""} {W "Check materials in $subid"} + foreach prop [dict get $props properties] { + if { [dict get $prop model_part_name] eq $subid || [lindex [split [dict get $prop model_part_name] "."] end] eq $subid } { + set result $prop + } + } + + return $result +} + diff --git a/kratos.gid/apps/DEM/write/writeMDPA_Clusters.tcl b/kratos.gid/apps/DEM/write/writeMDPA_Clusters.tcl index 86e241d9f..2aacfb61b 100644 --- a/kratos.gid/apps/DEM/write/writeMDPA_Clusters.tcl +++ b/kratos.gid/apps/DEM/write/writeMDPA_Clusters.tcl @@ -1,4 +1,4 @@ -proc DEM::write::WriteMDPAClusters { } { +proc ::DEM::write::WriteMDPAClusters { } { } diff --git a/kratos.gid/apps/DEM/write/writeMDPA_Inlet.tcl b/kratos.gid/apps/DEM/write/writeMDPA_Inlet.tcl index a5ce34eb0..cef36c46f 100644 --- a/kratos.gid/apps/DEM/write/writeMDPA_Inlet.tcl +++ b/kratos.gid/apps/DEM/write/writeMDPA_Inlet.tcl @@ -1,42 +1,59 @@ -proc DEM::write::WriteMDPAInlet { } { +proc ::DEM::write::WriteMDPAInlet { } { # Headers write::writeModelPartData + # process materials + processInletMaterials + + # Properties section writeMaterialsInlet # Nodal coordinates (only for DEM Parts ) write::writeNodalCoordinatesOnGroups [GetInletGroups] # SubmodelParts - if {$::Model::SpatialDimension eq "2D"} { writeInletMeshes2D - } else {writeInletMeshes} + + writeInletMeshes #Copy cluster files (.clu) copyClusterFiles } -proc DEM::write::GetInletGroups { } { - set groups [list ] - +proc ::DEM::write::GetInletConditionName { } { set condition_name Inlet if {$::Model::SpatialDimension eq "2D"} { - set condition_name Inlet2D + set condition_name Inlet2D } - set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$condition_name'\]/group" + return $condition_name +} + +proc ::DEM::write::GetInletConditionXpath { } { + set condition_name [GetInletConditionName] + set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$condition_name'\]" + return $xp1 +} + +# That can be all or active / All by default +proc ::DEM::write::GetInletGroups { {that all}} { + set groups [list ] - foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { - set groupid [$group @n] - lappend groups [write::GetWriteGroupName $groupid] + foreach group [[customlib::GetBaseRoot] selectNodes [DEM::write::GetInletConditionXpath]/group] { + set groupid [$group @n] + if {$that eq "active"} { + set active_inlet [write::getValueByNodeChild $group SetActive] + if {[write::isBooleanFalse $active_inlet]} {continue} + } + lappend groups [write::GetWriteGroupName $groupid] } return $groups } -proc DEM::write::copyClusterFiles { } { +proc ::DEM::write::copyClusterFiles { } { set dir [write::GetConfigurationAttribute dir] set src_dir $::Kratos::kratos_private(Path) - set cluster_dir [file join $src_dir exec Kratos applications DEMApplication custom_elements custom_clusters] + set cluster_dir [file join $src_dir apps DEM clusters] set two_lists_of_clusters [GetUsedClusters ] set pre_built_clusters_list [lindex $two_lists_of_clusters 0] @@ -58,620 +75,352 @@ proc DEM::write::copyClusterFiles { } { } } -proc DEM::write::GetUsedClusters { } { +proc ::DEM::write::GetUsedClusters { } { variable inletProperties set clusters_list [list ] set custom_clusters_list [list] - foreach groupid [dict keys $inletProperties ] { - if {[dict get $inletProperties $groupid InletElementType] in [list "Cluster2D" "Cluster3D"]} { - set inlet_element_type [dict get $inletProperties $groupid ClusterType] - if { $inlet_element_type == "FromFile" } { - set cluster_full_path [dict get $inletProperties $groupid ClusterFilename] - lappend custom_clusters_list $cluster_full_path - } else { - lappend clusters_list $inlet_element_type + set condition_name [DEM::write::GetInletConditionName] + + foreach groupid [DEM::write::GetInletGroups] { + if {[write::getSubModelPartId $condition_name $groupid] ne 0} { + set mid [write::AddSubmodelpart $condition_name $groupid] + set props [DEM::write::FindPropertiesBySubmodelpart $inletProperties $mid] + if {[dict get $props Material Variables InletElementType] in [list "Cluster2D" "Cluster3D"]} { + set inlet_element_type [dict get $props Material Variables ClusterType] + if { $inlet_element_type == "FromFile" } { + set cluster_full_path [dict get $props Material Variables ClusterFilename] + lappend custom_clusters_list $cluster_full_path + } else { + lappend clusters_list $inlet_element_type + } } } } return [list $clusters_list $custom_clusters_list] } - -proc DEM::write::writeInletMeshes { } { - variable inletProperties - foreach groupid [dict keys $inletProperties ] { - set what nodal - if {![dict exists $::write::submodelparts [list Inlet ${groupid}]]} { - set mid [expr [llength [dict keys $::write::submodelparts]] +1] - set good_name [write::transformGroupName $groupid] - set mid "Inlet_${good_name}" - dict set ::write::submodelparts [list Inlet ${groupid}] $mid - set gdict [dict create] - set f "%10i\n" - set f [subst $f] - set group_real_name [write::GetWriteGroupName $groupid] - dict set gdict $group_real_name $f - write::WriteString "Begin SubModelPart $mid // Group $groupid // Subtree Inlet" - write::WriteString " Begin SubModelPartData" - write::WriteString " PROPERTIES_ID [dict get $inletProperties $groupid MID]" - - set is_active [dict get $inletProperties $groupid SetActive] - if {$is_active=="No"} { - continue - } - - if {[write::isBooleanTrue $is_active]} { - set motion_type [dict get $inletProperties $groupid InletMotionType] - set TableNumber 0 - set TableVelocityComponent 0 - if {$motion_type == "FromATable"} { - set TableNumber $mid - set TableVelocityComponent [dict get $inletProperties $groupid TableVelocityComponent] - } - if {$motion_type=="LinearPeriodic"} { - - # Linear velocity - set velocity [dict get $inletProperties $groupid VelocityModulus] - lassign [split [dict get $inletProperties $groupid DirectionVector] ","] velocity_X velocity_Y velocity_Z - lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z - lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y $velocity_Z] ] vx vy vz - write::WriteString " LINEAR_VELOCITY \[3\] ($vx, $vy, $vz)" - - # Period - set periodic [dict get $inletProperties $groupid LinearPeriodic] - if {[write::isBooleanTrue $periodic]} { - #set period [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearPeriod'\]"]] - set period [dict get $inletProperties $groupid LinearPeriod] - } else { - set period 0.0 - } - write::WriteString " VELOCITY_PERIOD $period" - - # Angular velocity - #set velocity [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularVelocityModulus'\]"]] - set velocity [dict get $inletProperties $groupid AngularVelocityModulus] - lassign [split [dict get $inletProperties $groupid AngularDirectionVector] ","] velocity_X velocity_Y velocity_Z - lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z - lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y $velocity_Z] ] wX wY wZ - write::WriteString " ANGULAR_VELOCITY \[3\] ($wX,$wY,$wZ)" - - - # Angular center of rotation - #lassign [write::getValueByNode [$group_node selectNodes "./value\[@n='CenterOfRotation'\]"]] oX oY oZ - lassign [split [dict get $inletProperties $groupid CenterOfRotation] ","] oX oY oZ - write::WriteString " ROTATION_CENTER \[3\] ($oX,$oY,$oZ)" - - # Angular Period - set angular_periodic [dict get $inletProperties $groupid AngularPeriodic] - if {[write::isBooleanTrue $angular_periodic]} { - set angular_period [dict get $inletProperties $groupid AngularPeriod] - } else { - set angular_period 0.0 - } - write::WriteString " ANGULAR_VELOCITY_PERIOD $angular_period" - - # # Interval - # set interval [write::getValueByNode [$group_node selectNodes "./value\[@n='Interval'\]"]] - # lassign [write::getInterval $interval] ini end - # if {![string is double $ini]} { - # set ini [write::getValue DEMTimeParameters StartTime] - # } - # # write::WriteString " ${cond}_START_TIME $ini" - # write::WriteString " VELOCITY_START_TIME $ini" - # write::WriteString " ANGULAR_VELOCITY_START_TIME $ini" - # if {![string is double $end]} { - # set end [write::getValue DEMTimeParameters EndTime] - # } - # # write::WriteString " ${cond}_STOP_TIME $end" - # write::WriteString " VELOCITY_STOP_TIME $end" - # write::WriteString " ANGULAR_VELOCITY_STOP_TIME $end" - - - set LinearStartTime [dict get $inletProperties $groupid LinearStartTime] - set LinearEndTime [dict get $inletProperties $groupid LinearEndTime] - set AngularStartTime [dict get $inletProperties $groupid AngularStartTime] - set AngularEndTime [dict get $inletProperties $groupid AngularEndTime] - set rigid_body_motion 1 - write::WriteString " VELOCITY_START_TIME $LinearStartTime" - write::WriteString " VELOCITY_STOP_TIME $LinearEndTime" - write::WriteString " ANGULAR_VELOCITY_START_TIME $AngularStartTime" - write::WriteString " ANGULAR_VELOCITY_STOP_TIME $AngularEndTime" - write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" - } else { - set rigid_body_motion 0 - write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" - write::WriteString " //TABLE_VELOCITY_COMPONENT $TableVelocityComponent" - } - - set contains_clusters 0 - set random_orientation 0 - - - DefineInletConditions $inletProperties $groupid $mid $contains_clusters - - set velocity_modulus [dict get $inletProperties $groupid InVelocityModulus] - lassign [split [dict get $inletProperties $groupid InDirectionVector] ","] velocity_X velocity_Y velocity_Z - #lassign [write::getValueByNode [dict get $inletProperties $groupid DirectionVector]] velocity_X velocity_Y velocity_Z - lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z - lassign [MathUtils::ScalarByVectorProd $velocity_modulus [list $velocity_X $velocity_Y $velocity_Z] ] vx vy vz - write::WriteString " VELOCITY \[3\] ($vx, $vy, $vz)" - - set max_deviation_angle [dict get $inletProperties $groupid VelocityDeviation] - write::WriteString " MAX_RAND_DEVIATION_ANGLE $max_deviation_angle" - - - if {[dict get $inletProperties $groupid InletElementType] eq "Cluster3D"} { - if {[dict get $inletProperties $groupid ClusterType] eq "SingleSphereCluster3D"} { - write::WriteString " EXCENTRICITY [dict get $inletProperties $groupid Excentricity]" - write::WriteString " EXCENTRICITY_PROBABILITY_DISTRIBUTION [dict get $inletProperties $groupid ProbabilityDistributionOfExcentricity]" - write::WriteString " EXCENTRICITY_STANDARD_DEVIATION [dict get $inletProperties $groupid StandardDeviationOfExcentricity]" - } - } - - set type_of_measurement [dict get $inletProperties $groupid TypeOfFlowMeasurement] - if {$type_of_measurement eq "Kilograms"} { - set mass_flow_option 1 - } else { - set mass_flow_option 0 - } - - if {$mass_flow_option == 0} { - set inlet_number_of_particles [dict get $inletProperties $groupid NumberOfParticles] - write::WriteString " INLET_NUMBER_OF_PARTICLES $inlet_number_of_particles" - } - - write::WriteString " IMPOSED_MASS_FLOW_OPTION $mass_flow_option" - - # search for tem id="InletLimitedVelocity" related to dense inlet in spreaddem - if {$mass_flow_option == 1} { - set inlet_mass_flow [dict get $inletProperties $groupid InletMassFlow] - write::WriteString " MASS_FLOW $inlet_mass_flow" - } - set inlet_start_time [dict get $inletProperties $groupid InletStartTime] - write::WriteString " INLET_START_TIME $inlet_start_time" - set inlet_stop_time [dict get $inletProperties $groupid InletStopTime] - write::WriteString " INLET_STOP_TIME $inlet_stop_time" - set particle_diameter [dict get $inletProperties $groupid ParticleDiameter] - write::WriteString " RADIUS [expr {0.5 * $particle_diameter}]" - set probability_distribution [dict get $inletProperties $groupid ProbabilityDistribution] - write::WriteString " PROBABILITY_DISTRIBUTION $probability_distribution" - set standard_deviation [dict get $inletProperties $groupid StandardDeviation] - write::WriteString " STANDARD_DEVIATION $standard_deviation" - - if {[dict get $inletProperties $groupid InletElementType] eq "Cluster3D"} { - if {[dict get $inletProperties $groupid RandomOrientation] == "Yes"} { - set random_orientation 1 - } else { - set random_orientation 0 - set orientation_x [dict get $inletProperties $groupid OrientationX] - set orientation_y [dict get $inletProperties $groupid OrientationY] - set orientation_z [dict get $inletProperties $groupid OrientationZ] - set orientation_w [dict get $inletProperties $groupid OrientationW] - write::WriteString " ORIENTATION \[4\] ($orientation_x, $orientation_y, $orientation_z, $orientation_w)" - } - write::WriteString " RANDOM_ORIENTATION $random_orientation" - } - - write::WriteString " End SubModelPartData" - # Write nodes - write::WriteString " Begin SubModelPartNodes" - GiD_WriteCalculationFile nodes -sorted $gdict - write::WriteString " End SubModelPartNodes" - write::WriteString " End SubModelPart" - write::WriteString " " - - } - } - - if {$motion_type=="NotReady-FromATable"} { - set properties_path "${basexpath}//c.[list ${cgroupid}]//c.MainProperties" - set filename [::xmlutils::setXml "${properties_path}//i.VelocitiesFilename" dv] - GiD_File fprintf $deminletchannel "Begin Table $TableNumber TIME VELOCITY" - set file_open [open [file native [file join [::KUtils::GetPaths "PDir"] $filename]] r] - set file_data [read $file_open] - close $file_open - GiD_File fprintf -nonewline $deminletchannel $file_data - GiD_File fprintf $deminletchannel "End Table" - GiD_File fprintf $deminletchannel "" - } - - write::WriteString " Begin Table 0 TIME VELOCITY" - write::WriteString " 0.0 0.0" - write::WriteString " 1.0 0.0" - write::WriteString " End Table" - write::WriteString " " - } -} - -proc DEM::write::DefineInletConditions {inletProperties groupid mid contains_clusters} { - set inlet_element_type SphericParticle3D - if {[dict get $inletProperties $groupid InletElementType] eq "Cluster3D"} { +proc ::DEM::write::DefineInletConditions {inletProperties mid contains_clusters} { + set inlet_element_type [DEM::write::GetInletElementType] + if {[dict get $inletProperties Material Variables InletElementType] eq "Cluster3D"} { set contains_clusters 1 - if {[dict get $inletProperties $groupid ClusterType] eq "FromFile"} { - set custom_file_name [dict get $inletProperties $groupid ClusterFilename] + if {[dict get $inletProperties Material Variables ClusterType] eq "FromFile"} { + set custom_file_name [dict get $inletProperties Material Variables ClusterFilename] set only_name [file tail $custom_file_name] write::WriteString " CLUSTER_FILE_NAME $only_name" } else { - set cluster_file_name [dict get $inletProperties $groupid ClusterType] + set cluster_file_name [dict get $inletProperties Material Variables ClusterType] lassign [GetClusterFileNameAndReplaceInletElementType $cluster_file_name] inlet_element_type cluster_file_name write::WriteString " CLUSTER_FILE_NAME $cluster_file_name" } } write::WriteString " IDENTIFIER $mid" - write::WriteString " INJECTOR_ELEMENT_TYPE SphericParticle3D" - write::WriteString " ELEMENT_TYPE [dict get $inletProperties $groupid InletElementType]" + write::WriteString " INJECTOR_ELEMENT_TYPE [DEM::write::GetInjectorElementType]" + write::WriteString " ELEMENT_TYPE $inlet_element_type" write::WriteString " CONTAINS_CLUSTERS $contains_clusters" - # Change to SphericSwimmingParticle3D in FLUIDDEM interface } -proc DEM::write::writeInletMeshes2D { } { - variable inletProperties - foreach groupid [dict keys $inletProperties ] { - set what nodal - if {![dict exists $::write::submodelparts [list Inlet ${groupid}]]} { - set mid [expr [llength [dict keys $::write::submodelparts]] +1] - set good_name [write::transformGroupName $groupid] - set mid "Inlet_${good_name}" - dict set ::write::submodelparts [list Inlet ${groupid}] $mid - set gdict [dict create] - set f "%10i\n" - set f [subst $f] - set group_real_name [write::GetWriteGroupName $groupid] - dict set gdict $group_real_name $f - write::WriteString "Begin SubModelPart $mid // Group $groupid // Subtree Inlet" - write::WriteString " Begin SubModelPartData" - write::WriteString " PROPERTIES_ID [dict get $inletProperties $groupid MID]" - - set is_active [dict get $inletProperties $groupid SetActive] - if {$is_active=="No"} { - continue - } - - if {[write::isBooleanTrue $is_active]} { - set motion_type [dict get $inletProperties $groupid InletMotionType] - set TableNumber 0 - set TableVelocityComponent 0 - if {$motion_type == "FromATable"} { - set TableNumber $mid - set TableVelocityComponent [dict get $inletProperties $groupid TableVelocityComponent] - } - if {$motion_type=="LinearPeriodic"} { - - # Linear velocity - set velocity [dict get $inletProperties $groupid VelocityModulus] - lassign [split [dict get $inletProperties $groupid DirectionVector] ","] velocity_X velocity_Y - lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y]] velocity_X velocity_Y - lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y] ] vx vy - write::WriteString " LINEAR_VELOCITY \[3\] ($vx, $vy, 0.0)" - - - # Period - set periodic [dict get $inletProperties $groupid LinearPeriodic] - if {[write::isBooleanTrue $periodic]} { - #set period [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearPeriod'\]"]] - set period [dict get $inletProperties $groupid LinearPeriod] - } else { - set period 0.0 - } - write::WriteString " VELOCITY_PERIOD $period" - - # Angular velocity - #set velocity [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularVelocityModulus'\]"]] - set avelocity [dict get $inletProperties $groupid AngularVelocityModulus] - write::WriteString " ANGULAR_VELOCITY \[3\] (0.0,0.0,$avelocity)" - - # Angular center of rotation - #lassign [write::getValueByNode [$group_node selectNodes "./value\[@n='CenterOfRotation'\]"]] oX oY oZ - lassign [split [dict get $inletProperties $groupid CenterOfRotation] ","] oX oY - write::WriteString " ROTATION_CENTER \[3\] ($oX,$oY,0.0)" - - # Angular Period - set angular_periodic [dict get $inletProperties $groupid AngularPeriodic] - if {[write::isBooleanTrue $angular_periodic]} { - set angular_period [dict get $inletProperties $groupid AngularPeriod] - } else { - set angular_period 0.0 - } - write::WriteString " ANGULAR_VELOCITY_PERIOD $angular_period" - - # # Interval - # set interval [write::getValueByNode [$group_node selectNodes "./value\[@n='Interval'\]"]] - # lassign [write::getInterval $interval] ini end - # if {![string is double $ini]} { - # set ini [write::getValue DEMTimeParameters StartTime] - # } - # # write::WriteString " ${cond}_START_TIME $ini" - # write::WriteString " VELOCITY_START_TIME $ini" - # write::WriteString " ANGULAR_VELOCITY_START_TIME $ini" - # if {![string is double $end]} { - # set end [write::getValue DEMTimeParameters EndTime] - # } - # # write::WriteString " ${cond}_STOP_TIME $end" - # write::WriteString " VELOCITY_STOP_TIME $end" - # write::WriteString " ANGULAR_VELOCITY_STOP_TIME $end" - - - set LinearStartTime [dict get $inletProperties $groupid LinearStartTime] - set LinearEndTime [dict get $inletProperties $groupid LinearEndTime] - set AngularStartTime [dict get $inletProperties $groupid AngularStartTime] - set AngularEndTime [dict get $inletProperties $groupid AngularEndTime] - set rigid_body_motion 1 - write::WriteString " VELOCITY_START_TIME $LinearStartTime" - write::WriteString " VELOCITY_STOP_TIME $LinearEndTime" - write::WriteString " ANGULAR_VELOCITY_START_TIME $AngularStartTime" - write::WriteString " ANGULAR_VELOCITY_STOP_TIME $AngularEndTime" - write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" - } else { - set rigid_body_motion 0 - write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" - write::WriteString " //TABLE_VELOCITY_COMPONENT $TableVelocityComponent" - } - - set contains_clusters 0 - set random_orientation 0 - - DefineInletConditions2D $inletProperties $groupid $mid $contains_clusters - - set velocity_modulus [dict get $inletProperties $groupid InVelocityModulus] - lassign [split [dict get $inletProperties $groupid InDirectionVector] ","] velocity_X velocity_Y - lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y]] velocity_X velocity_Y - lassign [MathUtils::ScalarByVectorProd $velocity_modulus [list $velocity_X $velocity_Y] ] vx vy - write::WriteString " VELOCITY \[3\] ($vx, $vy, 0.0)" - - set max_deviation_angle [dict get $inletProperties $groupid VelocityDeviation] - write::WriteString " MAX_RAND_DEVIATION_ANGLE $max_deviation_angle" - - set type_of_measurement [dict get $inletProperties $groupid TypeOfFlowMeasurement] - if {$type_of_measurement eq "Kilograms"} { - set mass_flow_option 1 - } else { - set mass_flow_option 0 - } - - if {$mass_flow_option == 0} { - set inlet_number_of_particles [dict get $inletProperties $groupid NumberOfParticles] - write::WriteString " INLET_NUMBER_OF_PARTICLES $inlet_number_of_particles" - } - - write::WriteString " IMPOSED_MASS_FLOW_OPTION $mass_flow_option" - - # search for tem id="InletLimitedVelocity" related to dense inlet in spreaddem - if {$mass_flow_option == 1} { - set inlet_mass_flow [dict get $inletProperties $groupid InletMassFlow] - write::WriteString " MASS_FLOW $inlet_mass_flow" - } - set inlet_start_time [dict get $inletProperties $groupid InletStartTime] - write::WriteString " INLET_START_TIME $inlet_start_time" - set inlet_stop_time [dict get $inletProperties $groupid InletStopTime] - write::WriteString " INLET_STOP_TIME $inlet_stop_time" - set particle_diameter [dict get $inletProperties $groupid ParticleDiameter] - write::WriteString " RADIUS [expr {0.5 * $particle_diameter}]" - set probability_distribution [dict get $inletProperties $groupid ProbabilityDistribution] - write::WriteString " PROBABILITY_DISTRIBUTION $probability_distribution" - set standard_deviation [dict get $inletProperties $groupid StandardDeviation] - write::WriteString " STANDARD_DEVIATION $standard_deviation" - - write::WriteString " End SubModelPartData" - # Write nodes - write::WriteString " Begin SubModelPartNodes" - GiD_WriteCalculationFile nodes -sorted $gdict - write::WriteString " End SubModelPartNodes" - write::WriteString " End SubModelPart" - write::WriteString " " - - } - } - - if {$motion_type=="NotReady-FromATable"} { - set properties_path "${basexpath}//c.[list ${cgroupid}]//c.MainProperties" - set filename [::xmlutils::setXml "${properties_path}//i.VelocitiesFilename" dv] - GiD_File fprintf $deminletchannel "Begin Table $TableNumber TIME VELOCITY" - set file_open [open [file native [file join [::KUtils::GetPaths "PDir"] $filename]] r] - set file_data [read $file_open] - close $file_open - GiD_File fprintf -nonewline $deminletchannel $file_data - GiD_File fprintf $deminletchannel "End Table" - GiD_File fprintf $deminletchannel "" - } - - write::WriteString " Begin Table 0 TIME VELOCITY" - write::WriteString " 0.0 0.0" - write::WriteString " 1.0 0.0" - write::WriteString " End Table" - write::WriteString " " +proc ::DEM::write::GetInletElementType {} { + set elem_name SphericParticle3D + if {$::Model::SpatialDimension eq "2D"} { + set elem_name CylinderParticle2D } + return $elem_name } +proc ::DEM::write::GetInjectorElementType {} { + return [DEM::write::GetInletElementType] +} -proc DEM::write::DefineInletConditions2D {inletProperties groupid mid contains_clusters} { +proc ::DEM::write::writeInletMeshes { } { + variable inletProperties - set inlet_element_type CylinderPartDEMElement2D - write::WriteString " IDENTIFIER $mid" - write::WriteString " INJECTOR_ELEMENT_TYPE [dict get $inletProperties $groupid InletElementType]" - write::WriteString " ELEMENT_TYPE [dict get $inletProperties $groupid InletElementType]" - write::WriteString " CONTAINS_CLUSTERS 0" - # Change to SphericSwimmingParticle3D in FLUIDDEM interface + set condition_name [DEM::write::GetInletConditionName] + + foreach groupid [DEM::write::GetInletGroups] { + set what nodal + if {[write::getSubModelPartId $condition_name $groupid] eq 0} { + set mid [write::AddSubmodelpart $condition_name $groupid] + set props [DEM::write::FindPropertiesBySubmodelpart $inletProperties $mid] + if {$props eq ""} {W "Error printing inlet $groupid"} + set is_active [dict get $props Material Variables SetActive] + if {[write::isBooleanFalse $is_active]} { + continue + } + + set group_real_name [write::GetWriteGroupName $groupid] + set gdict [dict create] + set f "%10i\n" + set f [subst $f] + dict set gdict $group_real_name $f + write::WriteString "Begin SubModelPart $mid // Group $groupid // Subtree Inlet" + write::WriteString " Begin SubModelPartData" + + + if {[write::isBooleanTrue $is_active]} { + set motion_type [dict get $props Material Variables InletMotionType] + set TableNumber 0 + set TableVelocityComponent 0 + if {$motion_type == "FromATable"} { + set TableNumber $mid + set TableVelocityComponent [dict get $props Material Variables TableVelocityComponent] + } + if {$motion_type=="LinearPeriodic"} { + + # Linear velocity + set velocity [dict get $props Material Variables VelocityModulus] + lassign [dict get $props Material Variables DirectionVector] velocity_X velocity_Y velocity_Z + if {$velocity_Z eq ""} {set velocity_Z 0.0} + lassign [MathUtils::VectorNormalized [list [string trim $velocity_X] [string trim $velocity_Y] [string trim $velocity_Z]]] velocity_X velocity_Y velocity_Z + lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y $velocity_Z] ] vx vy vz + write::WriteString " LINEAR_VELOCITY \[3\] ($vx, $vy, $vz)" + if {$::Model::SpatialDimension eq "2D"} { + if {$vz ne "0.0"} { + error "Invalid value for LINEAR_VELOCITY Z : $vz" + } + } + + # Period + set periodic [dict get $props Material Variables LinearPeriodic] + if {[write::isBooleanTrue $periodic]} { + set period [dict get $props Material Variables LinearPeriod] + } else { + set period 0.0 + } + write::WriteString " VELOCITY_PERIOD $period" + + # Angular velocity + set avelocity [dict get $props Material Variables AngularVelocityModulus] + set wX 0.0; set wY 0.0; set wZ $avelocity + if {$::Model::SpatialDimension ne "2D"} { + lassign [dict get $inletProperties $groupid Variables AngularDirectionVector] velocity_X velocity_Y velocity_Z + lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z + lassign [MathUtils::ScalarByVectorProd $avelocity [list $velocity_X $velocity_Y $velocity_Z] ] wX wY wZ + } + write::WriteString " ANGULAR_VELOCITY \[3\] ($wX,$wY,$wZ)" + + # Angular center of rotation + lassign [dict get $props Material Variables CenterOfRotation] oX oY oZ + if {$oZ eq ""} {set oZ 0.0} + write::WriteString " ROTATION_CENTER \[3\] ($oX,$oY,$oZ)" + + # Angular Period + set angular_periodic [dict get $props Material Variables AngularPeriodic] + if {[write::isBooleanTrue $angular_periodic]} { + set angular_period [dict get $props Material Variables AngularPeriod] + } else { + set angular_period 0.0 + } + write::WriteString " ANGULAR_VELOCITY_PERIOD $angular_period" + + set LinearStartTime [dict get $props Material Variables LinearStartTime] + set LinearEndTime [dict get $props Material Variables LinearEndTime] + set AngularStartTime [dict get $props Material Variables AngularStartTime] + set AngularEndTime [dict get $props Material Variables AngularEndTime] + set rigid_body_motion 1 + write::WriteString " VELOCITY_START_TIME $LinearStartTime" + write::WriteString " VELOCITY_STOP_TIME $LinearEndTime" + write::WriteString " ANGULAR_VELOCITY_START_TIME $AngularStartTime" + write::WriteString " ANGULAR_VELOCITY_STOP_TIME $AngularEndTime" + write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" + } else { + set rigid_body_motion 0 + write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" + write::WriteString " //TABLE_VELOCITY_COMPONENT $TableVelocityComponent" + } + + set contains_clusters 0 + set random_orientation 0 + + DefineInletConditions $props $mid $contains_clusters + + set velocity_modulus [dict get $props Material Variables InVelocityModulus] + lassign [dict get $props Material Variables InDirectionVector] velocity_X velocity_Y velocity_Z + if {$velocity_Z eq ""} {set velocity_Z 0.0} + lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z + lassign [MathUtils::ScalarByVectorProd $velocity_modulus [list $velocity_X $velocity_Y $velocity_Z] ] vx vy vz + write::WriteString " VELOCITY \[3\] ($vx, $vy, $vz)" + + set max_deviation_angle [dict get $props Material Variables VelocityDeviation] + write::WriteString " MAX_RAND_DEVIATION_ANGLE $max_deviation_angle" + + set type_of_measurement [dict get $props Material Variables TypeOfFlowMeasurement] + if {$type_of_measurement eq "Kilograms"} { + set mass_flow_option 1 + } else { + set mass_flow_option 0 + } + + if {$mass_flow_option == 0} { + set inlet_number_of_particles [dict get $props Material Variables NumberOfParticles] + write::WriteString " INLET_NUMBER_OF_PARTICLES $inlet_number_of_particles" + } + + write::WriteString " IMPOSED_MASS_FLOW_OPTION $mass_flow_option" + + # search for tem id="InletLimitedVelocity" related to dense inlet in spreaddem + if {$mass_flow_option == 1} { + set inlet_mass_flow [dict get $props Material Variables InletMassFlow] + write::WriteString " MASS_FLOW $inlet_mass_flow" + } + + set inlet_start_time [dict get $props Material Variables InletStartTime] + write::WriteString " INLET_START_TIME $inlet_start_time" + set inlet_stop_time [dict get $props Material Variables InletStopTime] + write::WriteString " INLET_STOP_TIME $inlet_stop_time" + set particle_diameter [dict get $props Material Variables ParticleDiameter] + write::WriteString " RADIUS [expr {0.5 * $particle_diameter}]" + set probability_distribution [dict get $props Material Variables ProbabilityDistribution] + write::WriteString " PROBABILITY_DISTRIBUTION $probability_distribution" + set standard_deviation [dict get $props Material Variables StandardDeviation] + write::WriteString " STANDARD_DEVIATION $standard_deviation" + + if {[dict get $props Material Variables InletElementType] eq "Cluster3D"} { + if {[dict get $props Material Variables ClusterType] eq "SingleSphereCluster3D"} { + write::WriteString " EXCENTRICITY [dict get $props Material Variables Excentricity]" + write::WriteString " EXCENTRICITY_PROBABILITY_DISTRIBUTION [dict get $props Material Variables ProbabilityDistributionOfExcentricity]" + write::WriteString " EXCENTRICITY_STANDARD_DEVIATION [dict get $props Material Variables StandardDeviationOfExcentricity]" + } + } + + if {[dict get $props Material Variables InletElementType] eq "Cluster3D"} { + if {[dict get $props Material Variables RandomOrientation] == "Yes"} { + set random_orientation 1 + } else { + set random_orientation 0 + set orientation_x [dict get $props Material Variables OrientationX] + set orientation_y [dict get $props Material Variables OrientationY] + set orientation_z [dict get $props Material Variables OrientationZ] + set orientation_w [dict get $props Material Variables OrientationW] + write::WriteString " ORIENTATION \[4\] ($orientation_x, $orientation_y, $orientation_z, $orientation_w)" + } + write::WriteString " RANDOM_ORIENTATION $random_orientation" + } + + write::WriteString " End SubModelPartData" + # Write nodes + write::WriteString " Begin SubModelPartNodes" + GiD_WriteCalculationFile nodes -sorted $gdict + write::WriteString " End SubModelPartNodes" + write::WriteString " End SubModelPart" + write::WriteString " " + + } + } + + if {$motion_type=="NotReady-FromATable"} { + set properties_path "${basexpath}//c.[list ${cgroupid}]//c.MainProperties" + set filename [::xmlutils::setXml "${properties_path}//i.VelocitiesFilename" dv] + GiD_File fprintf $deminletchannel "Begin Table $TableNumber TIME VELOCITY" + set file_open [open [file native [file join [::KUtils::GetPaths "PDir"] $filename]] r] + set file_data [read $file_open] + close $file_open + GiD_File fprintf -nonewline $deminletchannel $file_data + GiD_File fprintf $deminletchannel "End Table" + GiD_File fprintf $deminletchannel "" + } + + write::WriteString " Begin Table 0 TIME VELOCITY" + write::WriteString " 0.0 0.0" + write::WriteString " 1.0 0.0" + write::WriteString " End Table" + write::WriteString " " + } } -proc DEM::write::GetClusterFileNameAndReplaceInletElementType {inlet_element_type} { +proc ::DEM::write::GetClusterFileNameAndReplaceInletElementType {inlet_element_type} { if {$inlet_element_type eq "LineCluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "linecluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "linecluster3D.clu" } elseif {$inlet_element_type eq "RingCluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ringcluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ringcluster3D.clu" } elseif {$inlet_element_type eq "Wheat5Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "wheat5cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "wheat5cluster3D.clu" } elseif {$inlet_element_type eq "SoyBeanCluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "soybeancluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "soybeancluster3D.clu" } elseif {$inlet_element_type eq "CornKernel3Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "corn3cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "corn3cluster3D.clu" } elseif {$inlet_element_type eq "CornKernelCluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "cornkernelcluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "cornkernelcluster3D.clu" } elseif {$inlet_element_type eq "Rock1Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "rock1cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "rock1cluster3D.clu" } elseif {$inlet_element_type eq "Rock2Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "rock2cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "rock2cluster3D.clu" } elseif {$inlet_element_type eq "Ballast1Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast1cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast1cluster3D.clu" } elseif {$inlet_element_type eq "Ballast1Cluster3Dred"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast1cluster3Dred.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast1cluster3Dred.clu" } elseif {$inlet_element_type eq "Ballast2Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast2cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast2cluster3D.clu" } elseif {$inlet_element_type eq "Ballast2Cluster3Dred"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast2cluster3Dred.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast2cluster3Dred.clu" } elseif {$inlet_element_type eq "Ballast3Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast3cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast3cluster3D.clu" } elseif {$inlet_element_type eq "Ballast3Cluster3Dred"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast3cluster3Dred.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast3cluster3Dred.clu" } elseif {$inlet_element_type eq "Ballast4Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast4cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast4cluster3D.clu" } elseif {$inlet_element_type eq "Ballast4Cluster3Dred"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast4cluster3Dred.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast4cluster3Dred.clu" } elseif {$inlet_element_type eq "Ballast5Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast5cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast5cluster3D.clu" } elseif {$inlet_element_type eq "Ballast5Cluster3Dred"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast5cluster3Dred.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast5cluster3Dred.clu" } elseif {$inlet_element_type eq "Ballast6Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast6cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast6cluster3D.clu" } elseif {$inlet_element_type eq "Ballast6Cluster3Dred"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "ballast6cluster3Dred.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "ballast6cluster3Dred.clu" } elseif {$inlet_element_type eq "SoyBean3Cluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "soybean3cluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "soybean3cluster3D.clu" } elseif {$inlet_element_type eq "CapsuleCluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "capsulecluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "capsulecluster3D.clu" } elseif {$inlet_element_type eq "SingleSphereCluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "singlespherecluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "singlespherecluster3D.clu" } elseif {$inlet_element_type eq "Rock3RefinedCluster3D"} { - set inlet_element_type "Cluster3D" - set cluster_file_name "rock3refinedcluster3D.clu" + set inlet_element_type "Cluster3D" + set cluster_file_name "rock3refinedcluster3D.clu" } else { - error "No cluster found" + error "No cluster found" } return [list $inlet_element_type $cluster_file_name] } +proc ::DEM::write::writeMaterialsInlet { } { + write::WriteString "Begin Properties 0" + write::WriteString "End Properties" + write::WriteString "" -proc DEM::write::writeInletMeshes-old { } { - variable inletProperties - foreach groupid [dict keys $inletProperties ] { - set what nodal - if {![dict exists $::write::submodelparts [list Inlet ${groupid}]]} { - set mid [expr [llength [dict keys $::write::submodelparts]] +1] - set good_name [write::transformGroupName $groupid] - set mid "Inlet_${good_name}" - dict set ::write::submodelparts [list Inlet ${groupid}] $mid - set gdict [dict create] - set f "%10i\n" - set f [subst $f] - set group_real_name [write::GetWriteGroupName $groupid] - dict set gdict $group_real_name $f - write::WriteString "Begin SubModelPart $mid // Group $groupid // Subtree Inlet" - write::WriteString " Begin SubModelPartData" - write::WriteString " PROPERTIES_ID [dict get $inletProperties $groupid MID]" - write::WriteString " RIGID_BODY_MOTION 0" - write::WriteString " IDENTIFIER $mid" - write::WriteString " INJECTOR_ELEMENT_TYPE [dict get $inletProperties $groupid InletElementType]" - write::WriteString " ELEMENT_TYPE [dict get $inletProperties $groupid InletElementType]" - write::WriteString " CONTAINS_CLUSTERS 0" - set velocity [dict get $inletProperties $groupid VELOCITY_MODULUS] - lassign [split [dict get $inletProperties $groupid DIRECTION_VECTOR] ","] velocity_X velocity_Y velocity_Z - lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z - lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y $velocity_Z] ] vx vy vz - write::WriteString " VELOCITY \[3\] ($vx, $vy, $vz)" - write::WriteString " MAX_RAND_DEVIATION_ANGLE [dict get $inletProperties $groupid MAX_RAND_DEVIATION_ANGLE]" - set type_of_measurement [dict get $inletProperties $groupid FLOW_MEASUREMENT] - if {$type_of_measurement eq "Kilograms"} { - set number_of_particles 200.0 - set mass_flow_option 1 - set mass_flow [dict get $inletProperties $groupid INLET_NUMBER_OF_KILOGRAMS] - } else { - set number_of_particles [dict get $inletProperties $groupid INLET_NUMBER_OF_PARTICLES] - set mass_flow_option 0 - set mass_flow 0.5 - write::WriteString " INLET_NUMBER_OF_PARTICLES $number_of_particles" - } - write::WriteString " IMPOSED_MASS_FLOW_OPTION $mass_flow_option" - write::WriteString " MASS_FLOW $mass_flow" - set interval [dict get $inletProperties $groupid Interval] - lassign [write::getInterval $interval] ini end - write::WriteString " INLET_START_TIME $ini" - if {$end in [list "End" "end"]} {set end [write::getValue DEMTimeParameters EndTime]} - write::WriteString " INLET_STOP_TIME $end" - set diameter [dict get $inletProperties $groupid DIAMETER] - write::WriteString " RADIUS [expr $diameter / 2]" - write::WriteString " PROBABILITY_DISTRIBUTION [dict get $inletProperties $groupid PROBABILITY_DISTRIBUTION]" - write::WriteString " STANDARD_DEVIATION [dict get $inletProperties $groupid STANDARD_DEVIATION]" - write::WriteString " RANDOM_ORIENTATION 1" - write::WriteString " ORIENTATION \[4\] (0.0, 0.0, 0.0, 1.0)" - - write::WriteString " End SubModelPartData" - write::WriteString " Begin SubModelPartNodes" - GiD_WriteCalculationFile nodes -sorted $gdict - write::WriteString " End SubModelPartNodes" - write::WriteString "End SubModelPart" - } - } } -proc DEM::write::writeMaterialsInlet { } { +proc ::DEM::write::processInletMaterials { } { variable inletProperties - variable last_property_id - if {$::Model::SpatialDimension eq "2D"} {set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'Inlet2D'\]/group" - } else { set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'Inlet'\]/group" - } - set old_mat_dict $::write::mat_dict - set ::write::mat_dict [dict create] - write::processMaterials $xp1 $DEM::write::last_property_id - set DEM::write::last_property_id [expr $last_property_id + [dict size $::write::mat_dict]] - set inletProperties $::write::mat_dict - set ::write::mat_dict $old_mat_dict - - set printable [list PARTICLE_DENSITY YOUNG_MODULUS POISSON_RATIO FRICTION PARTICLE_COHESION COEFFICIENT_OF_RESTITUTION PARTICLE_MATERIAL ROLLING_FRICTION ROLLING_FRICTION_WITH_WALLS PARTICLE_SPHERICITY DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME DEM_CONTINUUM_CONSTITUTIVE_LAW_NAME] - - foreach group [dict keys $inletProperties] { - write::WriteString "Begin Properties [dict get $inletProperties $group MID] // Inlet group: [write::GetWriteGroupName $group]" - if {$::Model::SpatialDimension eq "2D"} {set DEM_D_law "DEM_D_Hertz_viscous_Coulomb2D" - } else { set DEM_D_law "DEM_D_Hertz_viscous_Coulomb" - } - - dict set inletProperties $group DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME $DEM_D_law - dict set inletProperties $group DEM_CONTINUUM_CONSTITUTIVE_LAW_NAME DEMContinuumConstitutiveLaw - foreach {prop val} [dict get $inletProperties $group] { - if {$prop in $printable} { - if {$prop eq "FRICTION"} { - set propvalue [expr {tan($val)}] - write::WriteString " FRICTION $propvalue" - } else { - write::WriteString " $prop $val" - } - } - } - write::WriteString "End Properties\n" - } + set inlet_xpath [DEM::write::GetInletConditionXpath] + write::processMaterials $inlet_xpath/group + set inletProperties [write::getPropertiesListByConditionXPath $inlet_xpath 0 DEMInletPart] + } \ No newline at end of file diff --git a/kratos.gid/apps/DEM/write/writeMDPA_Parts.tcl b/kratos.gid/apps/DEM/write/writeMDPA_Parts.tcl index 6579fcfd6..f4229fd40 100644 --- a/kratos.gid/apps/DEM/write/writeMDPA_Parts.tcl +++ b/kratos.gid/apps/DEM/write/writeMDPA_Parts.tcl @@ -1,82 +1,42 @@ -proc DEM::write::WriteMDPAParts { } { - variable last_property_id - # Prepare properties - write::processMaterials "" $last_property_id - set last_property_id [expr $last_property_id + [dict size $::write::mat_dict]] +proc ::DEM::write::WriteMDPAParts { } { # Headers write::writeModelPartData - - # Materials + + # Process properties + DEM::write::processPartMaterials + + # Write Materials writeMaterialsParts - + # Nodal coordinates (only for DEM Parts ) - write::writeNodalCoordinatesOnParts - write::writeNodalCoordinatesOnGroups [DEM::write::GetDEMGroupNamesCustomSubmodelpart] - write::writeNodalCoordinatesOnGroups [GetDEMGroupsInitialC] - write::writeNodalCoordinatesOnGroups [GetDEMGroupsBoundayC] - write::writeNodalCoordinatesOnGroups [GetNodesForGraphs] - - # Element connectivities (Groups on STParts) + WriteNodalCoordinatesParts + + # Element connectivities (Groups on Parts) PrepareCustomMeshedParts write::writeElementConnectivities RestoreCustomMeshedParts - + # Element radius writeSphereRadius - + # SubmodelParts write::writePartSubModelPart - writeDEMConditionMeshes - + # CustomSubmodelParts - WriteCustomDEMSmp; + WriteCustomDEMSmp } - - - -# TODO: Simulations do not run with this. Bad mdpa -proc DEM::write::WriteCustomDEMSmp-simulation_does_not_run { } { - foreach group [GetDEMGroupsCustomSubmodelpart] { - set groupid [write::GetWriteGroupName [$group @n]] - - # TODO: Missing write properties for Custom Submodelparts - - # Nodes are previously printed - # Print elements and connectivities - set elem [write::getValueByNode [$group selectNodes ".//value\[@n='Element']"] ] - write::writeGroupElementConnectivities $group $elem - - DEM::write::writeSphereRadiusOnGroup $group - - write::writeGroupSubModelPart DEM-CustomSmp $groupid Elements - } +proc ::DEM::write::WriteNodalCoordinatesParts { } { + write::writeNodalCoordinatesOnParts + write::writeNodalCoordinatesOnGroups [DEM::write::GetDEMGroupNamesCustomSubmodelpart] + write::writeNodalCoordinatesOnGroups [GetDEMGroupsInitialC] + write::writeNodalCoordinatesOnGroups [GetDEMGroupsBoundaryC] + write::writeNodalCoordinatesOnGroups [GetNodesForGraphs] } - -proc DEM::write::WriteCustomDEMSmp { } { - set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-CustomSmp'\]/group" - foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { - set group_id [$group @n] - set group_raw [write::GetWriteGroupName $group_id] - set good_name [write::transformGroupName $group_raw] - set destination_mdpa [write::getValueByNode [$group selectNodes "./value\[@n='WhatMdpa'\]"]] - if {$destination_mdpa == "DEM"} { - write::WriteString "Begin SubModelPart $good_name \/\/ Custom SubModelPart. Group name: $group_id" - write::WriteString "Begin SubModelPartData" - write::WriteString "End SubModelPartData" - write::WriteString "Begin SubModelPartNodes" - GiD_WriteCalculationFile nodes -sorted [dict create [write::GetWriteGroupName $group_id] [subst "%10i\n"]] - write::WriteString "End SubModelPartNodes" - write::WriteString "End SubModelPart" - write::WriteString "" - } - } -} - -proc DEM::write::GetDEMGroupNamesCustomSubmodelpart { } { +proc ::DEM::write::GetDEMGroupNamesCustomSubmodelpart { } { set groups [list ] foreach group [DEM::write::GetDEMGroupsCustomSubmodelpart] { set groupid [$group @n] @@ -84,7 +44,7 @@ proc DEM::write::GetDEMGroupNamesCustomSubmodelpart { } { } return $groups } -proc DEM::write::GetDEMGroupsCustomSubmodelpart { } { +proc ::DEM::write::GetDEMGroupsCustomSubmodelpart { } { set groups [list ] set xp2 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-CustomSmp'\]/group" foreach group [[customlib::GetBaseRoot] selectNodes $xp2] { @@ -96,10 +56,13 @@ proc DEM::write::GetDEMGroupsCustomSubmodelpart { } { return $groups } -proc DEM::write::GetDEMGroupsInitialC { } { +proc ::DEM::write::GetDEMGroupsInitialC { } { set groups [list ] - if {$::Model::SpatialDimension eq "2D"} { set xp3 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityIC2D'\]/group" - } else {set xp3 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityIC'\]/group"} + if {$::Model::SpatialDimension eq "2D"} { + set xp3 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityIC2D'\]/group" + } else { + set xp3 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityIC'\]/group" + } foreach group [[customlib::GetBaseRoot] selectNodes $xp3] { set groupid [$group @n] lappend groups [write::GetWriteGroupName $groupid] @@ -107,10 +70,13 @@ proc DEM::write::GetDEMGroupsInitialC { } { return $groups } -proc DEM::write::GetDEMGroupsBoundayC { } { +proc ::DEM::write::GetDEMGroupsBoundaryC { } { set groups [list ] - if {$::Model::SpatialDimension eq "2D"} { set xp4 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityBC2D'\]/group" - } else {set xp4 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityBC'\]/group"} + if {$::Model::SpatialDimension eq "2D"} { + set xp4 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityBC2D'\]/group" + } else { + set xp4 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityBC'\]/group" + } foreach group [[customlib::GetBaseRoot] selectNodes $xp4] { set groupid [$group @n] lappend groups [write::GetWriteGroupName $groupid] @@ -118,10 +84,13 @@ proc DEM::write::GetDEMGroupsBoundayC { } { return $groups } -proc DEM::write::GetNodesForGraphs { } { +proc ::DEM::write::GetNodesForGraphs { } { set groups [list ] - if {$::Model::SpatialDimension eq "2D"} { set xp5 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-GraphCondition2D'\]/group" - } else {set xp5 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-GraphCondition'\]/group"} + if {$::Model::SpatialDimension eq "2D"} { + set xp5 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-GraphCondition2D'\]/group" + } else { + set xp5 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-GraphCondition'\]/group" + } foreach group [[customlib::GetBaseRoot] selectNodes $xp5] { set groupid [$group @n] lappend groups [write::GetWriteGroupName $groupid] @@ -129,7 +98,7 @@ proc DEM::write::GetNodesForGraphs { } { return $groups } -proc DEM::write::writeSphereRadius { } { +proc ::DEM::write::writeSphereRadius { } { set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/group" foreach group [$root selectNodes $xp1] { @@ -137,7 +106,7 @@ proc DEM::write::writeSphereRadius { } { } } -proc DEM::write::writeSphereRadiusOnGroup { group } { +proc ::DEM::write::writeSphereRadiusOnGroup { group } { set groupid [$group @n] set print_groupid [write::GetWriteGroupName $groupid] write::WriteString "Begin NodalData RADIUS // GUI group identifier: $print_groupid" @@ -146,24 +115,23 @@ proc DEM::write::writeSphereRadiusOnGroup { group } { write::WriteString "" } -proc DEM::write::writeDEMConditionMeshes { } { - set i 0 +proc ::DEM::write::writeDEMConditionMeshes { } { foreach {cond group_list} [GetSpheresGroupsListInConditions] { - if {$cond eq "DEM-VelocityBC" || $cond eq "DEM-VelocityBC2D"} { + if {$cond in {"DEM-VelocityBC" "DEM-VelocityBC2D"}} { #set cnd [Model::getCondition $cond] foreach group $group_list { - incr i - write::WriteString "Begin SubModelPart $i // GUI DEM-VelocityBC - $cond - group identifier: $group" + set mid [write::AddSubmodelpart $cond $group] + write::WriteString "Begin SubModelPart $mid // GUI DEM-VelocityBC - $cond - group identifier: $group" write::WriteString " Begin SubModelPartData // DEM-VelocityBC. Group name: $group" set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$cond'\]/group\[@n = '$group'\]" set group_node [[customlib::GetBaseRoot] selectNodes $xp1] - + set prescribeMotion_flag [write::getValueByNode [$group_node selectNodes "./value\[@n='PrescribeMotion_flag'\]"]] if {[write::isBooleanTrue $prescribeMotion_flag]} { - + set motion_type [write::getValueByNode [$group_node selectNodes "./value\[@n='DEM-VelocityBCMotion'\]"]] if {$motion_type == "LinearPeriodic"} { - + # Linear velocity set velocity [write::getValueByNode [$group_node selectNodes "./value\[@n='VelocityModulus'\]"]] lassign [write::getValueByNode [$group_node selectNodes "./value\[@n='DirectionVector'\]"]] velocity_X velocity_Y velocity_Z @@ -175,14 +143,14 @@ proc DEM::write::writeDEMConditionMeshes { } { lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y $velocity_Z] ] vx vy vz write::WriteString " LINEAR_VELOCITY \[3\] ($vx, $vy, $vz)"} - + # Period set periodic [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearPeriodic'\]"]] if {[write::isBooleanTrue $periodic]} { set period [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearPeriod'\]"]] } else {set period 0.0} write::WriteString " VELOCITY_PERIOD $period" - + # Angular velocity set avelocity [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularVelocityModulus'\]"]] if {$::Model::SpatialDimension eq "2D"} {write::WriteString " ANGULAR_VELOCITY \[3\] (0.0,0.0,$avelocity)" @@ -191,12 +159,12 @@ proc DEM::write::writeDEMConditionMeshes { } { lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z lassign [MathUtils::ScalarByVectorProd $avelocity [list $velocity_X $velocity_Y $velocity_Z] ] wX wY wZ write::WriteString " ANGULAR_VELOCITY \[3\] ($wX,$wY,$wZ)"} - + # Angular center of rotation lassign [write::getValueByNode [$group_node selectNodes "./value\[@n='CenterOfRotation'\]"]] oX oY oZ if {$::Model::SpatialDimension eq "2D"} {write::WriteString " ROTATION_CENTER \[3\] ($oX,$oY,0.0)" } else {write::WriteString " ROTATION_CENTER \[3\] ($oX,$oY,$oZ)"} - + # Angular Period set angular_periodic [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularPeriodic'\]"]] if {[write::isBooleanTrue $angular_periodic]} { @@ -205,7 +173,7 @@ proc DEM::write::writeDEMConditionMeshes { } { set angular_period 0.0 } write::WriteString " ANGULAR_VELOCITY_PERIOD $angular_period" - + set LinearStartTime [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearStartTime'\]"]] set LinearEndTime [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearEndTime'\]"]] set AngularStartTime [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularStartTime'\]"]] @@ -216,29 +184,10 @@ proc DEM::write::writeDEMConditionMeshes { } { write::WriteString " ANGULAR_VELOCITY_START_TIME $AngularStartTime" write::WriteString " ANGULAR_VELOCITY_STOP_TIME $AngularEndTime" write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" - - - # # Interval - # set interval [write::getValueByNode [$group_node selectNodes "./value\[@n='Interval'\]"]] - # lassign [write::getInterval $interval] ini end - # if {![string is double $ini]} { - # set ini [write::getValue DEMTimeParameters StartTime] - # } - # # write::WriteString " ${cond}_START_TIME $ini" - # write::WriteString " VELOCITY_START_TIME $ini" - # write::WriteString " ANGULAR_VELOCITY_START_TIME $ini" - # if {![string is double $end]} { - # set end [write::getValue DEMTimeParameters EndTime] - # } - # # write::WriteString " ${cond}_STOP_TIME $end" - # write::WriteString " VELOCITY_STOP_TIME $end" - # write::WriteString " ANGULAR_VELOCITY_STOP_TIME $end" - - - + } elseif {$motion_type == "FixedDOFs"} { set rigid_body_motion 0 - + # DOFS set Ax [write::getValueByNode [$group_node selectNodes "./value\[@n='Ax'\]"]] set Ay [write::getValueByNode [$group_node selectNodes "./value\[@n='Ay'\]"]] @@ -275,11 +224,10 @@ proc DEM::write::writeDEMConditionMeshes { } { write::WriteString " VELOCITY_START_TIME $VStart" write::WriteString " VELOCITY_STOP_TIME $VEnd" write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" - + } - } - + DefineDEMExtraConditions $group_node $group write::WriteString " End SubModelPartData" write::WriteString " Begin SubModelPartNodes" @@ -288,19 +236,19 @@ proc DEM::write::writeDEMConditionMeshes { } { write::WriteString "End SubModelPart" write::WriteString "" } - } elseif {$cond eq "DEM-VelocityIC" || $cond eq "DEM-VelocityIC2D"} { + } elseif {$cond in {"DEM-VelocityIC" "DEM-VelocityIC2D"}} { set rigid_body_motion 0 #set cnd [Model::getCondition $cond] foreach group $group_list { - incr i - write::WriteString "Begin SubModelPart $i // GUI DEM-VelocityIC - $cond - group identifier: $group" + set mid [write::AddSubmodelpart $cond $group] + write::WriteString "Begin SubModelPart $mid // GUI DEM-VelocityIC - $cond - group identifier: $group" write::WriteString " Begin SubModelPartData // DEM-VelocityIC. Group name: $group" set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$cond'\]/group\[@n = '$group'\]" set group_node [[customlib::GetBaseRoot] selectNodes $xp1] - + set prescribeMotion_flag [write::getValueByNode [$group_node selectNodes "./value\[@n='PrescribeMotion_flag'\]"]] if {[write::isBooleanTrue $prescribeMotion_flag]} { - + # Linear velocity set velocity [write::getValueByNode [$group_node selectNodes "./value\[@n='InitialVelocityModulus'\]"]] lassign [write::getValueByNode [$group_node selectNodes "./value\[@n='iDirectionVector'\]"]] velocity_X velocity_Y velocity_Z @@ -317,7 +265,7 @@ proc DEM::write::writeDEMConditionMeshes { } { write::WriteString " INITIAL_VELOCITY_X_VALUE $vx" write::WriteString " INITIAL_VELOCITY_Y_VALUE $vy" write::WriteString " INITIAL_VELOCITY_Z_VALUE $vz"} - + # Angular velocity set avelocity [write::getValueByNode [$group_node selectNodes "./value\[@n='InitialAngularVelocityModulus'\]"]] if {$::Model::SpatialDimension eq "2D"} { @@ -335,7 +283,7 @@ proc DEM::write::writeDEMConditionMeshes { } { #Hardcoded write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" DefineDEMExtraConditions $group_node $group - + write::WriteString " End SubModelPartData" write::WriteString " Begin SubModelPartNodes" GiD_WriteCalculationFile nodes -sorted [dict create [write::GetWriteGroupName $group] [subst "%10i\n"]] @@ -343,16 +291,17 @@ proc DEM::write::writeDEMConditionMeshes { } { write::WriteString "End SubModelPart" write::WriteString "" } - } elseif {$cond eq "DEM-GraphCondition" || $cond eq "DEM-GraphCondition2D"} { + } elseif {$cond in {"DEM-GraphCondition" "DEM-GraphCondition2D"}} { foreach group $group_list { - incr i - write::WriteString "Begin SubModelPart $i // GUI DEM-GraphCondition - $cond - group identifier: $group" + + set mid [write::AddSubmodelpart $cond $group] + write::WriteString "Begin SubModelPart $mid // GUI DEM-GraphCondition - $cond - group identifier: $group" write::WriteString " Begin SubModelPartData // DEM-GraphCondition. Group name: $group" set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$cond'\]/group\[@n = '$group'\]" set group_node [[customlib::GetBaseRoot] selectNodes $xp1] - + DefineDEMExtraConditions $group_node $group - + write::WriteString " End SubModelPartData" write::WriteString " Begin SubModelPartNodes" GiD_WriteCalculationFile nodes -sorted [dict create [write::GetWriteGroupName $group] [subst "%10i\n"]] @@ -364,7 +313,7 @@ proc DEM::write::writeDEMConditionMeshes { } { } } -proc DEM::write::DefineDEMExtraConditions {group_node group} { +proc ::DEM::write::DefineDEMExtraConditions {group_node group} { set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]] if {$GraphPrint == "true"} { set GraphPrintval 1 @@ -376,10 +325,10 @@ proc DEM::write::DefineDEMExtraConditions {group_node group} { } # TODO: This code is extremely inefficient -> find a simple way to solve it -proc DEM::write::GetSpheresGroupsListInConditions { } { +proc ::DEM::write::GetSpheresGroupsListInConditions { } { set conds_groups_dict [dict create ] set groups [list ] - + # Get all the groups with spheres foreach group [GetSpheresGroups] { foreach surface [GiD_EntitiesGroups get $group nodes] { @@ -389,7 +338,7 @@ proc DEM::write::GetSpheresGroupsListInConditions { } { } } } - + # Find the relations condition -> group set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition" foreach cond [[customlib::GetBaseRoot] selectNodes $xp1] { @@ -402,62 +351,41 @@ proc DEM::write::GetSpheresGroupsListInConditions { } { return $conds_groups_dict } -proc DEM::write::GetSpheresGroups { } { +proc ::DEM::write::GetSpheresGroups { } { set groups [list ] - if {$::Model::SpatialDimension eq "2D"} { set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityBC2D'\]/group" - } else {set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityBC'\]/group"} - foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { - set groupid [$group @n] - lappend groups [write::GetWriteGroupName $groupid] - } - if {$::Model::SpatialDimension eq "2D"} { set xp2 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityIC2D'\]/group" - } else {set xp2 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-VelocityIC'\]/group"} - foreach group [[customlib::GetBaseRoot] selectNodes $xp2] { - set groupid [$group @n] - lappend groups [write::GetWriteGroupName $groupid] + + set conditions_list {DEM-VelocityBC DEM-VelocityIC DEM-GraphCondition} + if {$::Model::SpatialDimension eq "2D"} { + set conditions_list {DEM-VelocityBC2D DEM-VelocityIC2D DEM-GraphCondition2D} } - if {$::Model::SpatialDimension eq "2D"} { set xp3 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-GraphCondition2D'\]/group" - } else {set xp3 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-GraphCondition'\]/group"} - foreach group [[customlib::GetBaseRoot] selectNodes $xp3] { - set groupid [$group @n] - lappend groups [write::GetWriteGroupName $groupid] + + foreach condition $conditions_list { + set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$condition'\]/group" + foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { + set groupid [$group @n] + lappend groups [write::GetWriteGroupName $groupid] + } } + return $groups } -proc DEM::write::writeMaterialsParts { } { +proc ::DEM::write::processPartMaterials { } { variable partsProperties - set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'Parts'\]/group" - set partsProperties $::write::mat_dict - #set ::write::mat_dict [dict create] - #write::processMaterials $xp1 - #set partsProperties $::write::mat_dict - #set ::write::mat_dict $old_mat_dict - # WV inletProperties - set printable [list PARTICLE_DENSITY YOUNG_MODULUS POISSON_RATIO FRICTION PARTICLE_COHESION COEFFICIENT_OF_RESTITUTION PARTICLE_MATERIAL ROLLING_FRICTION ROLLING_FRICTION_WITH_WALLS PARTICLE_SPHERICITY DEM_CONTINUUM_CONSTITUTIVE_LAW_NAME ConstitutiveLaw] - foreach group [dict keys $partsProperties] { - if { [dict get $partsProperties $group APPID] eq "DEM"} { - write::WriteString "Begin Properties [dict get $partsProperties $group MID]" - dict set partsProperties $group DEM_CONTINUUM_CONSTITUTIVE_LAW_NAME DEMContinuumConstitutiveLaw - foreach {prop val} [dict get $partsProperties $group] { - if {$prop in $printable} { - if {$prop eq "ConstitutiveLaw"} { - write::WriteString " DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME $val" - } elseif {$prop eq "FRICTION"} { - set propvalue [expr {tan($val)}] - write::WriteString " FRICTION $propvalue" - } else { - write::WriteString " $prop $val" - } - } - } - write::WriteString "End Properties\n" - } - } + # Materials for parts are already processed + #W [write::processMaterials] + set partsProperties [write::getPropertiesList [GetAttribute parts_un] 0 SpheresPart] } -proc DEM::write::PrepareCustomMeshedParts { } { +proc ::DEM::write::writeMaterialsParts { } { + + write::WriteString "Begin Properties 0" + write::WriteString "End Properties" + write::WriteString "" +} + +proc ::DEM::write::PrepareCustomMeshedParts { } { variable restore_ov set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/group" @@ -474,7 +402,7 @@ proc DEM::write::PrepareCustomMeshedParts { } { } } -proc DEM::write::RestoreCustomMeshedParts { } { +proc ::DEM::write::RestoreCustomMeshedParts { } { variable restore_ov set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/group" @@ -487,4 +415,25 @@ proc DEM::write::RestoreCustomMeshedParts { } { } } set restore_ov [dict create] +} + + +proc ::DEM::write::WriteCustomDEMSmp { } { + set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-CustomSmp'\]/group" + foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { + set group_id [$group @n] + + set destination_mdpa [write::getValueByNode [$group selectNodes "./value\[@n='WhatMdpa'\]"]] + if {$destination_mdpa == "DEM"} { + set mid [write::AddSubmodelpart DEM-CustomSmp $group_id] + write::WriteString "Begin SubModelPart $mid \/\/ Custom SubModelPart. Group name: $group_id" + write::WriteString "Begin SubModelPartData" + write::WriteString "End SubModelPartData" + write::WriteString "Begin SubModelPartNodes" + GiD_WriteCalculationFile nodes -sorted [dict create [write::GetWriteGroupName $group_id] [subst "%10i\n"]] + write::WriteString "End SubModelPartNodes" + write::WriteString "End SubModelPart" + write::WriteString "" + } + } } \ No newline at end of file diff --git a/kratos.gid/apps/DEM/write/writeMDPA_Walls.tcl b/kratos.gid/apps/DEM/write/writeMDPA_Walls.tcl index c56640089..0acec9eb2 100644 --- a/kratos.gid/apps/DEM/write/writeMDPA_Walls.tcl +++ b/kratos.gid/apps/DEM/write/writeMDPA_Walls.tcl @@ -1,16 +1,27 @@ -proc DEM::write::WriteMDPAWalls { } { +proc ::DEM::write::WriteMDPAWalls { } { # Headers write::writeModelPartData # Material - set wall_properties [WriteWallProperties] + DEM::write::processRigidWallMaterials + if {$::Model::SpatialDimension ne "2D"} { + DEM::write::processPhantomWallMaterials + } + + # Properties section + WriteRigidWallProperties # Nodal coordinates (only for Walls ) - write::writeNodalCoordinatesOnGroups [GetWallsGroups] - write::writeNodalCoordinatesOnGroups [GetWallsGroupsSmp] + write::writeNodalCoordinatesOnGroups [DEM::write::GetWallsGroups] + if {$::Model::SpatialDimension ne "2D"} { + write::writeNodalCoordinatesOnGroups [DEM::write::GetWallsGroupsSmp] + } # Nodal conditions and conditions - writeConditions $wall_properties + writeConditions + if {$::Model::SpatialDimension ne "2D"} { + writePhantomConditions + } # SubmodelParts writeWallConditionMeshes @@ -19,15 +30,33 @@ proc DEM::write::WriteMDPAWalls { } { WriteWallCustomSmp } +proc ::DEM::write::processRigidWallMaterials { } { + variable wallsProperties + set walls_xpath [DEM::write::GetRigidWallXPath] + write::processMaterials $walls_xpath/group + set wallsProperties [write::getPropertiesListByConditionXPath $walls_xpath 0 RigidFacePart] +} +proc ::DEM::write::processPhantomWallMaterials { } { + variable phantomwallsProperties + set phantom_walls_xpath [DEM::write::GetPhantomWallXPath] + write::processMaterials $phantom_walls_xpath/group + set phantomwallsProperties [write::getPropertiesListByConditionXPath $phantom_walls_xpath 0] +} -proc DEM::write::WriteWallProperties { } { +proc ::DEM::write::WriteRigidWallProperties { } { + + write::WriteString "Begin Properties 0" + write::WriteString "End Properties" + write::WriteString "" +} + +proc ::DEM::write::WritePhantomWallProperties { } { set wall_properties [dict create ] - set cnd [Model::getCondition "DEM-FEM-Wall"] + set condition_name "Phantom-Wall" + set cnd [Model::getCondition $condition_name] - if {$::Model::SpatialDimension eq "2D"} {set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-FEM-Wall2D'\]/group" - } else { set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-FEM-Wall'\]/group" - } + set xp1 [DEM::write::GetPhantomWallXPath] #set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-FEM-Wall'\]/group" set i $DEM::write::last_property_id @@ -83,17 +112,17 @@ proc DEM::write::WriteWallProperties { } { } -proc DEM::write::WriteWallCustomSmp { } { +proc ::DEM::write::WriteWallCustomSmp { } { + set condition_name "DEM-CustomSmp" set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-CustomSmp'\]/group" - set i $DEM::write::last_property_id + foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { - incr i + set groupid [$group @n] set destination_mdpa [write::getValueByNode [$group selectNodes "./value\[@n='WhatMdpa'\]"]] if {$destination_mdpa == "FEM"} { - - #write::WriteString "Begin SubModelPart $groupid \/\/ Custom SubModelPart. Group name: $groupid" - write::WriteString "Begin SubModelPart $groupid \/\/ Custom SubModelPart. Group name: $groupid" + set mid [write::AddSubmodelpart $condition_name $groupid] + write::WriteString "Begin SubModelPart $mid \/\/ Custom SubModelPart. Group name: $groupid" write::WriteString "Begin SubModelPartData // DEM-FEM-Wall. Group name: $groupid" write::WriteString "End SubModelPartData" write::WriteString "Begin SubModelPartNodes" @@ -106,26 +135,69 @@ proc DEM::write::WriteWallCustomSmp { } { } -proc DEM::write::writeConditions { wall_properties } { - if {$::Model::SpatialDimension eq "2D"} {write::writeConditionsByGiDId DEMConditions DEM-FEM-Wall2D $wall_properties - } else {write::writeConditionsByGiDId DEMConditions DEM-FEM-Wall $wall_properties +proc ::DEM::write::writeConditions { } { + variable wallsProperties + ::write::writeConditionsByGiDId DEMConditions [GetRigidWallConditionName] $wallsProperties +} + +proc ::DEM::write::writePhantomConditions { } { + variable phantomwallsProperties + ::write::writeConditionsByGiDId DEMConditions [GetPhantomWallConditionName] $phantomwallsProperties +} + +proc ::DEM::write::GetWallsGroups { } { + set groups [list ] + set groups_rigid [GetRigidWallsGroups] + set groups_phantom [GetPhantomWallsGroups] + set groups [concat $groups_rigid $groups_phantom] + return $groups +} + +proc ::DEM::write::GetRigidWallConditionName {} { + set condition_name "DEM-FEM-Wall" + if {$::Model::SpatialDimension eq "2D"} { + set condition_name "DEM-FEM-Wall2D" } + return $condition_name +} +proc ::DEM::write::GetPhantomWallConditionName {} { + set condition_name "Phantom-Wall" + if {$::Model::SpatialDimension eq "2D"} { + set condition_name "Phantom-Wall2D" + } + return $condition_name } +proc ::DEM::write::GetRigidWallXPath { } { + set condition_name [GetRigidWallConditionName] + return "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$condition_name'\]" +} +proc ::DEM::write::GetPhantomWallXPath { } { + set condition_name [GetPhantomWallConditionName] + return "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$condition_name'\]" +} +proc ::DEM::write::GetRigidWallsGroups { } { + set groups [list ] -proc DEM::write::GetWallsGroups { } { + foreach group [[customlib::GetBaseRoot] selectNodes "[DEM::write::GetRigidWallXPath]/group"] { + set groupid [$group @n] + lappend groups [write::GetWriteGroupName $groupid] + } + return $groups +} + +proc ::DEM::write::GetPhantomWallsGroups { } { set groups [list ] - if {$::Model::SpatialDimension eq "2D"} {set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-FEM-Wall2D'\]/group" - } else { set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-FEM-Wall'\]/group"} - foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { + + foreach group [[customlib::GetBaseRoot] selectNodes "[DEM::write::GetPhantomWallXPath]/group"] { set groupid [$group @n] lappend groups [write::GetWriteGroupName $groupid] } return $groups } -proc DEM::write::GetWallsGroupsSmp { } { +proc ::DEM::write::GetWallsGroupsSmp { } { set groups [list ] set xp2 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = 'DEM-CustomSmp'\]/group" foreach group [[customlib::GetBaseRoot] selectNodes $xp2] { @@ -139,12 +211,12 @@ proc DEM::write::GetWallsGroupsSmp { } { } ## TODO: UNDER REVISION, UNUSED PROC -proc DEM::write::GetWallsGroupsListInConditions { } { +proc ::DEM::write::GetWallsGroupsListInConditions { } { set conds_groups_dict [dict create ] set groups [list ] # Get all the groups with surfaces involved in walls - foreach group [GetWallsGroups] { + foreach group [GetRigidWallsGroups] { foreach surface [GiD_EntitiesGroups get $group surfaces] { foreach involved_group [GiD_EntitiesGroups entity_groups surfaces $surface] { set involved_group_id [write::GetWriteGroupName $involved_group] @@ -153,7 +225,7 @@ proc DEM::write::GetWallsGroupsListInConditions { } { } } - foreach group [GetWallsGroups] { + foreach group [GetRigidWallsGroups] { foreach line [GiD_EntitiesGroups get $group lines] { foreach involved_group [GiD_EntitiesGroups entity_groups lines $line] { set involved_group_id [write::GetWriteGroupName $involved_group] @@ -176,7 +248,7 @@ proc DEM::write::GetWallsGroupsListInConditions { } { ## TODO: UNDER REVISION, UNUSED PROC -proc DEM::write::GetConditionsGroups { } { +proc ::DEM::write::GetConditionsGroups { } { set groups [list ] set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group" foreach group [[customlib::GetBaseRoot] selectNodes $xp1] { @@ -186,256 +258,282 @@ proc DEM::write::GetConditionsGroups { } { return $groups } -proc DEM::write::writeWallConditionMeshes { } { - set i 0 - if {$::Model::SpatialDimension eq "2D"} {set cond "DEM-FEM-Wall2D" - } else {set cond "DEM-FEM-Wall"} - foreach group [GetWallsGroups] { - incr i - write::WriteString "Begin SubModelPart $i // $cond - group identifier: $group" - write::WriteString " Begin SubModelPartData // DEM-FEM-Wall. Group name: $group" - set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$cond'\]/group\[@n = '$group'\]" - set group_node [[customlib::GetBaseRoot] selectNodes $xp1] - - set is_active [write::getValueByNode [$group_node selectNodes "./value\[@n='SetActive'\]"]] - if {[write::isBooleanTrue $is_active]} { - set motion_type [write::getValueByNode [$group_node selectNodes "./value\[@n='DEM-ImposedMotion'\]"]] - if {$motion_type == "LinearPeriodic"} { - # Linear velocity - set velocity [write::getValueByNode [$group_node selectNodes "./value\[@n='VelocityModulus'\]"]] - lassign [write::getValueByNode [$group_node selectNodes "./value\[@n='DirectionVector'\]"]] velocity_X velocity_Y velocity_Z - if {$::Model::SpatialDimension eq "2D"} { - lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y]] velocity_X velocity_Y - lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y] ] vx vy - write::WriteString " LINEAR_VELOCITY \[3\] ($vx, $vy, 0.0)" - } else { - lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z - lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y $velocity_Z] ] vx vy vz - write::WriteString " LINEAR_VELOCITY \[3\] ($vx, $vy, $vz)"} - # set vX [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearVelocityX'\]"]] - - # Period - set periodic [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearPeriodic'\]"]] - if {[write::isBooleanTrue $periodic]} { - set period [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearPeriod'\]"]] - } else { - set period 0.0 - } - write::WriteString " VELOCITY_PERIOD $period" - - # Angular velocity - set avelocity [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularVelocityModulus'\]"]] - if {$::Model::SpatialDimension eq "2D"} {write::WriteString " ANGULAR_VELOCITY \[3\] (0.0,0.0,$avelocity)" - } else { - lassign [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularDirectionVector'\]"]] velocity_X velocity_Y velocity_Z - lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z - lassign [MathUtils::ScalarByVectorProd $avelocity [list $velocity_X $velocity_Y $velocity_Z] ] wx wy wz - write::WriteString " ANGULAR_VELOCITY \[3\] ($wx,$wy,$wz)"} - - # Angular center of rotation - lassign [write::getValueByNode [$group_node selectNodes "./value\[@n='CenterOfRotation'\]"]] oX oY oZ - if {$::Model::SpatialDimension eq "2D"} {write::WriteString " ROTATION_CENTER \[3\] ($oX,$oY,0.0)" - } else {write::WriteString " ROTATION_CENTER \[3\] ($oX,$oY,$oZ)"} - - # Angular Period - set angular_periodic [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularPeriodic'\]"]] - if {[write::isBooleanTrue $angular_periodic]} { - set angular_period [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularPeriod'\]"]] - } else {set angular_period 0.0} - write::WriteString " ANGULAR_VELOCITY_PERIOD $angular_period" - - # set intervals - set LinearStartTime [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearStartTime'\]"]] - set LinearEndTime [write::getValueByNode [$group_node selectNodes "./value\[@n='LinearEndTime'\]"]] - set AngularStartTime [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularStartTime'\]"]] - set AngularEndTime [write::getValueByNode [$group_node selectNodes "./value\[@n='AngularEndTime'\]"]] - write::WriteString " VELOCITY_START_TIME $LinearStartTime" - write::WriteString " VELOCITY_STOP_TIME $LinearEndTime" - write::WriteString " ANGULAR_VELOCITY_START_TIME $AngularStartTime" - write::WriteString " ANGULAR_VELOCITY_STOP_TIME $AngularEndTime" - - set fixed_mesh_option_bool [write::getValueByNode [$group_node selectNodes "./value\[@n='fixed_wall'\]"]] - if {[write::isBooleanTrue $fixed_mesh_option_bool]} {set fixed_mesh_option 1 - } else {set fixed_mesh_option 0} - set rigid_body_motion 1 - set free_body_motion 0 - #Hardcoded - write::WriteString " FIXED_MESH_OPTION $fixed_mesh_option" - write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" - write::WriteString " FREE_BODY_MOTION $free_body_motion" - - } elseif {$motion_type == "FreeMotion"} { - set fixed_mesh_option 0 - set rigid_body_motion 0 - set free_body_motion 1 - - set mass [write::getValueByNode [$group_node selectNodes "./value\[@n='Mass'\]"]] - write::WriteString " RIGID_BODY_MASS $mass" - - lassign [write::getValueByNode [$group_node selectNodes "./value\[@n='CenterOfMass'\]"]] cX cY cZ - if {$::Model::SpatialDimension eq "2D"} {write::WriteString " RIGID_BODY_CENTER_OF_MASS \[3\] ($cX,$cY,0.0)" - } else {write::WriteString " RIGID_BODY_CENTER_OF_MASS \[3\] ($cX,$cY,$cZ)"} - - set inertias [write::getValueByNode [$group_node selectNodes "./value\[@n='Inertia'\]"]] - if {$::Model::SpatialDimension eq "2D"} { - set iX $inertias - write::WriteString " RIGID_BODY_INERTIAS \[3\] (0.0,0.0,$iX)" - } else { - lassign $inertias iX iY iZ - write::WriteString " RIGID_BODY_INERTIAS \[3\] ($iX,$iY,$iZ)" - } - - # DOFS - set Ax [write::getValueByNode [$group_node selectNodes "./value\[@n='Ax'\]"]] - set Ay [write::getValueByNode [$group_node selectNodes "./value\[@n='Ay'\]"]] - set Az [write::getValueByNode [$group_node selectNodes "./value\[@n='Az'\]"]] - set Bx [write::getValueByNode [$group_node selectNodes "./value\[@n='Bx'\]"]] - set By [write::getValueByNode [$group_node selectNodes "./value\[@n='By'\]"]] - set Bz [write::getValueByNode [$group_node selectNodes "./value\[@n='Bz'\]"]] - if {$Ax == "Constant"} { - set fix_vx [write::getValueByNode [$group_node selectNodes "./value\[@n='Vx'\]"]] - write::WriteString " IMPOSED_VELOCITY_X_VALUE $fix_vx" - } - if {$Ay == "Constant"} { - set fix_vy [write::getValueByNode [$group_node selectNodes "./value\[@n='Vy'\]"]] - write::WriteString " IMPOSED_VELOCITY_Y_VALUE $fix_vy" - } - if {$Az == "Constant"} { - set fix_vz [write::getValueByNode [$group_node selectNodes "./value\[@n='Vz'\]"]] - if {$::Model::SpatialDimension eq "2D"} {write::WriteString " IMPOSED_VELOCITY_Z_VALUE 0.0" - } else {write::WriteString " IMPOSED_VELOCITY_Z_VALUE $fix_vz"} - - } - if {$Bx == "Constant"} { - set fix_avx [write::getValueByNode [$group_node selectNodes "./value\[@n='AVx'\]"]] - if {$::Model::SpatialDimension eq "2D"} {write::WriteString " IMPOSED_ANGULAR_VELOCITY_X_VALUE 0.0" - } else {write::WriteString " IMPOSED_ANGULAR_VELOCITY_X_VALUE $fix_avx"} - - } - if {$By == "Constant"} { - set fix_avy [write::getValueByNode [$group_node selectNodes "./value\[@n='AVy'\]"]] - if {$::Model::SpatialDimension eq "2D"} {write::WriteString " IMPOSED_ANGULAR_VELOCITY_Y_VALUE 0.0" - } else {write::WriteString " IMPOSED_ANGULAR_VELOCITY_Y_VALUE $fix_avy"} - - } - if {$Bz == "Constant"} { - set fix_avz [write::getValueByNode [$group_node selectNodes "./value\[@n='AVz'\]"]] - write::WriteString " IMPOSED_ANGULAR_VELOCITY_Z_VALUE $fix_avz" - } - set VStart [write::getValueByNode [$group_node selectNodes "./value\[@n='VStart'\]"]] - set VEnd [write::getValueByNode [$group_node selectNodes "./value\[@n='VEnd'\]"]] - write::WriteString " VELOCITY_START_TIME $VStart" - write::WriteString " VELOCITY_STOP_TIME $VEnd" - - # initial conditions - set iAx [write::getValueByNode [$group_node selectNodes "./value\[@n='iAx'\]"]] - set iAy [write::getValueByNode [$group_node selectNodes "./value\[@n='iAy'\]"]] - set iAz [write::getValueByNode [$group_node selectNodes "./value\[@n='iAz'\]"]] - set iBx [write::getValueByNode [$group_node selectNodes "./value\[@n='iBx'\]"]] - set iBy [write::getValueByNode [$group_node selectNodes "./value\[@n='iBy'\]"]] - set iBz [write::getValueByNode [$group_node selectNodes "./value\[@n='iBz'\]"]] - if {$iAx == "true"} { - set fix_vx [write::getValueByNode [$group_node selectNodes "./value\[@n='iVx'\]"]] - write::WriteString " INITIAL_VELOCITY_X_VALUE $fix_vx" - } - if {$iAy == "true"} { - set fix_vy [write::getValueByNode [$group_node selectNodes "./value\[@n='iVy'\]"]] - write::WriteString " INITIAL_VELOCITY_Y_VALUE $fix_vy" - } - if {$iAz == "true"} { - set fix_vz [write::getValueByNode [$group_node selectNodes "./value\[@n='iVz'\]"]] - if {$::Model::SpatialDimension eq "2D"} {write::WriteString " INITIAL_VELOCITY_Z_VALUE 0.0" - } else {write::WriteString " INITIAL_VELOCITY_Z_VALUE $fix_vz"} - - } - if {$iBx == "true"} { - set fix_avx [write::getValueByNode [$group_node selectNodes "./value\[@n='iAVx'\]"]] - if {$::Model::SpatialDimension eq "2D"} {write::WriteString " INITIAL_ANGULAR_VELOCITY_X_VALUE 0.0" - } else {write::WriteString " INITIAL_ANGULAR_VELOCITY_X_VALUE $fix_avx"} - - } - if {$iBy == "true"} { - set fix_avy [write::getValueByNode [$group_node selectNodes "./value\[@n='iAVy'\]"]] - if {$::Model::SpatialDimension eq "2D"} {write::WriteString " INITIAL_ANGULAR_VELOCITY_Y_VALUE 0.0" - } else {write::WriteString " INITIAL_ANGULAR_VELOCITY_Y_VALUE $fix_avy"} - - } - if {$iBz == "true"} { - set fix_avz [write::getValueByNode [$group_node selectNodes "./value\[@n='iAVz'\]"]] - write::WriteString " INITIAL_ANGULAR_VELOCITY_Z_VALUE $fix_avz" - } - - # impose forces and moments - set ExternalForceX [write::getValueByNode [$group_node selectNodes "./value\[@n='ExternalForceX'\]"]] - set ExternalForceY [write::getValueByNode [$group_node selectNodes "./value\[@n='ExternalForceY'\]"]] - set ExternalForceZ [write::getValueByNode [$group_node selectNodes "./value\[@n='ExternalForceZ'\]"]] - set ExternalMomentX [write::getValueByNode [$group_node selectNodes "./value\[@n='ExternalMomentX'\]"]] - set ExternalMomentY [write::getValueByNode [$group_node selectNodes "./value\[@n='ExternalMomentY'\]"]] - set ExternalMomentZ [write::getValueByNode [$group_node selectNodes "./value\[@n='ExternalMomentZ'\]"]] - - if {$ExternalForceX == "true"} { - set FX [write::getValueByNode [$group_node selectNodes "./value\[@n='FX'\]"]] - write::WriteString " EXTERNAL_APPLIED_FORCE_X $FX" - } - if {$ExternalForceY == "true"} { - set FY [write::getValueByNode [$group_node selectNodes "./value\[@n='FY'\]"]] - write::WriteString " EXTERNAL_APPLIED_FORCE_Y $FY" - } - if {$ExternalForceZ == "true"} { - set FZ [write::getValueByNode [$group_node selectNodes "./value\[@n='FZ'\]"]] - write::WriteString " EXTERNAL_APPLIED_FORCE_Z $FZ" - } - if {$ExternalMomentX == "true"} { - set MX [write::getValueByNode [$group_node selectNodes "./value\[@n='MX'\]"]] - write::WriteString " EXTERNAL_APPLIED_MOMENT_X $MX" - } - if {$ExternalMomentY == "true"} { - set MY [write::getValueByNode [$group_node selectNodes "./value\[@n='MY'\]"]] - write::WriteString " EXTERNAL_APPLIED_MOMENT_Y $MY" - } - if {$ExternalMomentZ == "true"} { - set MZ [write::getValueByNode [$group_node selectNodes "./value\[@n='MZ'\]"]] - write::WriteString " EXTERNAL_APPLIED_MOMENT_Z $MZ" - } - #Hardcoded - write::WriteString " FIXED_MESH_OPTION $fixed_mesh_option" - write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" - write::WriteString " FREE_BODY_MOTION $free_body_motion" - } +proc ::DEM::write::writeWallConditionMeshes { } { + variable wallsProperties + variable phantomwallsProperties + set condition_name [GetRigidWallConditionName] + foreach group [GetRigidWallsGroups] { + set mid [write::AddSubmodelpart $condition_name $group] + set props [DEM::write::FindPropertiesBySubmodelpart $wallsProperties $mid] + writeWallConditionMesh $condition_name $group $props + } + + if {$::Model::SpatialDimension ne "2D"} { + set condition_name [GetPhantomWallConditionName] + foreach group [GetPhantomWallsGroups] { + set mid [write::AddSubmodelpart $condition_name $group] + set props [DEM::write::FindPropertiesBySubmodelpart $phantomwallsProperties $mid] + writeWallConditionMesh $condition_name $group $props + } + } +} + +proc ::DEM::write::writeWallConditionMesh { condition group props } { + + set mid [write::AddSubmodelpart $condition $group] + + write::WriteString "Begin SubModelPart $mid // $condition - group identifier: $group" + write::WriteString " Begin SubModelPartData // $condition. Group name: $group" + set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition\[@n = '$condition'\]/group\[@n = '$group'\]" + set group_node [[customlib::GetBaseRoot] selectNodes $xp1] + + set is_active [dict get $props Material Variables SetActive] + if {[write::isBooleanTrue $is_active]} { + set motion_type [dict get $props Material Variables DEM-ImposedMotion] + if {$motion_type == "LinearPeriodic"} { + # Linear velocity + set velocity [dict get $props Material Variables VelocityModulus] + lassign [dict get $props Material Variables DirectionVector] velocity_X velocity_Y velocity_Z + if {$::Model::SpatialDimension eq "2D"} { + lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y]] velocity_X velocity_Y + lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y] ] vx vy + write::WriteString " LINEAR_VELOCITY \[3\] ($vx, $vy, 0.0)" + } else { + lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z + lassign [MathUtils::ScalarByVectorProd $velocity [list $velocity_X $velocity_Y $velocity_Z] ] vx vy vz + write::WriteString " LINEAR_VELOCITY \[3\] ($vx, $vy, $vz)" + } + # set vX [dict get $props Material Variables LinearVelocityX'\]"]] + + # Period + set periodic [dict get $props Material Variables LinearPeriodic] + if {[write::isBooleanTrue $periodic]} { + set period [dict get $props Material Variables LinearPeriod] + } else { + set period 0.0 + } + write::WriteString " VELOCITY_PERIOD $period" + + # Angular velocity + set avelocity [dict get $props Material Variables AngularVelocityModulus] + if {$::Model::SpatialDimension eq "2D"} { + write::WriteString " ANGULAR_VELOCITY \[3\] (0.0,0.0,$avelocity)" + } else { + lassign [dict get $props Material Variables AngularDirectionVector] velocity_X velocity_Y velocity_Z + lassign [MathUtils::VectorNormalized [list $velocity_X $velocity_Y $velocity_Z]] velocity_X velocity_Y velocity_Z + lassign [MathUtils::ScalarByVectorProd $avelocity [list $velocity_X $velocity_Y $velocity_Z] ] wx wy wz + write::WriteString " ANGULAR_VELOCITY \[3\] ($wx,$wy,$wz)"} + + # Angular center of rotation + lassign [dict get $props Material Variables CenterOfRotation] oX oY oZ + if {$::Model::SpatialDimension eq "2D"} {write::WriteString " ROTATION_CENTER \[3\] ($oX,$oY,0.0)" + } else {write::WriteString " ROTATION_CENTER \[3\] ($oX,$oY,$oZ)"} + + # Angular Period + set angular_periodic [dict get $props Material Variables AngularPeriodic] + set angular_period 0.0 + if {[write::isBooleanTrue $angular_periodic]} { + set angular_period [dict get $props Material Variables AngularPeriod] + } + write::WriteString " ANGULAR_VELOCITY_PERIOD $angular_period" + + # set intervals + set LinearStartTime [dict get $props Material Variables LinearStartTime] + set LinearEndTime [dict get $props Material Variables LinearEndTime] + set AngularStartTime [dict get $props Material Variables AngularStartTime] + set AngularEndTime [dict get $props Material Variables AngularEndTime] + write::WriteString " VELOCITY_START_TIME $LinearStartTime" + write::WriteString " VELOCITY_STOP_TIME $LinearEndTime" + write::WriteString " ANGULAR_VELOCITY_START_TIME $AngularStartTime" + write::WriteString " ANGULAR_VELOCITY_STOP_TIME $AngularEndTime" + + set fixed_mesh_option_bool [dict get $props Material Variables fixed_wall] + set fixed_mesh_option 0 + if {[write::isBooleanTrue $fixed_mesh_option_bool]} { + set fixed_mesh_option 1 + } + set rigid_body_motion 1 + set free_body_motion 0 #Hardcoded - set is_ghost [write::getValueByNode [$group_node selectNodes "./value\[@n='IsGhost'\]"]] - write::WriteString " IS_GHOST $is_ghost" - write::WriteString " IDENTIFIER [write::transformGroupName $group]" + write::WriteString " FIXED_MESH_OPTION $fixed_mesh_option" + write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" + write::WriteString " FREE_BODY_MOTION $free_body_motion" + + } elseif {$motion_type == "FreeMotion"} { + set fixed_mesh_option 0 + set rigid_body_motion 0 + set free_body_motion 1 + + set mass [dict get $props Material Variables Mass] + write::WriteString " RIGID_BODY_MASS $mass" + + lassign [dict get $props Material Variables CenterOfMass] cX cY cZ + if {$::Model::SpatialDimension eq "2D"} {write::WriteString " RIGID_BODY_CENTER_OF_MASS \[3\] ($cX,$cY,0.0)" + } else {write::WriteString " RIGID_BODY_CENTER_OF_MASS \[3\] ($cX,$cY,$cZ)"} + + set inertias [dict get $props Material Variables Inertia] + if {$::Model::SpatialDimension eq "2D"} { + set iX $inertias + write::WriteString " RIGID_BODY_INERTIAS \[3\] (0.0,0.0,$iX)" + } else { + lassign $inertias iX iY iZ + write::WriteString " RIGID_BODY_INERTIAS \[3\] ($iX,$iY,$iZ)" + } + + # DOFS + set Ax [dict get $props Material Variables Ax] + set Ay [dict get $props Material Variables Ay] + set Az [dict get $props Material Variables Az] + set Bx [dict get $props Material Variables Bx] + set By [dict get $props Material Variables By] + set Bz [dict get $props Material Variables Bz] + if {$Ax == "Constant"} { + set fix_vx [dict get $props Material Variables Vx] + write::WriteString " IMPOSED_VELOCITY_X_VALUE $fix_vx" + } + if {$Ay == "Constant"} { + set fix_vy [dict get $props Material Variables Vy] + write::WriteString " IMPOSED_VELOCITY_Y_VALUE $fix_vy" + } + if {$Az == "Constant"} { + set fix_vz [dict get $props Material Variables Vz] + if {$::Model::SpatialDimension eq "2D"} {write::WriteString " IMPOSED_VELOCITY_Z_VALUE 0.0" + } else {write::WriteString " IMPOSED_VELOCITY_Z_VALUE $fix_vz"} - DefineFEMExtraConditions $group_node + } + if {$Bx == "Constant"} { + set fix_avx [dict get $props Material Variables AVx] + if {$::Model::SpatialDimension eq "2D"} {write::WriteString " IMPOSED_ANGULAR_VELOCITY_X_VALUE 0.0" + } else {write::WriteString " IMPOSED_ANGULAR_VELOCITY_X_VALUE $fix_avx"} + + } + if {$By == "Constant"} { + set fix_avy [dict get $props Material Variables AVy] + if {$::Model::SpatialDimension eq "2D"} {write::WriteString " IMPOSED_ANGULAR_VELOCITY_Y_VALUE 0.0" + } else {write::WriteString " IMPOSED_ANGULAR_VELOCITY_Y_VALUE $fix_avy"} + + } + if {$Bz == "Constant"} { + set fix_avz [dict get $props Material Variables AVz] + write::WriteString " IMPOSED_ANGULAR_VELOCITY_Z_VALUE $fix_avz" + } + set VStart [dict get $props Material Variables VStart] + set VEnd [dict get $props Material Variables VEnd] + write::WriteString " VELOCITY_START_TIME $VStart" + write::WriteString " VELOCITY_STOP_TIME $VEnd" + + # initial conditions + set iAx [dict get $props Material Variables iAx] + set iAy [dict get $props Material Variables iAy] + set iAz [dict get $props Material Variables iAz] + set iBx [dict get $props Material Variables iBx] + set iBy [dict get $props Material Variables iBy] + set iBz [dict get $props Material Variables iBz] + if {$iAx == "true"} { + set fix_vx [dict get $props Material Variables iVx] + write::WriteString " INITIAL_VELOCITY_X_VALUE $fix_vx" + } + if {$iAy == "true"} { + set fix_vy [dict get $props Material Variables iVy] + write::WriteString " INITIAL_VELOCITY_Y_VALUE $fix_vy" + } + if {$iAz == "true"} { + set fix_vz [dict get $props Material Variables iVz] + if {$::Model::SpatialDimension eq "2D"} {write::WriteString " INITIAL_VELOCITY_Z_VALUE 0.0" + } else {write::WriteString " INITIAL_VELOCITY_Z_VALUE $fix_vz"} + + } + if {$iBx == "true"} { + set fix_avx [dict get $props Material Variables iAVx] + if {$::Model::SpatialDimension eq "2D"} {write::WriteString " INITIAL_ANGULAR_VELOCITY_X_VALUE 0.0" + } else {write::WriteString " INITIAL_ANGULAR_VELOCITY_X_VALUE $fix_avx"} + } + if {$iBy == "true"} { + set fix_avy [dict get $props Material Variables iAVy] + if {$::Model::SpatialDimension eq "2D"} {write::WriteString " INITIAL_ANGULAR_VELOCITY_Y_VALUE 0.0" + } else {write::WriteString " INITIAL_ANGULAR_VELOCITY_Y_VALUE $fix_avy"} + + } + if {$iBz == "true"} { + set fix_avz [dict get $props Material Variables iAVz] + write::WriteString " INITIAL_ANGULAR_VELOCITY_Z_VALUE $fix_avz" + } + + # impose forces and moments + set ExternalForceX [dict get $props Material Variables ExternalForceX] + set ExternalForceY [dict get $props Material Variables ExternalForceY] + set ExternalForceZ [dict get $props Material Variables ExternalForceZ] + set ExternalMomentX [dict get $props Material Variables ExternalMomentX] + set ExternalMomentY [dict get $props Material Variables ExternalMomentY] + set ExternalMomentZ [dict get $props Material Variables ExternalMomentZ] + + if {$ExternalForceX == "true"} { + set FX [dict get $props Material Variables FX] + write::WriteString " EXTERNAL_APPLIED_FORCE_X $FX" + } + if {$ExternalForceY == "true"} { + set FY [dict get $props Material Variables FY] + write::WriteString " EXTERNAL_APPLIED_FORCE_Y $FY" + } + if {$ExternalForceZ == "true"} { + set FZ [dict get $props Material Variables FZ] + write::WriteString " EXTERNAL_APPLIED_FORCE_Z $FZ" + } + if {$ExternalMomentX == "true"} { + set MX [dict get $props Material Variables MX] + write::WriteString " EXTERNAL_APPLIED_MOMENT_X $MX" + } + if {$ExternalMomentY == "true"} { + set MY [dict get $props Material Variables MY] + write::WriteString " EXTERNAL_APPLIED_MOMENT_Y $MY" + } + if {$ExternalMomentZ == "true"} { + set MZ [dict get $props Material Variables MZ] + write::WriteString " EXTERNAL_APPLIED_MOMENT_Z $MZ" + } + #Hardcoded + write::WriteString " FIXED_MESH_OPTION $fixed_mesh_option" + write::WriteString " RIGID_BODY_MOTION $rigid_body_motion" + write::WriteString " FREE_BODY_MOTION $free_body_motion" + } + + #Hardcoded + set is_ghost [dict get $props Material Variables IsGhost] + if {$is_ghost == "true"} { + write::WriteString " IS_GHOST 1" + } else { + write::WriteString " IS_GHOST 0" } - write::WriteString " End SubModelPartData" - - write::WriteString " Begin SubModelPartNodes" - GiD_WriteCalculationFile nodes -sorted [dict create [write::GetWriteGroupName $group] [subst "%10i\n"]] - write::WriteString " End SubModelPartNodes" - - write::WriteString "Begin SubModelPartConditions" - set gdict [dict create] - set f "%10i\n" - set f [subst $f] - dict set gdict $group $f - GiD_WriteCalculationFile elements -sorted $gdict - write::WriteString "End SubModelPartConditions" - write::WriteString "" - write::WriteString "End SubModelPart" - write::WriteString "" + write::WriteString " IDENTIFIER [write::transformGroupName $group]" + + DEM::write::DefineFEMExtraConditions $props + } + write::WriteString " End SubModelPartData" + + write::WriteString " Begin SubModelPartNodes" + GiD_WriteCalculationFile nodes -sorted [dict create [write::GetWriteGroupName $group] [subst "%10i\n"]] + write::WriteString " End SubModelPartNodes" + + write::WriteString "Begin SubModelPartConditions" + set gdict [dict create] + set f "%10i\n" + set f [subst $f] + dict set gdict $group $f + GiD_WriteCalculationFile elements -sorted $gdict + write::WriteString "End SubModelPartConditions" + write::WriteString "" + write::WriteString "End SubModelPart" + write::WriteString "" } -proc DEM::write::DefineFEMExtraConditions {group_node} { - set GraphPrint [write::getValueByNode [$group_node selectNodes "./value\[@n='GraphPrint'\]"]] - if {$GraphPrint == "true"} { +proc ::DEM::write::DefineFEMExtraConditions {props} { + set GraphPrint [dict get $props Material Variables GraphPrint] + set GraphPrintval 0 + if {[write::isBooleanTrue $GraphPrint]} { set GraphPrintval 1 - } else { - set GraphPrintval 0 } write::WriteString " FORCE_INTEGRATION_GROUP $GraphPrintval" -} \ No newline at end of file +} diff --git a/kratos.gid/apps/DEM/write/writeMaterials.tcl b/kratos.gid/apps/DEM/write/writeMaterials.tcl new file mode 100644 index 000000000..23f08f1e1 --- /dev/null +++ b/kratos.gid/apps/DEM/write/writeMaterials.tcl @@ -0,0 +1,123 @@ +proc ::DEM::write::getDEMMaterialsDict { } { + # TODO: Remove properties in mdpas ? Check with MA. Probably remove material properties but check the process properties + # TODO: Check 2d dem fem wall is written twice, also as phantom + # TODO: Materials have more properties than expected. Write from properties variables, not from xml + + # Loop over parts, inlets and walls to list the materials to print. For each material used print: DENSITY, YOUNG_MODULUS, POISSON_RATIO + # print COMPUTE_WEAR as false always, too (temporal fix) + # While looping, create the assignation_table_list + set materials_node_list [DEM::write::GetDEMUsedMaterialsNodeList] + set materials_list [list ] + set processed_mats [dict create ] + + set matid 0 + foreach mat_node $materials_node_list { + set mat_name [write::getValueByNode $mat_node] + if {$mat_name ni [dict keys $processed_mats]} { + incr matid + set mat [dict create] + dict set mat material_name $mat_name + dict set mat material_id $matid + set material_xp "[spdAux::getRoute [GetAttribute materials_un]]/blockdata\[@name='$mat_name'\]" + foreach param [[customlib::GetBaseRoot] selectNodes "$material_xp/value"] { + dict set mat Variables [$param @n] [write::getValueByNode $param] + } + lappend materials_list $mat + dict set processed_mats $mat_name $matid + } + } + + # Loop over the material relations, which is a new menu in the tree linking each possible pair of materials + set material_relations_node_list [DEM::write::GetMaterialRelationsNodeList] + set material_relations_list [list ] + + foreach mat_rel_node $material_relations_node_list { + set mat_rel [dict create ] + set mat_a [write::getValueByNode [$mat_rel_node selectNodes "./value\[@n = 'MATERIAL_A'\]"]] + set mat_b [write::getValueByNode [$mat_rel_node selectNodes "./value\[@n = 'MATERIAL_B'\]"]] + if {[dict exists $processed_mats $mat_a] && [dict exists $processed_mats $mat_b]} { + dict set mat_rel material_names_list [list $mat_a $mat_b] + dict set mat_rel material_ids_list [list [dict get $processed_mats $mat_a] [dict get $processed_mats $mat_b]] + foreach param [$mat_rel_node selectNodes "./value"] { + set param_name [$param @n] + if {$param_name eq "ConstitutiveLaw"} {set param_name "DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME"} + if {$param_name ni [list MATERIAL_A MATERIAL_B]} { + dict set mat_rel Variables $param_name [write::getValueByNode $param] + } + } + lappend material_relations_list $mat_rel + } + } + + # Submodelpart - material assignation + set assignation_table_list [list ] + foreach mnode $materials_node_list { + set gnode [$mnode parent] + set active_group_node [$gnode selectNodes "value\[@n='SetActive'\]"] + if {$active_group_node ne ""} { + if {[write::isBooleanFalse [write::getValueByNode $active_group_node]]} { + continue + } + } + set mat_name [write::getValueByNode $mnode] + set group_name [write::GetWriteGroupName [$gnode @n]] + set cond_name [[$gnode parent] @n] + set submodelpart_id [write::getSubModelPartId $cond_name $group_name] + set modelpart_parent [DEM::write::GetModelPartParentNameFromGroup $group_name] + lappend assignation_table_list [list ${modelpart_parent}.${submodelpart_id} $mat_name] + + } + + + dict set global_dict "materials" $materials_list + dict set global_dict "material_relations" $material_relations_list + dict set global_dict "material_assignation_table" $assignation_table_list + + ValidateMaterialRelations $materials_list $material_relations_list $assignation_table_list + + return $global_dict +} + +proc ::DEM::write::GetModelPartParentNameFromGroup {group} { + set model_part_parent SpheresPart + if {$group in [DEM::write::GetWallsGroups]} {set model_part_parent "RigidFacePart"} + if {$group in [DEM::write::GetInletGroups]} {set model_part_parent "DEMInletPart"} + return $model_part_parent +} + + +proc ::DEM::write::GetDEMUsedMaterialsNodeList { } { + # Dem needs more material information than default + set materials [list ] + + set root [[customlib::GetBaseRoot] selectNodes [spdAux::getRoute DEMROOT]] + foreach mat [$root selectNodes "descendant::group/value\[@n='Material'\]"] { + lappend materials $mat + } + return $materials +} + +proc ::DEM::write::GetMaterialRelationsNodeList { } { + # Dem needs more material information than default + set material_relations [list ] + + set root [customlib::GetBaseRoot] + + set material_relations_xp "[spdAux::getRoute DEMMaterialRelations]/blockdata\[@n='material_relation'\]" + foreach mat_rel_node [[customlib::GetBaseRoot] selectNodes $material_relations_xp] { + lappend material_relations $mat_rel_node + } + return $material_relations +} + +proc ::DEM::write::ValidateMaterialRelations {materials relations assignations} { + set material_relations [DEM::xml::GetMaterialRelationsTable] + + foreach relation_ref [dict keys $material_relations] { + foreach relation_check [dict keys [dict get $material_relations $relation_ref]] { + if {![dict get $material_relations $relation_ref $relation_check]} { + W "Missing relation between $relation_ref and $relation_check" + } + } + } +} \ No newline at end of file diff --git a/kratos.gid/apps/DEM/write/writeProjectParameters.tcl b/kratos.gid/apps/DEM/write/writeProjectParameters.tcl index 5c4848b3a..cd6563df9 100644 --- a/kratos.gid/apps/DEM/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/DEM/write/writeProjectParameters.tcl @@ -1,21 +1,12 @@ # Project Parameters -# proc ::DEM::write::getParametersEventtest { } { - -# set project_parameters_dict [dict create] -# dict set project_parameters_dict [DEM::write::getParametersEvent1] -# dict set project_parameters_dict "PostBoundingBox" "SphericPartDEMElement3D" -# dict set project_parameters_dict "PostPoissonRatio" "false" -# return $project_parameters_dict -# } - -proc DEM::write::getParametersDict { } { +proc ::DEM::write::getParametersDict { } { set project_parameters_dict [dict create] + set dimension [expr 3] + if {$::Model::SpatialDimension eq "2D"} {set dimension [expr 2]} - if {$::Model::SpatialDimension eq "2D"} {set dimension [expr 2] - } else {set dimension [expr 3]} dict set project_parameters_dict "Dimension" [expr $dimension] dict set project_parameters_dict "PeriodicDomainOption" [write::getValue Boundingbox PeriodicDomain] dict set project_parameters_dict "BoundingBoxOption" [write::getValue Boundingbox UseBB] @@ -31,12 +22,8 @@ proc DEM::write::getParametersDict { } { dict set project_parameters_dict "BoundingBoxMinZ" [write::getValue Boundingbox MinZ] # dem_inlet_option - set numinlets [llength [DEM::write::GetInletGroups]] - if {$numinlets == 0} { - set dem_inlet_option "false" - } else { - set dem_inlet_option "true" - } + set dem_inlet_option true + if {[llength [DEM::write::GetInletGroups]] == 0} {set dem_inlet_option false} dict set project_parameters_dict "dem_inlet_option" $dem_inlet_option # Gravity @@ -51,62 +38,54 @@ proc DEM::write::getParametersDict { } { dict set project_parameters_dict "CleanIndentationsOption" [write::getValue AdvOptions CleanIndentations] set strategy_parameters_dict [dict create] - # set ElementType [::wkcf::GetElementType] # TODO: check old ::wkcf::GetElementType functionalities if required - set ElementType SphericPartDEMElement3D - if {$ElementType eq "SphericPartDEMElement3D" || $ElementType eq "CylinderPartDEMElement2D"} { - set dem_strategy "sphere_strategy" - } elseif {$ElementType eq "SphericContPartDEMElement3D" || $ElementType eq "CylinderContPartDEMElement3D"} { - set dem_strategy "continuum_sphere_strategy" - } elseif {$ElementType eq "ThermalSphericPartDEMElement3D"} { - set dem_strategy "thermal_sphere_strategy" - } elseif {$ElementType eq "ThermalSphericContPartDEMElement3D"} { - set dem_strategy "thermal_continuum_sphere_strategy" - } elseif {$ElementType eq "SinteringSphericConPartDEMElement3D"} { - set dem_strategy "thermal_continuum_sphere_strategy" - } elseif {$ElementType eq "IceContPartDEMElement3D"} { - set dem_strategy "ice_continuum_sphere_strategy" - } + set dem_strategy [DEM::write::GetDemStrategyName] dict set strategy_parameters_dict "RemoveBallsInitiallyTouchingWalls" [write::getValue AdvOptions RemoveParticlesInWalls] dict set strategy_parameters_dict "strategy" $dem_strategy - dict set project_parameters_dict "solver_settings" $strategy_parameters_dict + set material_import_settings [dict create] + dict set material_import_settings "materials_filename" [GetAttribute materials_file] + dict set strategy_parameters_dict "material_import_settings" $material_import_settings + + dict set project_parameters_dict "solver_settings" $strategy_parameters_dict dict set project_parameters_dict "VirtualMassCoefficient" [write::getValue AdvOptions VirtualMassCoef] dict set project_parameters_dict "RollingFrictionOption" [write::getValue AdvOptions RollingFriction] dict set project_parameters_dict "GlobalDamping" [write::getValue AdvOptions GlobalDamping] dict set project_parameters_dict "ContactMeshOption" [write::getValue BondElem ContactMeshOption] dict set project_parameters_dict "OutputFileType" [write::getValue GiDOptions GiDPostMode] dict set project_parameters_dict "Multifile" [write::getValue GiDOptions GiDMultiFileFlag] - dict set project_parameters_dict "ElementType" $ElementType + + dict set project_parameters_dict "ElementType" [GetElementType] dict set project_parameters_dict "TranslationalIntegrationScheme" [write::getValue DEMTranslationalScheme] dict set project_parameters_dict "RotationalIntegrationScheme" [write::getValue DEMRotationalScheme] set time_params [DEM::write::GetTimeSettings] - set MaxTimeStep [dict get $time_params DeltaTime] + set MaxTimeStep [dict get $time_params DeltaTime] # TODO: MAXTIMESTEP is get from General and it should be getting its value from DEM block dict set project_parameters_dict "MaxTimeStep" $MaxTimeStep - set FinalTime [dict get $time_params EndTime] + set FinalTime [dict get $time_params EndTime] dict set project_parameters_dict "FinalTime" $FinalTime # TODO: check for inconsistencies in DEMTIMEPARAMETERS UN # dict set project_parameters_dict "ControlTime" [write::getValue DEMTimeParameters ScreenInfoOutput] dict set project_parameters_dict "NeighbourSearchFrequency" [write::getValue DEMTimeParameters NeighbourSearchFrequency] + dict set project_parameters_dict "SearchTolerance" [write::getValue AdvOptions SearchTolerance] dict set project_parameters_dict "GraphExportFreq" [write::getValue DGraphs GraphExportFreq] dict set project_parameters_dict "VelTrapGraphExportFreq" 1e-3 # Output timestep - set output_criterion [write::getValue DEMResults DEM-OTimeStepType] - if {$output_criterion eq "Detail_priority"} { - set output_timestep [write::getValue DEMResults DEM-OTimeStepDetail] - } elseif {$output_criterion eq "Storage_priority"} { - set amount [write::getValue DEMResults DEM-OTimeStepStorage] - set OTimeStepStorage [expr (double($FinalTime)/$amount)] - set maxamount [expr ($FinalTime/$MaxTimeStep)] - if {$amount < $maxamount} { - set output_timestep $OTimeStepStorage - } else { - set output_timestep $MaxTimeStep - } + set output_criterion [write::getValue DEMResults DEM-OTimeStepType] + if {$output_criterion eq "Detail_priority"} { + set output_timestep [write::getValue DEMResults DEM-OTimeStepDetail] + } elseif {$output_criterion eq "Storage_priority"} { + set amount [write::getValue DEMResults DEM-OTimeStepStorage] + set OTimeStepStorage [expr (double($FinalTime)/$amount)] + set maxamount [expr ($FinalTime/$MaxTimeStep)] + if {$amount < $maxamount} { + set output_timestep $OTimeStepStorage + } else { + set output_timestep $MaxTimeStep } + } dict set project_parameters_dict "OutputTimeStep" $output_timestep dict set project_parameters_dict "PostBoundingBox" [write::getValue Boundingbox PostBB] dict set project_parameters_dict "PostLocalContactForce" [write::getValue BondElem LocalContactForce] @@ -122,29 +101,51 @@ proc DEM::write::getParametersDict { } { dict set project_parameters_dict "PostTotalForces" [write::getValue PostPrint TotalForces] dict set project_parameters_dict "PostPressure" [write::getValue PostPrint Pressure] dict set project_parameters_dict "PostShearStress" [write::getValue PostPrint ShearStress] + dict set project_parameters_dict "PostSkinSphere" [write::getValue PostPrint SkinSphere] dict set project_parameters_dict "PostNonDimensionalVolumeWear" [write::getValue PostPrint Wear] dict set project_parameters_dict "PostParticleMoment" [write::getValue PostPrint ParticleMoment] dict set project_parameters_dict "PostEulerAngles" [write::getValue PostPrint EulerAngles] dict set project_parameters_dict "PostRollingResistanceMoment" [write::getValue PostPrint RollingResistanceMoment] - #dict set project_parameters_dict "PostNodalArea" [write::getValue PostPrint NodalArea] - #dict set project_parameters_dict "PostRHS" [write::getValue PostPrint Rhs] - #dict set project_parameters_dict "PostDampForces" [write::getValue PostPrint DampForces] - #dict set project_parameters_dict "PostAppliedForces" [write::getValue PostPrint AppliedForces] - #dict set project_parameters_dict "PostGroupId" [write::getValue PostPrint GroupId] - #dict set project_parameters_dict "PostExportId" [write::getValue PostPrint ExportId] dict set project_parameters_dict "problem_name" [Kratos::GetModelName] return $project_parameters_dict } -proc DEM::write::GetTimeSettings { } { +proc ::DEM::write::GetElementType { } { + set used_elements [spdAux::GetUsedElements] + set element_type [lindex $used_elements 0] + return $element_type +} + +proc ::DEM::write::GetDemStrategyName { } { + return sphere_strategy + # set ElementType [::wkcf::GetElementType] # TODO: check old ::wkcf::GetElementType functionalities if required + # set used_elements [spdAux::GetUsedElements] + + # set ElementType SphericPartDEMElement3D + # if {$ElementType eq "SphericPartDEMElement3D" || $ElementType eq "CylinderPartDEMElement2D"} { + # set dem_strategy "sphere_strategy" + # } elseif {$ElementType eq "SphericContPartDEMElement3D" || $ElementType eq "CylinderContPartDEMElement3D"} { + # set dem_strategy "continuum_sphere_strategy" + # } elseif {$ElementType eq "ThermalSphericPartDEMElement3D"} { + # set dem_strategy "thermal_sphere_strategy" + # } elseif {$ElementType eq "ThermalSphericContPartDEMElement3D"} { + # set dem_strategy "thermal_continuum_sphere_strategy" + # } elseif {$ElementType eq "SinteringSphericConPartDEMElement3D"} { + # set dem_strategy "thermal_continuum_sphere_strategy" + # } elseif {$ElementType eq "IceContPartDEMElement3D"} { + # set dem_strategy "ice_continuum_sphere_strategy" + # } +} + +proc ::DEM::write::GetTimeSettings { } { set result [dict create] dict set result DeltaTime [write::getValue DEMTimeParameters DeltaTime] dict set result EndTime [write::getValue DEMTimeParameters EndTime] return $result } -proc DEM::write::GetGravity { } { +proc ::DEM::write::GetGravity { } { set gravity_value [write::getValue DEMGravity GravityValue] set gravity_X [write::getValue DEMGravity Cx] set gravity_Y [write::getValue DEMGravity Cy] @@ -157,7 +158,7 @@ proc DEM::write::GetGravity { } { return [list $gx $gy $gz] } -proc DEM::write::writeParametersEvent { } { +proc ::DEM::write::writeParametersEvent { } { write::SetParallelismConfiguration write::WriteJSON [getParametersDict] } diff --git a/kratos.gid/apps/DEM/write/write_utils.tcl b/kratos.gid/apps/DEM/write/write_utils.tcl index 1efdd9104..c8d9ba38c 100644 --- a/kratos.gid/apps/DEM/write/write_utils.tcl +++ b/kratos.gid/apps/DEM/write/write_utils.tcl @@ -1,5 +1,5 @@ # utility for advanced meshing features in DEM -proc DEM::write::Elements_Substitution {} { +proc ::DEM::write::Elements_Substitution {} { set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute DEMParts]/group" @@ -236,7 +236,7 @@ proc DEM::write::Elements_Substitution {} { return $fail } -proc DEM::write::Compute_External_Elements {ndime cgroupid element_ids} { +proc ::DEM::write::Compute_External_Elements {ndime cgroupid element_ids} { set mesh_elements [GiD_EntitiesGroups get $cgroupid all_mesh] set real_mesh_elements [lindex $mesh_elements 1] @@ -279,7 +279,7 @@ proc DEM::write::Compute_External_Elements {ndime cgroupid element_ids} { return [array get is_external_element] } -proc DEM::write::Delete_Unnecessary_Elements_From_Mesh {cgroupid} { +proc ::DEM::write::Delete_Unnecessary_Elements_From_Mesh {cgroupid} { set elem_types [list line triangle quadrilateral tetrahedra hexahedra] foreach elem_type $elem_types { if {[GiD_EntitiesGroups get $cgroupid elements -count -element_type $elem_type] > 0} { @@ -288,7 +288,7 @@ proc DEM::write::Delete_Unnecessary_Elements_From_Mesh {cgroupid} { } } -proc DEM::write::Cleaning_Up_Skin_And_Removing_Isolated_Nodes {final_list_of_isolated_nodes} { +proc ::DEM::write::Cleaning_Up_Skin_And_Removing_Isolated_Nodes {final_list_of_isolated_nodes} { # GiD_EntitiesGroups unassign SKIN_SPHERE_DO_NOT_DELETE nodes # # GiD_Mesh delete element [GiD_EntitiesGroups get SKIN_SPHERE_DO_NOT_DELETE elements -element_type triangle] @@ -304,7 +304,7 @@ proc DEM::write::Cleaning_Up_Skin_And_Removing_Isolated_Nodes {final_list_of_iso } } -proc DEM::write::NormalDistribution {mean standard_deviation min_rad max_rad} { +proc ::DEM::write::NormalDistribution {mean standard_deviation min_rad max_rad} { if {$standard_deviation} { set max_iterations 1000 ; #set a maximun number of iterations to avoid an infinite loop for {set i 0} {$i < $max_iterations} {incr i} { @@ -321,7 +321,7 @@ proc DEM::write::NormalDistribution {mean standard_deviation min_rad max_rad} { return $mean } -proc DEM::write::LognormalDistribution {mean standard_deviation min_rad max_rad} { +proc ::DEM::write::LognormalDistribution {mean standard_deviation min_rad max_rad} { if {$standard_deviation} { set log_min [expr log($min_rad)] set log_max [expr log($max_rad)] @@ -332,7 +332,7 @@ proc DEM::write::LognormalDistribution {mean standard_deviation min_rad max_rad} return $mean } -proc DEM::write::Destroy_Skin_Sphere_Group {what_dempack_package} { +proc ::DEM::write::Destroy_Skin_Sphere_Group {what_dempack_package} { if {$what_dempack_package eq "G-DEMPack"} { if [GiD_Groups exists SKIN_SPHERE_DO_NOT_DELETE] { GiD_Groups delete SKIN_SPHERE_DO_NOT_DELETE @@ -343,7 +343,7 @@ proc DEM::write::Destroy_Skin_Sphere_Group {what_dempack_package} { } } -proc DEM::write::GetNodeHigherentities {node_id} { +proc ::DEM::write::GetNodeHigherentities {node_id} { set node_data [GiD_Info list_entities nodes $node_id] if {![regexp {HigherEntity: ([0-9]+)} $node_data dummy higherentity]} { set higherentity 9999; #the node does not exist, return > 0 to not delete it @@ -351,7 +351,7 @@ proc DEM::write::GetNodeHigherentities {node_id} { return $higherentity } -proc DEM::write::GetElementCenter {element_id} { +proc ::DEM::write::GetElementCenter {element_id} { set element_data [GiD_Mesh get element $element_id] set num_nodes [lindex $element_data 2] set node_ids [lrange $element_data 3 2+$num_nodes] @@ -363,7 +363,7 @@ proc DEM::write::GetElementCenter {element_id} { return [MathUtils::ScalarByVectorProd [expr {1.0/$num_nodes}] $sum] } -proc DEM::write::BeforeMeshGenerationUtils {elementsize} { +proc ::DEM::write::BeforeMeshGenerationUtils {elementsize} { # Align the normal DEM::write::AlignSurfNormals Outwards @@ -412,7 +412,7 @@ proc DEM::write::BeforeMeshGenerationUtils {elementsize} { } -proc DEM::write::AlignSurfNormals {direction} { +proc ::DEM::write::AlignSurfNormals {direction} { # ABSTRACT: Makes all of boundary surfaces' normals point inwards or outwards # Arguments # direction => Direction option ["Inwards"|"Outwards"] @@ -456,7 +456,7 @@ proc DEM::write::AlignSurfNormals {direction} { } } -proc DEM::write::CleanAutomaticConditionGroupGiD {args {fieldvalue ""}} { +proc ::DEM::write::CleanAutomaticConditionGroupGiD {args {fieldvalue ""}} { if {![GiD_Groups exists $fieldvalue]} { GiD_Groups create $fieldvalue } @@ -469,7 +469,7 @@ proc DEM::write::CleanAutomaticConditionGroupGiD {args {fieldvalue ""}} { GidUtils::UpdateWindow GROUPS } -proc DEM::write::FindBoundariesOfNonSphericElements {entity} { +proc ::DEM::write::FindBoundariesOfNonSphericElements {entity} { # ABSTRACT: Return a list containing all boundaries entities # Arguments # entity => Entity to be processed @@ -514,7 +514,7 @@ proc DEM::write::FindBoundariesOfNonSphericElements {entity} { return $boundarylist } -proc DEM::write::FindAllSurfacesOfNonSphericElements {entity} { +proc ::DEM::write::FindAllSurfacesOfNonSphericElements {entity} { # ABSTRACT: Return a list containing all boundaries entities # Arguments # entity => surface @@ -545,12 +545,13 @@ proc DEM::write::FindAllSurfacesOfNonSphericElements {entity} { return $boundarylist } -proc DEM::write::AssignGeometricalEntitiesToSkinSphere2D {} { +proc ::DEM::write::AssignGeometricalEntitiesToSkinSphere2D {} { set list_of_points [GiD_Geometry list point 1:end] set list_of_lines [GiD_Geometry list line 1:end] if {![GiD_Groups exists SKIN_SPHERE_DO_NOT_DELETE]} { GiD_Groups create SKIN_SPHERE_DO_NOT_DELETE + GiD_Groups edit state SKIN_SPHERE_DO_NOT_DELETE hidden } set points_to_add_to_skin_circles [list] @@ -563,13 +564,14 @@ proc DEM::write::AssignGeometricalEntitiesToSkinSphere2D {} { } -proc DEM::write::AssignGeometricalEntitiesToSkinSphere3D {} { +proc ::DEM::write::AssignGeometricalEntitiesToSkinSphere3D {} { set list_of_points [GiD_Geometry list point 1:end] set list_of_lines [GiD_Geometry list line 1:end] set list_of_surfaces [GiD_Geometry list surface 1:end] if {![GiD_Groups exists SKIN_SPHERE_DO_NOT_DELETE]} { GiD_Groups create SKIN_SPHERE_DO_NOT_DELETE + GiD_Groups edit state SKIN_SPHERE_DO_NOT_DELETE hidden } set points_to_add_to_skin_spheres [list] @@ -599,7 +601,7 @@ proc DEM::write::AssignGeometricalEntitiesToSkinSphere3D {} { GiD_EntitiesGroups assign SKIN_SPHERE_DO_NOT_DELETE all_geometry $total_skin_sphere_list } -proc DEM::write::GetSurfaceTypeList {surfacelist} { +proc ::DEM::write::GetSurfaceTypeList {surfacelist} { set tetrasurf [list] set hexasurf [list] @@ -628,7 +630,7 @@ proc DEM::write::GetSurfaceTypeList {surfacelist} { return [list $tetrasurf $hexasurf] } -proc DEM::write::AssignConditionToGroupGID {entity elist groupid} { +proc ::DEM::write::AssignConditionToGroupGID {entity elist groupid} { # Need New GiD_group adaptation if {![GiD_Groups exists $groupid]} { GiD_Groups create $groupid @@ -638,7 +640,7 @@ proc DEM::write::AssignConditionToGroupGID {entity elist groupid} { GidUtils::UpdateWindow GROUPS } -proc DEM::write::AssignSpecialBoundaries {entitylist} { +proc ::DEM::write::AssignSpecialBoundaries {entitylist} { #set DEMApplication "No" #catch {set DEMApplication [::xmlutils::setXml {GeneralApplicationData//c.ApplicationTypes//i.DEM} dv]} #if {$DEMApplication eq "Yes"} { @@ -673,7 +675,7 @@ proc DEM::write::AssignSpecialBoundaries {entitylist} { #} } -proc DEM::write::ForceTheMeshingOfDEMFEMWallGroups {} { +proc ::DEM::write::ForceTheMeshingOfDEMFEMWallGroups {} { set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute "DEMConditions"]/condition\[@n ='DEM-FEM-Wall'\]/group" foreach group [$root selectNodes $xp1] { @@ -687,7 +689,7 @@ proc DEM::write::ForceTheMeshingOfDEMFEMWallGroups {} { } } -proc DEM::write::ForceTheMeshingOfDEMInletGroups {} { +proc ::DEM::write::ForceTheMeshingOfDEMInletGroups {} { set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute "DEMConditions"]/condition\[@n ='Inlet'\]/group" foreach group [$root selectNodes $xp1] { @@ -701,7 +703,7 @@ proc DEM::write::ForceTheMeshingOfDEMInletGroups {} { } } -proc DEM::write::FindBoundariesOfCircularElements {entity} { +proc ::DEM::write::FindBoundariesOfCircularElements {entity} { set root [customlib::GetBaseRoot] @@ -750,7 +752,7 @@ proc DEM::write::FindBoundariesOfCircularElements {entity} { -proc DEM::write::FindBoundariesOfSphericElements {entity} { +proc ::DEM::write::FindBoundariesOfSphericElements {entity} { set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute DEMParts]/group" diff --git a/kratos.gid/apps/DEM/xml/Conditions.xml b/kratos.gid/apps/DEM/xml/Conditions.xml index d19cf2b18..bcd6445b6 100644 --- a/kratos.gid/apps/DEM/xml/Conditions.xml +++ b/kratos.gid/apps/DEM/xml/Conditions.xml @@ -2,13 +2,22 @@ - + + + + + + + + + + @@ -26,7 +35,7 @@ - + @@ -46,28 +55,28 @@ - + - + - + - + - + diff --git a/kratos.gid/apps/DEM/xml/Elements.xml b/kratos.gid/apps/DEM/xml/Elements.xml index 9b72019c4..a13712a9c 100644 --- a/kratos.gid/apps/DEM/xml/Elements.xml +++ b/kratos.gid/apps/DEM/xml/Elements.xml @@ -12,7 +12,9 @@ - + + + @@ -26,7 +28,9 @@ - + + + diff --git a/kratos.gid/apps/DEM/xml/Main.spd b/kratos.gid/apps/DEM/xml/Main.spd index fcbf4aa92..de12e931a 100644 --- a/kratos.gid/apps/DEM/xml/Main.spd +++ b/kratos.gid/apps/DEM/xml/Main.spd @@ -1,10 +1,11 @@ - + - + + diff --git a/kratos.gid/apps/DEM/xml/Materials.spd b/kratos.gid/apps/DEM/xml/Materials.spd index 4bf435d87..62d6a1e96 100644 --- a/kratos.gid/apps/DEM/xml/Materials.spd +++ b/kratos.gid/apps/DEM/xml/Materials.spd @@ -1,4 +1,4 @@ - + diff --git a/kratos.gid/apps/DEM/xml/Materials.xml b/kratos.gid/apps/DEM/xml/Materials.xml index 96cf0710c..ec2936e25 100644 --- a/kratos.gid/apps/DEM/xml/Materials.xml +++ b/kratos.gid/apps/DEM/xml/Materials.xml @@ -5,11 +5,6 @@ - - - - - @@ -19,11 +14,6 @@ - - - - - @@ -32,11 +22,6 @@ - - - - - @@ -45,11 +30,6 @@ - - - - - @@ -58,11 +38,6 @@ - - - - - @@ -71,11 +46,6 @@ - - - - - @@ -84,11 +54,6 @@ - - - - - diff --git a/kratos.gid/apps/DEM/xml/Parts.spd b/kratos.gid/apps/DEM/xml/Parts.spd index 6a4e1284b..3f6bf7382 100644 --- a/kratos.gid/apps/DEM/xml/Parts.spd +++ b/kratos.gid/apps/DEM/xml/Parts.spd @@ -1,24 +1,18 @@ - + - - - - - - + - + - + - diff --git a/kratos.gid/apps/DEM/xml/Processes.xml b/kratos.gid/apps/DEM/xml/Processes.xml index 2d06693cb..bfdbff032 100644 --- a/kratos.gid/apps/DEM/xml/Processes.xml +++ b/kratos.gid/apps/DEM/xml/Processes.xml @@ -4,11 +4,143 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -88,70 +220,69 @@ - - - - + + + + - - - - - - - + + + + + + + - - - + + + - - - - - + + + + - - + + - - - - - - - + + + + + + - - + + - - - + + + - - + + @@ -182,100 +313,18 @@ - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -284,33 +333,17 @@ - + - + - - - - + @@ -324,30 +357,41 @@ - + + + + + + + + + + + + + + + + - - - - + - - + - + diff --git a/kratos.gid/apps/DEM/xml/Results.spd b/kratos.gid/apps/DEM/xml/Results.spd index 537e9464f..52c1f6f30 100644 --- a/kratos.gid/apps/DEM/xml/Results.spd +++ b/kratos.gid/apps/DEM/xml/Results.spd @@ -16,6 +16,7 @@ + @@ -26,7 +27,6 @@ - diff --git a/kratos.gid/apps/DEM/xml/SolutionStrategy.spd b/kratos.gid/apps/DEM/xml/SolutionStrategy.spd index df65033af..1ae6239f9 100644 --- a/kratos.gid/apps/DEM/xml/SolutionStrategy.spd +++ b/kratos.gid/apps/DEM/xml/SolutionStrategy.spd @@ -23,6 +23,7 @@ + @@ -30,7 +31,7 @@ - + diff --git a/kratos.gid/apps/DEM/xml/StageInfo.spd b/kratos.gid/apps/DEM/xml/StageInfo.spd index dc6801abd..153c06733 100644 --- a/kratos.gid/apps/DEM/xml/StageInfo.spd +++ b/kratos.gid/apps/DEM/xml/StageInfo.spd @@ -1,7 +1,6 @@ - - + diff --git a/kratos.gid/apps/DEM/xml/Strategies.xml b/kratos.gid/apps/DEM/xml/Strategies.xml index 63a201d8e..5d0b503fe 100644 --- a/kratos.gid/apps/DEM/xml/Strategies.xml +++ b/kratos.gid/apps/DEM/xml/Strategies.xml @@ -1,6 +1,6 @@ - + diff --git a/kratos.gid/apps/DEM/xml/XmlController.tcl b/kratos.gid/apps/DEM/xml/XmlController.tcl index 450403b55..c7cc2b4d0 100644 --- a/kratos.gid/apps/DEM/xml/XmlController.tcl +++ b/kratos.gid/apps/DEM/xml/XmlController.tcl @@ -1,10 +1,13 @@ -namespace eval DEM::xml { +namespace eval ::DEM::xml { + namespace path ::DEM + Kratos::AddNamespace [namespace current] + variable dir } -proc DEM::xml::Init { } { +proc ::DEM::xml::Init { } { variable dir - Model::InitVariables dir $DEM::dir + Model::InitVariables dir $::DEM::dir Model::getSolutionStrategies Strategies.xml Model::getElements Elements.xml @@ -13,17 +16,14 @@ proc DEM::xml::Init { } { Model::getProcesses "../../Common/xml/Processes.xml" Model::getProcesses Processes.xml Model::getConditions Conditions.xml + Model::getMaterialRelations "material_relations/MaterialRelations.xml" } -proc DEM::xml::getUniqueName {name} { - return DEM$name +proc ::DEM::xml::getUniqueName {name} { + return [::DEM::GetAttribute prefix]$name } -proc DEM::xml::MultiAppEvent {args} { - -} - -proc DEM::xml::CustomTree { args } { +proc ::DEM::xml::CustomTree { args } { set root [customlib::GetBaseRoot] spdAux::SetValueOnTreeItem values OpenMP ParallelType spdAux::SetValueOnTreeItem state hidden DEMTimeParameters StartTime @@ -41,20 +41,18 @@ proc DEM::xml::CustomTree { args } { set custom_smp_xpath "[spdAux::getRoute DEMConditions]/condition\[@n='DEM-CustomSmp'\]/value\[@n='AdvancedMeshingFeatures'\]" gid_groups_conds::setAttributes $custom_smp_xpath [list state hidden ] - # customlib::ProcessIncludes $::Kratos::kratos_private(Path) - # spdAux::parseRoutes -} - + # Inlet 2D or 3D special parameters + set 3dinlet_xpath "[spdAux::getRoute DEMConditions]/condition\[@n='Inlet'\]/value\[@n='InletElementType'\]" + gid_groups_conds::setAttributes $3dinlet_xpath [list values "SphericParticle3D,Cluster3D,SingleSphereCluster" ] + set 2dinlet_xpath "[spdAux::getRoute DEMConditions]/condition\[@n='Inlet2D'\]/value\[@n='InletElementType'\]" + gid_groups_conds::setAttributes $2dinlet_xpath [list values "CylinderParticle2D" ] + -proc DEM::xml::InsertConstitutiveLawForParameters {input arguments} { - return { - - - - } + # spdAux::parseRoutes + spdAux::processDynamicNodes [customlib::GetBaseRoot] } -proc DEM::xml::ProcGetElements { domNode args } { +proc ::DEM::xml::ProcGetElements { domNode args } { set elems [Model::GetElements] set names [list ] set pnames [list ] @@ -75,7 +73,7 @@ proc DEM::xml::ProcGetElements { domNode args } { return $diction } -proc DEM::xml::ProcGetStateBoundingBoxParams { domNode args } { +proc ::DEM::xml::ProcGetStateBoundingBoxParams { domNode args } { set bounding_box_active [write::getValue Boundingbox UseBB ] set bounding_box_automatic [write::getValue Boundingbox AutomaticBB ] @@ -87,7 +85,7 @@ proc DEM::xml::ProcGetStateBoundingBoxParams { domNode args } { return $ret } -proc DEM::xml::ProcGetDEMPartsOvWhat { domNode args } { +proc ::DEM::xml::ProcGetDEMPartsOvWhat { domNode args } { if {$::Model::SpatialDimension eq "2D"} { return "point,line,surface" } else { @@ -96,7 +94,7 @@ proc DEM::xml::ProcGetDEMPartsOvWhat { domNode args } { } -proc DEM::xml::InertiaType { args } { +proc ::DEM::xml::InertiaType { args } { set ret inline_vector if {$::Model::SpatialDimension eq "2D"} { set ret double @@ -105,6 +103,33 @@ proc DEM::xml::InertiaType { args } { return $ret } +proc ::DEM::xml::injectMaterialRelations { basenode args } { + + set base [$basenode parent] + set materials_relations [Model::GetMaterialRelations {*}$args] + foreach mat $materials_relations { + set matname [$mat getName] + set mathelp [$mat getAttribute help] + set icon [$mat getAttribute icon] + if {$icon eq ""} {set icon material-relation-16} + set inputs [$mat getInputs] + set matnode "" + foreach {inName in} $inputs { + set node [spdAux::GetParameterValueString $in [list base $mat state [$in getAttribute state]] $mat] + append matnode $node + } + append matnode " \n" + $base appendXML $matnode + } + $basenode delete +} -DEM::xml::Init +proc ::DEM::xml::MaterialRelationsValidation { } { + set err "" + # Get Used Materials + + # At least all materials must be related + + return $err +} diff --git a/kratos.gid/apps/DEM/xml/material_relations/MaterialRelations.spd b/kratos.gid/apps/DEM/xml/material_relations/MaterialRelations.spd new file mode 100644 index 000000000..64db1844b --- /dev/null +++ b/kratos.gid/apps/DEM/xml/material_relations/MaterialRelations.spd @@ -0,0 +1,4 @@ + + + + diff --git a/kratos.gid/apps/DEM/xml/material_relations/MaterialRelations.tcl b/kratos.gid/apps/DEM/xml/material_relations/MaterialRelations.tcl new file mode 100644 index 000000000..8b2c6c33d --- /dev/null +++ b/kratos.gid/apps/DEM/xml/material_relations/MaterialRelations.tcl @@ -0,0 +1,114 @@ +################################################################################## +# This file is common for all Kratos Applications. +# Do not change anything here unless it's strictly necessary. +################################################################################## + +namespace eval ::Model { + Kratos::AddNamespace [namespace current] + +catch {MaterialRelation destroy} +oo::class create MaterialRelation { + superclass Entity + + variable Materials + + constructor {n} { + next $n + variable Materials + + set Materials [list ] + } + method setMaterials { ms } {variable Materials; set Materials $ms} + method getMaterials { } {variable Materials; return $Materials} + method addMaterial {mat} {variable Materials; lappend Materials $mat} + method getMaterial {i} {variable Materials; return [lindex $Materials $i]} +} + variable MaterialRelations + set MaterialRelations [list ] +} + + +proc ::Model::ParseMaterialRelations { doc } { + variable MaterialRelations + + set MatNodeList [$doc getElementsByTagName MaterialRelation] + foreach MatNode $MatNodeList { + set mat_rel [ParseMatRelNode $MatNode] + set ma [::Model::getMaterialRelation [$mat_rel getName] ] + if {$ma eq ""} { + lappend MaterialRelations $mat_rel + } else { + foreach input [dict values [$mat_rel getInputs]] { + $ma addInputDone $input + } + } + } +} + +proc ::Model::ParseMatRelNode { node } { + set name [$node getAttribute n] + + set mat [::Model::MaterialRelation new $name] + $mat setPublicName [$node getAttribute n] + $mat setHelp [$node getAttribute help] + + foreach att [$node attributes] { + $mat setAttribute $att [split [$node getAttribute $att] ","] + } + foreach in [[$node getElementsByTagName inputs] getElementsByTagName parameter] { + set mat [ParseInputParamNode $mat $in] + } + + return $mat +} + +proc ::Model::getMaterialRelations { MaterialRelationsFileName } { + variable dir + dom parse [tDOM::xmlReadFile [file join $dir xml $MaterialRelationsFileName]] doc + ParseMaterialRelations $doc +} + +proc ::Model::GetMaterialRelations {args} { + variable MaterialRelations + # W "Get materials $args" + set cumplen [list ] + foreach mat_rel $MaterialRelations { + # W [$mat getName] + if {[$mat_rel cumple {*}$args]} { lappend cumplen $mat_rel} + } + # W "Good materials $cumplen" + return $cumplen +} + +proc ::Model::GetMaterialRelationNames {args} { + set material_relations [list ] + foreach mat [GetMaterialRelations {*}$args] { + lappend material_relations [$mat getName] + } + return $material_relations +} + +proc ::Model::getMaterialRelation {mid} { + + foreach mat_rel [GetMaterialRelations] { + if {[$mat_rel getName] eq $mid} { return $mat_rel} + } + return "" +} + + +proc ::Model::ForgetMaterialRelations { } { + variable MaterialRelations + set MaterialRelations [list ] +} + +proc ::Model::ForgetMaterialRelation { mid } { + variable MaterialRelations + set MaterialRelations2 [list ] + foreach material_relation $MaterialRelations { + if {[$material_relation getName] ne $mid} { + lappend MaterialRelations2 $material_relation + } + } + set MaterialRelations $MaterialRelations2 +} \ No newline at end of file diff --git a/kratos.gid/apps/DEM/xml/material_relations/MaterialRelations.xml b/kratos.gid/apps/DEM/xml/material_relations/MaterialRelations.xml new file mode 100644 index 000000000..e36931836 --- /dev/null +++ b/kratos.gid/apps/DEM/xml/material_relations/MaterialRelations.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/DEM/xml/material_relations/material_relations_window.tcl b/kratos.gid/apps/DEM/xml/material_relations/material_relations_window.tcl new file mode 100644 index 000000000..e47f62f6a --- /dev/null +++ b/kratos.gid/apps/DEM/xml/material_relations/material_relations_window.tcl @@ -0,0 +1,77 @@ + +proc ::DEM::xml::ShowMaterialRelationWindow { } { + + set material_relations [GetMaterialRelationsTable] + set materials [dict keys $material_relations] + # window name + set w .gid.windowmatrel + + if {[winfo exist $w]} {destroy $w} + toplevel $w + wm withdraw $w + set x [expr [winfo rootx .gid]+[winfo width .gid]/2-[winfo width $w]/2] + set y [expr [winfo rooty .gid]+[winfo height .gid]/2-[winfo height $w]/2] + wm geom $w +$x+$y + wm transient $w .gid + InitWindow $w [_ "Kratos Multiphysics - DEM - Material Relations"] Kratos "" "" 1 + + if {[llength $materials]>0} { + set table $w.tree + ttk::treeview $table -columns $materials -displaycolumns $materials + foreach header $materials { + $table heading $header -text $header -anchor center + } + pack $table + + foreach relation_ref [dict keys $material_relations] { + set row [list] + foreach relation_check [dict keys [dict get $material_relations $relation_ref]] { + if {[dict get $material_relations $relation_ref $relation_check]} {lappend row OK} {lappend row MISSING} + } + $table insert "" end -id $relation_ref -text $relation_ref -values $row + } + } else { + set table $w.warn + ttk::label $table -text "No materials have been used yet" + pack $table + } +} + +proc ::DEM::xml::GetMaterialRelationsTable {} { + set material_relations [dict create] + + set materials [list ] + foreach mat_node [DEM::write::GetDEMUsedMaterialsNodeList] { + set mat_name [write::getValueByNode $mat_node] + if {$mat_name ni $materials} { + lappend materials $mat_name + } + } + + set relations [dict create] + + foreach relation [DEM::write::GetMaterialRelationsNodeList] { + + set mat_a [write::getValueByNode [$relation selectNodes "./value\[@n = 'MATERIAL_A'\]"]] + set mat_b [write::getValueByNode [$relation selectNodes "./value\[@n = 'MATERIAL_B'\]"]] + dict lappend relations $mat_a $mat_b + if {$mat_a ne $mat_b} { dict lappend relations $mat_b $mat_a } + } + + set length [llength $materials] + for {set i 0} { $i < $length } { incr i } { + set row [list] + set ref_mat_name [lindex $materials $i] + for {set j 0} { $j < $length } { incr j } { + set check_mat_name [lindex $materials $j] + set exists 0 + if {[dict exists $relations $ref_mat_name]} { + if {$check_mat_name in [dict get $relations $ref_mat_name]} {set exists 1} + } + dict set material_relations $ref_mat_name $check_mat_name $exists + } + } + + return $material_relations + +} \ No newline at end of file diff --git a/kratos.gid/apps/DEMLauncher/app.json b/kratos.gid/apps/DEMLauncher/app.json new file mode 100644 index 000000000..49c23c168 --- /dev/null +++ b/kratos.gid/apps/DEMLauncher/app.json @@ -0,0 +1,18 @@ +{ + "id": "DEM Launcher", + "name": "DEM", + "script_files": [ + "start.tcl" + ], + "start_script":"::DemLauncher::Init", + "requeriments":{ + "apps_exist":["DEM", "DEMPFEM", "FluidDEM", "CDEM"], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": false, + "show_toolbar": true, + "intervals": false, + "wizard": false + } +} diff --git a/kratos.gid/apps/DEMLauncher/start.tcl b/kratos.gid/apps/DEMLauncher/start.tcl index 998b73de2..bc8b9b313 100644 --- a/kratos.gid/apps/DEMLauncher/start.tcl +++ b/kratos.gid/apps/DEMLauncher/start.tcl @@ -1,11 +1,13 @@ namespace eval ::DemLauncher { + Kratos::AddNamespace [namespace current] + variable available_apps } -proc ::DemLauncher::Init { } { +proc ::DemLauncher::Init { app } { variable available_apps - set dir [apps::getMyDir "DemLauncher"] + # TODO: Get apps from json set available_apps [list DEM DEMPFEM FluidDEM CDEM] # Allow to open the tree set ::spdAux::TreeVisibility 0 @@ -25,12 +27,10 @@ proc ::DemLauncher::AppSelectorWindow { } { # } } { [$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait - set dir $::Kratos::kratos_private(Path) - set initwind .gid.win_example - if { [ winfo exist $initwind]} { - destroy $initwind - } + set initwind $::spdAux::application_window_id + spdAux::DestroyWindows + spdAux::RegisterWindow $initwind toplevel $initwind wm withdraw $initwind @@ -47,21 +47,29 @@ proc ::DemLauncher::AppSelectorWindow { } { ttk::frame $w.top ttk::label $w.top.title_text -text [_ "Select a DEM application"] - ttk::frame $w.information -relief ridge + ttk::frame $w.applications -relief ridge set i 0 foreach app $available_apps { set img [::apps::getImgFrom $app] set app_publicname [[::apps::getAppById $app] getPublicName] - set but [ttk::button $w.information.img$app -image $img -command [list ::DemLauncher::ChangeAppTo $app] ] - ttk::label $w.information.text$app -text $app_publicname - grid $w.information.img$app -column $i -row 0 - grid $w.information.text$app -column $i -row 1 + set but [ttk::button $w.applications.img$app -image $img -command [list ::DemLauncher::ChangeAppTo $app] ] + bind $w.applications.img$app {::spdAux::PlaceInformationWindowByPath %W applications} + ttk::label $w.applications.text$app -text $app_publicname + grid $w.applications.img$app -column $i -row 0 + grid $w.applications.text$app -column $i -row 1 incr i } grid $w.top grid $w.top.title_text - grid $w.information + grid $w.applications + + # Information panel + set spdAux::info_main_window_text "" + ttk::labelframe $w.info -text " Information " -relief ridge + ttk::label $w.info.text -textvariable spdAux::info_main_window_text + grid $w.info.text + grid $w.info -sticky we } } @@ -70,5 +78,3 @@ proc ::DemLauncher::ChangeAppTo {appid} { spdAux::SetSpatialDimmension undefined apps::setActiveApp $appid } - -::DemLauncher::Init diff --git a/kratos.gid/apps/DEMPFEM/app.json b/kratos.gid/apps/DEMPFEM/app.json new file mode 100644 index 000000000..744ba254b --- /dev/null +++ b/kratos.gid/apps/DEMPFEM/app.json @@ -0,0 +1,34 @@ +{ + "id": "DEMPFEM", + "name": "DEM PFEM", + "prefix": "DEMPFEM_", + "themed": false, + "kratos_name": "DEMPFEMapplication", + "dimensions": [ + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/InnerSphere.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script":"::DEMPFEM::Init", + "requeriments":{ + "apps":["DEM", "PfemFluid"], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "write": { + "coordinates": "groups" + }, + "main_launch_file": "python/MainKratos.py", + "examples": "examples/examples.xml" +} diff --git a/kratos.gid/apps/DEMPFEM/examples/InnerSphere.tcl b/kratos.gid/apps/DEMPFEM/examples/InnerSphere.tcl index 9ad1189c3..5a1dcd4cf 100644 --- a/kratos.gid/apps/DEMPFEM/examples/InnerSphere.tcl +++ b/kratos.gid/apps/DEMPFEM/examples/InnerSphere.tcl @@ -1,11 +1,15 @@ +namespace eval ::DEMPFEM::examples::InnerSphere { + namespace path ::DEMPFEM::examples + Kratos::AddNamespace [namespace current] +} -proc ::DEMPFEM::examples::InnerSphere {args} { +proc ::DEMPFEM::examples::InnerSphere::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawSquareGeometry3D + DrawGeometry3D AssignGroups3D TreeAssignation3D MeshAssignation3D @@ -19,7 +23,7 @@ proc ::DEMPFEM::examples::InnerSphere {args} { # Draw Geometry -proc DEMPFEM::examples::DrawSquareGeometry3D {args} { +proc ::DEMPFEM::examples::InnerSphere::DrawGeometry3D {args} { Kratos::ResetModel @@ -41,7 +45,7 @@ proc DEMPFEM::examples::DrawSquareGeometry3D {args} { # Group assign -proc DEMPFEM::examples::AssignGroups3D {args} { +proc ::DEMPFEM::examples::InnerSphere::AssignGroups3D {args} { # Create the groups GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -62,7 +66,7 @@ proc DEMPFEM::examples::AssignGroups3D {args} { } # Tree assign -proc DEMPFEM::examples::TreeAssignation3D {args} { +proc ::DEMPFEM::examples::InnerSphere::TreeAssignation3D {args} { set root [customlib::GetBaseRoot] set condtype surface @@ -70,7 +74,7 @@ proc DEMPFEM::examples::TreeAssignation3D {args} { # DEM - PARTS set demPart [customlib::AddConditionGroupOnXPath [spdAux::getRoute "DEMParts"] Dem] - set props [list Element SphericPartDEMElement3D ConstitutiveLaw Hertz Material DEM-DefaultMaterial] + set props [list Element SphericPartDEMElement3D] $demPart setAttribute ov $fluidtype spdAux::SetValuesOnBaseNode $demPart $props @@ -104,16 +108,7 @@ proc DEMPFEM::examples::TreeAssignation3D {args} { } -proc DEMPFEM::examples::MeshAssignation3D {} { +proc ::DEMPFEM::examples::InnerSphere::MeshAssignation3D {} { set list_vols [GiD_EntitiesGroups get Dem volumes] GiD_Process Mescape Meshing ElemType Sphere Volumes {*}$list_vols escape - -} - -proc DEMPFEM::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } } diff --git a/kratos.gid/apps/DEMPFEM/examples/examples.tcl b/kratos.gid/apps/DEMPFEM/examples/examples.tcl index feb423ec8..bd659f0a8 100644 --- a/kratos.gid/apps/DEMPFEM/examples/examples.tcl +++ b/kratos.gid/apps/DEMPFEM/examples/examples.tcl @@ -1,15 +1,13 @@ -namespace eval DEMPFEM::examples { +namespace eval ::DEMPFEM::examples { + namespace path ::DEMPFEM + Kratos::AddNamespace [namespace current] } -proc DEMPFEM::examples::Init { } { - uplevel #0 [list source [file join $::DEMPFEM::dir examples InnerSphere.tcl]] +proc ::DEMPFEM::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} + } } - -proc DEMPFEM::examples::UpdateMenus { } { - GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Heated square" ] 8 PRE [list ::DEMPFEM::examples::InnerSphere] "" "" insertafter = - GiDMenu::UpdateMenus -} - -DEMPFEM::examples::Init \ No newline at end of file diff --git a/kratos.gid/apps/DEMPFEM/examples/examples.xml b/kratos.gid/apps/DEMPFEM/examples/examples.xml new file mode 100644 index 000000000..a85f04e7e --- /dev/null +++ b/kratos.gid/apps/DEMPFEM/examples/examples.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/DEMPFEM/images/InnerSphere.png b/kratos.gid/apps/DEMPFEM/images/InnerSphere.png new file mode 100644 index 000000000..943b56996 Binary files /dev/null and b/kratos.gid/apps/DEMPFEM/images/InnerSphere.png differ diff --git a/kratos.gid/apps/DEMPFEM/python/MainKratos.py b/kratos.gid/apps/DEMPFEM/python/MainKratos.py index cad6ceab9..d5378e520 100644 --- a/kratos.gid/apps/DEMPFEM/python/MainKratos.py +++ b/kratos.gid/apps/DEMPFEM/python/MainKratos.py @@ -4,17 +4,15 @@ # Some parts of the original fluid script have been kept practically untouched and are clearly marked. # Whenever a minor modification has been made on one of these parts, the corresponding line is indicated with a comment: # MOD. -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - # Kratos import KratosMultiphysics as Kratos from KratosMultiphysics import Model, Parameters import KratosMultiphysics.FluidDynamicsApplication import KratosMultiphysics.DEMApplication import KratosMultiphysics.SwimmingDEMApplication as SDEM -import KratosMultiphysics.SolidMechanicsApplication +# import KratosMultiphysics.SolidMechanicsApplication import KratosMultiphysics.PfemFluidDynamicsApplication -import KratosMultiphysics.ExternalSolversApplication +import KratosMultiphysics.LinearSolversApplication from KratosMultiphysics.SwimmingDEMApplication.swimming_DEM_PFEM_analysis import SDEMPFEMAnalysis diff --git a/kratos.gid/apps/DEMPFEM/start.tcl b/kratos.gid/apps/DEMPFEM/start.tcl index d3c17fea7..43cf83129 100644 --- a/kratos.gid/apps/DEMPFEM/start.tcl +++ b/kratos.gid/apps/DEMPFEM/start.tcl @@ -1,47 +1,25 @@ namespace eval ::DEMPFEM { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir - variable prefix - variable attributes - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::DEMPFEM::Init { } { +proc ::DEMPFEM::Init { app } { # Variable initialization variable dir - variable prefix - variable kratos_name - variable attributes - - set attributes [dict create] - set kratos_name DEMPFEMapplication + variable _app set dir [apps::getMyDir "DEMPFEM"] set prefix DEMPFEM_ - set ::spdAux::TreeVisibility 0 - - apps::LoadAppById "DEM" - apps::LoadAppById "PfemFluid" - - # Intervals - dict set attributes UseIntervals 1 - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - - set ::Model::ValidSpatialDimensions [list 3D] - LoadMyFiles - # ::spdAux::CreateDimensionWindow -} - -proc ::DEMPFEM::LoadMyFiles { } { - variable dir - - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - uplevel #0 [list source [file join $dir examples examples.tcl]] + DEMPFEM::xml::Init + DEMPFEM::write::Init } proc ::DEMPFEM::BeforeMeshGeneration {elementsize} { @@ -52,16 +30,6 @@ proc ::DEMPFEM::AfterMeshGeneration {fail} { ::DEM::AfterMeshGeneration $fail } -proc ::DEMPFEM::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value +proc ::DEMPFEM::AfterSaveModel {filespd} { + ::DEM::AfterSaveModel $filespd } - -proc ::DEMPFEM::CustomToolbarItems { } { - variable dir - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::DEMPFEM::examples::InnerSphere] [= "Example\nInnerSphere"] -} - -::DEMPFEM::Init diff --git a/kratos.gid/apps/DEMPFEM/write/write.tcl b/kratos.gid/apps/DEMPFEM/write/write.tcl index 309e56e45..06bd2894b 100644 --- a/kratos.gid/apps/DEMPFEM/write/write.tcl +++ b/kratos.gid/apps/DEMPFEM/write/write.tcl @@ -1,9 +1,11 @@ namespace eval ::DEMPFEM::write { + namespace path ::DEMPFEM + Kratos::AddNamespace [namespace current] } proc ::DEMPFEM::write::Init { } { - SetAttribute main_script_file "MainKratos.py" + SetAttribute main_launch_file [GetAttribute main_launch_file] } @@ -17,16 +19,10 @@ proc DEMPFEM::write::writeModelPartEvent { } { set DEM::write::delete_previous_mdpa 0 DEM::write::writeModelPartEvent -} -proc DEMPFEM::write::writeCustomFilesEvent { } { - SetAttribute main_script_file "MainKratos.py" - set orig_name [GetAttribute main_script_file] - write::CopyFileIntoModel [file join "python" $orig_name ] - } -proc DEMPFEM::write::WriteMaterialsFile { } { - +proc ::DEMPFEM::write::writeCustomFilesEvent { } { + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] } proc DEMPFEM::write::SetAttribute {att val} { diff --git a/kratos.gid/apps/DEMPFEM/xml/Main.spd b/kratos.gid/apps/DEMPFEM/xml/Main.spd index 7f2ae3a4f..00db06a74 100644 --- a/kratos.gid/apps/DEMPFEM/xml/Main.spd +++ b/kratos.gid/apps/DEMPFEM/xml/Main.spd @@ -17,7 +17,7 @@ - + diff --git a/kratos.gid/apps/DEMPFEM/xml/Procs.spd b/kratos.gid/apps/DEMPFEM/xml/Procs.spd index c4d9aed19..bf6325c03 100644 --- a/kratos.gid/apps/DEMPFEM/xml/Procs.spd +++ b/kratos.gid/apps/DEMPFEM/xml/Procs.spd @@ -84,5 +84,11 @@ return [PfemFluid::xml::ProcCheckNodalConditionStatePFEM $domNode $args] ]]> + + + + \ No newline at end of file diff --git a/kratos.gid/apps/DEMPFEM/xml/XmlController.tcl b/kratos.gid/apps/DEMPFEM/xml/XmlController.tcl index 7eeaaaa50..1b05075fe 100644 --- a/kratos.gid/apps/DEMPFEM/xml/XmlController.tcl +++ b/kratos.gid/apps/DEMPFEM/xml/XmlController.tcl @@ -1,22 +1,22 @@ -namespace eval DEMPFEM::xml { +namespace eval ::DEMPFEM::xml { # Namespace variables declaration - variable dir + namespace path ::DEMPFEM + Kratos::AddNamespace [namespace current] } -proc DEMPFEM::xml::Init { } { +proc ::DEMPFEM::xml::Init { } { # Namespace variables initialization - variable dir - Model::InitVariables dir $DEMPFEM::dir + Model::InitVariables dir $::DEMPFEM::dir Model::ForgetElement SphericPartDEMElement3D Model::getElements Elements.xml } -proc DEMPFEM::xml::getUniqueName {name} { +proc ::DEMPFEM::xml::getUniqueName {name} { return ${::DEMPFEM::prefix}${name} } -proc DEMPFEM::xml::CustomTree { args } { +proc ::DEMPFEM::xml::CustomTree { args } { DEM::xml::CustomTree PfemFluid::xml::CustomTree spdAux::SetValueOnTreeItem values Fluid PFEMFLUID_DomainType @@ -27,7 +27,4 @@ proc DEMPFEM::xml::CustomTree { args } { if { $result_node ne "" } {$result_node delete} set result_node [$root selectNodes "[spdAux::getRoute DEMStratSection]/container\[@n = 'DEMGravity'\]"] if { $result_node ne "" } {$result_node delete} - } - -DEMPFEM::xml::Init diff --git a/kratos.gid/apps/Dam/app.json b/kratos.gid/apps/Dam/app.json new file mode 100644 index 000000000..713a4f4dd --- /dev/null +++ b/kratos.gid/apps/Dam/app.json @@ -0,0 +1,52 @@ +{ + "id": "DAM", + "name": "DAM", + "prefix": "Dam", + "themed": false, + "kratos_name": "DamApplication", + "python_packages": [ + "KratosDamApplication" + ], + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/ThermoMechaDam2D.tcl", + "examples/ThermoMechaDam3D.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script":"::Dam::Init", + "requeriments":{ + "apps":[], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false, + "import_files":true + }, + "unique_names": { + "parts": "DamParts", + "nodal_conditions": "DamNodalConditions", + "conditions": "DamLoads", + "thermal_conditions": "DamThermalLoads", + "materials": "DamMaterials", + "results": "Results", + "time_parameters": "DamTimeParameters" + }, + "write": { + "coordinates": "all", + "materials_file": "FluidMaterials.json", + "properties_location": "mdpa", + "model_part_name": "MainModelPart" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} diff --git a/kratos.gid/apps/Dam/examples/ThermoMechaDam2D.tcl b/kratos.gid/apps/Dam/examples/ThermoMechaDam2D.tcl index 34fd5f2b1..444784701 100644 --- a/kratos.gid/apps/Dam/examples/ThermoMechaDam2D.tcl +++ b/kratos.gid/apps/Dam/examples/ThermoMechaDam2D.tcl @@ -1,18 +1,28 @@ +namespace eval ::Dam::examples::ThermoMechaDam2D { + namespace path ::Dam::examples + Kratos::AddNamespace [namespace current] -proc ::Dam::examples::ThermoMechaDam2D {args} { +} + +proc ::Dam::examples::ThermoMechaDam2D::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } - DrawDamGeometry2D - AssignGroupsDam2D - AssignDamMeshSizes2D - TreeAssignationDam2D + DrawGeometry + AssignGroups + AssignMeshSizes + TreeAssignation GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS GidUtils::UpdateWindow LAYER } -proc Dam::examples::DrawDamGeometry2D {args} { - +proc ::Dam::examples::ThermoMechaDam2D::DrawGeometry {args} { + Kratos::ResetModel GiD_Layers create Dam GiD_Layers edit to_use Dam @@ -41,7 +51,7 @@ proc Dam::examples::DrawDamGeometry2D {args} { 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 ] @@ -49,7 +59,7 @@ proc Dam::examples::DrawDamGeometry2D {args} { foreach {x y z} $soil_coordinates { lappend soilPoints [GiD_Geometry create point append Soil $x $y $z] } - + ## Lines ## set soilLines [list ] set initial [lindex $damPoints 0] @@ -58,60 +68,60 @@ proc Dam::examples::DrawDamGeometry2D {args} { set initial $point } lappend soilLines [GiD_Geometry create line append stline Soil $initial [lindex $damPoints 1]] - - + + lappend soilLines 1 - + ## Surface ## GiD_Process Mescape Geometry Create NurbsSurface {*}$soilLines escape escape - + GiD_Process 'Zoom Frame - + } -proc Dam::examples::AssignGroupsDam2D {args} { - +proc ::Dam::examples::ThermoMechaDam2D::AssignGroups {args} { + # Create the groups GiD_Groups create Dam 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 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_EntitiesGroups assign Uniform lines {3 2 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} } -proc Dam::examples::AssignDamMeshSizes2D {args} { - +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 @@ -119,7 +129,7 @@ proc Dam::examples::AssignDamMeshSizes2D {args} { } # Tree assign -proc Dam::examples::TreeAssignationDam2D {args} { +proc ::Dam::examples::ThermoMechaDam2D::TreeAssignation {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -132,20 +142,20 @@ proc Dam::examples::TreeAssignationDam2D {args} { set damNode [customlib::AddConditionGroupOnXPath $damParts Dam] 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 - + # Displacements set damDirichletConditions [spdAux::getRoute "DamNodalConditions"] set displacement "$damDirichletConditions/condition\[@n='DISPLACEMENT'\]" set displacemnetnode [customlib::AddConditionGroupOnXPath $displacement Displacement] - - # Surface Temperature + + # Surface Temperature set initial "$damDirichletConditions/condition\[@n='INITIALTEMPERATURE'\]" set initialnode [customlib::AddConditionGroupOnXPath $initial Initial] set props_initial [list is_fixed 0 value 7.5 ] @@ -156,36 +166,36 @@ proc Dam::examples::TreeAssignationDam2D {args} { 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 - + # 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 - - + + # Thermal Load Conditions - + # Thermal Parameters 1 set damThermalLoadConditions [spdAux::getRoute "DamThermalLoads"] set thermalparameter "$damThermalLoadConditions/condition\[@n='ThermalParameters2D'\]" set thermalparameternode1 [customlib::AddConditionGroupOnXPath $thermalparameter Thermal_Parameters_1] - + # 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 - + # 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 - - + + # Solution spdAux::SetValueOnTreeItem v "Days" DamTimeScale diff --git a/kratos.gid/apps/Dam/examples/ThermoMechaDam3D.tcl b/kratos.gid/apps/Dam/examples/ThermoMechaDam3D.tcl index 9dbda459d..5bd67d958 100644 --- a/kratos.gid/apps/Dam/examples/ThermoMechaDam3D.tcl +++ b/kratos.gid/apps/Dam/examples/ThermoMechaDam3D.tcl @@ -1,21 +1,26 @@ +namespace eval ::Dam::examples::ThermoMechaDam3D { + namespace path ::Dam::examples + Kratos::AddNamespace [namespace current] -proc ::Dam::examples::ThermoMechaDam3D {args} { +} + +proc ::Dam::examples::ThermoMechaDam3D::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawDamGeometry3D - AssignGroupsDam3D - AssignDamMeshSizes3D - TreeAssignationDam3D + DrawGeometry + AssignGroups + AssignMeshSizes + TreeAssignation GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS GidUtils::UpdateWindow LAYER } -proc Dam::examples::DrawDamGeometry3D {args} { +proc ::Dam::examples::ThermoMechaDam3D::DrawGeometry {args} { Kratos::ResetModel GiD_Layers create Ground @@ -64,7 +69,7 @@ proc Dam::examples::DrawDamGeometry3D {args} { } -proc Dam::examples::AssignGroupsDam3D {args} { +proc ::Dam::examples::ThermoMechaDam3D::AssignGroups {args} { # Create the groups GiD_Groups create Dam @@ -90,7 +95,7 @@ proc Dam::examples::AssignGroupsDam3D {args} { } -proc Dam::examples::AssignDamMeshSizes3D {args} { +proc ::Dam::examples::ThermoMechaDam3D::AssignMeshSizes {args} { set dam_mesh_size 2 GiD_Process Mescape Meshing AssignSizes volumes $dam_mesh_size [GiD_EntitiesGroups get Dam volumes] escape escape @@ -99,7 +104,7 @@ proc Dam::examples::AssignDamMeshSizes3D {args} { } # Tree assign -proc Dam::examples::TreeAssignationDam3D {args} { +proc ::Dam::examples::ThermoMechaDam3D::TreeAssignation {args} { set nd 3D set root [customlib::GetBaseRoot] diff --git a/kratos.gid/apps/Dam/examples/examples.tcl b/kratos.gid/apps/Dam/examples/examples.tcl index 5e4859822..9b8a2c51e 100644 --- a/kratos.gid/apps/Dam/examples/examples.tcl +++ b/kratos.gid/apps/Dam/examples/examples.tcl @@ -1,22 +1,5 @@ -namespace eval Dam::examples { +namespace eval ::Dam::examples { + namespace path ::Dam + Kratos::AddNamespace [namespace current] } - -proc Dam::examples::Init { } { - uplevel #0 [list source [file join $::Dam::dir examples ThermoMechaDam2D.tcl]] - uplevel #0 [list source [file join $::Dam::dir examples ThermoMechaDam3D.tcl]] - GiDMenu::InsertOption "Kratos" [list "---"] 6 PRE "" "" "" replace = - GiDMenu::InsertOption "Kratos" [list "Thermo-Mechanical Dam" ] 7 PRE [list ::Dam::examples::ThermoMechaDam] "" "" replace = - GiDMenu::UpdateMenus -} - -proc ::Dam::examples::ThermoMechaDam { } { - W $::Model::SpatialDimension - if {$::Model::SpatialDimension eq "2D"} { - ::Dam::examples::ThermoMechaDam2D - } { - ::Dam::examples::ThermoMechaDam3D - } -} - -Dam::examples::Init diff --git a/kratos.gid/apps/Dam/examples/examples.xml b/kratos.gid/apps/Dam/examples/examples.xml new file mode 100644 index 000000000..520fd7423 --- /dev/null +++ b/kratos.gid/apps/Dam/examples/examples.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/Dam/images/ThermoMechaDam2D.png b/kratos.gid/apps/Dam/images/ThermoMechaDam2D.png new file mode 100644 index 000000000..f0bb18f83 Binary files /dev/null and b/kratos.gid/apps/Dam/images/ThermoMechaDam2D.png differ diff --git a/kratos.gid/apps/Dam/images/ThermoMechaDam3D.png b/kratos.gid/apps/Dam/images/ThermoMechaDam3D.png new file mode 100644 index 000000000..074fccdee Binary files /dev/null and b/kratos.gid/apps/Dam/images/ThermoMechaDam3D.png differ diff --git a/kratos.gid/apps/Dam/python/MainKratosDam.py b/kratos.gid/apps/Dam/python/MainKratos.py similarity index 99% rename from kratos.gid/apps/Dam/python/MainKratosDam.py rename to kratos.gid/apps/Dam/python/MainKratos.py index fe7202c8b..ffa6a714b 100644 --- a/kratos.gid/apps/Dam/python/MainKratosDam.py +++ b/kratos.gid/apps/Dam/python/MainKratos.py @@ -1,5 +1,3 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - # Time monitoring import time as timer print(timer.ctime()) diff --git a/kratos.gid/apps/Dam/python/dam_acoustic_script.py b/kratos.gid/apps/Dam/python/dam_acoustic_script.py index 8f522952f..6a94420cf 100644 --- a/kratos.gid/apps/Dam/python/dam_acoustic_script.py +++ b/kratos.gid/apps/Dam/python/dam_acoustic_script.py @@ -1,5 +1,3 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - # Time monitoring import time as timer print(timer.ctime()) @@ -12,7 +10,7 @@ # Import kratos core and applications import KratosMultiphysics -import KratosMultiphysics.ExternalSolversApplication as KratosSolvers +import KratosMultiphysics.LinearSolversApplication as KratosSolvers #import KratosMultiphysics.TrilinosApplication as TrilinosApplication import KratosMultiphysics.ConvectionDiffusionApplication as KratosConvDiff import KratosMultiphysics.SolidMechanicsApplication as KratosSolid diff --git a/kratos.gid/apps/Dam/python/dam_eigen_script.py b/kratos.gid/apps/Dam/python/dam_eigen_script.py index ecb244c9f..3741f92c4 100644 --- a/kratos.gid/apps/Dam/python/dam_eigen_script.py +++ b/kratos.gid/apps/Dam/python/dam_eigen_script.py @@ -1,5 +1,3 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - # Time monitoring import time as timer print(timer.ctime()) @@ -12,7 +10,7 @@ # Import kratos core and applications import KratosMultiphysics -import KratosMultiphysics.ExternalSolversApplication as KratosSolvers +import KratosMultiphysics.LinearSolversApplication as KratosSolvers #import KratosMultiphysics.TrilinosApplication as TrilinosApplication import KratosMultiphysics.SolidMechanicsApplication as KratosSolid import KratosMultiphysics.DamApplication as KratosDam @@ -135,7 +133,7 @@ for process in list_of_processes: process.ExecuteBeforeOutputStep() - + for process in list_of_processes: process.ExecuteAfterOutputStep() @@ -155,7 +153,7 @@ for process in list_of_processes: process.ExecuteFinalize() - + # Time control print("Analysis Completed. Elapsed Time = %.3f" % (timer.perf_counter() - initial_time)," seconds.") diff --git a/kratos.gid/apps/Dam/python/dam_main.py b/kratos.gid/apps/Dam/python/dam_main.py index 5084fdda1..4d5925c0e 100644 --- a/kratos.gid/apps/Dam/python/dam_main.py +++ b/kratos.gid/apps/Dam/python/dam_main.py @@ -1,5 +1,3 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - # Time monitoring import time as timer print(timer.ctime()) @@ -12,7 +10,7 @@ # Import kratos core and applications import KratosMultiphysics -import KratosMultiphysics.ExternalSolversApplication as KratosSolvers +import KratosMultiphysics.LinearSolversApplication as KratosSolvers #import KratosMultiphysics.TrilinosApplication as TrilinosApplication import KratosMultiphysics.ConvectionDiffusionApplication as KratosConvDiff import KratosMultiphysics.SolidMechanicsApplication as KratosSolid diff --git a/kratos.gid/apps/Dam/python/dam_main_construction.py b/kratos.gid/apps/Dam/python/dam_main_construction.py index 6bbecbc13..523306875 100644 --- a/kratos.gid/apps/Dam/python/dam_main_construction.py +++ b/kratos.gid/apps/Dam/python/dam_main_construction.py @@ -1,5 +1,3 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - # Time monitoring import time as timer print(timer.ctime()) @@ -12,7 +10,7 @@ # Import kratos core and applications import KratosMultiphysics -import KratosMultiphysics.ExternalSolversApplication as KratosSolvers +import KratosMultiphysics.LinearSolversApplication as KratosSolvers #import KratosMultiphysics.TrilinosApplication as TrilinosApplication import KratosMultiphysics.ConvectionDiffusionApplication as KratosConvDiff import KratosMultiphysics.SolidMechanicsApplication as KratosSolid @@ -129,7 +127,7 @@ computing_model_part = solver.GetComputingModelPart() # Sacar de aqui un los computing model parts con otra funcion thermal_computing_model_part = solver.GetComputingThermalModelPart() -# Importing construction utility +# Importing construction utility import dam_construction_utility construction_utilities = dam_construction_utility.DamConstructionUtility(computing_model_part, thermal_computing_model_part, ProjectParameters["construction_process"]) diff --git a/kratos.gid/apps/Dam/python/dam_main_selfweight.py b/kratos.gid/apps/Dam/python/dam_main_selfweight.py index 44b128388..85427d4bc 100644 --- a/kratos.gid/apps/Dam/python/dam_main_selfweight.py +++ b/kratos.gid/apps/Dam/python/dam_main_selfweight.py @@ -1,5 +1,3 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - # Time monitoring import time as timer print(timer.ctime()) @@ -12,7 +10,7 @@ # Import kratos core and applications import KratosMultiphysics -import KratosMultiphysics.ExternalSolversApplication as KratosSolvers +import KratosMultiphysics.LinearSolversApplication as KratosSolvers #import KratosMultiphysics.TrilinosApplication as TrilinosApplication import KratosMultiphysics.ConvectionDiffusionApplication as KratosConvDiff import KratosMultiphysics.SolidMechanicsApplication as KratosSolid @@ -124,7 +122,7 @@ # Getting gravity direction direction_selfweight = ProjectParameters["problem_data"]["selfweight_direction"].GetString() - if(direction_selfweight == "X"): + if(direction_selfweight == "X"): variable_name = KratosMultiphysics.VOLUME_ACCELERATION_X elif(direction_selfweight == "Y"): variable_name = KratosMultiphysics.VOLUME_ACCELERATION_Y diff --git a/kratos.gid/apps/Dam/start.tcl b/kratos.gid/apps/Dam/start.tcl index 551d57d1e..69c67cc4a 100644 --- a/kratos.gid/apps/Dam/start.tcl +++ b/kratos.gid/apps/Dam/start.tcl @@ -1,39 +1,22 @@ namespace eval ::Dam { + Kratos::AddNamespace [namespace current] # Variable declaration variable dir - variable kratos_name -} + variable _app -proc ::Dam::Init { } { - # Variable initialization - variable dir - variable kratos_name - set kratos_name "DamApplication" - - set dir [apps::getMyDir "Dam"] - set ::Model::ValidSpatialDimensions [list 2D 3D] - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - LoadMyFiles - ::spdAux::CreateDimensionWindow - + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::Dam::LoadMyFiles { } { +proc ::Dam::Init { app } { + # Variable initialization variable dir + variable _app - uplevel #0 [list source [file join $dir xml GetFromXML.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - uplevel #0 [list source [file join $dir examples examples.tcl]] -} - + set dir [apps::getMyDir "Dam"] + set _app $app -proc ::Dam::CustomToolbarItems { } { - variable dir - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Dam::examples::ThermoMechaDam] [= "Example\nThermo-mechanical Dam"] + ::Dam::xml::Init + ::Dam::write::Init } - - -::Dam::Init diff --git a/kratos.gid/apps/Dam/write/write.tcl b/kratos.gid/apps/Dam/write/write.tcl index 4117f6065..bda8687c5 100644 --- a/kratos.gid/apps/Dam/write/write.tcl +++ b/kratos.gid/apps/Dam/write/write.tcl @@ -1,4 +1,7 @@ -namespace eval Dam::write { +namespace eval ::Dam::write { + namespace path ::Dam + Kratos::AddNamespace [namespace current] + variable ConditionsDictGroupIterators variable NodalConditionsGroup variable TableDict @@ -9,7 +12,7 @@ namespace eval Dam::write { variable number_tables } -proc Dam::write::Init { } { +proc ::Dam::write::Init { } { # Namespace variables inicialization variable ConditionsDictGroupIterators variable NodalConditionsGroup @@ -20,27 +23,23 @@ proc Dam::write::Init { } { catch {unset TableDict} set TableDict [dict create] - SetAttribute parts_un DamParts - SetAttribute nodal_conditions_un DamNodalConditions - SetAttribute conditions_un DamLoads - SetAttribute thermal_conditions_un DamThermalLoads - SetAttribute materials_un DamMaterials - SetAttribute results_un Results - SetAttribute time_parameters_un DamTimeParameters - SetAttribute writeCoordinatesByGroups 0 - SetAttribute validApps [list "Dam"] - SetAttribute main_script_file "MainKratosDam.py" - SetAttribute properties_location mdpa - SetAttribute model_part_name "MainModelPart" -} + SetAttribute parts_un [::Dam::GetUniqueName parts] + SetAttribute nodal_conditions_un [::Dam::GetUniqueName nodal_conditions] + SetAttribute conditions_un [::Dam::GetUniqueName conditions] + SetAttribute thermal_conditions_un [::Dam::GetUniqueName thermal_conditions] + SetAttribute materials_un [::Dam::GetUniqueName materials] + SetAttribute results_un [::Dam::GetUniqueName results] + SetAttribute time_parameters_un [::Dam::GetUniqueName time_parameters] -proc Dam::write::writeCustomFilesEvent { } { - write::CopyFileIntoModel "python/MainKratosDam.py" - write::RenameFileInModel "MainKratosDam.py" "MainKratos.py" + SetAttribute writeCoordinatesByGroups [::Dam::GetWriteProperty coordinates] + SetAttribute validApps [list "Dam"] + SetAttribute main_launch_file [::Dam::GetAttribute main_launch_file] + SetAttribute properties_location [::Dam::GetWriteProperty properties_location] + SetAttribute model_part_name [::Dam::GetWriteProperty model_part_name] } # MDPA Blocks -proc Dam::write::writeModelPartEvent { } { +proc ::Dam::write::writeModelPartEvent { } { # Init data write::initWriteConfiguration [GetAttributes] @@ -64,7 +63,7 @@ proc Dam::write::writeModelPartEvent { } { Dam::write::writeMeshes } -proc Dam::write::UpdateMaterials { } { +proc ::Dam::write::UpdateMaterials { } { set matdict [write::getMatDict] foreach {mat props} $matdict { set constlaw [dict get $props ConstitutiveLaw] @@ -75,34 +74,29 @@ proc Dam::write::UpdateMaterials { } { dict set matdict $mat THICKNESS 1.0000E+00 set newconstlaw "BilinearCohesive2DLaw" } - if {$constlaw eq "SimplifiedBilinear2DPlaneStress"} {set newconstlaw "SimplifiedBilinear2DLaw"} - if {$constlaw eq "SimplifiedBilinear2DPlaneStrain"} { - dict set matdict $mat THICKNESS 1.0000E+00 - set newconstlaw "SimplifiedBilinear2DLaw" - } dict set matdict $mat CONSTITUTIVE_LAW_NAME $newconstlaw } write::setMatDict $matdict } -proc Dam::write::writeConditions { } { +proc ::Dam::write::writeConditions { } { variable ConditionsDictGroupIterators - set ConditionsDictGroupIterators [write::writeConditions "DamLoads"] + set ConditionsDictGroupIterators [::write::writeConditions [GetAttribute conditions_un]] set pairs [lsort -increasing -index end [dict values $ConditionsDictGroupIterators] ] set index [lindex [lindex [lsort -integer -index 0 $pairs] end] end] if {$index eq ""} { set index 0 } - set ThermalConditionGroups [write::writeConditions "DamThermalLoads" $index] + set ThermalConditionGroups [::write::writeConditions [GetAttribute thermal_conditions_un] $index] set ConditionsDictGroupIterators [dict merge $ConditionsDictGroupIterators $ThermalConditionGroups] - set SelfweightConditionGroups [write::writeConditions "DamSelfweight" $index] + set SelfweightConditionGroups [::write::writeConditions "DamSelfweight" $index] set ConditionsDictGroupIterators [dict merge $ConditionsDictGroupIterators $SelfweightConditionGroups] } -proc Dam::write::writeMeshes { } { +proc ::Dam::write::writeMeshes { } { write::writePartSubModelPart @@ -112,17 +106,15 @@ proc Dam::write::writeMeshes { } { } # Solo Malla , no en conditions - writeNodalConditions "DamNodalConditions" + writeNodalConditions [GetAttribute nodal_conditions_un] # A Condition y a meshes-> salvo lo que no tenga topologia - writeLoads "DamLoads" - writeLoads "DamThermalLoads" - writeLoads "DamSelfweight" + writeLoads [GetAttribute conditions_un] + writeLoads [GetAttribute thermal_conditions_un] + writeLoads [GetAttribute nodal_conditions_un] } - - -proc Dam::write::writeNodalConditions { keyword } { +proc ::Dam::write::writeNodalConditions { keyword } { variable TableDict set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute $keyword]/condition/group" @@ -146,7 +138,7 @@ proc Dam::write::writeNodalConditions { keyword } { } } -proc Dam::write::writeLoads { baseUN } { +proc ::Dam::write::writeLoads { baseUN } { variable TableDict variable ConditionsDictGroupIterators set root [customlib::GetBaseRoot] @@ -170,7 +162,7 @@ proc Dam::write::writeLoads { baseUN } { } } -proc Dam::write::getVariableNameList {un {condition_type "Condition"}} { +proc ::Dam::write::getVariableNameList {un {condition_type "Condition"}} { set xp1 "[spdAux::getRoute $un]/condition/group" set groups [[customlib::GetBaseRoot] selectNodes $xp1] @@ -192,7 +184,7 @@ proc Dam::write::getVariableNameList {un {condition_type "Condition"}} { return $variable_list } -proc Dam::write::GetTableidFromFileid { filename } { +proc ::Dam::write::GetTableidFromFileid { filename } { variable TableDict foreach condid [dict keys $TableDict] { foreach groupid [dict keys [dict get $TableDict $condid]] { @@ -206,7 +198,7 @@ proc Dam::write::GetTableidFromFileid { filename } { return 0 } -proc Dam::write::writeTables { } { +proc ::Dam::write::writeTables { } { variable TableDict set printed_tables [list ] foreach table [GetPrinTables] { @@ -229,7 +221,7 @@ proc Dam::write::writeTables { } { } } -proc Dam::write::writeTables_dev { } { +proc ::Dam::write::writeTables_dev { } { set printed_tables [list ] foreach table [GetPrinTables_dev] { @@ -251,14 +243,14 @@ proc Dam::write::writeTables_dev { } { } -proc Dam::write::GetPrinTables {} { +proc ::Dam::write::GetPrinTables {} { set root [customlib::GetBaseRoot] - FileSelector::CopyFilesIntoModel [file join [GiD_Info project ModelName] ".gid"] + if {$Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file join [GiD_Info project ModelName] ".gid"]} set listaTablas [list ] set listaFiles [list ] set num 0 - set origins [list "DamLoads" "DamThermalLoads" "DamNodalConditions" "DamSelfweight"] + set origins [list [GetAttribute conditions_un] [GetAttribute thermal_conditions_un] [GetAttribute nodal_conditions_un] "DamSelfweight"] foreach unique_name $origins { set xpathCond "[spdAux::getRoute $unique_name]/condition/group/value\[@type='tablefile'\]" foreach node [$root selectNodes $xpathCond] { @@ -266,8 +258,8 @@ proc Dam::write::GetPrinTables {} { set valueid [get_domnode_attribute $node n] set groupid [get_domnode_attribute [$node parent] n] set condid [get_domnode_attribute [[$node parent] parent] n] - #W $condid - if {$fileid ni [list "" "- No file"]} { + # W $fileid + if {$fileid ni [list "" "- No file" $::spdAux::no_file_string]} { if {$fileid ni $listaFiles} { lappend listaFiles $fileid incr num @@ -287,11 +279,10 @@ proc Dam::write::GetPrinTables {} { return $listaTablas } - -proc Dam::write::GetPrinTables_dev { } { +proc ::Dam::write::GetPrinTables_dev { } { set root [customlib::GetBaseRoot] - FileSelector::CopyFilesIntoModel [file join [GiD_Info project ModelName] ".gid"] + if {$Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file join [GiD_Info project ModelName] ".gid"]} set listaTablas2 [list ] set listaFiles2 [list ] set num [llength [GetPrinTables]] @@ -305,7 +296,7 @@ proc Dam::write::GetPrinTables_dev { } { set node_table_device [$root selectNodes $table_device] set fileid [write::getValueByNode $node_table_device] - if {$fileid ni [list "" "- No file"]} { + if {$fileid ni [list "" "- No file" $::spdAux::no_file_string]} { if {$fileid ni $listaFiles2} { lappend listaFiles2 $fileid incr num @@ -324,17 +315,18 @@ proc Dam::write::GetPrinTables_dev { } { return $listaTablas2 } - #------------------------------------------------------------------------------- -proc Dam::write::writeThermalElements {} { +proc ::Dam::write::writeThermalElements {} { set ThermalGroups [list] - set mat_dict [write::getMatDict] - foreach part_name [dict keys $mat_dict] { - if {[[Model::getElement [dict get $mat_dict $part_name Element]] getAttribute "ElementType"] eq "Solid"} { - lappend ThermalGroups $part_name + foreach node_part [GetDamPartGroupNodes] { + set element_id [write::getValueByNode [$node_part selectNodes "./value\[@n='Element'\]"] ] + set element [Model::getElement $element_id] + set element_type [$element getAttribute "ElementType"] + if {$element_type eq "Solid"} { + lappend ThermalGroups [$node_part @n] } } @@ -360,13 +352,10 @@ proc Dam::write::writeThermalElements {} { set old_name_SubModelPart "Thermal_[lindex $ThermalGroups $i]" set new_name_SubModelPart [string map {" " "_"} $old_name_SubModelPart] dict set ThermalSubModelPartDict [lindex $ThermalGroups $i] SubModelPartName $new_name_SubModelPart - } - - } -proc Dam::write::writeThermalConnectivities {Group ElemType ElemName ConnectivityType ElementId ElementList} { +proc ::Dam::write::writeThermalConnectivities {Group ElemType ElemName ConnectivityType ElementId ElementList} { set Entities [GiD_EntitiesGroups get $Group elements -element_type $ElemType] if {[llength $Entities] > 0} { upvar $ElementId MyElementId @@ -383,7 +372,7 @@ proc Dam::write::writeThermalConnectivities {Group ElemType ElemName Connectivit } } -proc Dam::write::Triangle2D3Connectivities { ElemId } { +proc ::Dam::write::Triangle2D3Connectivities { ElemId } { set ElementInfo [GiD_Mesh get element $ElemId] #ElementInfo: ... @@ -391,17 +380,16 @@ proc Dam::write::Triangle2D3Connectivities { ElemId } { } -proc Dam::write::Quadrilateral2D4Connectivities { ElemId } { +proc ::Dam::write::Quadrilateral2D4Connectivities { ElemId } { #Note: It is the same for the Tethrahedron3D4 set ElementInfo [GiD_Mesh get element $ElemId] #ElementInfo: ... - return "[lindex $ElementInfo 3] [lindex $ElementInfo 4] [lindex $ElementInfo 5]\ - [lindex $ElementInfo 6]" + return "[lindex $ElementInfo 3] [lindex $ElementInfo 4] [lindex $ElementInfo 5] [lindex $ElementInfo 6]" } -proc Dam::write::Hexahedron3D8Connectivities { ElemId } { +proc ::Dam::write::Hexahedron3D8Connectivities { ElemId } { #It is the same for Quadrilateral2D8 @@ -414,8 +402,7 @@ proc Dam::write::Hexahedron3D8Connectivities { ElemId } { #------------------------------------------------------------------------------- - -proc Dam::write::ThermalSubModelPart { } { +proc ::Dam::write::ThermalSubModelPart { } { variable ThermalSubModelPartDict @@ -446,7 +433,7 @@ proc Dam::write::ThermalSubModelPart { } { #------------------------------------------------------------------------------- -proc Dam::write::getSubModelPartThermalNames { } { +proc ::Dam::write::getSubModelPartThermalNames { } { set submodelThermalPartsNames [list] @@ -458,31 +445,38 @@ proc Dam::write::getSubModelPartThermalNames { } { return $submodelThermalPartsNames } +proc ::Dam::write::GetDamPartGroupNodes { } { + set nodes [write::getPartsGroupsId node] + return $nodes +} + -proc Dam::write::GetAttribute {att} { +proc ::Dam::write::writeCustomFilesEvent { } { + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] +} + +proc ::Dam::write::GetAttribute {att} { variable writeAttributes return [dict get $writeAttributes $att] } -proc Dam::write::GetAttributes {} { +proc ::Dam::write::GetAttributes {} { variable writeAttributes return $writeAttributes } -proc Dam::write::SetAttribute {att val} { +proc ::Dam::write::SetAttribute {att val} { variable writeAttributes dict set writeAttributes $att $val } -proc Dam::write::AddAttribute {att val} { +proc ::Dam::write::AddAttribute {att val} { variable writeAttributes dict lappend writeAttributes $att $val } -proc Dam::write::AddAttributes {configuration} { +proc ::Dam::write::AddAttributes {configuration} { variable writeAttributes set writeAttributes [dict merge $writeAttributes $configuration] } - -Dam::write::Init diff --git a/kratos.gid/apps/Dam/write/writeProjectParameters.tcl b/kratos.gid/apps/Dam/write/writeProjectParameters.tcl index 59f143bc7..ada1dae33 100644 --- a/kratos.gid/apps/Dam/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/Dam/write/writeProjectParameters.tcl @@ -1,12 +1,15 @@ ### Project Parameters -proc Dam::write::getParametersDict { } { +proc ::Dam::write::getParametersDict { } { variable number_tables set number_tables 0 set projectParametersDict [dict create] + # Analysis stage field + dict set projectParametersDict analysis_stage "KratosMultiphysics.DamApplication.dam_analysis" + ### Problem data dict set projectParametersDict problem_data [Dam::write::GetProblemDataDict] @@ -41,7 +44,7 @@ proc Dam::write::getParametersDict { } { } # This process is the responsible of writing files -proc Dam::write::writeParametersEvent { } { +proc ::Dam::write::writeParametersEvent { } { set projectParametersDict [Dam::write::getParametersDict] write::WriteJSON $projectParametersDict @@ -57,7 +60,7 @@ proc Dam::write::writeParametersEvent { } { } } -proc Dam::write::GetProblemDataDict { } { +proc ::Dam::write::GetProblemDataDict { } { ### Create section set problemDataDict [dict create] set damTypeofProblem [write::getValue DamTypeofProblem] @@ -106,7 +109,7 @@ proc Dam::write::GetProblemDataDict { } { return $problemDataDict } -proc Dam::write::GetSolverSettingsDict { } { +proc ::Dam::write::GetSolverSettingsDict { } { set solversettingsDict [dict create] set damTypeofProblem [write::getValue DamTypeofProblem] @@ -336,16 +339,19 @@ proc Dam::write::GetSolverSettingsDict { } { } # This process returns a dict of domains according input parameters in the solvers -proc Dam::write::DefinitionDomains { } { +proc ::Dam::write::DefinitionDomains { } { ### Boundary conditions processes set domainsDict [dict create] set body_part_list [list ] set joint_part_list [list ] set mat_dict [write::getMatDict] - foreach part_name [dict keys $mat_dict] { - if {[[Model::getElement [dict get $mat_dict $part_name Element]] getAttribute "ElementType"] eq "Solid"} { - lappend body_part_list [write::getSubModelPartId Parts $part_name] + foreach node_part [GetDamPartGroupNodes] { + set element_id [write::getValueByNode [$node_part selectNodes "./value\[@n='Element'\]"] ] + set element [Model::getElement $element_id] + set element_type [$element getAttribute "ElementType"] + if {$element_type eq "Solid"} { + lappend body_part_list [write::getSubModelPartId Parts [$node_part @n]] } } dict set domainsDict problem_domain_sub_model_part_list [write::getSubModelPartNames "DamParts"] @@ -368,7 +374,7 @@ proc Dam::write::DefinitionDomains { } { # This process assign a number for the different tables instead of names (this is for matching with .mdpa) -proc Dam::write::ChangeFileNameforTableid { processList } { +proc ::Dam::write::ChangeFileNameforTableid { processList } { # Variable global definida al principio y utilizada para transferir entre procesos el número de tablas existentes variable number_tables @@ -414,7 +420,7 @@ proc Dam::write::ChangeFileNameforTableid { processList } { # This process is used to define new list of Output configuratino parameters -proc Dam::write::GetOutputDict { {appid ""} } { +proc ::Dam::write::GetOutputDict { {appid ""} } { set outputDict [dict create] set resultDict [dict create] @@ -439,7 +445,7 @@ proc Dam::write::GetOutputDict { {appid ""} } { set frequency [write::getValue Results OutputDeltaTime_w] } - dict set resultDict output_frequency $frequency + dict set resultDict output_interval $frequency dict set resultDict start_output_results [write::getValue Results StartOutputResults] dict set resultDict body_output [write::getValue Results BodyOutput] @@ -458,7 +464,7 @@ proc Dam::write::GetOutputDict { {appid ""} } { # This process is used for checking if the user is interested on streamlines -proc Dam::write::StremalinesUtility {} { +proc ::Dam::write::StremalinesUtility {} { set nodalList [write::GetResultsList NodalResults] if {[lsearch $nodalList Vi_POSITIVE] >= 0 || [lsearch $nodalList Viii_POSITIVE] >= 0} { @@ -470,7 +476,7 @@ proc Dam::write::StremalinesUtility {} { } # appid Dam solStratUN DamSolStrat problem_base_UN DamMechanicalData -proc Dam::write::getSolversParametersDict { {appid "Dam"} {solStratUN ""} {problem_base_UN ""}} { +proc ::Dam::write::getSolversParametersDict { {appid "Dam"} {solStratUN ""} {problem_base_UN ""}} { #W "Params -> $appid $solStratUN $problem_base_UN" set solstratName [write::getValue $solStratUN] @@ -523,7 +529,7 @@ proc Dam::write::getSolversParametersDict { {appid "Dam"} {solStratUN ""} {probl } # This process write the construction in process in case is selected -proc Dam::write::GetConstructionDomainProcessDict { } { +proc ::Dam::write::GetConstructionDomainProcessDict { } { set construction_dict [dict create] set data_basenode [[customlib::GetBaseRoot] selectNodes [spdAux::getRoute "DamConstructionProcess"]] @@ -581,7 +587,7 @@ proc Dam::write::GetConstructionDomainProcessDict { } { } # This process write the transfer results process in case is selected -proc Dam::write::GetTransferResultsDict { } { +proc ::Dam::write::GetTransferResultsDict { } { set transfer_results_dict [dict create] set consider_save_intermediate_variables [write::getValue DamSaveResults SaveIntermediateResults] if {$consider_save_intermediate_variables eq "Yes"} { @@ -696,7 +702,7 @@ proc Dam::write::GetTransferResultsDict { } { # This process writes a dictionary for creating new projectparameters exclusively for solving selfweight problem -proc Dam::write::getParametersSelfWeight { } { +proc ::Dam::write::getParametersSelfWeight { } { set projectParametersDictSelfWeight [dict create] set solversettingsDict [dict create] @@ -747,7 +753,7 @@ proc Dam::write::getParametersSelfWeight { } { } # Predefined solver values for selfweight problem -proc Dam::write::predefinedParametersSelfWeight { } { +proc ::Dam::write::predefinedParametersSelfWeight { } { set solverSelfParametersDict [dict create] dict set solverSelfParametersDict solution_type "Quasi-Static" @@ -782,7 +788,7 @@ proc Dam::write::predefinedParametersSelfWeight { } { } # This process filters Nodal constraints for selfweight problem -proc Dam::write::filteringConstraints { processList} { +proc ::Dam::write::filteringConstraints { processList} { set returnList [list ] foreach nodalProcess $processList { @@ -794,7 +800,7 @@ proc Dam::write::filteringConstraints { processList} { return $returnList } -proc Dam::write::DevicesOutput { } { +proc ::Dam::write::DevicesOutput { } { set output_state [write::getValue DamOutputState] set lista [list ] @@ -851,7 +857,7 @@ proc Dam::write::DevicesOutput { } { } -proc Dam::write::TemperaturebyDevices { } { +proc ::Dam::write::TemperaturebyDevices { } { # Variable global definida al principio y utilizada para transferir entre procesos el número de tablas existentes variable number_tables @@ -909,7 +915,7 @@ proc Dam::write::TemperaturebyDevices { } { dict set parameterDict is_fixed $isfixed dict set parameterDict value $value - if {$fileid ni [list "" "- No file"]} { + if {$fileid ni [list "" "- No file" $::spdAux::no_file_string]} { if {$fileid ni $listaFiles} { lappend listaFiles $fileid incr number_devices diff --git a/kratos.gid/apps/Dam/xml/Conditions.xml b/kratos.gid/apps/Dam/xml/Conditions.xml index 3fa07a83e..bcc378610 100644 --- a/kratos.gid/apps/Dam/xml/Conditions.xml +++ b/kratos.gid/apps/Dam/xml/Conditions.xml @@ -5,7 +5,7 @@ @@ -20,7 +20,7 @@ @@ -415,7 +415,7 @@ - - + --> diff --git a/kratos.gid/apps/Dam/xml/ConstitutiveLaws.xml b/kratos.gid/apps/Dam/xml/ConstitutiveLaws.xml index 3a49cbd96..3f1bdbd98 100644 --- a/kratos.gid/apps/Dam/xml/ConstitutiveLaws.xml +++ b/kratos.gid/apps/Dam/xml/ConstitutiveLaws.xml @@ -77,13 +77,28 @@ - + help="Simplified joint cohesion driven law for problems in 3D" Dimension="3D" LargeDeformation="False" RequiresLocalAxes="False" HybridType="False" AllowsAnisotropy="False" DamageType="Local,NonLocal" > + + + + + + + + + + + + + @@ -238,30 +253,29 @@ - + - - - - + + + - + + - diff --git a/kratos.gid/apps/Dam/xml/Elements.xml b/kratos.gid/apps/Dam/xml/Elements.xml index 321268b10..d625edae3 100644 --- a/kratos.gid/apps/Dam/xml/Elements.xml +++ b/kratos.gid/apps/Dam/xml/Elements.xml @@ -210,7 +210,7 @@ - + diff --git a/kratos.gid/apps/Dam/xml/Parts.spd b/kratos.gid/apps/Dam/xml/Parts.spd index 420de8173..a133648b2 100644 --- a/kratos.gid/apps/Dam/xml/Parts.spd +++ b/kratos.gid/apps/Dam/xml/Parts.spd @@ -1,17 +1,13 @@ - - - - - - - - - - - - + + + + + + + + + + + diff --git a/kratos.gid/apps/Dam/xml/Processes.xml b/kratos.gid/apps/Dam/xml/Processes.xml index fa5e18bfd..376f5c781 100644 --- a/kratos.gid/apps/Dam/xml/Processes.xml +++ b/kratos.gid/apps/Dam/xml/Processes.xml @@ -337,7 +337,7 @@ kratos_module="KratosMultiphysics.DamApplication" help="This process assigns different values of Reference Temperature to each node" > - + diff --git a/kratos.gid/apps/Dam/xml/Solvers.xml b/kratos.gid/apps/Dam/xml/Solvers.xml index 594477a57..330606943 100644 --- a/kratos.gid/apps/Dam/xml/Solvers.xml +++ b/kratos.gid/apps/Dam/xml/Solvers.xml @@ -6,7 +6,7 @@ - + @@ -50,6 +50,11 @@ + + + + + - + diff --git a/kratos.gid/apps/EmbeddedFluid/xml/XmlController.tcl b/kratos.gid/apps/EmbeddedFluid/xml/XmlController.tcl index e076a5fd2..2add2e2b0 100644 --- a/kratos.gid/apps/EmbeddedFluid/xml/XmlController.tcl +++ b/kratos.gid/apps/EmbeddedFluid/xml/XmlController.tcl @@ -1,40 +1,31 @@ -namespace eval EmbeddedFluid::xml { +namespace eval ::EmbeddedFluid::xml { + namespace path ::EmbeddedFluid + Kratos::AddNamespace [namespace current] # Namespace variables declaration - variable dir variable lastImportMeshSize variable export_dir - } proc EmbeddedFluid::xml::Init { } { # Namespace variables inicialization - variable dir variable lastImportMeshSize set lastImportMeshSize 0 - Model::DestroyEverything - Model::InitVariables dir $EmbeddedFluid::dir + Model::InitVariables dir $::EmbeddedFluid::dir + + Model::ForgetSolutionStrategies Model::getSolutionStrategies Strategies.xml - Model::getElements "../../Fluid/xml/Elements.xml" - Model::getMaterials Materials.xml - Model::getNodalConditions "../../Fluid/xml/NodalConditions.xml" - Model::getConstitutiveLaws "../../Fluid/xml/ConstitutiveLaws.xml" - Model::getProcesses "../../Common/xml/Processes.xml" - Model::getProcesses "../../Fluid/xml/Processes.xml" - Model::getConditions "../../Fluid/xml/Conditions.xml" - Model::getSolvers "../../Common/xml/Solvers.xml" } - proc EmbeddedFluid::xml::MultiAppEvent {args} { if {$args eq "init"} { spdAux::parseRoutes - spdAux::ConvertAllUniqueNames FL ${::EmbeddedFluid::prefix} + spdAux::ConvertAllUniqueNames [::Fluid::GetAttribute prefix] [::EmbeddedFluid::GetAttribute prefix] } } proc EmbeddedFluid::xml::getUniqueName {name} { - return ${::EmbeddedFluid::prefix}${name} + return [::EmbeddedFluid::GetAttribute prefix]${name} } proc EmbeddedFluid::xml::CustomTree { args } { @@ -66,7 +57,4 @@ proc EmbeddedFluid::xml::CustomTree { args } { #spdAux::SetValueOnTreeItem v MN EMBFLScheme #spdAux::SetValueOnTreeItem values MN EMBFLScheme #spdAux::SetValueOnTreeItem dict "MN,Monolitic generic scheme" EMBFLScheme - } - -EmbeddedFluid::xml::Init diff --git a/kratos.gid/apps/Examples/app.json b/kratos.gid/apps/Examples/app.json new file mode 100644 index 000000000..18868fb90 --- /dev/null +++ b/kratos.gid/apps/Examples/app.json @@ -0,0 +1,16 @@ +{ + "id": "Examples", + "name": "Examples", + "themed": false, + "start_script":"::Examples::StartWindowEmpty", + "requeriments":{ + "apps":[], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": false, + "show_toolbar": false, + "intervals": false, + "wizard": true + } +} diff --git a/kratos.gid/apps/Examples/images/Solid/CircularTank2Da.png b/kratos.gid/apps/Examples/images/Solid/CircularTank2Da.png deleted file mode 100644 index ea5b4f190..000000000 Binary files a/kratos.gid/apps/Examples/images/Solid/CircularTank2Da.png and /dev/null differ diff --git a/kratos.gid/apps/Examples/images/Solid/CircularTank3D.png b/kratos.gid/apps/Examples/images/Solid/CircularTank3D.png deleted file mode 100644 index 6e90a4f8a..000000000 Binary files a/kratos.gid/apps/Examples/images/Solid/CircularTank3D.png and /dev/null differ diff --git a/kratos.gid/apps/Examples/images/Solid/DynamicBeam.png b/kratos.gid/apps/Examples/images/Solid/DynamicBeam.png deleted file mode 100644 index 38a78b626..000000000 Binary files a/kratos.gid/apps/Examples/images/Solid/DynamicBeam.png and /dev/null differ diff --git a/kratos.gid/apps/Examples/images/Solid/DynamicRod2D.png b/kratos.gid/apps/Examples/images/Solid/DynamicRod2D.png deleted file mode 100644 index e8959dabd..000000000 Binary files a/kratos.gid/apps/Examples/images/Solid/DynamicRod2D.png and /dev/null differ diff --git a/kratos.gid/apps/Examples/images/Solid/DynamicRod3D.png b/kratos.gid/apps/Examples/images/Solid/DynamicRod3D.png deleted file mode 100644 index 58e66f9fd..000000000 Binary files a/kratos.gid/apps/Examples/images/Solid/DynamicRod3D.png and /dev/null differ diff --git a/kratos.gid/apps/Examples/images/Solid/EccentricColumn.png b/kratos.gid/apps/Examples/images/Solid/EccentricColumn.png deleted file mode 100644 index 2b03fdbe6..000000000 Binary files a/kratos.gid/apps/Examples/images/Solid/EccentricColumn.png and /dev/null differ diff --git a/kratos.gid/apps/Examples/images/Solid/NotchedBeam.png b/kratos.gid/apps/Examples/images/Solid/NotchedBeam.png deleted file mode 100644 index 2a3f988ec..000000000 Binary files a/kratos.gid/apps/Examples/images/Solid/NotchedBeam.png and /dev/null differ diff --git a/kratos.gid/apps/Examples/images/Thermic/BuoyancyHeatedSquare2D.png b/kratos.gid/apps/Examples/images/Thermic/BuoyancyHeatedSquare2D.png new file mode 100644 index 000000000..1be4ba165 Binary files /dev/null and b/kratos.gid/apps/Examples/images/Thermic/BuoyancyHeatedSquare2D.png differ diff --git a/kratos.gid/apps/Examples/images/Thermic/ConjugateHeatTransferHeatedSquare2D.png b/kratos.gid/apps/Examples/images/Thermic/ConjugateHeatTransferHeatedSquare2D.png new file mode 100644 index 000000000..ce7a0a422 Binary files /dev/null and b/kratos.gid/apps/Examples/images/Thermic/ConjugateHeatTransferHeatedSquare2D.png differ diff --git a/kratos.gid/apps/Examples/images/Thermic/ConvectionDiffusionHeatedSquare2D.png b/kratos.gid/apps/Examples/images/Thermic/ConvectionDiffusionHeatedSquare2D.png new file mode 100644 index 000000000..5a6d5d090 Binary files /dev/null and b/kratos.gid/apps/Examples/images/Thermic/ConvectionDiffusionHeatedSquare2D.png differ diff --git a/kratos.gid/apps/Examples/start.tcl b/kratos.gid/apps/Examples/start.tcl deleted file mode 100644 index e0f3bd995..000000000 --- a/kratos.gid/apps/Examples/start.tcl +++ /dev/null @@ -1,125 +0,0 @@ -namespace eval ::Examples { - # Variable declaration - variable dir - variable doc - variable examples_window -} - -proc ::Examples::Init { } { - # Variable initialization - variable dir - variable examples_window - set examples_window .gid.examples_window - - set dir [apps::getMyDir "Examples"] - - # Don't open the tree - set ::spdAux::TreeVisibility 0 - set ::spdAux::must_open_dim_window 0 - - LoadMyFiles - - after 200 [list ::Examples::StartWindow] -} - -proc ::Examples::LoadMyFiles { } { - variable dir - variable doc - - # uplevel #0 [list source [file join $dir xml GetFromXML.tcl]] - set xmlfd [tDOM::xmlOpenFile [file join $dir xml examples.xml]] - set doc [dom parse -channel $xmlfd] - close $xmlfd -} - -proc ::Examples::StartWindow { } { - variable doc - variable examples_window - - if { [GidUtils::IsTkDisabled] } { - return 0 - } - set root [$doc documentElement] - - spdAux::DestroyInitWindow - Examples::DestroyExamplesWindow - toplevel $examples_window - wm withdraw $examples_window - - set x [expr [winfo rootx .gid]+[winfo width .gid]/2-[winfo width $examples_window]/2] - set y [expr [winfo rooty .gid]+[winfo height .gid]/2-[winfo height $examples_window]/2] - - wm geom $examples_window +$x+$y - wm transient $examples_window .gid - - InitWindow $examples_window [_ "Kratos Multiphysics - Examples"] Kratos "" "" 1 - set initwind $examples_window - - set c_to_scroll [CreateScrolledCanvas $initwind.center] - set fcenter [tk::frame $c_to_scroll.fcenter] - AddToScrolledCanvas $initwind.center $fcenter - grid $initwind.center -sticky nsew - - set groups [$root getElementsByTagName "Group"] - foreach group $groups { - set group_id [$group @id] - set group_name [$group @name] - #set title_frame [ttk::frame $examples_window.information_$group_id] - #grid [ttk::labelframe $examples_window.title_text$group_id -text $group_name] - - set parent [ttk::labelframe $fcenter.title_text$group_id -text $group_name] - set buttons_frame [ttk::frame $parent.buttonframe] - set examples [$group getElementsByTagName "Example"] - set col 0 - set row 0 - foreach example $examples { - set example_id [$example @id] - set example_name [subst -nocommands -novariables [$example @name]] - set example_logo [$example @logo] - set example_dim [$example @dim] - set example_app [$example @app] - set example_cmd [$example @cmd] - set img [Examples::getImgFrom $group_id $example_logo] - ttk::button $buttons_frame.img$example_id -image $img -command [list Examples::LaunchExample $example_app $example_dim $example_cmd ] - ttk::label $buttons_frame.text$example_id -text $example_name - grid $buttons_frame.img$example_id -column $col -row $row - grid $buttons_frame.text$example_id -column $col -row [expr $row +1] - - incr col - if {$col >= 7} {set col 0; incr row; incr row} - } - #grid $title_frame - grid $parent -sticky ew - grid $buttons_frame - grid columnconfigure $parent 0 -weight 1 - } - - grid columnconfigure $initwind 0 -weight 1 - grid rowconfigure $initwind 0 -weight 1 - wm minsize $initwind 900 500 - #wm maxsize $initwind 500 500 -} - -proc ::Examples::getImgFrom {group_name example_logo} { - - return [apps::getImgFrom "Examples" [file join $group_name $example_logo]] -} - -proc ::Examples::LaunchExample {example_app example_dim example_cmd} { - Examples::DestroyExamplesWindow - spdAux::SetSpatialDimmension $example_dim - apps::setActiveApp $example_app - $example_cmd - spdAux::OpenTree - -} - -proc ::Examples::DestroyExamplesWindow {} { - - variable examples_window - if { ![GidUtils::IsTkDisabled] } { - if {[winfo exists $examples_window]} {destroy $examples_window} - } -} - -::Examples::Init diff --git a/kratos.gid/apps/Examples/xml/examples.xml b/kratos.gid/apps/Examples/xml/examples.xml index dd7668bc8..7ca5de691 100644 --- a/kratos.gid/apps/Examples/xml/examples.xml +++ b/kratos.gid/apps/Examples/xml/examples.xml @@ -1,27 +1,25 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/FSI/app.json b/kratos.gid/apps/FSI/app.json new file mode 100644 index 000000000..48444ba9b --- /dev/null +++ b/kratos.gid/apps/FSI/app.json @@ -0,0 +1,59 @@ +{ + "id": "FSI", + "name": "Fluid Strucure Interaction", + "prefix": "FSI", + "themed": false, + "kratos_name": "FSIApplication", + "python_packages": [ + "KratosStructuralMechanicsApplication", + "KratosFluidDynamicsApplication", + "KratosFSIApplication", + "KratosMeshMovingApplication", + "KratosMappingApplication" + ], + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/MokChannelWithFlexibleWall.tcl", + "examples/TurekBenchmark.tcl", + "examples/HighRiseBuilding.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script": "::FSI::Init", + "requeriments": { + "apps": [ + "Fluid", + "Structural" + ], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "unique_names": { + "parts": "STParts", + "initial_conditions": "STInitialConditions", + "nodal_conditions": "STNodalConditions", + "conditions": "STLoads", + "time_parameters": "STTimeParameters", + "results": "STResults", + "materials": "STMaterials" + }, + "write": { + "coordinates": "all", + "materials_file": "StructuralMaterials.json", + "properties_location": "json", + "model_part_name": "Structure" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} \ No newline at end of file diff --git a/kratos.gid/apps/FSI/examples/HighRiseBuilding.tcl b/kratos.gid/apps/FSI/examples/HighRiseBuilding.tcl index 8050de56d..ef9b33c36 100644 --- a/kratos.gid/apps/FSI/examples/HighRiseBuilding.tcl +++ b/kratos.gid/apps/FSI/examples/HighRiseBuilding.tcl @@ -1,16 +1,21 @@ +namespace eval ::FSI::examples::HighRiseBuilding { + namespace path ::FSI::examples + Kratos::AddNamespace [namespace current] -proc FSI::examples::HighRiseBuilding {args} { +} + +proc ::FSI::examples::HighRiseBuilding::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - Kratos::ResetModel - DrawHighRiseBuildingGeometry - AssignGroupsHighRiseBuilding$::Model::SpatialDimension - AssignHighRiseBuildingMeshSizes - TreeAssignationHighRiseBuilding + + DrawGeometry + AssignGroups$::Model::SpatialDimension + AssignMeshSizes + TreeAssignation GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -18,12 +23,12 @@ proc FSI::examples::HighRiseBuilding {args} { GiD_Process 'Zoom Frame } -proc FSI::examples::DrawHighRiseBuildingGeometry {args} { - Fluid::examples::DrawHighRiseBuildingGeometry$::Model::SpatialDimension - Structural::examples::DrawHighRiseBuildingGeometry$::Model::SpatialDimension +proc ::FSI::examples::HighRiseBuilding::DrawGeometry {args} { + Fluid::examples::HighRiseBuilding::DrawGeometry$::Model::SpatialDimension + Structural::examples::HighRiseBuilding::DrawGeometry$::Model::SpatialDimension } -proc FSI::examples::AssignGroupsHighRiseBuilding2D {args} { +proc ::FSI::examples::HighRiseBuilding::AssignGroups2D {args} { # Fluid group creation GiD_Groups create Fluid GiD_EntitiesGroups assign Fluid surfaces 1 @@ -56,16 +61,16 @@ proc FSI::examples::AssignGroupsHighRiseBuilding2D {args} { GiD_EntitiesGroups assign InterfaceStructure lines {9 10 11} } -proc FSI::examples::AssignGroupsHighRiseBuilding3D {args} { +proc ::FSI::examples::HighRiseBuilding::AssignGroups3D {args} { # To be implemented } -proc FSI::examples::AssignHighRiseBuildingMeshSizes {args} { - Fluid::examples::AssignHighRiseBuildingMeshSizes$::Model::SpatialDimension - Structural::examples::AssignHighRiseBuildingMeshSizes$::Model::SpatialDimension +proc ::FSI::examples::HighRiseBuilding::AssignMeshSizes {args} { + ::Fluid::examples::HighRiseBuilding::AssignMeshSizes$::Model::SpatialDimension + ::Structural::examples::HighRiseBuilding::AssignMeshSizes$::Model::SpatialDimension } -proc FSI::examples::TreeAssignationHighRiseBuilding {args} { +proc ::FSI::examples::HighRiseBuilding::TreeAssignation {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -79,7 +84,7 @@ proc FSI::examples::TreeAssignationHighRiseBuilding {args} { set fluidParts [spdAux::getRoute "FLParts"] set fluidNode [customlib::AddConditionGroupOnXPath $fluidParts Fluid] set props [list Element Monolithic$nd ConstitutiveLaw Newtonian DENSITY 1.225 DYNAMIC_VISCOSITY 1.846e-5] - spdAux::SetValuesOnBaseNode $fluidNode $flux_props + spdAux::SetValuesOnBaseNode $fluidNode $props set fluidConditions {container[@n='FSI']/container[@n='Fluid']/container[@n='BoundaryConditions']} diff --git a/kratos.gid/apps/FSI/examples/MokChannelWithFlexibleWall.tcl b/kratos.gid/apps/FSI/examples/MokChannelWithFlexibleWall.tcl index 1b549b746..fe80b35ce 100644 --- a/kratos.gid/apps/FSI/examples/MokChannelWithFlexibleWall.tcl +++ b/kratos.gid/apps/FSI/examples/MokChannelWithFlexibleWall.tcl @@ -1,16 +1,21 @@ +namespace eval ::FSI::examples::MokChannelFlexibleWall { + namespace path ::FSI::examples + Kratos::AddNamespace [namespace current] -proc ::FSI::examples::MokChannelFlexibleWall {args} { +} + +proc ::FSI::examples::MokChannelFlexibleWall::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawMokChannelFlexibleWallGeometry - AssignMokChannelFlexibleWallMeshSizes$::Model::SpatialDimension - TreeAssignationMokChannelFlexibleWall + DrawGeometry + AssignMeshSizes$::Model::SpatialDimension + TreeAssignation } -proc FSI::examples::DrawMokChannelFlexibleWallGeometry {args} { +proc ::FSI::examples::MokChannelFlexibleWall::DrawGeometry {args} { Kratos::ResetModel GiD_Process Mescape 'Layers ChangeName Layer0 Fluid escape @@ -137,7 +142,7 @@ proc FSI::examples::DrawMokChannelFlexibleWallGeometry {args} { GidUtils::UpdateWindow GROUPS } -proc FSI::examples::AssignMokChannelFlexibleWallMeshSizes2D {args} { +proc ::FSI::examples::MokChannelFlexibleWall::AssignMeshSizes2D {args} { set long_side_divisions 100 set short_side_divisions 4 set outlet_element_size 0.01 @@ -154,7 +159,7 @@ proc FSI::examples::AssignMokChannelFlexibleWallMeshSizes2D {args} { GiD_Process Mescape Meshing ElemType Triangle [GiD_EntitiesGroups get Fluid surfaces] escape escape } -proc FSI::examples::AssignMokChannelFlexibleWallMeshSizes3D {args} { +proc ::FSI::examples::MokChannelFlexibleWall::AssignMeshSizes3D {args} { set long_side_divisions 100 set short_side_divisions 4 set outlet_element_size 0.01 @@ -164,7 +169,8 @@ proc FSI::examples::AssignMokChannelFlexibleWallMeshSizes3D {args} { GiD_Process Mescape Utilities Variables SizeTransitionsFactor 0.4 escape escape GiD_Process Mescape Meshing ElemType Tetrahedra [GiD_EntitiesGroups get Fluid volumes] escape - GiD_Process Mescape Meshing ElemType Hexahedra [GiD_EntitiesGroups get Structure volumes] escape + GiD_Process Mescape Meshing ElemType Tetrahedra [GiD_EntitiesGroups get Structure volumes] escape + # GiD_Process Mescape Meshing ElemType Hexahedra [GiD_EntitiesGroups get Structure volumes] escape GiD_Process Mescape Meshing Structured Surfaces 14 16 escape $long_side_divisions 12 14 escape $long_side_divisions 45 46 escape escape GiD_Process Mescape Meshing Structured Surfaces 15 escape $short_side_divisions 13 escape $long_side_divisions 45 46 escape escape GiD_Process Mescape Meshing Structured Volumes [GiD_EntitiesGroups get Structure volumes] escape $short_side_divisions 48 escape $long_side_divisions 15 17 52 53 escape escape @@ -174,7 +180,7 @@ proc FSI::examples::AssignMokChannelFlexibleWallMeshSizes3D {args} { GiD_Process Mescape Meshing AssignSizes Volumes $fluid_element_size [GiD_EntitiesGroups get Fluid volumes] escape escape } -proc FSI::examples::TreeAssignationMokChannelFlexibleWall {args} { +proc ::FSI::examples::MokChannelFlexibleWall::TreeAssignation {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -188,12 +194,13 @@ proc FSI::examples::TreeAssignationMokChannelFlexibleWall {args} { spdAux::SetValuesOnBaseNode $fluidNode $props set fluidConditions {container[@n='FSI']/container[@n='Fluid']/container[@n='BoundaryConditions']} + # Fluid Interface set fluidInlet "$fluidConditions/condition\[@n='AutomaticInlet$nd'\]" # Fluid Inlet - set function {0.1214*(1-cos(0.1*pi*t))*y*(1-y) if t<10 else 0.2428*y*(1-y)} - Fluid::xml::CreateNewInlet Inlet {new false name Total} true $function + Fluid::xml::CreateNewInlet Inlet {new true name interval1 ini 0 end 10.0} true "0.1214*(1-cos(0.1*pi*t))*y*(1-y)" + Fluid::xml::CreateNewInlet Inlet {new true name interval2 ini 10.0 end End} true "0.2428*y*(1-y)" # Fluid Outlet set fluidOutlet "$fluidConditions/condition\[@n='Outlet$nd'\]" diff --git a/kratos.gid/apps/FSI/examples/TurekBenchmark.tcl b/kratos.gid/apps/FSI/examples/TurekBenchmark.tcl index 22d679105..6b9599e42 100644 --- a/kratos.gid/apps/FSI/examples/TurekBenchmark.tcl +++ b/kratos.gid/apps/FSI/examples/TurekBenchmark.tcl @@ -1,5 +1,10 @@ +namespace eval ::FSI::examples::TurekBenchmark { + namespace path ::FSI::examples + Kratos::AddNamespace [namespace current] -proc ::FSI::examples::TurekBenchmark {args} { +} + +proc ::FSI::examples::TurekBenchmark::Init {args} { # At this moment we do only support 2D for this test if {$::Model::SpatialDimension eq "2D"} { if {![Kratos::IsModelEmpty]} { @@ -8,41 +13,41 @@ proc ::FSI::examples::TurekBenchmark {args} { if { $retval == "cancel" } { return } } # Set up geometry and groups - DrawTurekBenchmarkFluidGeometry - DrawTurekBenchmarkStructureGeometry + DrawGeometryFluid + DrawGeometryStructure # Generated geometry frame zoom GiD_Process 'Layers On Fluid escape GiD_Process 'Layers On Structure escape GiD_Process 'Zoom Frame GiD_Process 'Render Flat escape # Assign mesh sizes - AssignTurekBenchmarkMeshSizes$::Model::SpatialDimension + AssignMeshSizes$::Model::SpatialDimension # Assign tree values - TreeAssignationTurekBenchmark + TreeAssignation } } -proc FSI::examples::DrawTurekBenchmarkFluidGeometry {args} { +proc ::FSI::examples::TurekBenchmark::DrawGeometryFluid {args} { Kratos::ResetModel # Set fluid domain geometry if {$::Model::SpatialDimension eq "2D"} { - GiD_Process 'Layers ChangeName Layer0 Fluid escape Mescape - GiD_Process MEscape Geometry Create Object Rectangle 0,0 2.5,0.41 Mescape + GiD_Process 'Layers ChangeName Layer0 Fluid escape Mescape + GiD_Process MEscape Geometry Create Object Rectangle 0,0 2.5,0.41 Mescape GiD_Process MEscape Geometry Delete Surfaces 1 escape Mescape \ - 'GetPointCoord Silent FNoJoin 0.2,0.2 escape escape - GiD_Process MEscape Geometry Create Object CirclePNR 0.2 0.2 0.0 0.0 0.0 1.0 0.05 escape escape escape - GiD_Process MEscape Geometry Delete Surfaces 1 escape escape - GiD_Process MEscape Geometry Create Line 0.6,0.19 @-0.4,0 escape Join 6 NoJoin @0,0.02 @-0.4,0 escape escape escape escape escape - GiD_Process MEscape Geometry Create IntMultLines 5 6 escape 8 10 escape escape escape escape - GiD_Process MEscape Geometry Delete AllTypes points 7 9 lines 12 14 surfaces volumes dimensions points lines 15 surfaces volumes dimensions escape escape + 'GetPointCoord Silent FNoJoin 0.2,0.2 escape escape + GiD_Process MEscape Geometry Create Object CirclePNR 0.2 0.2 0.0 0.0 0.0 1.0 0.05 escape escape escape + GiD_Process MEscape Geometry Delete Surfaces 1 escape escape + GiD_Process MEscape Geometry Create Line 0.6,0.19 @-0.4,0 escape Join 6 NoJoin @0,0.02 @-0.4,0 escape escape escape escape escape + GiD_Process MEscape Geometry Create IntMultLines 5 6 escape 8 10 escape escape escape escape + GiD_Process MEscape Geometry Delete AllTypes points 7 9 lines 12 14 surfaces volumes dimensions points lines 15 surfaces volumes dimensions escape escape GiD_Process MEscape Geometry Create NurbsSurface 1 2 3 4 7 9 11 13 16 escape escape } else { # 3D version not implemented yet } # Set layer coloring - GiD_Process 'Layers Color Fluid 047186223 Transparent Fluid 255 escape + GiD_Process 'Layers Color Fluid 047186223 Transparent Fluid 255 escape GiD_Process 'Layers On Fluid escape # Group creation @@ -74,21 +79,21 @@ proc FSI::examples::DrawTurekBenchmarkFluidGeometry {args} { GidUtils::UpdateWindow GROUPS } -proc FSI::examples::DrawTurekBenchmarkStructureGeometry {args} { +proc ::FSI::examples::TurekBenchmark::DrawGeometryStructure {args} { # Set structure domain geometry if {$::Model::SpatialDimension eq "2D"} { - + GiD_Process 'Layers New Structure escape GiD_Process 'Layers Off Fluid escape GiD_Process 'Layers ToUse Structure escape - GiD_Process Mescape Geometry Create Object CirclePNR 0.2 0.2 0.0 0.0 0.0 1.0 0.05 escape Mescape - GiD_Process Mescape Geometry Create Line 0.6,0.19 @-0.4,0 escape Join 13 NoJoin @0,0.02 @-0.4,0 escape escape Mescape - GiD_Process Mescape Geometry Delete Surfaces 2 escape escape Mescape - GiD_Process Mescape Geometry Create IntMultLines 17 18 escape 20 22 escape escape escape escape escape Mescape - GiD_Process Mescape Geometry Delete Lines 21 28 escape Mescape - GiD_Process Mescape Geometry Delete AllTypes points 12 14 16 lines 24 26 surfaces volumes dimensions escape escape escape escape escape escape Mescape + GiD_Process Mescape Geometry Create Object CirclePNR 0.2 0.2 0.0 0.0 0.0 1.0 0.05 escape Mescape + GiD_Process Mescape Geometry Create Line 0.6,0.19 @-0.4,0 escape Join 13 NoJoin @0,0.02 @-0.4,0 escape escape Mescape + GiD_Process Mescape Geometry Delete Surfaces 2 escape escape Mescape + GiD_Process Mescape Geometry Create IntMultLines 17 18 escape 20 22 escape escape escape escape escape Mescape + GiD_Process Mescape Geometry Delete Lines 21 28 escape Mescape + GiD_Process Mescape Geometry Delete AllTypes points 12 14 16 lines 24 26 surfaces volumes dimensions escape escape escape escape escape escape Mescape GiD_Process Mescape Geometry Create NurbsSurface 19 23 25 27 escape escape escape escape } else { # 3D version not implemented yet @@ -115,7 +120,7 @@ proc FSI::examples::DrawTurekBenchmarkStructureGeometry {args} { GidUtils::UpdateWindow GROUPS } -proc FSI::examples::AssignTurekBenchmarkMeshSizes2D {args} { +proc ::FSI::examples::TurekBenchmark::AssignMeshSizes2D {args} { # Structure and fluid mesh settings set str_flag_tail_divisions 15 set str_flag_long_sides_divisions 175 @@ -129,11 +134,11 @@ proc FSI::examples::AssignTurekBenchmarkMeshSizes2D {args} { GiD_Process Mescape Utilities Variables SizeTransitionsFactor 0.3 escape escape # Structure meshing settings - GiD_Process Mescape Meshing ElemType Quadrilateral 2 escape + GiD_Process Mescape Meshing ElemType Quadrilateral 2 escape GiD_Process Mescape Meshing Structured Surfaces 2 escape $str_flag_long_sides_divisions 23 25 escape $str_flag_tail_divisions 27 escape escape # Fluid meshing settings - GiD_Process Mescape Meshing ElemType Triangle 1 escape + GiD_Process Mescape Meshing ElemType Triangle 1 escape GiD_Process Mescape Meshing AssignSizes Lines $fluid_flag_tail_element_size 7 escape escape GiD_Process Mescape Meshing AssignSizes Lines $fluid_cylinder_element_size 9 16 escape escape GiD_Process Mescape Meshing AssignSizes Lines $fluid_walls_element_size 1 2 3 4 escape escape @@ -141,7 +146,7 @@ proc FSI::examples::AssignTurekBenchmarkMeshSizes2D {args} { GiD_Process Mescape Meshing AssignSizes Surfaces $fluid_domain_element_size 1 escape escape } -# proc FSI::examples::AssignTurekBenchmarkMeshSizes3D {args} { +# proc ::FSI::examples::TurekBenchmark::AssignTurekBenchmarkMeshSizes3D {args} { # set long_side_divisions 100 # set short_side_divisions 4 # set outlet_element_size 0.01 @@ -161,7 +166,7 @@ proc FSI::examples::AssignTurekBenchmarkMeshSizes2D {args} { # GiD_Process Mescape Meshing AssignSizes Volumes $fluid_element_size [GiD_EntitiesGroups get Fluid volumes] escape escape # } -proc FSI::examples::TreeAssignationTurekBenchmark {args} { +proc ::FSI::examples::TurekBenchmark::TreeAssignation {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -175,13 +180,14 @@ proc FSI::examples::TreeAssignationTurekBenchmark {args} { spdAux::SetValuesOnBaseNode $fluidNode $props set fluidConditions {container[@n='FSI']/container[@n='Fluid']/container[@n='BoundaryConditions']} + # Fluid Interface set fluidInlet "$fluidConditions/condition\[@n='AutomaticInlet$nd'\]" # Fluid Inlet - set function {1.5*(0.5*(1-cos(0.5*pi*t))*1.0)*(4.0/0.1681)*y*(0.41-y) if t<2.0 else 1.5*(1.0)*(4.0/0.1681)*y*(0.41-y)} - Fluid::xml::CreateNewInlet Inlet {new false name Total} true $function - + Fluid::xml::CreateNewInlet Inlet {new true name interval1 ini 0 end 2.0} true "1.5*(0.5*(1-cos(0.5*pi*t))*1.0)*(4.0/0.1681)*y*(0.41-y)" + Fluid::xml::CreateNewInlet Inlet {new true name interval2 ini 2.0 end End} true "1.5*(1.0)*(4.0/0.1681)*y*(0.41-y)" + # Fluid Outlet set fluidOutlet "$fluidConditions/condition\[@n='Outlet$nd'\]" set outletNode [customlib::AddConditionGroupOnXPath $fluidOutlet Outlet] @@ -196,7 +202,7 @@ proc FSI::examples::TreeAssignationTurekBenchmark {args} { # Displacement 3D if {$nd eq "3D"} { - + } { set gname "FluidALEMeshFreeX//Total" GiD_Groups create $gname @@ -208,7 +214,7 @@ proc FSI::examples::TreeAssignationTurekBenchmark {args} { $fluidDisplacementNode setAttribute ov line set props [list selector_component_X Not selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total] spdAux::SetValuesOnBaseNode $fluidDisplacementNode $props - + set gname "FluidALEMeshFixXY//Total" GiD_Groups create $gname GiD_Groups edit state $gname hidden diff --git a/kratos.gid/apps/FSI/examples/examples.tcl b/kratos.gid/apps/FSI/examples/examples.tcl index a6a556e10..f1dc06f8d 100644 --- a/kratos.gid/apps/FSI/examples/examples.tcl +++ b/kratos.gid/apps/FSI/examples/examples.tcl @@ -1,22 +1,5 @@ -namespace eval FSI::examples { +namespace eval ::FSI::examples { + namespace path ::FSI::examples + Kratos::AddNamespace [namespace current] } - -proc FSI::examples::Init { } { - uplevel #0 [list source [file join $::FSI::dir examples MokChannelWithFlexibleWall.tcl]] - uplevel #0 [list source [file join $::FSI::dir examples TurekBenchmark.tcl]] - uplevel #0 [list source [file join $::FSI::dir examples HighRiseBuilding.tcl]] -} - -proc FSI::examples::UpdateMenus { } { - set menu_id 7 - GiDMenu::InsertOption "Kratos" [list "Mok - Channel with flexible wall" ] [incr menu_id] PRE [list ::FSI::examples::MokChannelFlexibleWall] "" "" insertbefore = - if {$::Model::SpatialDimension eq "2D"} { - GiDMenu::InsertOption "Kratos" [list "Turek benchmark" ] [incr menu_id] PRE [list ::FSI::examples::TurekBenchmark] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "High-rise building" ] [incr menu_id] PRE [list ::FSI::examples::HighRiseBuilding] "" "" insertbefore = - } - GiDMenu::InsertOption "Kratos" [list "---"] [incr menu_id] PRE "" "" "" insertbefore = - GiDMenu::UpdateMenus -} - -FSI::examples::Init \ No newline at end of file diff --git a/kratos.gid/apps/FSI/examples/examples.xml b/kratos.gid/apps/FSI/examples/examples.xml new file mode 100644 index 000000000..f9a5ae56d --- /dev/null +++ b/kratos.gid/apps/FSI/examples/examples.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/FSI/images/HighRiseBuilding.png b/kratos.gid/apps/FSI/images/HighRiseBuilding.png new file mode 100644 index 000000000..7b95dbccc Binary files /dev/null and b/kratos.gid/apps/FSI/images/HighRiseBuilding.png differ diff --git a/kratos.gid/apps/Examples/images/FSI/MokChannelWithFlexibleWall2D.png b/kratos.gid/apps/FSI/images/MokChannelWithFlexibleWall2D.png similarity index 100% rename from kratos.gid/apps/Examples/images/FSI/MokChannelWithFlexibleWall2D.png rename to kratos.gid/apps/FSI/images/MokChannelWithFlexibleWall2D.png diff --git a/kratos.gid/apps/Examples/images/FSI/MokChannelWithFlexibleWall3D.png b/kratos.gid/apps/FSI/images/MokChannelWithFlexibleWall3D.png similarity index 100% rename from kratos.gid/apps/Examples/images/FSI/MokChannelWithFlexibleWall3D.png rename to kratos.gid/apps/FSI/images/MokChannelWithFlexibleWall3D.png diff --git a/kratos.gid/apps/Examples/images/FSI/TurekBenchmark2D.png b/kratos.gid/apps/FSI/images/TurekBenchmark2D.png similarity index 100% rename from kratos.gid/apps/Examples/images/FSI/TurekBenchmark2D.png rename to kratos.gid/apps/FSI/images/TurekBenchmark2D.png diff --git a/kratos.gid/apps/FSI/python/KratosFSI.py b/kratos.gid/apps/FSI/python/KratosFSI.py deleted file mode 100644 index 11ac0468a..000000000 --- a/kratos.gid/apps/FSI/python/KratosFSI.py +++ /dev/null @@ -1,32 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -from KratosMultiphysics.FSIApplication.fsi_analysis import FSIAnalysis - -import sys -import time - -class FSIAnalysisWithFlush(FSIAnalysis): - - def __init__(self, model, project_parameters, flush_frequency=10.0): - super(FSIAnalysisWithFlush,self).__init__(model, project_parameters) - self.flush_frequency = flush_frequency - self.last_flush = time.time() - - def FinalizeSolutionStep(self): - super(FSIAnalysisWithFlush,self).FinalizeSolutionStep() - - if self.parallel_type == "OpenMP": - now = time.time() - if now - self.last_flush > self.flush_frequency: - sys.stdout.flush() - self.last_flush = now - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = FSIAnalysisWithFlush(model, parameters) - simulation.Run() diff --git a/kratos.gid/apps/FSI/start.tcl b/kratos.gid/apps/FSI/start.tcl index 5ff52455f..d887ebe74 100644 --- a/kratos.gid/apps/FSI/start.tcl +++ b/kratos.gid/apps/FSI/start.tcl @@ -1,68 +1,23 @@ namespace eval ::FSI { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir - variable prefix - variable attributes - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::FSI::Init { } { +proc ::FSI::Init { app } { # Variable initialization variable dir - variable prefix - variable kratos_name - variable attributes - - set kratos_name FSIapplication + variable _app - #W "Sourced FSI" + set _app $app set dir [apps::getMyDir "FSI"] - set prefix FSI - - - apps::LoadAppById "Structural" - apps::LoadAppById "Fluid" - - # Intervals - dict set attributes UseIntervals 1 - # dict set ::Fluid::attributes UseIntervals 0 - # dict set ::Structural::attributes UseIntervals 0 - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - - set ::Model::ValidSpatialDimensions [list 2D 3D] - LoadMyFiles - #::spdAux::CreateDimensionWindow -} - -proc ::FSI::LoadMyFiles { } { - variable dir - - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - uplevel #0 [list source [file join $FSI::dir examples examples.tcl]] -} - -proc ::FSI::CustomToolbarItems { } { - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::FSI::examples::MokChannelFlexibleWall] [= "Example\nMOK - Channel with flexible wall"] - # TODO: REMOVE THIS IF STATEMENT ONCE THE 3D MOK BENCHMARK IS IMPLEMENTED - if {$::Model::SpatialDimension eq "2D"} { - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::FSI::examples::TurekBenchmark] [= "Example\nTurek benchmark - FSI2"] - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::FSI::examples::HighRiseBuilding] [= "Example\nHigh-rise building"] - } -} - -proc ::FSI::CustomMenus { } { - FSI::examples::UpdateMenus -} - -proc ::FSI::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value -} - -::FSI::Init + + ::FSI::xml::Init + ::FSI::write::Init +} \ No newline at end of file diff --git a/kratos.gid/apps/FSI/write/write.tcl b/kratos.gid/apps/FSI/write/write.tcl index fcdf28744..ffc59021f 100644 --- a/kratos.gid/apps/FSI/write/write.tcl +++ b/kratos.gid/apps/FSI/write/write.tcl @@ -1,10 +1,13 @@ -namespace eval FSI::write { +namespace eval ::FSI::write { + namespace path ::FSI + Kratos::AddNamespace [namespace current] + variable fluid_project_parameters variable structure_project_parameters variable mdpa_names } -proc FSI::write::Init { } { +proc ::FSI::write::Init { } { variable fluid_project_parameters variable structure_project_parameters set fluid_project_parameters [dict create ] @@ -15,7 +18,7 @@ proc FSI::write::Init { } { } # Events -proc FSI::write::writeModelPartEvent { } { +proc ::FSI::write::writeModelPartEvent { } { variable mdpa_names set filename [Kratos::GetModelName] @@ -33,13 +36,8 @@ proc FSI::write::writeModelPartEvent { } { write::RenameFileInModel "$filename.mdpa" "[dict get $mdpa_names Structural].mdpa" } -proc FSI::write::writeCustomFilesEvent { } { +proc ::FSI::write::writeCustomFilesEvent { } { Fluid::write::WriteMaterialsFile Structural::write::WriteMaterialsFile - - write::CopyFileIntoModel "python/KratosFSI.py" - write::RenameFileInModel "KratosFSI.py" "MainKratos.py" + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] } - - -FSI::write::Init diff --git a/kratos.gid/apps/FSI/write/writeProjectParameters.tcl b/kratos.gid/apps/FSI/write/writeProjectParameters.tcl index cb1b3518a..4f20cf496 100644 --- a/kratos.gid/apps/FSI/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/FSI/write/writeProjectParameters.tcl @@ -1,10 +1,13 @@ # Project Parameters -proc FSI::write::getParametersDict { } { +proc ::FSI::write::getParametersDict { } { # Init the Fluid and Structural dicts InitExternalProjectParameters set projectParametersDict [dict create] + # Analysis stage field + dict set projectParametersDict analysis_stage "KratosMultiphysics.FSIApplication.fsi_analysis" + # Problem data set problem_data_dict [GetProblemDataDict] dict set projectParametersDict problem_data $problem_data_dict @@ -12,7 +15,7 @@ proc FSI::write::getParametersDict { } { # Solver settings set solver_settings_dict [GetSolverSettingsDict] dict set projectParametersDict solver_settings $solver_settings_dict - + # Processes settings set processes_dict [GetProcessesDict] dict set projectParametersDict processes $processes_dict @@ -24,19 +27,19 @@ proc FSI::write::getParametersDict { } { return $projectParametersDict } -proc FSI::write::writeParametersEvent { } { +proc ::FSI::write::writeParametersEvent { } { set projectParametersDict [getParametersDict] write::SetParallelismConfiguration write::WriteJSON $projectParametersDict } -proc FSI::write::GetProblemDataDict { } { +proc ::FSI::write::GetProblemDataDict { } { # Copy the section from the Fluid, who owns the time parameters of the model set problem_data_dict [dict get $FSI::write::fluid_project_parameters problem_data] return $problem_data_dict } -proc FSI::write::GetSolverSettingsDict { } { +proc ::FSI::write::GetSolverSettingsDict { } { variable mdpa_names set solver_settings_dict [dict create] @@ -62,22 +65,30 @@ proc FSI::write::GetSolverSettingsDict { } { # coupling settings # Mapper settings - dict set solver_settings_dict coupling_settings [write::getSolutionStrategyParametersDict] + dict set solver_settings_dict coupling_settings [write::getSolutionStrategyParametersDict] dict set solver_settings_dict coupling_settings mapper_settings [GetMappingSettingsList] dict set solver_settings_dict coupling_settings coupling_strategy_settings [dict get [write::getSolversParametersDict FSI] coupling_strategy] - + # structure interface - set structure_interfaces_list [write::GetSubModelPartFromCondition STLoads StructureInterface2D] - lappend structure_interfaces_list {*}[write::GetSubModelPartFromCondition STLoads StructureInterface3D] + set structure_interfaces_list [list ] + set structure_interfaces_list_raw [write::GetSubModelPartFromCondition STLoads StructureInterface2D] + lappend structure_interfaces_list_raw {*}[write::GetSubModelPartFromCondition STLoads StructureInterface3D] + foreach interface $structure_interfaces_list_raw { + lappend structure_interfaces_list [Structural::write::GetAttribute model_part_name].$interface + } dict set solver_settings_dict coupling_settings structure_interfaces_list $structure_interfaces_list # Fluid interface set fluid_interface_uniquename FluidNoSlipInterface$::Model::SpatialDimension - set fluid_interfaces_list [write::GetSubModelPartFromCondition FLBC $fluid_interface_uniquename] + set fluid_interfaces_list [list ] + set fluid_interfaces_list_raw [write::GetSubModelPartFromCondition FLBC $fluid_interface_uniquename] + foreach interface $fluid_interfaces_list_raw { + lappend fluid_interfaces_list [Fluid::write::GetAttribute model_part_name].$interface + } dict set solver_settings_dict coupling_settings fluid_interfaces_list $fluid_interfaces_list - + # Change the input_filenames dict set solver_settings_dict structure_solver_settings model_import_settings input_filename [dict get $mdpa_names Structural] dict set solver_settings_dict fluid_solver_settings model_import_settings input_filename [dict get $mdpa_names Fluid] @@ -87,27 +98,34 @@ proc FSI::write::GetSolverSettingsDict { } { # set nodalresults [dict get $gid_output Parameters postprocess_parameters result_file_configuration nodal_results] # lappend nodalresults "MESH_DISPLACEMENT" # dict set gid_output Parameters postprocess_parameters result_file_configuration nodal_results $nodalresults - } -proc FSI::write::GetProcessesDict { } { +proc ::FSI::write::GetProcessesDict { } { set processes_dict [dict create] - + # Fluid dict set processes_dict fluid_initial_conditions_process_list [dict get $FSI::write::fluid_project_parameters processes initial_conditions_process_list] - dict set processes_dict fluid_boundary_conditions_process_list [dict get $FSI::write::fluid_project_parameters processes boundary_conditions_process_list] + dict set processes_dict fluid_boundary_conditions_process_list [GetNonDeprecatedProcessList [dict get $FSI::write::fluid_project_parameters processes boundary_conditions_process_list]] dict set processes_dict fluid_gravity [dict get $FSI::write::fluid_project_parameters processes gravity] dict set processes_dict fluid_auxiliar_process_list [dict get $FSI::write::fluid_project_parameters processes auxiliar_process_list] - + # Structure dict set processes_dict structure_constraints_process_list [dict get $FSI::write::structure_project_parameters processes constraints_process_list] - dict set processes_dict structure_loads_process_list [dict get $FSI::write::structure_project_parameters processes loads_process_list] + dict set processes_dict structure_loads_process_list [GetNonDeprecatedProcessList [dict get $FSI::write::structure_project_parameters processes loads_process_list]] return $processes_dict } -proc FSI::write::GetOutputProcessesDict { } { +proc ::FSI::write::GetNonDeprecatedProcessList { original_process_list } { + set list [list ] + foreach process $original_process_list { + if {[dict get $process python_module] ne "python_process"} {lappend list $process} + } + return $list +} + +proc ::FSI::write::GetOutputProcessesDict { } { set output_processes_dict [dict create] set gid_output_list [list ] @@ -120,38 +138,38 @@ proc FSI::write::GetOutputProcessesDict { } { # Append the fluid and structure output processes to the output processes dictionary lappend gid_output_list $structure_output lappend gid_output_list $fluid_output - + dict set output_processes_dict gid_output $gid_output_list return $output_processes_dict } -proc FSI::write::UpdateUniqueNames { appid } { +proc ::FSI::write::UpdateUniqueNames { appid } { set unList [list "Results"] foreach un $unList { - set current_un [apps::getAppUniqueName $appid $un] - spdAux::setRoute $un [spdAux::getRoute $current_un] + set current_un [apps::getAppUniqueName $appid $un] + spdAux::setRoute $un [spdAux::getRoute $current_un] } } -proc FSI::write::GetMappingSettingsList { } { +proc ::FSI::write::GetMappingSettingsList { } { set mappingsList [list ] set fluid_interface_name FluidNoSlipInterface$::Model::SpatialDimension set structural_interface_name StructureInterface$::Model::SpatialDimension set structuralInterface [lindex [write::GetSubModelPartFromCondition STLoads $structural_interface_name] 0] foreach fluid_interface [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute FLBC]/condition\[@n = '$fluid_interface_name'\]/group" ] { - set map [dict create] - set mapper_face [write::getValueByNode [$fluid_interface selectNodes ".//value\[@n='mapper_face']"] ] - dict set map mapper_face $mapper_face - dict set map fluid_interface_submodelpart_name [write::getSubModelPartId $fluid_interface_name [get_domnode_attribute $fluid_interface n]] - dict set map structure_interface_submodelpart_name $structuralInterface - lappend mappingsList $map + set map [dict create] + set mapper_face [write::getValueByNode [$fluid_interface selectNodes ".//value\[@n='mapper_face']"] ] + dict set map mapper_face $mapper_face + dict set map fluid_interface_submodelpart_name [Fluid::write::GetAttribute model_part_name].[write::getSubModelPartId $fluid_interface_name [get_domnode_attribute $fluid_interface n]] + dict set map structure_interface_submodelpart_name [Structural::write::GetAttribute model_part_name].$structuralInterface + lappend mappingsList $map } return $mappingsList } -proc FSI::write::InitExternalProjectParameters { } { +proc ::FSI::write::InitExternalProjectParameters { } { # Fluid section UpdateUniqueNames Fluid apps::setActiveAppSoft Fluid @@ -165,6 +183,5 @@ proc FSI::write::InitExternalProjectParameters { } { write::initWriteConfiguration [Structural::write::GetAttributes] set FSI::write::structure_project_parameters [Structural::write::getParametersDict] - apps::setActiveAppSoft FSI } \ No newline at end of file diff --git a/kratos.gid/apps/FSI/xml/Procs.spd b/kratos.gid/apps/FSI/xml/Procs.spd index e290687be..9f1f4c90f 100644 --- a/kratos.gid/apps/FSI/xml/Procs.spd +++ b/kratos.gid/apps/FSI/xml/Procs.spd @@ -111,5 +111,10 @@ return [Structural::xml::ProcCheckNodalConditionStateStructural $domNode $args] ]]> + + + \ No newline at end of file diff --git a/kratos.gid/apps/FSI/xml/XmlController.tcl b/kratos.gid/apps/FSI/xml/XmlController.tcl index 2df645e57..6685296c4 100644 --- a/kratos.gid/apps/FSI/xml/XmlController.tcl +++ b/kratos.gid/apps/FSI/xml/XmlController.tcl @@ -1,12 +1,15 @@ -namespace eval FSI::xml { +namespace eval ::FSI::xml { + namespace path ::FSI + Kratos::AddNamespace [namespace current] + # Namespace variables declaration variable dir } -proc FSI::xml::Init { } { +proc ::FSI::xml::Init { } { # Namespace variables initialization variable dir - Model::InitVariables dir $FSI::dir + Model::InitVariables dir $::FSI::dir Model::ForgetSolutionStrategies Model::getSolutionStrategies "../../Fluid/xml/Strategies.xml" @@ -21,18 +24,18 @@ proc FSI::xml::Init { } { Model::getSolvers Coupling_solvers.xml } -proc FSI::xml::getUniqueName {name} { - return ${::FSI::prefix}${name} +proc ::FSI::xml::getUniqueName {name} { + return [::FSI::GetAttribute prefix]${name} } proc ::FSI::xml::MultiAppEvent {args} { if {$args eq "init"} { - ::Structural::xml::MultiAppEvent init + catch {::Structural::xml::MultiAppEvent init} } } -proc FSI::xml::CustomTree { args } { +proc ::FSI::xml::CustomTree { args } { FSI::write::UpdateUniqueNames Fluid apps::setActiveAppSoft Fluid Fluid::xml::CustomTree @@ -51,7 +54,6 @@ proc FSI::xml::CustomTree { args } { # Remove Eigen #spdAux::SetValueOnTreeItem values "Static,Quasi-static,Dynamic,formfinding" STSoluType - # Disable MPI parallelism until it is fully tested #spdAux::SetValueOnTreeItem values "OpenMP" ParallelType @@ -83,5 +85,3 @@ proc spdAux::injectElementOutputs {basenode args} { } return [spdAux::injectElementOutputs_do $basenode $args] } - -FSI::xml::Init diff --git a/kratos.gid/apps/Fluid/app.json b/kratos.gid/apps/Fluid/app.json new file mode 100644 index 000000000..d220b9b5c --- /dev/null +++ b/kratos.gid/apps/Fluid/app.json @@ -0,0 +1,53 @@ +{ + "id": "Fluid", + "name": "CFD", + "prefix": "FL", + "themed": false, + "kratos_name": "FluidDynamicsApplication", + "python_packages": [ + "KratosFluidDynamicsApplication" + ], + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/CylinderInFlow.tcl", + "examples/HighRiseBuilding.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script": "::Fluid::Init", + "requeriments": { + "apps": [], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "unique_names": { + "parts": "FLParts", + "nodal_conditions": "FLNodalConditions", + "conditions": "FLBC", + "materials": "FLMaterials", + "results": "FLResults", + "drag": "FLDrags", + "time_parameters": "FLTimeParameters" + }, + "write": { + "coordinates": "all", + "materials_file": "FluidMaterials.json", + "properties_location": "json", + "model_part_name": "FluidModelPart", + "output_model_part_name": "fluid_computational_model_part" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml", + "description": "" +} \ No newline at end of file diff --git a/kratos.gid/apps/Fluid/examples/CylinderInFlow.tcl b/kratos.gid/apps/Fluid/examples/CylinderInFlow.tcl index 992d5a629..117491000 100644 --- a/kratos.gid/apps/Fluid/examples/CylinderInFlow.tcl +++ b/kratos.gid/apps/Fluid/examples/CylinderInFlow.tcl @@ -1,14 +1,19 @@ -proc ::Fluid::examples::CylinderInFlow {args} { +namespace eval ::Fluid::examples::CylinderInFlow { + namespace path ::Fluid::examples + Kratos::AddNamespace [namespace current] +} + +proc ::Fluid::examples::CylinderInFlow::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawCylinderInFlowGeometry$::Model::SpatialDimension - AssignGroupsCylinderInFlow$::Model::SpatialDimension - AssignCylinderInFlowMeshSizes$::Model::SpatialDimension - TreeAssignationCylinderInFlow$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignGroups$::Model::SpatialDimension + AssignMeshSizes$::Model::SpatialDimension + TreeAssignation$::Model::SpatialDimension GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -18,14 +23,14 @@ proc ::Fluid::examples::CylinderInFlow {args} { # Draw Geometry -proc Fluid::examples::DrawCylinderInFlowGeometry3D {args} { - DrawCylinderInFlowGeometry2D +proc ::Fluid::examples::CylinderInFlow::DrawGeometry3D {args} { + DrawGeometry2D 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 GiD_Layers edit opaque Fluid 0 - GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate obj x -150 y -30 escape escape + GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate objaxes x -150 y -30 escape escape } -proc Fluid::examples::DrawCylinderInFlowGeometry2D {args} { +proc ::Fluid::examples::CylinderInFlow::DrawGeometry2D {args} { Kratos::ResetModel GiD_Layers create Fluid GiD_Layers edit to_use Fluid @@ -68,7 +73,7 @@ proc Fluid::examples::DrawCylinderInFlowGeometry2D {args} { # Group assign -proc Fluid::examples::AssignGroupsCylinderInFlow2D {args} { +proc ::Fluid::examples::CylinderInFlow::AssignGroups2D {args} { # Create the groups GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -90,7 +95,7 @@ proc Fluid::examples::AssignGroupsCylinderInFlow2D {args} { GiD_Groups edit color No_Slip_Cylinder "#3b3b3bff" GiD_EntitiesGroups assign No_Slip_Cylinder lines 5 } -proc Fluid::examples::AssignGroupsCylinderInFlow3D {args} { +proc ::Fluid::examples::CylinderInFlow::AssignGroups3D {args} { # Create the groups GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -115,7 +120,7 @@ proc Fluid::examples::AssignGroupsCylinderInFlow3D {args} { # Mesh sizes -proc Fluid::examples::AssignCylinderInFlowMeshSizes3D {args} { +proc ::Fluid::examples::CylinderInFlow::AssignMeshSizes3D {args} { set cylinder_mesh_size 0.005 set walls_mesh_size 0.05 set fluid_mesh_size 0.05 @@ -127,7 +132,7 @@ proc Fluid::examples::AssignCylinderInFlowMeshSizes3D {args} { GiD_Process Mescape Meshing AssignSizes Volumes $fluid_mesh_size [GiD_EntitiesGroups get Fluid volumes] escape escape Kratos::Event_BeforeMeshGeneration $fluid_mesh_size } -proc Fluid::examples::AssignCylinderInFlowMeshSizes2D {args} { +proc ::Fluid::examples::CylinderInFlow::AssignMeshSizes2D {args} { set cylinder_mesh_size 0.005 set fluid_mesh_size 0.05 GiD_Process Mescape Utilities Variables SizeTransitionsFactor 0.4 escape escape @@ -138,11 +143,11 @@ proc Fluid::examples::AssignCylinderInFlowMeshSizes2D {args} { # Tree assign -proc Fluid::examples::TreeAssignationCylinderInFlow3D {args} { - TreeAssignationCylinderInFlow2D - AddCuts +proc ::Fluid::examples::CylinderInFlow::TreeAssignation3D {args} { + TreeAssignation2D + ::Fluid::examples::AddCuts } -proc Fluid::examples::TreeAssignationCylinderInFlow2D {args} { +proc ::Fluid::examples::CylinderInFlow::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -155,12 +160,12 @@ proc Fluid::examples::TreeAssignationCylinderInFlow2D {args} { # Fluid Parts set fluidParts [spdAux::getRoute "FLParts"] set fluidNode [customlib::AddConditionGroupOnXPath $fluidParts Fluid] - # set props [list Element Monolithic$nd ConstitutiveLaw Newtonian DENSITY 1.0 DYNAMIC_VISCOSITY 0.002 YIELD_STRESS 0 POWER_LAW_K 1 POWER_LAW_N 1] - set props [list Element Monolithic$nd ConstitutiveLaw Newtonian DENSITY 1.0 DYNAMIC_VISCOSITY 0.002] + # set props [list Element Monolithic$nd ConstitutiveLaw Newtonian2DLaw DENSITY 1.0 DYNAMIC_VISCOSITY 0.002 YIELD_STRESS 0 POWER_LAW_K 1 POWER_LAW_N 1] + set props [list Element Monolithic$nd ConstitutiveLaw Newtonian2DLaw DENSITY 1.0 DYNAMIC_VISCOSITY 0.002] spdAux::SetValuesOnBaseNode $fluidNode $props set fluidConditions [spdAux::getRoute "FLBC"] - ErasePreviousIntervals + ::Fluid::examples::ErasePreviousIntervals # Fluid Inlet Fluid::xml::CreateNewInlet Inlet {new true name inlet1 ini 0 end 1} true "6*y*(1-y)*sin(pi*t*0.5)" @@ -194,18 +199,3 @@ proc Fluid::examples::TreeAssignationCylinderInFlow2D {args} { spdAux::RequestRefresh } - -proc Fluid::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} - -proc Fluid::examples::AddCuts { } { - # Cuts - set results "[spdAux::getRoute FLResults]/container\[@n='GiDOutput'\]" - set cp [[customlib::GetBaseRoot] selectNodes "$results/container\[@n = 'CutPlanes'\]/blockdata\[@name = 'CutPlane'\]"] - [$cp selectNodes "./value\[@n = 'point'\]"] setAttribute v "0.0,0.5,0.0" -} \ No newline at end of file diff --git a/kratos.gid/apps/Fluid/examples/HighRiseBuilding.tcl b/kratos.gid/apps/Fluid/examples/HighRiseBuilding.tcl index 2e23a83bf..d25337f2c 100644 --- a/kratos.gid/apps/Fluid/examples/HighRiseBuilding.tcl +++ b/kratos.gid/apps/Fluid/examples/HighRiseBuilding.tcl @@ -1,5 +1,9 @@ +namespace eval ::Fluid::examples::HighRiseBuilding { + namespace path ::Fluid::examples + Kratos::AddNamespace [namespace current] +} -proc ::Fluid::examples::HighRiseBuilding {args} { +proc ::Fluid::examples::HighRiseBuilding::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] @@ -7,10 +11,10 @@ proc ::Fluid::examples::HighRiseBuilding {args} { } Kratos::ResetModel - DrawHighRiseBuildingGeometry$::Model::SpatialDimension - AssignGroupsHighRiseBuilding$::Model::SpatialDimension - AssignHighRiseBuildingMeshSizes$::Model::SpatialDimension - TreeAssignationHighRiseBuilding$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignGroups$::Model::SpatialDimension + AssignMeshSizes$::Model::SpatialDimension + TreeAssignation$::Model::SpatialDimension GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -20,11 +24,11 @@ proc ::Fluid::examples::HighRiseBuilding {args} { # Draw Geometry -proc Fluid::examples::DrawHighRiseBuildingGeometry3D {args} { +proc ::Fluid::examples::HighRiseBuilding::DrawGeometry3D {args} { # To be implemented } -proc Fluid::examples::DrawHighRiseBuildingGeometry2D {args} { +proc ::Fluid::examples::HighRiseBuilding::DrawGeometry2D {args} { GiD_Layers create Fluid GiD_Layers edit to_use Fluid @@ -51,7 +55,7 @@ proc Fluid::examples::DrawHighRiseBuildingGeometry2D {args} { # Group assign -proc Fluid::examples::AssignGroupsHighRiseBuilding2D {args} { +proc ::Fluid::examples::HighRiseBuilding::AssignGroups2D {args} { # Create the groups GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -77,17 +81,17 @@ proc Fluid::examples::AssignGroupsHighRiseBuilding2D {args} { GiD_Groups edit color InterfaceFluid "#3b3b3bff" GiD_EntitiesGroups assign InterfaceFluid lines {2 3 4} } -proc Fluid::examples::AssignGroupsHighRiseBuilding3D {args} { +proc ::Fluid::examples::HighRiseBuilding::AssignGroups3D {args} { # To be implemented } # Mesh sizes -proc Fluid::examples::AssignHighRiseBuildingMeshSizes3D {args} { +proc ::Fluid::examples::HighRiseBuilding::AssignMeshSizes3D {args} { # To be implemented } -proc Fluid::examples::AssignHighRiseBuildingMeshSizes2D {args} { +proc ::Fluid::examples::HighRiseBuilding::AssignMeshSizes2D {args} { set fluid_mesh_size 30.0 set walls_mesh_size 30.0 set building_mesh_size 3.0 @@ -102,11 +106,11 @@ proc Fluid::examples::AssignHighRiseBuildingMeshSizes2D {args} { # Tree assign -proc Fluid::examples::TreeAssignationHighRiseBuilding3D {args} { +proc ::Fluid::examples::HighRiseBuilding::TreeAssignation3D {args} { # To be implemented } -proc Fluid::examples::TreeAssignationHighRiseBuilding2D {args} { +proc ::Fluid::examples::HighRiseBuilding::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -123,11 +127,11 @@ proc Fluid::examples::TreeAssignationHighRiseBuilding2D {args} { spdAux::SetValuesOnBaseNode $fluidNode $props set fluidConditions [spdAux::getRoute "FLBC"] - ErasePreviousIntervals + ::Fluid::examples::ErasePreviousIntervals # Fluid Inlet - Fluid::xml::CreateNewInlet Inlet {new true name inlet1 ini 0 end 10.0} true "25.0*t/10.0" - Fluid::xml::CreateNewInlet Inlet {new true name inlet2 ini 10.0 end End} false 25.0 + ::Fluid::xml::CreateNewInlet Inlet {new true name inlet1 ini 0 end 10.0} true "25.0*t/10.0" + ::Fluid::xml::CreateNewInlet Inlet {new true name inlet2 ini 10.0 end End} false 25.0 # Fluid Outlet set fluidOutlet "$fluidConditions/condition\[@n='Outlet$nd'\]" @@ -158,11 +162,3 @@ proc Fluid::examples::TreeAssignationHighRiseBuilding2D {args} { spdAux::RequestRefresh } - -proc Fluid::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} \ No newline at end of file diff --git a/kratos.gid/apps/Fluid/examples/examples.tcl b/kratos.gid/apps/Fluid/examples/examples.tcl index c99d8c7c8..e00f4cfa9 100644 --- a/kratos.gid/apps/Fluid/examples/examples.tcl +++ b/kratos.gid/apps/Fluid/examples/examples.tcl @@ -1,17 +1,20 @@ -namespace eval Fluid::examples { - -} - -proc Fluid::examples::Init { } { - uplevel #0 [list source [file join $::Fluid::dir examples CylinderInFlow.tcl]] - uplevel #0 [list source [file join $::Fluid::dir examples HighRiseBuilding.tcl]] +namespace eval ::Fluid::examples { + namespace path ::Fluid + Kratos::AddNamespace [namespace current] } -proc Fluid::examples::UpdateMenus { } { - GiDMenu::InsertOption "Kratos" [list "---"] 7 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Cylinder in air flow" ] 7 PRE [list ::Fluid::examples::CylinderInFlow] "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "High-rise building" ] 7 PRE [list ::Fluid::examples::HighRiseBuilding] "" "" insertafter = - GiDMenu::UpdateMenus +# Common functions for all examples that uses Fluid App +proc ::Fluid::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} + } } -Fluid::examples::Init \ No newline at end of file +proc ::Fluid::examples::AddCuts { } { + # Cuts + set results "[spdAux::getRoute FLResults]/container\[@n='GiDOutput'\]" + set cp [[customlib::GetBaseRoot] selectNodes "$results/container\[@n = 'CutPlanes'\]/blockdata\[@name = 'CutPlane'\]"] + [$cp selectNodes "./value\[@n = 'point'\]"] setAttribute v "0.0,0.5,0.0" +} \ No newline at end of file diff --git a/kratos.gid/apps/Fluid/examples/examples.xml b/kratos.gid/apps/Fluid/examples/examples.xml new file mode 100644 index 000000000..3fda1852f --- /dev/null +++ b/kratos.gid/apps/Fluid/examples/examples.xml @@ -0,0 +1,17 @@ + + + + This example applies an inlet condition to the air surrounding a 2D building. + The default mesh is made of 4.000 trianglular elements, and the calculation generates results for 800 timesteps. + - Size of model: 0.4 MB + - Time: Avg calulation time: 2 minutes + - Size with results: 250 MB + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/Examples/images/Fluid/CylinderInFlow2D.png b/kratos.gid/apps/Fluid/images/CylinderInFlow2D.png similarity index 100% rename from kratos.gid/apps/Examples/images/Fluid/CylinderInFlow2D.png rename to kratos.gid/apps/Fluid/images/CylinderInFlow2D.png diff --git a/kratos.gid/apps/Examples/images/Fluid/CylinderInFlow3D.png b/kratos.gid/apps/Fluid/images/CylinderInFlow3D.png similarity index 100% rename from kratos.gid/apps/Examples/images/Fluid/CylinderInFlow3D.png rename to kratos.gid/apps/Fluid/images/CylinderInFlow3D.png diff --git a/kratos.gid/apps/Fluid/images/HighRiseBuilding2D.png b/kratos.gid/apps/Fluid/images/HighRiseBuilding2D.png new file mode 100644 index 000000000..74982cb6d Binary files /dev/null and b/kratos.gid/apps/Fluid/images/HighRiseBuilding2D.png differ diff --git a/kratos.gid/apps/Fluid/images/drop.png b/kratos.gid/apps/Fluid/images/drop.png new file mode 100644 index 000000000..eb9ebee00 Binary files /dev/null and b/kratos.gid/apps/Fluid/images/drop.png differ diff --git a/kratos.gid/apps/Fluid/images/gas.png b/kratos.gid/apps/Fluid/images/gas.png new file mode 100644 index 000000000..105b8e278 Binary files /dev/null and b/kratos.gid/apps/Fluid/images/gas.png differ diff --git a/kratos.gid/apps/Fluid/python/KratosFluid.py b/kratos.gid/apps/Fluid/python/KratosFluid.py deleted file mode 100644 index 422e49f08..000000000 --- a/kratos.gid/apps/Fluid/python/KratosFluid.py +++ /dev/null @@ -1,32 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -from KratosMultiphysics.FluidDynamicsApplication.fluid_dynamics_analysis import FluidDynamicsAnalysis - -import sys -import time - -class FluidDynamicsAnalysisWithFlush(FluidDynamicsAnalysis): - - def __init__(self,model,project_parameters,flush_frequency=10.0): - super(FluidDynamicsAnalysisWithFlush,self).__init__(model,project_parameters) - self.flush_frequency = flush_frequency - self.last_flush = time.time() - - def FinalizeSolutionStep(self): - super(FluidDynamicsAnalysisWithFlush,self).FinalizeSolutionStep() - - if self.parallel_type == "OpenMP": - now = time.time() - if now - self.last_flush > self.flush_frequency: - sys.stdout.flush() - self.last_flush = now - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = FluidDynamicsAnalysisWithFlush(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/Fluid/start.tcl b/kratos.gid/apps/Fluid/start.tcl index 6bcbea730..4816d4682 100644 --- a/kratos.gid/apps/Fluid/start.tcl +++ b/kratos.gid/apps/Fluid/start.tcl @@ -1,64 +1,24 @@ namespace eval ::Fluid { + Kratos::AddNamespace [namespace current] + # Variable declaration + variable _app variable dir - variable prefix - variable attributes - variable kratos_name - variable app_id + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::Fluid::Init { } { +proc ::Fluid::Init { app } { # Variable initialization + variable _app variable dir - variable prefix - variable attributes - variable kratos_name - variable app_id - - set app_id Fluid - set kratos_name "FluidDynamicsApplication" + set _app $app set dir [apps::getMyDir "Fluid"] - set attributes [dict create] - - set prefix FL - set ::Model::ValidSpatialDimensions [list 2D 3D] - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - - dict set attributes UseIntervals 1 - - LoadMyFiles - #::spdAux::CreateDimensionWindow -} - -proc ::Fluid::LoadMyFiles { } { - variable dir - - uplevel #0 [list source [file join $dir examples examples.tcl]] - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] -} - -proc ::Fluid::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value -} - -proc ::Fluid::CustomToolbarItems { } { - variable dir - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Fluid::examples::CylinderInFlow] [= "Example\nCylinder in air flow"] - if {$::Model::SpatialDimension eq "2D"} { - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Fluid::examples::HighRiseBuilding] [= "Example\nHigh-rise building"] - } -} - -proc ::Fluid::CustomMenus { } { - Fluid::examples::UpdateMenus + + # XML init event + ::Fluid::xml::Init + ::Fluid::write::Init } - -::Fluid::Init diff --git a/kratos.gid/apps/Fluid/write/write.tcl b/kratos.gid/apps/Fluid/write/write.tcl index a2cdbbce2..13944ebc8 100644 --- a/kratos.gid/apps/Fluid/write/write.tcl +++ b/kratos.gid/apps/Fluid/write/write.tcl @@ -1,4 +1,7 @@ -namespace eval Fluid::write { +namespace eval ::Fluid::write { + namespace path ::Fluid + Kratos::AddNamespace [namespace current] + # Namespace variables declaration variable writeCoordinatesByGroups variable writeAttributes @@ -8,29 +11,30 @@ namespace eval Fluid::write { variable last_condition_iterator } -proc Fluid::write::Init { } { +proc ::Fluid::write::Init { } { # Namespace variables inicialization - - SetAttribute parts_un FLParts - SetAttribute nodal_conditions_un FLNodalConditions - SetAttribute conditions_un FLBC - SetAttribute materials_un FLMaterials - SetAttribute results_un FLResults - SetAttribute drag_un FLDrags - SetAttribute time_parameters_un FLTimeParameters - SetAttribute writeCoordinatesByGroups 0 + SetAttribute parts_un [::Fluid::GetUniqueName parts] + SetAttribute nodal_conditions_un [::Fluid:::GetUniqueName nodal_conditions] + SetAttribute conditions_un [::Fluid::GetUniqueName conditions] + SetAttribute materials_un [::Fluid::GetUniqueName materials] + SetAttribute results_un [::Fluid::GetUniqueName results] + SetAttribute drag_un [::Fluid::GetUniqueName drag] + SetAttribute time_parameters_un [::Fluid::GetUniqueName time_parameters] + + SetAttribute writeCoordinatesByGroups [::Fluid::GetWriteProperty coordinates] SetAttribute validApps [list "Fluid"] - SetAttribute main_script_file "KratosFluid.py" - SetAttribute materials_file "FluidMaterials.json" - SetAttribute properties_location json - SetAttribute model_part_name "FluidModelPart" - SetAttribute output_model_part_name "fluid_computational_model_part" + SetAttribute main_launch_file [::Fluid::GetAttribute main_launch_file] + SetAttribute materials_file [::Fluid::GetWriteProperty materials_file] + SetAttribute properties_location [::Fluid::GetWriteProperty properties_location] + SetAttribute model_part_name [::Fluid::GetWriteProperty model_part_name] + SetAttribute output_model_part_name [::Fluid::GetWriteProperty output_model_part_name] + variable last_condition_iterator set last_condition_iterator 0 } # MDPA write event -proc Fluid::write::writeModelPartEvent { } { +proc ::Fluid::write::writeModelPartEvent { } { # Validation set err [Validate] if {$err ne ""} {error $err} @@ -45,7 +49,7 @@ proc Fluid::write::writeModelPartEvent { } { writeProperties # Nodal coordinates (1: Print only Fluid nodes | 0: the whole mesh ) - if {[GetAttribute writeCoordinatesByGroups]} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} + if {[GetAttribute writeCoordinatesByGroups] ne "all"} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} # Element connectivities (Groups on FLParts) write::writeElementConnectivities @@ -55,32 +59,37 @@ proc Fluid::write::writeModelPartEvent { } { # Custom SubmodelParts variable last_condition_iterator - write::writeBasicSubmodelPartsByUniqueId $Fluid::write::FluidConditionMap $last_condition_iterator - + write::writeBasicSubmodelPartsByUniqueId $Fluid::write::FluidConditionMap $last_condition_iterator + # SubmodelParts writeMeshes + # Write custom blocks at the end of the file + writeCustomBlocks + # Clean - unset Fluid::write::FluidConditionMap + unset ::Fluid::write::FluidConditionMap } -proc Fluid::write::writeCustomFilesEvent { } { - # Write the fluid materials json file - Fluid::write::WriteMaterialsFile - # Main python script - set orig_name [GetAttribute main_script_file] - write::CopyFileIntoModel [file join "python" $orig_name ] - write::RenameFileInModel $orig_name "MainKratos.py" +proc ::Fluid::write::writeCustomFilesEvent { } { + # Write the fluid materials json file + ::Fluid::write::WriteMaterialsFile + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] } # Custom files -proc Fluid::write::WriteMaterialsFile { {write_const_law True} {include_modelpart_name True} } { +proc ::Fluid::write::WriteMaterialsFile { {write_const_law True} {include_modelpart_name True} } { set model_part_name "" if {[write::isBooleanTrue $include_modelpart_name]} {set model_part_name [GetAttribute model_part_name]} write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] $write_const_law $model_part_name } +proc Fluid::write::GetMaterialsFile { {write_const_law True} {include_modelpart_name True} } { + set model_part_name "" + if {[write::isBooleanTrue $include_modelpart_name]} {set model_part_name [GetAttribute model_part_name]} + return [write::getPropertiesJson [GetAttribute parts_un] $write_const_law $model_part_name] +} -proc Fluid::write::Validate {} { +proc ::Fluid::write::Validate {} { set err "" set root [customlib::GetBaseRoot] @@ -98,23 +107,23 @@ proc Fluid::write::Validate {} { } # MDPA Blocks -proc Fluid::write::writeProperties { } { +proc ::Fluid::write::writeProperties { } { # Begin Properties write::WriteString "Begin Properties 0" write::WriteString "End Properties" write::WriteString "" } -proc Fluid::write::writeConditions { } { +proc ::Fluid::write::writeConditions { } { writeBoundaryConditions writeDrags } -proc Fluid::write::getFluidModelPartFilename { } { +proc ::Fluid::write::getFluidModelPartFilename { } { return [Kratos::GetModelName] } -proc Fluid::write::writeBoundaryConditions { } { +proc ::Fluid::write::writeBoundaryConditions { } { variable FluidConditionMap variable last_condition_iterator @@ -146,26 +155,26 @@ proc Fluid::write::writeBoundaryConditions { } { set kname LineCondition2D2N set nnodes 2 } - set last_condition_iterator [write::writeGroupConditionByUniqueId $skin_group_name $kname $nnodes 0 $Fluid::write::FluidConditionMap] + set last_condition_iterator [write::writeGroupConditionByUniqueId $skin_group_name $kname $nnodes 0 $::Fluid::write::FluidConditionMap] # Clean GiD_Groups delete $skin_group_name } -proc Fluid::write::writeDrags { } { +proc ::Fluid::write::writeDrags { } { lappend ::Model::NodalConditions [::Model::NodalCondition new Drag] write::writeNodalConditions [GetAttribute drag_un] Model::ForgetNodalCondition Drag } -proc Fluid::write::writeMeshes { } { +proc ::Fluid::write::writeMeshes { } { write::writePartSubModelPart write::writeNodalConditions [GetAttribute nodal_conditions_un] writeConditionsMesh #writeSkinMesh } -proc Fluid::write::writeConditionsMesh { } { +proc ::Fluid::write::writeConditionsMesh { } { set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group" @@ -202,7 +211,12 @@ proc Fluid::write::writeConditionsMesh { } { } } -proc Fluid::write::InitConditionsMap { {map "" } } { +# Overwrite this function to print something at the end of the mdpa +proc ::Fluid::write::writeCustomBlocks { } { + +} + +proc ::Fluid::write::InitConditionsMap { {map "" } } { variable FluidConditionMap if {$map eq ""} { @@ -211,43 +225,43 @@ proc Fluid::write::InitConditionsMap { {map "" } } { set FluidConditionMap $map } } -proc Fluid::write::FreeConditionsMap { } { +proc ::Fluid::write::FreeConditionsMap { } { variable FluidConditionMap unset FluidConditionMap } -proc Fluid::write::GetAttribute {att} { +proc ::Fluid::write::GetAttribute {att} { variable writeAttributes return [dict get $writeAttributes $att] } -proc Fluid::write::GetAttributes {} { +proc ::Fluid::write::GetAttributes {} { variable writeAttributes return $writeAttributes } -proc Fluid::write::SetAttribute {att val} { +proc ::Fluid::write::SetAttribute {att val} { variable writeAttributes dict set writeAttributes $att $val } -proc Fluid::write::AddAttribute {att val} { +proc ::Fluid::write::AddAttribute {att val} { variable writeAttributes dict lappend writeAttributes $att $val } -proc Fluid::write::AddAttributes {configuration} { +proc ::Fluid::write::AddAttributes {configuration} { variable writeAttributes set writeAttributes [dict merge $writeAttributes $configuration] } -proc Fluid::write::AddValidApps {appid} { +proc ::Fluid::write::AddValidApps {appid} { AddAttribute validApps $appid } -proc Fluid::write::SetCoordinatesByGroups {value} { +proc ::Fluid::write::SetCoordinatesByGroups {value} { SetAttribute writeCoordinatesByGroups $value } -Fluid::write::Init + diff --git a/kratos.gid/apps/Fluid/write/writeByGiDId.tcl b/kratos.gid/apps/Fluid/write/writeByGiDId.tcl index 9b1bc9546..505133134 100644 --- a/kratos.gid/apps/Fluid/write/writeByGiDId.tcl +++ b/kratos.gid/apps/Fluid/write/writeByGiDId.tcl @@ -1,11 +1,14 @@ -namespace eval Fluid::write { +namespace eval ::Fluid::write { + namespace path ::Fluid + Kratos::AddNamespace [namespace current] + # Namespace variables declaration variable writeCoordinatesByGroups variable writeAttributes variable FluidConditionMap } -proc Fluid::write::Init { } { +proc ::Fluid::write::Init { } { # Namespace variables inicialization InitConditionsMap @@ -16,14 +19,14 @@ proc Fluid::write::Init { } { SetAttribute drag_un FLDrags SetAttribute writeCoordinatesByGroups 0 SetAttribute validApps [list "Fluid"] - SetAttribute main_script_file "KratosFluid.py" + SetAttribute main_launch_file "../../exec/MainKratos.py" SetAttribute materials_file "FluidMaterials.json" SetAttribute properties_location json FreeConditionsMap } # Events -proc Fluid::write::writeModelPartEvent { } { +proc ::Fluid::write::writeModelPartEvent { } { # Validation set err [Validate] if {$err ne ""} {error $err} @@ -50,17 +53,17 @@ proc Fluid::write::writeModelPartEvent { } { # Custom SubmodelParts #write::writeBasicSubmodelParts } -proc Fluid::write::writeCustomFilesEvent { } { +proc ::Fluid::write::writeCustomFilesEvent { } { # Materials file TODO -> Python script must read from here write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] # Main python script - set orig_name [GetAttribute main_script_file] + set orig_name [GetAttribute main_launch_file] write::CopyFileIntoModel [file join "python" $orig_name ] write::RenameFileInModel $orig_name "MainKratos.py" } -proc Fluid::write::Validate {} { +proc ::Fluid::write::Validate {} { set err "" set root [customlib::GetBaseRoot] @@ -78,40 +81,40 @@ proc Fluid::write::Validate {} { } # MDPA Blocks -proc Fluid::write::writeProperties { } { +proc ::Fluid::write::writeProperties { } { # Begin Properties write::WriteString "Begin Properties 0" write::WriteString "End Properties" write::WriteString "" } -proc Fluid::write::writeConditions { } { +proc ::Fluid::write::writeConditions { } { writeBoundaryConditions writeDrags } -proc Fluid::write::writeBoundaryConditions { } { +proc ::Fluid::write::writeBoundaryConditions { } { set BCUN [GetAttribute conditions_un] # Write the conditions - write::writeConditionsByGiDId $BCUN + ::write::writeConditionsByGiDId $BCUN } -proc Fluid::write::writeDrags { } { +proc ::Fluid::write::writeDrags { } { lappend ::Model::NodalConditions [::Model::NodalCondition new Drag] write::writeNodalConditions [GetAttribute drag_un] Model::ForgetNodalCondition Drag } -proc Fluid::write::writeMeshes { } { +proc ::Fluid::write::writeMeshes { } { write::writePartSubModelPart write::writeNodalConditions [GetAttribute nodal_conditions_un] writeConditionsMesh #writeSkinMesh } -proc Fluid::write::writeConditionsMesh { } { +proc ::Fluid::write::writeConditionsMesh { } { set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group" @@ -148,7 +151,7 @@ proc Fluid::write::writeConditionsMesh { } { } } -# proc Fluid::write::writeSkinMesh { } { +# proc ::Fluid::write::writeSkinMesh { } { # variable FluidConditions # set root [customlib::GetBaseRoot] @@ -174,7 +177,7 @@ proc Fluid::write::writeConditionsMesh { } { # ::write::writeGroupSubModelPart EXTRA $skinconfgroup "Conditions" $listiniend # } -# proc Fluid::write::CheckClosedVolume {} { +# proc ::Fluid::write::CheckClosedVolume {} { # variable BCUN # set isclosed 1 @@ -207,36 +210,36 @@ proc Fluid::write::writeConditionsMesh { } { -proc Fluid::write::GetAttribute {att} { +proc ::Fluid::write::GetAttribute {att} { variable writeAttributes return [dict get $writeAttributes $att] } -proc Fluid::write::GetAttributes {} { +proc ::Fluid::write::GetAttributes {} { variable writeAttributes return $writeAttributes } -proc Fluid::write::SetAttribute {att val} { +proc ::Fluid::write::SetAttribute {att val} { variable writeAttributes dict set writeAttributes $att $val } -proc Fluid::write::AddAttribute {att val} { +proc ::Fluid::write::AddAttribute {att val} { variable writeAttributes dict lappend writeAttributes $att $val } -proc Fluid::write::AddAttributes {configuration} { +proc ::Fluid::write::AddAttributes {configuration} { variable writeAttributes set writeAttributes [dict merge $writeAttributes $configuration] } -proc Fluid::write::AddValidApps {appid} { +proc ::Fluid::write::AddValidApps {appid} { AddAttribute validApps $appid } -proc Fluid::write::SetCoordinatesByGroups {value} { +proc ::Fluid::write::SetCoordinatesByGroups {value} { SetAttribute writeCoordinatesByGroups $value } diff --git a/kratos.gid/apps/Fluid/write/writeProjectParameters.tcl b/kratos.gid/apps/Fluid/write/writeProjectParameters.tcl index 471faaac9..fae554fe7 100644 --- a/kratos.gid/apps/Fluid/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/Fluid/write/writeProjectParameters.tcl @@ -2,11 +2,14 @@ proc ::Fluid::write::getParametersDict { } { set projectParametersDict [dict create] + # Analysis stage field + dict set projectParametersDict analysis_stage "KratosMultiphysics.FluidDynamicsApplication.fluid_dynamics_analysis" + # Problem data - dict set projectParametersDict problem_data [write::GetDefaultProblemDataDict $Fluid::app_id] + dict set projectParametersDict problem_data [write::GetDefaultProblemDataDict [::Fluid::GetAttribute id]] # output configuration - dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict $Fluid::app_id] + dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict [::Fluid::GetAttribute id]] # Solver settings set solver_settings_dict [Fluid::write::getSolverSettingsDict] @@ -15,8 +18,8 @@ proc ::Fluid::write::getParametersDict { } { # Boundary conditions processes set processesDict [dict create] - dict set processesDict initial_conditions_process_list [write::getConditionsParametersDict [GetAttribute nodal_conditions_un] "Nodal"] - dict set processesDict boundary_conditions_process_list [write::getConditionsParametersDict [GetAttribute conditions_un]] + dict set processesDict initial_conditions_process_list [write::getConditionsParametersDict [::Fluid::GetUniqueName nodal_conditions] "Nodal"] + dict set processesDict boundary_conditions_process_list [write::getConditionsParametersDict [::Fluid::GetUniqueName conditions]] dict set processesDict gravity [list [getGravityProcessDict] ] dict set processesDict auxiliar_process_list [getAuxiliarProcessList] @@ -25,13 +28,13 @@ proc ::Fluid::write::getParametersDict { } { return $projectParametersDict } -proc Fluid::write::writeParametersEvent { } { +proc ::Fluid::write::writeParametersEvent { } { set projectParametersDict [getParametersDict] write::SetParallelismConfiguration write::WriteJSON $projectParametersDict } -proc Fluid::write::getAuxiliarProcessList {} { +proc ::Fluid::write::getAuxiliarProcessList {} { set process_list [list ] foreach process [getDragProcessList] {lappend process_list $process} @@ -39,11 +42,11 @@ proc Fluid::write::getAuxiliarProcessList {} { return $process_list } -proc Fluid::write::getDragProcessList {} { +proc ::Fluid::write::getDragProcessList {} { set root [customlib::GetBaseRoot] set process_list [list ] - set xp1 "[spdAux::getRoute [GetAttribute drag_un]]/group" + set xp1 "[spdAux::getRoute [::Fluid::GetUniqueName drag]]/group" set groups [$root selectNodes $xp1] foreach group $groups { set groupName [$group @n] @@ -73,7 +76,7 @@ proc Fluid::write::getDragProcessList {} { } # Gravity SubModelParts and Process collection -proc Fluid::write::getGravityProcessDict {} { +proc ::Fluid::write::getGravityProcessDict {} { set root [customlib::GetBaseRoot] set value [write::getValue FLGravity GravityValue] @@ -98,10 +101,10 @@ proc Fluid::write::getGravityProcessDict {} { } # Skin SubModelParts ids -proc Fluid::write::getBoundaryConditionMeshId {} { +proc ::Fluid::write::getBoundaryConditionMeshId {} { set root [customlib::GetBaseRoot] set listOfBCGroups [list ] - set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group" + set xp1 "[spdAux::getRoute [::Fluid::GetUniqueName conditions]]/condition/group" set groups [$root selectNodes $xp1] foreach group $groups { set groupName [$group @n] @@ -126,12 +129,12 @@ proc Fluid::write::getBoundaryConditionMeshId {} { } # No-skin SubModelParts ids -proc Fluid::write::getNoSkinConditionMeshId {} { +proc ::Fluid::write::getNoSkinConditionMeshId {} { set root [customlib::GetBaseRoot] set listOfNoSkinGroups [list ] # Append drag processes model parts names - set xp1 "[spdAux::getRoute [GetAttribute drag_un]]/group" + set xp1 "[spdAux::getRoute [::Fluid::GetUniqueName drag]]/group" set dragGroups [$root selectNodes $xp1] foreach dragGroup $dragGroups { set groupName [$dragGroup @n] @@ -158,13 +161,30 @@ proc Fluid::write::getNoSkinConditionMeshId {} { return $listOfNoSkinGroups } -proc Fluid::write::getSolverSettingsDict { } { +proc ::Fluid::write::GetUsedElements {} { + set root [customlib::GetBaseRoot] + + # Get the fluid part + set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/group" + set lista [list ] + foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { + set g $gNode + set name [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element']"] ] + if {$name ni $lista} {lappend lista $name} + } + + return $lista +} + +proc ::Fluid::write::getSolverSettingsDict { } { set solverSettingsDict [dict create] dict set solverSettingsDict model_part_name [GetAttribute model_part_name] set nDim [expr [string range [write::getValue nDim] 0 0]] dict set solverSettingsDict domain_size $nDim - set currentStrategyId [write::getValue FLSolStrat] - set strategy_write_name [[::Model::GetSolutionStrategy $currentStrategyId] getAttribute "ImplementedInPythonFile"] + set currentStrategyId [write::getValue FLSolStrat "" force] + set strategy [::Model::GetSolutionStrategy $currentStrategyId] + set strategy_write_name [$strategy getAttribute "ImplementedInPythonFile"] + set strategy_type [$strategy getAttribute "Type"] dict set solverSettingsDict solver_type $strategy_write_name # model import settings @@ -191,6 +211,11 @@ proc Fluid::write::getSolverSettingsDict { } { # No skin parts dict set solverSettingsDict no_skin_parts [getNoSkinConditionMeshId] + # Time scheme settings + if {$strategy_type eq "monolithic"} { + dict set solverSettingsDict time_scheme [write::getValue FLScheme] + } + # Time stepping settings set timeSteppingDict [dict create] set automaticDeltaTime [write::getValue FLTimeParameters AutomaticDeltaTime] @@ -205,23 +230,41 @@ proc Fluid::write::getSolverSettingsDict { } { dict set solverSettingsDict time_stepping $timeSteppingDict # For monolithic schemes, set the formulation settings - if {$currentStrategyId eq "Monolithic"} { + if {$strategy_type eq "monolithic"} { + # Create formulation dictionary set formulationSettingsDict [dict create] - # Set element type - # TODO: get element type name from the xml -> Avoid Hardcoding - dict set formulationSettingsDict element_type "vms" + + # Set formulation dictionary element type + set elements [Fluid::write::GetUsedElements] + if {[llength $elements] ne 1} {error "You must select 1 element"} {set element_name [lindex $elements 0]} + set element_type [Fluid::write::GetMonolithicElementTypeFromElementName $element_name] + dict set formulationSettingsDict element_type $element_type + # Set OSS and remove oss_switch from the original dictionary # It is important to check that there is oss_switch, otherwise the derived apps (e.g. embedded) might crash if {[dict exists $solverSettingsDict oss_switch]} { - dict set formulationSettingsDict use_orthogonal_subscales [write::getStringBinaryFromValue [dict get $solverSettingsDict oss_switch]] + # Set the oss_switch only in those elements that support it + if {$element_type eq "qsvms" || $element_type eq "dvms"} { + dict set formulationSettingsDict use_orthogonal_subscales [write::getStringBinaryFromValue [dict get $solverSettingsDict oss_switch]] + } + # Always remove the oss_switch from the original dictionary dict unset solverSettingsDict oss_switch } - # Set dynamic tau and remove dynamic_tau from the original dictionary + + # Set dynamic tau and remove it from the original dictionary dict set formulationSettingsDict dynamic_tau [dict get $solverSettingsDict dynamic_tau] dict unset solverSettingsDict dynamic_tau + # Include the formulation settings in the solver settings dict dict set solverSettingsDict formulation $formulationSettingsDict } return $solverSettingsDict +} + +proc ::Fluid::write::GetMonolithicElementTypeFromElementName {element_name} { + set element [Model::getElement $element_name] + if {![$element hasAttribute FormulationElementType]} {error "Your monolithic element $element_name need to define the FormulationElementType field"} + set formulation_element_type [$element getAttribute FormulationElementType] + return {*}$formulation_element_type } \ No newline at end of file diff --git a/kratos.gid/apps/Fluid/xml/AnalysisType.spd b/kratos.gid/apps/Fluid/xml/AnalysisType.spd index 8d1acb277..bd00ea862 100644 --- a/kratos.gid/apps/Fluid/xml/AnalysisType.spd +++ b/kratos.gid/apps/Fluid/xml/AnalysisType.spd @@ -2,6 +2,7 @@ - + + - \ No newline at end of file + diff --git a/kratos.gid/apps/Fluid/xml/ConstitutiveLaws.xml b/kratos.gid/apps/Fluid/xml/ConstitutiveLaws.xml index e43c5960f..34555ab9c 100644 --- a/kratos.gid/apps/Fluid/xml/ConstitutiveLaws.xml +++ b/kratos.gid/apps/Fluid/xml/ConstitutiveLaws.xml @@ -1,7 +1,7 @@ - + @@ -10,7 +10,7 @@ - + @@ -19,6 +19,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -33,6 +34,7 @@ + @@ -45,53 +47,227 @@ - - - - - - - + + + + + + + - - - + + + + - - - - - - - - - - - + + + + + + + - + + + - - - - - + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/Fluid/xml/Materials.xml b/kratos.gid/apps/Fluid/xml/Materials.xml index 775490c6a..8f3fab1b7 100644 --- a/kratos.gid/apps/Fluid/xml/Materials.xml +++ b/kratos.gid/apps/Fluid/xml/Materials.xml @@ -1,15 +1,17 @@ - + - + + - + - + + diff --git a/kratos.gid/apps/Fluid/xml/Parts.spd b/kratos.gid/apps/Fluid/xml/Parts.spd index f9de1d27a..f670b9bc5 100644 --- a/kratos.gid/apps/Fluid/xml/Parts.spd +++ b/kratos.gid/apps/Fluid/xml/Parts.spd @@ -1,17 +1,14 @@ - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/Fluid/xml/Procs.spd b/kratos.gid/apps/Fluid/xml/Procs.spd index 53779c99b..b68a2aa0b 100644 --- a/kratos.gid/apps/Fluid/xml/Procs.spd +++ b/kratos.gid/apps/Fluid/xml/Procs.spd @@ -35,4 +35,9 @@ return $r ]]> + + + \ No newline at end of file diff --git a/kratos.gid/apps/Fluid/xml/Strategies.xml b/kratos.gid/apps/Fluid/xml/Strategies.xml index 90c81075e..f77499c01 100644 --- a/kratos.gid/apps/Fluid/xml/Strategies.xml +++ b/kratos.gid/apps/Fluid/xml/Strategies.xml @@ -6,6 +6,7 @@ - - - - - - - + + + + + + + + + + + + @@ -55,6 +61,7 @@ - + diff --git a/kratos.gid/apps/Fluid/xml/XmlController.tcl b/kratos.gid/apps/Fluid/xml/XmlController.tcl index b0bcb4888..cb28e5bcf 100644 --- a/kratos.gid/apps/Fluid/xml/XmlController.tcl +++ b/kratos.gid/apps/Fluid/xml/XmlController.tcl @@ -1,12 +1,15 @@ -namespace eval Fluid::xml { +namespace eval ::Fluid::xml { + namespace path ::Fluid + Kratos::AddNamespace [namespace current] + # Namespace variables declaration variable dir } -proc Fluid::xml::Init { } { +proc ::Fluid::xml::Init { } { # Namespace variables inicialization variable dir - Model::InitVariables dir $Fluid::dir + Model::InitVariables dir $::Fluid::dir Model::getSolutionStrategies Strategies.xml Model::getElements Elements.xml @@ -17,16 +20,17 @@ proc Fluid::xml::Init { } { Model::getProcesses Processes.xml Model::getConditions Conditions.xml Model::getSolvers "../../Common/xml/Solvers.xml" - } -proc Fluid::xml::getUniqueName {name} { - return ${::Fluid::prefix}${name} +proc ::Fluid::xml::getUniqueName {name} { + return [::Fluid::GetAttribute prefix]${name} } -proc Fluid::xml::CustomTree { args } { +proc ::Fluid::xml::CustomTree { args } { set root [customlib::GetBaseRoot] + set results_un [::Fluid::GetUniqueName "results"] + # Output control in output settings spdAux::SetValueOnTreeItem v time FLResults FileLabel spdAux::SetValueOnTreeItem v time FLResults OutputControlType @@ -47,11 +51,14 @@ proc Fluid::xml::CustomTree { args } { # TODO: remove when Non newtonian is implemented for 2d if {$::Model::SpatialDimension eq "2D"} { Model::ForgetConstitutiveLaw HerschelBulkley } + + # Hide dynamic_tau on some elements + spdAux::SetValueOnTreeItem state "\[HideIfElement {DVMS2D DVMS3D}\]" FLStratParams dynamic_tau } # Usage # Fluid::xml::CreateNewInlet Inlet {new false name Total} true "6*y*(1-y)" -proc Fluid::xml::CreateNewInlet { base_group_name {interval_data {new true name inlet1 ini 0 end "End"}} {uses_formula false} {value 10.0} {direction automatic_inwards_normal} {fluid_conditions_UN FLBC} {inlet_condition_name_base AutomaticInlet} } { +proc ::Fluid::xml::CreateNewInlet { base_group_name {interval_data {new true name inlet1 ini 0 end "End"}} {uses_formula false} {value 10.0} {direction automatic_inwards_normal} {fluid_conditions_UN FLBC} {inlet_condition_name_base AutomaticInlet} } { # Fluid Inlet set nd $::Model::SpatialDimension set condtype line @@ -84,11 +91,9 @@ proc Fluid::xml::CreateNewInlet { base_group_name {interval_data {new true name W "Warning - Couldn't find property Inlet $prop" } } - } - -proc Fluid::xml::ClearInlets { delete_groups {fluid_conditions_UN FLBC} {inlet_condition_name_base AutomaticInlet} } { +proc ::Fluid::xml::ClearInlets { delete_groups {fluid_conditions_UN FLBC} {inlet_condition_name_base AutomaticInlet} } { set nd $::Model::SpatialDimension set fluidConditions [spdAux::getRoute $fluid_conditions_UN] @@ -103,4 +108,7 @@ proc Fluid::xml::ClearInlets { delete_groups {fluid_conditions_UN FLBC} {inlet_c } } -Fluid::xml::Init +proc ::Fluid::xml::ProcHideIfElement { domNode list_elements } { + set element [lindex [Fluid::write::GetUsedElements] 0] + if {$element in $list_elements} {return hidden} {return normal} +} diff --git a/kratos.gid/apps/FluidDEM/app.json b/kratos.gid/apps/FluidDEM/app.json new file mode 100644 index 000000000..2ddd90135 --- /dev/null +++ b/kratos.gid/apps/FluidDEM/app.json @@ -0,0 +1,42 @@ +{ + "id": "FluidDEM", + "name": "Swimming DEM", + "prefix": "DEM", + "themed": false, + "kratos_name": "FluidDEMapplication", + "python_packages": [ + "KratosSwimmingDEMApplication", + "KratosFluidDynamicsApplication", + "KratosDEMApplication" + ], + "dimensions": [ + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/CylinderInFlow.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script": "::FluidDEM::Init", + "requeriments": { + "apps": [ + "DEM", + "Fluid" + ], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "write": { + "coordinates": "groups" + }, + "main_launch_file": "python/MainKratos.py", + "examples": "examples/examples.xml" +} \ No newline at end of file diff --git a/kratos.gid/apps/FluidDEM/examples/CylinderInFlow.tcl b/kratos.gid/apps/FluidDEM/examples/CylinderInFlow.tcl index 5f60c905f..fbfe0a576 100644 --- a/kratos.gid/apps/FluidDEM/examples/CylinderInFlow.tcl +++ b/kratos.gid/apps/FluidDEM/examples/CylinderInFlow.tcl @@ -1,15 +1,19 @@ +namespace eval ::FluidDEM::examples::CylinderInFlow { + namespace path ::FluidDEM::examples + Kratos::AddNamespace [namespace current] +} -proc ::FluidDEM::examples::CylinderInFlow {args} { +proc ::FluidDEM::examples::CylinderInFlow::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawCylinderInFlowGeometry$::Model::SpatialDimension - AssignGroupsCylinderInFlow$::Model::SpatialDimension - AssignCylinderInFlowMeshSizes$::Model::SpatialDimension - TreeAssignationCylinderInFlow$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignGroups$::Model::SpatialDimension + AssignMeshSizes$::Model::SpatialDimension + TreeAssignation$::Model::SpatialDimension AssignToTree GiD_Process 'Redraw @@ -24,8 +28,8 @@ proc ::FluidDEM::examples::CylinderInFlow {args} { # Draw Geometry -proc FluidDEM::examples::DrawCylinderInFlowGeometry3D {args} { - DrawCylinderInFlowGeometry2D +proc ::FluidDEM::examples::DrawGeometry3D {args} { + DrawGeometry2D 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 GiD_Layers edit opaque Fluid 0 @@ -45,7 +49,7 @@ proc FluidDEM::examples::DrawCylinderInFlowGeometry3D {args} { GiD_Process 'Rotate Angle 0 0 'rotate scr y -45 'rotate scr x 45 escape } -proc FluidDEM::examples::DrawCylinderInFlowGeometry2D {args} { +proc ::FluidDEM::examples::DrawGeometry2D {args} { Kratos::ResetModel GiD_Layers create Fluid GiD_Layers edit to_use Fluid @@ -86,10 +90,8 @@ proc FluidDEM::examples::DrawCylinderInFlowGeometry2D {args} { } - # Group assign - -proc FluidDEM::examples::AssignGroupsCylinderInFlow3D {args} { +proc ::FluidDEM::examples::AssignGroups3D {args} { # Create the groups GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -122,7 +124,7 @@ proc FluidDEM::examples::AssignGroupsCylinderInFlow3D {args} { } # Mesh sizes -proc FluidDEM::examples::AssignCylinderInFlowMeshSizes3D {args} { +proc ::FluidDEM::examples::AssignMeshSizes3D {args} { set cylinder_mesh_size 0.1 set walls_mesh_size 0.1 set fluid_mesh_size 0.1 @@ -139,11 +141,8 @@ proc FluidDEM::examples::AssignCylinderInFlowMeshSizes3D {args} { } - - # Tree assign - -proc FluidDEM::examples::TreeAssignationCylinderInFlow3D {args} { +proc ::FluidDEM::examples::TreeAssignation3D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -157,7 +156,7 @@ proc FluidDEM::examples::TreeAssignationCylinderInFlow3D {args} { set fluidParts [spdAux::getRoute "FLParts"] set fluidNode [customlib::AddConditionGroupOnXPath $fluidParts Fluid] # set props [list Element Monolithic$nd ConstitutiveLaw Newtonian DENSITY 1.0 DYNAMIC_VISCOSITY 0.002 YIELD_STRESS 0 POWER_LAW_K 1 POWER_LAW_N 1] - set props [list Element Monolithic$nd ConstitutiveLaw Newtonian DENSITY 1.0 DYNAMIC_VISCOSITY 0.002] + set props [list ConstitutiveLaw Newtonian DENSITY 1.0 DYNAMIC_VISCOSITY 0.002] spdAux::SetValuesOnBaseNode $fluidNode $props set fluidConditions [spdAux::getRoute "FLBC"] @@ -197,7 +196,7 @@ proc FluidDEM::examples::TreeAssignationCylinderInFlow3D {args} { proc ::FluidDEM::examples::AssignToTree { } { # Material set DEMmaterials [spdAux::getRoute "DEMMaterials"] - set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e6 PARTICLE_MATERIAL 2 ] + set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e6 ] set material_node [[customlib::GetBaseRoot] selectNodes "$DEMmaterials/blockdata\[@name = 'DEM-DefaultMaterial' \]"] foreach {prop val} $props { set propnode [$material_node selectNodes "./value\[@n = '$prop'\]"] @@ -251,8 +250,6 @@ proc ::FluidDEM::examples::AssignToTree { } { } } - - # General data # Time parameters set change_list [list EndTime 20 DeltaTime 1e-5 DEMDeltaTime 1e-6 NeighbourSearchFrequency 20] @@ -269,11 +266,4 @@ proc ::FluidDEM::examples::AssignToTree { } { spdAux::RequestRefresh } -proc FluidDEM::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} diff --git a/kratos.gid/apps/FluidDEM/examples/SpheresDrop.tcl b/kratos.gid/apps/FluidDEM/examples/SpheresDrop.tcl deleted file mode 100644 index 1c05895a8..000000000 --- a/kratos.gid/apps/FluidDEM/examples/SpheresDrop.tcl +++ /dev/null @@ -1,119 +0,0 @@ - -proc ::FluidDEM::examples::SpheresDrop {args} { - if {![Kratos::IsModelEmpty]} { - set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" - set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] - if { $retval == "cancel" } { return } - } - - DrawGeometry - AssignToTree - AssignMeshSize - - GiD_Process 'Redraw - GidUtils::UpdateWindow GROUPS - GidUtils::UpdateWindow LAYER -} - -proc ::FluidDEM::examples::DrawGeometry { } { - Kratos::ResetModel - - GiD_Process Mescape Geometry Create Object Rectangle -5 -5 0 5 5 0 escape - GiD_Process Mescape Geometry Create Object Rectangle -2 -2 5 2 2 5 escape - GiD_Process Mescape Geometry Create Object Rectangle -5 -5 10 5 5 10 escape - GiD_Process Mescape Geometry Create Object Sphere 0 0 2 1 escape escape - - GiD_Process Mescape Geometry Create Object Cylinder 0.0 0.0 0.0 0.0 0.0 1.0 1 10 escape escape - - GiD_Groups create "Floor" - GiD_Groups create "Inlet" - GiD_Groups create "Spheres" - GiD_Groups create "FluidInlet" - GiD_Groups create "FluidOutlet" - - GiD_Layers create "Floor" - GiD_Layers create "Inlet" - GiD_Layers create "Spheres" - GiD_Layers create "FluidInlet" - GiD_Layers create "FluidOutlet" - - GiD_EntitiesGroups assign "Floor" surfaces 1 - GiD_EntitiesGroups assign "Inlet" surfaces 2 - GiD_EntitiesGroups assign "Spheres" volumes 1 - - GiD_EntitiesGroups assign "FluidInlet" surfaces 3 - GiD_EntitiesGroups assign "FluidOutlet" surfaces 1 - - - GiD_EntitiesLayers assign "Floor" -also_lower_entities surfaces 1 - GiD_EntitiesLayers assign "Inlet" -also_lower_entities surfaces 2 - GiD_EntitiesLayers assign "Spheres" -also_lower_entities volumes 1 - - GiD_EntitiesLayers assign "FluidInlet" -also_lower_entities surfaces 3 - GiD_EntitiesLayers assign "FluidOutlet" -also_lower_entities surfaces 2 - - -} - -proc ::FluidDEM::examples::AssignToTree { } { - # Material - set DEMmaterials [spdAux::getRoute "DEMMaterials"] - set props [list PARTICLE_DENSITY 2500.0 YOUNG_MODULUS 1.0e6 PARTICLE_MATERIAL 2 ] - set material_node [[customlib::GetBaseRoot] selectNodes "$DEMmaterials/blockdata\[@name = 'DEM-DefaultMaterial' \]"] - spdAux::SetValuesOnBaseNode $material_node $props - - # Parts - set DEMParts [spdAux::getRoute "DEMParts"] - set DEMPartsNode [customlib::AddConditionGroupOnXPath $DEMParts Spheres] - $DEMPartsNode setAttribute ov volume - set props [list Material "DEM-DefaultMaterial"] - spdAux::SetValuesOnBaseNode $DEMPartsNode $props - - # DEM FEM Walls - set DEMConditions [spdAux::getRoute "DEMConditions"] - set walls "$DEMConditions/condition\[@n='DEM-FEM-Wall'\]" - set wallsNode [customlib::AddConditionGroupOnXPath $walls Floor] - $wallsNode setAttribute ov surface - - # Inlet - set DEMInlet "$DEMConditions/condition\[@n='Inlet'\]" - set inlets [list Total 2] - ErasePreviousIntervals - foreach {interval_name modulus} $inlets { - GiD_Groups create "Inlet//$interval_name" - GiD_Groups edit state "Inlet//$interval_name" hidden - spdAux::AddIntervalGroup Inlet "Inlet//$interval_name" - set inletNode [customlib::AddConditionGroupOnXPath $DEMInlet "Inlet//$interval_name"] - $inletNode setAttribute ov surface - set props [list Material "DEM-DefaultMaterial" ParticleDiameter 0.1 VelocityModulus $modulus Interval $interval_name DirectionVector "0.0,0.0,-1.0"] - spdAux::SetValuesOnBaseNode $inletNode $props - } - - # General data - # Time parameters - set change_list [list EndTime 20 DeltaTime 1e-5 NeighbourSearchFrequency 20] - set xpath [spdAux::getRoute DEMTimeParameters] - spdAux::SetValuesOnBasePath $xpath $change_list - - # Bounding box - set change_list [list UseBB true MinZ -1.0] - set xpath [spdAux::getRoute Boundingbox] - spdAux::SetValuesOnBasePath $xpath $change_list - - spdAux::RequestRefresh -} - -proc FluidDEM::examples::AssignMeshSize { } { - GiD_Process Mescape Meshing AssignSizes Volumes 0.2 1:end escape escape escape - GiD_Process Mescape Meshing AssignSizes Surfaces 0.2 1:end escape escape escape - GiD_Process Mescape Meshing AssignSizes Lines 0.2 1:end escape escape escape -} - - -proc FluidDEM::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} \ No newline at end of file diff --git a/kratos.gid/apps/FluidDEM/examples/examples.tcl b/kratos.gid/apps/FluidDEM/examples/examples.tcl index c9d26f0bd..2996d7476 100644 --- a/kratos.gid/apps/FluidDEM/examples/examples.tcl +++ b/kratos.gid/apps/FluidDEM/examples/examples.tcl @@ -1,15 +1,12 @@ -namespace eval FluidDEM::examples { +namespace eval ::FluidDEM::examples { + namespace path ::Fluid + Kratos::AddNamespace [namespace current] } - -proc FluidDEM::examples::Init { } { - uplevel #0 [list source [file join $::FluidDEM::dir examples CylinderInFlow.tcl]] -} - -proc FluidDEM::examples::UpdateMenus { } { - GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "FluidDEM CylinderInFlow" ] 8 PRE [list ::FluidDEM::examples::CylinderInFlow] "" "" insertafter = - GiDMenu::UpdateMenus +proc ::FluidDEM::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} + } } - -FluidDEM::examples::Init \ No newline at end of file diff --git a/kratos.gid/apps/FluidDEM/examples/examples.xml b/kratos.gid/apps/FluidDEM/examples/examples.xml new file mode 100644 index 000000000..70e8b5019 --- /dev/null +++ b/kratos.gid/apps/FluidDEM/examples/examples.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/FluidDEM/images/CylinderInFlow3D.png b/kratos.gid/apps/FluidDEM/images/CylinderInFlow3D.png new file mode 100644 index 000000000..cb2226ee8 Binary files /dev/null and b/kratos.gid/apps/FluidDEM/images/CylinderInFlow3D.png differ diff --git a/kratos.gid/apps/FluidDEM/images/SpheresDrop.png b/kratos.gid/apps/FluidDEM/images/SpheresDrop.png new file mode 100644 index 000000000..8888126b0 Binary files /dev/null and b/kratos.gid/apps/FluidDEM/images/SpheresDrop.png differ diff --git a/kratos.gid/apps/FluidDEM/images/drop.png b/kratos.gid/apps/FluidDEM/images/drop.png index f473a22eb..eb9ebee00 100644 Binary files a/kratos.gid/apps/FluidDEM/images/drop.png and b/kratos.gid/apps/FluidDEM/images/drop.png differ diff --git a/kratos.gid/apps/FluidDEM/images/material-relation.png b/kratos.gid/apps/FluidDEM/images/material-relation.png new file mode 100644 index 000000000..fe736f449 Binary files /dev/null and b/kratos.gid/apps/FluidDEM/images/material-relation.png differ diff --git a/kratos.gid/apps/FluidDEM/python/MainKratos.py b/kratos.gid/apps/FluidDEM/python/MainKratos.py index 114ceafee..2cbb8e947 100644 --- a/kratos.gid/apps/FluidDEM/python/MainKratos.py +++ b/kratos.gid/apps/FluidDEM/python/MainKratos.py @@ -4,11 +4,16 @@ # Some parts of the original fluid script have been kept practically untouched and are clearly marked. # Whenever a minor modification has been made on one of these parts, the corresponding line is indicated with a comment: # MOD. -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 +import warnings # Kratos from KratosMultiphysics import * -from KratosMultiphysics.ExternalSolversApplication import * + +try: + from KratosMultiphysics.LinearSolversApplication import * +except ImportError: + warnings.warn('Package LinearSolversApplication could not be loaded. Make sure to compile it if needed.', ImportWarning) + from KratosMultiphysics.DEMApplication import * from KratosMultiphysics.FluidDynamicsApplication import * from KratosMultiphysics.SwimmingDEMApplication import * diff --git a/kratos.gid/apps/FluidDEM/start.tcl b/kratos.gid/apps/FluidDEM/start.tcl index 8d7631c62..d0c4bbc42 100644 --- a/kratos.gid/apps/FluidDEM/start.tcl +++ b/kratos.gid/apps/FluidDEM/start.tcl @@ -1,47 +1,25 @@ namespace eval ::FluidDEM { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir - variable prefix - variable attributes - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::FluidDEM::Init { } { +proc ::FluidDEM::Init { app } { # Variable initialization variable dir - variable prefix - variable kratos_name - variable attributes - - set attributes [dict create] - set kratos_name FluidDEMapplication + variable _app + set _app $app set dir [apps::getMyDir "FluidDEM"] - set prefix FluidDEM_ - - set ::spdAux::TreeVisibility 0 - - apps::LoadAppById "DEM" - apps::LoadAppById "Fluid" - - # Intervals - dict set attributes UseIntervals 1 - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - set ::Model::ValidSpatialDimensions [list 3D] - LoadMyFiles - # ::spdAux::CreateDimensionWindow -} - -proc ::FluidDEM::LoadMyFiles { } { - variable dir - - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - uplevel #0 [list source [file join $dir examples examples.tcl]] + FluidDEM::xml::Init + FluidDEM::write::Init } proc ::FluidDEM::BeforeMeshGeneration {elementsize} { @@ -52,17 +30,12 @@ proc ::FluidDEM::AfterMeshGeneration { fail } { ::DEM::AfterMeshGeneration fail } -proc ::FluidDEM::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value +proc ::FluidDEM::AfterSaveModel {filespd} { + ::DEM::AfterSaveModel $filespd } proc ::FluidDEM::CustomToolbarItems { } { - variable dir - #Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::FluidDEM::examples::InnerSphere] [= "Example\nInnerSphere"] - Kratos::ToolbarAddItem "Example" [file join $dir images drop.png] [list -np- ::FluidDEM::examples::CylinderInFlow] [= "Example\nCylinderInFlow"] + ::DEM::CustomToolbarItems } -::FluidDEM::Init + diff --git a/kratos.gid/apps/FluidDEM/write/write.tcl b/kratos.gid/apps/FluidDEM/write/write.tcl index aad82bc61..3056c8014 100644 --- a/kratos.gid/apps/FluidDEM/write/write.tcl +++ b/kratos.gid/apps/FluidDEM/write/write.tcl @@ -1,23 +1,23 @@ namespace eval ::FluidDEM::write { + namespace path ::FluidDEM + Kratos::AddNamespace [namespace current] + variable fluid_project_parameters variable dem_project_parameters } proc ::FluidDEM::write::Init { } { - variable fluid_project_parameters - variable dem_project_parameters - variable general_project_parameters set fluid_project_parameters [dict create] + variable dem_project_parameters set dem_project_parameters [dict create] + variable general_project_parameters set general_project_parameters [dict create] - SetAttribute main_script_file "MainKratos.py" - } # Events proc FluidDEM::write::writeModelPartEvent { } { - + Validate set filename [Kratos::GetModelName] Fluid::write::Init @@ -29,18 +29,29 @@ proc FluidDEM::write::writeModelPartEvent { } { DEM::write::Init set DEM::write::delete_previous_mdpa 0 write::writeAppMDPA DEM +} +proc FluidDEM::write::Validate { } { + if {[GiD_Info mesh] eq 0} {[error "Model not meshed"]} } + proc FluidDEM::write::writeCustomFilesEvent { } { - Fluid::write::WriteMaterialsFile False - SetAttribute main_script_file "MainKratos.py" - set orig_name [GetAttribute main_script_file] - write::CopyFileIntoModel [file join "python" $orig_name ] + FluidDEM::write::WriteMaterialsFile + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] +} +# Overwritten to add CylinderContinuumParticle +proc DEM::write::GetInletElementType {} { + set elem_name SphericSwimmingParticle3D + if {$::Model::SpatialDimension eq "2D"} { + set elem_name SphericSwimmingParticle2D + } + return $elem_name } proc FluidDEM::write::WriteMaterialsFile { } { - + FluidDEM::write::writeFluidModifiedMaterials [Fluid::write::GetMaterialsFile True] + DEM::write::writeMaterialsFile } proc FluidDEM::write::SetAttribute {att val} { @@ -67,4 +78,34 @@ proc Fluid::write::getFluidModelPartFilename { } { return [Kratos::GetModelName]Fluid } -FluidDEM::write::Init \ No newline at end of file +proc FluidDEM::write::writeFluidModifiedMaterials {fluid_materials_json} { + set new_json [dict create] + + foreach property [dict get $fluid_materials_json properties] { + if {[dict exists $property Material Variables PERMEABILITY]} { + set permeability [dict get $property Material Variables PERMEABILITY] + + set p11 [expr [lindex $permeability 0 0]] + set p12 [expr [lindex $permeability 0 1]] + set p13 [expr [lindex $permeability 0 2]] + set p21 [expr [lindex $permeability 1 0]] + set p22 [expr [lindex $permeability 1 1]] + set p23 [expr [lindex $permeability 1 2]] + set p31 [expr [lindex $permeability 2 0]] + set p32 [expr [lindex $permeability 2 1]] + set p33 [expr [lindex $permeability 2 2]] + set permeability_1 [list $p11 $p12 $p13] + set permeability_2 [list $p21 $p22 $p23] + set permeability_3 [list $p31 $p32 $p33] + dict unset property Material Variables PERMEABILITY_11; dict unset property Material Variables PERMEABILITY_12; dict unset property Material Variables PERMEABILITY_13 + dict unset property Material Variables PERMEABILITY_22; dict unset property Material Variables PERMEABILITY_23 + dict unset property Material Variables PERMEABILITY_33 + dict set property Material Variables PERMEABILITY [list $permeability_1 $permeability_2 $permeability_3] + if {[dict exists $property Material Variables value]} {dict unset property Material Variables value} + } + dict lappend new_json properties $property + } + write::writePropertiesJsonFileDone [Fluid::write::GetAttribute materials_file] $new_json +} + +FluidDEM::write::Init diff --git a/kratos.gid/apps/FluidDEM/write/writeProjectParameters.tcl b/kratos.gid/apps/FluidDEM/write/writeProjectParameters.tcl index 800f53e43..b15d82fb2 100644 --- a/kratos.gid/apps/FluidDEM/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/FluidDEM/write/writeProjectParameters.tcl @@ -2,88 +2,29 @@ proc ::FluidDEM::write::getParametersDict { } { set project_parameters_dict [dict create] - set gravity_value [write::getValue DEMGravity GravityValue] - set gravity_X [write::getValue DEMGravity Cx] - set gravity_Y [write::getValue DEMGravity Cy] - set gravity_Z [write::getValue DEMGravity Cz] - - dict set project_parameters_dict gravity_parameters "modulus" $gravity_value - lassign [MathUtils::VectorNormalized [list $gravity_X $gravity_Y $gravity_Z]] gravity_X gravity_Y gravity_Z - dict set project_parameters_dict gravity_parameters "direction" [list $gravity_X $gravity_Y $gravity_Z] - - # # Gravity - # lassign [DEM::write::GetGravity] gx gy gz - # # Add data to the parameters_dict - # dict set project_parameters_dict "GravityX" $gx - # dict set project_parameters_dict "GravityY" $gy - # dict set project_parameters_dict "GravityZ" $gz + dict set project_parameters_dict gravity_parameters [FluidDEM::write::GetGravityDict] - # add time_stepping + # Time_stepping set automatic_time_step [write::getValue FDEMTimeParameters AutomaticDeltaTime] set time_step [write::getValue FDEMTimeParameters DEMDeltaTime] - dict set project_parameters_dict time_stepping "automatic_time_step" $automatic_time_step - dict set project_parameters_dict time_stepping "time_step" $time_step + dict set project_parameters_dict time_stepping "automatic_time_step" $automatic_time_step + dict set project_parameters_dict time_stepping "time_step" $time_step # output_interval set output_interval [write::getValue FDEMTimeParameters OutputInterval] - dict set project_parameters_dict "output_interval" $output_interval + dict set project_parameters_dict "output_interval" $output_interval # non newtonian fluid - set non_newtonian_option [write::getValue DEMFluidNonNewtonian non_newtonian_option] - set yield_stress [write::getValue DEMFluidNonNewtonian yield_stress] - set regularization_coefficient [write::getValue DEMFluidNonNewtonian regularization_coefficient] - set power_law_tol [write::getValue DEMFluidNonNewtonian power_law_tol] - set power_law_k [write::getValue DEMFluidNonNewtonian power_law_k] - set power_law_n [write::getValue DEMFluidNonNewtonian power_law_n] - - dict set project_parameters_dict non_newtonian_fluid "non_newtonian_option" $non_newtonian_option - dict set project_parameters_dict non_newtonian_fluid "power_law_k" $power_law_k - dict set project_parameters_dict non_newtonian_fluid "power_law_n" $power_law_n - dict set project_parameters_dict non_newtonian_fluid "yield_stress" $yield_stress - dict set project_parameters_dict non_newtonian_fluid "regularization_coefficient" $regularization_coefficient - dict set project_parameters_dict non_newtonian_fluid "power_law_tol" $power_law_tol - + dict set project_parameters_dict non_newtonian_fluid [FluidDEM::write::GetNonNewtonianFluidDict] # Problem data - calling directly GetDefaultProblemDataDict should be enough - dict set project_parameters_dict problem_data [write::GetDefaultProblemDataDict $Fluid::app_id] - # set model_name [Kratos::GetModelName] - # dict set project_parameters_dict problem_data $model_name - # dict set project_parameters_dict "ControlTime" [write::getValue DEMTimeParameters ScreenInfoOutput] + dict set project_parameters_dict problem_data [write::GetDefaultProblemDataDict [::Fluid::GetAttribute id]] - #set do_print_results_option [write::getValue FluidDEM_GeneralParameters PrintResults] - dict set project_parameters_dict "do_print_results_option" true + dict set project_parameters_dict "do_print_results_option" true # coupling FDEMCoupling - set coupling_level_type [write::getValue FDEMCoupling CouplingLevel] - set interaction_start_time [write::getValue FDEMCoupling InteractionStart] - dict set project_parameters_dict coupling "coupling_level_type" $coupling_level_type - dict set project_parameters_dict coupling "coupling_weighing_type" 2 - dict set project_parameters_dict coupling "interaction_start_time" $interaction_start_time - - set time_averaging_type [write::getValue FDEMfwCoupling TimeAveraging] - dict set project_parameters_dict coupling forward_coupling "time_averaging_type" $time_averaging_type - - set meso_scale_length [write::getValue FDEMbwCoupling MesoScaleLength] - set shape_factor [write::getValue FDEMbwCoupling ShapeFactor] - set filter_velocity_option [write::getValue FDEMbwCoupling FilterVelocity] - set apply_time_filter [write::getValue FDEMbwCoupling ApplyTimeFilter] - set min_fluid_fraction [write::getValue FDEMbwCoupling MinFluidFraction] - set fluid_fraction_grad_type [write::getValue FDEMbwCoupling FluidFractGradT] - set calculate_diffusivity_option [write::getValue FDEMbwCoupling CalcDiffusivity] - set viscosity_modification_type [write::getValue FDEMbwCoupling ViscosityModif] - - dict set project_parameters_dict coupling backward_coupling "meso_scale_length" $meso_scale_length - dict set project_parameters_dict coupling backward_coupling "shape_factor" $shape_factor - dict set project_parameters_dict coupling backward_coupling "filter_velocity_option" $filter_velocity_option - dict set project_parameters_dict coupling backward_coupling "apply_time_filter_to_fluid_fraction_option" $apply_time_filter - dict set project_parameters_dict coupling backward_coupling "min_fluid_fraction" $min_fluid_fraction - dict set project_parameters_dict coupling backward_coupling "fluid_fraction_grad_type" $fluid_fraction_grad_type - dict set project_parameters_dict coupling backward_coupling "calculate_diffusivity_option" $calculate_diffusivity_option - dict set project_parameters_dict coupling backward_coupling "viscosity_modification_type" $viscosity_modification_type - - # derivative recovery disabled by now - #dict set project_parameters_dict derivative_recovery "store_full_gradient_option" "false" + dict set project_parameters_dict coupling [FluidDEM::write::GetCouplingDict] # custom dem set do_search_neighbours [write::getValue FDEMCoupling NeighbourSearch] @@ -93,7 +34,115 @@ proc ::FluidDEM::write::getParametersDict { } { dict set project_parameters_dict custom_dem "type_of_dem_inlet" VelocityImposed dict set project_parameters_dict custom_dem "translational_integration_scheme" $translational_integration_scheme - # dem_nodal_results + # nodal results + dict set project_parameters_dict dem_nodal_results [FluidDEM::write::GetDEMNodalResultsDict] + dict set project_parameters_dict fluid_nodal_results [FluidDEM::write::GetFluidNodalResultsDict] + + # Hydrodynamic Properties + dict set project_parameters_dict properties [FluidDEM::write::GetHydrodynamicPropertiesList] + + # output configuration #TODO to be checked/modified by GCasas + dict set project_parameters_dict sdem_output_processes [write::GetDefaultOutputProcessDict [::Fluid::GetAttribute id]] + FluidDEM::write::InitExternalProjectParameters + dict set project_parameters_dict dem_parameters $FluidDEM::write::dem_project_parameters + dict set project_parameters_dict dem_parameters "solver_settings" "strategy" "swimming_sphere_strategy" + dict set project_parameters_dict fluid_parameters $FluidDEM::write::fluid_project_parameters + + # Update the fluid element + set element_name {*}[FluidDEM::write::GetCurrentFluidElementName] + dict set project_parameters_dict fluid_parameters solver_settings formulation element_type $element_name + if { $element_name eq "qsvmsDEM" } { + dict set project_parameters_dict fluid_parameters solver_settings solver_type "MonolithicDEM" + dict unset project_parameters_dict fluid_parameters solver_settings time_scheme + } + + return $project_parameters_dict +} + +proc FluidDEM::write::GetHydrodynamicPropertiesList { } { + set properties_list [list ] + set used_hydrodynamic_properties [list ] + + set hydrodynamic_laws_dict [GetHydrodynamicLawsDict] + set mat_dict [write::getMatDict] + #set mat_dict [dict merge [write::getMatDict] $DEM::write::inletProperties] + foreach property [dict keys $mat_dict] { + if { [dict get $mat_dict $property APPID] eq "DEM"} { + if {"hydrodynamic_law" in [dict keys [dict get $mat_dict $property] ]} { + set law [dict get $hydrodynamic_laws_dict [dict get $mat_dict $property hydrodynamic_law]] + #WV law + set law_name [dict get $law hydrodynamic_law_name] + if {$law_name ni $used_hydrodynamic_properties} { + lappend used_hydrodynamic_properties $law_name + set properties_dict [dict create] + set partgroup [write::getPartsSubModelPartId] + dict set properties_dict properties_id [dict get $mat_dict $property MID] + dict set properties_dict hydrodynamic_law_parameters "name" [dict get $law hydrodynamic_law_name] + dict set properties_dict hydrodynamic_law_parameters buoyancy_parameters "name" [dict get $law buoyancy_parameters] + dict set properties_dict hydrodynamic_law_parameters inviscid_force_parameters "name" [dict get $law inviscid_force_parameters] + dict set properties_dict hydrodynamic_law_parameters inviscid_force_parameters "do_apply_faxen_corrections" [dict get $law do_apply_faxen_corrections] + dict set properties_dict hydrodynamic_law_parameters drag_parameters "name" [dict get $law drag_parameters] + dict set properties_dict hydrodynamic_law_parameters history_force_parameters "name" [dict get $law history_force_parameters] + dict set properties_dict hydrodynamic_law_parameters history_force_parameters "quadrature_order" [dict get $law quadrature_order] + dict set properties_dict hydrodynamic_law_parameters history_force_parameters mae_parameters "do_use_mae" [dict get $law do_use_mae] + dict set properties_dict hydrodynamic_law_parameters history_force_parameters mae_parameters "m" [dict get $law m] + dict set properties_dict hydrodynamic_law_parameters history_force_parameters mae_parameters "window_time_interval" [dict get $law window_time_interval] + dict set properties_dict hydrodynamic_law_parameters history_force_parameters mae_parameters "type" [dict get $law type] + lappend properties_list $properties_dict + } + } + } + } + + return $properties_list +} + +proc FluidDEM::write::GetFluidNodalResultsDict { } { + set fluid_nodal_results_dict [dict create ] + + set MATERIAL_ACCELERATION [write::getValue FluidNodalResults MaterialAccel] + set VELOCITY_GRADIENT [write::getValue FluidNodalResults VelocityGrad] + set PRESSURE_GRADIENT [write::getValue FluidNodalResults PressureGrad] + set FLUID_FRACTION [write::getValue FluidNodalResults FluidFraction] + set DISPERSE_FRACTION [write::getValue FluidNodalResults DisperseFraction] + set PARTICLE_VEL_FILTERED [write::getValue FluidNodalResults ParticleVelFiltered] + set FLUID_FRACTION_GRADIENT [write::getValue FluidNodalResults FluidFractionGrad] + set FLUID_FRACTION_RATE [write::getValue FluidNodalResults FluidFractionRate] + set HYDRODYNAMIC_REACTION [write::getValue FluidNodalResults HydrodynamicReaction] + set VISCOSITY [write::getValue FluidNodalResults Viscosity] + set DISTANCE [write::getValue FluidNodalResults Distance] + set VORTICITY [write::getValue FluidNodalResults Vorticity] + set VELOCITY_LAPLACIAN [write::getValue FluidNodalResults VelocityLaplacian] + set VELOCITY_LAPLACIAN_RATE [write::getValue FluidNodalResults VelocityLaplacianRate] + set BODY_FORCE [write::getValue FluidNodalResults BodyForce] + set VELOCITY [write::getValue FluidNodalResults FVelocity] + set PRESSURE [write::getValue FluidNodalResults FPressure] + + dict set fluid_nodal_results_dict "BODY_FORCE" $BODY_FORCE + dict set fluid_nodal_results_dict "DISPERSE_FRACTION" $DISPERSE_FRACTION + dict set fluid_nodal_results_dict "DISTANCE" $DISTANCE + dict set fluid_nodal_results_dict "FLUID_FRACTION_GRADIENT" $FLUID_FRACTION_GRADIENT + dict set fluid_nodal_results_dict "FLUID_FRACTION_RATE" $FLUID_FRACTION_RATE + dict set fluid_nodal_results_dict "FLUID_FRACTION" $FLUID_FRACTION + dict set fluid_nodal_results_dict "HYDRODYNAMIC_REACTION" $HYDRODYNAMIC_REACTION + dict set fluid_nodal_results_dict "MATERIAL_ACCELERATION" $MATERIAL_ACCELERATION + dict set fluid_nodal_results_dict "PARTICLE_VEL_FILTERED" $PARTICLE_VEL_FILTERED + dict set fluid_nodal_results_dict "PRESSURE_GRADIENT" $PRESSURE_GRADIENT + dict set fluid_nodal_results_dict "PRESSURE" $PRESSURE + dict set fluid_nodal_results_dict "VELOCITY_GRADIENT" false + dict set fluid_nodal_results_dict "VELOCITY_LAPLACIAN_RATE" $VELOCITY_LAPLACIAN_RATE + dict set fluid_nodal_results_dict "VELOCITY_LAPLACIAN" $VELOCITY_LAPLACIAN + dict set fluid_nodal_results_dict "VELOCITY" $VELOCITY + dict set fluid_nodal_results_dict "VISCOSITY" $VISCOSITY + dict set fluid_nodal_results_dict "VORTICITY" $VORTICITY + + return $fluid_nodal_results_dict +} + + +proc FluidDEM::write::GetDEMNodalResultsDict { } { + set dem_nodal_results_dict [dict create ] + set ANGULAR_VELOCITY [write::getValue DEMNodalResults AngularVelocity] set BASSET_FORCE [write::getValue DEMNodalResults BassetForce] set BUOYANCY [write::getValue DEMNodalResults Buoyancy] @@ -121,118 +170,111 @@ proc ::FluidDEM::write::getParametersDict { } { set TOTAL_FORCES [write::getValue DEMNodalResults TotalForces] set VIRTUAL_MASS_FORCE [write::getValue DEMNodalResults VirtualMassForce] - dict set project_parameters_dict dem_nodal_results "ANGULAR_VELOCITY" $ANGULAR_VELOCITY - dict set project_parameters_dict dem_nodal_results "BASSET_FORCE" $BASSET_FORCE - dict set project_parameters_dict dem_nodal_results "BUOYANCY" $BUOYANCY - dict set project_parameters_dict dem_nodal_results "CONTACT_FORCES" $CONTACT_FORCES - dict set project_parameters_dict dem_nodal_results "DRAG_FORCE" $DRAG_FORCE - dict set project_parameters_dict dem_nodal_results "ELASTIC_FORCES" $ELASTIC_FORCES - dict set project_parameters_dict dem_nodal_results "FLUID_ACCEL_PROJECTED" $FLUID_ACCEL_PROJECTED - dict set project_parameters_dict dem_nodal_results "FLUID_FRACTION_GRADIENT_PROJECTED" $FLUID_FRACTION_GRADIENT_PROJECTED - dict set project_parameters_dict dem_nodal_results "FLUID_FRACTION_PROJECTED" $FLUID_FRACTION_PROJECTED - dict set project_parameters_dict dem_nodal_results "FLUID_VEL_LAPL_PROJECTED" $FLUID_VEL_LAPL_PROJECTED - dict set project_parameters_dict dem_nodal_results "FLUID_VEL_LAPL_RATE_PROJECTED" $FLUID_VEL_LAPL_RATE_PROJECTED - dict set project_parameters_dict dem_nodal_results "FLUID_VEL_PROJECTED_RATE" $FLUID_VEL_PROJECTED_RATE - dict set project_parameters_dict dem_nodal_results "FLUID_VEL_PROJECTED" $FLUID_VEL_PROJECTED - dict set project_parameters_dict dem_nodal_results "FLUID_VISCOSITY_PROJECTED" $FLUID_VISCOSITY_PROJECTED - dict set project_parameters_dict dem_nodal_results "HYDRODYNAMIC_FORCE" $HYDRODYNAMIC_FORCE - dict set project_parameters_dict dem_nodal_results "HYDRODYNAMIC_MOMENT" $HYDRODYNAMIC_MOMENT - dict set project_parameters_dict dem_nodal_results "IMPACT_WEAR" $IMPACT_WEAR - dict set project_parameters_dict dem_nodal_results "LIFT_FORCE" $LIFT_FORCE - dict set project_parameters_dict dem_nodal_results "NON_DIMENSIONAL_VOLUME_WEAR" $NON_DIMENSIONAL_VOLUME_WEAR - dict set project_parameters_dict dem_nodal_results "PRESSURE_GRAD_PROJECTED" $PRESSURE_GRAD_PROJECTED - # dict set project_parameters_dict dem_nodal_results "PRESSURE" $PRESSURE - dict set project_parameters_dict dem_nodal_results "RADIUS" $RADIUS - dict set project_parameters_dict dem_nodal_results "REYNOLDS_NUMBER" $REYNOLDS_NUMBER - dict set project_parameters_dict dem_nodal_results "SLIP_VELOCITY" $SLIP_VELOCITY - dict set project_parameters_dict dem_nodal_results "TOTAL_FORCES" $TOTAL_FORCES - dict set project_parameters_dict dem_nodal_results "VIRTUAL_MASS_FORCE" $VIRTUAL_MASS_FORCE - - # fluid_nodal_results - set MATERIAL_ACCELERATION [write::getValue FluidNodalResults MaterialAccel] - set VELOCITY_GRADIENT [write::getValue FluidNodalResults VelocityGrad] - set PRESSURE_GRADIENT [write::getValue FluidNodalResults PressureGrad] - set FLUID_FRACTION [write::getValue FluidNodalResults FluidFraction] - set DISPERSE_FRACTION [write::getValue FluidNodalResults DisperseFraction] - set PARTICLE_VEL_FILTERED [write::getValue FluidNodalResults ParticleVelFiltered] - set FLUID_FRACTION_GRADIENT [write::getValue FluidNodalResults FluidFractionGrad] - set FLUID_FRACTION_RATE [write::getValue FluidNodalResults FluidFractionRate] - set HYDRODYNAMIC_REACTION [write::getValue FluidNodalResults HydrodynamicReaction] - set VISCOSITY [write::getValue FluidNodalResults Viscosity] - set DISTANCE [write::getValue FluidNodalResults Distance] - set VORTICITY [write::getValue FluidNodalResults Vorticity] - set VELOCITY_LAPLACIAN [write::getValue FluidNodalResults VelocityLaplacian] - set VELOCITY_LAPLACIAN_RATE [write::getValue FluidNodalResults VelocityLaplacianRate] - set BODY_FORCE [write::getValue FluidNodalResults BodyForce] - set VELOCITY [write::getValue FluidNodalResults FVelocity] - set PRESSURE [write::getValue FluidNodalResults FPressure] + dict set dem_nodal_results_dict "ANGULAR_VELOCITY" $ANGULAR_VELOCITY + dict set dem_nodal_results_dict "BASSET_FORCE" $BASSET_FORCE + dict set dem_nodal_results_dict "BUOYANCY" $BUOYANCY + dict set dem_nodal_results_dict "CONTACT_FORCES" $CONTACT_FORCES + dict set dem_nodal_results_dict "DRAG_FORCE" $DRAG_FORCE + dict set dem_nodal_results_dict "ELASTIC_FORCES" $ELASTIC_FORCES + dict set dem_nodal_results_dict "FLUID_ACCEL_PROJECTED" $FLUID_ACCEL_PROJECTED + dict set dem_nodal_results_dict "FLUID_FRACTION_GRADIENT_PROJECTED" $FLUID_FRACTION_GRADIENT_PROJECTED + dict set dem_nodal_results_dict "FLUID_FRACTION_PROJECTED" $FLUID_FRACTION_PROJECTED + dict set dem_nodal_results_dict "FLUID_VEL_LAPL_PROJECTED" $FLUID_VEL_LAPL_PROJECTED + dict set dem_nodal_results_dict "FLUID_VEL_LAPL_RATE_PROJECTED" $FLUID_VEL_LAPL_RATE_PROJECTED + dict set dem_nodal_results_dict "FLUID_VEL_PROJECTED_RATE" $FLUID_VEL_PROJECTED_RATE + dict set dem_nodal_results_dict "FLUID_VEL_PROJECTED" $FLUID_VEL_PROJECTED + dict set dem_nodal_results_dict "FLUID_VISCOSITY_PROJECTED" $FLUID_VISCOSITY_PROJECTED + dict set dem_nodal_results_dict "HYDRODYNAMIC_FORCE" $HYDRODYNAMIC_FORCE + dict set dem_nodal_results_dict "HYDRODYNAMIC_MOMENT" $HYDRODYNAMIC_MOMENT + dict set dem_nodal_results_dict "IMPACT_WEAR" $IMPACT_WEAR + dict set dem_nodal_results_dict "LIFT_FORCE" $LIFT_FORCE + dict set dem_nodal_results_dict "NON_DIMENSIONAL_VOLUME_WEAR" $NON_DIMENSIONAL_VOLUME_WEAR + dict set dem_nodal_results_dict "PRESSURE_GRAD_PROJECTED" $PRESSURE_GRAD_PROJECTED + dict set dem_nodal_results_dict "RADIUS" $RADIUS + dict set dem_nodal_results_dict "REYNOLDS_NUMBER" $REYNOLDS_NUMBER + dict set dem_nodal_results_dict "SLIP_VELOCITY" $SLIP_VELOCITY + dict set dem_nodal_results_dict "TOTAL_FORCES" $TOTAL_FORCES + dict set dem_nodal_results_dict "VIRTUAL_MASS_FORCE" $VIRTUAL_MASS_FORCE - dict set project_parameters_dict fluid_nodal_results "BODY_FORCE" $BODY_FORCE - dict set project_parameters_dict fluid_nodal_results "DISPERSE_FRACTION" $DISPERSE_FRACTION - dict set project_parameters_dict fluid_nodal_results "DISTANCE" $DISTANCE - dict set project_parameters_dict fluid_nodal_results "FLUID_FRACTION_GRADIENT" $FLUID_FRACTION_GRADIENT - dict set project_parameters_dict fluid_nodal_results "FLUID_FRACTION_RATE" $FLUID_FRACTION_RATE - dict set project_parameters_dict fluid_nodal_results "FLUID_FRACTION" $FLUID_FRACTION - dict set project_parameters_dict fluid_nodal_results "HYDRODYNAMIC_REACTION" $HYDRODYNAMIC_REACTION - dict set project_parameters_dict fluid_nodal_results "MATERIAL_ACCELERATION" $MATERIAL_ACCELERATION - dict set project_parameters_dict fluid_nodal_results "PARTICLE_VEL_FILTERED" $PARTICLE_VEL_FILTERED - dict set project_parameters_dict fluid_nodal_results "PRESSURE_GRADIENT" $PRESSURE_GRADIENT - dict set project_parameters_dict fluid_nodal_results "PRESSURE" $PRESSURE - dict set project_parameters_dict fluid_nodal_results "VELOCITY_GRADIENT" false - dict set project_parameters_dict fluid_nodal_results "VELOCITY_LAPLACIAN_RATE" $VELOCITY_LAPLACIAN_RATE - dict set project_parameters_dict fluid_nodal_results "VELOCITY_LAPLACIAN" $VELOCITY_LAPLACIAN - dict set project_parameters_dict fluid_nodal_results "VELOCITY" $VELOCITY - dict set project_parameters_dict fluid_nodal_results "VISCOSITY" $VISCOSITY - dict set project_parameters_dict fluid_nodal_results "VORTICITY" $VORTICITY - - # set time_things [DEM::write::GetTimeSettings] - # set MaxTimeStep [dict get $time_things DeltaTime] - # dict set project_parameters_dict "MaxTimeStep" $MaxTimeStep - # set TTime [dict get $time_things EndTime] - # dict set project_parameters_dict "FinalTime" $TTime - # # dict set project_parameters_dict "ControlTime" [write::getValue DEMTimeParameters ScreenInfoOutput] - # # dict set project_parameters_dict "NeighbourSearchFrequency" [write::getValue DEMTimeParameters NeighbourSearchFrequency] - - # Properties - set hydrodynamic_laws_dict [GetHydrodynamicLawsDict] - set properties_list [list ] - set mat_dict [dict merge [write::getMatDict] $DEM::write::inletProperties] - foreach property [dict keys $mat_dict] { - if { [dict get $mat_dict $property APPID] eq "DEM"} { - set properties_dict [dict create] - set law [dict get $hydrodynamic_laws_dict [dict get $mat_dict $property hydrodynamic_law]] - #WV law - set partgroup [write::getPartsSubModelPartId] - dict set properties_dict properties_id [dict get $mat_dict $property MID] - dict set properties_dict hydrodynamic_law_parameters "name" [dict get $law hydrodynamic_law_name] - dict set properties_dict hydrodynamic_law_parameters buoyancy_parameters "name" [dict get $law buoyancy_parameters] - dict set properties_dict hydrodynamic_law_parameters inviscid_force_parameters "name" [dict get $law inviscid_force_parameters] - dict set properties_dict hydrodynamic_law_parameters inviscid_force_parameters "do_apply_faxen_corrections" [dict get $law do_apply_faxen_corrections] - dict set properties_dict hydrodynamic_law_parameters drag_parameters "name" [dict get $law drag_parameters] - dict set properties_dict hydrodynamic_law_parameters history_force_parameters "name" [dict get $law history_force_parameters] - dict set properties_dict hydrodynamic_law_parameters history_force_parameters "quadrature_order" [dict get $law quadrature_order] - dict set properties_dict hydrodynamic_law_parameters history_force_parameters mae_parameters "do_use_mae" [dict get $law do_use_mae] - dict set properties_dict hydrodynamic_law_parameters history_force_parameters mae_parameters "m" [dict get $law m] - dict set properties_dict hydrodynamic_law_parameters history_force_parameters mae_parameters "window_time_interval" [dict get $law window_time_interval] - dict set properties_dict hydrodynamic_law_parameters history_force_parameters mae_parameters "type" [dict get $law type] - # dict set properties_dict hydrodynamic_law_parameters vorticity_induced_lift_parameters "name" "default" - # dict set properties_dict hydrodynamic_law_parameters rotation_induced_lift_parameters "name" "default" - # dict set properties_dict hydrodynamic_law_parameters steady_viscous_torque_parameters "name" "default" - lappend properties_list $properties_dict - } - } + return $dem_nodal_results_dict +} - dict set project_parameters_dict properties $properties_list +proc FluidDEM::write::GetNonNewtonianFluidDict { } { + set non_newtonian_fluid_dict [dict create ] - # output configuration #TODO to be checked/modified by GCasas - dict set project_parameters_dict sdem_output_processes [write::GetDefaultOutputProcessDict $Fluid::app_id] - FluidDEM::write::InitExternalProjectParameters - dict set project_parameters_dict dem_parameters $FluidDEM::write::dem_project_parameters - dict set project_parameters_dict dem_parameters "solver_settings" "strategy" "swimming_sphere_strategy" - dict set project_parameters_dict fluid_parameters $FluidDEM::write::fluid_project_parameters - # set FluidDEM::write::general_project_parameters [getParametersDict] - # dict set project_parameters_dict $FluidDEM::write::general_project_parameters - return $project_parameters_dict + set non_newtonian_option [write::getValue DEMFluidNonNewtonian non_newtonian_option] + set yield_stress [write::getValue DEMFluidNonNewtonian yield_stress] + set regularization_coefficient [write::getValue DEMFluidNonNewtonian regularization_coefficient] + set power_law_tol [write::getValue DEMFluidNonNewtonian power_law_tol] + set power_law_k [write::getValue DEMFluidNonNewtonian power_law_k] + set power_law_n [write::getValue DEMFluidNonNewtonian power_law_n] + + dict set non_newtonian_fluid_dict "non_newtonian_option" $non_newtonian_option + dict set non_newtonian_fluid_dict "power_law_k" $power_law_k + dict set non_newtonian_fluid_dict "power_law_n" $power_law_n + dict set non_newtonian_fluid_dict "yield_stress" $yield_stress + dict set non_newtonian_fluid_dict "regularization_coefficient" $regularization_coefficient + dict set non_newtonian_fluid_dict "power_law_tol" $power_law_tol + + return $non_newtonian_fluid_dict +} + +proc ::FluidDEM::write::GetGravityDict { } { + set gravity_dict [dict create ] + + # modulus + set gravity_value [write::getValue DEMGravity GravityValue] + dict set gravity_dict "modulus" $gravity_value + + # normalized direction + set gravity_X [write::getValue DEMGravity Cx] + set gravity_Y [write::getValue DEMGravity Cy] + set gravity_Z [write::getValue DEMGravity Cz] + lassign [MathUtils::VectorNormalized [list $gravity_X $gravity_Y $gravity_Z]] gravity_X gravity_Y gravity_Z + dict set gravity_dict "direction" [list $gravity_X $gravity_Y $gravity_Z] + + return $gravity_dict +} + +proc FluidDEM::write::GetCouplingDict { } { + set coupling_dict [dict create ] + set coupling_level_type [write::getValue FDEMCoupling CouplingLevel] + set interaction_start_time [write::getValue FDEMCoupling InteractionStart] + dict set coupling_dict "coupling_level_type" $coupling_level_type + dict set coupling_dict "coupling_weighing_type" 2 + dict set coupling_dict "interaction_start_time" $interaction_start_time + + set time_averaging_type [write::getValue FDEMfwCoupling TimeAveraging] + dict set coupling_dict forward_coupling "time_averaging_type" $time_averaging_type + + set meso_scale_length [write::getValue FDEMbwCoupling MesoScaleLength] + set shape_factor [write::getValue FDEMbwCoupling ShapeFactor] + set filter_velocity_option [write::getValue FDEMbwCoupling FilterVelocity] + set apply_time_filter [write::getValue FDEMbwCoupling ApplyTimeFilter] + set min_fluid_fraction [write::getValue FDEMbwCoupling MinFluidFraction] + set fluid_fraction_grad_type [write::getValue FDEMbwCoupling FluidFractGradT] + set calculate_diffusivity_option [write::getValue FDEMbwCoupling CalcDiffusivity] + set viscosity_modification_type [write::getValue FDEMbwCoupling ViscosityModif] + + dict set coupling_dict backward_coupling "meso_scale_length" $meso_scale_length + dict set coupling_dict backward_coupling "shape_factor" $shape_factor + dict set coupling_dict backward_coupling "filter_velocity_option" $filter_velocity_option + dict set coupling_dict backward_coupling "apply_time_filter_to_fluid_fraction_option" $apply_time_filter + dict set coupling_dict backward_coupling "min_fluid_fraction" $min_fluid_fraction + dict set coupling_dict backward_coupling "fluid_fraction_grad_type" $fluid_fraction_grad_type + dict set coupling_dict backward_coupling "calculate_diffusivity_option" $calculate_diffusivity_option + dict set coupling_dict backward_coupling "viscosity_modification_type" $viscosity_modification_type + + return $coupling_dict +} + +proc FluidDEM::write::GetCurrentFluidElementName { } { + set gnode [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute "FLParts"]/group"] + set element [write::getValueByNode [$gnode selectNodes "./value\[@n = 'Element'\]"]] + set element [::Model::getElement $element] + set element_name [$element getAttribute "WriteName"] + if {$element_name eq ""} {set element_name "vms"} + return $element_name } proc FluidDEM::write::GetHydrodynamicLawsDict { } { @@ -263,7 +305,7 @@ proc FluidDEM::write::InitExternalProjectParameters { } { write::initWriteConfiguration [Fluid::write::GetAttributes] set FluidDEM::write::fluid_project_parameters [Fluid::write::getParametersDict] - # Structure section + # DEM section #UpdateUniqueNames DEM apps::setActiveAppSoft DEM write::initWriteConfiguration [DEM::write::GetAttributes] @@ -272,10 +314,7 @@ proc FluidDEM::write::InitExternalProjectParameters { } { apps::setActiveAppSoft FluidDEM } -# Probably not necessary to rewrite this proc -# proc spdAux::injectConditions { basenode args} { -# #set conditions [::Model::GetConditions [list ImplementedInApplication {FluidDEMapplication}]] -# set conditions [::Model::GetConditions ImplementedInApplication FluidDEMapplication] -# spdAux::_injectCondsToTree $basenode $conditions -# $basenode delete -# } +proc ::DEM::write::GetElementType { } { + return "SphericPartDEMElement3D" +} + diff --git a/kratos.gid/apps/FluidDEM/xml/Coupling.spd b/kratos.gid/apps/FluidDEM/xml/Coupling.spd index b04b7a5dc..3028447ed 100644 --- a/kratos.gid/apps/FluidDEM/xml/Coupling.spd +++ b/kratos.gid/apps/FluidDEM/xml/Coupling.spd @@ -1,19 +1,19 @@ - + - - - - - - - - - + + + + + + + + + diff --git a/kratos.gid/apps/FluidDEM/xml/Elements.xml b/kratos.gid/apps/FluidDEM/xml/Elements.xml index 71fad0611..7106195c2 100644 --- a/kratos.gid/apps/FluidDEM/xml/Elements.xml +++ b/kratos.gid/apps/FluidDEM/xml/Elements.xml @@ -2,7 +2,7 @@ - + @@ -12,7 +12,57 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/FluidDEM/xml/HydrodynamicLaws.spd b/kratos.gid/apps/FluidDEM/xml/HydrodynamicLaws.spd index d44d3cca9..bb348f349 100644 --- a/kratos.gid/apps/FluidDEM/xml/HydrodynamicLaws.spd +++ b/kratos.gid/apps/FluidDEM/xml/HydrodynamicLaws.spd @@ -1,42 +1,23 @@ - - - - - - - + + + + + + - - - - - - - - - - + + + + + + + + + + diff --git a/kratos.gid/apps/FluidDEM/xml/Main.spd b/kratos.gid/apps/FluidDEM/xml/Main.spd index 3226dbed1..705fefe45 100644 --- a/kratos.gid/apps/FluidDEM/xml/Main.spd +++ b/kratos.gid/apps/FluidDEM/xml/Main.spd @@ -1,10 +1,11 @@ - + + @@ -13,17 +14,18 @@ - + + - + diff --git a/kratos.gid/apps/FluidDEM/xml/ManufacturedConditions.spd b/kratos.gid/apps/FluidDEM/xml/ManufacturedConditions.spd new file mode 100644 index 000000000..9fe7e616e --- /dev/null +++ b/kratos.gid/apps/FluidDEM/xml/ManufacturedConditions.spd @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/kratos.gid/apps/FluidDEM/xml/NodalConditions.xml b/kratos.gid/apps/FluidDEM/xml/NodalConditions.xml new file mode 100644 index 000000000..cacb596aa --- /dev/null +++ b/kratos.gid/apps/FluidDEM/xml/NodalConditions.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/FluidDEM/xml/Processes.xml b/kratos.gid/apps/FluidDEM/xml/Processes.xml index 7c7cc95bb..2cfb59797 100644 --- a/kratos.gid/apps/FluidDEM/xml/Processes.xml +++ b/kratos.gid/apps/FluidDEM/xml/Processes.xml @@ -9,6 +9,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file + } --> diff --git a/kratos.gid/apps/FluidDEM/xml/Procs.spd b/kratos.gid/apps/FluidDEM/xml/Procs.spd index e1df4f914..bec991ab5 100644 --- a/kratos.gid/apps/FluidDEM/xml/Procs.spd +++ b/kratos.gid/apps/FluidDEM/xml/Procs.spd @@ -51,5 +51,14 @@ return [DEM::xml::ProcGetStateBoundingBoxParams $domNode $args] ]]> - + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/FluidDEM/xml/Strategies.xml b/kratos.gid/apps/FluidDEM/xml/Strategies.xml new file mode 100644 index 000000000..690cf9c3a --- /dev/null +++ b/kratos.gid/apps/FluidDEM/xml/Strategies.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/FluidDEM/xml/XmlController.tcl b/kratos.gid/apps/FluidDEM/xml/XmlController.tcl index 4b0a0d813..5c4c5d07d 100644 --- a/kratos.gid/apps/FluidDEM/xml/XmlController.tcl +++ b/kratos.gid/apps/FluidDEM/xml/XmlController.tcl @@ -1,14 +1,19 @@ -namespace eval FluidDEM::xml { +namespace eval ::FluidDEM::xml { # Namespace variables declaration + namespace path ::FluidDEM + Kratos::AddNamespace [namespace current] variable dir } -proc FluidDEM::xml::Init { } { +proc ::FluidDEM::xml::Init { } { # Namespace variables initialization variable dir - Model::InitVariables dir $FluidDEM::dir + Model::InitVariables dir $::FluidDEM::dir - Model::ForgetElement SphericPartDEMElement3D + Model::ForgetElements + Model::ForgetSolutionStrategies + Model::getSolutionStrategies [file join ".." ".." DEM xml "Strategies.xml"] + Model::getSolutionStrategies Strategies.xml Model::getElements Elements.xml Model::getProcesses Processes.xml Model::getConditions Conditions.xml @@ -29,19 +34,18 @@ proc FluidDEM::xml::Init { } { $inlet_element_type_param setDv "SphericSwimmingParticle3D" } - set element [::Model::getElement "SphericPartDEMElement3D"] $element addInputDone $parameter spdAux::parseRoutes } -proc FluidDEM::xml::getUniqueName {name} { +proc ::FluidDEM::xml::getUniqueName {name} { return ${::FluidDEM::prefix}${name} } -proc FluidDEM::xml::CustomTree { args } { - DEM::xml::CustomTree - Fluid::xml::CustomTree +proc ::FluidDEM::xml::CustomTree { args } { + ::DEM::xml::CustomTree + ::Fluid::xml::CustomTree spdAux::parseRoutes set root [customlib::GetBaseRoot] @@ -60,13 +64,9 @@ proc FluidDEM::xml::CustomTree { args } { spdAux::SetValueOnTreeItem state hidden DEMResults - # spdAux::SetValueOnTreeItem state hidden DEMGraphs - # spdAux::SetValueOnTreeItem state hidden DEMResults DEM-OTimeStepType - # spdAux::SetValueOnTreeItem state hidden DEMResults DEM-OTimeStepDetail - # spdAux::SetValueOnTreeItem state hidden DEMResults GiDOptions - # spdAux::SetValueOnTreeItem state hidden DEMResults PartElem - + spdAux::SetValueOnTreeItem state normal FLParts Element + spdAux::SetValueOnTreeItem dict {[GetElements ElementType "Fluid"]} FLParts Element # Remove Fluid things to move them to Common set result_node [$root selectNodes "[spdAux::getRoute FLSolutionParameters]/container\[@n = 'ParallelType'\]"] @@ -78,7 +78,6 @@ proc FluidDEM::xml::CustomTree { args } { # set result_node [$root selectNodes "[spdAux::getRoute FLResults]/container\[@n = 'GiDOptions'\]"] # if { $result_node ne "" } {$result_node delete} - spdAux::SetValueOnTreeItem state disabled FLSolStrat spdAux::SetValueOnTreeItem state disabled FLScheme spdAux::SetValueOnTreeItem state hidden FLResults FileLabel spdAux::SetValueOnTreeItem state hidden FLResults OutputControlType @@ -91,11 +90,11 @@ proc FluidDEM::xml::CustomTree { args } { } -proc FluidDEM::xml::ProcGetHydrodynamicLaws {domNode args} { +proc ::FluidDEM::xml::ProcGetHydrodynamicLaws {domNode args} { set names [list ] set dem_hydrodynamic_law_nodes [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute "DEMFluidHydrodynamicLaw"]/blockdata"] foreach hydro_law $dem_hydrodynamic_law_nodes { - lappend names [$hydro_law @name] + lappend names [$hydro_law @name] } set values [join $names ","] @@ -104,5 +103,3 @@ proc FluidDEM::xml::ProcGetHydrodynamicLaws {domNode args} { if {[get_domnode_attribute $domNode v] ni $names} {$domNode setAttribute v [lindex $names 0]; spdAux::RequestRefresh} return $values } - -FluidDEM::xml::Init diff --git a/kratos.gid/apps/FluidLauncher/app.json b/kratos.gid/apps/FluidLauncher/app.json new file mode 100644 index 000000000..500a6a824 --- /dev/null +++ b/kratos.gid/apps/FluidLauncher/app.json @@ -0,0 +1,18 @@ +{ + "id": "Fluid Launcher", + "name": "Fluid", + "script_files": [ + "start.tcl" + ], + "start_script":"::FluidLauncher::Init", + "requeriments":{ + "apps_exist":["Fluid","EmbeddedFluid", "PotentialFluid", "Buoyancy", "ConjugateHeatTransfer", "FluidDEM"], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": false, + "show_toolbar": true, + "intervals": false, + "wizard": false + } +} diff --git a/kratos.gid/apps/FluidLauncher/start.tcl b/kratos.gid/apps/FluidLauncher/start.tcl index baa7f8c7e..2a80afa3b 100644 --- a/kratos.gid/apps/FluidLauncher/start.tcl +++ b/kratos.gid/apps/FluidLauncher/start.tcl @@ -1,20 +1,20 @@ namespace eval ::FluidLauncher { + Kratos::AddNamespace [namespace current] + variable available_apps } -proc ::FluidLauncher::Init { } { +proc ::FluidLauncher::Init { app } { variable available_apps + # TODO: Get apps from json set available_apps [list Fluid EmbeddedFluid PotentialFluid Buoyancy ConjugateHeatTransfer FluidDEM] - # Allow to open the tree - set ::spdAux::TreeVisibility 0 ::FluidLauncher::FluidAppSelectorWindow } proc ::FluidLauncher::FluidAppSelectorWindow { } { variable available_apps - set initwind $::spdAux::initwind set root [customlib::GetBaseRoot] set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v] @@ -25,7 +25,9 @@ proc ::FluidLauncher::FluidAppSelectorWindow { } { } { [$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait - set initwind .gid.win_example + set initwind $::spdAux::application_window_id + spdAux::DestroyWindows + spdAux::RegisterWindow $initwind if { [ winfo exist $initwind]} { destroy $initwind } @@ -45,24 +47,32 @@ proc ::FluidLauncher::FluidAppSelectorWindow { } { ttk::frame $w.top ttk::label $w.top.title_text -text [_ "Select a fluid application"] - ttk::frame $w.information -relief ridge + ttk::frame $w.applications -relief ridge set r 0 set c 0 set max_cols 3 foreach app $available_apps { set img [::apps::getImgFrom $app] set app_publicname [[::apps::getAppById $app] getPublicName] - set but [ttk::button $w.information.img$app -image $img -command [list ::FluidLauncher::ChangeAppTo $app] ] - ttk::label $w.information.text$app -text $app_publicname - grid $w.information.img$app -column $r -row $c - grid $w.information.text$app -column $r -row [expr $c + 1] + set but [ttk::button $w.applications.img$app -image $img -command [list ::FluidLauncher::ChangeAppTo $app] ] + bind $w.applications.img$app {::spdAux::PlaceInformationWindowByPath %W applications} + ttk::label $w.applications.text$app -text $app_publicname + grid $w.applications.img$app -column $r -row $c + grid $w.applications.text$app -column $r -row [expr $c + 1] incr r if {$r >= $max_cols} {incr c 2; set r 0} } grid $w.top grid $w.top.title_text - grid $w.information + grid $w.applications + + # Information panel + set spdAux::info_main_window_text "" + ttk::labelframe $w.info -text " Information " -relief ridge + ttk::label $w.info.text -textvariable spdAux::info_main_window_text + grid $w.info.text + grid $w.info -sticky we } } @@ -71,5 +81,3 @@ proc ::FluidLauncher::ChangeAppTo {appid} { spdAux::SetSpatialDimmension undefined apps::setActiveApp $appid } - -::FluidLauncher::Init diff --git a/kratos.gid/apps/MPM/app.json b/kratos.gid/apps/MPM/app.json new file mode 100644 index 000000000..ef6695dd3 --- /dev/null +++ b/kratos.gid/apps/MPM/app.json @@ -0,0 +1,50 @@ +{ + "id": "MPM", + "name": "MPM", + "prefix": "MPM", + "themed": false, + "kratos_name": "ParticleMechanicsApplication", + "python_packages": [ + "KratosParticleMechanicsApplication", + "KratosLinearSolversApplication" + ], + "dimensions": [ + "2D", + "2Da", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/FallingSandBall.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script": "::MPM::Init", + "requeriments": { + "apps": [ + "Structural" + ], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "unique_names": { + "parts": "MPMParts", + "nodal_conditions": "MPMNodalConditions", + "conditions": "MPMLoads" + }, + "write": { + "coordinates": "all", + "materials_file": "ParticleMaterials.json", + "properties_location": "json", + "model_part_name": "Background_Grid" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} \ No newline at end of file diff --git a/kratos.gid/apps/MPM/examples/FallingSandBall.tcl b/kratos.gid/apps/MPM/examples/FallingSandBall.tcl index cc26c9f8e..4157b14a8 100644 --- a/kratos.gid/apps/MPM/examples/FallingSandBall.tcl +++ b/kratos.gid/apps/MPM/examples/FallingSandBall.tcl @@ -1,13 +1,17 @@ +namespace eval ::MPM::examples::FallingSandBall { + namespace path ::MPM::examples + Kratos::AddNamespace [namespace current] -proc ::MPM::examples::FallingSandBall {args} { +} +proc ::MPM::examples::FallingSandBall::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawFallingSandBallGeometry$::Model::SpatialDimension - AssignGroupsFallingSandBall$::Model::SpatialDimension - TreeAssignationFallingSandBall$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignGroups$::Model::SpatialDimension + TreeAssignation$::Model::SpatialDimension GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -17,14 +21,14 @@ proc ::MPM::examples::FallingSandBall {args} { # Draw Geometry -proc MPM::examples::DrawFallingSandBallGeometry3D {args} { +proc ::MPM::examples::FallingSandBall::DrawGeometry3D {args} { # DrawFallingSandBallGeometry2D # 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 # GiD_Layers edit opaque Fluid 0 - # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate obj x -150 y -30 escape escape + # GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate objaxes x -150 y -30 escape escape } -proc MPM::examples::DrawFallingSandBallGeometry2D {args} { +proc ::MPM::examples::FallingSandBall::DrawGeometry2D {args} { Kratos::ResetModel GiD_Layers create Sand GiD_Layers edit to_use Sand @@ -61,7 +65,7 @@ proc MPM::examples::DrawFallingSandBallGeometry2D {args} { # Group assign -proc MPM::examples::AssignGroupsFallingSandBall2D {args} { +proc ::MPM::examples::FallingSandBall::AssignGroups2D {args} { # Create the groups GiD_Groups create Sand GiD_Groups edit color Sand "#26d1a8ff" @@ -80,16 +84,16 @@ proc MPM::examples::AssignGroupsFallingSandBall2D {args} { GiD_EntitiesGroups assign Slip lines {2 4} } -proc MPM::examples::AssignGroupsFallingSandBall3D {args} { +proc ::MPM::examples::FallingSandBall::AssignGroups3D {args} { } # Tree assign -proc MPM::examples::TreeAssignationFallingSandBall3D {args} { - TreeAssignationFallingSandBall2D +proc ::MPM::examples::FallingSandBall::TreeAssignation3D {args} { + TreeAssignation2D } -proc MPM::examples::TreeAssignationFallingSandBall2D {args} { +proc ::MPM::examples::FallingSandBall::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -141,11 +145,3 @@ proc MPM::examples::TreeAssignationFallingSandBall2D {args} { spdAux::SetValueOnTreeItem v "0.005" MPMTimeParameters DeltaTime spdAux::SetValueOnTreeItem v "0.01" GiDOptions OutputDeltaTime } - -proc MPM::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} \ No newline at end of file diff --git a/kratos.gid/apps/MPM/examples/examples.tcl b/kratos.gid/apps/MPM/examples/examples.tcl index 5a8c20f67..c9eafdaef 100644 --- a/kratos.gid/apps/MPM/examples/examples.tcl +++ b/kratos.gid/apps/MPM/examples/examples.tcl @@ -1,15 +1,13 @@ -namespace eval MPM::examples { +namespace eval ::MPM::examples { + namespace path ::MPM + Kratos::AddNamespace [namespace current] } -proc MPM::examples::Init { } { - uplevel #0 [list source [file join $::MPM::dir examples FallingSandBall.tcl]] -} - -proc MPM::examples::UpdateMenus { } { - GiDMenu::InsertOption "Kratos" [list "---"] 7 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Falling sand ball" ] 7 PRE [list ::MPM::examples::FallingSandBall] "" "" insertafter = - GiDMenu::UpdateMenus -} - -MPM::examples::Init \ No newline at end of file +proc ::MPM::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} + } +} \ No newline at end of file diff --git a/kratos.gid/apps/MPM/examples/examples.xml b/kratos.gid/apps/MPM/examples/examples.xml new file mode 100644 index 000000000..dbd426f99 --- /dev/null +++ b/kratos.gid/apps/MPM/examples/examples.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/MPM/images/FallingSandBall.png b/kratos.gid/apps/MPM/images/FallingSandBall.png new file mode 100644 index 000000000..181e4c27d Binary files /dev/null and b/kratos.gid/apps/MPM/images/FallingSandBall.png differ diff --git a/kratos.gid/apps/MPM/python/KratosParticle.py b/kratos.gid/apps/MPM/python/KratosParticle.py deleted file mode 100755 index 0f26028ce..000000000 --- a/kratos.gid/apps/MPM/python/KratosParticle.py +++ /dev/null @@ -1,18 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -from KratosMultiphysics.ParticleMechanicsApplication.particle_mechanics_analysis import ParticleMechanicsAnalysis - -""" -For user-scripting it is intended that a new class is derived -from ParticleMechanicsAnalysis to do modifications -""" - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = ParticleMechanicsAnalysis(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/MPM/start.tcl b/kratos.gid/apps/MPM/start.tcl index 951f1f074..a7863e5c9 100644 --- a/kratos.gid/apps/MPM/start.tcl +++ b/kratos.gid/apps/MPM/start.tcl @@ -1,67 +1,26 @@ namespace eval ::MPM { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir - variable prefix - variable attributes - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::MPM::Init { } { +proc ::MPM::Init { app } { # Variable initialization variable dir - variable prefix - variable attributes - variable kratos_name - - apps::LoadAppById "Structural" - set kratos_name ParticleMechanicsApplication + variable _app + set _app $app set dir [apps::getMyDir "MPM"] - set attributes [dict create] - - set prefix MPM - - set ::Model::ValidSpatialDimensions [list 2D 2Da 3D] - # spdAux::SetSpatialDimmension "3D" - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - - dict set attributes UseIntervals 1 - - LoadMyFiles Kratos::AddRestoreVar "::GidPriv(DuplicateEntities)" set ::GidPriv(DuplicateEntities) 1 - #::spdAux::CreateDimensionWindow -} - -proc ::MPM::LoadMyFiles { } { - variable dir - - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - uplevel #0 [list source [file join $dir examples examples.tcl]] -} - -proc ::MPM::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value -} - -proc ::MPM::CustomToolbarItems { } { - variable dir - if {$::Model::SpatialDimension eq "2D"} { - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::MPM::examples::FallingSandBall] [= "Example\nFalling sand ball"] - } -} - -proc ::MPM::CustomMenus { } { - MPM::examples::UpdateMenus + # XML init event + ::MPM::xml::Init + ::MPM::write::Init } - - -::MPM::Init diff --git a/kratos.gid/apps/MPM/write/write.tcl b/kratos.gid/apps/MPM/write/write.tcl index 527f1fbbe..83d9a12aa 100644 --- a/kratos.gid/apps/MPM/write/write.tcl +++ b/kratos.gid/apps/MPM/write/write.tcl @@ -1,4 +1,7 @@ namespace eval MPM::write { + namespace path ::MPM + Kratos::AddNamespace [namespace current] + variable writeAttributes variable ConditionsDictGroupIterators } @@ -7,17 +10,16 @@ proc MPM::write::Init { } { # Namespace variables inicialization variable ConditionsDictGroupIterators set ConditionsDictGroupIterators [dict create] - SetAttribute parts_un MPMParts - SetAttribute nodal_conditions_un MPMNodalConditions - SetAttribute conditions_un MPMLoads - SetAttribute properties_location json - # SetAttribute conditions_un FLBC - # SetAttribute materials_un EMBFLMaterials - # SetAttribute writeCoordinatesByGroups 0 - # SetAttribute validApps [list "MPM"] - SetAttribute main_script_file "KratosParticle.py" - SetAttribute materials_file "ParticleMaterials.json" - SetAttribute model_part_name "Background_Grid" + + SetAttribute parts_un [::MPM::GetUniqueName parts] + SetAttribute nodal_conditions_un [::MPM:::GetUniqueName nodal_conditions] + SetAttribute conditions_un [::MPM::GetUniqueName conditions] + + SetAttribute writeCoordinatesByGroups [::MPM::GetWriteProperty coordinates] + SetAttribute main_launch_file [::MPM::GetAttribute main_launch_file] + SetAttribute materials_file [::MPM::GetWriteProperty materials_file] + SetAttribute properties_location [::MPM::GetWriteProperty properties_location] + SetAttribute model_part_name [::MPM::GetWriteProperty model_part_name] } # Events @@ -26,21 +28,21 @@ proc MPM::write::writeModelPartEvent { } { write::initWriteConfiguration [GetAttributes] MPM::write::UpdateMaterials - + set filename [Kratos::GetModelName] - + ## Grid MPDA ## # Headers write::writeModelPartData write::WriteString "Begin Properties 0" write::WriteString "End Properties" - # Nodal coordinates + # Nodal coordinates write::writeNodalCoordinates # Grid element connectivities writeGridConnectivities - + # Write conditions writeConditions @@ -70,22 +72,30 @@ proc MPM::write::writeModelPartEvent { } { write::CloseFile } -proc MPM::write::writeBodyNodalCoordinates { } { +proc MPM::write::GetPartsGroups { part_type {what "name"} } { set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group" set body_groups [list ] + set grid_elems [list GRID2D GRID3D] foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { set elem [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element'\]"] ] - if {$elem ni [list GRID2D GRID3D]} { - lappend body_groups [$gNode @n] + + if {($part_type eq "grid" && $elem in $grid_elems) || ($part_type ne "grid" && $elem ni $grid_elems)} { + if {$what eq "name"} { + lappend body_groups [$gNode @n] + } { + lappend body_groups $gNode + } } } - write::writeNodalCoordinatesOnGroups $body_groups + return $body_groups +} + +proc MPM::write::writeBodyNodalCoordinates { } { + write::writeNodalCoordinatesOnGroups [MPM::write::GetPartsGroups Body] } proc MPM::write::writeBodyElementConnectivities { } { - set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group" - set body_groups [list ] - foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { + foreach gNode [MPM::write::GetPartsGroups Body node] { set elem [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element'\]"] ] if {$elem ni [list GRID2D GRID3D]} { write::writeGroupElementConnectivities $gNode $elem @@ -94,8 +104,7 @@ proc MPM::write::writeBodyElementConnectivities { } { } proc MPM::write::writeGridConnectivities { } { - set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group" - foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { + foreach gNode [MPM::write::GetPartsGroups grid node] { set elem [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element'\]"] ] if {$elem in [list GRID2D GRID3D]} { write::writeGroupElementConnectivities $gNode $elem @@ -104,39 +113,29 @@ proc MPM::write::writeGridConnectivities { } { } proc MPM::write::writeConditions { } { - variable ConditionsDictGroupIterators - set ConditionsDictGroupIterators [write::writeConditions [GetAttribute conditions_un] ] + set ConditionsDictGroupIterators [::write::writeConditions [GetAttribute conditions_un] ] } + proc MPM::write::writeSubmodelparts { type } { set grid_elements [list GRID2D GRID3D] - set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group" - set body_groups [list ] - foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { + foreach gNode [MPM::write::GetPartsGroups $type node] { set elem [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element'\]"] ] set part_name [get_domnode_attribute [$gNode parent] n] set group_name [get_domnode_attribute $gNode n] - if {$type eq "grid"} { - if {$elem in $grid_elements} { - write::writeGroupSubModelPart $part_name $group_name "Elements" - } - } else { - if {$elem ni $grid_elements} { - write::writeGroupSubModelPart $part_name $group_name "Elements" - } - } + write::writeGroupSubModelPart $part_name $group_name "Elements" } - if {$type eq "grid"} { # Write the boundary conditions submodelpart write::writeNodalConditions [GetAttribute nodal_conditions_un] - + # A Condition y a meshes-> salvo lo que no tenga topologia writeLoads } } + proc MPM::write::writeLoads { } { variable ConditionsDictGroupIterators set root [customlib::GetBaseRoot] @@ -154,30 +153,36 @@ proc MPM::write::writeLoads { } { } proc MPM::write::writeCustomFilesEvent { } { - # write::RenameFileInModel "ProjectParameters.json" "ProjectParameters.py" - # Materials file - write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] True Initial_MPM_Material - - # Main python script - set orig_name [GetAttribute main_script_file] - write::CopyFileIntoModel [file join "python" $orig_name ] - write::RenameFileInModel $orig_name "MainKratos.py" -} + set mats_json [dict get [write::getPropertiesList [GetAttribute parts_un] True Initial_MPM_Material] properties ] + set new_mats [list ] + foreach mat $mats_json { + set type [dict exists $mat Material constitutive_law] + if {$type eq 0} { + set submodelpart [lindex [split [dict get $mat model_part_name] "."] end] + dict set mat model_part_name Background_Grid.$submodelpart + } + lappend new_mats $mat + } + write::OpenFile [GetAttribute materials_file] + write::WriteJSON [dict create properties $new_mats] + write::CloseFile + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] +} proc MPM::write::UpdateMaterials { } { set matdict [write::getMatDict] foreach {mat props} $matdict { # Modificar la ley constitutiva dict set matdict $mat THICKNESS 1.0000E+00 - + set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group\[@n='$mat'\]/value\[@n='THICKNESS'\]" - set vNode [[customlib::GetBaseRoot] selectNodes $xp1] + set vNode [[customlib::GetBaseRoot] selectNodes $xp1] if {$vNode ne ""} { dict set matdict $mat THICKNESS [write::getValueByNode $vNode] } - + } write::setMatDict $matdict } @@ -195,6 +200,4 @@ proc MPM::write::GetAttributes {} { proc MPM::write::SetAttribute {att val} { variable writeAttributes dict set writeAttributes $att $val -} - -MPM::write::Init +} \ No newline at end of file diff --git a/kratos.gid/apps/MPM/write/writeProjectParameters.tcl b/kratos.gid/apps/MPM/write/writeProjectParameters.tcl index 2ad7dcd24..534ad83e5 100644 --- a/kratos.gid/apps/MPM/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/MPM/write/writeProjectParameters.tcl @@ -2,6 +2,9 @@ proc ::MPM::write::getParametersDict { } { set project_parameters_dict [Structural::write::getParametersDict] + # Analysis stage field + dict set project_parameters_dict analysis_stage "KratosMultiphysics.ParticleMechanicsApplication.particle_mechanics_analysis" + # Quasi-static must be written as Quasi-static... set solutiontype [write::getValue STSoluType] dict set project_parameters_dict solver_settings solver_type $solutiontype @@ -100,10 +103,8 @@ proc ::MPM::write::getParametersDict { } { dict unset project_parameters_dict solver_settings rayleigh_alpha dict unset project_parameters_dict solver_settings rayleigh_beta - return $project_parameters_dict } proc ::MPM::write::writeParametersEvent { } { write::WriteJSON [getParametersDict] } - diff --git a/kratos.gid/apps/MPM/xml/Conditions.xml b/kratos.gid/apps/MPM/xml/Conditions.xml index bd92c566a..75a2559ca 100644 --- a/kratos.gid/apps/MPM/xml/Conditions.xml +++ b/kratos.gid/apps/MPM/xml/Conditions.xml @@ -97,7 +97,7 @@ WorkingSpaceDimension="2D" LocalSpaceDimension="1" RequiresLocalAxes="False" LargeDeformation="False" ElementType="Line" ProcessName="ApplyMPMSlipBoundaryProcess" help=""> - + @@ -110,7 +110,7 @@ WorkingSpaceDimension="2Da" LocalSpaceDimension="1" RequiresLocalAxes="False" LargeDeformation="False" ElementType="Line" ProcessName="ApplyMPMSlipBoundaryProcess" help=""> - + diff --git a/kratos.gid/apps/MPM/xml/XmlController.tcl b/kratos.gid/apps/MPM/xml/XmlController.tcl index c9186ab2e..dc5502204 100644 --- a/kratos.gid/apps/MPM/xml/XmlController.tcl +++ b/kratos.gid/apps/MPM/xml/XmlController.tcl @@ -1,13 +1,12 @@ namespace eval MPM::xml { - # Namespace variables declaration - variable dir + namespace path ::MPM + Kratos::AddNamespace [namespace current] } proc MPM::xml::Init { } { # Namespace variables inicialization - variable dir - Model::InitVariables dir $MPM::dir + Model::InitVariables dir $::MPM::dir # Import our elements Model::ForgetElements @@ -48,12 +47,12 @@ proc MPM::xml::Init { } { proc MPM::xml::MultiAppEvent {args} { if {$args eq "init"} { spdAux::parseRoutes - spdAux::ConvertAllUniqueNames ST ${::MPM::prefix} + spdAux::ConvertAllUniqueNames ST MPM } } proc MPM::xml::getUniqueName {name} { - return ${::MPM::prefix}${name} + return MPM${name} } proc MPM::xml::CustomTree { args } { @@ -61,7 +60,7 @@ proc MPM::xml::CustomTree { args } { spdAux::SetValueOnTreeItem v "time" Results OutputControlType spdAux::SetValueOnTreeItem values "time" Results OutputControlType spdAux::SetValueOnTreeItem v No NodalResults PARTITION_INDEX - spdAux::SetValueOnTreeItem v "EigenSolversApplication.sparse_lu" MPMimplicitlinear_solver_settings Solver + spdAux::SetValueOnTreeItem v "LinearSolversApplication.sparse_lu" MPMimplicitlinear_solver_settings Solver } @@ -72,5 +71,3 @@ proc MPM::xml::ProcCheckGeometry {domNode args} { } return $ret } - -MPM::xml::Init diff --git a/kratos.gid/apps/MdpaGenerator/app.json b/kratos.gid/apps/MdpaGenerator/app.json new file mode 100644 index 000000000..4b08bd753 --- /dev/null +++ b/kratos.gid/apps/MdpaGenerator/app.json @@ -0,0 +1,24 @@ +{ + "id": "MdpaGenerator", + "name": "Mdpa Generator", + "script_files": [ + "start.tcl", + "xml/XmlController.tcl", + "write/write.tcl" + ], + "dimensions": [ + "3D" + ], + "start_script":"::MdpaGenerator::Init", + "requeriments":{ + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": false, + "wizard": false + }, + "main_launch_file": null, + "description": "MDPA generator \n-Useful tool to generate modelparts" +} diff --git a/kratos.gid/apps/MdpaGenerator/images/logo.png b/kratos.gid/apps/MdpaGenerator/images/logo.png new file mode 100644 index 000000000..243957065 Binary files /dev/null and b/kratos.gid/apps/MdpaGenerator/images/logo.png differ diff --git a/kratos.gid/apps/MdpaGenerator/start.tcl b/kratos.gid/apps/MdpaGenerator/start.tcl new file mode 100644 index 000000000..5abf127ef --- /dev/null +++ b/kratos.gid/apps/MdpaGenerator/start.tcl @@ -0,0 +1,25 @@ +namespace eval ::MdpaGenerator { + Kratos::AddNamespace [namespace current] + + # Variable declaration + variable _app + variable dir +} + + +proc ::MdpaGenerator::Init { app } { + + # Variable initialization + variable _app + variable dir + + set _app $app + set dir [apps::getMyDir "MdpaGenerator"] + + ::MdpaGenerator::xml::Init + ::MdpaGenerator::write::Init +} + +proc ::MdpaGenerator::BreakRunCalculation {} { + return true +} \ No newline at end of file diff --git a/kratos.gid/apps/MdpaGenerator/write/write.tcl b/kratos.gid/apps/MdpaGenerator/write/write.tcl new file mode 100644 index 000000000..bb6cda6dc --- /dev/null +++ b/kratos.gid/apps/MdpaGenerator/write/write.tcl @@ -0,0 +1,118 @@ +namespace eval ::MdpaGenerator::write { + namespace path ::MdpaGenerator + Kratos::AddNamespace [namespace current] + + # Namespace variables declaration + variable writeCoordinatesByGroups + variable writeAttributes + variable ConditionMap + # after regular conditions are written, we need this number in order to print the custom submodelpart conditions + # only if are applied over things that are not in the skin + variable last_condition_iterator +} + +proc ::MdpaGenerator::write::Init { } { + # Namespace variables inicialization + + variable last_condition_iterator + set last_condition_iterator 0 + + variable writeAttributes + set writeAttributes [dict create ] +} + +# MDPA write event +proc ::MdpaGenerator::write::writeModelPartEvent { } { + # Validation + set err [Validate] + if {$err ne ""} {error $err} + + InitConditionsMap + writeProperties + + # Init data + write::initWriteConfiguration [GetAttributes] + + # Headers + write::writeModelPartData + + # Nodal coordinates + write::writeNodalCoordinates + + # Custom SubmodelParts + set conditions_mode [write::getValue SMP_write_options condition_write_mode] + variable last_condition_iterator + set last_condition_iterator [expr [write::getValue SMP_write_options conditions_start_id] -1] + switch $conditions_mode { + "unique" {write::writeBasicSubmodelPartsByUniqueId $MdpaGenerator::write::ConditionMap $last_condition_iterator} + "norepeat" {write::writeBasicSubmodelParts $last_condition_iterator} + "gid-id" {} + default {} + } + + + # Clean + unset ::MdpaGenerator::write::ConditionMap +} + +proc ::MdpaGenerator::write::writeCustomFilesEvent { } { +} + + +proc ::MdpaGenerator::write::Validate {} { + set err "" + + return $err +} + +# MDPA Blocks +proc ::MdpaGenerator::write::writeProperties { } { + # Begin Properties + write::WriteString "Begin Properties 0" + write::WriteString "End Properties" + write::WriteString "" +} + +proc ::MdpaGenerator::write::InitConditionsMap { {map "" } } { + + variable ConditionMap + if {$map eq ""} { + set ConditionMap [objarray new intarray [expr [GiD_Info Mesh MaxNumElements] +1] 0] + } { + set ConditionMap $map + } +} +proc ::MdpaGenerator::write::FreeConditionsMap { } { + + variable ConditionMap + unset ConditionMap +} + +proc ::MdpaGenerator::write::GetAttribute {att} { + variable writeAttributes + return [dict get $writeAttributes $att] +} + +proc ::MdpaGenerator::write::GetAttributes {} { + variable writeAttributes + return $writeAttributes +} + +proc ::MdpaGenerator::write::SetAttribute {att val} { + variable writeAttributes + dict set writeAttributes $att $val +} + +proc ::MdpaGenerator::write::AddAttribute {att val} { + variable writeAttributes + dict lappend writeAttributes $att $val +} + +proc ::MdpaGenerator::write::AddAttributes {configuration} { + variable writeAttributes + set writeAttributes [dict merge $writeAttributes $configuration] +} + +proc ::MdpaGenerator::write::writeParametersEvent { } { + +} \ No newline at end of file diff --git a/kratos.gid/apps/MdpaGenerator/xml/Main.spd b/kratos.gid/apps/MdpaGenerator/xml/Main.spd new file mode 100644 index 000000000..e3ca4c759 --- /dev/null +++ b/kratos.gid/apps/MdpaGenerator/xml/Main.spd @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/MdpaGenerator/xml/Procs.spd b/kratos.gid/apps/MdpaGenerator/xml/Procs.spd new file mode 100644 index 000000000..040933111 --- /dev/null +++ b/kratos.gid/apps/MdpaGenerator/xml/Procs.spd @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/kratos.gid/apps/MdpaGenerator/xml/XmlController.tcl b/kratos.gid/apps/MdpaGenerator/xml/XmlController.tcl new file mode 100644 index 000000000..b3273b76c --- /dev/null +++ b/kratos.gid/apps/MdpaGenerator/xml/XmlController.tcl @@ -0,0 +1,14 @@ +namespace eval ::MdpaGenerator::xml { + namespace path ::MdpaGenerator + Kratos::AddNamespace [namespace current] + + # Namespace variables declaration + variable dir +} + +proc ::MdpaGenerator::xml::Init { } { + # Namespace variables inicialization + variable dir + Model::InitVariables dir $::MdpaGenerator::dir + +} diff --git a/kratos.gid/apps/Pfem/images/2D.png b/kratos.gid/apps/Pfem/images/2D.png deleted file mode 100644 index b7ea880e0..000000000 Binary files a/kratos.gid/apps/Pfem/images/2D.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/2Da.png b/kratos.gid/apps/Pfem/images/2Da.png deleted file mode 100644 index 177ed86fc..000000000 Binary files a/kratos.gid/apps/Pfem/images/2Da.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/3D.png b/kratos.gid/apps/Pfem/images/3D.png deleted file mode 100644 index 6b418ad8e..000000000 Binary files a/kratos.gid/apps/Pfem/images/3D.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/2D.png b/kratos.gid/apps/Pfem/images/Black/2D.png deleted file mode 100644 index 4fc87cb47..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/2D.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/2Da.png b/kratos.gid/apps/Pfem/images/Black/2Da.png deleted file mode 100644 index ea01da8a2..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/2Da.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/3D.png b/kratos.gid/apps/Pfem/images/Black/3D.png deleted file mode 100644 index c50b7c2f1..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/3D.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/analysis_type.png b/kratos.gid/apps/Pfem/images/Black/analysis_type.png deleted file mode 100644 index e9518e1c7..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/analysis_type.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/bodies.png b/kratos.gid/apps/Pfem/images/Black/bodies.png deleted file mode 100644 index 76b337649..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/bodies.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/body.png b/kratos.gid/apps/Pfem/images/Black/body.png deleted file mode 100644 index 6d2de31d2..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/body.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/boundaryConditions.png b/kratos.gid/apps/Pfem/images/Black/boundaryConditions.png deleted file mode 100644 index 7a53439e5..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/boundaryConditions.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/cancelProcess.png b/kratos.gid/apps/Pfem/images/Black/cancelProcess.png deleted file mode 100644 index 6f0580957..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/cancelProcess.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/contactStrategy.png b/kratos.gid/apps/Pfem/images/Black/contactStrategy.png deleted file mode 100644 index e5fec1056..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/contactStrategy.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/data.png b/kratos.gid/apps/Pfem/images/Black/data.png deleted file mode 100644 index 0a9012afb..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/data.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/doRestart.png b/kratos.gid/apps/Pfem/images/Black/doRestart.png deleted file mode 100644 index 4f5a443ac..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/doRestart.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/folder.png b/kratos.gid/apps/Pfem/images/Black/folder.png deleted file mode 100644 index 9b967fc38..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/folder.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/gravity_vector.png b/kratos.gid/apps/Pfem/images/Black/gravity_vector.png deleted file mode 100644 index f4fa5b90a..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/gravity_vector.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/groupCreated.png b/kratos.gid/apps/Pfem/images/Black/groupCreated.png deleted file mode 100644 index f174a291e..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/groupCreated.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/linear_solver.png b/kratos.gid/apps/Pfem/images/Black/linear_solver.png deleted file mode 100644 index 80f0f7307..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/linear_solver.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/meshingStrategies.png b/kratos.gid/apps/Pfem/images/Black/meshingStrategies.png deleted file mode 100644 index 194b27976..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/meshingStrategies.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/modelProperties.png b/kratos.gid/apps/Pfem/images/Black/modelProperties.png deleted file mode 100644 index 0662b1959..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/modelProperties.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/modelling.png b/kratos.gid/apps/Pfem/images/Black/modelling.png deleted file mode 100644 index e67b0a10f..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/modelling.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/parallel_type.png b/kratos.gid/apps/Pfem/images/Black/parallel_type.png deleted file mode 100644 index 32ddaae50..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/parallel_type.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/parts.png b/kratos.gid/apps/Pfem/images/Black/parts.png deleted file mode 100644 index d25725f10..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/parts.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/pfemData.png b/kratos.gid/apps/Pfem/images/Black/pfemData.png deleted file mode 100644 index bf9bc6821..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/pfemData.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/runSimulation.png b/kratos.gid/apps/Pfem/images/Black/runSimulation.png deleted file mode 100644 index 37a16063a..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/runSimulation.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/seeResults.png b/kratos.gid/apps/Pfem/images/Black/seeResults.png deleted file mode 100644 index 0137561eb..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/seeResults.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/select.png b/kratos.gid/apps/Pfem/images/Black/select.png deleted file mode 100644 index 5e245deeb..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/select.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/setLoad.png b/kratos.gid/apps/Pfem/images/Black/setLoad.png deleted file mode 100644 index 066f81048..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/setLoad.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/setUnits.png b/kratos.gid/apps/Pfem/images/Black/setUnits.png deleted file mode 100644 index f9d191505..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/setUnits.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/settings.png b/kratos.gid/apps/Pfem/images/Black/settings.png deleted file mode 100644 index a42cf2596..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/settings.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/sheets.png b/kratos.gid/apps/Pfem/images/Black/sheets.png deleted file mode 100644 index d1d70413c..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/sheets.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/solid.png b/kratos.gid/apps/Pfem/images/Black/solid.png deleted file mode 100644 index 29241370a..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/solid.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/solvers.png b/kratos.gid/apps/Pfem/images/Black/solvers.png deleted file mode 100644 index 72773b5db..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/solvers.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/timeIntervals.png b/kratos.gid/apps/Pfem/images/Black/timeIntervals.png deleted file mode 100644 index 5555fa5d7..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/timeIntervals.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/timeParameters.png b/kratos.gid/apps/Pfem/images/Black/timeParameters.png deleted file mode 100644 index 2400bd6a5..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/timeParameters.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/tree.png b/kratos.gid/apps/Pfem/images/Black/tree.png deleted file mode 100644 index c3839cc21..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/tree.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/Black/view.png b/kratos.gid/apps/Pfem/images/Black/view.png deleted file mode 100644 index 84569e82d..000000000 Binary files a/kratos.gid/apps/Pfem/images/Black/view.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/bodies.png b/kratos.gid/apps/Pfem/images/bodies.png deleted file mode 100644 index 76b337649..000000000 Binary files a/kratos.gid/apps/Pfem/images/bodies.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/body.png b/kratos.gid/apps/Pfem/images/body.png deleted file mode 100644 index 6d2de31d2..000000000 Binary files a/kratos.gid/apps/Pfem/images/body.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/logo.png b/kratos.gid/apps/Pfem/images/logo.png deleted file mode 100644 index e23b3129d..000000000 Binary files a/kratos.gid/apps/Pfem/images/logo.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/logo_1.png b/kratos.gid/apps/Pfem/images/logo_1.png deleted file mode 100644 index cff91a03d..000000000 Binary files a/kratos.gid/apps/Pfem/images/logo_1.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/images/solvers.png b/kratos.gid/apps/Pfem/images/solvers.png deleted file mode 100644 index 9ae99faee..000000000 Binary files a/kratos.gid/apps/Pfem/images/solvers.png and /dev/null differ diff --git a/kratos.gid/apps/Pfem/python/RunPfem.py b/kratos.gid/apps/Pfem/python/RunPfem.py deleted file mode 100644 index 3dd0f0902..000000000 --- a/kratos.gid/apps/Pfem/python/RunPfem.py +++ /dev/null @@ -1,9 +0,0 @@ -import KratosMultiphysics -import KratosMultiphysics.ExternalSolversApplication -import KratosMultiphysics.DelaunayMeshingApplication -import KratosMultiphysics.PfemApplication -import KratosMultiphysics.ConstitutiveModelsApplication -import KratosMultiphysics.SolidMechanicsApplication -import MainPfem - -MainPfem.PfemSolution(KratosMultiphysics.Model()).Run() \ No newline at end of file diff --git a/kratos.gid/apps/Pfem/start.tcl b/kratos.gid/apps/Pfem/start.tcl deleted file mode 100644 index e1618d909..000000000 --- a/kratos.gid/apps/Pfem/start.tcl +++ /dev/null @@ -1,61 +0,0 @@ -namespace eval ::Pfem { - # Variable declaration - variable dir - variable attributes - variable kratos_name -} - -proc ::Pfem::Init { } { - # Variable initialization - variable dir - variable attributes - variable kratos_name - set kratos_name PfemFluidDynamicsApplication - - set dir [apps::getMyDir "Pfem"] - set ::Model::ValidSpatialDimensions [list 2D 2Da 3D] - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - set attributes [dict create] - dict set attributes UseIntervals 1 - if {$::Kratos::kratos_private(DevMode) ne "dev"} {error [= "You need to change to Developer mode in the Kratos menu"] } - dict set attributes UseRestart 1 - LoadMyFiles -} - -proc ::Pfem::LoadMyFiles { } { - variable dir - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir xml BodiesWindowController.tcl]] - uplevel #0 [list source [file join $dir .. Solid write write.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] -} - - -proc ::Pfem::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value -} - -proc ::Pfem::CustomToolbarItems { } { - variable dir - # Reset the left toolbar - set Kratos::kratos_private(MenuItems) [dict create] - set img_dir [file join $dir images] - if {[gid_themes::GetCurrentTheme] eq "GiD_black"} { - set img_dir [file join $img_dir Black] - } - Kratos::ToolbarAddItem "Model" [file join $img_dir "modelProperties.png"] [list -np- gid_groups_conds::open_conditions menu] [= "Define the model properties"] - Kratos::ToolbarAddItem "Bodies" [file join $img_dir "body.png"] [list -np- Pfem::xml::BodiesWindow::Start] [= "Bodies window"] - Kratos::ToolbarAddItem "Spacer" "" "" "" - Kratos::ToolbarAddItem "Run" [file join $img_dir "runSimulation.png"] {Utilities Calculate} [= "Run the simulation"] - Kratos::ToolbarAddItem "Output" [file join $img_dir "view.png"] [list -np- PWViewOutput] [= "View process info"] - Kratos::ToolbarAddItem "Stop" [file join $img_dir "cancelProcess.png"] {Utilities CancelProcess} [= "Cancel process"] - Kratos::ToolbarAddItem "SpacerApp" "" "" "" - -} - -::Pfem::Init diff --git a/kratos.gid/apps/Pfem/write/ProjectParameters.json b/kratos.gid/apps/Pfem/write/ProjectParameters.json deleted file mode 100644 index 180da658d..000000000 --- a/kratos.gid/apps/Pfem/write/ProjectParameters.json +++ /dev/null @@ -1,326 +0,0 @@ -{ - "problem_data" : { - "problem_name" : "problem_name", - "model_part_name" : "Main Model", - "dimension" : 3, - "time_step" : 0.001, - "start_time" : 0.0, - "end_time" : 0.002, - "echo_level" : 0, - "threads" : 2 - }, - "solver_settings" : { - "echo_level" : 0, - "buffer_size" : 2, - "solver_type" : "solid_mechanics_implicit_dynamic_solver", - "solution_type" : "Dynamic", - "time_integration_method" : "Implicit", - "scheme_type" : "Newmark", - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "Particle Domain", - "input_file_label" : "0" - }, - "line_search" : false, - "convergence_criterion" : "Residual_criterion", - "reform_dofs_at_each_step" : true, - "displacement_relative_tolerance" : 0.0001, - "displacement_absolute_tolerance" : 1e-9, - "residual_relative_tolerance" : 0.0001, - "residual_absolute_tolerance" : 1e-9, - "max_iteration" : 25, - "linear_solver_settings" : { - "solver_type" : "ExternalSolversApplication.sparse_lu" - }, - "bodies_list": [ - {"body_name":"body1", - "parts_list":["Part1"] - }, - {"body_name":"body2", - "parts_list":["Part2","Part3"] - } - ], - "processes_sub_model_part_list" :["DISPLACEMENT_Displacement_Auto1","SelfWeight3D_Self_weight_Auto1"] - }, - "problem_process_list" : [{ - "python_module" : "remesh_domains_process", - "kratos_module" : "KratosMultiphysics.PfemApplication", - "help" : "This process applies meshing to the problem domains", - "process_name" : "RemeshDomainsProcess", - "Parameters" : { - "model_part_name" : "Main Model", - "meshing_control_type" : "step", - "meshing_frequency" : 1.0, - "meshing_before_output" : true, - "meshing_domains" : [ - { - "python_module": "meshing_domain", - "model_part_name": "body_1", - "alpha_shape": 2.4, - "offset_factor": 0.0, - "meshing_strategy":{ - "python_module": "meshing_strategy", - "meshing_frequency": 0, - "remesh": false, - "refine": false, - "reconnect": false, - "transfer": false, - "constrained": false, - "mesh_smoothing": false, - "variables_smoothing": false, - "elemental_variables_to_smooth":[ "DETERMINANT_F" ], - "reference_element_type": "Element2D3N", - "reference_condition_type": "CompositeCondition2D2N" - }, - "spatial_bounding_box":{ - "upper_point": [0.0, 0.0, 0.0], - "lower_point": [0.0, 0.0, 0.0], - "velocity": [0.0, 0.0, 0.0] - }, - "refining_parameters":{ - "critical_size": 0.0, - "threshold_variable": "PLASTIC_STRAIN", - "reference_threshold" : 0.0, - "error_variable": "NORM_ISOCHORIC_STRESS", - "reference_error" : 0.0, - "add_nodes": true, - "insert_nodes": false, - "remove_nodes": { - "apply_removal": false, - "on_distance": false, - "on_threshold": false, - "on_error": false - }, - "remove_boundary": { - "apply_removal": false, - "on_distance": false, - "on_threshold": false, - "on_error": false - }, - "refine_elements": { - "apply_refinement": false, - "on_distance": false, - "on_threshold": false, - "on_error": false - }, - "refine_boundary": { - "apply_refinement": false, - "on_distance": false, - "on_threshold": false, - "on_error": false - }, - "refining_box":{ - "refine_in_box_only": false, - "upper_point": [0.0, 0.0, 0.0], - "lower_point": [0.0, 0.0, 0.0], - "velocity": [0.0, 0.0, 0.0] - } - }, - "elemental_variables_to_transfer":[ "CAUCHY_STRESS_VECTOR", "DEFORMATION_GRADIENT" ] - } - ] - } - },{ - "python_module" : "parametric_walls_process", - "kratos_module" : "KratosMultiphysics.ContactMechanicsApplication", - "help" : "This process applies parametric walls and search contact", - "process_name" : "ParametricWallsProcess", - "Parameters" : { - "model_part_name" : "Solid Domain", - "search_control_type" : "step", - "search_frequency" : 1.0, - "parametric_walls" : [ - { - "python_module": "parametric_wall", - "model_part_name" : "model_part_name", - "rigid_body_settings":{ - "rigid_body_element_type": "TranslatoryRigidElement3D1N", - "fixed_body": true, - "compute_body_parameters": false, - "rigid_body_model_part_name": "model_part_name", - "rigid_body_parameters":{ - "center_of_gravity": [0.0 ,0.0, 0.0], - "mass":0.0, - "main_inertias": [0.0, 0.0, 0.0], - "main_axes": [ [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0] ] - } - }, - "bounding_box_settings":{ - "kratos_module": "KratosMultiphysics.ContactMechanicsApplication", - "bounding_box_type": "SpatialBoundingBox", - "bounding_box_parameters":{ - "parameters_list":[], - "velocity" : [0.0, 0.0, 0.0] - } - }, - "contact_search_settings":{ - "kratos_module": "KratosMultiphysics.ContactMechanicsApplication", - "contact_search_type": "ParametricWallContactSearch", - "contact_parameters":{ - "contact_condition_type": "PointContactCondition2D1N", - "friction_law_type": "FrictionLaw", - "kratos_module": "KratosMultiphysics.ContactMechanicsApplication", - "variables_of_properties":{ - "FRICTION_ACTIVE": false, - "MU_STATIC": 0.3, - "MU_DYNAMIC": 0.2, - "PENALTY_PARAMETER": 1000, - "TANGENTIAL_PENALTY_RATIO": 0.1, - "TAU_STAB": 1 - } - } - } - } - - ] - } - },{ - "help" : "This process creates the rigid bodies of the model", - "kratos_module": "KratosMultiphysics.ContactMechanicsApplication", - "python_module": "rigid_bodies_process", - "process_name" : "RigidBodyProcess", - "Parameters" : { - "model_part_name" : "Main_Domain", - "rigid_bodies" : [ - { - "python_module" : "rigid_body", - "model_part_name": "Rigid_Body_Volume", - "rigid_body_settings":{ - "rigid_body_element_type": "RigidBodyElement2D1N", - "fixed_body": false, - "compute_body_parameters": true, - "rigid_body_model_part_name": "Rigid_Body_Volume", - "rigid_body_parameters":{ - "center_of_gravity": [0,0,0], - "mass": 0, - "main_inertias": [0, 0, 0], - "main_axes": [ [1,0,0], [0,1,0], [0,0,1] ] - } - } - }, - { - "python_module" : "rigid_body", - "model_part_name": "Rigid_Body_Surface", - "rigid_body_settings":{ - "rigid_body_element_type": "RigidBodyElement2D1N", - "fixed_body": false, - "compute_body_parameters": false, - "rigid_body_model_part_name": "Rigid_Body_Surface", - "rigid_body_parameters":{ - "center_of_gravity": [2,0,0], - "mass": 1, - "main_inertias": [1, 1, 1], - "main_axes": [ [1,0,0], [0,1,0], [0,0,1] ] - } - } - } - ] - } - },{ - "python_module" : "contact_domain_process", - "kratos_module" : "KratosMultiphysics.ContactMechanicsApplication", - "help" : "This process applies contact domain search by remeshing outer boundaries", - "process_name" : "ContactDomainProcess", - "Parameters" : { - "model_part_name" : "model_part_name", - "meshing_control_type" : "step", - "meshing_frequency" : 1.0, - "meshing_before_output" : true, - "meshing_domains" : [ - { - "python_module": "contact_domain", - "model_part_name": "sub_model_part_name", - "alpha_shape": 1.4, - "offset_factor": 0.0, - "meshing_strategy":{ - "python_module": "contact_meshing_strategy", - "meshing_frequency": 0, - "remesh": true, - "constrained": false, - "contact_parameters":{ - "contact_condition_type": "ContactDomainLM2DCondition", - "friction_law_type": "FrictionLaw", - "kratos_module": "KratosMultiphysics.ContactMechanicsApplication", - "variables_of_properties":{ - "FRICTION_ACTIVE": false, - "MU_STATIC": 0.3, - "MU_DYNAMIC": 0.2, - "PENALTY_PARAMETER": 1000, - "TANGENTIAL_PENALTY_RATIO": 0.1, - "TAU_STAB": 1 - } - } - }, - "elemental_variables_to_transfer":[ "CAUCHY_STRESS_VECTOR", "DEFORMATION_GRADIENT" ], - "contact_bodies_list": ["body1"] - } - ] - } - }], - "constraints_process_list" : [{ - "python_module" : "assign_value_to_vector_components_process", - "kratos_module" : "KratosMultiphysics.SolidMechanicsApplication", - "help" : "This process imposes a constraint", - "process_name" : "AssignValueToVectorComponentsProcess", - "Parameters" : { - "model_part_name" : "DISPLACEMENT_Displacement_Auto1", - "variable_name" : "DISPLACEMENT", - "interval" : [0.0, 100], - "time_function" : "constant", - "imposed_components" : [true, false, false], - "value" : [0.0, 0.0, 0.0] - } - }], - "loads_process_list" : [{ - "python_module" : "assign_vector_to_conditions_process", - "kratos_module" : "KratosMultiphysics.SolidMechanicsApplication", - "help" : "This process assigns a load value on conditions", - "process_name" : "AssignVectorToConditionsProcess", - "Parameters" : { - "model_part_name" : "load_y", - "variable_name" : "LINE_LOAD", - "interval" : [0.0, 100], - "time_function" : "incremental", - "modulus" : 100, - "direction" : [0.0,-1.0,0.0] - } - }], - "output_process_list" : [{ - "python_module" : "restart_process", - "kratos_module" : "KratosMultiphysics.SolidMechanicsApplication", - "help" : "This process writes restart files", - "process_name" : "RestartProcess", - "Parameters" : { - "model_part_name" : "Main Model", - "save_restart" : true, - "restart_file_name" : "cutting_test_rigid_2D_json", - "restart_file_label" : "step", - "output_control_type" : "time", - "output_frequency" : 0, - "json_output" : false - } - }], - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "MultipleFiles" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["DISPLACEMENT","REACTION","VELOCITY","ACCELERATION"], - "gauss_point_results" : ["GREEN_LAGRANGE_STRAIN_TENSOR","CAUCHY_STRESS_TENSOR","VON_MISES_STRESS"], - "additional_list_files": [] - - }, - "point_data_configuration" : [] - } - -} diff --git a/kratos.gid/apps/Pfem/write/design.txt b/kratos.gid/apps/Pfem/write/design.txt deleted file mode 100644 index 8716c2cf9..000000000 --- a/kratos.gid/apps/Pfem/write/design.txt +++ /dev/null @@ -1,61 +0,0 @@ -------------------------------- -ProblemType Tree: Proposta (hi ha coses que es poden ampliar i d'altres simplificar) - -Parts - Solid - Deformable - Rigid - Fluid - -( Select: Element, ConstitutiveLaw, Material, Body ) (igual que la SolidMechanics + el Body) - - -Bodies - -(Select: Type(Deformable_Solid, Rigid_Solid, Fluid), Meshing_Strategy, Contact_Strategy) - --------------- - -Meshing_Strategies - -(Select: No_Remesh, Remesh, Remesh and Refine ) a cada opció preguntar els paràmetres necessaris per la configuració del json. El Rigid_Solid_Body només No_Remesh. Habitualment hi haurà un sol Fluid_Body amb una única Meshing_Strategy, i cada Deformable_Solid_Body amb la seva meshing_strategy. - - -Contact_Strategies - -(Select: No_Contact, Deformable_Contact, Rigid_Contact) només existeixen aquestes tres, i no s'en poden afegir, un Deformable_Solid pot escollir: No_Contact or Deformable_Contact, un Rigid_Solid pot escollir només Rigid_Contact, i el Fluid només No_Contact. - -Se sobrentén que el fluid sempre trobarà les parets o rigid_bodies (no hi ha element de contacte), el sòlid trobarà les parets o rigid_bodies utilitzant la Rigid_Contact strategy. Per detectar el contacte entre Deformable_Bodies, un o tots ells han de seleccionar la Deformable_Contact_strategy. - - -Time Intervals / Time Functions / Boundary Conditions / Loads / Results / Materials -(igual que la SolidMechanics) - - -Solution - Solution_type (igual que la SolidMechanics) - - Solution_Strategy (igual que la SolidMechanics) - - Strategy_Parameters (igual que la SolidMechanics) - - Time_Parameters (igual que la SolidMechanics) - - Restart ( demano si carrego un .rest, necessito un Label ) - - Parallel_type (igual que la SolidMechanics + Selecció de threads) - - Linear_solver (igual que la SolidMechanics) - - -------------------------------- -arxius de input: - - -problem_name.mdpa (igual que la SolidMechanics) afegint submodelparts per BODIES creats (un body es un conjunt de les seves PARTS) -materials.py (igual de la Solid Mechanics, suposo que en el futur desepareixerà) -ProjectParamters.json (el que hi ha a la carpeta write) - - - - diff --git a/kratos.gid/apps/Pfem/write/write.tcl b/kratos.gid/apps/Pfem/write/write.tcl deleted file mode 100644 index 153663741..000000000 --- a/kratos.gid/apps/Pfem/write/write.tcl +++ /dev/null @@ -1,259 +0,0 @@ -namespace eval Pfem::write { - variable remesh_domains_dict - variable bodies_list - variable writeAttributes -} - -proc Pfem::write::Init { } { - variable remesh_domains_dict - set remesh_domains [dict create ] - variable bodies_list - set bodies_list [list ] - Solid::write::AddValidApps "Pfem" - - SetAttribute parts_un PFEM_Parts - SetAttribute nodal_conditions_un PFEM_NodalConditions - SetAttribute conditions_un PFEM_Loads - SetAttribute materials_un PFEM_Materials - SetAttribute writeCoordinatesByGroups 0 - SetAttribute validApps [list "Pfem"] - SetAttribute materials_file "Materials.json" - SetAttribute properties_location "json" -} - -proc Pfem::write::writeParametersEvent { } { - write::WriteJSON [getParametersDict] - write::SetParallelismConfiguration -} - -# Model Part Blocks -proc Pfem::write::writeModelPartEvent { } { - # Init data - SetAttribute main_script_file [Pfem::write::GetMainScriptFilename] - write::initWriteConfiguration [GetAttributes] - - # Headers - write::writeModelPartData - write::WriteString "Begin Properties 0" - write::WriteString "End Properties" - write::writeMaterials "Pfem" - - # Nodal coordinates (1: Print only Fluid nodes | 0: the whole mesh ) - if {[GetAttribute writeCoordinatesByGroups]} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} - - # Element connectivities (Groups on FLParts) - write::writeElementConnectivities - - # Nodal conditions and conditions - Solid::write::writeConditions - - # SubmodelParts - Pfem::write::writeSubmodelParts -} - -proc Pfem::write::writeSubmodelParts { } { - # Submodelparts for Parts - write::writePartSubModelPart - - # Solo Malla , no en conditions - writeNodalConditions [GetAttribute nodal_conditions_un] - - # A Condition y a meshes-> salvo lo que no tenga topologia - Solid::write::writeLoads -} - - -proc Pfem::write::writeNodalConditions { keyword } { - write::writeNodalConditions $keyword - return "" - - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute $keyword]/container/blockdata" - set groups [$root selectNodes $xp1] - foreach group $groups { - set cid [[$group parent] @n] - set groupid [$group @name] - set groupid [write::GetWriteGroupName $groupid] - # TODO: Aqui hay que gestionar la escritura de los bodies - # Una opcion es crear un megagrupo temporal con esa informacion, mandar a pintar, y luego borrar el grupo. - # Otra opcion es no escribir el submodelpart. Ya tienen las parts y el project parameters tiene el conformado de los bodies - ::write::writeGroupSubModelPart $cid $groupid "nodal" - } -} - -# Custom files (Copy python scripts, write materials file...) -proc Pfem::write::writeCustomFilesEvent { } { - Pfem::write::WriteMaterialsFile - - set orig_name [GetAttribute main_script_file] - write::CopyFileIntoModel [file join "python" $orig_name] - write::RenameFileInModel $orig_name "MainKratos.py" -} - -proc Pfem::write::WriteMaterialsFile { } { - variable validApps - - set mats_json [Pfem::write::getPropertiesList [GetAttribute parts_un]] - - write::OpenFile [GetAttribute materials_file] - write::WriteJSON $mats_json - write::CloseFile -} - -proc Pfem::write::getPropertiesList {parts_un} { - set mat_dict [write::getMatDict] - set props_dict [dict create] - set props [list ] - set sections [list ] - - set python_module "assign_materials_process" - set process_name "AssignMaterialsProcess" - set help "This process creates a material and assigns its properties" - - #set doc $gid_groups_conds::doc - #set root [$doc documentElement] - set root [customlib::GetBaseRoot] - - set xp1 "[spdAux::getRoute $parts_un]/group" - foreach gNode [$root selectNodes $xp1] { - set group [get_domnode_attribute $gNode n] - set sub_model_part [write::getSubModelPartId Parts $group] - if { [dict exists $mat_dict $group] } { - set law_id [dict get $mat_dict $group MID] - set law_name [dict get $mat_dict $group ConstitutiveLaw] - if { $law_name ne "None" } { - - set law_type [[Model::getConstitutiveLaw $law_name] getAttribute "Type"] - set mat_name [dict get $mat_dict $group Material] - set prop_dict [dict create] - set kratos_module [[Model::getConstitutiveLaw $law_name] getAttribute "kratos_module"] - - dict set prop_dict "python_module" $python_module - dict set prop_dict "kratos_module" $kratos_module - dict set prop_dict "help" $help - dict set prop_dict "process_name" $process_name - - set exclusionList [list "MID" "APPID" "ConstitutiveLaw" "Material" "Element"] - set variables_dict [dict create] - foreach prop [dict keys [dict get $mat_dict $group] ] { - if {$prop ni $exclusionList} { - dict set variables_list $prop [write::getFormattedValue [dict get $mat_dict $group $prop]] - } - } - set material_dict [dict create] - dict set material_dict "model_part_name" $sub_model_part - dict set material_dict "properties_id" $law_id - dict set material_dict "material_name" $mat_name - - set law_full_name [join [list "KratosMultiphysics" $kratos_module $law_name] "."] - dict set material_dict constitutive_law [dict create name $law_full_name] - dict set material_dict variables $variables_list - dict set material_dict tables dictnull - dict set prop_dict Parameters $material_dict - - lappend props $prop_dict - } - } - - } - - - dict set props_dict material_models_list $props - - return $props_dict -} - - - -proc Pfem::write::GetDefaultOutputDict { {appid ""} } { - set outputDict [dict create] - set resultDict [dict create] - - if {$appid eq ""} {set results_UN Results } {set results_UN [apps::getAppUniqueName $appid Results]} - set GiDPostDict [dict create] - dict set GiDPostDict GiDPostMode [write::getValue $results_UN GiDPostMode] - dict set GiDPostDict WriteDeformedMeshFlag [write::getValue $results_UN GiDWriteMeshFlag] - dict set GiDPostDict WriteConditionsFlag [write::getValue $results_UN GiDWriteConditionsFlag] - dict set GiDPostDict MultiFileFlag [write::getValue $results_UN GiDMultiFileFlag] - dict set resultDict gidpost_flags $GiDPostDict - - dict set resultDict file_label [write::getValue $results_UN FileLabel] - set outputCT [write::getValue $results_UN OutputControlType] - dict set resultDict output_control_type $outputCT - if {$outputCT eq "time"} {set frequency [write::getValue $results_UN OutputDeltaTime]} {set frequency [write::getValue $results_UN OutputDeltaStep]} - dict set resultDict output_frequency $frequency - - dict set resultDict node_output [write::getValue $results_UN NodeOutput] - - #dict set resultDict plane_output [write::GetCutPlanesList $results_UN] - - set nodal_results [write::GetResultsList $results_UN OnNodes] - - set problemtype [write::getValue PFEM_DomainType] - set contact_active False - if {$problemtype ne "Fluid"} { - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute "PFEM_Bodies"]/blockdata" - foreach body_node [$root selectNodes $xp1] { - set contact [get_domnode_attribute [$body_node selectNodes ".//value\[@n='ContactStrategy'\]"] v] - if {$contact eq "Yes"} { set contact_active True } - } - if {$contact_active eq True} { - lappend nodal_results "CONTACT_FORCE" - lappend nodal_results "NORMAL" - } - } - - if {$problemtype ne "Solid"} { - if {$contact_active ne True} { - lappend nodal_results "NORMAL" - } - set nodal_flags_results [list] - lappend nodal_flags_results "FREE_SURFACE" "INLET" - dict set resultDict nodal_flags_results $nodal_flags_results - } - - dict set resultDict nodal_results $nodal_results - dict set resultDict gauss_point_results [write::GetResultsList $results_UN OnElement] - - dict set outputDict "result_file_configuration" $resultDict - #dict set outputDict "point_data_configuration" [write::GetEmptyList] - return $outputDict -} - -proc Pfem::write::GetMainScriptFilename { } { - set problemtype [write::getValue PFEM_DomainType] - return "RunPfem.py" -} - -# Functions to use the write attribute system -proc Pfem::write::GetAttribute {att} { - variable writeAttributes - return [dict get $writeAttributes $att] -} - -proc Pfem::write::GetAttributes {} { - variable writeAttributes - return $writeAttributes -} - -proc Pfem::write::SetAttribute {att val} { - variable writeAttributes - dict set writeAttributes $att $val -} - -proc Pfem::write::AddAttribute {att val} { - variable writeAttributes - dict lappend writeAttributes $att $val -} - -proc Pfem::write::AddAttributes {configuration} { - variable writeAttributes - set writeAttributes [dict merge $writeAttributes $configuration] -} - -proc Pfem::write::AddValidApps {appid} { - AddAttribute validApps $appid -} - -Pfem::write::Init diff --git a/kratos.gid/apps/Pfem/write/writeProjectParameters.tcl b/kratos.gid/apps/Pfem/write/writeProjectParameters.tcl deleted file mode 100644 index ca678919b..000000000 --- a/kratos.gid/apps/Pfem/write/writeProjectParameters.tcl +++ /dev/null @@ -1,887 +0,0 @@ - -# Project Parameters -proc Pfem::write::getParametersDict { } { - Pfem::write::CalculateMyVariables - set projectParametersDict [dict create] - - ##### Problem data ##### - # Create section - set problemDataDict [GetPFEM_ProblemDataDict] - dict set projectParametersDict problem_data $problemDataDict - - ##### model_data ##### - set modelDataDict [GetPFEM_ModelDataDict] - dict set projectParametersDict model_settings $modelDataDict - - ##### Time settings ##### - set timeDataDict [dict create] - dict set timeDataDict time_step [write::getValue PFEM_TimeParameters DeltaTime] - dict set timeDataDict end_time [write::getValue PFEM_TimeParameters EndTime] - dict set projectParametersDict time_settings $timeDataDict - - ##### solver_settings ##### - set solverSettingsDict [GetPFEM_SolverSettingsDict] - dict set projectParametersDict solver_settings $solverSettingsDict - - ##### problem_process_list - set problemProcessList [GetPFEM_ProblemProcessList] - dict set projectParametersDict problem_process_list $problemProcessList - - ##### constraints_process_list - set group_constraints [Pfem::write::getConditionsParametersDict PFEM_NodalConditions "Nodal"] - set body_constraints [Pfem::write::getBodyConditionsParametersDict PFEM_NodalConditions "Nodal"] - dict set projectParametersDict constraints_process_list [concat $group_constraints $body_constraints] - - ##### loads_process_list - dict set projectParametersDict loads_process_list [Pfem::write::GetConditionsParametersDictWithGravity] - - ##### Restart - set output_process_list [GetPFEM_OutputProcessList] - dict set projectParametersDict output_process_list $output_process_list - - ##### output_configuration - dict set projectParametersDict output_configuration [Pfem::write::GetDefaultOutputDict] - - return $projectParametersDict -} - -proc Pfem::write::GetConditionsParametersDictWithGravity { } { - set loads_list [Pfem::write::getConditionsParametersDict PFEM_Loads] - set problemtype [write::getValue PFEM_DomainType] - if {$problemtype ne "Solid"} { - - set cx [write::getValue FLGravity Cx] - set cy [write::getValue FLGravity Cy] - set cz [write::getValue FLGravity Cz] - - set fluid_bodies_list [Pfem::write::GetFluidBodies] - - foreach body $fluid_bodies_list { - - set processDict [dict create] - set parametersDict [dict create] - - dict set parametersDict "model_part_name" $body - dict set parametersDict "variable_name" "VOLUME_ACCELERATION" - dict set parametersDict "value" [list $cx $cy $cz] - dict set parametersDict "constrained" false - - dict set processDict python_module "assign_vector_components_to_nodes_process" - dict set processDict kratos_module "KratosMultiphysics.SolidMechanicsApplication" - dict set processDict Parameters $parametersDict - - lappend loads_list $processDict - } - } - return $loads_list -} -proc Pfem::write::GetPFEM_ProblemDataDict { } { - set problemDataDict [dict create] - dict set problemDataDict problem_name [Kratos::GetModelName] - - dict set problemDataDict echo_level [write::getValue Results EchoLevel] - - #dict set problemDataDict threads [write::getValue Parallelization OpenMPNumberOfThreads] - - #set problemtype [write::getValue PFEM_DomainType] - #if {$problemtype ne "Solid"} { - # set cx [write::getValue FLGravity Cx] - # set cy [write::getValue FLGravity Cy] - # set cz [write::getValue FLGravity Cz] - # dict set problemDataDict gravity_vector [list $cx $cy $cz] - #} - - return $problemDataDict -} - -proc Pfem::write::GetPFEM_ModelDataDict { } { - variable bodies_list - set modelDataDict [dict create] - dict set modelDataDict model_name [Kratos::GetModelName] - - set nDim $::Model::SpatialDimension - set nDim [expr [string range [write::getValue nDim] 0 0] ] - dict set modelDataDict dimension $nDim - - # model import settings - set modelDict [dict create] - #dict set modelDict type "mdpa" - dict set modelDict name [Kratos::GetModelName] - #dict set modelDict label 0 - dict set modelDataDict input_file_settings $modelDict - - set bodies_parts_list [list ] - foreach body $bodies_list { - set body_parts [dict get $body parts_list] - foreach part $body_parts { - lappend bodies_parts_list $part - } - } - - dict set modelDataDict bodies_list $bodies_list - dict set modelDataDict domain_parts_list $bodies_parts_list - dict set modelDataDict processes_parts_list [write::getSubModelPartNames "PFEM_NodalConditions" "PFEM_Loads"] - - return $modelDataDict -} - -proc Pfem::write::GetPFEM_SolverSettingsDict { } { - - set equationType [write::getValue PFEM_EquationType] - set solverSettingsDict [dict create] - set strategyId [write::getValue PFEM_SolStrat] - set strategy_write_name [[::Model::GetSolutionStrategy $strategyId] getAttribute "python_module"] - - if {$equationType eq "Monolithic"} { - return [GetPFEM_MonolithicSolverSettingsDict $strategy_write_name [DofsInElements]] - } else { - - # Solver type - dict set solverSettingsDict solver_type $strategy_write_name - # Solver parameters - set solverParametersDict [dict create] - set solver_name "solid_mechanics_implicit_dynamic_solver" - - set solversList [list ] - foreach dof [DofsInElements] { - lappend solversList [GetPFEM_MonolithicSolverSettingsDict $solver_name $dof] - } - - dict set solverParametersDict solvers $solversList - - # Set parameters to solver settings - dict set solverSettingsDict Parameters $solverParametersDict - - return $solverSettingsDict - } -} - -proc Pfem::write::GetPFEM_MonolithicSolverSettingsDict { solver_name dofs } { - - set solverSettingsDict [dict create] - - dict set solverSettingsDict solver_type $solver_name - - # Solver parameters - set solverParametersDict [dict create] - - # Time integration settings - set integrationDataDict [dict create] - - dict set integrationDataDict solution_type [write::getValue PFEM_SolutionType] - - set solutiontype [write::getValue PFEM_SolutionType] - - if {$solutiontype ne "Dynamic"} { - dict set integrationDataDict integration_method "Static" - dict set integrationDataDict analysis_type [write::getValue PFEM_AnalysisType] - } else { - if {$dofs eq "PRESSURE"} { - dict set integrationDataDict integration_method "Bdf" - dict set integrationDataDict time_integration_order 1 - dict set integrationDataDict analysis_type "Non-linear" - } else { - dict set integrationDataDict time_integration "Implicit" - dict set integrationDataDict integration_method [write::getValue PFEM_Scheme] - } - } - - # Solving strategy settings - set strategyDataDict [dict create] - - # Solution strategy parameters and Solvers - set strategyDataDict [dict merge $strategyDataDict [write::getSolutionStrategyParametersDict] ] - - # Get integration order as term for the integration settings - set exist_time_integration [dict exists $strategyDataDict time_integration_order] - if {$exist_time_integration eq 1} { - dict set integrationDataDict time_integration_order [dict get $strategyDataDict time_integration_order] - dict unset strategyDataDict time_integration_order - } - - # Buffer size for contact - set contact_list [Pfem::write::GetPFEM_ContactList] - set buffer_size 2 - if {[llength $contact_list]} { - set buffer_size 3 - } - dict set integrationDataDict buffer_size [expr $buffer_size] - - dict set solverParametersDict time_integration_settings $integrationDataDict - - # Get convergence criterion settings - set convergenceDataDict [dict create] - set exist_convergence_criterion [dict exists $strategyDataDict convergence_criterion] - if {$exist_convergence_criterion eq 1} { - dict set convergenceDataDict convergence_criterion [dict get $strategyDataDict convergence_criterion] - dict unset strategyDataDict convergence_criterion - set exist_variable_tolerances [dict exists $strategyDataDict variable_relative_tolerance] - if {$exist_variable_tolerances eq 1} { - dict set convergenceDataDict variable_relative_tolerance [dict get $strategyDataDict variable_relative_tolerance] - dict set convergenceDataDict variable_absolute_tolerance [dict get $strategyDataDict variable_absolute_tolerance] - dict unset strategyDataDict variable_relative_tolerance - dict unset strategyDataDict variable_absolute_tolerance - } - set exist_residual_tolerances [dict exists $strategyDataDict residual_relative_tolerance] - if {$exist_residual_tolerances eq 1} { - dict set convergenceDataDict residual_relative_tolerance [dict get $strategyDataDict residual_relative_tolerance] - dict set convergenceDataDict residual_absolute_tolerance [dict get $strategyDataDict residual_absolute_tolerance] - dict unset strategyDataDict residual_relative_tolerance - dict unset strategyDataDict residual_absolute_tolerance - } - } - - dict set solverParametersDict convergence_criterion_settings $convergenceDataDict - - set reform_dofs true - dict set strategyDataDict reform_dofs_at_each_step [expr $reform_dofs] - - set strategy_data_size [dict size $strategyDataDict] - if { $strategy_data_size ne 0 } { - dict set solverParametersDict solving_strategy_settings $strategyDataDict - } - - # Linear solver settings - set solverParametersDict [dict merge $solverParametersDict [write::getSolversParametersDict Pfem] ] - - # Add Dofs - # here [list {*}$dofs] forces the to be a list of items for correct writting json file (DARK TRICK) - dict set solverParametersDict dofs [list {*}$dofs] - - dict set solverSettingsDict Parameters $solverParametersDict - - - return $solverSettingsDict -} - -proc Pfem::write::GetPFEM_OutputProcessList { } { - set resultList [list] - lappend resultList [write::GetRestartProcess Restart] - return $resultList -} -proc Pfem::write::GetPFEM_ProblemProcessList { } { - set resultList [list ] - set problemtype [write::getValue PFEM_DomainType] - if {$problemtype ne "Solid"} { - lappend resultList [GetPFEM_FluidRemeshDict] - } else { - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute "PFEM_Bodies"]/blockdata" - set remesh_list [list ] - foreach body_node [$root selectNodes $xp1] { - set remesh [get_domnode_attribute [$body_node selectNodes ".//value\[@n='MeshingStrategy'\]"] v] - if {$remesh ne "No remesh" && $remesh ne ""} {lappend remesh_list $remesh} - } - if {[llength $remesh_list]} { - lappend resultList [GetPFEM_RemeshDict] - } - } - set contactDict [GetPFEM_ContactDict] - if {[dict size $contactDict]} {lappend resultList $contactDict} - return $resultList -} - -proc Pfem::write::GetPFEM_ContactList { } { - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute "PFEM_Bodies"]/blockdata" - set contact_list [list ] - foreach body_node [$root selectNodes $xp1] { - set contact [get_domnode_attribute [$body_node selectNodes ".//value\[@n='ContactStrategy'\]"] v] - if {$contact ne "No" && $contact ne "" && $contact ni $contact_list} {lappend contact_list $contact} - } - return $contact_list -} - -proc Pfem::write::GetPFEM_ContactDict { } { - - set contact_list [Pfem::write::GetPFEM_ContactList] - #W $contact_list - set contact_domains [list ] - foreach contact $contact_list { - lappend contact_domains [Pfem::write::GetPFEM_ContactProcessDict $contact] - } - set contact_dict [dict create] - if {[llength $contact_list]} { - dict set contact_dict "python_module" "contact_domain_process" - dict set contact_dict "kratos_module" "KratosMultiphysics.ContactMechanicsApplication" - dict set contact_dict "help" "This process applies contact domain search by remeshing outer boundaries" - dict set contact_dict "process_name" "ContactDomainProcess" - set params [dict create] - set model_name [Kratos::GetModelName] - dict set params "model_part_name" $model_name - dict set params "meshing_control_type" "step" - set frequency [Pfem::write::GetContactProperty "Solid-Solid" "Frequency"] - dict set params "meshing_frequency" [expr $frequency] - dict set params "meshing_before_output" true - dict set params "meshing_domains" $contact_domains - dict set contact_dict "Parameters" $params - } - return $contact_dict -} - -proc Pfem::write::GetPFEM_ContactProcessDict {contact_name} { - set cont_dict [dict create] - dict set cont_dict "python_module" "contact_domain" - set mesh_strat [dict create] - dict set mesh_strat "python_module" "contact_meshing_strategy" - set contact_parameters [dict create] - - set penalty_method [Pfem::write::GetContactProperty "Solid-Solid" "Penalty"] - set nDim $::Model::SpatialDimension - if {$nDim eq "3D"} { - if {$penalty_method eq "true"} { - dict set contact_parameters "contact_condition_type" "ContactDomainPenaltyCondition3D4N" - } else { - dict set contact_parameters "contact_condition_type" "ContactDomainLMCondition3D4N" - } - } else { - if {$penalty_method eq "true"} { - dict set contact_parameters "contact_condition_type" "ContactDomainPenaltyCondition2D3N" - } else { - dict set contact_parameters "contact_condition_type" "ContactDomainLMCondition2D3N" - } - } - - dict set contact_parameters "friction_law_type" "FrictionLaw" - dict set contact_parameters "kratos_module" "KratosMultiphysics.ContactMechanicsApplication" - set properties_dict [dict create] - - set prop_list [list ] - if {$penalty_method eq "true"} { - lappend prop_list "PENALTY_PARAMETER" - } else { - lappend prop_list "TAU_STAB" - } - - set friction_active [Pfem::write::GetContactProperty "Solid-Solid" "FRICTION_ACTIVE"] - if {$friction_active eq "true"} { - lappend prop_list "FRICTION_ACTIVE" - lappend prop_list "MU_STATIC" - lappend prop_list "MU_DYNAMIC" - if {$penalty_method eq "true"} { - lappend prop_list "TANGENTIAL_PENALTY_RATIO" - } - } else { - lappend prop_list "FRICTION_ACTIVE" - } - - foreach prop $prop_list { - set prop_value [Pfem::write::GetContactProperty "Solid-Solid" $prop] - set prop_value [expr $prop_value] - dict set properties_dict $prop $prop_value - } - - dict set contact_parameters "variables_of_properties" $properties_dict - dict set mesh_strat "contact_parameters" $contact_parameters - dict set cont_dict "elemental_variables_to_transfer" [list "CAUCHY_STRESS_VECTOR" "DEFORMATION_GRADIENT" ] - dict set cont_dict "contact_bodies_list" [Pfem::write::GetSolidBodiesWithContact] - dict set cont_dict "meshing_strategy" $mesh_strat - return $cont_dict -} - -proc Pfem::write::GetFluidBodies { } { - set bodies_list [list ] - # Locate the node pointing to the bodies - set xp1 "[spdAux::getRoute "PFEM_Bodies"]/blockdata" - foreach body_node [[customlib::GetBaseRoot] selectNodes $xp1] { - # If the body is Fluid - set body_type_path ".//value\[@n='BodyType'\]" - set body_type [get_domnode_attribute [$body_node selectNodes $body_type_path] v] - # Append to the return list - if {$body_type eq "Fluid"} {lappend bodies_list [get_domnode_attribute $body_node name]} - } - - return $bodies_list -} - -proc Pfem::write::GetSolidBodiesWithContact { } { - set bodies_list [list ] - set xp1 "[spdAux::getRoute "PFEM_Bodies"]/blockdata" - foreach body_node [[customlib::GetBaseRoot] selectNodes $xp1] { - set contact [get_domnode_attribute [$body_node selectNodes ".//value\[@n='ContactStrategy'\]"] v] - if {$contact eq "Yes"} {lappend bodies_list [get_domnode_attribute $body_node name]} - } - return $bodies_list -} - -proc Pfem::write::GetContactProperty { contact_name property } { - set ret "" - set root [customlib::GetBaseRoot] - set ret [get_domnode_attribute [$root selectNodes "[spdAux::getRoute "PFEM_contacts"]/container\[@n='$contact_name'\]/value\[@n='$property'\]"] v] - - if {$ret eq ""} {set ret null} - return $ret -} - -proc Pfem::write::GetPFEM_RemeshDict { } { - variable bodies_list - set resultDict [dict create ] - dict set resultDict "help" "This process applies meshing to the problem domains" - dict set resultDict "kratos_module" "KratosMultiphysics.PfemApplication" - dict set resultDict "python_module" "remesh_domains_process" - dict set resultDict "process_name" "RemeshDomainsProcess" - - set paramsDict [dict create] - set model_name [Kratos::GetModelName] - dict set paramsDict "model_part_name" $model_name - dict set paramsDict "meshing_control_type" "step" - dict set paramsDict "meshing_frequency" 1.0 - dict set paramsDict "meshing_before_output" true - set meshing_domains_list [list ] - foreach body $bodies_list { - set bodyDict [dict create ] - set body_name [dict get $body body_name] - set remesh [write::getStringBinaryFromValue [Pfem::write::GetRemeshProperty $body_name "Remesh"]] - if { $remesh eq "true" } { - dict set bodyDict "python_module" "meshing_domain" - dict set bodyDict "model_part_name" $body_name - dict set bodyDict "alpha_shape" 2.4 - dict set bodyDict "offset_factor" 0.0 - set refine [write::getStringBinaryFromValue [Pfem::write::GetRemeshProperty $body_name "Refine"]] - set meshing_strategyDict [dict create ] - dict set meshing_strategyDict "python_module" "meshing_strategy" - dict set meshing_strategyDict "meshing_frequency" 0 - dict set meshing_strategyDict "remesh" $remesh - dict set meshing_strategyDict "refine" $refine - dict set meshing_strategyDict "reconnect" false - dict set meshing_strategyDict "transfer" false - dict set meshing_strategyDict "constrained" false - dict set meshing_strategyDict "mesh_smoothing" false - dict set meshing_strategyDict "variables_smoothing" false - dict set meshing_strategyDict "elemental_variables_to_smooth" [list "DETERMINANT_F" ] - set nDim $::Model::SpatialDimension - if {$nDim eq "3D"} { - dict set meshing_strategyDict "reference_element_type" "Element3D4N" - dict set meshing_strategyDict "reference_condition_type" "CompositeCondition3D3N" - } else { - dict set meshing_strategyDict "reference_element_type" "Element2D3N" - dict set meshing_strategyDict "reference_condition_type" "CompositeCondition2D2N" - } - dict set bodyDict meshing_strategy $meshing_strategyDict - - set spatial_bounding_boxDict [dict create ] - set upX [expr 0.0]; set upY [expr 0.0]; set upZ [expr 0.0] - dict set spatial_bounding_boxDict "upper_point" [list $upX $upY $upZ] - set lpX [expr 0.0]; set lpY [expr 0.0]; set lpZ [expr 0.0] - dict set spatial_bounding_boxDict "lower_point" [list $lpX $lpY $lpZ] - set vlX [expr 0.0]; set vlY [expr 0.0]; set vlZ [expr 0.0] - dict set spatial_bounding_boxDict "velocity" [list $vlX $vlY $vlZ] - dict set bodyDict spatial_bounding_box $spatial_bounding_boxDict - - set refining_parametersDict [dict create ] - dict set refining_parametersDict "critical_size" 0.0 - dict set refining_parametersDict "threshold_variable" "PLASTIC_STRAIN" - dict set refining_parametersDict "reference_threshold" 0.0 - dict set refining_parametersDict "error_variable" "NORM_ISOCHORIC_STRESS" - dict set refining_parametersDict "reference_error" 0.0 - dict set refining_parametersDict "add_nodes" true - dict set refining_parametersDict "insert_nodes" false - - set remove_nodesDict [dict create] - dict set remove_nodesDict "apply_removal" false - dict set remove_nodesDict "on_distance" false - dict set remove_nodesDict "on_threshold" false - dict set remove_nodesDict "on_error" false - dict set refining_parametersDict remove_nodes $remove_nodesDict - - set remove_boundaryDict [dict create] - dict set remove_boundaryDict "apply_removal" false - dict set remove_boundaryDict "on_distance" false - dict set remove_boundaryDict "on_threshold" false - dict set remove_boundaryDict "on_error" false - dict set refining_parametersDict remove_boundary $remove_boundaryDict - - set refine_elementsDict [dict create] - dict set refine_elementsDict "apply_refinement" false - dict set refine_elementsDict "on_distance" false - dict set refine_elementsDict "on_threshold" false - dict set refine_elementsDict "on_error" false - dict set refining_parametersDict refine_elements $refine_elementsDict - - set refine_boundaryDict [dict create] - dict set refine_boundaryDict "apply_refinement" false - dict set refine_boundaryDict "on_distance" false - dict set refine_boundaryDict "on_threshold" false - dict set refine_boundaryDict "on_error" false - dict set refining_parametersDict refine_boundary $refine_boundaryDict - - set refining_boxDict [dict create] - dict set refining_boxDict "refine_in_box_only" false - set upX [expr 0.0]; set upY [expr 0.0]; set upZ [expr 0.0] - dict set refining_boxDict "upper_point" [list $upX $upY $upZ] - set lpX [expr 0.0]; set lpY [expr 0.0]; set lpZ [expr 0.0] - dict set refining_boxDict "lower_point" [list $lpX $lpY $lpZ] - set vlX [expr 0.0]; set vlY [expr 0.0]; set vlZ [expr 0.0] - dict set refining_boxDict "velocity" [list $vlX $vlY $vlZ] - dict set refining_parametersDict refining_box $refining_boxDict - - dict set bodyDict refining_parameters $refining_parametersDict - - dict set bodyDict "elemental_variables_to_transfer" [list "CAUCHY_STRESS_VECTOR" "DEFORMATION_GRADIENT"] - lappend meshing_domains_list $bodyDict - } - } - dict set paramsDict meshing_domains $meshing_domains_list - dict set resultDict Parameters $paramsDict - return $resultDict -} - -proc Pfem::write::GetPFEM_FluidRemeshDict { } { - variable bodies_list - set resultDict [dict create ] - dict set resultDict "help" "This process applies meshing to the problem domains" - dict set resultDict "kratos_module" "KratosMultiphysics.PfemApplication" - set problemtype [write::getValue PFEM_DomainType] - - dict set resultDict "python_module" "remesh_fluid_domains_process" - dict set resultDict "process_name" "RemeshFluidDomainsProcess" - - set paramsDict [dict create] - set model_name [Kratos::GetModelName] - dict set paramsDict "model_part_name" $model_name - dict set paramsDict "meshing_control_type" "step" - dict set paramsDict "meshing_frequency" 1.0 - dict set paramsDict "meshing_before_output" true - set meshing_domains_list [list ] - foreach body $bodies_list { - set bodyDict [dict create ] - set body_name [dict get $body body_name] - set remesh [write::getStringBinaryFromValue [Pfem::write::GetRemeshProperty $body_name "Remesh"]] - if { $remesh eq "true" } { - dict set bodyDict "model_part_name" $body_name - dict set bodyDict "python_module" "meshing_domain" - set nDim $::Model::SpatialDimension - if {$nDim eq "3D"} { - dict set bodyDict "alpha_shape" 1.3 - } else { - dict set bodyDict "alpha_shape" 1.25 - } - dict set bodyDict "offset_factor" 0.0 - set refine [write::getStringBinaryFromValue [Pfem::write::GetRemeshProperty $body_name "Refine"]] - set meshing_strategyDict [dict create ] - dict set meshing_strategyDict "python_module" "fluid_meshing_strategy" - dict set meshing_strategyDict "meshing_frequency" 0 - dict set meshing_strategyDict "remesh" $remesh - dict set meshing_strategyDict "refine" $refine - dict set meshing_strategyDict "reconnect" false - dict set meshing_strategyDict "transfer" false - dict set meshing_strategyDict "constrained" false - dict set meshing_strategyDict "mesh_smoothing" false - dict set meshing_strategyDict "variables_smoothing" false - dict set meshing_strategyDict "elemental_variables_to_smooth" [list "DETERMINANT_F" ] - if {$nDim eq "3D"} { - dict set meshing_strategyDict "reference_element_type" "UpdatedLagrangianSegregatedFluidElement3D4N" - dict set meshing_strategyDict "reference_condition_type" "CompositeCondition3D3N" - } else { - dict set meshing_strategyDict "reference_element_type" "UpdatedLagrangianSegregatedFluidElement2D3N" - dict set meshing_strategyDict "reference_condition_type" "CompositeCondition2D2N" - } - dict set bodyDict meshing_strategy $meshing_strategyDict - - set spatial_bounding_boxDict [dict create ] - set upX [expr 0.0]; set upY [expr 0.0]; set upZ [expr 0.0] - dict set spatial_bounding_boxDict "upper_point" [list $upX $upY $upZ] - set lpX [expr 0.0]; set lpY [expr 0.0]; set lpZ [expr 0.0] - dict set spatial_bounding_boxDict "lower_point" [list $lpX $lpY $lpZ] - set vlX [expr 0.0]; set vlY [expr 0.0]; set vlZ [expr 0.0] - dict set spatial_bounding_boxDict "velocity" [list $vlX $vlY $vlZ] - dict set bodyDict spatial_bounding_box $spatial_bounding_boxDict - - set refining_parametersDict [dict create ] - dict set refining_parametersDict "critical_size" 0.0 - dict set refining_parametersDict "threshold_variable" "PLASTIC_STRAIN" - dict set refining_parametersDict "reference_threshold" 0.0 - dict set refining_parametersDict "error_variable" "NORM_ISOCHORIC_STRESS" - dict set refining_parametersDict "reference_error" 0.0 - dict set refining_parametersDict "add_nodes" false - dict set refining_parametersDict "insert_nodes" true - - set remove_nodesDict [dict create] - dict set remove_nodesDict "apply_removal" true - dict set remove_nodesDict "on_distance" true - dict set remove_nodesDict "on_threshold" false - dict set remove_nodesDict "on_error" false - dict set refining_parametersDict remove_nodes $remove_nodesDict - - set remove_boundaryDict [dict create] - dict set remove_boundaryDict "apply_removal" false - dict set remove_boundaryDict "on_distance" false - dict set remove_boundaryDict "on_threshold" false - dict set remove_boundaryDict "on_error" false - dict set refining_parametersDict remove_boundary $remove_boundaryDict - - set refine_elementsDict [dict create] - dict set refine_elementsDict "apply_refinement" true - dict set refine_elementsDict "on_distance" true - dict set refine_elementsDict "on_threshold" false - dict set refine_elementsDict "on_error" false - dict set refining_parametersDict refine_elements $refine_elementsDict - - set refine_boundaryDict [dict create] - dict set refine_boundaryDict "apply_refinement" false - dict set refine_boundaryDict "on_distance" false - dict set refine_boundaryDict "on_threshold" false - dict set refine_boundaryDict "on_error" false - dict set refining_parametersDict refine_boundary $refine_boundaryDict - - set refining_boxDict [dict create] - dict set refining_boxDict "refine_in_box_only" false - set upX [expr 0.0]; set upY [expr 0.0]; set upZ [expr 0.0] - dict set refining_boxDict "upper_point" [list $upX $upY $upZ] - set lpX [expr 0.0]; set lpY [expr 0.0]; set lpZ [expr 0.0] - dict set refining_boxDict "lower_point" [list $lpX $lpY $lpZ] - set vlX [expr 0.0]; set vlY [expr 0.0]; set vlZ [expr 0.0] - dict set refining_boxDict "velocity" [list $vlX $vlY $vlZ] - dict set refining_parametersDict refining_box $refining_boxDict - - dict set bodyDict refining_parameters $refining_parametersDict - - dict set bodyDict "elemental_variables_to_transfer" [list "CAUCHY_STRESS_VECTOR" "DEFORMATION_GRADIENT"] - lappend meshing_domains_list $bodyDict - } - } - dict set paramsDict meshing_domains $meshing_domains_list - dict set resultDict Parameters $paramsDict - return $resultDict -} - -proc Pfem::write::GetRemeshProperty { body_name property } { - set ret "" - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute "PFEM_Bodies"]/blockdata" - set remesh_name "" - foreach body_node [$root selectNodes $xp1] { - if {[$body_node @name] eq $body_name} { - set remesh_name [get_domnode_attribute [$body_node selectNodes ".//value\[@n='MeshingStrategy'\]"] v] - break - } - } - if {$remesh_name ne ""} { - variable remesh_domains_dict - if {[dict exists $remesh_domains_dict ${remesh_name} $property]} { - set ret [dict get $remesh_domains_dict ${remesh_name} $property] - } - } - if {$ret eq ""} {set ret false} - return $ret -} - - -proc Pfem::write::ProcessBodiesList { } { - customlib::UpdateDocument - set bodiesList [list ] - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute "PFEM_Bodies"]/blockdata" - foreach body_node [$root selectNodes $xp1] { - set body [dict create] - set name [$body_node @name] - set body_type_path ".//value\[@n='BodyType'\]" - set body_type [get_domnode_attribute [$body_node selectNodes $body_type_path] v] - set parts [list ] - foreach part_node [$body_node selectNodes "./container\[@n = 'Groups'\]/blockdata\[@n='Group'\]"] { - lappend parts [write::getSubModelPartId "Parts" [$part_node @name]] - } - dict set body "body_type" $body_type - dict set body "body_name" $name - dict set body "parts_list" $parts - lappend bodiesList $body - } - return $bodiesList -} - -proc Pfem::write::GetNodalDataDict { } { - set root [customlib::GetBaseRoot] - set NodalData [list ] - set parts [list "PFEM_Rigid2DParts" "PFEM_Rigid3DParts" "PFEM_Deformable2DParts" "PFEM_Deformable3DParts" "PFEM_Fluid2DParts" "PFEM_Fluid3DParts"] - - foreach part $parts { - set xp1 "[spdAux::getRoute $part]/group" - set groups [$root selectNodes $xp1] - foreach group $groups { - set partid [[$group parent] @n] - set groupid [$group @n] - set processDict [dict create] - dict set processDict process_name "ApplyValuesToNodes" - dict set processDict kratos_module "KratosMultiphysics.PfemApplication" - - set params [dict create] - set xp2 "./value" - set atts [$group selectNodes $xp2] - #W "$group $groupid $atts" - foreach att $atts { - set state [get_domnode_attribute $att state] - if {$state ne "hidden"} { - set paramName [$att @n] - set paramValue [get_domnode_attribute $att v] - if {$paramName eq "Material"} { - set matdict [::write::getAllMaterialParametersDict $paramValue] - dict set matdict Name $paramValue - dict set params $paramName $matdict - } { - if {[write::isBoolean $paramValue]} {set paramValue [expr $paramValue]} - dict set params $paramName $paramValue - } - } - } - dict set params "model_part_name" [::write::getSubModelPartId $partid $groupid] - dict set processDict "Parameters" $params - lappend NodalData $processDict - } - } - - return $NodalData -} - -proc Pfem::write::ProcessRemeshDomainsDict { } { - customlib::UpdateDocument - set domains_dict [dict create ] - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute "PFEM_meshing_domains"]/blockdata" - foreach domain_node [$root selectNodes $xp1] { - set name [$domain_node @name] - foreach part_node [$domain_node selectNodes "./value"] { - dict set domains_dict $name [get_domnode_attribute $part_node n] [get_domnode_attribute $part_node v] - } - } - return $domains_dict -} - -proc Pfem::write::CalculateMyVariables { } { - variable bodies_list - set bodies_list [Pfem::write::ProcessBodiesList] - variable remesh_domains_dict - set remesh_domains_dict [Pfem::write::ProcessRemeshDomainsDict] -} - - - -proc Pfem::write::getBodyConditionsParametersDict {un {condition_type "Condition"}} { - set root [customlib::GetBaseRoot] - return [list ] - set bcCondsDict [list ] - - set xp1 "[spdAux::getRoute $un]/container/blockdata" - set blocks [$root selectNodes $xp1] - - foreach block $blocks { - set groupName [$block @name] - set cid [[$block parent] @n] - get_domnode_attribute [$block find n Body] values - set bodyId [get_domnode_attribute [$block find n Body] v] - - if {$condition_type eq "Condition"} { - error [= "Body conditions (not nodal) Not implemented yet."] - #set condition [::Model::getCondition $cid] - } { - set condition [Pfem::xml::getBodyNodalConditionById $cid] - } - set processName [$condition getProcessName] - #set processName [[$block parent] @processname] - - set process [::Model::GetProcess $processName] - set processDict [dict create] - set paramDict [dict create] - dict set paramDict model_part_name $bodyId - set vatiable_name [$condition getAttribute VariableName] - dict set paramDict variable_name [lindex $vatiable_name 0] - - set process_attributes [$process getAttributes] - set process_parameters [$process getInputs] - - dict set process_attributes process_name [dict get $process_attributes n] - dict unset process_attributes n - dict unset process_attributes pn - - set processDict [dict merge $processDict $process_attributes] - - foreach {inputName in_obj} $process_parameters { - set in_type [$in_obj getType] - if {$in_type eq "vector"} { - if {[$in_obj getAttribute vectorType] eq "bool"} { - set ValX [expr [get_domnode_attribute [$block find n ${inputName}X] v] ? True : False] - set ValY [expr [get_domnode_attribute [$block find n ${inputName}Y] v] ? True : False] - set ValZ [expr False] - if {[$block find n ${inputName}Z] ne ""} {set ValZ [expr [get_domnode_attribute [$block find n ${inputName}Z] v] ? True : False]} - dict set paramDict $inputName [list $ValX $ValY $ValZ] - } { - if {[$in_obj getAttribute "enabled"] in [list "1" "0"]} { - foreach i [list "X" "Y" "Z"] { - if {[expr [get_domnode_attribute [$block find n Enabled_$i] v] ] ne "Yes"} { - set Val$i null - } else { - set printed 0 - if {[$in_obj getAttribute "function"] eq "1"} { - if {[get_domnode_attribute [$block find n "ByFunction$i"] v] eq "Yes"} { - set funcinputName "${i}function_$inputName" - set value [get_domnode_attribute [$block find n $funcinputName] v] - set Val$i $value - set printed 1 - } - } - if {!$printed} { - set value [expr [get_domnode_attribute [$block find n ${inputName}$i] v] ] - set Val$i $value - } - } - } - } else { - set ValX [expr [gid_groups_conds::convert_value_to_default [$block find n ${inputName}X]] ] - set ValY [expr [gid_groups_conds::convert_value_to_default [$block find n ${inputName}Y]] ] - set ValZ [expr 0.0] - if {[$block find n ${inputName}Z] ne ""} {set ValZ [expr [gid_groups_conds::convert_value_to_default [$block find n ${inputName}Z]]]} - } - dict set paramDict $inputName [list $ValX $ValY $ValZ] - } - } elseif {$in_type eq "double" || $in_type eq "integer"} { - set printed 0 - if {[$in_obj getAttribute "function"] eq "1"} { - if {[get_domnode_attribute [$block find n "ByFunction"] v] eq "Yes"} { - set funcinputName "function_$inputName" - set value [get_domnode_attribute [$block find n $funcinputName] v] - dict set paramDict $inputName $value - set printed 1 - } - } - if {!$printed} { - set value [gid_groups_conds::convert_value_to_default [$block find n $inputName]] - dict set paramDict $inputName [expr $value] - } - } elseif {$in_type eq "bool"} { - set value [get_domnode_attribute [$block find n $inputName] v] - set value [expr $value ? True : False] - dict set paramDict $inputName [expr $value] - } elseif {$in_type eq "tablefile"} { - set value [get_domnode_attribute [$block find n $inputName] v] - dict set paramDict $inputName $value - } else { - if {[get_domnode_attribute [$block find n $inputName] state] ne "hidden" } { - set value [get_domnode_attribute [$block find n $inputName] v] - dict set paramDict $inputName $value - } - } - } - if {[$block find n Interval] ne ""} {dict set paramDict interval [write::getInterval [get_domnode_attribute [$block find n Interval] v]] } - dict set processDict Parameters $paramDict - lappend bcCondsDict $processDict - } - return $bcCondsDict -} - -proc Pfem::write::DofsInElements { } { - set dofs [list ] - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/group/value\[@n='Element'\]" - set elements [$root selectNodes $xp1] - foreach element_node $elements { - set elemid [$element_node @v] - set elem [Model::getElement $elemid] - foreach dof [split [$elem getAttribute "Dofs"] ","] { - foreach item $dof { - if {$item ni $dofs} { - lappend dofs $item - } - } - } - } - return $dofs -} diff --git a/kratos.gid/apps/Pfem/xml/Bodies.spd b/kratos.gid/apps/Pfem/xml/Bodies.spd deleted file mode 100644 index 161f9ea41..000000000 --- a/kratos.gid/apps/Pfem/xml/Bodies.spd +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/kratos.gid/apps/Pfem/xml/BodiesWindowController.tcl b/kratos.gid/apps/Pfem/xml/BodiesWindowController.tcl deleted file mode 100644 index 701b62f51..000000000 --- a/kratos.gid/apps/Pfem/xml/BodiesWindowController.tcl +++ /dev/null @@ -1,292 +0,0 @@ -namespace eval ::Pfem::xml::BodiesWindow { - variable window - variable list_of_bodies - variable description_frame - - variable name_entry - variable type_combo - variable mesh_combo - variable cont_combo - - variable current_body - variable current_part - - variable list_of_parts - variable part_frame - variable part_combo - variable part_description_frame -} - -proc Pfem::xml::BodiesWindow::Init { } { - variable window - set window ".gid.bodieswindow" -} - -proc Pfem::xml::BodiesWindow::Start { } { - variable window - variable part_frame - variable description_frame - variable name_entry - variable type_combo - variable mesh_combo - variable cont_combo - variable part_description_frame - - # 1 - Create Window - if {[winfo exists $window]} {destroy $window} - toplevel $window -class Toplevel -relief groove - #wm maxsize $w 500 300 - wm minsize $window 500 300 - wm overrideredirect $window 0 - wm resizable $window 1 1 - wm deiconify $window - wm title $window [= "Body create/edit window"] - wm attribute $window -topmost 1 - - # 2 - Top frame - window content - set topframe [ttk::frame $window.topframe] - - # 3 - Left panel - Bodies frame - set bodyframe [ttk::frame $topframe.bodyframe] - - # 4 - Top labelframe - List of bodies container - set listbodieslabel [ttk::labelframe $bodyframe.lflist -text "Bodies"] - - # 5 - List of bodies - set bodies_list [listbox $listbodieslabel.list -listvariable Pfem::xml::BodiesWindow::list_of_bodies] - grid $bodies_list -sticky nswe - grid $listbodieslabel -sticky nswe - # 5 - Body description - set description_frame [ttk::frame $listbodieslabel.description] - # 6 - Name entry - set namelabel [ttk::label $description_frame.namelabel -text "Name"] - set nameentry [ttk::entry $description_frame.nameentry -textvariable ::Pfem::xml::BodiesWindow::name_entry] - grid $namelabel $nameentry -sticky nswe - # 6 - Body type combo - set type_values [list Fluid Solid Rigid] - set typelabel [ttk::label $description_frame.typelabel -text "Type"] - set typecombo [ttk::combobox $description_frame.typecombo -values $type_values -textvariable ::Pfem::xml::BodiesWindow::type_combo -state readonly] - grid $typelabel $typecombo -sticky nswe - # 6 - Remesh combo - set remesh_values [list "No remesh" "Remesh and refine"] - set remeshlabel [ttk::label $description_frame.remeshlabel -text "Remesh"] - set remeshcombo [ttk::combobox $description_frame.remeshcombo -values $remesh_values -textvariable ::Pfem::xml::BodiesWindow::mesh_combo -state readonly] - grid $remeshlabel $remeshcombo -sticky nswe - # 6 - Contact combo - set contact_values [list Yes No] - set contactlabel [ttk::label $description_frame.contactlabel -text "Contact"] - set contactcombo [ttk::combobox $description_frame.contactcombo -values $contact_values -textvariable ::Pfem::xml::BodiesWindow::cont_combo -state readonly] - grid $contactlabel $contactcombo -sticky nswe - - # 6 - Bottom frame - ok / cancel buttons - set botframe [ttk::frame $description_frame.botframe] - ttk::button $botframe.cancel -text Close -command [list Pfem::xml::BodiesWindow::InitialState] -style BottomFrame.TButton - ttk::button $botframe.ok -text Ok -command [list Pfem::xml::BodiesWindow::SaveBody] -style BottomFrame.TButton - grid $botframe.ok $botframe.cancel -sticky sew - grid $botframe -sticky swe -columnspan 2 - - # 5 - Bottom frame - Add, delete, draw buttons - set bodybotframe [ttk::frame $listbodieslabel.bodybotframe] - set but_add [ttk::button $bodybotframe.add -text +Add -command [list Pfem::xml::BodiesWindow::AddBody] -style BottomFrame.TButton] - set but_del [ttk::button $bodybotframe.del -text -Del -command [list Pfem::xml::BodiesWindow::DelBody] -style BottomFrame.TButton] - set but_dra [ttk::button $bodybotframe.drw -text Draw -command [list Pfem::xml::BodiesWindow::DrawBody] -style BottomFrame.TButton] - grid $but_add $but_del $but_dra -sticky sew - grid $bodybotframe -sticky swe - - grid $bodyframe -sticky nswe -row 0 -column 0 - - # 3 - Right panel - Parts frame - set part_frame [ttk::frame $topframe.partframe] - - # 4 - Top labelframe - List of parts container - set listpartslabel [ttk::labelframe $part_frame.lflist -text "Parts"] - - # 5 - List of parts - set parts_list [listbox $listpartslabel.list -listvariable Pfem::xml::BodiesWindow::list_of_parts] - grid $parts_list -sticky nswe - grid $listpartslabel -sticky nswe - # 5 - Part description - set part_description_frame [ttk::frame $listpartslabel.description] - # 6 - Part selector combo - # TODO: get available only - no repeat - just the type - set part_values [Pfem::xml::GetPartsGroups] - set part_label [ttk::label $part_description_frame.partlabel -text "Part name"] - set partcombo [ttk::combobox $part_description_frame.partcombo -textvariable Pfem::xml::BodiesWindow::part_combo -values $part_values -state readonly] - grid $part_label $partcombo -sticky nswe - - # 6 - Bottom frame - ok / cancel buttons - set botframe [ttk::frame $part_description_frame.botframe] - ttk::button $botframe.cancel -text Close -command [list Pfem::xml::BodiesWindow::InitialState] -style BottomFrame.TButton - ttk::button $botframe.ok -text Ok -command [list Pfem::xml::BodiesWindow::AcceptPartAdd] -style BottomFrame.TButton - grid $botframe.ok $botframe.cancel -sticky sew - grid $botframe -sticky swe -columnspan 2 - - # 5 - Bottom frame - Add, delete, draw buttons - set bodybotframe [ttk::frame $listpartslabel.bodybotframe] - set but_add [ttk::button $bodybotframe.add -text +Add -command [list Pfem::xml::BodiesWindow::AddPart] -style BottomFrame.TButton] - set but_del [ttk::button $bodybotframe.del -text -Del -command [list Pfem::xml::BodiesWindow::DelPart] -style BottomFrame.TButton] - set but_dra [ttk::button $bodybotframe.drw -text Draw -command [list Pfem::xml::BodiesWindow::DrawPart] -style BottomFrame.TButton] - grid $but_add $but_del $but_dra -sticky sew - grid $bodybotframe -sticky swe - - grid $topframe -sticky nswe - - bind $bodies_list <> [list Pfem::xml::BodiesWindow::BodySelection %W] - bind $parts_list <> [list Pfem::xml::BodiesWindow::PartSelected %W] - - Pfem::xml::BodiesWindow::InitialState -} - -proc Pfem::xml::BodiesWindow::InitialState { } { - # 1 - Fill with data - variable list_of_bodies - set list_of_bodies [list ] - foreach body [Pfem::xml::GetBodiesInformation] { - lappend list_of_bodies [dict get $body name] - } - - # 2 - Hide lateral panel - variable part_frame - grid forget $part_frame - variable description_frame - grid forget $description_frame - variable part_description_frame - grid forget $part_description_frame -} - -proc Pfem::xml::BodiesWindow::SaveBody { } { - variable current_body - set body_name_old [dict get [lindex [Pfem::xml::GetBodiesInformation] $current_body] name] - - set body_name $::Pfem::xml::BodiesWindow::name_entry - set body_type $::Pfem::xml::BodiesWindow::type_combo - set body_mesh $::Pfem::xml::BodiesWindow::mesh_combo - set body_cont $::Pfem::xml::BodiesWindow::cont_combo - - Pfem::xml::UpdateBody $body_name_old $body_name $body_type $body_mesh $body_cont - spdAux::RequestRefresh - Pfem::xml::BodiesWindow::InitialState - Pfem::xml::BodiesWindow::BodySelected $current_body -} - -proc Pfem::xml::BodiesWindow::BodySelection { w } { - set selected [$w curselection] - if {$selected ne ""} { - Pfem::xml::BodiesWindow::BodySelected $selected - } -} -proc Pfem::xml::BodiesWindow::BodySelected { body_id } { - variable description_frame - variable name_entry - variable type_combo - variable mesh_combo - variable cont_combo - - variable part_frame - variable list_of_parts - - variable current_body - variable current_part - - set current_body $body_id - # Get data from tree - set data [lindex [Pfem::xml::GetBodiesInformation] $body_id] - - # Fill data in description frame - set name_entry [dict get $data name] - set type_combo [dict get $data type] - set mesh_combo [dict get $data mesh] - set cont_combo [dict get $data cont] - - # Show description frame - grid $description_frame -sticky swe - - # Fill data in Parts panel - set list_of_parts [dict get $data parts] - - # Show parts panel - grid $part_frame -sticky nswe -row 0 -column 1 - -} -proc Pfem::xml::BodiesWindow::PartSelected { w } { - variable part_description_frame - variable current_body - variable current_part - - set selected [$w curselection] - if {$selected ne ""} { - set current_part $selected - } -} - -proc Pfem::xml::BodiesWindow::AddBody { } { - Pfem::xml::AddNewBodyRaw - spdAux::RequestRefresh - Pfem::xml::BodiesWindow::InitialState -} -proc Pfem::xml::BodiesWindow::AddPart { } { - # Show the adding part frame - variable part_description_frame - grid $part_description_frame -sticky swe -} - -proc Pfem::xml::BodiesWindow::AcceptPartAdd { } { - variable current_body - set body_name [dict get [lindex [Pfem::xml::GetBodiesInformation] $current_body] name] - set part_name $Pfem::xml::BodiesWindow::part_combo - if {$part_name in [GiD_Groups list]} { - Pfem::xml::AddPartToBody $body_name $part_name - spdAux::RequestRefresh - Pfem::xml::BodiesWindow::InitialState - Pfem::xml::BodiesWindow::BodySelected $current_body - } -} - -proc Pfem::xml::BodiesWindow::DelBody { } { - variable current_body - - if {$current_body ne ""} { - Pfem::xml::DeleteBody [dict get [lindex [Pfem::xml::GetBodiesInformation] $current_body] name] - } - spdAux::RequestRefresh - Pfem::xml::BodiesWindow::InitialState -} -proc Pfem::xml::BodiesWindow::DelPart { } { - variable current_body - variable current_part - if {$current_body ne "" && $current_part ne ""} { - set body_name [dict get [lindex [Pfem::xml::GetBodiesInformation] $current_body] name] - set part_name [lindex [dict get [lindex [Pfem::xml::GetBodiesInformation] $current_body] parts] $current_part] - Pfem::xml::DeletePartInBody $body_name $part_name - } - spdAux::RequestRefresh - Pfem::xml::BodiesWindow::InitialState - Pfem::xml::BodiesWindow::BodySelected $current_body -} - -proc Pfem::xml::BodiesWindow::DrawBody { } { - variable current_body - - set names [dict get [lindex [Pfem::xml::GetBodiesInformation] $current_body] parts] - Pfem::xml::BodiesWindow::TryEndDraw - GiD_Groups draw $names - GiD_Process 'Redraw - after 5000 { Pfem::xml::BodiesWindow::TryEndDraw } -} -proc Pfem::xml::BodiesWindow::DrawPart { } { - variable current_part - variable current_body - - set name [lindex [dict get [lindex [Pfem::xml::GetBodiesInformation] $current_body] parts] $current_part] - Pfem::xml::BodiesWindow::TryEndDraw - GiD_Groups draw [list $name] - GiD_Process 'Redraw - after 5000 { Pfem::xml::BodiesWindow::TryEndDraw } -} - -proc Pfem::xml::BodiesWindow::TryEndDraw { } { - catch {GiD_Groups end_draw} - GiD_Process 'Redraw -} - -Pfem::xml::BodiesWindow::Init \ No newline at end of file diff --git a/kratos.gid/apps/Pfem/xml/ConstitutiveLaws.xml b/kratos.gid/apps/Pfem/xml/ConstitutiveLaws.xml deleted file mode 100644 index a6db6fed8..000000000 --- a/kratos.gid/apps/Pfem/xml/ConstitutiveLaws.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Contact.spd b/kratos.gid/apps/Pfem/xml/Contact.spd deleted file mode 100644 index 9f41802ac..000000000 --- a/kratos.gid/apps/Pfem/xml/Contact.spd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Elements.xml b/kratos.gid/apps/Pfem/xml/Elements.xml deleted file mode 100644 index d0505ec01..000000000 --- a/kratos.gid/apps/Pfem/xml/Elements.xml +++ /dev/null @@ -1,516 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Main.spd b/kratos.gid/apps/Pfem/xml/Main.spd deleted file mode 100644 index 491ffb850..000000000 --- a/kratos.gid/apps/Pfem/xml/Main.spd +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Materials.spd b/kratos.gid/apps/Pfem/xml/Materials.spd deleted file mode 100644 index e8e63b2bd..000000000 --- a/kratos.gid/apps/Pfem/xml/Materials.spd +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/kratos.gid/apps/Pfem/xml/Materials.xml b/kratos.gid/apps/Pfem/xml/Materials.xml deleted file mode 100644 index d4d08add1..000000000 --- a/kratos.gid/apps/Pfem/xml/Materials.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Meshing.spd b/kratos.gid/apps/Pfem/xml/Meshing.spd deleted file mode 100644 index a378506f7..000000000 --- a/kratos.gid/apps/Pfem/xml/Meshing.spd +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/ModelType.spd b/kratos.gid/apps/Pfem/xml/ModelType.spd deleted file mode 100644 index ca2588692..000000000 --- a/kratos.gid/apps/Pfem/xml/ModelType.spd +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/NodalConditions.spd b/kratos.gid/apps/Pfem/xml/NodalConditions.spd deleted file mode 100644 index 190d187be..000000000 --- a/kratos.gid/apps/Pfem/xml/NodalConditions.spd +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/NodalConditions.xml b/kratos.gid/apps/Pfem/xml/NodalConditions.xml deleted file mode 100644 index a2f243a3a..000000000 --- a/kratos.gid/apps/Pfem/xml/NodalConditions.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/kratos.gid/apps/Pfem/xml/Parts.spd b/kratos.gid/apps/Pfem/xml/Parts.spd deleted file mode 100644 index 0373e31e1..000000000 --- a/kratos.gid/apps/Pfem/xml/Parts.spd +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Processes.xml b/kratos.gid/apps/Pfem/xml/Processes.xml deleted file mode 100644 index b5256e055..000000000 --- a/kratos.gid/apps/Pfem/xml/Processes.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Procs.spd b/kratos.gid/apps/Pfem/xml/Procs.spd deleted file mode 100644 index 741143407..000000000 --- a/kratos.gid/apps/Pfem/xml/Procs.spd +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Results.spd b/kratos.gid/apps/Pfem/xml/Results.spd deleted file mode 100644 index 0f9c8eee8..000000000 --- a/kratos.gid/apps/Pfem/xml/Results.spd +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Solution.spd b/kratos.gid/apps/Pfem/xml/Solution.spd deleted file mode 100644 index 75f15cb59..000000000 --- a/kratos.gid/apps/Pfem/xml/Solution.spd +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Solvers.xml b/kratos.gid/apps/Pfem/xml/Solvers.xml deleted file mode 100644 index e75f934de..000000000 --- a/kratos.gid/apps/Pfem/xml/Solvers.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/Strategies.xml b/kratos.gid/apps/Pfem/xml/Strategies.xml deleted file mode 100644 index 2416526b0..000000000 --- a/kratos.gid/apps/Pfem/xml/Strategies.xml +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Pfem/xml/XmlController.tcl b/kratos.gid/apps/Pfem/xml/XmlController.tcl deleted file mode 100644 index a13b8da90..000000000 --- a/kratos.gid/apps/Pfem/xml/XmlController.tcl +++ /dev/null @@ -1,723 +0,0 @@ -namespace eval Pfem::xml { - variable dir - variable bodyNodalCondition - variable body_UN - variable Elements -} - -proc Pfem::xml::Init { } { - variable bodyNodalCondition - set bodyNodalCondition [list ] - - variable body_UN - set body_UN "PFEM_Bodies" - - variable dir - Model::InitVariables dir $Pfem::dir - - Model::getSolutionStrategies Strategies.xml - Model::getElements Elements.xml - Model::getConstitutiveLaws "../../Pfem/xml/ConstitutiveLaws.xml" - Model::getConstitutiveLaws "../../Solid/xml/ConstitutiveLaws.xml" - Model::getProcesses "../../Solid/xml/Processes.xml" - Model::getProcesses "../../Common/xml/Processes.xml" - Model::getProcesses Processes.xml - Model::getNodalConditions NodalConditions.xml - Model::getNodalConditions "../../Solid/xml/NodalConditions.xml" - Model::getMaterials Materials.xml - Model::getConditions "../../Solid/xml/Conditions.xml" - Model::getSolvers "../../Pfem/xml/Solvers.xml" - - Model::ForgetNodalCondition "CONTACT" -} - -proc Pfem::xml::getUniqueName {name} { - return PFEM_$name -} - -proc Pfem::xml::MultiAppEvent {args} { - if {$args eq "init"} { - spdAux::parseRoutes - spdAux::ConvertAllUniqueNames SL PFEM_ - } -} - -proc Pfem::xml::CustomTree { args } { - - #HOW TO USE THIS FUNCTION: - #spdAux::SetValueOnTreeItem arg1 arg2 arg3 (arg4) - #arg1: attribute_to_modify - #arg2: value_of_the_attribute - #arg3: unique_name_of_the_node ('unique name is defined by the attribute un=) - #arg4 (optional): name_of_the_child_we_want_to_modify ('name'is defined by the attribute n=) - - #set icon data as default - foreach node [[customlib::GetBaseRoot] getElementsByTagName value ] { $node setAttribute icon data } - - #problem settings - foreach node [[customlib::GetBaseRoot] getElementsByTagName container ] { if {[$node hasAttribute solstratname]} {$node setAttribute icon folder } } - #TODO: (for JG) the previous icons should be changed automatically looking at the strategies.xml - - - #intervals - spdAux::SetValueOnTreeItem icon timeIntervals Intervals - foreach node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute Intervals]/blockdata"] { - $node setAttribute icon select - } - - #conditions - #spdAux::SetValueOnTreeItem state \[CheckNodalConditionStatePFEM\] PFEM_NodalConditions VELOCITY - #spdAux::SetValueOnTreeItem state \[CheckNodalConditionStatePFEM\] PFEM_NodalConditions PRESSURE - - foreach node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute PFEM_NodalConditions]/condition" ] { - $node setAttribute icon select - $node setAttribute groups_icon groupCreated - } - - #loads - spdAux::SetValueOnTreeItem icon setLoad PFEM_Loads - foreach node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute PFEM_Loads]/condition" ] { - $node setAttribute icon select - $node setAttribute groups_icon groupCreated - } - - #materials - foreach node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute PFEM_Materials]/blockdata" ] { - $node setAttribute icon select - } - - #solver settings - foreach node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute PFEM_Solution]/container\[@n = 'linear_solver_settings'\]" ] { - $node setAttribute icon solvers - } - - foreach node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute PFEM_Solution]/container\[@n = 'velocity_linear_solver_settings'\]" ] { - $node setAttribute icon solvers - } - - foreach node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute PFEM_Solution]/container\[@n = 'pressure_linear_solver_settings'\]" ] { - $node setAttribute icon solvers - } - - - #units - [[customlib::GetBaseRoot] selectNodes "/Kratos_data/blockdata\[@n = 'units'\]"] setAttribute icon setUnits - - #results - set problemtype [write::getValue PFEM_DomainType] - if {$problemtype eq "Fluid"} { - spdAux::SetValueOnTreeItem v Yes NodalResults VELOCITY - spdAux::SetValueOnTreeItem v Yes NodalResults PRESSURE - spdAux::SetValueOnTreeItem v No NodalResults DISPLACEMENT - } - spdAux::SetValueOnTreeItem v No NodalResults VELOCITY_REACTION - - foreach result [list INLET SPRING_2D BALLAST_2D AXIAL_TURN_2D AXIAL_VELOCITY_TURN_2D AXIAL_ACCELERATION_TURN_2D SPRING_3D BALLAST_3D AXIAL_TURN_3D AXIAL_VELOCITY_TURN_3D AXIAL_ACCELERATION_TURN_3D] { - set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = '$result'\]"] - if { $result_node ne "" } {$result_node delete} - } - - #restart - spdAux::SetValueOnTreeItem icon doRestart Restart - spdAux::SetValueOnTreeItem icon select Restart RestartOptions - - -} - -proc Pfem::xml::ProcCheckNodalConditionStatePFEM {domNode args} { - set domain_type [write::getValue PFEM_DomainType] - set fluid_exclusive_conditions [list "VELOCITY" "INLET" "PRESSURE"] - set current_condition [$domNode @n] - if {$domain_type eq "Fluid"} { - if {$current_condition ni $fluid_exclusive_conditions} { - return hidden - } - } elseif {$domain_type eq "Solid"} { - if {$current_condition eq "INLET"} { - return hidden - } - } - return [Pfem::xml::ProcCheckNodalConditionStateSolid $domNode {*}$args] -} - -proc Pfem::xml::CheckElementOutputState { domNode args } { - set elemsactive [list ] - set parts_path [spdAux::getRoute [Pfem::write::GetAttribute parts_un]] - set xp1 "$parts_path/group/value\[@n='Element'\]" - foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { - lappend elemsactive [get_domnode_attribute $gNode v] - } - - set paramName [$domNode @n] - return [::Model::CheckElementOutputState $elemsactive $paramName] -} - -proc Pfem::xml::ProcGetElements {domNode args} { - set cumplen [list ] - set domain_type_un PFEM_DomainType - set domain_type_route [spdAux::getRoute $domain_type_un] - set equation_type_un PFEM_EquationType - set equation_type_route [spdAux::getRoute $equation_type_un] - - if {$domain_type_route ne ""} { - set domain_type_node [$domNode selectNodes $domain_type_route] - set domain_type_value [get_domnode_attribute $domain_type_node v] - - set equation_type_node [$domNode selectNodes $equation_type_route] - set equation_type_value [get_domnode_attribute $equation_type_node v] - - set filter [list ] - lappend filter "EquationType" $equation_type_value - if {$domain_type_value ne "Coupled"} { - lappend filter "ElementType" $domain_type_value - set cumplen [Model::GetElements $filter] - set filter [list "ElementType" "Rigid"] - lappend filter "EquationType" $equation_type_value - lappend cumplen {*}[Model::GetElements $filter] - } else { - set cumplen [Model::GetElements $filter] - } - } - set names [list ] - set pnames [list ] - foreach elem $cumplen { - lappend names [$elem getName] - lappend pnames [$elem getName] - lappend pnames [$elem getPublicName] - } - set diction [join $pnames ","] - set values [join $names ","] - $domNode setAttribute values $values - if {[get_domnode_attribute $domNode v] eq ""} {$domNode setAttribute v [lindex $names 0]} - if {[get_domnode_attribute $domNode v] ni $names} {$domNode setAttribute v [lindex $names 0]; spdAux::RequestRefresh} - - return $diction -} - -proc Pfem::xml::FindMyBlocknode {domNode} { - set top 10 - set ret "" - for {set i 0} {$i < $top} {incr i} { - if {[$domNode nodeName] eq "blockdata"} { - set ret $domNode - break - } else { - set domNode [$domNode parent] - } - } - return $ret -} - -proc Pfem::xml::ProcGetMeshingDomains {domNode args} { - set basepath [spdAux::getRoute "PFEM_meshing_domains"] - set values [list ] - foreach meshing_domain [[$domNode selectNodes $basepath] childNodes] { - lappend values [get_domnode_attribute $meshing_domain name] - } - if {[get_domnode_attribute $domNode v] eq "" || [get_domnode_attribute $domNode v] ni $values} { - $domNode setAttribute v [lindex $values 0] - } - return [join $values ,] -} - -proc Pfem::xml::ProcGetContactDomains {domNode args} { - set basepath [spdAux::getRoute "PFEM_contacts"] - set values [list "No contact strategy"] - foreach contact_domain [[$domNode selectNodes $basepath] childNodes] { - lappend values [get_domnode_attribute $contact_domain name] - } - - if {[get_domnode_attribute $domNode v] eq "" || [get_domnode_attribute $domNode v] ni $values} { - $domNode setAttribute v [lindex $values 0] - } - return [join $values ,] -} - -proc Pfem::xml::ProcCheckNodalConditionStateSolid {domNode args} { - # Overwritten the base function to add Solution Type restrictions - set elemsactive [list ] - set parts_path [spdAux::getRoute [Pfem::write::GetAttribute parts_un]] - set xp1 "$parts_path/group/value\[@n='Element'\]" - foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { - lappend elemsactive [get_domnode_attribute $gNode v] - } - if {$elemsactive eq ""} {return "hidden"} - set elemsactive [lsort -unique $elemsactive] - set conditionId [$domNode @n] - set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute PFEM_SolutionType]] v] - set params [list analysis_type $solutionType] - if {[::Model::CheckElementsNodalCondition $conditionId $elemsactive $params]} {return "normal"} else {return "hidden"} -} - - - -proc Pfem::xml::ProcSolutionTypeState {domNode args} { - set domain_type_un PFEM_DomainType - set domain_type_route [spdAux::getRoute $domain_type_un] - set state normal - if {$domain_type_route ne ""} { - set domain_type_node [$domNode selectNodes $domain_type_route] - set domain_type_value [get_domnode_attribute $domain_type_node v] - - if {$domain_type_value ne "Solid"} { - $domNode setAttribute values Dynamic - $domNode setAttribute v Dynamic - set state disabled - } { - $domNode setAttribute values "Static,Quasi-static,Dynamic" - set state normal - } - } - return $state -} - -proc Pfem::xml::ProcEquationTypeState {domNode args} { - set domain_type_un PFEM_DomainType - set domain_type_route [spdAux::getRoute $domain_type_un] - set state normal - if {$domain_type_route ne ""} { - set domain_type_node [$domNode selectNodes $domain_type_route] - set domain_type_value [get_domnode_attribute $domain_type_node v] - - if {$domain_type_value ne "Solid"} { - $domNode setAttribute values Segregated - $domNode setAttribute v Segregated - set state disabled - } elseif {$domain_type_value eq "Solid"} { - $domNode setAttribute values Monolithic - $domNode setAttribute v Monolithic - set state disabled - } else { - $domNode setAttribute values "Monolithic,Segregated" - set state normal - } - } - return $state -} - -proc Pfem::xml::ProcStrategyTypeState {domNode args} { - set domain_type_un PFEM_DomainType - set domain_type_route [spdAux::getRoute $domain_type_un] - set state normal - if {$domain_type_route ne ""} { - set domain_type_node [$domNode selectNodes $domain_type_route] - set domain_type_value [get_domnode_attribute $domain_type_node v] - - if {$domain_type_value ne "Solid"} { - $domNode setAttribute values Implicit - $domNode setAttribute v Implicit - set state disabled - } { - set solution_type_un PFEM_SolutionType - set solution_type_route [spdAux::getRoute $solution_type_un] - set state normal - if {$solution_type_route ne ""} { - set solution_type_node [$domNode selectNodes $solution_type_route] - set solution_type_value [get_domnode_attribute $solution_type_node v] - if {$solution_type_value eq "Static"} { - $domNode setAttribute values Static - $domNode setAttribute v Static - set state disabled - } elseif {$solution_type_value eq "Quasi-static"} { - $domNode setAttribute values Quasi-static - $domNode setAttribute v Quasi-static - set state disabled - } - } - } - } - return $state -} - -proc Pfem::xml::ProcGetBodyTypeValues {domNode args} { - set domain_type_un PFEM_DomainType - set domain_type_route [spdAux::getRoute $domain_type_un] - set values [list Fluid Solid Rigid] - if {$domain_type_route ne ""} { - set domain_type_node [$domNode selectNodes $domain_type_route] - set domain_type_value [get_domnode_attribute $domain_type_node v] - - if {$domain_type_value eq "Fluid"} { - set values [list Fluid Rigid] - } - if {$domain_type_value eq "Coupled"} { - set values [list Fluid Solid Rigid] - } - if {$domain_type_value eq "Solid"} { - set values [list Solid Rigid] - } - } - if {[get_domnode_attribute $domNode v] eq "" || [get_domnode_attribute $domNode v] ni $values} { - $domNode setAttribute v [lindex $values 0] - } - gid_groups_conds::check_node_dependencies $domNode - return [join $values ,] -} - -proc Pfem::xml::ProcGetSolutionStrategiesPFEM {domNode args} { - set names "" - set pnames "" - set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute PFEM_SolutionType]] v] - set Sols [::Model::GetSolutionStrategies [list "SolutionType" $solutionType] ] - set ids [list ] - set domainType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute PFEM_DomainType]] v] - set filter [list Solid Pfem] - if {$domainType eq "Solid"} {set filter "Solid"} - if {$domainType eq "Fluid"} {set filter "Pfem"} - if {$domainType eq "Coupled"} {set filter "Pfem"} - - foreach ss $Sols { - if {[$ss getAttribute "App"] in $filter} { - lappend names [$ss getName] - lappend pnames [$ss getName] - lappend pnames [$ss getPublicName] - } - } - - $domNode setAttribute values [join $names ","] - set dv [lindex $names 0] - #W "dv $dv" - if {[$domNode getAttribute v] eq ""} {$domNode setAttribute v $dv; spdAux::RequestRefresh} - if {[$domNode getAttribute v] ni $names} {$domNode setAttribute v $dv; spdAux::RequestRefresh} - - return [join $pnames ","] -} - - -proc Pfem::xml::ProcPartsOverWhat {domNode args} { - set names [list ] - set blockNode [Pfem::xml::FindMyBlocknode $domNode] - set BodyType [get_domnode_attribute [$blockNode selectNodes "value\[@n='BodyType'\]"] v] - if {$BodyType eq "Fluid" || $BodyType eq "Solid"} { - if {$::Model::SpatialDimension eq "3D"} { - return "volume" - } else { - return "surface" - } - } elseif { $BodyType eq "Rigid"} { - if {$::Model::SpatialDimension eq "3D"} { - return "surface,volume" - } else { - return "line,surface" - } - } else { - return "point,line,surface,volume" - } -} - -proc Pfem::xml::ProcActiveIfAnyPartState {domNode args} { - set parts "" - set parts_un "PFEM_Parts" - catch { - set parts [$domNode selectNodes "[spdAux::getRoute $parts_un]/group"] - } - if {$parts ne ""} {return "normal"} else {return "hidden"} -} - -proc Pfem::xml::ProcGetBodiesValues {domNode args} { - customlib::UpdateDocument - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute "PFEM_Bodies"]/blockdata" - set bodies [list ] - foreach body_node [$root selectNodes $xp1] { - lappend bodies [$body_node @name] - } - if {[get_domnode_attribute $domNode v] ni $bodies} {$domNode setAttribute v [lindex $bodies 0]} - return [join $bodies ","] -} - -proc Pfem::xml::ProcGetRigidBodiesValues {domNode args} { - customlib::UpdateDocument - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute "PFEM_Bodies"]/blockdata" - set bodies [list ] - foreach body_node [$root selectNodes $xp1] { - foreach subnode [$body_node childNodes] { - if { [$subnode getAttribute n] eq "BodyType" } { - if { [$subnode getAttribute v] eq "Rigid" } { - lappend bodies [$body_node @name] - break - } - } - } - } - if {[get_domnode_attribute $domNode v] ni $bodies} {$domNode setAttribute v [lindex $bodies 0]} - return [join $bodies ","] -} - -proc Pfem::xml::StartSortingWindow { } { - package require SorterWindow - set data_dict [dict create] - set conds [Pfem::xml::GetConditionsAndGroups PFEM_Loads] - set nodalconds [Pfem::xml::GetConditionsAndGroups PFEM_NodalConditions] - if {[dict size $conds]} {dict set data_dict Loads $conds} - if {[dict size $nodalconds]} {dict set data_dict Constraints $nodalconds} - SorterWindow::SorterWindow $data_dict "Pfem::xml::GetDataFromSortingWindow" -} -proc Pfem::xml::GetDataFromSortingWindow { data_dict } { - W $data_dict -} -proc Pfem::xml::GetConditionsAndGroups { cnd_UN } { - customlib::UpdateDocument - set data_dict [dict create] - set root [customlib::GetBaseRoot] - foreach {cond_type cond_item cond_item_name} {container blockdata name condition group n} { - set xp1 "[spdAux::getRoute $cnd_UN]/$cond_type" - foreach cnd_cont_node [$root selectNodes $xp1] { - set cnd_cont_name [$cnd_cont_node @n] - set xp2 "./$cond_item" - foreach cnd_node [$cnd_cont_node selectNodes $xp2] { - set cnd_name [$cnd_node getAttribute $cond_item_name] - set num 0 - if {[$cnd_node hasAttribute order]} {set num [$cnd_node @order]} - dict set data_dict $cnd_cont_name $cnd_name $num - } - } - } - return $data_dict -} - -proc Pfem::xml::getBodyNodalConditionById { id } { - variable bodyNodalCondition - - foreach cnd $bodyNodalCondition { - if {[$cnd getName] eq $id} { - return $cnd - } - } - return "" -} -proc Pfem::xml::getBodyNodalConditions { filename } { - variable bodyNodalCondition - dom parse [tDOM::xmlReadFile [file join $Pfem::dir xml $filename]] doc - - set NCList [$doc getElementsByTagName NodalConditionItem] - foreach Node $NCList { - lappend bodyNodalCondition [::Model::ParseNodalConditionsNode $Node] - } -} -proc Pfem::xml::injectBodyNodalConditions { basenode args} { - variable bodyNodalCondition - Pfem::xml::_injectCondsToTree $basenode $bodyNodalCondition nodal - $basenode delete -} - - -proc Pfem::xml::_injectCondsToTree {basenode cond_list {cond_type "normal"} } { - set conds [$basenode parent] - set AppUsesIntervals [::Pfem::GetAttribute UseIntervals] - if {$AppUsesIntervals eq ""} {set AppUsesIntervals 0} - - foreach cnd $cond_list { - set n [$cnd getName] - set pn [$cnd getPublicName] - set help [$cnd getHelp] - set units [$cnd getAttribute "units"] - set um [$cnd getAttribute "unit_magnitude"] - set process [::Model::GetProcess [$cnd getProcessName]] - set check [$process getAttribute "check"] - if {$check eq ""} {set check "UpdateTree"} - set state "ConditionState" - if {$cond_type eq "nodal"} { - set state [$cnd getAttribute state] - if {$state eq ""} {set state "CheckNodalConditionState"} - } - set contNode [gid_groups_conds::addF [$conds toXPath] container [list n $n pn ${pn}s help $help]] - set blockNode [gid_groups_conds::addF [$contNode toXPath] blockdata [list n $n pn $pn help $help icon shells16 update_proc $check name "$pn 1" sequence 1 editable_name unique sequence_type non_void_disabled]] - set block_path [$blockNode toXPath] - set inputs [$process getInputs] - foreach {inName in} $inputs { - set pn [$in getPublicName] - set type [$in getType] - set v [$in getDv] - set help [$in getHelp] - set state [$in getAttribute "state"] - if {$state eq ""} {set state "normal"} - foreach key [$cnd getDefaults $inName] { - set $key [$cnd getDefault $inName $key] - } - - set has_units [$in getAttribute "has_units"] - if {$has_units ne ""} { set has_units "units='$units' unit_magnitude='$um'"} - if {$type eq "vector"} { - set vector_type [$in getAttribute "vectorType"] - lassign [split $v ","] v1 v2 v3 - if {$vector_type eq "bool"} { - gid_groups_conds::addF $block_path value [list n ${inName}X wn [concat $n "_X"] pn "X ${pn}" values "1,0"] - gid_groups_conds::addF $block_path value [list n ${inName}Y wn [concat $n "_Y"] pn "Y ${pn}" values "1,0"] - gid_groups_conds::addF $block_path value [list n ${inName}Z wn [concat $n "_Z"] pn "Z ${pn}" values "1,0" state {[CheckDimension 3D]}] - } { - foreach i [list "X" "Y" "Z"] { - set nodev "../value\[@n='${inName}$i'\]" - set zstate "" - if {$i eq "Z"} { set zstate "state {\[CheckDimension 3D\]}"} - if {[$in getAttribute "enabled"] in [list "1" "0"]} { - set val [expr [$in getAttribute "enabled"] ? "Yes" : "No"] - if {$i eq "Z"} { set val "No" } - set valNode [gid_groups_conds::addF $block_path value [list n Enabled_$i pn "$i component" v No values "Yes,No" help "Enables the $i ${inName}" actualize_tree 1 {*}$zstate]] - - gid_groups_conds::addF [$valNode toXPath] dependencies [list value No node $nodev att1 state v1 hidden] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value Yes node $nodev att1 state v1 normal] - if {[$in getAttribute "function"] eq "1"} { - set fname "${i}function_$inName" - set nodef "../value\[@n='$fname'\]" - set nodeb "../value\[@n='ByFunction$i'\]" - gid_groups_conds::addF [$valNode toXPath] dependencies [list value No node $nodef att1 state v1 hidden] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value No node $nodeb att1 state v1 hidden] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value Yes node $nodeb att1 state v1 normal att2 v v2 No] - } - } - if {[$in getAttribute "function"] eq "1"} { - set fname "${i}function_$inName" - set valNode [gid_groups_conds::addF $block_path value [list n ByFunction$i pn "by function -> f(x,y,z,t)" v No values "Yes,No" actualize_tree 1 state hidden]] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value No node $nodev att1 state v1 normal] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value Yes node $nodev att1 state v1 hidden] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value No node $nodef att1 state v1 hidden] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value Yes node $nodef att1 state v1 normal] - gid_groups_conds::addF $block_path value [list n $fname pn "$i function" state hidden] - } - gid_groups_conds::addF $block_path value [list n ${inName}$i wn [concat $n "_$i"] pn "$i ${pn}" v $v1 state hidden] - } - } - - } elseif { $type eq "combo" } { - set values [join [$in getValues] ","] - gid_groups_conds::addF $block_path value [list n $inName pn $pn v $v1 values $values state $state help $help] - } elseif { $type eq "bool" } { - set values "1,0" - gid_groups_conds::addF $block_path value [list n $inName pn $pn v $v1 values $values state $state help $help] - } elseif { $type eq "file" || $type eq "tablefile" } { - gid_groups_conds::addF $block_path value [list n $inName pn $pn v $v1 values {[GetFilesValues]} update_proc AddFile type $type state $state help $help] - } else { - if {[$in getAttribute "function"] eq "1"} { - set fname "function_$inName" - set nodev "../value\[@n='$inName'\]" - set nodef "../value\[@n='$fname'\]" - - set valNode [gid_groups_conds::addF $block_path value [list n ByFunction pn "by function -> f(x,y,z,t)" v No values "Yes,No" actualize_tree 1]] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value No node $nodev att1 state v1 normal] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value Yes node $nodev att1 state v1 hidden] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value No node $nodef att1 state v1 hidden] - gid_groups_conds::addF [$valNode toXPath] dependencies [list value Yes node $nodef att1 state v1 normal] - gid_groups_conds::addF $block_path value [list n $fname pn "Function"] - } - append node "" - gid_groups_conds::addF $block_path value [list n $inName pn $pn v $v units $units unit_magnitude $um help $help] - } - } - - set CondUsesIntervals [$cnd getAttribute "Interval"] - if {$AppUsesIntervals && $CondUsesIntervals ne "False"} { - gid_groups_conds::addF $block_path value [list n Interval pn "Time interval" v $CondUsesIntervals values {[getIntervals]} help $help] - } - gid_groups_conds::addF $block_path value [list n Body pn Body v - values {[GetRigidBodiesValues]} help $help] - } -} - - -proc Pfem::xml::GetPartsGroups { } { - set parts [list ] - set parts_path [spdAux::getRoute "PFEM_Parts"] - # set xp1 "$parts_path/group/value\[@n='Element'\]" - set xp1 "$parts_path/group" - foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { - lappend parts [get_domnode_attribute $gNode n] - } - return $parts -} - -proc Pfem::xml::GetBodiesInformation { } { - variable body_UN - set bodies [list ] - set bodies_path [spdAux::getRoute $body_UN] - foreach body_node [[customlib::GetBaseRoot] selectNodes "$bodies_path/blockdata"] { - set body [dict create] - dict set body name [get_domnode_attribute $body_node name] - dict set body type [get_domnode_attribute [$body_node selectNodes "./value\[@n='BodyType'\]"] v] - dict set body mesh [get_domnode_attribute [$body_node selectNodes "./value\[@n='MeshingStrategy'\]"] v] - dict set body cont [get_domnode_attribute [$body_node selectNodes "./value\[@n='ContactStrategy'\]"] v] - set parts [list ] - foreach gNode [$body_node selectNodes "./container\[@n='Groups'\]/blockdata\[@n='Group'\]"] { - lappend parts [$gNode @name] - } - dict set body parts $parts - lappend bodies $body - } - - return $bodies -} - -proc Pfem::xml::SaveBodiesInformation {data} { - W "Unimplemented method Pfem::xml::SaveBodiesInformation" -} - -proc Pfem::xml::AddNewBodyRaw { } { - variable body_UN - set bodies_path [spdAux::getRoute $body_UN] - - set bodies_name_list [list ] - foreach body [Pfem::xml::GetBodiesInformation] { - lappend bodies_name_list [dict get $body name] - } - set i 0 - while {"Body$i" in $bodies_name_list} {incr i} - set body_name "Body$i" - - set str "" - append str "" - append str "" - append str "" - append str "" - # append str "" - append str "" - append str "" - - [[customlib::GetBaseRoot] selectNodes $bodies_path] appendXML $str - - return $body_name -} - -proc Pfem::xml::DeleteBody {body_name} { - variable body_UN - set bodies_path [spdAux::getRoute $body_UN] - [[customlib::GetBaseRoot] selectNodes "$bodies_path/blockdata\[@name = '$body_name'\]"] delete -} - -proc Pfem::xml::AddPartToBody {body_name part_name} { - variable body_UN - set bodies_path [spdAux::getRoute $body_UN] - # TODO: Check if part exists in parts availables for body - foreach body [Pfem::xml::GetBodiesInformation] { - if {[dict get $body name] eq $body_name} { - if {$part_name ni [dict get $body parts]} { - set str "" - [[customlib::GetBaseRoot] selectNodes "$bodies_path/blockdata\[@name = '$body_name'\]/container\[@n = 'Groups'\]"] appendXML $str - } - } - } -} - -proc Pfem::xml::DeletePartInBody {body_name part_name} { - variable body_UN - set bodies_path [spdAux::getRoute $body_UN] - [[customlib::GetBaseRoot] selectNodes "$bodies_path/blockdata\[@name = '$body_name'\]/container\[@n = 'Groups'\]/blockdata\[@name = '$part_name'\]"] delete -} - -proc Pfem::xml::UpdateBody {body_name_old body_name body_type body_mesh body_cont} { - - variable body_UN - set bodies_path [spdAux::getRoute $body_UN] - # TODO: check if $body_name_old exists in parent - set node [[customlib::GetBaseRoot] selectNodes "$bodies_path/blockdata\[@name = '$body_name_old'\]"] - $node setAttribute name $body_name - [$node selectNodes "./value\[@n = 'BodyType'\]"] setAttribute v $body_type - [$node selectNodes "./value\[@n = 'MeshingStrategy'\]"] setAttribute v $body_mesh - [$node selectNodes "./value\[@n = 'ContactStrategy'\]"] setAttribute v $body_cont -} - - -# TODO: Event After rename group for bodies associetion. Wait Event register system - -# TODO: Event After delete group for bodies associetion. Wait Event register system - -Pfem::xml::Init diff --git a/kratos.gid/apps/PfemFluid/app.json b/kratos.gid/apps/PfemFluid/app.json new file mode 100644 index 000000000..15aa6bb7f --- /dev/null +++ b/kratos.gid/apps/PfemFluid/app.json @@ -0,0 +1,45 @@ +{ + "id": "PfemFluid", + "name": "Pfem Fluid", + "prefix": "PFEMFLUID_", + "themed": true, + "kratos_name": "PfemFluidDynamicsApplication", + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/DamBreakFSI.tcl", + "examples/WaterDamBreak.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script":"::PfemFluid::Init", + "requeriments":{ + "apps":[], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "unique_names": { + "nodal_conditions": "PFEMFLUID_NodalConditions", + "materials": "PFEMFLUID_Materials", + "results": "Results", + "time_parameters": "PFEMFLUID_TimeParameters" + }, + "write": { + "coordinates": "all", + "materials_file": "PFEMFluidMaterials.json", + "properties_location": "json", + "model_part_name": "PfemFluidModelPart" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} diff --git a/kratos.gid/apps/PfemFluid/examples/DamBreakFSI.tcl b/kratos.gid/apps/PfemFluid/examples/DamBreakFSI.tcl index e7cda944a..e84f2db6b 100644 --- a/kratos.gid/apps/PfemFluid/examples/DamBreakFSI.tcl +++ b/kratos.gid/apps/PfemFluid/examples/DamBreakFSI.tcl @@ -1,5 +1,10 @@ +namespace eval ::PfemFluid::examples::DamBreakFSI { + namespace path ::PfemFluid::examples + Kratos::AddNamespace [namespace current] -proc ::PfemFluid::examples::DamBreakFSI {args} { +} + +proc ::PfemFluid::examples::DamBreakFSI::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] @@ -7,10 +12,10 @@ proc ::PfemFluid::examples::DamBreakFSI {args} { } Kratos::ResetModel - DrawDamBreakFSIGeometry$::Model::SpatialDimension - AssignGroupsDamBreakFSIGeometry$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignGroups$::Model::SpatialDimension # AssignDamBreakFSIMeshSizes$::Model::SpatialDimension - TreeAssignationDamBreakFSI$::Model::SpatialDimension + TreeAssignation$::Model::SpatialDimension GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -20,11 +25,11 @@ proc ::PfemFluid::examples::DamBreakFSI {args} { # Draw Geometry -proc PfemFluid::examples::DrawDamBreakFSIGeometry3D {args} { +proc PfemFluid::examples::DamBreakFSI::DrawGeometry3D {args} { # To be implemented } -proc PfemFluid::examples::DrawDamBreakFSIGeometry2D {args} { +proc PfemFluid::examples::DamBreakFSI::DrawGeometry2D {args} { set layer PfemFluid GiD_Layers create $layer GiD_Layers edit to_use $layer @@ -68,14 +73,14 @@ proc PfemFluid::examples::DrawDamBreakFSIGeometry2D {args} { # Group assign -proc PfemFluid::examples::AssignGroupsDamBreakFSIGeometry2D {args} { +proc PfemFluid::examples::DamBreakFSI::AssignGroups2D {args} { # Create the groups GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" GiD_EntitiesGroups assign Fluid surfaces 1 GiD_Groups create Solid - GiD_Groups edit color Solid "#26d1a8ff" + GiD_Groups edit color Solid "#3b3b3bff" GiD_EntitiesGroups assign Solid surfaces 2 GiD_Groups create Interface @@ -83,20 +88,20 @@ proc PfemFluid::examples::AssignGroupsDamBreakFSIGeometry2D {args} { GiD_EntitiesGroups assign Interface lines {5 6 7} GiD_Groups create Rigid_Walls - GiD_Groups edit color Rigid_Walls "#e0210fff" + GiD_Groups edit color Rigid_Walls "#42eb71ff" GiD_EntitiesGroups assign Rigid_Walls lines {1 4 9 10 11 12 13} } -proc PfemFluid::examples::AssignGroupsDamBreakFSIGeometry3D {args} { +proc PfemFluid::examples::DamBreakFSI::AssignGroups3D {args} { # To be implemented } # Tree assign -proc PfemFluid::examples::TreeAssignationDamBreakFSI3D {args} { +proc PfemFluid::examples::DamBreakFSI::TreeAssignation3D {args} { # To be implemented } -proc PfemFluid::examples::TreeAssignationDamBreakFSI2D {args} { +proc PfemFluid::examples::DamBreakFSI::TreeAssignation2D {args} { gid_groups_conds::setAttributesF [spdAux::getRoute PFEMFLUID_DomainType] {v FSI} @@ -109,7 +114,7 @@ proc PfemFluid::examples::TreeAssignationDamBreakFSI2D {args} { gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[3\]" {name SolidBody} gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] - gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[4\]" {name RigidInterfaceBody} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[4\]" {name InterfaceBody} gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[5\]" {name RigidWallsBody} @@ -132,9 +137,9 @@ proc PfemFluid::examples::TreeAssignationDamBreakFSI2D {args} { spdAux::SetValuesOnBaseNode $solidNode $props # Rigid Parts - gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidInterfaceBody'\]/value\[@n='BodyType'\]" {v Rigid} - gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidInterfaceBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} - set interface_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidInterfaceBody'\]/condition\[@n='Parts'\]" + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/value\[@n='BodyType'\]" {v Interface} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set interface_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/condition\[@n='Parts'\]" set interfaceNode [customlib::AddConditionGroupOnXPath $interface_part_xpath Interface] $interfaceNode setAttribute ov line @@ -156,10 +161,3 @@ proc PfemFluid::examples::TreeAssignationDamBreakFSI2D {args} { } -proc PfemFluid::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} diff --git a/kratos.gid/apps/PfemFluid/examples/WaterDamBreak.tcl b/kratos.gid/apps/PfemFluid/examples/WaterDamBreak.tcl index 8a82dfc56..398ea2ca5 100644 --- a/kratos.gid/apps/PfemFluid/examples/WaterDamBreak.tcl +++ b/kratos.gid/apps/PfemFluid/examples/WaterDamBreak.tcl @@ -1,5 +1,10 @@ +namespace eval ::PfemFluid::examples::WaterDamBreak { + namespace path ::PfemFluid::examples + Kratos::AddNamespace [namespace current] -proc ::PfemFluid::examples::WaterDamBreak {args} { +} + +proc ::PfemFluid::examples::WaterDamBreak::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] @@ -7,10 +12,9 @@ proc ::PfemFluid::examples::WaterDamBreak {args} { } Kratos::ResetModel - DrawWaterDamBreakGeometry$::Model::SpatialDimension - AssignGroupsWaterDamBreakGeometry$::Model::SpatialDimension - # AssignWaterDamBreakMeshSizes$::Model::SpatialDimension - TreeAssignationWaterDamBreak$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignGroups$::Model::SpatialDimension + TreeAssignation$::Model::SpatialDimension GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -20,11 +24,11 @@ proc ::PfemFluid::examples::WaterDamBreak {args} { # Draw Geometry -proc PfemFluid::examples::DrawWaterDamBreakGeometry3D {args} { +proc PfemFluid::examples::WaterDamBreak::DrawGeometry3D {args} { # To be implemented } -proc PfemFluid::examples::DrawWaterDamBreakGeometry2D {args} { +proc PfemFluid::examples::WaterDamBreak::DrawGeometry2D {args} { set layer PfemFluid GiD_Layers create $layer GiD_Layers edit to_use $layer @@ -51,10 +55,8 @@ proc PfemFluid::examples::DrawWaterDamBreakGeometry2D {args} { GiD_Process Mescape Geometry Create NurbsSurface 2 3 4 1 escape escape } - - # Group assign -proc PfemFluid::examples::AssignGroupsWaterDamBreakGeometry2D {args} { +proc PfemFluid::examples::WaterDamBreak::AssignGroups2D {args} { # Create the groups GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" @@ -65,17 +67,17 @@ proc PfemFluid::examples::AssignGroupsWaterDamBreakGeometry2D {args} { GiD_EntitiesGroups assign Rigid_Walls lines {1 4 5 6 7 8 9 10 11 12} } -proc PfemFluid::examples::AssignGroupsWaterDamBreakGeometry3D {args} { +proc PfemFluid::examples::WaterDamBreak::AssignGroups3D {args} { # To be implemented } # Tree assign -proc PfemFluid::examples::TreeAssignationWaterDamBreak3D {args} { +proc PfemFluid::examples::WaterDamBreak::TreeAssignation3D {args} { # To be implemented } -proc PfemFluid::examples::TreeAssignationWaterDamBreak2D {args} { -# ONLY ASSIGN VELOCITY X Y EQUAL TO 0 TO THE RIGID LINES (SEE ABOVE) +proc PfemFluid::examples::WaterDamBreak::TreeAssignation2D {args} { + # ONLY ASSIGN VELOCITY X Y EQUAL TO 0 TO THE RIGID LINES (SEE ABOVE) # Fluid Parts set bodies_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='Body1'\]" gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] @@ -102,11 +104,3 @@ proc PfemFluid::examples::TreeAssignationWaterDamBreak2D {args} { set fixVelocityNode [customlib::AddConditionGroupOnXPath $fixVelocity "Rigid_Walls//Total"] $fixVelocityNode setAttribute ov line } - -proc PfemFluid::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} \ No newline at end of file diff --git a/kratos.gid/apps/PfemFluid/examples/examples.tcl b/kratos.gid/apps/PfemFluid/examples/examples.tcl index 0b266fc51..989b3e0b4 100644 --- a/kratos.gid/apps/PfemFluid/examples/examples.tcl +++ b/kratos.gid/apps/PfemFluid/examples/examples.tcl @@ -1,17 +1,13 @@ -namespace eval PfemFluid::examples { +namespace eval ::PfemFluid::examples { + namespace path ::PfemFluid + Kratos::AddNamespace [namespace current] } -proc PfemFluid::examples::Init { } { - uplevel #0 [list source [file join $::PfemFluid::dir examples WaterDamBreak.tcl]] - uplevel #0 [list source [file join $::PfemFluid::dir examples DamBreakFSI.tcl]] -} - -proc PfemFluid::examples::UpdateMenus { } { - GiDMenu::InsertOption "Kratos" [list "---"] 7 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Water dam break" ] 7 PRE [list ::PfemFluid::examples::WaterDamBreak] "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Dam break FSI" ] 7 PRE [list ::PfemFluid::examples::DamBreakFSI] "" "" insertafter = - GiDMenu::UpdateMenus -} - -PfemFluid::examples::Init +proc ::PfemFluid::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} + } +} \ No newline at end of file diff --git a/kratos.gid/apps/PfemFluid/examples/examples.xml b/kratos.gid/apps/PfemFluid/examples/examples.xml new file mode 100644 index 000000000..d67b53d76 --- /dev/null +++ b/kratos.gid/apps/PfemFluid/examples/examples.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/PfemFluid/images/DamBreakFSI.png b/kratos.gid/apps/PfemFluid/images/DamBreakFSI.png new file mode 100644 index 000000000..81a17a1c8 Binary files /dev/null and b/kratos.gid/apps/PfemFluid/images/DamBreakFSI.png differ diff --git a/kratos.gid/apps/PfemFluid/images/WaterDamBreak.png b/kratos.gid/apps/PfemFluid/images/WaterDamBreak.png new file mode 100644 index 000000000..16ec8c195 Binary files /dev/null and b/kratos.gid/apps/PfemFluid/images/WaterDamBreak.png differ diff --git a/kratos.gid/apps/Pfem/images/linear_solver.png b/kratos.gid/apps/PfemFluid/images/dmsettings.png similarity index 100% rename from kratos.gid/apps/Pfem/images/linear_solver.png rename to kratos.gid/apps/PfemFluid/images/dmsettings.png diff --git a/kratos.gid/apps/PfemFluid/python/Erase--script.py b/kratos.gid/apps/PfemFluid/python/Erase--script.py deleted file mode 100644 index 5cecb5555..000000000 --- a/kratos.gid/apps/PfemFluid/python/Erase--script.py +++ /dev/null @@ -1,291 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -#Activate it to import in the gdb path: -#import sys -#sys.path.append('/home/cpuigbo/kratos') -#x = input("stopped to allow debug: set breakpoints and press enter to continue"); - -#### TIME MONITORING START #### - -# Time control starts -import time as timer -print(timer.ctime()) -# Measure process time -t0p = timer.clock() -# Measure wall time -t0w = timer.time() - -def StartTimeMeasuring(): - # Measure process time - time_ip = timer.clock() - return time_ip - -def StopTimeMeasuring(time_ip, process, report): - # Measure process time - time_fp = timer.clock() - if( report ): - used_time = time_fp - time_ip - print("::[KSM Simulation]:: [ %.2f" % round(used_time,2),"s", process," ] ") - -#### TIME MONITORING END #### - -#### SET NUMBER OF THREADS #### - -def SetParallelSize(num_threads): - parallel = KratosMultiphysics.OpenMPUtils() - parallel.SetNumThreads(int(num_threads)) - -def GetParallelSize(): - parallel = KratosMultiphysics.OpenMPUtils() - return parallel.GetNumThreads() - -#### SET NUMBER OF THREADS #### - -# Import system python -import os - -# Import kratos core and applications -import KratosMultiphysics -import KratosMultiphysics.ExternalSolversApplication as KratosSolvers -import KratosMultiphysics.DelaunayMeshingApplication as KratosPfemg -import KratosMultiphysics.PfemFluidDynamicsApplication as KratosPfemFluid - -###################################################################################### -###################################################################################### -###################################################################################### - -#### PARSING THE PARAMETERS #### - -# Import input -parameter_file = open("ProjectParameters.json",'r') -ProjectParameters = KratosMultiphysics.Parameters(parameter_file.read()) - -#set echo level -echo_level = ProjectParameters["problem_data"]["echo_level"].GetInt() - -print(" ") - -# defining the number of threads: -threads = ProjectParameters["problem_data"]["threads"].GetInt() -SetParallelSize(threads) -num_threads = GetParallelSize() -print("::[KPFEM Simulation]:: [OMP USING",num_threads,"THREADS ]") -#parallel.PrintOMPInfo() - - -print(" ") -print("::[KPFEM Simulation]:: [Time Step:", ProjectParameters["problem_data"]["time_step"].GetDouble()," echo:", echo_level,"]") - -#### Model_part settings start #### - -# Defining the model_part -main_model_part = KratosMultiphysics.ModelPart(ProjectParameters["problem_data"]["model_part_name"].GetString()) - -main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DIMENSION, ProjectParameters["problem_data"]["dimension"].GetInt()) -main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DOMAIN_SIZE, ProjectParameters["problem_data"]["dimension"].GetInt()) -main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DELTA_TIME, ProjectParameters["problem_data"]["time_step"].GetDouble()) -main_model_part.ProcessInfo.SetValue(KratosMultiphysics.TIME, ProjectParameters["problem_data"]["start_time"].GetDouble()) -if( ProjectParameters["problem_data"].Has("gravity_vector") ): - main_model_part.ProcessInfo.SetValue(KratosMultiphysics.GRAVITY_X, ProjectParameters["problem_data"]["gravity_vector"][0].GetDouble()) - main_model_part.ProcessInfo.SetValue(KratosMultiphysics.GRAVITY_Y, ProjectParameters["problem_data"]["gravity_vector"][1].GetDouble()) - main_model_part.ProcessInfo.SetValue(KratosMultiphysics.GRAVITY_Z, ProjectParameters["problem_data"]["gravity_vector"][2].GetDouble()) - -###TODO replace this "model" for real one once available in kratos core -Model = {ProjectParameters["problem_data"]["model_part_name"].GetString() : main_model_part} - -#construct the solver (main setting methods are located in the solver_module) -solver_module = __import__(ProjectParameters["solver_settings"]["solver_type"].GetString()) -solver = solver_module.CreateSolver(main_model_part, ProjectParameters["solver_settings"]) - -# Add variables (always before importing the model part) -solver.AddVariables() - -# Read model_part (note: the buffer_size is set here) (restart is read here) -solver.ImportModelPart() - -# Add dofs (always after importing the model part) -if((main_model_part.ProcessInfo).Has(KratosMultiphysics.IS_RESTARTED)): - if(main_model_part.ProcessInfo[KratosMultiphysics.IS_RESTARTED] == False): - solver.AddDofs() -else: - solver.AddDofs() - -# Build sub_model_parts or submeshes (rearrange parts for the application of custom processes) -## Get the list of the submodel part in the object Model -for i in range(ProjectParameters["solver_settings"]["processes_sub_model_part_list"].size()): - part_name = ProjectParameters["solver_settings"]["processes_sub_model_part_list"][i].GetString() - if( main_model_part.HasSubModelPart(part_name) ): - Model.update({part_name: main_model_part.GetSubModelPart(part_name)}) - -#### Model_part settings end #### - - -#print model_part and properties -if(echo_level>1): - print("") - print(main_model_part) - for properties in main_model_part.Properties: - print(properties) - -#### Processes settings start #### - -#obtain the list of the processes to be applied - -import process_handler - -process_parameters = KratosMultiphysics.Parameters("{}") -process_parameters.AddValue("echo_level", ProjectParameters["problem_data"]["echo_level"]) -process_parameters.AddValue("constraints_process_list", ProjectParameters["constraints_process_list"]) -process_parameters.AddValue("loads_process_list", ProjectParameters["loads_process_list"]) -if( ProjectParameters.Has("problem_process_list") ): - process_parameters.AddValue("problem_process_list", ProjectParameters["problem_process_list"]) -if( ProjectParameters.Has("output_process_list") ): - process_parameters.AddValue("output_process_list", ProjectParameters["output_process_list"]) -if( ProjectParameters.Has("processes_sub_model_part_tree_list") ): - process_parameters.AddValue("processes_sub_model_part_tree_list",ProjectParameters["processes_sub_model_part_tree_list"]) - -model_processes = process_handler.ProcessHandler(Model, process_parameters) - -model_processes.ExecuteInitialize() - -#### processes settings end #### - - -# --PLOT GRAPHS OPTIONS START--############### -#problem_path = os.getcwd() #current path -#plot_active = general_variables.PlotGraphs -#graph_plot = plot_utils.GraphPlotUtility(model_part, problem_path) -# --PLOT GRAPHS OPTIONS END--################# - -#### START SOLUTION #### - -computing_model_part = solver.GetComputingModelPart() - -## Sets strategies, builders, linear solvers, schemes and solving info, and fills the buffer -solver.Initialize() -solver.InitializeStrategy() -solver.SetEchoLevel(echo_level) - -#### Output settings start #### - -problem_path = os.getcwd() -problem_name = ProjectParameters["problem_data"]["problem_name"].GetString() - -# Initialize GiD I/O (gid outputs, file_lists) -from gid_output_process import GiDOutputProcess -output_settings = ProjectParameters["output_configuration"] -gid_output = GiDOutputProcess(computing_model_part, - problem_name, - output_settings) - -gid_output.ExecuteInitialize() - -#### Output settings end #### - -# writing a initial state results file -current_id = 0 -#if(load_restart == False): -# if (general_variables.TryToSetTheWeight): -# if (general_variables.TryToSetConstantWeight): -# conditions.SetConstantWeight( general_variables.TryToSetWeightVertical, general_variables.TryToSetWeightHorizontal); -# else: -# conditions.SetWeight(); - -# set solver info starting parameters -# solving_info = solving_info_utils.SolvingInfoUtility(model_part, SolverSettings) - -print(" ") -print("::[KPFEM Simulation]:: Analysis -START- ") - -model_processes.ExecuteBeforeSolutionLoop() - -# writing a initial state results file or single file (if no restart) -if((main_model_part.ProcessInfo).Has(KratosMultiphysics.IS_RESTARTED)): - if(main_model_part.ProcessInfo[KratosMultiphysics.IS_RESTARTED] == False): - gid_output.ExecuteBeforeSolutionLoop() - -# Set time settings -step = main_model_part.ProcessInfo[KratosMultiphysics.STEP] -time = main_model_part.ProcessInfo[KratosMultiphysics.TIME] - -end_time = ProjectParameters["problem_data"]["end_time"].GetDouble() -delta_time = ProjectParameters["problem_data"]["time_step"].GetDouble() - - - -# Solving the problem (time integration) -while(time < end_time): - - # current time parameters - # main_model_part.ProcessInfo.GetPreviousSolutionStepInfo()[KratosMultiphysics.DELTA_TIME] = delta_time - delta_time = main_model_part.ProcessInfo[KratosMultiphysics.DELTA_TIME] - - time = time + delta_time - step = step + 1 - - main_model_part.ProcessInfo[KratosMultiphysics.STEP] = step - main_model_part.CloneTimeStep(time) - - - print(" [STEP:",step," TIME:",time,"]") - - # processes to be executed at the begining of the solution step - model_processes.ExecuteInitializeSolutionStep() - - gid_output.ExecuteInitializeSolutionStep() - - # solve time step - clock_time = StartTimeMeasuring(); - - solver.InitializeSolutionStep() - - solver.Predict() - - solver.SolveSolutionStep() - - solver.FinalizeSolutionStep() - - StopTimeMeasuring(clock_time,"Solving", False); - - gid_output.ExecuteFinalizeSolutionStep() - - # processes to be executed at the end of the solution step - model_processes.ExecuteFinalizeSolutionStep() - - # processes to be executed before witting the output - model_processes.ExecuteBeforeOutputStep() - - # write output results GiD: (frequency writing is controlled internally) - if(gid_output.IsOutputStep()): - gid_output.PrintOutput() - - # processes to be executed after witting the output - model_processes.ExecuteAfterOutputStep() - - -# Ending the problem (time integration finished) -gid_output.ExecuteFinalize() - -model_processes.ExecuteFinalize() - -print("::[KPFEM Simulation]:: Analysis -END- ") -print(" ") - -# Check solving information for any problem -#~ solver.InfoCheck() # InfoCheck not implemented yet. - -#### END SOLUTION #### - -# Measure process time -tfp = timer.clock() -# Measure wall time -tfw = timer.time() - -print("::[KPFEM Simulation]:: [Elapsed Time = %.2f" % (tfw - t0w),"seconds] (%.2f" % (tfp - t0p),"seconds of cpu/s time)") - -print(timer.ctime()) - -# to create a benchmark: add standard benchmark files and decomment next two lines -# rename the file to: run_test.py -#from run_test_benchmark_results import * -#WriteBenchmarkResults(model_part) diff --git a/kratos.gid/apps/PfemFluid/python/RunPFEM.py b/kratos.gid/apps/PfemFluid/python/RunPFEM.py deleted file mode 100644 index d1524ff55..000000000 --- a/kratos.gid/apps/PfemFluid/python/RunPFEM.py +++ /dev/null @@ -1,17 +0,0 @@ -import KratosMultiphysics -import KratosMultiphysics.ExternalSolversApplication -import KratosMultiphysics.DelaunayMeshingApplication -import KratosMultiphysics.PfemFluidDynamicsApplication - -from KratosMultiphysics.PfemFluidDynamicsApplication.pfem_fluid_dynamics_analysis import PfemFluidDynamicsAnalysis - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - - simulation = PfemFluidDynamicsAnalysis(model,parameters) - - simulation.Run() diff --git a/kratos.gid/apps/PfemFluid/start.tcl b/kratos.gid/apps/PfemFluid/start.tcl index c89e51f9f..36cbf91f1 100644 --- a/kratos.gid/apps/PfemFluid/start.tcl +++ b/kratos.gid/apps/PfemFluid/start.tcl @@ -1,42 +1,24 @@ namespace eval ::PfemFluid { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir - variable attributes - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::PfemFluid::Init { } { +proc ::PfemFluid::Init { app } { # Variable initialization variable dir - variable attributes - variable kratos_name - set kratos_name PfemFluidDynamicsApplication - set dir [apps::getMyDir "PfemFluid"] - set ::Model::ValidSpatialDimensions [list 2D 3D] - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - set attributes [dict create] - dict set attributes UseIntervals 1 - if {$::Kratos::kratos_private(DevMode) ne "dev"} {error [= "You need to change to Developer mode in the Kratos menu"] } - dict set attributes UseRestart 1 - LoadMyFiles -} - -proc ::PfemFluid::LoadMyFiles { } { - variable dir - uplevel #0 [list source [file join $dir examples examples.tcl]] - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] -} - + variable _app + set _app $app -proc ::PfemFluid::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value + PfemFluid::xml::Init + PfemFluid::write::Init } proc ::PfemFluid::CustomToolbarItems { } { @@ -52,15 +34,8 @@ proc ::PfemFluid::CustomToolbarItems { } { Kratos::ToolbarAddItem "Run" [file join $img_dir "runSimulation.png"] {Utilities Calculate} [= "Run the simulation"] Kratos::ToolbarAddItem "Output" [file join $img_dir "view.png"] [list -np- PWViewOutput] [= "View process info"] Kratos::ToolbarAddItem "Stop" [file join $img_dir "cancelProcess.png"] {Utilities CancelProcess} [= "Cancel process"] - Kratos::ToolbarAddItem "SpacerApp" "" "" "" Kratos::ToolbarAddItem "Spacer" "" "" "" - Kratos::ToolbarAddItem "Example" [file join $img_dir "exampleFluid.png"] [list -np- ::PfemFluid::examples::WaterDamBreak] [= "Example\nWater dam break"] - Kratos::ToolbarAddItem "Example" [file join $img_dir "exampleFsi.png"] [list -np- ::PfemFluid::examples::DamBreakFSI] [= "Example\nDam break FSI"] - - # Solo para JG - if {[GiD_Info problemtypepath] eq "E:/PROYECTOS/Kratos/interfaces/GiD/kratos.gid"} { - Kratos::ToolbarAddItem "Conditions" "list.png" [list -np- PfemFluid::xml::StartSortingWindow] [= "Sort the conditions"] - } + Kratos::ToolbarAddItem "Examples" "losta.png" [list -np- ::Examples::StartWindow [apps::getActiveAppId]] [= "Examples window"] + Kratos::ToolbarAddItem "SpacerApp" "" "" "" } -::PfemFluid::Init diff --git a/kratos.gid/apps/PfemFluid/write/ProjectParameters.json b/kratos.gid/apps/PfemFluid/write/ProjectParameters.json index 6fb16b766..40efda130 100644 --- a/kratos.gid/apps/PfemFluid/write/ProjectParameters.json +++ b/kratos.gid/apps/PfemFluid/write/ProjectParameters.json @@ -153,7 +153,7 @@ }, "file_label" : "step", "output_control_type" : "step", - "output_frequency" : 1.0, + "output_interval" : 1.0, "body_output" : true, "node_output" : false, "skin_output" : false, diff --git a/kratos.gid/apps/PfemFluid/write/write.tcl b/kratos.gid/apps/PfemFluid/write/write.tcl index 44cf937de..1b575e1e7 100644 --- a/kratos.gid/apps/PfemFluid/write/write.tcl +++ b/kratos.gid/apps/PfemFluid/write/write.tcl @@ -1,4 +1,7 @@ -namespace eval PfemFluid::write { +namespace eval ::PfemFluid::write { + namespace path ::PfemFluid + Kratos::AddNamespace [namespace current] + variable writeAttributes variable remesh_domains_dict variable bodies_list @@ -14,9 +17,14 @@ proc PfemFluid::write::Init { } { variable Names set Names [dict create DeltaTime DeltaTime] - SetAttribute properties_location json - SetAttribute model_part_name "PfemFluidModelPart" - SetAttribute materials_file "PFEMFluidMaterials.json" + + SetAttribute materials_un [::PfemFluid::GetUniqueName materials] + SetAttribute nodal_conditions_un [::PfemFluid::GetUniqueName nodal_conditions] + + SetAttribute main_launch_file [::PfemFluid::GetAttribute main_launch_file] + SetAttribute materials_file [::PfemFluid::GetWriteProperty materials_file] + SetAttribute properties_location [::PfemFluid::GetWriteProperty properties_location] + SetAttribute model_part_name [::PfemFluid::GetWriteProperty model_part_name] } @@ -27,7 +35,7 @@ proc PfemFluid::write::writeModelPartEvent { } { set parts_un_list [GetPartsUN] foreach part_un $parts_un_list { - write::initWriteData $part_un "PFEMFLUID_Materials" + write::initWriteData $part_un [GetAttribute materials_un] } write::writeModelPartData @@ -37,7 +45,7 @@ proc PfemFluid::write::writeModelPartEvent { } { write::writeNodalCoordinates foreach part_un $parts_un_list { - write::initWriteData $part_un "PFEMFLUID_Materials" + write::initWriteData $part_un [GetAttribute materials_un] write::writeElementConnectivities } PfemFluid::write::writeMeshes @@ -46,31 +54,17 @@ proc PfemFluid::write::writeModelPartEvent { } { proc PfemFluid::write::writeMeshes { } { foreach part_un [GetPartsUN] { - write::initWriteData $part_un "PFEMFLUID_Materials" + write::initWriteData $part_un [GetAttribute materials_un] write::writePartSubModelPart } # Solo Malla , no en conditions - writeNodalConditions "PFEMFLUID_NodalConditions" + writeNodalConditions [GetAttribute nodal_conditions_un] } proc PfemFluid::write::writeNodalConditions { keyword } { - write::writeNodalConditions $keyword - return "" - - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute $keyword]/container/blockdata" - set groups [$root selectNodes $xp1] - foreach group $groups { - set cid [[$group parent] @n] - set groupid [$group @name] - set groupid [write::GetWriteGroupName $groupid] - # Aqui hay que gestionar la escritura de los bodies - # Una opcion es crear un megagrupo temporal con esa informacion, mandar a pintar, y luego borrar el grupo. - # Otra opcion es no escribir el submodelpart. Ya tienen las parts y el project parameters tiene el conformado de los bodies - ::write::writeGroupSubModelPart $cid $groupid "nodal" - } + ::write::writeNodalConditions $keyword } proc PfemFluid::write::GetPartsUN { } { @@ -99,11 +93,7 @@ proc PfemFluid::write::GetPartsUN { } { proc PfemFluid::write::writeCustomFilesEvent { } { # Write the fluid materials json file PfemFluid::write::WriteMaterialsFile - - write::CopyFileIntoModel "python/RunPFEM.py" - write::RenameFileInModel "RunPFEM.py" "MainKratos.py" - - #write::RenameFileInModel "ProjectParameters.json" "ProjectParameters.py" + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] } proc PfemFluid::write::WriteMaterialsFile { {write_const_law True} {include_modelpart_name True} } { @@ -126,8 +116,6 @@ proc PfemFluid::write::writePropertiesJsonFile { {fname "materials.json"} {write write::CloseFile } - - proc PfemFluid::write::GetAttribute {att} { variable writeAttributes return [dict get $writeAttributes $att] @@ -152,6 +140,3 @@ proc PfemFluid::write::AddAttributes {configuration} { variable writeAttributes set writeAttributes [dict merge $writeAttributes $configuration] } - - -PfemFluid::write::Init diff --git a/kratos.gid/apps/PfemFluid/write/writeProjectParameters.tcl b/kratos.gid/apps/PfemFluid/write/writeProjectParameters.tcl index 72c4a7b44..528f59b7a 100644 --- a/kratos.gid/apps/PfemFluid/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/PfemFluid/write/writeProjectParameters.tcl @@ -9,6 +9,9 @@ proc PfemFluid::write::getNewParametersDict { } { PfemFluid::write::CalculateMyVariables set projectParametersDict [dict create] + # Analysis stage field + dict set projectParametersDict analysis_stage "KratosMultiphysics.PfemFluidDynamicsApplication.pfem_fluid_dynamics_analysis" + ##### Problem data ##### # Create section set problemDataDict [GetPFEM_ProblemDataDict] @@ -20,7 +23,7 @@ proc PfemFluid::write::getNewParametersDict { } { dict set projectParametersDict solver_settings $solverSettingsDict ##### problem_process_list - set problemProcessList [GetPFEM_ProblemProcessList] + set problemProcessList [GetPFEM_ProblemProcessList "[]" "[]"] dict set projectParametersDict problem_process_list $problemProcessList set processList [GetPFEM_ProcessList] @@ -122,6 +125,7 @@ proc PfemFluid::write::GetPFEM_SolverSettingsDict { } { set solverSettingsDict [dict merge $solverSettingsDict [write::getSolutionStrategyParametersDict PFEMFLUID_SolStrat PFEMFLUID_Scheme PFEMFLUID_StratParams] ] set solverSettingsDict [dict merge $solverSettingsDict [write::getSolversParametersDict PfemFluid] ] + # Body parts list set bodies_parts_list [list ] foreach body $bodies_list { set body_parts [dict get $body parts_list] @@ -130,9 +134,20 @@ proc PfemFluid::write::GetPFEM_SolverSettingsDict { } { } } + # Constitutive laws + set constitutive_list [list] + foreach parts_un [PfemFluid::write::GetPartsUN] { + set parts_path [spdAux::getRoute $parts_un] + set xp1 "$parts_path/group/value\[@n='ConstitutiveLaw'\]" + foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { + lappend constitutive_list [get_domnode_attribute $gNode v] + } + } + dict set solverSettingsDict bodies_list $bodies_list dict set solverSettingsDict problem_domain_sub_model_part_list $bodies_parts_list - dict set solverSettingsDict processes_sub_model_part_list [write::getSubModelPartNames "PFEMFLUID_NodalConditions" "PFEMFLUID_Loads"] + dict set solverSettingsDict constitutive_laws_list $constitutive_list + dict set solverSettingsDict processes_sub_model_part_list [write::getSubModelPartNames [GetAttribute nodal_conditions_un] "PFEMFLUID_Loads"] set materialsDict [dict create] dict set materialsDict materials_filename [GetAttribute materials_file] @@ -146,10 +161,10 @@ proc PfemFluid::write::GetPFEM_OutputProcessList { } { # lappend resultList [write::GetRestartProcess Restart] return $resultList } -proc PfemFluid::write::GetPFEM_ProblemProcessList { } { +proc PfemFluid::write::GetPFEM_ProblemProcessList { free_surface_heat_flux free_surface_thermal_face } { set resultList [list ] set problemtype [write::getValue PFEMFLUID_DomainType] - lappend resultList [GetPFEM_FluidRemeshDict] + lappend resultList [GetPFEM_FluidRemeshDict $free_surface_heat_flux $free_surface_thermal_face] return $resultList } @@ -209,20 +224,13 @@ proc PfemFluid::write::GetPFEM_RemeshDict { } { dict set bodyDict "python_module" "meshing_domain" dict set bodyDict "model_part_name" $body_name dict set bodyDict "alpha_shape" 2.4 - dict set bodyDict "offset_factor" 0.0 set remesh [write::getStringBinaryFromValue [PfemFluid::write::GetRemeshProperty $body_name "Remesh"]] set refine [write::getStringBinaryFromValue [PfemFluid::write::GetRemeshProperty $body_name "Refine"]] set meshing_strategyDict [dict create ] dict set meshing_strategyDict "python_module" "meshing_strategy" - dict set meshing_strategyDict "meshing_frequency" 0 dict set meshing_strategyDict "remesh" $remesh dict set meshing_strategyDict "refine" $refine - dict set meshing_strategyDict "reconnect" false dict set meshing_strategyDict "transfer" false - dict set meshing_strategyDict "constrained" false - dict set meshing_strategyDict "mesh_smoothing" false - dict set meshing_strategyDict "variables_smoothing" false - dict set meshing_strategyDict "elemental_variables_to_smooth" [list "DETERMINANT_F" ] set nDim $::Model::SpatialDimension if {$nDim eq "3D"} { dict set meshing_strategyDict "reference_element_type" "Element3D4N" @@ -233,7 +241,6 @@ proc PfemFluid::write::GetPFEM_RemeshDict { } { } dict set bodyDict meshing_strategy $meshing_strategyDict - set spatial_bounding_boxDict [dict create ] dict set spatial_bounding_boxDict "use_bounding_box" [write::getValue PFEMFLUID_BoundingBox UseBoundingBox] dict set spatial_bounding_boxDict "initial_time" [write::getValue PFEMFLUID_BoundingBox StartTime] @@ -251,45 +258,6 @@ proc PfemFluid::write::GetPFEM_RemeshDict { } { dict set spatial_refining_boxDict "lower_point" [PfemFluid::write::GetLowerPointRefiningBox] dict set bodyDict spatial_refining_box $spatial_refining_boxDict - set refining_parametersDict [dict create ] - dict set refining_parametersDict "critical_size" 0.0 - dict set refining_parametersDict "threshold_variable" "PLASTIC_STRAIN" - dict set refining_parametersDict "reference_threshold" 0.0 - dict set refining_parametersDict "error_variable" "NORM_ISOCHORIC_STRESS" - dict set refining_parametersDict "reference_error" 0.0 - dict set refining_parametersDict "add_nodes" true - dict set refining_parametersDict "insert_nodes" false - - set remove_nodesDict [dict create] - dict set remove_nodesDict "apply_removal" false - dict set remove_nodesDict "on_distance" false - dict set remove_nodesDict "on_threshold" false - dict set remove_nodesDict "on_error" false - dict set refining_parametersDict remove_nodes $remove_nodesDict - - set remove_boundaryDict [dict create] - dict set remove_boundaryDict "apply_removal" false - dict set remove_boundaryDict "on_distance" false - dict set remove_boundaryDict "on_threshold" false - dict set remove_boundaryDict "on_error" false - dict set refining_parametersDict remove_boundary $remove_boundaryDict - - set refine_elementsDict [dict create] - dict set refine_elementsDict "apply_refinement" false - dict set refine_elementsDict "on_distance" false - dict set refine_elementsDict "on_threshold" false - dict set refine_elementsDict "on_error" false - dict set refining_parametersDict refine_elements $refine_elementsDict - - set refine_boundaryDict [dict create] - dict set refine_boundaryDict "apply_refinement" false - dict set refine_boundaryDict "on_distance" false - dict set refine_boundaryDict "on_threshold" false - dict set refine_boundaryDict "on_error" false - dict set refining_parametersDict refine_boundary $refine_boundaryDict - - dict set bodyDict refining_parameters $refining_parametersDict - lappend meshing_domains_list $bodyDict } dict set paramsDict meshing_domains $meshing_domains_list @@ -299,7 +267,7 @@ proc PfemFluid::write::GetPFEM_RemeshDict { } { -proc PfemFluid::write::GetPFEM_FluidRemeshDict { } { +proc PfemFluid::write::GetPFEM_FluidRemeshDict { free_surface_heat_flux free_surface_thermal_face } { variable bodies_list set resultDict [dict create ] dict set resultDict "help" "This process applies meshing to the problem domains" @@ -314,10 +282,7 @@ proc PfemFluid::write::GetPFEM_FluidRemeshDict { } { dict set paramsDict "meshing_control_type" "step" dict set paramsDict "meshing_frequency" 1.0 dict set paramsDict "meshing_before_output" true - - set update_conditionsDict [dict create ] - dict set update_conditionsDict "update_conditions" false - dict set paramsDict update_conditions_on_free_surface $update_conditionsDict + dict set paramsDict update_conditions_on_free_surface [PfemFluid::write::GetUpdateConditionsOnFreeSurface $free_surface_heat_flux $free_surface_thermal_face] set meshing_domains_list [list ] foreach body $bodies_list { @@ -331,20 +296,13 @@ proc PfemFluid::write::GetPFEM_FluidRemeshDict { } { } else { dict set bodyDict "alpha_shape" 1.25 } - dict set bodyDict "offset_factor" 0.0 set remesh [write::getStringBinaryFromValue [PfemFluid::write::GetRemeshProperty $body_name "Remesh"]] set refine [write::getStringBinaryFromValue [PfemFluid::write::GetRemeshProperty $body_name "Refine"]] set meshing_strategyDict [dict create ] dict set meshing_strategyDict "python_module" "fluid_meshing_strategy" - dict set meshing_strategyDict "meshing_frequency" 0 dict set meshing_strategyDict "remesh" $remesh dict set meshing_strategyDict "refine" $refine - dict set meshing_strategyDict "reconnect" false dict set meshing_strategyDict "transfer" false - dict set meshing_strategyDict "constrained" false - dict set meshing_strategyDict "mesh_smoothing" false - dict set meshing_strategyDict "variables_smoothing" false - dict set meshing_strategyDict "elemental_variables_to_smooth" [list "DETERMINANT_F" ] if {$nDim eq "3D"} { dict set meshing_strategyDict "reference_element_type" "TwoStepUpdatedLagrangianVPFluidElement3D" dict set meshing_strategyDict "reference_condition_type" "CompositeCondition3D3N" @@ -373,45 +331,6 @@ proc PfemFluid::write::GetPFEM_FluidRemeshDict { } { dict set spatial_refining_boxDict "lower_point" [PfemFluid::write::GetLowerPointRefiningBox] dict set bodyDict spatial_refining_box $spatial_refining_boxDict - set refining_parametersDict [dict create ] - dict set refining_parametersDict "critical_size" 0.0 - dict set refining_parametersDict "threshold_variable" "PLASTIC_STRAIN" - dict set refining_parametersDict "reference_threshold" 0.0 - dict set refining_parametersDict "error_variable" "NORM_ISOCHORIC_STRESS" - dict set refining_parametersDict "reference_error" 0.0 - dict set refining_parametersDict "add_nodes" false - dict set refining_parametersDict "insert_nodes" true - - set remove_nodesDict [dict create] - dict set remove_nodesDict "apply_removal" true - dict set remove_nodesDict "on_distance" true - dict set remove_nodesDict "on_threshold" false - dict set remove_nodesDict "on_error" false - dict set refining_parametersDict remove_nodes $remove_nodesDict - - set remove_boundaryDict [dict create] - dict set remove_boundaryDict "apply_removal" false - dict set remove_boundaryDict "on_distance" false - dict set remove_boundaryDict "on_threshold" false - dict set remove_boundaryDict "on_error" false - dict set refining_parametersDict remove_boundary $remove_boundaryDict - - set refine_elementsDict [dict create] - dict set refine_elementsDict "apply_refinement" true - dict set refine_elementsDict "on_distance" true - dict set refine_elementsDict "on_threshold" false - dict set refine_elementsDict "on_error" false - dict set refining_parametersDict refine_elements $refine_elementsDict - - set refine_boundaryDict [dict create] - dict set refine_boundaryDict "apply_refinement" false - dict set refine_boundaryDict "on_distance" false - dict set refine_boundaryDict "on_threshold" false - dict set refine_boundaryDict "on_error" false - dict set refining_parametersDict refine_boundary $refine_boundaryDict - - dict set bodyDict refining_parameters $refining_parametersDict - lappend meshing_domains_list $bodyDict } dict set paramsDict meshing_domains $meshing_domains_list @@ -419,6 +338,42 @@ proc PfemFluid::write::GetPFEM_FluidRemeshDict { } { return $resultDict } +proc PfemFluid::write::GetUpdateConditionsOnFreeSurface { free_surface_heat_flux free_surface_thermal_face } { + set updateConditionsDict [dict create] + if {$free_surface_heat_flux eq "[]" && $free_surface_thermal_face eq "[]"} { + dict set updateConditionsDict "update_conditions" false + } else { + set free_part_name_list [list ] + set condition_type_list [list ] + set nDim $::Model::SpatialDimension + set nDim [expr [string range [write::getValue nDim] 0 0] ] + if {$free_surface_heat_flux ne "[]"} { + foreach part $free_surface_heat_flux { + lappend free_part_name_list $part + } + if {$nDim == 2} { + lappend condition_type_list "LineCondition2D2N" + } else { + lappend condition_type_list "SurfaceCondition3D3N" + } + } + if {$free_surface_thermal_face ne "[]"} { + foreach part $free_surface_thermal_face { + lappend free_part_name_list $part + } + if {$nDim == 2} { + lappend condition_type_list "LineCondition2D2N" + } else { + lappend condition_type_list "SurfaceCondition3D3N" + } + } + dict set updateConditionsDict "update_conditions" true + dict set updateConditionsDict "sub_model_part_list" $free_part_name_list + dict set updateConditionsDict "reference_condition_list" $condition_type_list + } + return $updateConditionsDict +} + proc PfemFluid::write::GetRemeshProperty { body_name property } { set ret "" set root [customlib::GetBaseRoot] diff --git a/kratos.gid/apps/PfemFluid/xml/Bodies.spd b/kratos.gid/apps/PfemFluid/xml/Bodies.spd index 2424d7b2f..e2aeb4361 100644 --- a/kratos.gid/apps/PfemFluid/xml/Bodies.spd +++ b/kratos.gid/apps/PfemFluid/xml/Bodies.spd @@ -3,6 +3,7 @@ + diff --git a/kratos.gid/apps/PfemFluid/xml/ConstitutiveLaws.xml b/kratos.gid/apps/PfemFluid/xml/ConstitutiveLaws.xml index 379e3aff1..d36426e88 100644 --- a/kratos.gid/apps/PfemFluid/xml/ConstitutiveLaws.xml +++ b/kratos.gid/apps/PfemFluid/xml/ConstitutiveLaws.xml @@ -2,7 +2,7 @@ - + @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -35,7 +35,7 @@ - + @@ -48,106 +48,64 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + - - - - + - - - + + + + + + + + - + - - - + + + + + + + + - - + + @@ -157,7 +115,7 @@ - + diff --git a/kratos.gid/apps/PfemFluid/xml/Elements.xml b/kratos.gid/apps/PfemFluid/xml/Elements.xml index 8d3a2ad49..349a72184 100644 --- a/kratos.gid/apps/PfemFluid/xml/Elements.xml +++ b/kratos.gid/apps/PfemFluid/xml/Elements.xml @@ -1,461 +1,754 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/PfemFluid/xml/Main.spd b/kratos.gid/apps/PfemFluid/xml/Main.spd index 23249a3c8..348c19beb 100644 --- a/kratos.gid/apps/PfemFluid/xml/Main.spd +++ b/kratos.gid/apps/PfemFluid/xml/Main.spd @@ -1,14 +1,13 @@ - + - - - + + + - - + diff --git a/kratos.gid/apps/PfemFluid/xml/MeshBoxes.spd b/kratos.gid/apps/PfemFluid/xml/MeshBoxes.spd index 7e3532609..e3abe947f 100644 --- a/kratos.gid/apps/PfemFluid/xml/MeshBoxes.spd +++ b/kratos.gid/apps/PfemFluid/xml/MeshBoxes.spd @@ -1,5 +1,5 @@ - + diff --git a/kratos.gid/apps/PfemFluid/xml/Procs.spd b/kratos.gid/apps/PfemFluid/xml/Procs.spd index 15a210566..ac5ea828e 100644 --- a/kratos.gid/apps/PfemFluid/xml/Procs.spd +++ b/kratos.gid/apps/PfemFluid/xml/Procs.spd @@ -35,6 +35,11 @@ return [PfemFluid::xml::ProcGetElementsValues $domNode $args] ]]> + + + - - - + + + + + + diff --git a/kratos.gid/apps/PfemFluid/xml/SolutionStrategy.spd b/kratos.gid/apps/PfemFluid/xml/SolutionStrategy.spd index 999d733d5..dbe5c1dab 100644 --- a/kratos.gid/apps/PfemFluid/xml/SolutionStrategy.spd +++ b/kratos.gid/apps/PfemFluid/xml/SolutionStrategy.spd @@ -1,5 +1,5 @@ - + diff --git a/kratos.gid/apps/PfemFluid/xml/Solvers.xml b/kratos.gid/apps/PfemFluid/xml/Solvers.xml index ff9df08a4..ef4c9335b 100644 --- a/kratos.gid/apps/PfemFluid/xml/Solvers.xml +++ b/kratos.gid/apps/PfemFluid/xml/Solvers.xml @@ -5,7 +5,7 @@ - + diff --git a/kratos.gid/apps/PfemFluid/xml/Strategies.xml b/kratos.gid/apps/PfemFluid/xml/Strategies.xml index 43c6119f9..c65198ace 100644 --- a/kratos.gid/apps/PfemFluid/xml/Strategies.xml +++ b/kratos.gid/apps/PfemFluid/xml/Strategies.xml @@ -11,9 +11,9 @@ - - - + + + @@ -63,9 +63,9 @@ - - - + + + @@ -115,9 +115,9 @@ - - - + + + diff --git a/kratos.gid/apps/PfemFluid/xml/XmlController.tcl b/kratos.gid/apps/PfemFluid/xml/XmlController.tcl index 9965351aa..1ee618094 100644 --- a/kratos.gid/apps/PfemFluid/xml/XmlController.tcl +++ b/kratos.gid/apps/PfemFluid/xml/XmlController.tcl @@ -1,24 +1,25 @@ -namespace eval PfemFluid::xml { - variable dir +namespace eval ::PfemFluid::xml { + namespace path ::PfemFluid + Kratos::AddNamespace [namespace current] + variable bodyNodalCondition } proc PfemFluid::xml::Init { } { - variable dir variable bodyNodalCondition - + set bodyNodalCondition [list ] - - Model::InitVariables dir $PfemFluid::dir - + + Model::InitVariables dir $::PfemFluid::dir + Model::getSolutionStrategies Strategies.xml Model::getElements Elements.xml Model::getConstitutiveLaws ConstitutiveLaws.xml Model::getProcesses "../../Common/xml/Processes.xml" Model::getProcesses Processes.xml Model::getNodalConditions NodalConditions.xml - Model::getSolvers "../../Pfem/xml/Solvers.xml" - + Model::getSolvers Solvers.xml + Model::ForgetNodalCondition "CONTACT" } @@ -36,8 +37,8 @@ proc PfemFluid::xml::MultiAppEvent {args} { proc PfemFluid::xml::CustomTree { args } { #HOW TO USE THIS FUNCTION: #spdAux::SetValueOnTreeItem arg1 arg2 arg3 (arg4) - #arg1: attribute_to_modify - #arg2: value_of_the_attribute + #arg1: attribute_to_modify + #arg2: value_of_the_attribute #arg3: unique_name_of_the_node ('unique name is defined by the attribute un=) #arg4 (optional): name_of_the_child_we_want_to_modify ('name'is defined by the attribute n=) @@ -51,50 +52,49 @@ proc PfemFluid::xml::CustomTree { args } { foreach node [$app_root getElementsByTagName container ] { if {[$node hasAttribute solstratname]} {$node setAttribute icon folder } } #TODO: (for JG) the previous icons should be changed automatically looking at the strategies.xml - #intervals spdAux::SetValueOnTreeItem icon sheets Intervals foreach node [[$app_root parent] selectNodes "[spdAux::getRoute Intervals]/blockdata"] { $node setAttribute icon select - } - + } + #conditions spdAux::SetValueOnTreeItem state \[CheckNodalConditionStatePFEM\] PFEMFLUID_NodalConditions VELOCITY spdAux::SetValueOnTreeItem state \[CheckNodalConditionStatePFEM\] PFEMFLUID_NodalConditions PRESSURE - foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition" ] { + foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition" ] { $node setAttribute icon select $node setAttribute groups_icon groupCreated } #loads if {[spdAux::getRoute PFEMFLUID_Loads] ne ""} { - spdAux::SetValueOnTreeItem icon setLoad PFEMFLUID_Loads - foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_Loads]/condition" ] { + spdAux::SetValueOnTreeItem icon setLoad PFEMFLUID_Loads + foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_Loads]/condition" ] { $node setAttribute icon select $node setAttribute groups_icon groupCreated } } #materials - foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_Materials]/blockdata" ] { + foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_Materials]/blockdata" ] { $node setAttribute icon select } - + #solver settings - foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_StratSection]/container\[@n = 'linear_solver_settings'\]" ] { + foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_StratSection]/container\[@n = 'linear_solver_settings'\]" ] { $node setAttribute icon select } - foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_StratSection]/container\[@n = 'velocity_linear_solver_settings'\]" ] { + foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_StratSection]/container\[@n = 'velocity_linear_solver_settings'\]" ] { $node setAttribute icon select - } + } - foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_StratSection]/container\[@n = 'pressure_linear_solver_settings'\]" ] { + foreach node [[$app_root parent] selectNodes "[spdAux::getRoute PFEMFLUID_StratSection]/container\[@n = 'pressure_linear_solver_settings'\]" ] { $node setAttribute icon select - } + } + - #units [[$app_root parent] selectNodes "/Kratos_data/blockdata\[@n = 'units'\]"] setAttribute icon setUnits @@ -104,22 +104,22 @@ proc PfemFluid::xml::CustomTree { args } { spdAux::SetValueOnTreeItem v No NodalResults DISPLACEMENT spdAux::SetValueOnTreeItem v No NodalResults VELOCITY_REACTION spdAux::SetValueOnTreeItem v No NodalResults DISPLACEMENT_REACTION - + set inlet_result_node [[$app_root parent] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'INLET'\]"] if {$inlet_result_node ne "" } {$inlet_result_node delete} #restart - spdAux::SetValueOnTreeItem icon doRestart Restart - spdAux::SetValueOnTreeItem icon select Restart RestartOptions - + # spdAux::SetValueOnTreeItem icon doRestart Restart + # spdAux::SetValueOnTreeItem icon select Restart RestartOptions + # 3D gravity if {$Model::SpatialDimension eq "3D"} { catch { - spdAux::SetValueOnTreeItem v -9.81 PFEMFLUID_Gravity Cy - spdAux::SetValueOnTreeItem v 0.0 PFEMFLUID_Gravity Cz + spdAux::SetValueOnTreeItem v -9.81 PFEMFLUID_Gravity Cy + spdAux::SetValueOnTreeItem v 0.0 PFEMFLUID_Gravity Cz } } - + } proc PfemFluid::xml::ProcCheckNodalConditionStatePFEM {domNode args} { @@ -154,7 +154,7 @@ proc PfemFluid::xml::ProcGetElementsDict {domNode args} { set pnames "" foreach elem $elems { if {[$elem cumple $argums]} { - lappend pnames [$elem getName] + lappend pnames [$elem getName] lappend pnames [$elem getPublicName] } } @@ -166,7 +166,7 @@ proc PfemFluid::xml::ProcGetElementsValues {domNode args} { set names [list ] set blockNode [PfemFluid::xml::FindMyBlocknode $domNode] set BodyType [get_domnode_attribute [$blockNode selectNodes "value\[@n='BodyType'\]"] v] - + set argums [list ElementType $BodyType] set elems [PfemFluid::xml::GetElements $domNode $args] foreach elem $elems { @@ -175,26 +175,46 @@ proc PfemFluid::xml::ProcGetElementsValues {domNode args} { } } set values [join $names ","] - + if {[get_domnode_attribute $domNode v] eq ""} {$domNode setAttribute v [lindex $names 0]} if {[get_domnode_attribute $domNode v] ni $names} {$domNode setAttribute v [lindex $names 0]} - + + return $values +} + +proc PfemFluid::xml::ProcGetConstitutiveLaws {domNode args} { + set Elementname [$domNode selectNodes {string(../value[@n='Element']/@v)}] + set Claws [::Model::GetAvailableConstitutiveLaws $Elementname] + + if {[llength $Claws] == 0} { + set names [list "None"] + } { + set names [list ] + foreach cl $Claws { + lappend names [$cl getName] + } + } + + set values [join $names ","] + + if {[get_domnode_attribute $domNode v] eq "" || [get_domnode_attribute $domNode v] ni $names} {$domNode setAttribute v [lindex $names 0]; spdAux::RequestRefresh} + return $values } proc PfemFluid::xml::GetElements {domNode args} { - + set nodeApp [spdAux::GetAppIdFromNode $domNode] set sol_stratUN [apps::getAppUniqueName $nodeApp SolStrat] set schemeUN [apps::getAppUniqueName $nodeApp Scheme] - + get_domnode_attribute [$domNode selectNodes [spdAux::getRoute $sol_stratUN]] dict get_domnode_attribute [$domNode selectNodes [spdAux::getRoute $schemeUN]] dict - + set solStratName [::write::getValue $sol_stratUN] set schemeName [write::getValue $schemeUN] set elems [::Model::GetAvailableElements $solStratName $schemeName] - + return $elems } @@ -206,7 +226,7 @@ proc PfemFluid::xml::FindMyBlocknode {domNode} { set ret $domNode break } else { - set domNode [$domNode parent] + set domNode [$domNode parent] } } return $ret @@ -230,7 +250,7 @@ proc PfemFluid::xml::ProcGetContactDomains {domNode args} { foreach contact_domain [[$domNode selectNodes $basepath] childNodes] { lappend values [get_domnode_attribute $contact_domain name] } - + if {[get_domnode_attribute $domNode v] eq "" || [get_domnode_attribute $domNode v] ni $values} { $domNode setAttribute v [lindex $values 0] } @@ -244,11 +264,11 @@ proc PfemFluid::xml::ProcSolutionTypeState {domNode args} { if {$domain_type_route ne ""} { set domain_type_node [$domNode selectNodes $domain_type_route] set domain_type_value [get_domnode_attribute $domain_type_node v] - - $domNode setAttribute values Dynamic + + $domNode setAttribute values Dynamic $domNode setAttribute v Dynamic set state disabled - + } return $state } @@ -260,12 +280,12 @@ proc PfemFluid::xml::ProcGetBodyTypeValues {domNode args} { if {$domain_type_route ne ""} { set domain_type_node [$domNode selectNodes $domain_type_route] set domain_type_value [get_domnode_attribute $domain_type_node v] - + if {$domain_type_value eq "Fluids"} { set values "Fluid,Rigid" } - if {$domain_type_value eq "Coupled"} { - set values "Solid,Fluid,Rigid" + if {$domain_type_value eq "FSI"} { + set values "Fluid,Solid,Rigid,Interface" } if {$domain_type_value eq "Solids"} { set values "Solid,Rigid" @@ -284,8 +304,8 @@ proc PfemFluid::xml::ProcGetSolutionStrategiesPFEM {domNode args} { set filter [list Solid Pfem] if {$domainType eq "Solids"} {set filter "Solid"} if {$domainType eq "Fluids"} {set filter "Pfem"} - if {$domainType eq "Coupled"} {set filter "Pfem"} - + if {$domainType eq "FSI"} {set filter "Pfem"} + foreach ss $Sols { if {[$ss getAttribute "App"] in $filter} { lappend names [$ss getName] @@ -293,13 +313,13 @@ proc PfemFluid::xml::ProcGetSolutionStrategiesPFEM {domNode args} { lappend pnames [$ss getPublicName] } } - + $domNode setAttribute values [join $names ","] set dv [lindex $names 0] #W "dv $dv" if {[$domNode getAttribute v] eq ""} {$domNode setAttribute v $dv; spdAux::RequestRefresh} if {[$domNode getAttribute v] ni $names} {$domNode setAttribute v $dv; spdAux::RequestRefresh} - + return [join $pnames ","] } @@ -335,6 +355,12 @@ proc PfemFluid::xml::ProcPartsOverWhat {domNode args} { } else { return "line,surface" } + } elseif { $BodyType eq "Interface"} { + if {$::Model::SpatialDimension eq "3D"} { + return "surface" + } else { + return "line" + } } else { return "point,line,surface,volume" } @@ -368,11 +394,11 @@ proc PfemFluid::xml::ProcGetRigidBodiesValues {domNode args} { set bodies [list ] foreach body_node [$root selectNodes $xp1] { foreach subnode [$body_node childNodes] { - if { [$subnode getAttribute n] eq "BodyType" } { - if { [$subnode getAttribute v] eq "Rigid" } { + if { [$subnode getAttribute n] eq "BodyType" } { + if { [$subnode getAttribute v] eq "Rigid" || [$subnode getAttribute v] eq "Interface"} { lappend bodies [$body_node @name] break - } + } } } } @@ -414,7 +440,7 @@ proc PfemFluid::xml::GetConditionsAndGroups { cnd_UN } { proc PfemFluid::xml::getBodyNodalConditionById { id } { variable bodyNodalCondition - + foreach cnd $bodyNodalCondition { if {[$cnd getName] eq $id} { return $cnd @@ -425,7 +451,7 @@ proc PfemFluid::xml::getBodyNodalConditionById { id } { proc PfemFluid::xml::getBodyNodalConditions { filename } { variable bodyNodalCondition dom parse [tDOM::xmlReadFile [file join $PfemFluid::dir xml $filename]] doc - + set NCList [$doc getElementsByTagName NodalConditionItem] foreach Node $NCList { lappend bodyNodalCondition [::Model::ParseNodalConditionsNode $Node] @@ -442,7 +468,7 @@ proc PfemFluid::xml::_injectCondsToTree {basenode cond_list {cond_type "normal"} set conds [$basenode parent] set AppUsesIntervals [::PfemFluid::GetAttribute UseIntervals] if {$AppUsesIntervals eq ""} {set AppUsesIntervals 0} - + foreach cnd $cond_list { set n [$cnd getName] set pn [$cnd getPublicName] @@ -460,7 +486,7 @@ proc PfemFluid::xml::_injectCondsToTree {basenode cond_list {cond_type "normal"} set contNode [gid_groups_conds::addF [$conds toXPath] container [list n $n pn ${pn}s help $help]] set blockNode [gid_groups_conds::addF [$contNode toXPath] blockdata [list n $n pn $pn help $help icon shells16 update_proc $check name "$pn 1" sequence 1 editable_name unique sequence_type non_void_disabled]] set block_path [$blockNode toXPath] - set inputs [$process getInputs] + set inputs [$process getInputs] foreach {inName in} $inputs { set pn [$in getPublicName] set type [$in getType] @@ -471,7 +497,7 @@ proc PfemFluid::xml::_injectCondsToTree {basenode cond_list {cond_type "normal"} foreach key [$cnd getDefaults $inName] { set $key [$cnd getDefault $inName $key] } - + set has_units [$in getAttribute "has_units"] if {$has_units ne ""} { set has_units "units='$units' unit_magnitude='$um'"} if {$type eq "vector"} { @@ -490,7 +516,7 @@ proc PfemFluid::xml::_injectCondsToTree {basenode cond_list {cond_type "normal"} set val [expr [$in getAttribute "enabled"] ? "Yes" : "No"] if {$i eq "Z"} { set val "No" } set valNode [gid_groups_conds::addF $block_path value [list n Enabled_$i pn "$i component" v No values "Yes,No" help "Enables the $i ${inName}" actualize_tree 1 {*}$zstate]] - + gid_groups_conds::addF [$valNode toXPath] dependencies [list value No node $nodev att1 state v1 hidden] gid_groups_conds::addF [$valNode toXPath] dependencies [list value Yes node $nodev att1 state v1 normal] if {[$in getAttribute "function"] eq "1"} { @@ -514,7 +540,7 @@ proc PfemFluid::xml::_injectCondsToTree {basenode cond_list {cond_type "normal"} gid_groups_conds::addF $block_path value [list n ${inName}$i wn [concat $n "_$i"] pn "$i ${pn}" v $v1 state hidden] } } - + } elseif { $type eq "combo" } { set values [join [$in getValues] ","] gid_groups_conds::addF $block_path value [list n $inName pn $pn v $v1 values $values state $state help $help] @@ -528,7 +554,7 @@ proc PfemFluid::xml::_injectCondsToTree {basenode cond_list {cond_type "normal"} set fname "function_$inName" set nodev "../value\[@n='$inName'\]" set nodef "../value\[@n='$fname'\]" - + set valNode [gid_groups_conds::addF $block_path value [list n ByFunction pn "by function -> f(x,y,z,t)" v No values "Yes,No" actualize_tree 1]] gid_groups_conds::addF [$valNode toXPath] dependencies [list value No node $nodev att1 state v1 normal] gid_groups_conds::addF [$valNode toXPath] dependencies [list value Yes node $nodev att1 state v1 hidden] @@ -540,7 +566,7 @@ proc PfemFluid::xml::_injectCondsToTree {basenode cond_list {cond_type "normal"} gid_groups_conds::addF $block_path value [list n $inName pn $pn v $v units $units unit_magnitude $um help $help] } } - + set CondUsesIntervals [$cnd getAttribute "Interval"] if {$AppUsesIntervals && $CondUsesIntervals ne "False"} { gid_groups_conds::addF $block_path value [list n Interval pn "Time interval" v $CondUsesIntervals values {[getIntervals]} help $help] @@ -557,7 +583,7 @@ proc PfemFluid::xml::ProcCheckStateBoundingBox3Dimension {domNode args} { set checkvalue [split [lindex $arglist 1] ","] set pst [$domNode selectNodes $xpath] #W "xpath $xpath checkvalue $checkvalue pst $pst" - if {$pst in $checkvalue} { set state 1} + if {$pst in $checkvalue} { set state 1} if {$state} { set checkdim "3D" @@ -566,5 +592,3 @@ proc PfemFluid::xml::ProcCheckStateBoundingBox3Dimension {domNode args} { } if {$state} {return "normal"} else {return "hidden"} } - -PfemFluid::xml::Init diff --git a/kratos.gid/apps/PfemLauncher/app.json b/kratos.gid/apps/PfemLauncher/app.json new file mode 100644 index 000000000..1a10a5680 --- /dev/null +++ b/kratos.gid/apps/PfemLauncher/app.json @@ -0,0 +1,18 @@ +{ + "id": "Pfem Launcher", + "name": "Pfem", + "script_files": [ + "start.tcl" + ], + "start_script":"::PfemLauncher::Init", + "requeriments":{ + "apps_exist":["PfemFluid", "DEMPFEM", "PfemThermic"], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": false, + "show_toolbar": true, + "intervals": false, + "wizard": false + } +} diff --git a/kratos.gid/apps/PfemLauncher/start.tcl b/kratos.gid/apps/PfemLauncher/start.tcl index 4eee5af88..e94b55f93 100644 --- a/kratos.gid/apps/PfemLauncher/start.tcl +++ b/kratos.gid/apps/PfemLauncher/start.tcl @@ -1,12 +1,13 @@ namespace eval ::PfemLauncher { + Kratos::AddNamespace [namespace current] + variable available_apps } -proc ::PfemLauncher::Init { } { +proc ::PfemLauncher::Init { app } { variable available_apps - set available_apps [list Pfem PfemFluid DEMPFEM] - set available_apps [list PfemFluid DEMPFEM] + set available_apps [list PfemFluid DEMPFEM PfemThermic] # Allow to open the tree set ::spdAux::TreeVisibility 0 @@ -15,7 +16,6 @@ proc ::PfemLauncher::Init { } { proc ::PfemLauncher::AppSelectorWindow { } { variable available_apps - set initwind $::spdAux::initwind set root [customlib::GetBaseRoot] set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v] @@ -26,10 +26,9 @@ proc ::PfemLauncher::AppSelectorWindow { } { } { [$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait - set initwind .gid.win_example - if { [ winfo exist $initwind]} { - destroy $initwind - } + set initwind $::spdAux::application_window_id + spdAux::DestroyWindows + spdAux::RegisterWindow $initwind toplevel $initwind wm withdraw $initwind @@ -46,21 +45,28 @@ proc ::PfemLauncher::AppSelectorWindow { } { ttk::frame $w.top ttk::label $w.top.title_text -text [_ "Select a pfem application"] - ttk::frame $w.information -relief ridge + ttk::frame $w.applications -relief ridge set i 0 foreach app $available_apps { set img [::apps::getImgFrom $app] set app_publicname [[::apps::getAppById $app] getPublicName] - set but [ttk::button $w.information.img$app -image $img -command [list ::PfemLauncher::ChangeAppTo $app] ] - ttk::label $w.information.text$app -text $app_publicname - grid $w.information.img$app -column $i -row 0 - grid $w.information.text$app -column $i -row 1 + set but [ttk::button $w.applications.img$app -image $img -command [list ::PfemLauncher::ChangeAppTo $app] ] + bind $w.applications.img$app {::spdAux::PlaceInformationWindowByPath %W applications} + ttk::label $w.applications.text$app -text $app_publicname + grid $w.applications.img$app -column $i -row 0 + grid $w.applications.text$app -column $i -row 1 incr i } grid $w.top grid $w.top.title_text + grid $w.applications - grid $w.information + # Information panel + set spdAux::info_main_window_text "" + ttk::labelframe $w.info -text " Information " -relief ridge + ttk::label $w.info.text -textvariable spdAux::info_main_window_text + grid $w.info.text + grid $w.info -sticky we } } @@ -69,5 +75,3 @@ proc ::PfemLauncher::ChangeAppTo {appid} { spdAux::SetSpatialDimmension undefined apps::setActiveApp $appid } - -::PfemLauncher::Init diff --git a/kratos.gid/apps/PfemThermic/app.json b/kratos.gid/apps/PfemThermic/app.json new file mode 100644 index 000000000..a754e36e5 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/app.json @@ -0,0 +1,50 @@ +{ + "id": "PfemThermic", + "name": "Pfem Thermic", + "prefix": "PFEMTHERMIC_", + "themed": true, + "kratos_name": "PfemThermicDynamicsApplication", + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/ThermicSloshing.tcl", + "examples/ThermicConvection.tcl", + "examples/ThermicSloshingConvection.tcl", + "examples/ThermicDamBreakFSI.tcl", + "examples/ThermicCubeDrop.tcl", + "examples/ThermicFluidDrop.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script":"::PfemThermic::Init", + "requeriments":{ + "apps":["PfemFluid", "ConvectionDiffusion"], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false, + "import_files":true + }, + "unique_names": { + "nodal_conditions": "PFEMFLUID_NodalConditions", + "materials": "PFEMFLUID_Materials", + "results": "Results", + "time_parameters": "PFEMFLUID_TimeParameters" + }, + "write": { + "coordinates": "all", + "materials_file": "PFEMFluidMaterials.json", + "properties_location": "json", + "model_part_name": "PfemFluidModelPart" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} diff --git a/kratos.gid/apps/PfemThermic/examples/ThermicConvection.tcl b/kratos.gid/apps/PfemThermic/examples/ThermicConvection.tcl new file mode 100644 index 000000000..d984ccdee --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/ThermicConvection.tcl @@ -0,0 +1,171 @@ +namespace eval ::PfemThermic::examples::ThermicConvection { + namespace path ::PfemThermic::examples + Kratos::AddNamespace [namespace current] + +} +proc ::PfemThermic::examples::ThermicConvection::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + + Kratos::ResetModel + DrawGeometry + AssignGroups + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame +} + +# Draw Geometry +proc PfemThermic::examples::ThermicConvection::DrawGeometry {args} { + ## Layer ## + set layer PfemThermic + GiD_Layers create $layer + GiD_Layers edit to_use $layer + + ## Points ## + set points [list -0.5 -0.5 0.0 0.5 -0.5 0.0 0.5 0.5 0.0 -0.5 0.5 0.0] + foreach {x y z} $points { + GiD_Geometry create point append $layer $x $y $z + } + + ## Lines ## + set lines [list 1 2 2 3 3 4 4 1] + foreach {p1 p2} $lines { + GiD_Geometry create line append stline $layer $p1 $p2 + } + + ## Surface ## + GiD_Process Mescape Geometry Create NurbsSurface 1 2 3 4 escape escape +} + +# Group assign +proc PfemThermic::examples::ThermicConvection::AssignGroups {args} { + GiD_Groups create Fluid + GiD_Groups edit color Fluid "#26d1a8ff" + GiD_EntitiesGroups assign Fluid surfaces 1 + + GiD_Groups create Bottom_Wall + GiD_Groups edit color Bottom_Wall "#3b3b3bff" + GiD_EntitiesGroups assign Bottom_Wall lines {1} + + GiD_Groups create Right_Wall + GiD_Groups edit color Right_Wall "#42eb71ff" + GiD_EntitiesGroups assign Right_Wall lines {2} + + GiD_Groups create Top_Wall + GiD_Groups edit color Top_Wall "#3b3b3bff" + GiD_EntitiesGroups assign Top_Wall lines {3} + + GiD_Groups create Left_Wall + GiD_Groups edit color Left_Wall "#e0210fff" + GiD_EntitiesGroups assign Left_Wall lines {4} + +} + +# Tree assign +proc PfemThermic::examples::ThermicConvection::TreeAssignation {args} { + # Physics + spdAux::SetValueOnTreeItem v "Fluids" PFEMFLUID_DomainType + + # Create bodies + set bodies_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='Body1'\]" + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[2\]" {name FluidBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[3\]" {name BottomWallBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[4\]" {name RightWallBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[5\]" {name TopWallBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[6\]" {name LeftWallBody} + gid_groups_conds::setAttributesF $bodies_xpath {state hidden} + + # Fluid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/value\[@n='BodyType'\]" {v Fluid} + set fluid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/condition\[@n='Parts'\]" + set fluidNode [customlib::AddConditionGroupOnXPath $fluid_part_xpath Fluid] + set props [list ConstitutiveLaw NewtonianTemperatureDependent2DLaw DENSITY 1000 CONDUCTIVITY 2000.0 SPECIFIC_HEAT 4000 DYNAMIC_VISCOSITY 0.01 BULK_MODULUS 1000000000] + spdAux::SetValuesOnBaseNode $fluidNode $props + # Add table + set filePath [file join [file join [apps::getMyDir "PfemThermic"] examples] tables] + set fileName ThermicConvection_DENSITY.txt + set fullName [file join $filePath $fileName] + spdAux::UpdateFileField $fullName [$fluidNode selectNodes "./value\[@n = 'TEMPERATURE_vs_DENSITY'\]"] + + # Rigid bodies + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='BottomWallBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='BottomWallBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='BottomWallBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Bottom_Wall] + $rigidNode setAttribute ov line + + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RightWallBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RightWallBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RightWallBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Right_Wall] + $rigidNode setAttribute ov line + + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='TopWallBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='TopWallBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='TopWallBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Top_Wall] + $rigidNode setAttribute ov line + + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='LeftWallBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='LeftWallBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='LeftWallBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Left_Wall] + $rigidNode setAttribute ov line + + # Velocity BC + set fixVelocity "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='VELOCITY'\]" + [customlib::AddConditionGroupOnXPath $fixVelocity "Bottom_Wall"] setAttribute ov line + [customlib::AddConditionGroupOnXPath $fixVelocity "Right_Wall"] setAttribute ov line + [customlib::AddConditionGroupOnXPath $fixVelocity "Top_Wall"] setAttribute ov line + [customlib::AddConditionGroupOnXPath $fixVelocity "Left_Wall"] setAttribute ov line + + # Temperature BC + set fixTemperature "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='TEMPERATURE'\]" + + set fixTemperatureNode [customlib::AddConditionGroupOnXPath $fixTemperature "Right_Wall"] + set props [list value 372.65 Interval Total constrained 1] + $fixTemperatureNode setAttribute ov line + spdAux::SetValuesOnBaseNode $fixTemperatureNode $props + + set fixTemperatureNode [customlib::AddConditionGroupOnXPath $fixTemperature "Left_Wall"] + set props [list value 373.65 Interval Total constrained 1] + $fixTemperatureNode setAttribute ov line + spdAux::SetValuesOnBaseNode $fixTemperatureNode $props + + # Temperature IC + set thermalICnode [customlib::AddConditionGroupOnXPath $fixTemperature "Fluid"] + set props [list value 373.15 Interval Initial constrained 1] + $thermalICnode setAttribute ov surface + spdAux::SetValuesOnBaseNode $thermalICnode $props + + # Time parameters + set time_parameters [list StartTime 0.0 EndTime 10.0 DeltaTime 0.005 UseAutomaticDeltaTime No] + set time_params_path [spdAux::getRoute "PFEMFLUID_TimeParameters"] + spdAux::SetValuesOnBasePath $time_params_path $time_parameters + + # Parallelism + set parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 1] + set xpath [spdAux::getRoute "Parallelization"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Output + set parameters [list OutputControlType time OutputDeltaTime 0.01] + set xpath [spdAux::getRoute "Results"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Others + spdAux::SetValueOnTreeItem values transient CNVDFFSolStrat + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/PfemThermic/examples/ThermicCubeDrop.tcl b/kratos.gid/apps/PfemThermic/examples/ThermicCubeDrop.tcl new file mode 100644 index 000000000..e57c2b706 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/ThermicCubeDrop.tcl @@ -0,0 +1,168 @@ +namespace eval ::PfemThermic::examples::ThermicCubeDrop { + namespace path ::PfemThermic::examples + Kratos::AddNamespace [namespace current] + +} +proc ::PfemThermic::examples::ThermicCubeDrop::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + + Kratos::ResetModel + DrawGeometry + AssignGroups + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame +} + +# Draw Geometry +proc PfemThermic::examples::ThermicCubeDrop::DrawGeometry {args} { + ## Layer ## + set layer PfemThermic + GiD_Layers create $layer + GiD_Layers edit to_use $layer + + ## Points ## + set points_fluid [list 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.5 0.0 0.0 0.5 0.0] + foreach {x y z} $points_fluid { + GiD_Geometry create point append $layer $x $y $z + } + set points_solid [list 0.35 0.7 0.0 0.65 0.7 0.0 0.65 1.0 0.0 0.35 1.0 0.0] + foreach {x y z} $points_solid { + GiD_Geometry create point append $layer $x $y $z + } + set points_rigid [list 0.0 1.2 0.0 1.0 1.2 0.0 ] + foreach {x y z} $points_rigid { + GiD_Geometry create point append $layer $x $y $z + } + + ## Lines ## + set lines_fluid [list 1 2 2 3 3 4 4 1] + foreach {p1 p2} $lines_fluid { + GiD_Geometry create line append stline $layer $p1 $p2 + } + set lines_solid [list 5 6 6 7 7 8 8 5] + foreach {p1 p2} $lines_solid { + GiD_Geometry create line append stline $layer $p1 $p2 + } + set lines_rigid [list 4 9 9 10 10 3] + foreach {p1 p2} $lines_rigid { + GiD_Geometry create line append stline $layer $p1 $p2 + } + + ## Surface ## + GiD_Process Mescape Geometry Create NurbsSurface 2 3 4 1 escape escape + GiD_Process Mescape Geometry Create NurbsSurface 5 6 7 8 escape escape +} + +# Group assign +proc PfemThermic::examples::ThermicCubeDrop::AssignGroups {args} { + GiD_Groups create Fluid + GiD_Groups edit color Fluid "#26d1a8ff" + GiD_EntitiesGroups assign Fluid surfaces 1 + + GiD_Groups create Solid + GiD_Groups edit color Solid "#3b3b3bff" + GiD_EntitiesGroups assign Solid surfaces 2 + + GiD_Groups create Interface + GiD_Groups edit color Interface "#e0210fff" + GiD_EntitiesGroups assign Interface lines {5 6 7 8} + + GiD_Groups create Rigid_Walls + GiD_Groups edit color Rigid_Walls "#42eb71ff" + GiD_EntitiesGroups assign Rigid_Walls lines {1 2 4 9 10 11} +} + +# Tree assign +proc PfemThermic::examples::ThermicCubeDrop::TreeAssignation {args} { + # Physics + gid_groups_conds::setAttributesF [spdAux::getRoute PFEMFLUID_DomainType] {v FSI} + + # Create bodies + set bodies_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='Body1'\]" + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[2\]" {name FluidBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[3\]" {name SolidBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[4\]" {name InterfaceBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[5\]" {name RigidWallsBody} + gid_groups_conds::setAttributesF $bodies_xpath {state hidden} + + # Fluid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/value\[@n='BodyType'\]" {v Fluid} + set fluid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/condition\[@n='Parts'\]" + set fluidNode [customlib::AddConditionGroupOnXPath $fluid_part_xpath Fluid] + set props [list ConstitutiveLaw NewtonianTemperatureDependent2DLaw DENSITY 1000 CONDUCTIVITY 5000 SPECIFIC_HEAT 1000 DYNAMIC_VISCOSITY 0.01 BULK_MODULUS 1000000000] + spdAux::SetValuesOnBaseNode $fluidNode $props + + # Solid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='SolidBody'\]/value\[@n='BodyType'\]" {v Solid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='SolidBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set solid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='SolidBody'\]/condition\[@n='Parts'\]" + set solidNode [customlib::AddConditionGroupOnXPath $solid_part_xpath Solid] + set props [list Element UpdatedLagrangianVSolidElement2D ConstitutiveLaw Hypoelastic DENSITY 700 YOUNG_MODULUS 1000000 POISSON_RATIO 0 CONDUCTIVITY 10 SPECIFIC_HEAT 1000] + spdAux::SetValuesOnBaseNode $solidNode $props + + # Interface body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/value\[@n='BodyType'\]" {v Interface} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set interface_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/condition\[@n='Parts'\]" + set interfaceNode [customlib::AddConditionGroupOnXPath $interface_part_xpath Interface] + $interfaceNode setAttribute ov line + + # Rigid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidWallsBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidWallsBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidWallsBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Rigid_Walls] + $rigidNode setAttribute ov line + + # Velocity BC + set fixVelocity "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='VELOCITY'\]" + [customlib::AddConditionGroupOnXPath $fixVelocity "Rigid_Walls"] setAttribute ov line + + # Temperature BC + set fixTemperature "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='TEMPERATURE'\]" + set fixTemperatureNode [customlib::AddConditionGroupOnXPath $fixTemperature "Rigid_Walls"] + set props [list value 300.00 Interval Total constrained 1] + $fixTemperatureNode setAttribute ov line + spdAux::SetValuesOnBaseNode $fixTemperatureNode $props + + # Temperature IC + set thermalFluidICnode [customlib::AddConditionGroupOnXPath $fixTemperature "Fluid"] + set thermalSolidICnode [customlib::AddConditionGroupOnXPath $fixTemperature "Solid"] + set fluidProps [list value 300.00 Interval Initial constrained 1] + set solidProps [list value 380.00 Interval Initial constrained 1] + $thermalFluidICnode setAttribute ov surface + $thermalSolidICnode setAttribute ov surface + spdAux::SetValuesOnBaseNode $thermalFluidICnode $fluidProps + spdAux::SetValuesOnBaseNode $thermalSolidICnode $solidProps + + # Time parameters + set time_parameters [list StartTime 0.0 EndTime 5.0 DeltaTime 0.001 UseAutomaticDeltaTime No] + set time_params_path [spdAux::getRoute "PFEMFLUID_TimeParameters"] + spdAux::SetValuesOnBasePath $time_params_path $time_parameters + + # Parallelism + set parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 1] + set xpath [spdAux::getRoute "Parallelization"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Output + set parameters [list OutputControlType time OutputDeltaTime 0.01] + set xpath [spdAux::getRoute "Results"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Others + spdAux::SetValueOnTreeItem values transient CNVDFFSolStrat + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/PfemThermic/examples/ThermicDamBreakFSI.tcl b/kratos.gid/apps/PfemThermic/examples/ThermicDamBreakFSI.tcl new file mode 100644 index 000000000..134556641 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/ThermicDamBreakFSI.tcl @@ -0,0 +1,169 @@ +namespace eval ::PfemThermic::examples::ThermicDamBreakFSI { + namespace path ::PfemThermic::examples + Kratos::AddNamespace [namespace current] + +} +proc ::PfemThermic::examples::ThermicDamBreakFSI::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + + Kratos::ResetModel + DrawGeometry + AssignGroups + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame +} + +# Draw Geometry +proc PfemThermic::examples::ThermicDamBreakFSI::DrawGeometry {args} { + ## Layer ## + set layer PfemThermic + GiD_Layers create $layer + GiD_Layers edit to_use $layer + + ## Points ## + set points_fluid [list 0 0 0 0.146 0 0 0.146 0.350 0 0 0.350 0] + foreach {x y z} $points_fluid { + GiD_Geometry create point append $layer $x $y $z + } + set points_solid [list 0.360 0 0 0.360 0.10 0 0.330 0.10 0 0.330 0 0] + foreach {x y z} $points_solid { + GiD_Geometry create point append $layer $x $y $z + } + set points_rigid [list 0 0.596 0 0.596 0.596 0 0.596 0 0 ] + foreach {x y z} $points_rigid { + GiD_Geometry create point append $layer $x $y $z + } + + ## Lines ## + set lines_fluid [list 1 2 2 3 3 4 4 1] + foreach {p1 p2} $lines_fluid { + GiD_Geometry create line append stline $layer $p1 $p2 + } + set lines_solid [list 5 6 6 7 7 8 8 5] + foreach {p1 p2} $lines_solid { + GiD_Geometry create line append stline $layer $p1 $p2 + } + set lines_rigid [list 4 9 9 10 10 11 11 5 8 2] + foreach {p1 p2} $lines_rigid { + GiD_Geometry create line append stline $layer $p1 $p2 + } + + ## Surface ## + GiD_Process Mescape Geometry Create NurbsSurface 2 3 4 1 escape escape + GiD_Process Mescape Geometry Create NurbsSurface 5 6 7 8 escape escape +} + +# Group assign +proc PfemThermic::examples::ThermicDamBreakFSI::AssignGroups {args} { + GiD_Groups create Fluid + GiD_Groups edit color Fluid "#26d1a8ff" + GiD_EntitiesGroups assign Fluid surfaces 1 + + GiD_Groups create Solid + GiD_Groups edit color Solid "#3b3b3bff" + GiD_EntitiesGroups assign Solid surfaces 2 + + GiD_Groups create Interface + GiD_Groups edit color Interface "#e0210fff" + GiD_EntitiesGroups assign Interface lines {5 6 7} + + GiD_Groups create Rigid_Walls + GiD_Groups edit color Rigid_Walls "#42eb71ff" + GiD_EntitiesGroups assign Rigid_Walls lines {1 4 9 10 11 12 13} + +} + +# Tree assign +proc PfemThermic::examples::ThermicDamBreakFSI::TreeAssignation {args} { + # Physics + gid_groups_conds::setAttributesF [spdAux::getRoute PFEMFLUID_DomainType] {v FSI} + + # Create bodies + set bodies_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='Body1'\]" + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[2\]" {name FluidBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[3\]" {name SolidBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[4\]" {name InterfaceBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[5\]" {name RigidWallsBody} + gid_groups_conds::setAttributesF $bodies_xpath {state hidden} + + # Fluid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/value\[@n='BodyType'\]" {v Fluid} + set fluid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/condition\[@n='Parts'\]" + set fluidNode [customlib::AddConditionGroupOnXPath $fluid_part_xpath Fluid] + set props [list ConstitutiveLaw NewtonianTemperatureDependent2DLaw DENSITY 1000 CONDUCTIVITY 5000 SPECIFIC_HEAT 5000 DYNAMIC_VISCOSITY 0.01 BULK_MODULUS 1000000000] + spdAux::SetValuesOnBaseNode $fluidNode $props + + # Solid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='SolidBody'\]/value\[@n='BodyType'\]" {v Solid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='SolidBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set solid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='SolidBody'\]/condition\[@n='Parts'\]" + set solidNode [customlib::AddConditionGroupOnXPath $solid_part_xpath Solid] + set props [list Element UpdatedLagrangianVSolidElement2D ConstitutiveLaw Hypoelastic DENSITY 2500 YOUNG_MODULUS 1000000 POISSON_RATIO 0 CONDUCTIVITY 10 SPECIFIC_HEAT 1000] + spdAux::SetValuesOnBaseNode $solidNode $props + + # Interface body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/value\[@n='BodyType'\]" {v Interface} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set interface_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/condition\[@n='Parts'\]" + set interfaceNode [customlib::AddConditionGroupOnXPath $interface_part_xpath Interface] + $interfaceNode setAttribute ov line + + # Rigid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidWallsBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidWallsBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidWallsBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Rigid_Walls] + $rigidNode setAttribute ov line + + # Velocity BC + set fixVelocity "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='VELOCITY'\]" + [customlib::AddConditionGroupOnXPath $fixVelocity "Rigid_Walls"] setAttribute ov line + + # Temperature BC + set fixTemperature "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='TEMPERATURE'\]" + set fixTemperatureNode [customlib::AddConditionGroupOnXPath $fixTemperature "Rigid_Walls"] + set props [list value 330.00 Interval Total constrained 1] + $fixTemperatureNode setAttribute ov line + spdAux::SetValuesOnBaseNode $fixTemperatureNode $props + + # Temperature IC + set thermalFluidICnode [customlib::AddConditionGroupOnXPath $fixTemperature "Fluid"] + set thermalSolidICnode [customlib::AddConditionGroupOnXPath $fixTemperature "Solid"] + set fluidProps [list value 273.15 Interval Initial constrained 1] + set solidProps [list value 373.15 Interval Initial constrained 1] + $thermalFluidICnode setAttribute ov surface + $thermalSolidICnode setAttribute ov surface + spdAux::SetValuesOnBaseNode $thermalFluidICnode $fluidProps + spdAux::SetValuesOnBaseNode $thermalSolidICnode $solidProps + + # Time parameters + set time_parameters [list StartTime 0.0 EndTime 5.0 DeltaTime 0.001 UseAutomaticDeltaTime No] + set time_params_path [spdAux::getRoute "PFEMFLUID_TimeParameters"] + spdAux::SetValuesOnBasePath $time_params_path $time_parameters + + # Parallelism + set parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 1] + set xpath [spdAux::getRoute "Parallelization"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Output + set parameters [list OutputControlType time OutputDeltaTime 0.01] + set xpath [spdAux::getRoute "Results"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Others + spdAux::SetValueOnTreeItem values transient CNVDFFSolStrat + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/PfemThermic/examples/ThermicFluidDrop.tcl b/kratos.gid/apps/PfemThermic/examples/ThermicFluidDrop.tcl new file mode 100644 index 000000000..43364a23a --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/ThermicFluidDrop.tcl @@ -0,0 +1,143 @@ +namespace eval ::PfemThermic::examples::ThermicFluidDrop { + namespace path ::PfemThermic::examples + Kratos::AddNamespace [namespace current] + +} +proc ::PfemThermic::examples::ThermicFluidDrop::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + + Kratos::ResetModel + DrawGeometry + AssignGroups + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame +} + +# Draw Geometry +proc PfemThermic::examples::ThermicFluidDrop::DrawGeometry {args} { + ## Layer ## + set layer PfemThermic + GiD_Layers create $layer + GiD_Layers edit to_use $layer + + ## Points ## + set points_solid [list 0.00 1.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 1.00 1.00 0.00 0.90 1.00 0.00 0.90 0.10 0.00 0.10 0.10 0.00 0.10 1.00 0.00] + foreach {x y z} $points_solid { + GiD_Geometry create point append $layer $x $y $z + } + set points_fluid [list 0.25 0.15 0.00 0.75 0.15 0.00 0.75 0.65 0.00 0.25 0.65 0.00] + foreach {x y z} $points_fluid { + GiD_Geometry create point append $layer $x $y $z + } + + ## Lines ## + set lines_solid [list 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 1] + foreach {p1 p2} $lines_solid { + GiD_Geometry create line append stline $layer $p1 $p2 + } + set lines_fluid [list 9 10 10 11 11 12 12 9] + foreach {p1 p2} $lines_fluid { + GiD_Geometry create line append stline $layer $p1 $p2 + } + + ## Surface ## + GiD_Process Mescape Geometry Create NurbsSurface 9 10 11 12 escape escape + GiD_Process Mescape Geometry Create NurbsSurface 1 2 3 4 5 6 7 8 escape escape +} + +# Group assign +proc PfemThermic::examples::ThermicFluidDrop::AssignGroups {args} { + GiD_Groups create Fluid + GiD_Groups edit color Fluid "#26d1a8ff" + GiD_EntitiesGroups assign Fluid surfaces 1 + + GiD_Groups create Solid + GiD_Groups edit color Solid "#3b3b3bff" + GiD_EntitiesGroups assign Solid surfaces 2 + + GiD_Groups create Interface + GiD_Groups edit color Interface "#e0210fff" + GiD_EntitiesGroups assign Interface lines {1 2 3 4 5 6 7 8} +} + +# Tree assign +proc PfemThermic::examples::ThermicFluidDrop::TreeAssignation {args} { + # Physics + gid_groups_conds::setAttributesF [spdAux::getRoute PFEMFLUID_DomainType] {v FSI} + + # Create bodies + set bodies_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='Body1'\]" + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[2\]" {name FluidBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[3\]" {name SolidBody} + + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[4\]" {name InterfaceBody} + + gid_groups_conds::setAttributesF $bodies_xpath {state hidden} + + # Fluid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/value\[@n='BodyType'\]" {v Fluid} + set fluid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/condition\[@n='Parts'\]" + set fluidNode [customlib::AddConditionGroupOnXPath $fluid_part_xpath Fluid] + set props [list ConstitutiveLaw NewtonianTemperatureDependent2DLaw DENSITY 1000 CONDUCTIVITY 5000 SPECIFIC_HEAT 100 DYNAMIC_VISCOSITY 0.01 BULK_MODULUS 1000000000] + spdAux::SetValuesOnBaseNode $fluidNode $props + + # Solid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='SolidBody'\]/value\[@n='BodyType'\]" {v Solid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='SolidBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set solid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='SolidBody'\]/condition\[@n='Parts'\]" + set solidNode [customlib::AddConditionGroupOnXPath $solid_part_xpath Solid] + set props [list Element UpdatedLagrangianVSolidElement2D ConstitutiveLaw Hypoelastic DENSITY 2500 YOUNG_MODULUS 1000000 POISSON_RATIO 0 CONDUCTIVITY 7000 SPECIFIC_HEAT 100] + spdAux::SetValuesOnBaseNode $solidNode $props + + # Interface body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/value\[@n='BodyType'\]" {v Interface} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set interface_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='InterfaceBody'\]/condition\[@n='Parts'\]" + set interfaceNode [customlib::AddConditionGroupOnXPath $interface_part_xpath Interface] + $interfaceNode setAttribute ov line + + # Velocity BC + set fixSurfaceVelocity "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='VELOCITY'\]" + [customlib::AddConditionGroupOnXPath $fixSurfaceVelocity "Interface"] setAttribute ov line + + # Temperature IC + set InitTemperature "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='TEMPERATURE'\]" + set thermalFluidICnode [customlib::AddConditionGroupOnXPath $InitTemperature "Fluid"] + set thermalSolidICnode [customlib::AddConditionGroupOnXPath $InitTemperature "Solid"] + set fluidProps [list value 310.00 Interval Initial constrained 1] + set solidProps [list value 290.00 Interval Initial constrained 1] + $thermalFluidICnode setAttribute ov surface + $thermalSolidICnode setAttribute ov surface + spdAux::SetValuesOnBaseNode $thermalFluidICnode $fluidProps + spdAux::SetValuesOnBaseNode $thermalSolidICnode $solidProps + + # Time parameters + set time_parameters [list StartTime 0.0 EndTime 5.0 DeltaTime 0.001 UseAutomaticDeltaTime No] + set time_params_path [spdAux::getRoute "PFEMFLUID_TimeParameters"] + spdAux::SetValuesOnBasePath $time_params_path $time_parameters + + # Parallelism + set parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 1] + set xpath [spdAux::getRoute "Parallelization"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Output + set parameters [list OutputControlType time OutputDeltaTime 0.01] + set xpath [spdAux::getRoute "Results"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Others + spdAux::SetValueOnTreeItem values transient CNVDFFSolStrat + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/PfemThermic/examples/ThermicSloshing.tcl b/kratos.gid/apps/PfemThermic/examples/ThermicSloshing.tcl new file mode 100644 index 000000000..6fa06c02e --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/ThermicSloshing.tcl @@ -0,0 +1,130 @@ +namespace eval ::PfemThermic::examples::ThermicSloshing { + namespace path ::PfemThermic::examples + Kratos::AddNamespace [namespace current] + +} +proc ::PfemThermic::examples::ThermicSloshing::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + + Kratos::ResetModel + DrawGeometry + AssignGroups + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame +} + +# Draw Geometry +proc PfemThermic::examples::ThermicSloshing::DrawGeometry {args} { + ## Layer ## + set layer PfemThermic + GiD_Layers create $layer + GiD_Layers edit to_use $layer + + ## Points ## + set points_inner [list 0 0 0 1.0 0 0 1.0 0.3 0 0 0.7 0] + foreach {x y z} $points_inner { + GiD_Geometry create point append $layer $x $y $z + } + set points_outer [list 0 1.0 0 1.0 1.0 0] + foreach {x y z} $points_outer { + GiD_Geometry create point append $layer $x $y $z + } + + ## Lines ## + set lines_inner [list 1 2 2 3 3 4 4 1] + foreach {p1 p2} $lines_inner { + GiD_Geometry create line append stline $layer $p1 $p2 + } + set lines_outer [list 4 5 5 6 6 3] + foreach {p1 p2} $lines_outer { + GiD_Geometry create line append stline $layer $p1 $p2 + } + + ## Surface ## + GiD_Process Mescape Geometry Create NurbsSurface 2 3 4 1 escape escape +} + +# Group assign +proc PfemThermic::examples::ThermicSloshing::AssignGroups {args} { + GiD_Groups create Fluid + GiD_Groups edit color Fluid "#26d1a8ff" + GiD_EntitiesGroups assign Fluid surfaces 1 + + GiD_Groups create Rigid_Walls + GiD_Groups edit color Rigid_Walls "#3b3b3bff" + GiD_EntitiesGroups assign Rigid_Walls lines {1 2 4 5 6 7} + +} + +# Tree assign +proc PfemThermic::examples::ThermicSloshing::TreeAssignation {args} { + # Physics + spdAux::SetValueOnTreeItem v "Fluids" PFEMFLUID_DomainType + + # Create bodies + set bodies_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='Body1'\]" + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[2\]" {name FluidBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[3\]" {name RigidWallsBody} + gid_groups_conds::setAttributesF $bodies_xpath {state hidden} + + # Fluid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/value\[@n='BodyType'\]" {v Fluid} + set fluid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/condition\[@n='Parts'\]" + set fluidNode [customlib::AddConditionGroupOnXPath $fluid_part_xpath Fluid] + set props [list ConstitutiveLaw NewtonianTemperatureDependent2DLaw DENSITY 1000 CONDUCTIVITY 2000.0 SPECIFIC_HEAT 4000 DYNAMIC_VISCOSITY 0.01 BULK_MODULUS 1000000000] + spdAux::SetValuesOnBaseNode $fluidNode $props + + # Rigid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidWallsBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidWallsBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RigidWallsBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Rigid_Walls] + $rigidNode setAttribute ov line + + # Velocity BC + set fixVelocity "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='VELOCITY'\]" + set fixVelocityNode [customlib::AddConditionGroupOnXPath $fixVelocity "Rigid_Walls"] + $fixVelocityNode setAttribute ov line + + # Temperature BC + set fixTemperature "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='TEMPERATURE'\]" + set fixTemperatureNode [customlib::AddConditionGroupOnXPath $fixTemperature "Rigid_Walls"] + $fixTemperatureNode setAttribute ov line + set props [list value 338.15 Interval Total constrained 1] + spdAux::SetValuesOnBaseNode $fixTemperatureNode $props + + # Temperature IC + set thermalICnode [customlib::AddConditionGroupOnXPath $fixTemperature "Fluid"] + $thermalICnode setAttribute ov surface + set props [list value 293.15 Interval Initial constrained 1] + spdAux::SetValuesOnBaseNode $thermalICnode $props + + # Time parameters + set time_parameters [list StartTime 0.0 EndTime 10.0 DeltaTime 0.005 UseAutomaticDeltaTime No] + set time_params_path [spdAux::getRoute "PFEMFLUID_TimeParameters"] + spdAux::SetValuesOnBasePath $time_params_path $time_parameters + + # Parallelism + set parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 1] + set xpath [spdAux::getRoute "Parallelization"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Output + set parameters [list OutputControlType time OutputDeltaTime 0.01] + set xpath [spdAux::getRoute "Results"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Others + spdAux::SetValueOnTreeItem values transient CNVDFFSolStrat + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/PfemThermic/examples/ThermicSloshingConvection.tcl b/kratos.gid/apps/PfemThermic/examples/ThermicSloshingConvection.tcl new file mode 100644 index 000000000..762ad2325 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/ThermicSloshingConvection.tcl @@ -0,0 +1,189 @@ +namespace eval ::PfemThermic::examples::ThermicSloshingConvection { + namespace path ::PfemThermic::examples + Kratos::AddNamespace [namespace current] + +} +proc ::PfemThermic::examples::ThermicSloshingConvection::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + + Kratos::ResetModel + DrawGeometry + AssignGroups + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame +} + +# Draw Geometry +proc PfemThermic::examples::ThermicSloshingConvection::DrawGeometry {args} { + ## Layer ## + set layer PfemThermic + GiD_Layers create $layer + GiD_Layers edit to_use $layer + + ## Points ## + set points_inner [list 0 0 0 1.0 0 0 1.0 0.3 0 0 0.7 0] + foreach {x y z} $points_inner { + GiD_Geometry create point append $layer $x $y $z + } + set points_outer [list 0 1.0 0 1.0 1.0 0] + foreach {x y z} $points_outer { + GiD_Geometry create point append $layer $x $y $z + } + + ## Lines ## + set lines_inner [list 1 2 2 3 3 4 4 1] + foreach {p1 p2} $lines_inner { + GiD_Geometry create line append stline $layer $p1 $p2 + } + set lines_outer [list 4 5 5 6 6 3] + foreach {p1 p2} $lines_outer { + GiD_Geometry create line append stline $layer $p1 $p2 + } + + ## Surface ## + GiD_Process Mescape Geometry Create NurbsSurface 2 3 4 1 escape escape +} + +# Group assign +proc PfemThermic::examples::ThermicSloshingConvection::AssignGroups {args} { + GiD_Groups create Fluid + GiD_Groups edit color Fluid "#26d1a8ff" + GiD_EntitiesGroups assign Fluid surfaces 1 + + GiD_Groups create Bottom_Wall + GiD_Groups edit color Bottom_Wall "#3b3b3bff" + GiD_EntitiesGroups assign Bottom_Wall lines {1} + + GiD_Groups create Top_Wall + GiD_Groups edit color Top_Wall "#3b3b3bff" + GiD_EntitiesGroups assign Top_Wall lines {6} + + GiD_Groups create Right_Wall + GiD_Groups edit color Right_Wall "#e0210fff" + GiD_EntitiesGroups assign Right_Wall lines {2 7} + + GiD_Groups create Left_Wall + GiD_Groups edit color Left_Wall "#e0210fff" + GiD_EntitiesGroups assign Left_Wall lines {4 5} + +} + +# Tree assign +proc PfemThermic::examples::ThermicSloshingConvection::TreeAssignation {args} { + # Physics + spdAux::SetValueOnTreeItem v "Fluids" PFEMFLUID_DomainType + + # Create bodies + set bodies_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='Body1'\]" + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[2\]" {name FluidBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[3\]" {name BottomWallBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[4\]" {name RightWallBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[5\]" {name TopWallBody} + gid_groups_conds::copyNode $bodies_xpath [spdAux::getRoute PFEMFLUID_Bodies] + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@n='Body'\]\[6\]" {name LeftWallBody} + gid_groups_conds::setAttributesF $bodies_xpath {state hidden} + + # Fluid body + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/value\[@n='BodyType'\]" {v Fluid} + set fluid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='FluidBody'\]/condition\[@n='Parts'\]" + set fluidNode [customlib::AddConditionGroupOnXPath $fluid_part_xpath Fluid] + set props [list ConstitutiveLaw NewtonianTemperatureDependent2DLaw DENSITY 1000 CONDUCTIVITY 5000 SPECIFIC_HEAT 5000 DYNAMIC_VISCOSITY 0.01 BULK_MODULUS 1000000000] + spdAux::SetValuesOnBaseNode $fluidNode $props + # Add table + set filePath [file join [file join [apps::getMyDir "PfemThermic"] examples] tables] + set fileName ThermicSloshingConvection_DENSITY.txt + set fullName [file join $filePath $fileName] + spdAux::UpdateFileField $fullName [$fluidNode selectNodes "./value\[@n = 'TEMPERATURE_vs_DENSITY'\]"] + + # Rigid bodies + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='BottomWallBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='BottomWallBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='BottomWallBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Bottom_Wall] + $rigidNode setAttribute ov line + + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RightWallBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RightWallBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='RightWallBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Right_Wall] + $rigidNode setAttribute ov line + + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='TopWallBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='TopWallBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='TopWallBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Top_Wall] + $rigidNode setAttribute ov line + + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='LeftWallBody'\]/value\[@n='BodyType'\]" {v Rigid} + gid_groups_conds::setAttributesF "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='LeftWallBody'\]/value\[@n='MeshingStrategy'\]" {v "No remesh"} + set rigid_part_xpath "[spdAux::getRoute PFEMFLUID_Bodies]/blockdata\[@name='LeftWallBody'\]/condition\[@n='Parts'\]" + set rigidNode [customlib::AddConditionGroupOnXPath $rigid_part_xpath Left_Wall] + $rigidNode setAttribute ov line + + # Velocity BC + set fixVelocity "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='VELOCITY'\]" + [customlib::AddConditionGroupOnXPath $fixVelocity "Bottom_Wall"] setAttribute ov line + [customlib::AddConditionGroupOnXPath $fixVelocity "Right_Wall"] setAttribute ov line + [customlib::AddConditionGroupOnXPath $fixVelocity "Top_Wall"] setAttribute ov line + [customlib::AddConditionGroupOnXPath $fixVelocity "Left_Wall"] setAttribute ov line + + # Temperature BC + set fixTemperature "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition\[@n='TEMPERATURE'\]" + + set fixTemperatureNode [customlib::AddConditionGroupOnXPath $fixTemperature "Bottom_Wall"] + set props [list value 373.65 Interval Total constrained 1] + $fixTemperatureNode setAttribute ov line + spdAux::SetValuesOnBaseNode $fixTemperatureNode $props + + set fixTemperatureNode [customlib::AddConditionGroupOnXPath $fixTemperature "Top_Wall"] + set props [list value 373.65 Interval Total constrained 1] + $fixTemperatureNode setAttribute ov line + spdAux::SetValuesOnBaseNode $fixTemperatureNode $props + + set fixTemperatureNode [customlib::AddConditionGroupOnXPath $fixTemperature "Right_Wall"] + set props [list value 372.65 Interval Total constrained 1] + $fixTemperatureNode setAttribute ov line + spdAux::SetValuesOnBaseNode $fixTemperatureNode $props + + set fixTemperatureNode [customlib::AddConditionGroupOnXPath $fixTemperature "Left_Wall"] + set props [list value 372.65 Interval Total constrained 1] + $fixTemperatureNode setAttribute ov line + spdAux::SetValuesOnBaseNode $fixTemperatureNode $props + + # Temperature IC + set thermalICnode [customlib::AddConditionGroupOnXPath $fixTemperature "Fluid"] + set props [list value 373.15 Interval Initial constrained 1] + $thermalICnode setAttribute ov surface + spdAux::SetValuesOnBaseNode $thermalICnode $props + + # Time parameters + set time_parameters [list StartTime 0.0 EndTime 10.0 DeltaTime 0.005 UseAutomaticDeltaTime No] + set time_params_path [spdAux::getRoute "PFEMFLUID_TimeParameters"] + spdAux::SetValuesOnBasePath $time_params_path $time_parameters + + # Parallelism + set parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 1] + set xpath [spdAux::getRoute "Parallelization"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Output + set parameters [list OutputControlType time OutputDeltaTime 0.01] + set xpath [spdAux::getRoute "Results"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Others + spdAux::SetValueOnTreeItem values transient CNVDFFSolStrat + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/PfemThermic/examples/examples.tcl b/kratos.gid/apps/PfemThermic/examples/examples.tcl new file mode 100644 index 000000000..491e39180 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/examples.tcl @@ -0,0 +1,12 @@ +namespace eval ::PfemThermic::examples { + namespace path ::PfemThermic + Kratos::AddNamespace [namespace current] + +} +proc ::PfemThermic::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} + } +} \ No newline at end of file diff --git a/kratos.gid/apps/PfemThermic/examples/examples.xml b/kratos.gid/apps/PfemThermic/examples/examples.xml new file mode 100644 index 000000000..4590c5b40 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/examples.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/PfemThermic/examples/tables/ThermicConvection_DENSITY.txt b/kratos.gid/apps/PfemThermic/examples/tables/ThermicConvection_DENSITY.txt new file mode 100644 index 000000000..56a0dd952 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/tables/ThermicConvection_DENSITY.txt @@ -0,0 +1,3 @@ +372.65 1050 +373.15 1000 +373.65 950 \ No newline at end of file diff --git a/kratos.gid/apps/PfemThermic/examples/tables/ThermicSloshingConvection_DENSITY.txt b/kratos.gid/apps/PfemThermic/examples/tables/ThermicSloshingConvection_DENSITY.txt new file mode 100644 index 000000000..c5857225b --- /dev/null +++ b/kratos.gid/apps/PfemThermic/examples/tables/ThermicSloshingConvection_DENSITY.txt @@ -0,0 +1,3 @@ +372.65 1200 +373.15 1000 +373.65 800 \ No newline at end of file diff --git a/kratos.gid/apps/Pfem/images/2D-icon.png b/kratos.gid/apps/PfemThermic/images/2D-icon.png similarity index 100% rename from kratos.gid/apps/Pfem/images/2D-icon.png rename to kratos.gid/apps/PfemThermic/images/2D-icon.png diff --git a/kratos.gid/apps/Pfem/images/Black/_2D_.png b/kratos.gid/apps/PfemThermic/images/2D.png similarity index 100% rename from kratos.gid/apps/Pfem/images/Black/_2D_.png rename to kratos.gid/apps/PfemThermic/images/2D.png diff --git a/kratos.gid/apps/Pfem/images/Black/_2Da_.png b/kratos.gid/apps/PfemThermic/images/2Da.png similarity index 100% rename from kratos.gid/apps/Pfem/images/Black/_2Da_.png rename to kratos.gid/apps/PfemThermic/images/2Da.png diff --git a/kratos.gid/apps/Pfem/images/2da-icon.png b/kratos.gid/apps/PfemThermic/images/2da-icon.png similarity index 100% rename from kratos.gid/apps/Pfem/images/2da-icon.png rename to kratos.gid/apps/PfemThermic/images/2da-icon.png diff --git a/kratos.gid/apps/Pfem/images/3D-icon.png b/kratos.gid/apps/PfemThermic/images/3D-icon.png similarity index 100% rename from kratos.gid/apps/Pfem/images/3D-icon.png rename to kratos.gid/apps/PfemThermic/images/3D-icon.png diff --git a/kratos.gid/apps/Pfem/images/Black/_3D_.png b/kratos.gid/apps/PfemThermic/images/3D.png similarity index 100% rename from kratos.gid/apps/Pfem/images/Black/_3D_.png rename to kratos.gid/apps/PfemThermic/images/3D.png diff --git a/kratos.gid/apps/PfemThermic/images/Black/2D-icon.png b/kratos.gid/apps/PfemThermic/images/Black/2D-icon.png new file mode 100644 index 000000000..94bcc789f Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/Black/2D-icon.png differ diff --git a/kratos.gid/apps/Pfem/images/_2D_.png b/kratos.gid/apps/PfemThermic/images/Black/2D.png similarity index 100% rename from kratos.gid/apps/Pfem/images/_2D_.png rename to kratos.gid/apps/PfemThermic/images/Black/2D.png diff --git a/kratos.gid/apps/Pfem/images/_2Da_.png b/kratos.gid/apps/PfemThermic/images/Black/2Da.png similarity index 100% rename from kratos.gid/apps/Pfem/images/_2Da_.png rename to kratos.gid/apps/PfemThermic/images/Black/2Da.png diff --git a/kratos.gid/apps/PfemThermic/images/Black/2da-icon.png b/kratos.gid/apps/PfemThermic/images/Black/2da-icon.png new file mode 100644 index 000000000..bff5726c2 Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/Black/2da-icon.png differ diff --git a/kratos.gid/apps/PfemThermic/images/Black/3D-icon.png b/kratos.gid/apps/PfemThermic/images/Black/3D-icon.png new file mode 100644 index 000000000..d38597b25 Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/Black/3D-icon.png differ diff --git a/kratos.gid/apps/Pfem/images/_3D_.png b/kratos.gid/apps/PfemThermic/images/Black/3D.png similarity index 100% rename from kratos.gid/apps/Pfem/images/_3D_.png rename to kratos.gid/apps/PfemThermic/images/Black/3D.png diff --git a/kratos.gid/apps/Solid/images/bodies.png b/kratos.gid/apps/PfemThermic/images/Black/bodies.png similarity index 100% rename from kratos.gid/apps/Solid/images/bodies.png rename to kratos.gid/apps/PfemThermic/images/Black/bodies.png diff --git a/kratos.gid/apps/Pfem/images/boundaryConditions.png b/kratos.gid/apps/PfemThermic/images/Black/boundaryConditions.png similarity index 100% rename from kratos.gid/apps/Pfem/images/boundaryConditions.png rename to kratos.gid/apps/PfemThermic/images/Black/boundaryConditions.png diff --git a/kratos.gid/apps/Pfem/images/cancelProcess.png b/kratos.gid/apps/PfemThermic/images/Black/cancelProcess.png similarity index 100% rename from kratos.gid/apps/Pfem/images/cancelProcess.png rename to kratos.gid/apps/PfemThermic/images/Black/cancelProcess.png diff --git a/kratos.gid/apps/Pfem/images/contactStrategy.png b/kratos.gid/apps/PfemThermic/images/Black/contactStrategy.png similarity index 100% rename from kratos.gid/apps/Pfem/images/contactStrategy.png rename to kratos.gid/apps/PfemThermic/images/Black/contactStrategy.png diff --git a/kratos.gid/apps/Pfem/images/data.png b/kratos.gid/apps/PfemThermic/images/Black/data.png similarity index 100% rename from kratos.gid/apps/Pfem/images/data.png rename to kratos.gid/apps/PfemThermic/images/Black/data.png diff --git a/kratos.gid/apps/Pfem/images/doRestart.png b/kratos.gid/apps/PfemThermic/images/Black/doRestart.png similarity index 100% rename from kratos.gid/apps/Pfem/images/doRestart.png rename to kratos.gid/apps/PfemThermic/images/Black/doRestart.png diff --git a/kratos.gid/apps/PfemThermic/images/Black/exampleFluid.png b/kratos.gid/apps/PfemThermic/images/Black/exampleFluid.png new file mode 100644 index 000000000..f0a8cc66b Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/Black/exampleFluid.png differ diff --git a/kratos.gid/apps/PfemThermic/images/Black/exampleFsi.png b/kratos.gid/apps/PfemThermic/images/Black/exampleFsi.png new file mode 100644 index 000000000..419a1453d Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/Black/exampleFsi.png differ diff --git a/kratos.gid/apps/Pfem/images/folder.png b/kratos.gid/apps/PfemThermic/images/Black/folder.png similarity index 100% rename from kratos.gid/apps/Pfem/images/folder.png rename to kratos.gid/apps/PfemThermic/images/Black/folder.png diff --git a/kratos.gid/apps/Pfem/images/groupCreated.png b/kratos.gid/apps/PfemThermic/images/Black/groupCreated.png similarity index 100% rename from kratos.gid/apps/Pfem/images/groupCreated.png rename to kratos.gid/apps/PfemThermic/images/Black/groupCreated.png diff --git a/kratos.gid/apps/Pfem/images/Black/logo.png b/kratos.gid/apps/PfemThermic/images/Black/logo.png similarity index 100% rename from kratos.gid/apps/Pfem/images/Black/logo.png rename to kratos.gid/apps/PfemThermic/images/Black/logo.png diff --git a/kratos.gid/apps/Pfem/images/Black/logo_1.png b/kratos.gid/apps/PfemThermic/images/Black/logo_1.png similarity index 100% rename from kratos.gid/apps/Pfem/images/Black/logo_1.png rename to kratos.gid/apps/PfemThermic/images/Black/logo_1.png diff --git a/kratos.gid/apps/Pfem/images/meshingStrategies.png b/kratos.gid/apps/PfemThermic/images/Black/meshingStrategies.png similarity index 100% rename from kratos.gid/apps/Pfem/images/meshingStrategies.png rename to kratos.gid/apps/PfemThermic/images/Black/meshingStrategies.png diff --git a/kratos.gid/apps/Pfem/images/modelProperties.png b/kratos.gid/apps/PfemThermic/images/Black/modelProperties.png similarity index 100% rename from kratos.gid/apps/Pfem/images/modelProperties.png rename to kratos.gid/apps/PfemThermic/images/Black/modelProperties.png diff --git a/kratos.gid/apps/Pfem/images/modelling.png b/kratos.gid/apps/PfemThermic/images/Black/modelling.png similarity index 100% rename from kratos.gid/apps/Pfem/images/modelling.png rename to kratos.gid/apps/PfemThermic/images/Black/modelling.png diff --git a/kratos.gid/apps/PfemThermic/images/Black/pfemData.png b/kratos.gid/apps/PfemThermic/images/Black/pfemData.png new file mode 100644 index 000000000..de992251b Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/Black/pfemData.png differ diff --git a/kratos.gid/apps/Pfem/images/runSimulation.png b/kratos.gid/apps/PfemThermic/images/Black/runSimulation.png similarity index 100% rename from kratos.gid/apps/Pfem/images/runSimulation.png rename to kratos.gid/apps/PfemThermic/images/Black/runSimulation.png diff --git a/kratos.gid/apps/Pfem/images/seeResults.png b/kratos.gid/apps/PfemThermic/images/Black/seeResults.png similarity index 100% rename from kratos.gid/apps/Pfem/images/seeResults.png rename to kratos.gid/apps/PfemThermic/images/Black/seeResults.png diff --git a/kratos.gid/apps/Pfem/images/select.png b/kratos.gid/apps/PfemThermic/images/Black/select.png similarity index 100% rename from kratos.gid/apps/Pfem/images/select.png rename to kratos.gid/apps/PfemThermic/images/Black/select.png diff --git a/kratos.gid/apps/Pfem/images/setLoad.png b/kratos.gid/apps/PfemThermic/images/Black/setLoad.png similarity index 100% rename from kratos.gid/apps/Pfem/images/setLoad.png rename to kratos.gid/apps/PfemThermic/images/Black/setLoad.png diff --git a/kratos.gid/apps/Pfem/images/setUnits.png b/kratos.gid/apps/PfemThermic/images/Black/setUnits.png similarity index 100% rename from kratos.gid/apps/Pfem/images/setUnits.png rename to kratos.gid/apps/PfemThermic/images/Black/setUnits.png diff --git a/kratos.gid/apps/Pfem/images/settings.png b/kratos.gid/apps/PfemThermic/images/Black/settings.png similarity index 100% rename from kratos.gid/apps/Pfem/images/settings.png rename to kratos.gid/apps/PfemThermic/images/Black/settings.png diff --git a/kratos.gid/apps/Pfem/images/sheets.png b/kratos.gid/apps/PfemThermic/images/Black/sheets.png similarity index 100% rename from kratos.gid/apps/Pfem/images/sheets.png rename to kratos.gid/apps/PfemThermic/images/Black/sheets.png diff --git a/kratos.gid/apps/Pfem/images/timeParameters.png b/kratos.gid/apps/PfemThermic/images/Black/timeIntervals.png similarity index 100% rename from kratos.gid/apps/Pfem/images/timeParameters.png rename to kratos.gid/apps/PfemThermic/images/Black/timeIntervals.png diff --git a/kratos.gid/apps/Pfem/images/view.png b/kratos.gid/apps/PfemThermic/images/Black/view.png similarity index 100% rename from kratos.gid/apps/Pfem/images/view.png rename to kratos.gid/apps/PfemThermic/images/Black/view.png diff --git a/kratos.gid/apps/Pfem/images/parts.png b/kratos.gid/apps/PfemThermic/images/bodies.png similarity index 100% rename from kratos.gid/apps/Pfem/images/parts.png rename to kratos.gid/apps/PfemThermic/images/bodies.png diff --git a/kratos.gid/apps/Solid/images/boundaryConditions.png b/kratos.gid/apps/PfemThermic/images/boundaryConditions.png similarity index 100% rename from kratos.gid/apps/Solid/images/boundaryConditions.png rename to kratos.gid/apps/PfemThermic/images/boundaryConditions.png diff --git a/kratos.gid/apps/PfemThermic/images/boundingBox.png b/kratos.gid/apps/PfemThermic/images/boundingBox.png new file mode 100644 index 000000000..e42c23f9d Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/boundingBox.png differ diff --git a/kratos.gid/apps/Solid/images/cancelProcess.png b/kratos.gid/apps/PfemThermic/images/cancelProcess.png similarity index 100% rename from kratos.gid/apps/Solid/images/cancelProcess.png rename to kratos.gid/apps/PfemThermic/images/cancelProcess.png diff --git a/kratos.gid/apps/Solid/images/contactStrategy.png b/kratos.gid/apps/PfemThermic/images/contactStrategy.png similarity index 100% rename from kratos.gid/apps/Solid/images/contactStrategy.png rename to kratos.gid/apps/PfemThermic/images/contactStrategy.png diff --git a/kratos.gid/apps/Solid/images/data.png b/kratos.gid/apps/PfemThermic/images/data.png similarity index 100% rename from kratos.gid/apps/Solid/images/data.png rename to kratos.gid/apps/PfemThermic/images/data.png diff --git a/kratos.gid/apps/Pfem/images/pfemData.png b/kratos.gid/apps/PfemThermic/images/demData.png similarity index 100% rename from kratos.gid/apps/Pfem/images/pfemData.png rename to kratos.gid/apps/PfemThermic/images/demData.png diff --git a/kratos.gid/apps/PfemFluid/images/settings.png b/kratos.gid/apps/PfemThermic/images/dmsettings.png similarity index 100% rename from kratos.gid/apps/PfemFluid/images/settings.png rename to kratos.gid/apps/PfemThermic/images/dmsettings.png diff --git a/kratos.gid/apps/Solid/images/doRestart.png b/kratos.gid/apps/PfemThermic/images/doRestart.png similarity index 100% rename from kratos.gid/apps/Solid/images/doRestart.png rename to kratos.gid/apps/PfemThermic/images/doRestart.png diff --git a/kratos.gid/apps/PfemThermic/images/exampleConvection.png b/kratos.gid/apps/PfemThermic/images/exampleConvection.png new file mode 100644 index 000000000..66c439a7d Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/exampleConvection.png differ diff --git a/kratos.gid/apps/PfemThermic/images/exampleCubeDrop.png b/kratos.gid/apps/PfemThermic/images/exampleCubeDrop.png new file mode 100644 index 000000000..07266d818 Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/exampleCubeDrop.png differ diff --git a/kratos.gid/apps/PfemThermic/images/exampleDamBreakFSI.png b/kratos.gid/apps/PfemThermic/images/exampleDamBreakFSI.png new file mode 100644 index 000000000..f62c0264c Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/exampleDamBreakFSI.png differ diff --git a/kratos.gid/apps/PfemThermic/images/exampleFluidDrop.png b/kratos.gid/apps/PfemThermic/images/exampleFluidDrop.png new file mode 100644 index 000000000..1feff6e80 Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/exampleFluidDrop.png differ diff --git a/kratos.gid/apps/PfemThermic/images/exampleSloshing.png b/kratos.gid/apps/PfemThermic/images/exampleSloshing.png new file mode 100644 index 000000000..43b8b2fbb Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/exampleSloshing.png differ diff --git a/kratos.gid/apps/PfemThermic/images/exampleSloshingConvection.png b/kratos.gid/apps/PfemThermic/images/exampleSloshingConvection.png new file mode 100644 index 000000000..c110d7dd8 Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/exampleSloshingConvection.png differ diff --git a/kratos.gid/apps/Solid/images/folder.png b/kratos.gid/apps/PfemThermic/images/folder.png similarity index 100% rename from kratos.gid/apps/Solid/images/folder.png rename to kratos.gid/apps/PfemThermic/images/folder.png diff --git a/kratos.gid/apps/Pfem/images/gravity_vector.png b/kratos.gid/apps/PfemThermic/images/gravityForce.png similarity index 100% rename from kratos.gid/apps/Pfem/images/gravity_vector.png rename to kratos.gid/apps/PfemThermic/images/gravityForce.png diff --git a/kratos.gid/apps/Solid/images/groupCreated.png b/kratos.gid/apps/PfemThermic/images/groupCreated.png similarity index 100% rename from kratos.gid/apps/Solid/images/groupCreated.png rename to kratos.gid/apps/PfemThermic/images/groupCreated.png diff --git a/kratos.gid/apps/Solid/images/linear_solver.png b/kratos.gid/apps/PfemThermic/images/linear_solver.png similarity index 100% rename from kratos.gid/apps/Solid/images/linear_solver.png rename to kratos.gid/apps/PfemThermic/images/linear_solver.png diff --git a/kratos.gid/apps/PfemThermic/images/logo.png b/kratos.gid/apps/PfemThermic/images/logo.png new file mode 100644 index 000000000..3dde031ca Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/logo.png differ diff --git a/kratos.gid/apps/Solid/images/meshingStrategies.png b/kratos.gid/apps/PfemThermic/images/meshingStrategies.png similarity index 100% rename from kratos.gid/apps/Solid/images/meshingStrategies.png rename to kratos.gid/apps/PfemThermic/images/meshingStrategies.png diff --git a/kratos.gid/apps/Solid/images/modelProperties.png b/kratos.gid/apps/PfemThermic/images/modelProperties.png similarity index 100% rename from kratos.gid/apps/Solid/images/modelProperties.png rename to kratos.gid/apps/PfemThermic/images/modelProperties.png diff --git a/kratos.gid/apps/PfemThermic/images/modelling.png b/kratos.gid/apps/PfemThermic/images/modelling.png new file mode 100644 index 000000000..ce73a296e Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/modelling.png differ diff --git a/kratos.gid/apps/Pfem/images/parallel_type.png b/kratos.gid/apps/PfemThermic/images/parallel_type.png similarity index 100% rename from kratos.gid/apps/Pfem/images/parallel_type.png rename to kratos.gid/apps/PfemThermic/images/parallel_type.png diff --git a/kratos.gid/apps/PfemThermic/images/pfemData.png b/kratos.gid/apps/PfemThermic/images/pfemData.png new file mode 100644 index 000000000..9e70bb3e9 Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/pfemData.png differ diff --git a/kratos.gid/apps/Solid/images/runSimulation.png b/kratos.gid/apps/PfemThermic/images/runSimulation.png similarity index 100% rename from kratos.gid/apps/Solid/images/runSimulation.png rename to kratos.gid/apps/PfemThermic/images/runSimulation.png diff --git a/kratos.gid/apps/Solid/images/seeResults.png b/kratos.gid/apps/PfemThermic/images/seeResults.png similarity index 100% rename from kratos.gid/apps/Solid/images/seeResults.png rename to kratos.gid/apps/PfemThermic/images/seeResults.png diff --git a/kratos.gid/apps/Solid/images/select.png b/kratos.gid/apps/PfemThermic/images/select.png similarity index 100% rename from kratos.gid/apps/Solid/images/select.png rename to kratos.gid/apps/PfemThermic/images/select.png diff --git a/kratos.gid/apps/Solid/images/setLoad.png b/kratos.gid/apps/PfemThermic/images/setLoad.png similarity index 100% rename from kratos.gid/apps/Solid/images/setLoad.png rename to kratos.gid/apps/PfemThermic/images/setLoad.png diff --git a/kratos.gid/apps/Solid/images/setUnits.png b/kratos.gid/apps/PfemThermic/images/setUnits.png similarity index 100% rename from kratos.gid/apps/Solid/images/setUnits.png rename to kratos.gid/apps/PfemThermic/images/setUnits.png diff --git a/kratos.gid/apps/PfemThermic/images/settings.png b/kratos.gid/apps/PfemThermic/images/settings.png new file mode 100644 index 000000000..286e690b2 Binary files /dev/null and b/kratos.gid/apps/PfemThermic/images/settings.png differ diff --git a/kratos.gid/apps/Solid/images/sheets.png b/kratos.gid/apps/PfemThermic/images/sheets.png similarity index 100% rename from kratos.gid/apps/Solid/images/sheets.png rename to kratos.gid/apps/PfemThermic/images/sheets.png diff --git a/kratos.gid/apps/Pfem/images/timeIntervals.png b/kratos.gid/apps/PfemThermic/images/timeInterval.png similarity index 100% rename from kratos.gid/apps/Pfem/images/timeIntervals.png rename to kratos.gid/apps/PfemThermic/images/timeInterval.png diff --git a/kratos.gid/apps/Solid/images/timeParameters.png b/kratos.gid/apps/PfemThermic/images/timeParams.png similarity index 100% rename from kratos.gid/apps/Solid/images/timeParameters.png rename to kratos.gid/apps/PfemThermic/images/timeParams.png diff --git a/kratos.gid/apps/Solid/images/view.png b/kratos.gid/apps/PfemThermic/images/view.png similarity index 100% rename from kratos.gid/apps/Solid/images/view.png rename to kratos.gid/apps/PfemThermic/images/view.png diff --git a/kratos.gid/apps/PfemThermic/start.tcl b/kratos.gid/apps/PfemThermic/start.tcl new file mode 100644 index 000000000..c5a1c14d6 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/start.tcl @@ -0,0 +1,42 @@ +namespace eval ::PfemThermic { + Kratos::AddNamespace [namespace current] + + # Variable declaration + variable dir + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} +} + +proc ::PfemThermic::Init { app } { + # Variable initialization + variable dir + set dir [apps::getMyDir "PfemThermic"] + + variable _app + set _app $app + + PfemThermic::xml::Init + PfemThermic::write::Init +} + +proc ::PfemThermic::CustomToolbarItems { } { + variable dir + # Reset the left toolbar + set Kratos::kratos_private(MenuItems) [dict create] + set img_dir [file join $dir images] + if {[gid_themes::GetCurrentTheme] eq "GiD_black"} { + set img_dir [file join $img_dir Black] + } + Kratos::ToolbarAddItem "Model" [file join $img_dir "modelProperties.png"] [list -np- gid_groups_conds::open_conditions menu] [= "Define the model properties"] + Kratos::ToolbarAddItem "Run" [file join $img_dir "runSimulation.png"] {Utilities Calculate} [= "Run the simulation"] + Kratos::ToolbarAddItem "Output" [file join $img_dir "view.png"] [list -np- PWViewOutput] [= "View process info"] + Kratos::ToolbarAddItem "Stop" [file join $img_dir "cancelProcess.png"] {Utilities CancelProcess} [= "Cancel process"] + Kratos::ToolbarAddItem "Examples" "losta.png" [list -np- ::Examples::StartWindow [apps::getActiveAppId]] [= "Examples window"] + Kratos::ToolbarAddItem "SpacerApp1" "" "" "" + if {[info exists Kratos::kratos_private(UseFiles)] && $Kratos::kratos_private(UseFiles) == 1} { + Kratos::ToolbarAddItem "Files" "files.png" [list -np- spdAux::LaunchFileWindow] [= "File handler window"] + } +} diff --git a/kratos.gid/apps/PfemThermic/write/write.tcl b/kratos.gid/apps/PfemThermic/write/write.tcl new file mode 100644 index 000000000..dd6492473 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/write/write.tcl @@ -0,0 +1,229 @@ +namespace eval ::PfemThermic::write { + namespace path ::PfemThermic + Kratos::AddNamespace [namespace current] +} + +proc ::PfemThermic::write::Init { } { + PfemFluid::write::Init + ConvectionDiffusion::write::Init + + PfemFluid::write::SetAttribute materials_file PFEMThermicMaterials.json + ConvectionDiffusion::write::SetAttribute materials_file PFEMThermicMaterials.json +} + +# MDPA event +proc PfemThermic::write::writeModelPartEvent { } { + + set root [customlib::GetBaseRoot] + set dictGroupsIterators [dict create] + set xp1 "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition/group" + variable FluxConditions + set FluxConditions(temp) 0 + unset FluxConditions(temp) + + # Write geometries (adapted from PfemFluid::write::writeModelPartEvent) + write::initWriteConfiguration [PfemFluid::write::GetAttributes] + set parts_un_list [PfemFluid::write::GetPartsUN] + foreach part_un $parts_un_list { + write::initWriteData $part_un [PfemFluid::write::GetAttribute materials_un] + } + + write::writeModelPartData + write::WriteString "Begin Properties 0" + write::WriteString "End Properties" + write::writeNodalCoordinates + foreach part_un $parts_un_list { + write::initWriteData $part_un "PFEMFLUID_Materials" + write::writeElementConnectivities + } + + # Write flux conditions (adapted from write::writeConditions) + set iter 0 + foreach group [$root selectNodes $xp1] { + set condid [[$group parent] @n] + set groupid [get_domnode_attribute $group n] + set groupid [write::GetWriteGroupName $groupid] + incr iter + if {$condid eq "HeatFlux2D" || $condid eq "HeatFlux3D" || $condid eq "ThermalFace2D" || $condid eq "ThermalFace3D"} { + set dictGroupsIterators [write::writeGroupNodeCondition $dictGroupsIterators $group $condid $iter] + } + if {[dict exists $dictGroupsIterators $groupid]} { + set iter [lindex [dict get $dictGroupsIterators $groupid] 1] + } else { + incr iter -1 + } + } + + # Fill FluxConditions (adapted from ConvectionDiffusion::write::writeBoundaryConditions) + foreach group [$root selectNodes $xp1] { + set condid [[$group parent] @n] + set groupid [get_domnode_attribute $group n] + set groupid [write::GetWriteGroupName $groupid] + if {$condid eq "HeatFlux2D" || $condid eq "HeatFlux3D" || $condid eq "ThermalFace2D" || $condid eq "ThermalFace3D"} { + lassign [dict get $dictGroupsIterators $groupid] ini fin + set FluxConditions($groupid,initial) $ini + set FluxConditions($groupid,final) $fin + set FluxConditions($groupid,SkinCondition) 1 + } + } + + # Write submodelparts (adapted from PfemFluid::write::writeMeshes) + foreach part_un $parts_un_list { + write::initWriteData $part_un "PFEMFLUID_Materials" + write::writePartSubModelPart + } + + # Write submodel parts with flux conditions (adapted from PfemFluid::write::writeNodalConditions and ConvectionDiffusion::write::writeConditionsMesh) + foreach group [$root selectNodes $xp1] { + set condid [[$group parent] @n] + # For nodal conditions + if {[Model::getNodalConditionbyId $condid] ne ""} { + set groupid [$group @n] + set groupid [write::GetWriteGroupName $groupid] + if {$condid ne "HeatFlux2D" && $condid ne "HeatFlux3D" && $condid ne "ThermalFace2D" && $condid ne "ThermalFace3D"} { + ::write::writeGroupSubModelPart $condid $groupid "nodal" + } else { + set ini $FluxConditions($groupid,initial) + set end $FluxConditions($groupid,final) + ::write::writeGroupSubModelPart $condid $groupid "Conditions" [list $ini $end] + } + # For conditions + } else { + if {[Model::getCondition $condid] ne ""} { + set groupid [$group @n] + set groupid [write::GetWriteGroupName $groupid] + + if {$condid ne "HeatFlux2D" && $condid ne "HeatFlux3D" && $condid ne "ThermalFace2D" && $condid ne "ThermalFace3D"} { + ::write::writeGroupSubModelPart $condid $groupid "Nodes" + } else { + set ini $FluxConditions($groupid,initial) + set end $FluxConditions($groupid,final) + ::write::writeGroupSubModelPart $condid $groupid "Conditions" [list $ini $end] + } + } + } + } +} + +# Custom files event +proc PfemThermic::write::writeCustomFilesEvent { } { + PfemThermic::write::writePropertiesJsonFile "PFEMThermicMaterials.json" True [PfemFluid::write::GetAttribute model_part_name] + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] +} + +# Write material file +proc PfemThermic::write::writePropertiesJsonFile { {fname "materials.json"} {write_claw_name "True"} {model_part_name ""}} { + set mats_json [dict create properties [list ] ] + foreach parts_un [PfemFluid::write::GetPartsUN] { + foreach property [dict get [PfemThermic::write::getPropertiesList $parts_un $write_claw_name $model_part_name] properties ] { + if {$property ne "\[\]"} { + dict lappend mats_json properties $property + } + } + } + write::OpenFile $fname + write::WriteJSON $mats_json + write::CloseFile +} + +proc PfemThermic::write::getPropertiesList {parts_un {write_claw_name "True"} {model_part_name ""}} { + set mat_dict [write::getMatDict] + set props_dict [dict create] + set props [list] + set doc $gid_groups_conds::doc + set root [$doc documentElement] + + set xp1 "[spdAux::getRoute $parts_un]/group" + if {[llength [$root selectNodes $xp1]] < 1} { + set xp1 "[spdAux::getRoute $parts_un]/condition/group" + } + foreach gNode [$root selectNodes $xp1] { + set group [get_domnode_attribute $gNode n] + set cond_id [get_domnode_attribute [$gNode parent] n] + # set sub_model_part [write::getSubModelPartId $cond_id $group] + # if {$model_part_name ne ""} {set sub_model_part $model_part_name.$sub_model_part} + # set sub_model_part [string trim $sub_model_part "."] + + set submodelpart_id [write::GetSubModelPartName $cond_id $group] + set submodelpart_fullname $submodelpart_id + if {$model_part_name ne ""} {set submodelpart_fullname $model_part_name.$submodelpart_id} + set submodelpart_id [string trim $submodelpart_id "."] + if { [dict exists $mat_dict $submodelpart_id] } { + set mid [dict get $mat_dict $submodelpart_id MID] + set prop_dict [dict create] + dict set prop_dict "model_part_name" $submodelpart_fullname + dict set prop_dict "properties_id" $mid + set constitutive_law_id "" + if {[dict exists $mat_dict $submodelpart_id ConstitutiveLaw ]} {set constitutive_law_id [dict get $mat_dict $submodelpart_id ConstitutiveLaw]} + set constitutive_law [Model::getConstitutiveLaw $constitutive_law_id] + if {$constitutive_law ne ""} { + set exclusionList [list "MID" "APPID" "ConstitutiveLaw" "Material" "Element"] + set tableList [list "TEMPERATURE_vs_DENSITY" "TEMPERATURE_vs_VISCOSITY" "TEMPERATURE_vs_YIELDSHEAR" "TEMPERATURE_vs_YOUNG" "TEMPERATURE_vs_POISSON" "TEMPERATURE_vs_CONDUCTIVITY" "TEMPERATURE_vs_SPECIFIC_HEAT"] + set variables_dict [dict create] + set tables_dict [dict create] + foreach prop [dict keys [dict get $mat_dict $submodelpart_id] ] { + if {$prop ni $exclusionList && $prop ni $tableList} { + dict set variables_list $prop [write::getFormattedValue [dict get $mat_dict $submodelpart_id $prop]] + } + if {$prop in $tableList} { + set fileName [write::getFormattedValue [dict get $mat_dict $submodelpart_id $prop]] + if {$fileName ni [list "" "- No file" $::spdAux::no_file_string]} { + dict set tables_dict $prop [PfemThermic::write::GetTable $prop $fileName] + } + } + } + set material_dict [dict create] + + if {$write_claw_name eq "True"} { + set constitutive_law_name [$constitutive_law getKratosName] + dict set material_dict constitutive_law [dict create name $constitutive_law_name] + } + + dict set material_dict Variables $variables_list + dict set material_dict Tables $tables_dict + dict set prop_dict Material $material_dict + + lappend props $prop_dict + } + } + } + + dict set props_dict properties $props + return $props_dict +} + +proc PfemThermic::write::GetTable { prop fileName } { + set table [dict create] + dict set table input_variable "TEMPERATURE" + + if {$prop eq "TEMPERATURE_vs_DENSITY"} { + dict set table output_variable "DENSITY" + } elseif {$prop eq "TEMPERATURE_vs_VISCOSITY"} { + dict set table output_variable "DYNAMIC_VISCOSITY" + } elseif {$prop eq "TEMPERATURE_vs_YIELDSHEAR"} { + dict set table output_variable "YIELD_SHEAR" + } elseif {$prop eq "TEMPERATURE_vs_YOUNG"} { + dict set table output_variable "YOUNG_MODULUS" + } elseif {$prop eq "TEMPERATURE_vs_POISSON"} { + dict set table output_variable "POISSON_RATIO" + } elseif {$prop eq "TEMPERATURE_vs_CONDUCTIVITY"} { + dict set table output_variable "CONDUCTIVITY" + } elseif {$prop eq "TEMPERATURE_vs_SPECIFIC_HEAT"} { + dict set table output_variable "SPECIFIC_HEAT" + } + + set fp [open $fileName r] + set file_data [read $fp] + close $fp + + set points {} + set data [split $file_data "\n"] + foreach line $data { + if {[scan $line %f%f a b] == 2} { + lappend points [list $a $b] + } + } + dict set table data $points + + return $table +} \ No newline at end of file diff --git a/kratos.gid/apps/PfemThermic/write/writeProjectParameters.tcl b/kratos.gid/apps/PfemThermic/write/writeProjectParameters.tcl new file mode 100644 index 000000000..486228581 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/write/writeProjectParameters.tcl @@ -0,0 +1,180 @@ +# Parameters event +proc PfemThermic::write::writeParametersEvent { } { + write::WriteJSON [getNewParametersDict] +} + +proc PfemThermic::write::getNewParametersDict { } { + PfemFluid::write::CalculateMyVariables + set projectParametersDict [dict create] + + dict set projectParametersDict analysis_stage "KratosMultiphysics.PfemFluidDynamicsApplication.pfem_fluid_dynamics_analysis" + dict set projectParametersDict problem_data [PfemFluid::write::GetPFEM_ProblemDataDict] + dict set projectParametersDict solver_settings [PfemThermic::write::GetSolverSettingsDict] + dict set projectParametersDict problem_process_list [PfemFluid::write::GetPFEM_ProblemProcessList [PfemThermic::write::GetFreeSurfaceHeatFluxParts] [PfemThermic::write::GetFreeSurfaceThermalFaceParts]] + dict set projectParametersDict processes [PfemThermic::write::GetProcessList] + dict set projectParametersDict output_configuration [write::GetDefaultOutputGiDDict PfemFluid [spdAux::getRoute Results]] + dict set projectParametersDict output_configuration result_file_configuration nodal_results [write::GetResultsByXPathList [spdAux::getRoute NodalResults]] + dict set projectParametersDict output_configuration result_file_configuration gauss_point_results [write::GetResultsList ElementResults] + + return $projectParametersDict +} + +proc PfemThermic::write::GetSolverSettingsDict { } { + # GENERAL SETTINGS + set solverSettingsDict [dict create] + + dict set solverSettingsDict solver_type "pfem_fluid_thermally_coupled_solver" + dict set solverSettingsDict domain_size [expr [string range [write::getValue nDim] 0 0] ] + + # "time_stepping" + set timeSteppingDict [dict create] + if {[write::getValue PFEMFLUID_TimeParameters UseAutomaticDeltaTime] eq "Yes"} { + dict set timeSteppingDict automatic_time_step "true" + } else { + dict set timeSteppingDict automatic_time_step "false" + } + dict set timeSteppingDict time_step [write::getValue PFEMFLUID_TimeParameters [dict get $::PfemFluid::write::Names DeltaTime]] + dict set solverSettingsDict time_stepping $timeSteppingDict + + # FLUID / THERMIC SETTINGS + dict set solverSettingsDict fluid_solver_settings [PfemFluid::write::GetPFEM_SolverSettingsDict] + dict set solverSettingsDict thermal_solver_settings [PfemThermic::write::GetThermicSolverSettingsDict] +} + +proc PfemThermic::write::GetThermicSolverSettingsDict { } { + set thermicSolverSettingsDict [dict create] + + # General data + dict set thermicSolverSettingsDict solver_type "transient" + dict set thermicSolverSettingsDict analysis_type [write::getValue CNVDFFAnalysisType] + dict set thermicSolverSettingsDict time_integration_method "implicit" + dict set thermicSolverSettingsDict model_part_name [ConvectionDiffusion::write::GetAttribute model_part_name] + dict set thermicSolverSettingsDict domain_size [expr [string range [write::getValue nDim] 0 0]] + dict set thermicSolverSettingsDict reform_dofs_at_each_step "true" + + # Import data + set materialsDict [dict create] + dict set materialsDict materials_filename [ConvectionDiffusion::write::GetAttribute materials_file] + dict set thermicSolverSettingsDict material_import_settings $materialsDict + + # Solution Strategy and Solvers Parameters + set thermicSolverSettingsDict [dict merge $thermicSolverSettingsDict [write::getSolutionStrategyParametersDict CNVDFFSolStrat CNVDFFScheme CNVDFFStratParams]] + set thermicSolverSettingsDict [dict merge $thermicSolverSettingsDict [write::getSolversParametersDict ConvectionDiffusion]] + + # "problem_domain_sub_model_part_list" + set parts [list ] + foreach body_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute "PFEMFLUID_Bodies"]/blockdata"] { + if {[get_domnode_attribute $body_node state] ne "hidden"} { + foreach part_node [$body_node selectNodes "./condition/group"] { + lappend parts [write::getSubModelPartId "Parts" [$part_node @n]] + } + } + } + dict set thermicSolverSettingsDict problem_domain_sub_model_part_list $parts + + # "processes_sub_model_part_list" + dict set thermicSolverSettingsDict processes_sub_model_part_list [write::getSubModelPartNames "PFEMFLUID_NodalConditions" "PFEMFLUID_Loads"] + + return $thermicSolverSettingsDict +} + +proc PfemThermic::write::GetProcessList { } { + set processes [dict create] + + # "initial_conditions_process_list" + dict set processes initial_conditions_process_list [write::getConditionsParametersDict [ConvectionDiffusion::write::GetAttribute nodal_conditions_un] "Nodal"] + + # "constraints_process_list" + set group_constraints [write::getConditionsParametersDict PFEMFLUID_NodalConditions "Nodal"] + set body_constraints [PfemFluid::write::getBodyConditionsParametersDict PFEMFLUID_NodalConditions "Nodal"] + set thermic_constraints [write::getConditionsParametersDict [ConvectionDiffusion::write::GetAttribute conditions_un]] + set other_constraints [write::getConditionsParametersDict PFEMFLUID_NodalConditions] + dict set processes constraints_process_list [concat $group_constraints $body_constraints $thermic_constraints $other_constraints] + + # "list_other_processes" + #dict set processes list_other_processes [ConvectionDiffusion::write::getBodyForceProcessDictList] + + # "loads_process_list" + dict set processes loads_process_list [write::getConditionsParametersDict PFEMFLUID_Loads] + + # "auxiliar_process_list" + #dict set processes auxiliar_process_list [PfemThermic::write::getFreeSurfaceFluxProcessDictList] + + return $processes +} + +proc PfemThermic::write::GetFreeSurfaceHeatFluxParts {} { + set root [customlib::GetBaseRoot] + set listOfProcessedGroups [list ] + set groups [list ] + set xp1 "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition/group" + set xp2 "[spdAux::getRoute PFEMFLUID_NodalConditions]/group" + set grs [$root selectNodes $xp1] + if {$grs ne ""} {lappend groups {*}$grs} + set grs [$root selectNodes $xp2] + if {$grs ne ""} {lappend groups {*}$grs} + foreach group $groups { + set groupName [$group @n] + set groupName [write::GetWriteGroupName $groupName] + set cid [[$group parent] @n] + if {[Model::getNodalConditionbyId $cid] ne "" || [Model::getCondition $cid] ne "" || [string first Parts $cid] >= 0 } { + if {$cid eq "FreeSurfaceHeatFlux2D" || $cid eq "FreeSurfaceHeatFlux3D"} { + set gname [::write::getSubModelPartId $cid $groupName] + if {$gname ni $listOfProcessedGroups} {lappend listOfProcessedGroups $gname} + } + } + } + return $listOfProcessedGroups +} + +proc PfemThermic::write::GetFreeSurfaceThermalFaceParts {} { + set root [customlib::GetBaseRoot] + set listOfProcessedGroups [list ] + set groups [list ] + set xp1 "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition/group" + set xp2 "[spdAux::getRoute PFEMFLUID_NodalConditions]/group" + set grs [$root selectNodes $xp1] + if {$grs ne ""} {lappend groups {*}$grs} + set grs [$root selectNodes $xp2] + if {$grs ne ""} {lappend groups {*}$grs} + foreach group $groups { + set groupName [$group @n] + set groupName [write::GetWriteGroupName $groupName] + set cid [[$group parent] @n] + if {[Model::getNodalConditionbyId $cid] ne "" || [Model::getCondition $cid] ne "" || [string first Parts $cid] >= 0 } { + if {$cid eq "FreeSurfaceThermalFace2D" || $cid eq "FreeSurfaceThermalFace3D"} { + set gname [::write::getSubModelPartId $cid $groupName] + if {$gname ni $listOfProcessedGroups} {lappend listOfProcessedGroups $gname} + } + } + } + return $listOfProcessedGroups +} + +proc PfemThermic::write::getFreeSurfaceFluxProcessDictList {} { + set ret [list ] + set value [write::getValue PFEMTHERMIC_FreeSurfaceFlux] + if {$value != 0.0} { + set model_part_name [PfemFluid::write::GetAttribute model_part_name] + + set pdict [dict create] + dict set pdict "python_module" "assign_scalar_variable_process" + dict set pdict "kratos_module" "KratosMultiphysics" + dict set pdict "process_name" "AssignScalarVariableProcess" + + set params [dict create] + # Free_Surface is a tag name chosen to represent the free surface; + # It must be the same name of the modelpart written in the sub_model_part_list of update_conditions_on_free_surface + set group_name "Free_Surface" + dict set params "model_part_name" $model_part_name.$group_name + dict set params "variable_name" "FACE_HEAT_FLUX" + dict set params "constrained" false + dict set params "value" $value + dict set pdict "Parameters" $params + + lappend ret $pdict + } else { + set ret "[]" + } + return $ret +} \ No newline at end of file diff --git a/kratos.gid/apps/PfemThermic/xml/Conditions.xml b/kratos.gid/apps/PfemThermic/xml/Conditions.xml new file mode 100644 index 000000000..f04a87708 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/xml/Conditions.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/PfemThermic/xml/ConstitutiveLaws.xml b/kratos.gid/apps/PfemThermic/xml/ConstitutiveLaws.xml new file mode 100644 index 000000000..5ba9dff9b --- /dev/null +++ b/kratos.gid/apps/PfemThermic/xml/ConstitutiveLaws.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/PfemThermic/xml/FluidSolutionStrategy.spd b/kratos.gid/apps/PfemThermic/xml/FluidSolutionStrategy.spd new file mode 100644 index 000000000..27da2c54b --- /dev/null +++ b/kratos.gid/apps/PfemThermic/xml/FluidSolutionStrategy.spd @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/PfemThermic/xml/Main.spd b/kratos.gid/apps/PfemThermic/xml/Main.spd new file mode 100644 index 000000000..6ea3be860 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/xml/Main.spd @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/PfemThermic/xml/NodalConditions.spd b/kratos.gid/apps/PfemThermic/xml/NodalConditions.spd new file mode 100644 index 000000000..f593915b8 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/xml/NodalConditions.spd @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/PfemThermic/xml/NodalConditions.xml b/kratos.gid/apps/PfemThermic/xml/NodalConditions.xml new file mode 100644 index 000000000..cc55db927 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/xml/NodalConditions.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/PfemThermic/xml/Procs.spd b/kratos.gid/apps/PfemThermic/xml/Procs.spd new file mode 100644 index 000000000..08bacfe77 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/xml/Procs.spd @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/PfemThermic/xml/SolutionStrategyConvectionDiffusion.spd b/kratos.gid/apps/PfemThermic/xml/SolutionStrategyConvectionDiffusion.spd new file mode 100644 index 000000000..0e899c500 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/xml/SolutionStrategyConvectionDiffusion.spd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/kratos.gid/apps/PfemThermic/xml/XmlController.tcl b/kratos.gid/apps/PfemThermic/xml/XmlController.tcl new file mode 100644 index 000000000..3f564cd61 --- /dev/null +++ b/kratos.gid/apps/PfemThermic/xml/XmlController.tcl @@ -0,0 +1,105 @@ +namespace eval ::PfemThermic::xml { + namespace path ::PfemThermic + Kratos::AddNamespace [namespace current] + # Namespace variables declaration +} + +proc PfemThermic::xml::Init { } { + Model::InitVariables dir $::PfemThermic::dir + + Model::ForgetConstitutiveLaws + Model::getConstitutiveLaws ConstitutiveLaws.xml + + Model::ForgetNodalConditions + Model::getNodalConditions NodalConditions.xml + + Model::ForgetConditions + Model::getConditions Conditions.xml +} + +proc PfemThermic::xml::getUniqueName {name} { + return [::PfemThermic::GetAttribute prefix]${name} +} + +proc PfemThermic::xml::CustomTree { args } { + set root [customlib::GetBaseRoot] + spdAux::parseRoutes + + ########## From PfemFluid custom tree ########## + foreach node [$root getElementsByTagName container] { if {[$node hasAttribute prefix] && [$node getAttribute prefix] eq "PFEMTHERMIC_"} {set root $node; break} } + + foreach node [$root getElementsByTagName value] { $node setAttribute icon data } + foreach node [$root getElementsByTagName container] { if {[$node hasAttribute solstratname]} {$node setAttribute icon folder} } + + #foreach node [[$root parent] selectNodes "[spdAux::getRoute PFEMTHERMIC_FreeSurfaceFlux]"] { $node setAttribute icon select } + foreach node [[$root parent] selectNodes "[spdAux::getRoute Intervals]/blockdata"] { $node setAttribute icon select } + foreach node [[$root parent] selectNodes "[spdAux::getRoute PFEMFLUID_Materials]/blockdata" ] { $node setAttribute icon select } + foreach node [[$root parent] selectNodes "[spdAux::getRoute PFEMFLUID_StratSection]/container\[@n = 'linear_solver_settings'\]" ] { $node setAttribute icon select } + foreach node [[$root parent] selectNodes "[spdAux::getRoute PFEMFLUID_StratSection]/container\[@n = 'velocity_linear_solver_settings'\]" ] { $node setAttribute icon select } + foreach node [[$root parent] selectNodes "[spdAux::getRoute PFEMFLUID_StratSection]/container\[@n = 'pressure_linear_solver_settings'\]" ] { $node setAttribute icon select } + foreach node [[$root parent] selectNodes "[spdAux::getRoute CNVDFFStratSection]/container\[@n = 'linear_solver_settings'\]" ] { $node setAttribute icon data } + foreach node [[$root parent] selectNodes "[spdAux::getRoute CNVDFFStratSection]/container\[@n = 'StratParams'\]" ] { $node setAttribute icon data } + foreach node [[$root parent] selectNodes "[spdAux::getRoute PFEMFLUID_NodalConditions]/condition" ] { $node setAttribute icon select + $node setAttribute groups_icon groupCreated } + if {[spdAux::getRoute PFEMFLUID_Loads] ne ""} { + spdAux::SetValueOnTreeItem icon setLoad PFEMFLUID_Loads + foreach node [[$root parent] selectNodes "[spdAux::getRoute PFEMFLUID_Loads]/condition" ] { $node setAttribute icon select $node setAttribute groups_icon groupCreated } } + + set inlet_result_node [[$root parent] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'INLET'\]"] + if { $inlet_result_node ne "" } { $inlet_result_node delete } + + if {$Model::SpatialDimension eq "3D"} { + catch { + spdAux::SetValueOnTreeItem v -9.81 PFEMFLUID_Gravity Cy + spdAux::SetValueOnTreeItem v 0.0 PFEMFLUID_Gravity Cz } } + + [[$root parent] selectNodes "/Kratos_data/blockdata\[@n = 'units'\]"] setAttribute icon setUnits + + spdAux::SetValueOnTreeItem icon sheets Intervals + spdAux::SetValueOnTreeItem icon doRestart Restart + spdAux::SetValueOnTreeItem icon select Restart RestartOptions + + spdAux::SetValueOnTreeItem state \[CheckNodalConditionStatePFEM\] PFEMFLUID_NodalConditions VELOCITY + spdAux::SetValueOnTreeItem state \[CheckNodalConditionStatePFEM\] PFEMFLUID_NodalConditions PRESSURE + + spdAux::SetValueOnTreeItem v Yes NodalResults VELOCITY + spdAux::SetValueOnTreeItem v No NodalResults VELOCITY_REACTION + spdAux::SetValueOnTreeItem v Yes NodalResults PRESSURE + spdAux::SetValueOnTreeItem v No NodalResults PRESSURE_REACTION + spdAux::SetValueOnTreeItem v No NodalResults DISPLACEMENT + spdAux::SetValueOnTreeItem v No NodalResults DISPLACEMENT_REACTION + + set heatSource_result_node [[$root parent] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'HEAT_FLUX'\]"] + if { $heatSource_result_node ne "" } { $heatSource_result_node delete } + ################################################ + + ConvectionDiffusion::xml::CustomTree + + spdAux::SetValueOnTreeItem v linear CNVDFFAnalysisType + spdAux::SetValueOnTreeItem values transient CNVDFFSolStrat + spdAux::SetValueOnTreeItem state disabled CNVDFFSolStrat + spdAux::SetValueOnTreeItem v No CNVDFFStratParams line_search + spdAux::SetValueOnTreeItem state hidden CNVDFFStratParams line_search + spdAux::SetValueOnTreeItem v 1 CNVDFFStratParams echo_level +} + +proc PfemThermic::xml::ProcGetElementsValues {domNode args} { + set names [list ] + set blockNode [PfemFluid::xml::FindMyBlocknode $domNode] + set BodyType [get_domnode_attribute [$blockNode selectNodes "value\[@n='BodyType'\]"] v] + set argums [list ElementType $BodyType] + set elems [PfemFluid::xml::GetElements $domNode $args] + + foreach elem $elems { + if {[$elem cumple $argums] && [$elem getName] ne "RigidLagrangianElement2D3N" && [$elem getName] ne "RigidLagrangianElement3D4N"} { + lappend names [$elem getName] + } + } + + set values [join $names ","] + + if {[get_domnode_attribute $domNode v] eq ""} {$domNode setAttribute v [lindex $names 0]} + if {[get_domnode_attribute $domNode v] ni $names} {$domNode setAttribute v [lindex $names 0]} + + return $values +} diff --git a/kratos.gid/apps/PotentialFluid/app.json b/kratos.gid/apps/PotentialFluid/app.json new file mode 100644 index 000000000..6d580cefe --- /dev/null +++ b/kratos.gid/apps/PotentialFluid/app.json @@ -0,0 +1,47 @@ +{ + "id": "PotentialFluid", + "name": "PotentialFluid", + "prefix": "PTFL", + "themed": false, + "kratos_name": "CompressiblePotentialFlowApplication", + "dimensions": [ + "2D", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/NACA0012_2D.tcl", + "examples/NACA0012_3D.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl" + ], + "start_script":"::PotentialFluid::Init", + "requeriments":{ + "apps":["Fluid"], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": false, + "wizard": false + }, + "unique_names": { + "parts": "FLParts", + "nodal_conditions": "FLNodalConditions", + "conditions": "FLBC", + "materials": "FLMaterials", + "results": "FLResults", + "drag": "FLDrags", + "time_parameters": "FLTimeParameters" + }, + "write": { + "coordinates": "all", + "materials_file": "FluidMaterials.json", + "properties_location": "json" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} diff --git a/kratos.gid/apps/PotentialFluid/examples/NACA0012_2D.tcl b/kratos.gid/apps/PotentialFluid/examples/NACA0012_2D.tcl new file mode 100644 index 000000000..5e4dc53e4 --- /dev/null +++ b/kratos.gid/apps/PotentialFluid/examples/NACA0012_2D.tcl @@ -0,0 +1,130 @@ +namespace eval ::PotentialFluid::examples::NACA0012_2D { +namespace path ::PotentialFluid::examples + Kratos::AddNamespace [namespace current] +} + +proc ::PotentialFluid::examples::NACA0012_2D::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + DrawGeometry + AssignGroups + AssignMeshSizes + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame + +} + +proc ::PotentialFluid::examples::NACA0012_2D::DrawGeometry {args} { + Kratos::ResetModel + GiD_Layers create Fluid + GiD_Layers edit to_use Fluid + + # Geometry creation + ## Airfoil + GiD_Process Mescape Geometry Create NurbsLine 1.000000 0.000000 0 0.998459 0.000224 0 0.993844 0.000891 0 0.986185 0.001990 0 0.975528 0.003501 0 0.961940 0.005399 0 0.945503 0.007651 0 0.926320 0.010221 0 0.904508 0.013071 0 0.880203 0.016158 0 0.853553 0.019438 0 0.824724 0.022869 0 0.793893 0.026405 0 0.761249 0.030000 0 0.726995 0.033610 0 0.691342 0.037188 0 0.654508 0.040686 0 0.616723 0.044055 0 0.578217 0.047242 0 0.539230 0.050196 0 0.500000 0.052862 0 0.460770 0.055184 0 0.421783 0.057108 0 0.383277 0.058582 0 0.345492 0.059557 0 0.308658 0.059988 0 0.273005 0.059841 0 0.238751 0.059088 0 0.206107 0.057712 0 0.175276 0.055708 0 0.146447 0.053083 0 0.119797 0.049854 0 0.095492 0.046049 0 0.073680 0.041705 0 0.054497 0.036867 0 0.038060 0.031580 0 0.024472 0.025893 0 0.013815 0.019854 0 0.006156 0.013503 0 0.001541 0.006877 0 0.000000 0.000000 0 0.001541 -0.006877 0 0.006156 -0.013503 0 0.013815 -0.019854 0 0.024472 -0.025893 0 0.038060 -0.031580 0 0.054497 -0.036867 0 0.073680 -0.041705 0 0.095492 -0.046049 0 0.119797 -0.049854 0 0.146447 -0.053083 0 0.175276 -0.055708 0 0.206107 -0.057712 0 0.238751 -0.059088 0 0.273005 -0.059841 0 0.308658 -0.059988 0 0.345492 -0.059557 0 0.383277 -0.058582 0 0.421783 -0.057108 0 0.460770 -0.055184 0 0.500000 -0.052862 0 0.539230 -0.050196 0 0.578217 -0.047242 0 0.616723 -0.044055 0 0.654508 -0.040686 0 0.691342 -0.037188 0 0.726995 -0.033610 0 0.761249 -0.030000 0 0.793893 -0.026405 0 0.824724 -0.022869 0 0.853553 -0.019438 0 0.880203 -0.016158 0 0.904508 -0.013071 0 0.926320 -0.010221 0 0.945503 -0.007651 0 0.961940 -0.005399 0 0.975528 -0.003501 0 0.986185 -0.001990 0 0.993844 -0.000891 0 0.998459 -0.000224 0 Join 1 escape escape escape escape escape escape escape escape Escape + GiD_Process Mescape Geometry Edit DivideLine Multiple NumDivisions 2 1 escape escape escape + + ## Points ## + set coordinates [list 50 25 0 -50 25 0 -50 -25 0 50 -25 0] + set fluidPoints [list ] + foreach {x y z} $coordinates { + lappend fluidPoints [GiD_Geometry create point append Fluid $x $y $z] + } + + ## Lines ## + set fluidLines [list ] + set initial [lindex $fluidPoints 0] + foreach point [lrange $fluidPoints 1 end] { + lappend fluidLines [GiD_Geometry create line append stline Fluid $initial $point] + set initial $point + } + lappend fluidLines [GiD_Geometry create line append stline Fluid $initial [lindex $fluidPoints 0]] + + ## Surface + # Lines 2,3 (airfoil) and 4,5,6,7 (far field) + GiD_Process Mescape Geometry Create NurbsSurface 2 3 4 5 6 7 escape escape +} + +# Group assign +proc ::PotentialFluid::examples::NACA0012_2D::AssignGroups {args} { + # Create the groups + GiD_Groups create Fluid + GiD_Groups edit color Fluid "#26d1a8ff" + GiD_EntitiesGroups assign Fluid surfaces 1 + + GiD_Groups create FarField + GiD_Groups edit color FarField "#e0210fff" + GiD_EntitiesGroups assign FarField lines 4 + GiD_EntitiesGroups assign FarField lines 5 + GiD_EntitiesGroups assign FarField lines 6 + GiD_EntitiesGroups assign FarField lines 7 + + # GiD_Groups create UpperSurface + # GiD_Groups edit color UpperSurface "#42eb71ff" + # GiD_EntitiesGroups assign UpperSurface lines 2 + + # GiD_Groups create LowerSurface + # GiD_Groups edit color LowerSurface "#42eb71ff" + # GiD_EntitiesGroups assign LowerSurface lines 3 + + GiD_Groups create Body + GiD_Groups edit color Body "#42eb71ff" + GiD_EntitiesGroups assign Body lines {2 3} +} + +proc ::PotentialFluid::examples::NACA0012_2D::AssignMeshSizes {args} { + set fluid_mesh_size 2.0 + set airfoil_mesh_size 0.01 + GiD_Process Mescape Utilities Variables SizeTransitionsFactor 0.3 escape escape + # GiD_Process Mescape Meshing AssignSizes Lines $airfoil_mesh_size {*}[GiD_EntitiesGroups get UpperSurface lines] escape escape + # GiD_Process Mescape Meshing AssignSizes Lines $airfoil_mesh_size {*}[GiD_EntitiesGroups get LowerSurface lines] escape escape + GiD_Process Mescape Meshing AssignSizes Lines $airfoil_mesh_size {*}[GiD_EntitiesGroups get Body lines] escape escape + GiD_Process Mescape Meshing AssignSizes Surfaces $fluid_mesh_size [GiD_EntitiesGroups get Fluid surfaces] escape escape + +} + +proc ::PotentialFluid::examples::NACA0012_2D::TreeAssignation {args} { + set nd $::Model::SpatialDimension + set root [customlib::GetBaseRoot] + + set condtype line + set elemtype surface + if {$nd eq "3D"} { + set condtype surface + set elemtype volume + } + + # Fluid Parts + set fluidParts [spdAux::getRoute "FLParts"] + set fluidNode [customlib::AddConditionGroupOnXPath $fluidParts Fluid] + $fluidNode setAttribute ov $elemtype + set props [list Element PotentialFlowElement$nd ConstitutiveLaw Inviscid DENSITY 1.225] + spdAux::SetValuesOnBaseNode $fluidNode $props + + set fluidConditions [spdAux::getRoute "FLBC"] + ErasePreviousIntervals + + # Far field + set fluidFarField "$fluidConditions/condition\[@n='PotentialWallCondition$nd'\]" + set farFieldNode [customlib::AddConditionGroupOnXPath $fluidFarField FarField] + $farFieldNode setAttribute ov $condtype + set props [list angle_of_attack 0.0 mach_infinity 0.03 speed_of_sound 340.0] + spdAux::SetValuesOnBaseNode $farFieldNode $props + + # Fluid Conditions + [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='Body$nd'\]" Body] setAttribute ov $condtype + + # Parallelism + set parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] + set xpath [spdAux::getRoute "Parallelization"] + spdAux::SetValuesOnBasePath $xpath $parameters + + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/PotentialFluid/examples/NACA0012.tcl b/kratos.gid/apps/PotentialFluid/examples/NACA0012_3D.tcl similarity index 50% rename from kratos.gid/apps/PotentialFluid/examples/NACA0012.tcl rename to kratos.gid/apps/PotentialFluid/examples/NACA0012_3D.tcl index 50939b897..3a2ae24f1 100644 --- a/kratos.gid/apps/PotentialFluid/examples/NACA0012.tcl +++ b/kratos.gid/apps/PotentialFluid/examples/NACA0012_3D.tcl @@ -1,14 +1,18 @@ +namespace eval ::PotentialFluid::examples::NACA0012_3D { + namespace path ::PotentialFluid::examples + Kratos::AddNamespace [namespace current] +} -proc ::PotentialFluid::examples::NACA0012 {args} { +proc ::PotentialFluid::examples::NACA0012_3D::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawNACA0012Geometry$::Model::SpatialDimension - AssignGroupsNACA0012$::Model::SpatialDimension - AssignNACA0012MeshSizes$::Model::SpatialDimension - TreeAssignationNACA0012$::Model::SpatialDimension + DrawGeometry + AssignGroups + AssignMeshSizes + TreeAssignation GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -17,132 +21,8 @@ proc ::PotentialFluid::examples::NACA0012 {args} { } -proc PotentialFluid::examples::DrawNACA0012Geometry2D {args} { - Kratos::ResetModel - GiD_Layers create Fluid - GiD_Layers edit to_use Fluid - - # Geometry creation - ## Airfoil - GiD_Process Mescape Geometry Create NurbsLine 1.000000 0.000000 0 0.998459 0.000224 0 0.993844 0.000891 0 0.986185 0.001990 0 0.975528 0.003501 0 0.961940 0.005399 0 0.945503 0.007651 0 0.926320 0.010221 0 0.904508 0.013071 0 0.880203 0.016158 0 0.853553 0.019438 0 0.824724 0.022869 0 0.793893 0.026405 0 0.761249 0.030000 0 0.726995 0.033610 0 0.691342 0.037188 0 0.654508 0.040686 0 0.616723 0.044055 0 0.578217 0.047242 0 0.539230 0.050196 0 0.500000 0.052862 0 0.460770 0.055184 0 0.421783 0.057108 0 0.383277 0.058582 0 0.345492 0.059557 0 0.308658 0.059988 0 0.273005 0.059841 0 0.238751 0.059088 0 0.206107 0.057712 0 0.175276 0.055708 0 0.146447 0.053083 0 0.119797 0.049854 0 0.095492 0.046049 0 0.073680 0.041705 0 0.054497 0.036867 0 0.038060 0.031580 0 0.024472 0.025893 0 0.013815 0.019854 0 0.006156 0.013503 0 0.001541 0.006877 0 0.000000 0.000000 0 0.001541 -0.006877 0 0.006156 -0.013503 0 0.013815 -0.019854 0 0.024472 -0.025893 0 0.038060 -0.031580 0 0.054497 -0.036867 0 0.073680 -0.041705 0 0.095492 -0.046049 0 0.119797 -0.049854 0 0.146447 -0.053083 0 0.175276 -0.055708 0 0.206107 -0.057712 0 0.238751 -0.059088 0 0.273005 -0.059841 0 0.308658 -0.059988 0 0.345492 -0.059557 0 0.383277 -0.058582 0 0.421783 -0.057108 0 0.460770 -0.055184 0 0.500000 -0.052862 0 0.539230 -0.050196 0 0.578217 -0.047242 0 0.616723 -0.044055 0 0.654508 -0.040686 0 0.691342 -0.037188 0 0.726995 -0.033610 0 0.761249 -0.030000 0 0.793893 -0.026405 0 0.824724 -0.022869 0 0.853553 -0.019438 0 0.880203 -0.016158 0 0.904508 -0.013071 0 0.926320 -0.010221 0 0.945503 -0.007651 0 0.961940 -0.005399 0 0.975528 -0.003501 0 0.986185 -0.001990 0 0.993844 -0.000891 0 0.998459 -0.000224 0 Join 1 escape escape escape escape escape escape escape escape Escape - GiD_Process Mescape Geometry Edit DivideLine Multiple NumDivisions 2 1 escape escape escape - - ## Points ## - set coordinates [list 50 25 0 -50 25 0 -50 -25 0 50 -25 0] - set fluidPoints [list ] - foreach {x y z} $coordinates { - lappend fluidPoints [GiD_Geometry create point append Fluid $x $y $z] - } - - ## Lines ## - set fluidLines [list ] - set initial [lindex $fluidPoints 0] - foreach point [lrange $fluidPoints 1 end] { - lappend fluidLines [GiD_Geometry create line append stline Fluid $initial $point] - set initial $point - } - lappend fluidLines [GiD_Geometry create line append stline Fluid $initial [lindex $fluidPoints 0]] - - ## Surface - # Lines 2,3 (airfoil) and 4,5,6,7 (far field) - GiD_Process Mescape Geometry Create NurbsSurface 2 3 4 5 6 7 escape escape -} - -# Group assign -proc PotentialFluid::examples::AssignGroupsNACA00122D {args} { - # Create the groups - GiD_Groups create Fluid - GiD_Groups edit color Fluid "#26d1a8ff" - GiD_EntitiesGroups assign Fluid surfaces 1 - - GiD_Groups create FarField - GiD_Groups edit color FarField "#e0210fff" - GiD_EntitiesGroups assign FarField lines 4 - GiD_EntitiesGroups assign FarField lines 5 - GiD_EntitiesGroups assign FarField lines 6 - GiD_EntitiesGroups assign FarField lines 7 - - # GiD_Groups create UpperSurface - # GiD_Groups edit color UpperSurface "#42eb71ff" - # GiD_EntitiesGroups assign UpperSurface lines 2 - - # GiD_Groups create LowerSurface - # GiD_Groups edit color LowerSurface "#42eb71ff" - # GiD_EntitiesGroups assign LowerSurface lines 3 - - GiD_Groups create Body - GiD_Groups edit color Body "#42eb71ff" - GiD_EntitiesGroups assign Body lines {2 3} -} - -proc PotentialFluid::examples::AssignNACA0012MeshSizes2D {args} { - set fluid_mesh_size 2.0 - set airfoil_mesh_size 0.01 - GiD_Process Mescape Utilities Variables SizeTransitionsFactor 0.3 escape escape - # GiD_Process Mescape Meshing AssignSizes Lines $airfoil_mesh_size {*}[GiD_EntitiesGroups get UpperSurface lines] escape escape - # GiD_Process Mescape Meshing AssignSizes Lines $airfoil_mesh_size {*}[GiD_EntitiesGroups get LowerSurface lines] escape escape - GiD_Process Mescape Meshing AssignSizes Lines $airfoil_mesh_size {*}[GiD_EntitiesGroups get Body lines] escape escape - GiD_Process Mescape Meshing AssignSizes Surfaces $fluid_mesh_size [GiD_EntitiesGroups get Fluid surfaces] escape escape - -} - -proc PotentialFluid::examples::TreeAssignationNACA00122D {args} { - set nd $::Model::SpatialDimension - set root [customlib::GetBaseRoot] - - set condtype line - set elemtype surface - if {$nd eq "3D"} { - set condtype surface - set elemtype volume - } - - # Fluid Parts - set fluidParts [spdAux::getRoute "FLParts"] - set fluidNode [customlib::AddConditionGroupOnXPath $fluidParts Fluid] - $fluidNode setAttribute ov $elemtype - set props [list Element PotentialFlowElement$nd ConstitutiveLaw Inviscid DENSITY 1.225] - spdAux::SetValuesOnBaseNode $fluidNode $props - - set fluidConditions [spdAux::getRoute "FLBC"] - ErasePreviousIntervals - - # Far field - set fluidFarField "$fluidConditions/condition\[@n='PotentialWallCondition$nd'\]" - set farFieldNode [customlib::AddConditionGroupOnXPath $fluidFarField FarField] - $farFieldNode setAttribute ov $condtype - set props [list angle_of_attack 0.0 mach_infinity 0.03 speed_of_sound 340.0] - spdAux::SetValuesOnBaseNode $farFieldNode $props - - # Fluid Conditions - [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='Body$nd'\]" Body] setAttribute ov $condtype - - # Parallelism - set parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] - set xpath [spdAux::getRoute "Parallelization"] - spdAux::SetValuesOnBasePath $xpath $parameters - - spdAux::RequestRefresh -} - -proc PotentialFluid::examples::ErasePreviousIntervals { } { - set root [customlib::GetBaseRoot] - set interval_base [spdAux::getRoute "Intervals"] - foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { - if {[$int @name] ni [list Initial Total Custom1]} {$int delete} - } -} - -proc PotentialFluid::examples::AddCuts { } { - # Cuts - set results "[spdAux::getRoute FLResults]/container\[@n='GiDOutput'\]" - - set cp [[customlib::GetBaseRoot] selectNodes "$results/container\[@n = 'CutPlanes'\]/blockdata\[@name = 'CutPlane'\]"] - [$cp selectNodes "./value\[@n = 'point'\]"] setAttribute v "0.0,0.5,0.0" -} - # Draw Geometry -proc PotentialFluid::examples::DrawNACA0012Geometry3D {args} { +proc ::PotentialFluid::examples::NACA0012_3D::DrawGeometry {args} { Kratos::ResetModel GiD_Layers create Fluid GiD_Layers edit to_use Fluid @@ -183,7 +63,7 @@ proc PotentialFluid::examples::DrawNACA0012Geometry3D {args} { } # Group assign -proc PotentialFluid::examples::AssignGroupsNACA00123D {args} { +proc ::PotentialFluid::examples::NACA0012_3D::AssignGroups {args} { GiD_Groups create Fluid GiD_Groups edit color Fluid "#26d1a8ff" GiD_EntitiesGroups assign Fluid volumes 1 @@ -213,7 +93,7 @@ proc PotentialFluid::examples::AssignGroupsNACA00123D {args} { GiD_EntitiesGroups assign WingTips points {1 7} } -proc PotentialFluid::examples::AssignNACA0012MeshSizes3D {args} { +proc ::PotentialFluid::examples::NACA0012_3D::AssignMeshSizes {args} { #set fluid_mesh_size 2.0 set wing_lines_mesh_size 0.1 # set wing_points_mesh_size 0.1 @@ -226,7 +106,7 @@ proc PotentialFluid::examples::AssignNACA0012MeshSizes3D {args} { #Kratos::Event_BeforeMeshGeneration $fluid_mesh_size } -proc PotentialFluid::examples::TreeAssignationNACA00123D {args} { +proc ::PotentialFluid::examples::NACA0012_3D::TreeAssignation {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] diff --git a/kratos.gid/apps/PotentialFluid/examples/examples.tcl b/kratos.gid/apps/PotentialFluid/examples/examples.tcl index cb4b81a58..9e38c2668 100644 --- a/kratos.gid/apps/PotentialFluid/examples/examples.tcl +++ b/kratos.gid/apps/PotentialFluid/examples/examples.tcl @@ -1,15 +1,21 @@ -namespace eval PotentialFluid::examples { +namespace eval ::PotentialFluid::examples { + namespace path ::PotentialFluid + Kratos::AddNamespace [namespace current] } -proc PotentialFluid::examples::Init { } { - uplevel #0 [list source [file join $::PotentialFluid::dir examples NACA0012.tcl]] +proc ::PotentialFluid::examples::ErasePreviousIntervals { } { + set root [customlib::GetBaseRoot] + set interval_base [spdAux::getRoute "Intervals"] + foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] { + if {[$int @name] ni [list Initial Total Custom1]} {$int delete} + } } -proc PotentialFluid::examples::UpdateMenus { } { - GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "NACA 0012" ] 8 PRE [list ::PotentialFluid::examples::NACA0012] "" "" insertafter = - GiDMenu::UpdateMenus -} +proc ::PotentialFluid::examples::AddCuts { } { + # Cuts + set results "[spdAux::getRoute FLResults]/container\[@n='GiDOutput'\]" -PotentialFluid::examples::Init \ No newline at end of file + set cp [[customlib::GetBaseRoot] selectNodes "$results/container\[@n = 'CutPlanes'\]/blockdata\[@name = 'CutPlane'\]"] + [$cp selectNodes "./value\[@n = 'point'\]"] setAttribute v "0.0,0.5,0.0" +} \ No newline at end of file diff --git a/kratos.gid/apps/PotentialFluid/examples/examples.xml b/kratos.gid/apps/PotentialFluid/examples/examples.xml new file mode 100644 index 000000000..55a559643 --- /dev/null +++ b/kratos.gid/apps/PotentialFluid/examples/examples.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/PotentialFluid/images/NACA0012.png b/kratos.gid/apps/PotentialFluid/images/NACA0012.png new file mode 100644 index 000000000..e8c8ef3c7 Binary files /dev/null and b/kratos.gid/apps/PotentialFluid/images/NACA0012.png differ diff --git a/kratos.gid/apps/PotentialFluid/python/KratosPotentialFluid.py b/kratos.gid/apps/PotentialFluid/python/KratosPotentialFluid.py deleted file mode 100644 index 9a6c2d810..000000000 --- a/kratos.gid/apps/PotentialFluid/python/KratosPotentialFluid.py +++ /dev/null @@ -1,17 +0,0 @@ -#makes KratosMultiphysics backward compatible with python 2.6 and 2.7 -from __future__ import print_function, absolute_import, division - -import KratosMultiphysics - -from KratosMultiphysics.CompressiblePotentialFlowApplication.potential_flow_analysis import PotentialFlowAnalysis - -# For user-scripting it is intended that a new class is derived from PotentialFlowAnalysis to do modifications - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = PotentialFlowAnalysis(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/PotentialFluid/start.tcl b/kratos.gid/apps/PotentialFluid/start.tcl index 474431ac7..f0ad1765f 100644 --- a/kratos.gid/apps/PotentialFluid/start.tcl +++ b/kratos.gid/apps/PotentialFluid/start.tcl @@ -1,62 +1,26 @@ namespace eval ::PotentialFluid { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir - variable prefix - variable attributes - variable app_id - variable kratos_name + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::PotentialFluid::Init { } { +proc ::PotentialFluid::Init { app } { # Variable initialization variable dir - variable prefix - variable attributes - variable kratos_name - set app_id "PotentialFluid" - set kratos_name "CompressiblePotentialFlowApplication" - - apps::LoadAppById "Fluid" + variable _app set dir [apps::getMyDir "PotentialFluid"] - set attributes [dict create] - - set prefix PTFL - set ::Model::ValidSpatialDimensions [list 2D 3D] - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - - dict set attributes UseIntervals 0 - - LoadMyFiles + set _app $app + Kratos::AddRestoreVar "::GidPriv(DuplicateEntities)" set ::GidPriv(DuplicateEntities) 1 + PotentialFluid::xml::Init + PotentialFluid::write::Init - # TODO: activate this as soon as the 3D wake detection is working - #::spdAux::CreateDimensionWindow -} - -proc ::PotentialFluid::LoadMyFiles { } { - variable dir - - uplevel #0 [list source [file join $dir examples examples.tcl]] - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] -} - -proc ::PotentialFluid::GetAttribute {name} { - variable attributes - set value "" - catch {set value [dict get $attributes $name]} - return $value -} - -proc ::PotentialFluid::CustomToolbarItems { } { - variable dir - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::PotentialFluid::examples::NACA0012] [= "Example\nNACA 0012"] -} - - -::PotentialFluid::Init +} \ No newline at end of file diff --git a/kratos.gid/apps/PotentialFluid/write/write.tcl b/kratos.gid/apps/PotentialFluid/write/write.tcl index c9ab89bda..fa99cf936 100644 --- a/kratos.gid/apps/PotentialFluid/write/write.tcl +++ b/kratos.gid/apps/PotentialFluid/write/write.tcl @@ -1,65 +1,31 @@ -namespace eval PotentialFluid::write { +namespace eval ::PotentialFluid::write { + namespace path ::PotentialFluid + Kratos::AddNamespace [namespace current] + variable writeAttributes variable FluidConditionMap } -proc PotentialFluid::write::Init { } { +proc ::PotentialFluid::write::Init { } { # Namespace variables inicialization - SetAttribute parts_un FLParts - SetAttribute nodal_conditions_un FLNodalConditions - SetAttribute conditions_un FLBC - SetAttribute materials_un PTFLMaterials - SetAttribute results_un Results - SetAttribute drag_un FLDrags - SetAttribute time_parameters_un FLTimeParameters - SetAttribute writeCoordinatesByGroups 0 + variable writeAttributes + set writeAttributes [::Fluid::write::GetAttributes] SetAttribute validApps [list "Fluid" "PotentialFluid"] - SetAttribute main_script_file "KratosPotentialFluid.py" - SetAttribute materials_file "FluidMaterials.json" - SetAttribute properties_location json - SetAttribute output_model_part_name "fluid_computational_model_part" } # Events proc PotentialFluid::write::writeModelPartEvent { } { # Add the PotentialFluid to the Fluid valid applications list Fluid::write::AddValidApps "PotentialFluid" - - # Validation - Fluid::write::InitConditionsMap - - set err [Fluid::write::Validate] - if {$err ne ""} {error $err} - - # Init data - write::initWriteConfiguration [GetAttributes] - - # Headers - write::writeModelPartData - Fluid::write::writeProperties - - # Nodal coordinates (1: Print only Fluid nodes | 0: the whole mesh ) - if {[GetAttribute writeCoordinatesByGroups]} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} - - # Element connectivities (groups in FLParts) - write::writeElementConnectivities - - # Nodal conditions and conditions - Fluid::write::writeConditions - - # SubmodelParts - Fluid::write::writeMeshes + Fluid::write::writeModelPartEvent } proc PotentialFluid::write::writeCustomFilesEvent { } { # Write the fluid materials json file - write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] False - - write::CopyFileIntoModel "python/KratosPotentialFluid.py" - write::RenameFileInModel "KratosPotentialFluid.py" "MainKratos.py" + write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] False [GetAttribute model_part_name] + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] } - proc PotentialFluid::write::GetAttribute {att} { variable writeAttributes return [dict get $writeAttributes $att] diff --git a/kratos.gid/apps/PotentialFluid/xml/Materials.spd b/kratos.gid/apps/PotentialFluid/xml/Materials.spd index 1b3e404c1..f351f7613 100644 --- a/kratos.gid/apps/PotentialFluid/xml/Materials.spd +++ b/kratos.gid/apps/PotentialFluid/xml/Materials.spd @@ -1,4 +1,4 @@ - + diff --git a/kratos.gid/apps/PotentialFluid/xml/Materials.xml b/kratos.gid/apps/PotentialFluid/xml/Materials.xml index be3d18b3b..1b2f8262b 100644 --- a/kratos.gid/apps/PotentialFluid/xml/Materials.xml +++ b/kratos.gid/apps/PotentialFluid/xml/Materials.xml @@ -4,13 +4,13 @@ - + - + diff --git a/kratos.gid/apps/PotentialFluid/xml/Procs.spd b/kratos.gid/apps/PotentialFluid/xml/Procs.spd index cf2089264..4f9570707 100644 --- a/kratos.gid/apps/PotentialFluid/xml/Procs.spd +++ b/kratos.gid/apps/PotentialFluid/xml/Procs.spd @@ -35,4 +35,9 @@ return $r ]]> + + + \ No newline at end of file diff --git a/kratos.gid/apps/PotentialFluid/xml/XmlController.tcl b/kratos.gid/apps/PotentialFluid/xml/XmlController.tcl index f0a8f2cf2..5a8cdc3a7 100644 --- a/kratos.gid/apps/PotentialFluid/xml/XmlController.tcl +++ b/kratos.gid/apps/PotentialFluid/xml/XmlController.tcl @@ -1,6 +1,8 @@ -namespace eval PotentialFluid::xml { +namespace eval ::PotentialFluid::xml { + namespace path ::PotentialFluid + Kratos::AddNamespace [namespace current] + # Namespace variables declaration - variable dir variable lastImportMeshSize variable export_dir @@ -8,9 +10,8 @@ namespace eval PotentialFluid::xml { proc PotentialFluid::xml::Init { } { # Namespace variables inicialization - variable dir Model::DestroyEverything - Model::InitVariables dir $PotentialFluid::dir + Model::InitVariables dir [apps::getMyDir "PotentialFluid"] Model::getSolutionStrategies Strategies.xml Model::getElements Elements.xml @@ -28,12 +29,12 @@ proc PotentialFluid::xml::Init { } { proc PotentialFluid::xml::MultiAppEvent {args} { if {$args eq "init"} { spdAux::parseRoutes - spdAux::ConvertAllUniqueNames FL ${::PotentialFluid::prefix} + spdAux::ConvertAllUniqueNames [::Fluid::GetAttribute prefix] [::PotentialFluid::GetAttribute prefix] } } proc PotentialFluid::xml::getUniqueName {name} { - return ${::PotentialFluid::prefix}${name} + return [::PotentialFluid::GetAttribute prefix]${name} } proc PotentialFluid::xml::CustomTree { args } { @@ -51,4 +52,3 @@ proc spdAux::injectConditions { basenode args} { $basenode delete } -PotentialFluid::xml::Init diff --git a/kratos.gid/apps/ShallowWater/app.json b/kratos.gid/apps/ShallowWater/app.json new file mode 100644 index 000000000..72023b669 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/app.json @@ -0,0 +1,46 @@ +{ + "id": "ShallowWater", + "name": "Shallow water", + "prefix": "SW", + "themed": false, + "kratos_name": "ShallowWaterApplication", + "dimensions": [ + "2D" + ], + "script_files": [ + "start.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl", + "examples/examples.tcl", + "examples/DamBreak.tcl", + "examples/HydraulicJump.tcl" + ], + "start_script": "::ShallowWater::Init", + "requeriments":{ + "apps":[], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false + }, + "unique_names": { + "parts": "SWParts", + "materials": "SWMaterials", + "topography_data": "SWTopographicData", + "initial_conditions": "SWInitialConditions", + "conditions": "SWConditions" + }, + "write": { + "coordinates": "all", + "materials_file": "TopographyMaterials.json", + "properties_location": "json", + "model_part_name": "main_model_part", + "output_model_part_name": "main_model_part" + }, + "main_launch_file": "../../exec/MainKratos.py", + "description": "Tools for the simulation of free surface flows under the shallow water assumptions." +} \ No newline at end of file diff --git a/kratos.gid/apps/ShallowWater/examples/DamBreak.tcl b/kratos.gid/apps/ShallowWater/examples/DamBreak.tcl new file mode 100644 index 000000000..eb495c050 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/examples/DamBreak.tcl @@ -0,0 +1,157 @@ +namespace eval ::ShallowWater::examples::DamBreak { + namespace path ::ShallowWater::examples + Kratos::AddNamespace [namespace current] +} + +proc ::ShallowWater::examples::DamBreak::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + DrawGeometry + AssignGroups + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame +} + +proc ::ShallowWater::examples::DamBreak::DrawGeometry {args} { + Kratos::ResetModel + GiD_Layers create main_layer + GiD_Layers edit to_use main_layer + + # Geometry creation + ## Points ## + set coordinates_left [list 0 0 0 5 0 0 5 1 0 0 1 0] + set geom_points_left [list ] + foreach {x y z} $coordinates_left { + lappend geom_points_left [GiD_Geometry create point append main_layer $x $y $z] + } + + set coordinates_right [list 5 0 0 10 0 0 10 1 0 5 1 0] + set geom_points_right [list ] + foreach {x y z} $coordinates_right { + lappend geom_points_right [GiD_Geometry create point append main_layer $x $y $z] + } + + ## Lines ## + set geom_lines_left [list ] + set initial [lindex $geom_points_left 0] + foreach point [lrange $geom_points_left 1 end] { + lappend geom_lines_left [GiD_Geometry create line append stline main_layer $initial $point] + set initial $point + } + lappend geom_lines_left [GiD_Geometry create line append stline main_layer $initial [lindex $geom_points_left 0]] + + set geom_lines_right [list ] + set initial [lindex $geom_points_right 0] + foreach point [lrange $geom_points_right 1 end] { + lappend geom_lines_right [GiD_Geometry create line append stline main_layer $initial $point] + set initial $point + } + lappend geom_lines_right [GiD_Geometry create line append stline main_layer $initial [lindex $geom_points_right 0]] + + ## Surface ## + GiD_Process Mescape Geometry Create NurbsSurface {*}$geom_lines_left escape escape + GiD_Process Mescape Geometry Create NurbsSurface {*}$geom_lines_right escape escape + + ## Remove the duplicated line + GiD_Process Mescape Utilities Collapse model Yes +} + +proc ::ShallowWater::examples::DamBreak::AssignGroups {args} { + # Create and assign the groups + GiD_Groups create Body + GiD_Groups edit color Body "#26d1a8ff" + GiD_EntitiesGroups assign Body surfaces {1 2} + + GiD_Groups create Reservoir + GiD_Groups edit color Reservoir "#26d1a8ff" + GiD_EntitiesGroups assign Reservoir surfaces 1 + + GiD_Groups create Channel + GiD_Groups edit color Channel "#26d1a8ff" + GiD_EntitiesGroups assign Channel surfaces 2 + + GiD_Groups create Walls + GiD_Groups edit color Walls "#3b3b3bff" + GiD_EntitiesGroups assign Walls lines {1 3 5 7} + + GiD_Groups create Left + GiD_Groups edit color Left "#3b3b3bff" + GiD_EntitiesGroups assign Left lines 4 + + GiD_Groups create Right + GiD_Groups edit color Right "#3b3b3bff" + GiD_EntitiesGroups assign Right lines 6 +} + +proc ::ShallowWater::examples::DamBreak::TreeAssignation {args} { + + # Parts + set parts [spdAux::getRoute "SWParts"] + set part_node [customlib::AddConditionGroupOnXPath $parts Body] + set props [list Element GENERIC_ELEMENT Material Concrete] + spdAux::SetValuesOnBaseNode $part_node $props + + # Topography data + set topography_conditions [spdAux::getRoute "SWTopographicData"] + set topography_cond "$topography_conditions/condition\[@n='Topography'\]" + set topography_node [customlib::AddConditionGroupOnXPath $topography_cond Body] + $topography_node setAttribute ov surface + set props [list value 0.0] + spdAux::SetValuesOnBaseNode $topography_node $props + + # Initial conditions + set initial_conditions [spdAux::getRoute "SWInitialConditions"] + set initial_cond "$initial_conditions/condition\[@n='InitialWaterLevel'\]" + spdAux::AddIntervalGroup Reservoir "Reservoir//Initial" + set initial_node [customlib::AddConditionGroupOnXPath $initial_cond "Reservoir//Initial"] + $initial_node setAttribute ov surface + set props [list value 1.0 Interval Initial] + spdAux::SetValuesOnBaseNode $initial_node $props + + spdAux::AddIntervalGroup Channel "Channel//Initial" + set initial_node [customlib::AddConditionGroupOnXPath $initial_cond "Channel//Initial"] + $initial_node setAttribute ov surface + set props [list value 0.8 Interval Initial] + spdAux::SetValuesOnBaseNode $initial_node $props + + # Conditions + set boundary_conditions [spdAux::getRoute "SWConditions"] + set flow_rate_cond "$boundary_conditions/condition\[@n='ImposedFlowRate'\]" + spdAux::AddIntervalGroup Walls "Walls//Total" + set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Walls//Total"] + $flow_rate_node setAttribute ov line + set props [list selector_component_X Not value_component_Y 0.0 selector_component_Z Not Interval Total] + spdAux::SetValuesOnBaseNode $flow_rate_node $props + + spdAux::AddIntervalGroup Right "Right//Total" + set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Right//Total"] + $flow_rate_node setAttribute ov line + set props [list value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total] + spdAux::SetValuesOnBaseNode $flow_rate_node $props + + spdAux::AddIntervalGroup Left "Left//Total" + set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Left//Total"] + $flow_rate_node setAttribute ov line + set props [list value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total] + spdAux::SetValuesOnBaseNode $flow_rate_node $props + + # Time parameters + set parameters [list EndTime 2.0] + set xpath [spdAux::getRoute "SWTimeParameters"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Output + set parameters [list OutputControlType time OutputDeltaTime 0.1] + set xpath "[spdAux::getRoute Results]/container\[@n='GiDOutput'\]/container\[@n='GiDOptions'\]" + spdAux::SetValuesOnBasePath $xpath $parameters + + # Refresh + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/ShallowWater/examples/HydraulicJump.tcl b/kratos.gid/apps/ShallowWater/examples/HydraulicJump.tcl new file mode 100644 index 000000000..66b8d82fd --- /dev/null +++ b/kratos.gid/apps/ShallowWater/examples/HydraulicJump.tcl @@ -0,0 +1,127 @@ +namespace eval ::ShallowWater::examples::HydraulicJump { + namespace path ::ShallowWater::examples + Kratos::AddNamespace [namespace current] +} + +proc ::ShallowWater::examples::HydraulicJump::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + DrawGeometry + AssignGroups + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame +} + +proc ::ShallowWater::examples::HydraulicJump::DrawGeometry {args} { + Kratos::ResetModel + GiD_Layers create main_layer + GiD_Layers edit to_use main_layer + + # Geometry creation + ## Points ## + set coordinates [list 0 0 0 100 0 0 100 4 0 0 4 0] + set geom_points [list ] + foreach {x y z} $coordinates { + lappend geom_points [GiD_Geometry create point append main_layer $x $y $z] + } + + ## Lines ## + set geom_lines [list ] + set initial [lindex $geom_points 0] + foreach point [lrange $geom_points 1 end] { + lappend geom_lines [GiD_Geometry create line append stline main_layer $initial $point] + set initial $point + } + lappend geom_lines [GiD_Geometry create line append stline main_layer $initial [lindex $geom_points 0]] + + ## Surface ## + GiD_Process Mescape Geometry Create NurbsSurface {*}$geom_lines escape escape +} + +proc ::ShallowWater::examples::HydraulicJump::AssignGroups {args} { + # Create and assign the groups + GiD_Groups create Channel + GiD_Groups edit color Channel "#26d1a8ff" + GiD_EntitiesGroups assign Channel surfaces 1 + + GiD_Groups create Walls + GiD_Groups edit color Walls "#3b3b3bff" + GiD_EntitiesGroups assign Walls lines {1 3} + + GiD_Groups create Upstream + GiD_Groups edit color Upstream "#3b3b3bff" + GiD_EntitiesGroups assign Upstream lines 4 + + GiD_Groups create Downstream + GiD_Groups edit color Downstream "#3b3b3bff" + GiD_EntitiesGroups assign Downstream lines 2 +} + +proc ::ShallowWater::examples::HydraulicJump::TreeAssignation {args} { + + # Parts + set parts [spdAux::getRoute "SWParts"] + set part_node [customlib::AddConditionGroupOnXPath $parts Channel] + set props [list Element GENERIC_ELEMENT Material Concrete] + spdAux::SetValuesOnBaseNode $part_node $props + + # Topography data + set topography_conditions [spdAux::getRoute "SWTopographicData"] + set topography_cond "$topography_conditions/condition\[@n='Topography'\]" + set topography_node [customlib::AddConditionGroupOnXPath $topography_cond Channel] + $topography_node setAttribute ov surface + set props [list ByFunction Yes function_value "4.49449786e-09*x**5 -8.78489155e-07*x**4 +5.11763010e-05*x**3 -1.12368582e-03*x**2 +4.70535924e-03*x +2.58777553"] + spdAux::SetValuesOnBaseNode $topography_node $props + + # Initial conditions + set initial_conditions [spdAux::getRoute "SWInitialConditions"] + set initial_cond "$initial_conditions/condition\[@n='InitialWaterLevel'\]" + spdAux::AddIntervalGroup Channel "Channel//Initial" + set initial_node [customlib::AddConditionGroupOnXPath $initial_cond "Channel//Initial"] + $initial_node setAttribute ov surface + set props [list variable_name FREE_SURFACE_ELEVATION value 2.8 Interval Initial set_minimum_height 1 minimum_height_value 1] + spdAux::SetValuesOnBaseNode $initial_node $props + + # Conditions + set boundary_conditions [spdAux::getRoute "SWConditions"] + set flow_rate_cond "$boundary_conditions/condition\[@n='ImposedFlowRate'\]" + set water_height_cond "$boundary_conditions/condition\[@n='ImposedFreeSurface'\]" + + spdAux::AddIntervalGroup Walls "Walls//Total" + set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Walls//Total"] + $flow_rate_node setAttribute ov line + set props [list selector_component_X Not value_component_Y 0.0 selector_component_Z Not Interval Total] + spdAux::SetValuesOnBaseNode $flow_rate_node $props + + spdAux::AddIntervalGroup Upstream "Upstream//Total" + set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Upstream//Total"] + $flow_rate_node setAttribute ov line + set props [list value_component_X 2.0 selector_component_Y 0.0 selector_component_Z Not Interval Total] + spdAux::SetValuesOnBaseNode $flow_rate_node $props + + spdAux::AddIntervalGroup Downstream "Downstream//Total" + set free_surface_node [customlib::AddConditionGroupOnXPath $water_height_cond "Downstream//Total"] + $free_surface_node setAttribute ov line + set props [list value 2.8 Interval Total] + spdAux::SetValuesOnBaseNode $free_surface_node $props + + # Time parameters + set parameters [list EndTime 50.0] + set xpath [spdAux::getRoute "SWTimeParameters"] + spdAux::SetValuesOnBasePath $xpath $parameters + + # Output + set parameters [list OutputControlType time OutputDeltaTime 1.0] + set xpath "[spdAux::getRoute Results]/container\[@n='GiDOutput'\]/container\[@n='GiDOptions'\]" + spdAux::SetValuesOnBasePath $xpath $parameters + + # Refresh + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/ShallowWater/examples/Waves.tcl b/kratos.gid/apps/ShallowWater/examples/Waves.tcl new file mode 100644 index 000000000..aaa181388 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/examples/Waves.tcl @@ -0,0 +1,99 @@ +namespace eval ::ShallowWater::examples::Waves { + namespace path ::ShallowWater::examples + Kratos::AddNamespace [namespace current] +} + +proc ::ShallowWater::examples::Waves::Init {args} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + DrawGeometry + AssignGroups + TreeAssignation + + GiD_Process 'Redraw + GidUtils::UpdateWindow GROUPS + GidUtils::UpdateWindow LAYER + GiD_Process 'Zoom Frame +} + +proc ::ShallowWater::examples::Waves::DrawGeometry {args} { + Kratos::ResetModel + GiD_Layers create main_layer + GiD_Layers edit to_use main_layer + + # Geometry creation + ## Points ## + set coordinates [list 0 0 0 10 0 0 10 10 0 0 10 0] + set geom_points [list ] + foreach {x y z} $coordinates { + lappend geom_points [GiD_Geometry create point append main_layer $x $y $z] + } + + ## Lines ## + set geom_lines [list ] + set initial [lindex $geom_points 0] + foreach point [lrange $geom_points 1 end] { + lappend geom_lines [GiD_Geometry create line append stline main_layer $initial $point] + set initial $point + } + lappend geom_lines [GiD_Geometry create line append stline main_layer $initial [lindex $geom_points_left 0]] + + ## Surface ## + GiD_Process Mescape Geometry Create NurbsSurface {*}$geom_lines escape escape +} + +proc ::ShallowWater::examples::Waves::AssignGroups {args} { + # Create and assign the groups + GiD_Groups create Body + GiD_Groups edit color Body "#26d1a8ff" + GiD_EntitiesGroups assign Body surfaces 1 + + GiD_Groups create Walls + GiD_Groups edit color Walls "#3b3b3bff" + GiD_EntitiesGroups assign Walls lines {1 2 3 4} +} + +proc ::ShallowWater::examples::Waves::TreeAssignation {args} { + + # Parts + set parts [spdAux::getRoute "SWParts"] + set part_node [customlib::AddConditionGroupOnXPath $parts Body] + set props [list Element GENERIC_ELEMENT Material Concrete] + spdAux::SetValuesOnBaseNode $part_node $props + + # Initial conditions + set initial_conditions [spdAux::getRoute "SWInitialConditions"] + set initial_cond "$initial_conditions/condition\[@n='InitialWaterLevel'\]" + spdAux::AddIntervalGroup Body "Body//Initial" + set initial_node [customlib::AddConditionGroupOnXPath $initial_cond "Body//Initial"] + $initial_node setAttribute ov surface + set props [list value 1.0 Interval Initial] + spdAux::SetValuesOnBaseNode $initial_node $props + + # Conditions + set boundary_conditions [spdAux::getRoute "SWConditions"] + set flow_rate_cond "$boundary_conditions/condition\[@n='ImposedFlowRate'\]" + spdAux::AddIntervalGroup Walls "Walls//Total" + set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Walls//Total"] + $flow_rate_node setAttribute ov line + set props [list selector_component_X Not value_component_Y 0.0 Interval Total] + spdAux::SetValuesOnBaseNode $flow_rate_node $props + + # spdAux::AddIntervalGroup Right "Right//Total" + # set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Right//Total"] + # $flow_rate_node setAttribute ov line + # set props [list value_component_X 0.0 selector_component_Y Not Interval Total] + # spdAux::SetValuesOnBaseNode $flow_rate_node $props + + # spdAux::AddIntervalGroup Left "Left//Total" + # set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Left//Total"] + # $flow_rate_node setAttribute ov line + # set props [list value_component_X 0.0 selector_component_Y Not Interval Total] + # spdAux::SetValuesOnBaseNode $flow_rate_node $props + + # Refresh + spdAux::RequestRefresh +} diff --git a/kratos.gid/apps/ShallowWater/examples/examples.tcl b/kratos.gid/apps/ShallowWater/examples/examples.tcl new file mode 100644 index 000000000..a5d7ee15a --- /dev/null +++ b/kratos.gid/apps/ShallowWater/examples/examples.tcl @@ -0,0 +1,4 @@ +namespace eval ::ShallowWater::examples { + namespace path ::ShallowWater + Kratos::AddNamespace [namespace current] +} diff --git a/kratos.gid/apps/ShallowWater/examples/examples.xml b/kratos.gid/apps/ShallowWater/examples/examples.xml new file mode 100644 index 000000000..6ddac7034 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/examples/examples.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/kratos.gid/apps/ShallowWater/images/channel_inlet.png b/kratos.gid/apps/ShallowWater/images/channel_inlet.png new file mode 100644 index 000000000..90e01dafd Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/channel_inlet.png differ diff --git a/kratos.gid/apps/ShallowWater/images/dam_break.png b/kratos.gid/apps/ShallowWater/images/dam_break.png new file mode 100644 index 000000000..df3929487 Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/dam_break.png differ diff --git a/kratos.gid/apps/ShallowWater/images/gravity_vector.png b/kratos.gid/apps/ShallowWater/images/gravity_vector.png new file mode 100644 index 000000000..9a582f9ae Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/gravity_vector.png differ diff --git a/kratos.gid/apps/ShallowWater/images/jump.png b/kratos.gid/apps/ShallowWater/images/jump.png new file mode 100644 index 000000000..08d10334a Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/jump.png differ diff --git a/kratos.gid/apps/ShallowWater/images/land.png b/kratos.gid/apps/ShallowWater/images/land.png new file mode 100644 index 000000000..437c97880 Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/land.png differ diff --git a/kratos.gid/apps/ShallowWater/images/logo.png b/kratos.gid/apps/ShallowWater/images/logo.png new file mode 100644 index 000000000..2cd317722 Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/logo.png differ diff --git a/kratos.gid/apps/ShallowWater/images/logo_old.png b/kratos.gid/apps/ShallowWater/images/logo_old.png new file mode 100644 index 000000000..b44d924e7 Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/logo_old.png differ diff --git a/kratos.gid/apps/ShallowWater/images/topography.png b/kratos.gid/apps/ShallowWater/images/topography.png new file mode 100644 index 000000000..d851fc854 Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/topography.png differ diff --git a/kratos.gid/apps/ShallowWater/images/wave.png b/kratos.gid/apps/ShallowWater/images/wave.png new file mode 100644 index 000000000..633ccc28b Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/wave.png differ diff --git a/kratos.gid/apps/ShallowWater/images/waves.png b/kratos.gid/apps/ShallowWater/images/waves.png new file mode 100644 index 000000000..d4c65fe21 Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/waves.png differ diff --git a/kratos.gid/apps/ShallowWater/start.tcl b/kratos.gid/apps/ShallowWater/start.tcl new file mode 100644 index 000000000..68eb33a08 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/start.tcl @@ -0,0 +1,22 @@ +namespace eval ::ShallowWater { + Kratos::AddNamespace [namespace current] + + # Variable declaration + variable _app + variable dir + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} +} + +proc ::ShallowWater::Init {app} { + # Variable initialization + variable _app + variable dir + set _app $app + set dir [apps::getMyDir "ShallowWater"] + + ::ShallowWater::xml::Init + ::ShallowWater::write::Init +} diff --git a/kratos.gid/apps/ShallowWater/write/write.tcl b/kratos.gid/apps/ShallowWater/write/write.tcl new file mode 100644 index 000000000..73a7d3213 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/write/write.tcl @@ -0,0 +1,114 @@ +namespace eval ::ShallowWater::write { + namespace path ::ShallowWater + Kratos::AddNamespace [namespace current] + + variable ConditionsDictGroupIterators + variable writeAttributes +} + +proc ::ShallowWater::write::Init { } { + variable ConditionsDictGroupIterators + set ConditionsDictGroupIterators [dict create ] + variable writeAttributes + set writeAttributes [dict create] + + SetAttribute parts_un [GetUniqueName parts] + SetAttribute materials_un [GetUniqueName materials] + SetAttribute initial_conditions_un [GetUniqueName initial_conditions] + SetAttribute topography_data_un [GetUniqueName topography_data] + SetAttribute conditions_un [GetUniqueName conditions] + + SetAttribute main_launch_file [ShallowWater::GetAttribute main_launch_file] + SetAttribute properties_location [GetWriteProperty properties_location] + SetAttribute materials_file [GetWriteProperty materials_file] + SetAttribute model_part_name [GetWriteProperty model_part_name] +} + +proc ::ShallowWater::write::writeModelPartEvent { } { + # Validation + set err [Validate] + if {$err ne ""} {error $err} + + # Init data + ::write::initWriteConfiguration [GetAttributes] + + # Headers + ::write::writeModelPartData + ::write::WriteString "Begin Properties 0" + ::write::WriteString "End Properties" + ::write::WriteString "" + + # Nodal Coordinates + ::write::writeNodalCoordinates + + # Element connectivities + ::write::writeElementConnectivities + + # Conditions connectivities + writeConditions + + # SubmodelParts + writeSubModelParts +} + +proc ::ShallowWater::write::Validate {} { + set err "" + return $err +} + +proc ::ShallowWater::write::writeConditions { } { + variable ConditionsDictGroupIterators + set ConditionsDictGroupIterators [::write::writeConditions [GetAttribute conditions_un] ] +} + +proc ::ShallowWater::write::writeSubModelParts {} { + ::write::writePartSubModelPart + ::write::writeNodalConditions [GetAttribute topography_data_un] + ::write::writeNodalConditions [GetAttribute initial_conditions_un] + WriteConditionsSubModelParts +} + +proc ::ShallowWater::write::WriteConditionsSubModelParts { } { + variable ConditionsDictGroupIterators + set root [customlib::GetBaseRoot] + set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group" + foreach group [$root selectNodes $xp1] { + set groupid [$group @n] + set groupid [write::GetWriteGroupName $groupid] + if {$groupid in [dict keys $ConditionsDictGroupIterators]} { + ::write::writeGroupSubModelPart [[$group parent] @n] $groupid "Conditions" [dict get $ConditionsDictGroupIterators $groupid] + } else { + ::write::writeGroupSubModelPart [[$group parent] @n] $groupid "nodal" + } + } +} + +proc ::ShallowWater::write::writeCustomFilesEvent { } { + write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] false [GetAttribute model_part_name] + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] +} + +proc ::ShallowWater::write::GetAttribute {att} { + variable writeAttributes + return [dict get $writeAttributes $att] +} + +proc ::ShallowWater::write::GetAttributes {} { + variable writeAttributes + return $writeAttributes +} + +proc ::ShallowWater::write::SetAttribute {att val} { + variable writeAttributes + dict set writeAttributes $att $val +} + +proc ::ShallowWater::write::AddAttribute {att val} { + variable writeAttributes + dict lappend writeAttributes $att $val +} + +proc ::ShallowWater::write::AddAttributes {configuration} { + variable writeAttributes + set writeAttributes [dict merge $writeAttributes $configuration] +} diff --git a/kratos.gid/apps/ShallowWater/write/writeProjectParameters.tcl b/kratos.gid/apps/ShallowWater/write/writeProjectParameters.tcl new file mode 100644 index 000000000..e267c7bb3 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/write/writeProjectParameters.tcl @@ -0,0 +1,90 @@ +# Project Parameters +proc ::ShallowWater::write::writeParametersEvent { } { + write::WriteJSON [getParametersDict] +} + +proc ::ShallowWater::write::getParametersDict { } { + set projectParametersDict [dict create] + + # Analysis stage field + dict set projectParametersDict analysis_stage "KratosMultiphysics.ShallowWaterApplication.shallow_water_analysis" + + # Set the problem data section + dict set projectParametersDict problem_data [GetProblemDataDict] + + # Solver settings + dict set projectParametersDict solver_settings [GetSolverSettingsDict] + + # Regular processes + set processes [dict create] + dict set processes topography_process_list [write::getConditionsParametersDict [GetAttribute topography_data_un] "Nodal"] + dict set processes initial_conditions_process_list [write::getConditionsParametersDict [GetAttribute initial_conditions_un] "Nodal"] + dict set processes boundary_conditions_process_list [write::getConditionsParametersDict [GetAttribute conditions_un]] + dict set projectParametersDict processes $processes + + # Output processes + dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict] + + return $projectParametersDict +} + +proc ::ShallowWater::write::GetProblemDataDict { } { + + # First section -> Problem data + set problem_data_dict [dict create] + set model_name [Kratos::GetModelName] + dict set problem_data_dict problem_name $model_name + + # Parallelization + set paralleltype [write::getValue ParallelType] + dict set problem_data_dict parallel_type $paralleltype + + # Time settings + set timeSteppingDict [dict create] + dict set problem_data_dict start_time [write::getValue SWTimeParameters StartTime] + dict set problem_data_dict end_time [write::getValue SWTimeParameters EndTime] + + # Write the echo level in the problem data section + set echo_level [write::getValue Results EchoLevel] + dict set problem_data_dict echo_level $echo_level + + return $problem_data_dict +} + +proc ::ShallowWater::write::GetSolverSettingsDict { } { + # General data + set solverSettingsDict [dict create] + dict set solverSettingsDict solver_type [write::getValue SWSolStrat] + dict set solverSettingsDict model_part_name [GetAttribute model_part_name] + dict set solverSettingsDict domain_size 2 + dict set solverSettingsDict gravity [write::getValue SWGravity] + + # Model import settings + set modelImportDict [dict create] + dict set modelImportDict input_type "mdpa" + dict set modelImportDict input_filename [Kratos::GetModelName] + dict set solverSettingsDict model_import_settings $modelImportDict + + # Materials + set materialsDict [dict create] + dict set materialsDict materials_filename [GetAttribute materials_file] + dict set solverSettingsDict material_import_settings $materialsDict + + # Strategy, scheme and linear solver settings + set solverSettingsDict [dict merge $solverSettingsDict [write::getSolutionStrategyParametersDict SWSolStrat SWScheme SWStrategyParams] ] + set solverSettingsDict [dict merge $solverSettingsDict [write::getSolversParametersDict ShallowWater] ] + + # Time stepping settings + set timeSteppingDict [dict create] + dict set timeSteppingDict automatic_time_step [write::getValue SWAutomaticDeltaTime] + if {[write::getValue SWAutomaticDeltaTime] eq "Yes"} { + dict set timeSteppingDict courant_number [write::getValue SWTimeParameters CFLNumber] + dict set timeSteppingDict maximum_delta_time [write::getValue SWTimeParameters MaximumDeltaTime] + dict set timeSteppingDict minimum_delta_time [write::getValue SWTimeParameters MinimumDeltaTime] + } else { + dict set timeSteppingDict time_step [write::getValue SWTimeParameters DeltaTime] + } + dict set solverSettingsDict time_stepping $timeSteppingDict + + return $solverSettingsDict +} diff --git a/kratos.gid/apps/ShallowWater/xml/BoundaryConditions.spd b/kratos.gid/apps/ShallowWater/xml/BoundaryConditions.spd new file mode 100644 index 000000000..ee44e459b --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/BoundaryConditions.spd @@ -0,0 +1,4 @@ + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/Conditions.xml b/kratos.gid/apps/ShallowWater/xml/Conditions.xml new file mode 100644 index 000000000..5a24d0715 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/Conditions.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/InitialConditions.spd b/kratos.gid/apps/ShallowWater/xml/InitialConditions.spd new file mode 100644 index 000000000..ffa8646a7 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/InitialConditions.spd @@ -0,0 +1,4 @@ + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/Main.spd b/kratos.gid/apps/ShallowWater/xml/Main.spd new file mode 100644 index 000000000..a4c50f049 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/Main.spd @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/Materials.spd b/kratos.gid/apps/ShallowWater/xml/Materials.spd new file mode 100644 index 000000000..827c138ed --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/Materials.spd @@ -0,0 +1,4 @@ + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/Materials.xml b/kratos.gid/apps/ShallowWater/xml/Materials.xml new file mode 100644 index 000000000..b3887d682 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/Materials.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/NodalConditions.xml b/kratos.gid/apps/ShallowWater/xml/NodalConditions.xml new file mode 100644 index 000000000..a05261b97 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/NodalConditions.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/Parts.spd b/kratos.gid/apps/ShallowWater/xml/Parts.spd new file mode 100644 index 000000000..a6c9464bf --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/Parts.spd @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/Processes.xml b/kratos.gid/apps/ShallowWater/xml/Processes.xml new file mode 100644 index 000000000..fac3a3af3 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/Processes.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/Procs.spd b/kratos.gid/apps/ShallowWater/xml/Procs.spd new file mode 100644 index 000000000..da863d2cf --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/Procs.spd @@ -0,0 +1,3 @@ + + + diff --git a/kratos.gid/apps/ShallowWater/xml/SolutionStrategy.spd b/kratos.gid/apps/ShallowWater/xml/SolutionStrategy.spd new file mode 100644 index 000000000..0c3087dcc --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/SolutionStrategy.spd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/Strategies.xml b/kratos.gid/apps/ShallowWater/xml/Strategies.xml new file mode 100644 index 000000000..0019d74a5 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/Strategies.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/Strategy.spd b/kratos.gid/apps/ShallowWater/xml/Strategy.spd new file mode 100644 index 000000000..83fac0401 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/Strategy.spd @@ -0,0 +1,5 @@ + + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/TopographicData.spd b/kratos.gid/apps/ShallowWater/xml/TopographicData.spd new file mode 100644 index 000000000..3c6444596 --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/TopographicData.spd @@ -0,0 +1,4 @@ + + + + diff --git a/kratos.gid/apps/ShallowWater/xml/XmlController.tcl b/kratos.gid/apps/ShallowWater/xml/XmlController.tcl new file mode 100644 index 000000000..d624577eb --- /dev/null +++ b/kratos.gid/apps/ShallowWater/xml/XmlController.tcl @@ -0,0 +1,37 @@ +namespace eval ::ShallowWater::xml { + namespace path ::ShallowWater + Kratos::AddNamespace [namespace current] +} + +proc ::ShallowWater::xml::Init {} { + Model::InitVariables dir $::ShallowWater::dir + + Model::getSolutionStrategies Strategies.xml + Model::getElements "../../Common/xml/Elements.xml" + Model::getConditions Conditions.xml + Model::getMaterials Materials.xml + Model::getNodalConditions NodalConditions.xml + Model::getProcesses "../../Common/xml/Processes.xml" + Model::getProcesses Processes.xml + Model::getSolvers "../../Common/xml/Solvers.xml" +} + +proc ::ShallowWater::xml::getUniqueName {name} { + return [GetAttribute prefix]${name} +} + +proc ::ShallowWater::xml::CustomTree {args} { + # Set the nodal conditions active + gid_groups_conds::setAttributes "[spdAux::getRoute SWTopographicData]/condition" [list state normal] + gid_groups_conds::setAttributes "[spdAux::getRoute SWInitialConditions]/condition" [list state normal] + + # Register the primary outputs from topography data + gid_groups_conds::setAttributes "[spdAux::getRoute NodalResults]/value\[@n = 'MOMENTUM'\]" [list state normal] + gid_groups_conds::setAttributes "[spdAux::getRoute NodalResults]/value\[@n = 'VELOCITY'\]" [list state normal] + gid_groups_conds::setAttributes "[spdAux::getRoute NodalResults]/value\[@n = 'HEIGHT'\]" [list state normal] + gid_groups_conds::setAttributes "[spdAux::getRoute NodalResults]/value\[@n = 'FREE_SURFACE_ELEVATION'\]" [list state normal] + + # Set the default value for the Z component in the boundary conditions + gid_groups_conds::setAttributes "[spdAux::getRoute SWConditions]/condition\[@n = 'ImposedFlowRate'\]/value\[@n = 'selector_component_Z'\]" [list v Not] + gid_groups_conds::setAttributes "[spdAux::getRoute SWConditions]/condition\[@n = 'ImposedVelocity'\]/value\[@n = 'selector_component_Z'\]" [list v Not] +} diff --git a/kratos.gid/apps/Solid/examples/CircularTank.tcl b/kratos.gid/apps/Solid/examples/CircularTank.tcl deleted file mode 100644 index a1be5e5e9..000000000 --- a/kratos.gid/apps/Solid/examples/CircularTank.tcl +++ /dev/null @@ -1,297 +0,0 @@ - -proc ::Solid::examples::CircularTank {args} { - if {![Kratos::IsModelEmpty]} { - set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" - set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] - if { $retval == "cancel" } { return } - } - DrawCircularTankGeometry$::Model::SpatialDimension - TreeAssignationCircularTank$::Model::SpatialDimension - - GiD_Process 'Redraw - GidUtils::UpdateWindow GROUPS - GidUtils::UpdateWindow LAYER - GiD_Process 'Zoom Frame -} - - -# Draw Geometry -proc Solid::examples::DrawCircularTankGeometry3D {args} { - Kratos::ResetModel - set dir [apps::getMyDir "Solid"] - set problemfile [file join $dir examples CircularTank3D.gid] - GiD_Process Mescape Files InsertGeom $problemfile -} -proc Solid::examples::DrawCircularTankGeometry2Da {args} { - Kratos::ResetModel - set dir [apps::getMyDir "Solid"] - set problemfile [file join $dir examples CircularTank2Da.gid] - GiD_Process Mescape Files InsertGeom $problemfile -} -proc Solid::examples::DrawCircularTankGeometry2D {args} { - Kratos::ResetModel -} -# Mesh sizes - - -# Tree assign -proc Solid::examples::TreeAssignationCircularTank3D {args} { - set nd $::Model::SpatialDimension - set root [customlib::GetBaseRoot] - - set condtype line - if {$nd eq "3D"} { set condtype surface } - - # Static solution strategy set - spdAux::SetValueOnTreeItem v "Static" SLSoluType - - # Time parameters - set time_parameters [list EndTime 1.0 DeltaTime 1.0] - set time_params_path [spdAux::getRoute SLTimeParameters] - foreach {name value} $time_parameters { - set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"] - if {$node ne ""} { - $node setAttribute v $value - } else { - W "Couldn't find $name - Check example script" - } - } - - # Solid Parts - set solidParts [spdAux::getRoute "SLParts"] - set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid] - $solidPartsNode setAttribute ov volume - set props [list Element SmallDisplacementElement$nd ConstitutiveLaw SmallStrain3DLaw.LinearElasticModel] - foreach {prop val} $props { - set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - set solidConditions [spdAux::getRoute "SLNodalConditions"] - - # Solid Constraint - GiD_Groups clone ConstraintX Total - GiD_Groups edit parent Total ConstraintX - spdAux::AddIntervalGroup ConstraintX "ConstraintX//Total" - GiD_Groups edit state "ConstraintX//Total" hidden - set solidConstraintX {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintXNode [customlib::AddConditionGroupOnXPath $solidConstraintX "ConstraintX//Total"] - $solidConstraintXNode setAttribute ov surface - set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintXNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone ConstraintZ Total - GiD_Groups edit parent Total ConstraintZ - spdAux::AddIntervalGroup ConstraintZ "ConstraintZ//Total" - GiD_Groups edit state "ConstraintZ//Total" hidden - set solidConstraintZ {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintZNode [customlib::AddConditionGroupOnXPath $solidConstraintZ "ConstraintZ//Total"] - $solidConstraintZNode setAttribute ov surface - set props [list selector_component_X Not selector_component_Y Not selector_component_Z ByValue value_component_Z 0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintZNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Solid Loads - GiD_Groups clone SelfWeight Total - GiD_Groups edit parent Total SelfWeight - spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total" - GiD_Groups edit state "SelfWeight//Total" hidden - set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]" - set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"] - $solidLoadNode setAttribute ov volume - set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Pressure Total - GiD_Groups edit parent Total Pressure - spdAux::AddIntervalGroup Pressure "Pressure//Total" - GiD_Groups edit state "Pressure//Total" hidden - set solidPressure "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Pressure$nd'\]" - set solidPressureNode [customlib::AddConditionGroupOnXPath $solidPressure "Pressure//Total"] - $solidPressureNode setAttribute ov surface - set props [list ByFunction Yes function_value "9.81*1000*(2.5-y)" Interval Total] - foreach {prop val} $props { - set propnode [$solidPressureNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Ballast Total - GiD_Groups edit parent Total Ballast - spdAux::AddIntervalGroup Ballast "Ballast//Total" - GiD_Groups edit state "Ballast//Total" hidden - set solidBallast "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Ballast$nd'\]" - set solidBallastNode [customlib::AddConditionGroupOnXPath $solidBallast "Ballast//Total"] - $solidBallastNode setAttribute ov surface - set props [list ByFunction No value 50e6 Interval Total] - foreach {prop val} $props { - set propnode [$solidBallastNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Parallelism - set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] - set time_params_path [spdAux::getRoute "Parallelization"] - foreach {n v} $time_parameters { - [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - - # Solver - set solver_parameters [list Solver amgcl max_iteration 2000 tolerance 1e-6 krylov_type cg] - set solver_params_path [spdAux::getRoute "SLStaticlinear_solver_settings"] - foreach {n v} $solver_parameters { - [$root selectNodes "$solver_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - - spdAux::RequestRefresh -} -proc Solid::examples::TreeAssignationCircularTank2Da {args} { - set nd $::Model::SpatialDimension - set root [customlib::GetBaseRoot] - - set condtype line - if {$nd eq "3D"} { set condtype surface } - - # Static solution strategy set - spdAux::SetValueOnTreeItem v "Static" SLSoluType - - # Time parameters - set time_parameters [list EndTime 1.0 DeltaTime 1.0] - set time_params_path [spdAux::getRoute SLTimeParameters] - foreach {name value} $time_parameters { - set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"] - if {$node ne ""} { - $node setAttribute v $value - } else { - W "Couldn't find $name - Check example script" - } - - } - # Solid Parts - set solidParts [spdAux::getRoute "SLParts"] - set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid] - $solidPartsNode setAttribute ov surface - set props [list Element SmallDisplacementElement$nd ConstitutiveLaw SmallStrainAxisymmetric2DLaw.LinearElasticModel] - foreach {prop val} $props { - set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - set solidConditions [spdAux::getRoute "SLNodalConditions"] - - # Solid Constraint - GiD_Groups clone Constraint Total - GiD_Groups edit parent Total Constraint - spdAux::AddIntervalGroup Constraint "Constraint//Total" - GiD_Groups edit state "Constraint//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Constraint//Total"] - $solidConstraintNode setAttribute ov line - set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Solid Loads - GiD_Groups clone SelfWeight Total - GiD_Groups edit parent Total SelfWeight - spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total" - GiD_Groups edit state "SelfWeight//Total" hidden - set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]" - set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"] - $solidLoadNode setAttribute ov surface - set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Pressure Total - GiD_Groups edit parent Total Pressure - spdAux::AddIntervalGroup Pressure "Pressure//Total" - GiD_Groups edit state "Pressure//Total" hidden - set solidPressure "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Pressure$nd'\]" - set solidPressureNode [customlib::AddConditionGroupOnXPath $solidPressure "Pressure//Total"] - $solidPressureNode setAttribute ov line - set props [list ByFunction Yes function_value "9.81*1000*(2.5-y)" Interval Total] - foreach {prop val} $props { - set propnode [$solidPressureNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Ballast Total - GiD_Groups edit parent Total Ballast - spdAux::AddIntervalGroup Ballast "Ballast//Total" - GiD_Groups edit state "Ballast//Total" hidden - set solidBallast "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Ballast$nd'\]" - set solidBallastNode [customlib::AddConditionGroupOnXPath $solidBallast "Ballast//Total"] - $solidBallastNode setAttribute ov line - set props [list ByFunction No value 50e6 Interval Total] - foreach {prop val} $props { - set propnode [$solidBallastNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Parallelism - set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] - set time_params_path [spdAux::getRoute "Parallelization"] - foreach {n v} $time_parameters { - [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - spdAux::RequestRefresh -} -proc Solid::examples::TreeAssignationCircularTank2D {args} { - Kratos::ResetModel -} diff --git a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.geo b/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.geo deleted file mode 100644 index 2ae4c7227..000000000 Binary files a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.geo and /dev/null differ diff --git a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.prj b/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.prj deleted file mode 100644 index 5ee745466..000000000 --- a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.prj +++ /dev/null @@ -1,25 +0,0 @@ - - -
-    
-    
-      
-      
-      
-      
-      
-    
-    
-      
-        1 3 6 7 15 16 18 19
-        1x8
-        5 2 1x4 2 2
-      
-      
-        2 5 7 9:11
-        2x6
-        4 3 4 3 4 3 4 3 4 3 4 3
-      
-    
-  
-
diff --git a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.vv b/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.vv deleted file mode 100644 index fe66fee6e..000000000 --- a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.vv +++ /dev/null @@ -1,37 +0,0 @@ -BeginZE /home/cpuigbo/Desktop/CircularTank2Da.gid/CircularTank2Da.vv - x -2.27358531951904297 7.77358531951904297 - y 4.63604164123535156 -2.13604164123535156 - z -4.54599666595458984 4.54599666595458984 - e 3.38604164123535156 - v 0 0 0 - r 1 - m 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 - c 3.74545454978942871 0.654545426368713379 0 - pd 0 - pno 0 - pfo 0 - pf 4 - pv 0 - NowUse 0 - DrawingType 1 - LightVector 90 90 150 0 - OGLShadow(UseShadows) 0 - OGLShadow(RenderMode) RenderNice - OGLShadow(ShadowBias) -0.002 - OGLShadow(AmbientShadows) 1 - OGLShadow(UseFBO) 0 - OGLShadow(FBOSize) 2048 - OGLShadow(DimmedLightFactor) 0.02 - OGLStereo(UseStereo) 0 - OGLStereo(RelativeEyeDistance) 1 - OGLStereo(FlipEyes) 0 - OGLStereo(StereoMode) AnaglyphColors - OGLStereo(EyeDistance) 0.075 - OGLStereo(LeftEyeDistance) 1 0 0 1 - OGLStereo(RightEyeDistance) 0 1 1 1 -EndZE /home/cpuigbo/Desktop/CircularTank2Da.gid/CircularTank2Da.vv - -BeginMirror - Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror -EndMirror - diff --git a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.geo b/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.geo deleted file mode 100644 index 458181829..000000000 Binary files a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.geo and /dev/null differ diff --git a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.prj b/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.prj deleted file mode 100644 index 372744322..000000000 --- a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.prj +++ /dev/null @@ -1,26 +0,0 @@ - - -
-    
-    
-      
-      
-      
-      
-      
-      
-    
-    
-      
-        1:3 6:8 12
-        1x7
-        3 6 6 5x3 2
-      
-      
-        1
-        2
-        1 4
-      
-    
-  
-
diff --git a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.vv b/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.vv deleted file mode 100644 index 6a5d81bac..000000000 --- a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.vv +++ /dev/null @@ -1,37 +0,0 @@ -BeginZE /home/cpuigbo/Desktop/CircularTank3D.gid/CircularTank3D.vv - x -4.36261892318725586 9.74696636199951172 - y 5.52431821823120117 -3.00504279136657715 - z -2.05847859382629395 7.42126178741455078 - e 4.26468038558959961 - v -0.150687560439109802 -0.215787529945373535 -0.0511590689420700073 - r 0.963385581970214844 - m 0.901636958122253418 0.163604810833930969 -0.400355130434036255 0 -0.0335388220846652985 0.949352025985717773 0.31241944432258606 0 0.43119126558303833 -0.268261492252349854 0.861458003520965576 0 0 0 0 1 - c 2.68139147758483887 0.784821450710296631 -2.68139147758483887 - pd 0 - pno 0 - pfo 0 - pf 4 - pv 0 - NowUse 0 - DrawingType 1 - LightVector 90 90 150 0 - OGLShadow(UseShadows) 0 - OGLShadow(RenderMode) RenderNice - OGLShadow(ShadowBias) -0.002 - OGLShadow(AmbientShadows) 1 - OGLShadow(UseFBO) 0 - OGLShadow(FBOSize) 2048 - OGLShadow(DimmedLightFactor) 0.02 - OGLStereo(UseStereo) 0 - OGLStereo(RelativeEyeDistance) 1 - OGLStereo(FlipEyes) 0 - OGLStereo(StereoMode) AnaglyphColors - OGLStereo(EyeDistance) 0.075 - OGLStereo(LeftEyeDistance) 1 0 0 1 - OGLStereo(RightEyeDistance) 0 1 1 1 -EndZE /home/cpuigbo/Desktop/CircularTank3D.gid/CircularTank3D.vv - -BeginMirror - Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror -EndMirror - diff --git a/kratos.gid/apps/Solid/examples/DynamicBeam.tcl b/kratos.gid/apps/Solid/examples/DynamicBeam.tcl deleted file mode 100644 index 61becb49e..000000000 --- a/kratos.gid/apps/Solid/examples/DynamicBeam.tcl +++ /dev/null @@ -1,141 +0,0 @@ - -proc ::Solid::examples::DynamicBeam {args} { - if {![Kratos::IsModelEmpty]} { - set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" - set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] - if { $retval == "cancel" } { return } - } - DrawDynamicBeamGeometry$::Model::SpatialDimension - TreeAssignationDynamicBeam$::Model::SpatialDimension - - GiD_Process 'Redraw - GidUtils::UpdateWindow GROUPS - GidUtils::UpdateWindow LAYER - GiD_Process 'Zoom Frame -} - - -# Draw Geometry -proc Solid::examples::DrawDynamicBeamGeometry3D {args} { - Kratos::ResetModel - set dir [apps::getMyDir "Solid"] - set problemfile [file join $dir examples DynamicBeam3D.gid] - GiD_Process Mescape Files InsertGeom $problemfile -} -proc Solid::examples::DrawDynamicBeamGeometry2Da {args} { - Kratos::ResetModel -} -proc Solid::examples::DrawDynamicBeamGeometry2D {args} { - Kratos::ResetModel -} -# Mesh sizes - - -# Tree assign -proc Solid::examples::TreeAssignationDynamicBeam3D {args} { - set nd $::Model::SpatialDimension - set root [customlib::GetBaseRoot] - - set condtype point - - # Static solution strategy set - spdAux::SetValueOnTreeItem v "Dynamic" SLSoluType - spdAux::SetValueOnTreeItem v "SimoStep" SLScheme - - # Time parameters - set time_parameters [list EndTime 5.0 DeltaTime 0.05] - set time_params_path [spdAux::getRoute SLTimeParameters] - foreach {name value} $time_parameters { - set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"] - if {$node ne ""} { - $node setAttribute v $value - } else { - W "Couldn't find $name - Check example script" - } - } - - # Solid Parts - set solidParts [spdAux::getRoute "SLParts"] - set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid] - $solidPartsNode setAttribute ov line - set props [list Element LargeDisplacementBeamElement3D ConstitutiveLaw CircularSection3D DIAMETER 0.05 YOUNG_MODULUS 206.9e8] - foreach {prop val} $props { - set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - spdAux::RequestRefresh - set solidConditions [spdAux::getRoute "SLNodalConditions"] - - # Solid Constraint - GiD_Groups clone Constraint Total - GiD_Groups edit parent Total Constraint - spdAux::AddIntervalGroup Constraint "Constraint//Total" - GiD_Groups edit state "Constraint//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Constraint//Total"] - $solidConstraintNode setAttribute ov point - 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 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone AngularConstraint Total - GiD_Groups edit parent Total AngularConstraint - spdAux::AddIntervalGroup AngularConstraint "AngularConstraint//Total" - GiD_Groups edit state "AngularConstraint//Total" hidden - set solidAngularConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='ANGULAR_VELOCITY']} - set solidAngularConstraintNode [customlib::AddConditionGroupOnXPath $solidAngularConstraint "AngularConstraint//Total"] - $solidAngularConstraintNode setAttribute ov point - set props [list selector_component_X ByValue value_component_X 2.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidAngularConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Solid Loads - GiD_Groups clone SelfWeight Total - GiD_Groups edit parent Total SelfWeight - spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total" - GiD_Groups edit state "SelfWeight//Total" hidden - set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]" - set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"] - $solidLoadNode setAttribute ov line - set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Parallelism - set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] - set time_params_path [spdAux::getRoute "Parallelization"] - foreach {n v} $time_parameters { - [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - - spdAux::RequestRefresh -} -proc Solid::examples::TreeAssignationDynamicBeam2Da {args} { - Kratos::ResetModel -} -proc Solid::examples::TreeAssignationDynamicBeam2D {args} { - Kratos::ResetModel -} diff --git a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.geo b/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.geo deleted file mode 100644 index c8f5c092f..000000000 Binary files a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.geo and /dev/null differ diff --git a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.prj b/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.prj deleted file mode 100644 index 17cf51e35..000000000 --- a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.prj +++ /dev/null @@ -1,24 +0,0 @@ - - -
-    
-    
-      
-      
-      
-      
-    
-    
-      
-        1
-        3
-        3 1 4
-      
-      
-        1 2
-        2 2
-        1 2 1 2
-      
-    
-  
-
diff --git a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv b/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv deleted file mode 100644 index d30c49831..000000000 --- a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv +++ /dev/null @@ -1,37 +0,0 @@ -BeginZE /home/cpuigbo/GiDInterface/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv - x 0.582600831985473633 3.13705992698669434 - y 0.753371059894561768 -1.3496021032333374 - z -1.89401459693908691 1.89401459693908691 - e 1.65831243991851807 - v 0.0429526552950176832 0.875547797747364354 0.149245509813539512 - r -0.457489782468801232 - m -0.577716350555419922 0.211770802736282349 -0.788287341594696045 0 -0.0613423846662044525 0.951761722564697266 0.300643950700759888 0 0.813929319381713867 0.222042351961135864 -0.536857724189758301 0 0 0 0 1 - c 1.66666662693023682 -0.333333343267440796 0 - pd 0 - pno 0 - pfo 0 - pf 4 - pv 0 - NowUse 0 - DrawingType 0 - LightVector 90 90 150 0 - OGLShadow(UseShadows) 0 - OGLShadow(RenderMode) RenderNice - OGLShadow(ShadowBias) -0.002 - OGLShadow(AmbientShadows) 1 - OGLShadow(UseFBO) 0 - OGLShadow(FBOSize) 2048 - OGLShadow(DimmedLightFactor) 0.02 - OGLStereo(UseStereo) 0 - OGLStereo(RelativeEyeDistance) 1 - OGLStereo(FlipEyes) 0 - OGLStereo(StereoMode) AnaglyphColors - OGLStereo(EyeDistance) 0.075 - OGLStereo(LeftEyeDistance) 1 0 0 1 - OGLStereo(RightEyeDistance) 0 1 1 1 -EndZE /home/cpuigbo/GiDInterface/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv - -BeginMirror - Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror -EndMirror - diff --git a/kratos.gid/apps/Solid/examples/DynamicRod.tcl b/kratos.gid/apps/Solid/examples/DynamicRod.tcl deleted file mode 100644 index 90de1106f..000000000 --- a/kratos.gid/apps/Solid/examples/DynamicRod.tcl +++ /dev/null @@ -1,206 +0,0 @@ - -proc ::Solid::examples::DynamicRod {args} { - if {![Kratos::IsModelEmpty]} { - set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" - set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] - if { $retval == "cancel" } { return } - } - DrawDynamicRodGeometry$::Model::SpatialDimension - TreeAssignationDynamicRod$::Model::SpatialDimension - - GiD_Process 'Redraw - GidUtils::UpdateWindow GROUPS - GidUtils::UpdateWindow LAYER - GiD_Process 'Zoom Frame -} - - -# Draw Geometry -proc Solid::examples::DrawDynamicRodGeometry3D {args} { - Kratos::ResetModel - set dir [apps::getMyDir "Solid"] - set problemfile [file join $dir examples DynamicRod3D.gid] - GiD_Process Mescape Files InsertGeom $problemfile -} -proc Solid::examples::DrawDynamicRodGeometry2D {args} { - Kratos::ResetModel - set dir [apps::getMyDir "Solid"] - set problemfile [file join $dir examples DynamicRod2D.gid] - GiD_Process Mescape Files InsertGeom $problemfile -} -proc Solid::examples::DrawDynamicRodGeometry2Da {args} { - Kratos::ResetModel -} -# Mesh sizes - - -# Tree assign -proc Solid::examples::TreeAssignationDynamicRod3D {args} { - set nd $::Model::SpatialDimension - set root [customlib::GetBaseRoot] - - set condtype line - if {$nd eq "3D"} { set condtype surface } - - # Dynamic solution strategy set - spdAux::SetValueOnTreeItem v "Dynamic" SLSoluType - - # Time parameters - set time_parameters [list EndTime 1.06 DeltaTime 0.01] - set time_params_path [spdAux::getRoute SLTimeParameters] - foreach {name value} $time_parameters { - set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"] - if {$node ne ""} { - $node setAttribute v $value - } else { - W "Couldn't find $name - Check example script" - } - - } - - # Solid Parts - set solidParts [spdAux::getRoute "SLParts"] - set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid] - $solidPartsNode setAttribute ov volume - set props [list Element TotalLagrangianElement$nd ConstitutiveLaw LargeStrain3DLaw.SaintVenantKirchhoffModel] - foreach {prop val} $props { - set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - set solidConditions [spdAux::getRoute "SLNodalConditions"] - - # Solid Constraint - GiD_Groups clone Constraint Total - GiD_Groups edit parent Total Constraint - spdAux::AddIntervalGroup Constraint "Constraint//Total" - GiD_Groups edit state "Constraint//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Constraint//Total"] - $solidConstraintNode setAttribute ov line - 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 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Solid Loads - GiD_Groups clone SelfWeight Total - GiD_Groups edit parent Total SelfWeight - spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total" - GiD_Groups edit state "SelfWeight//Total" hidden - set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]" - set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"] - $solidLoadNode setAttribute ov volume - set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Parallelism - set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] - set time_params_path [spdAux::getRoute "Parallelization"] - foreach {n v} $time_parameters { - [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - - - spdAux::RequestRefresh -} -proc Solid::examples::TreeAssignationDynamicRod2D {args} { - set nd $::Model::SpatialDimension - set root [customlib::GetBaseRoot] - - set condtype line - if {$nd eq "3D"} { set condtype surface } - - # Dynamic solution strategy set - spdAux::SetValueOnTreeItem v "Dynamic" SLSoluType - - # Time parameters - set time_parameters [list EndTime 1.06 DeltaTime 0.01] - set time_params_path [spdAux::getRoute SLTimeParameters] - foreach {name value} $time_parameters { - set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"] - if {$node ne ""} { - $node setAttribute v $value - } else { - W "Couldn't find $name - Check example script" - } - } - - # Solid Parts - set solidParts [spdAux::getRoute "SLParts"] - set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid] - $solidPartsNode setAttribute ov surface - set props [list Element TotalLagrangianElement$nd ConstitutiveLaw LargeStrain3DLaw.SaintVenantKirchhoffModel] - foreach {prop val} $props { - set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - set solidConditions [spdAux::getRoute "SLNodalConditions"] - - # Solid Constraint - GiD_Groups clone Constraint Total - GiD_Groups edit parent Total Constraint - spdAux::AddIntervalGroup Constraint "Constraint//Total" - GiD_Groups edit state "Constraint//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Constraint//Total"] - $solidConstraintNode setAttribute ov point - 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 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Solid Loads - GiD_Groups clone SelfWeight Total - GiD_Groups edit parent Total SelfWeight - spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total" - GiD_Groups edit state "SelfWeight//Total" hidden - set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]" - set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"] - $solidLoadNode setAttribute ov surface - set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Parallelism - set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] - set time_params_path [spdAux::getRoute "Parallelization"] - foreach {n v} $time_parameters { - [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v - } -} -proc Solid::examples::TreeAssignationDynamicRod2Da {args} { - Kratos::ResetModel -} diff --git a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.geo b/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.geo deleted file mode 100644 index 27f7e44aa..000000000 Binary files a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.geo and /dev/null differ diff --git a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.prj b/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.prj deleted file mode 100644 index bb151ffae..000000000 --- a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.prj +++ /dev/null @@ -1,24 +0,0 @@ - - -
-    
-    
-      
-      
-      
-      
-    
-    
-      
-        85
-        1
-        4
-      
-      
-        1:3
-        2x3
-        2 3 2 3 2 3
-      
-    
-  
-
diff --git a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.vv b/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.vv deleted file mode 100644 index bb19ca5af..000000000 --- a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.vv +++ /dev/null @@ -1,37 +0,0 @@ -BeginZE /home/jmaria/Tests/DynamicRod2D.gid/DynamicRod2D.vv - x -0.0860478430986404419 0.338547825813293457 - y 0.147866189479827881 -0.147866189479827881 - z -0.443598568439483643 0.443598568439483643 - e 0.147866189479827881 - v 0 0 0 - r 1 - m 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 - c 0.126249998807907104 0 -6.32091712304827524e-09 - pd 0 - pno 0 - pfo 0 - pf 4 - pv 0 - NowUse 0 - DrawingType 1 - LightVector 90 90 150 0 - OGLShadow(UseShadows) 0 - OGLShadow(RenderMode) RenderNice - OGLShadow(ShadowBias) -0.002 - OGLShadow(AmbientShadows) 1 - OGLShadow(UseFBO) 1 - OGLShadow(FBOSize) 2048 - OGLShadow(DimmedLightFactor) 0.02 - OGLStereo(UseStereo) 0 - OGLStereo(RelativeEyeDistance) 1 - OGLStereo(FlipEyes) 0 - OGLStereo(StereoMode) AnaglyphColors - OGLStereo(EyeDistance) 0.075 - OGLStereo(LeftEyeDistance) 1 0 0 1 - OGLStereo(RightEyeDistance) 0 1 1 1 -EndZE /home/jmaria/Tests/DynamicRod2D.gid/DynamicRod2D.vv - -BeginMirror - Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror -EndMirror - diff --git a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.geo b/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.geo deleted file mode 100644 index bf48e089e..000000000 Binary files a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.geo and /dev/null differ diff --git a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.prj b/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.prj deleted file mode 100644 index 310a40a41..000000000 --- a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.prj +++ /dev/null @@ -1,29 +0,0 @@ - - -
-    
-    
-      
-      
-      
-      
-    
-    
-      
-        116
-        1
-        2
-      
-      
-        8:19 31:33 40 53:56
-        1x20
-        1x20
-      
-      
-        1
-        2
-        3 4
-      
-    
-  
-
diff --git a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.vv b/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.vv deleted file mode 100644 index dacde8124..000000000 --- a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.vv +++ /dev/null @@ -1,37 +0,0 @@ -BeginZE /home/jmaria/Tests/DynamicRod3D.gid/DynamicRod3D.vv - x -0.0906996056437492371 0.33330225944519043 - y 0.143511354923248291 -0.152221024036407471 - z -0.418598592281341553 0.468598544597625732 - e 0.147866189479827881 - v -0.155974417924880981 0.326733916997909546 0.115599974989891052 - r 0.924961388111114502 - m 0.759763181209564209 -0.315775305032730103 0.568371236324310303 0 0.111926771700382233 0.924617230892181396 0.364081501960754395 0 -0.640493810176849365 -0.21299976110458374 0.737833857536315918 0 0 0 0 1 - c 0.110273361206054688 6.73620590418977372e-08 -0.0249999910593032837 - pd 0 - pno 0 - pfo 0 - pf 4 - pv 0 - NowUse 0 - DrawingType 1 - LightVector 90 90 150 0 - OGLShadow(UseShadows) 0 - OGLShadow(RenderMode) RenderNice - OGLShadow(ShadowBias) -0.002 - OGLShadow(AmbientShadows) 1 - OGLShadow(UseFBO) 1 - OGLShadow(FBOSize) 2048 - OGLShadow(DimmedLightFactor) 0.02 - OGLStereo(UseStereo) 0 - OGLStereo(RelativeEyeDistance) 1 - OGLStereo(FlipEyes) 0 - OGLStereo(StereoMode) AnaglyphColors - OGLStereo(EyeDistance) 0.075 - OGLStereo(LeftEyeDistance) 1 0 0 1 - OGLStereo(RightEyeDistance) 0 1 1 1 -EndZE /home/jmaria/Tests/DynamicRod3D.gid/DynamicRod3D.vv - -BeginMirror - Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror -EndMirror - diff --git a/kratos.gid/apps/Solid/examples/EccentricColumn.tcl b/kratos.gid/apps/Solid/examples/EccentricColumn.tcl deleted file mode 100644 index f6301d3f2..000000000 --- a/kratos.gid/apps/Solid/examples/EccentricColumn.tcl +++ /dev/null @@ -1,181 +0,0 @@ - -proc ::Solid::examples::EccentricColumn {args} { - if {![Kratos::IsModelEmpty]} { - set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" - set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] - if { $retval == "cancel" } { return } - } - DrawEccentricColumnGeometry$::Model::SpatialDimension - TreeAssignationEccentricColumn$::Model::SpatialDimension - - GiD_Process 'Redraw - GidUtils::UpdateWindow GROUPS - GidUtils::UpdateWindow LAYER - GiD_Process 'Zoom Frame -} - - -# Draw Geometry -proc Solid::examples::DrawEccentricColumnGeometry3D {args} { - Kratos::ResetModel - set dir [apps::getMyDir "Solid"] - set problemfile [file join $dir examples EccentricColumn3D.gid] - GiD_Process Mescape Files InsertGeom $problemfile -} -proc Solid::examples::DrawEccentricColumnGeometry2Da {args} { - Kratos::ResetModel -} -proc Solid::examples::DrawEccentricColumnGeometry2D {args} { - Kratos::ResetModel -} -# Mesh sizes - - -# Tree assign -proc Solid::examples::TreeAssignationEccentricColumn3D {args} { - set nd $::Model::SpatialDimension - set root [customlib::GetBaseRoot] - - set condtype line - if {$nd eq "3D"} { set condtype surface } - - # Static solution strategy set - spdAux::SetValueOnTreeItem v "Static" SLSoluType - - # Time parameters - set time_parameters [list EndTime 1.0 DeltaTime 1.0] - set time_params_path [spdAux::getRoute SLTimeParameters] - foreach {name value} $time_parameters { - set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"] - if {$node ne ""} { - $node setAttribute v $value - } else { - W "Couldn't find $name - Check example script" - } - } - - # Solid Parts - set solidParts [spdAux::getRoute "SLParts"] - set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid] - $solidPartsNode setAttribute ov volume - set props [list Element SmallDisplacementElement$nd ConstitutiveLaw SmallStrain3DLaw.LinearElasticModel] - foreach {prop val} $props { - set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - set solidConditions [spdAux::getRoute "SLNodalConditions"] - - # Solid Constraint - GiD_Groups clone ConstraintX Total - GiD_Groups edit parent Total ConstraintX - spdAux::AddIntervalGroup ConstraintX "ConstraintX//Total" - GiD_Groups edit state "ConstraintX//Total" hidden - set solidConstraintX {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintXNode [customlib::AddConditionGroupOnXPath $solidConstraintX "ConstraintX//Total"] - $solidConstraintXNode setAttribute ov line - set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintXNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone ConstraintZ Total - GiD_Groups edit parent Total ConstraintZ - spdAux::AddIntervalGroup ConstraintZ "ConstraintZ//Total" - GiD_Groups edit state "ConstraintZ//Total" hidden - set solidConstraintZ {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintZNode [customlib::AddConditionGroupOnXPath $solidConstraintZ "ConstraintZ//Total"] - $solidConstraintZNode setAttribute ov line - set props [list selector_component_X Not selector_component_Y Not selector_component_Z ByValue value_component_Z 0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintZNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Solid Loads - GiD_Groups clone SelfWeight Total - GiD_Groups edit parent Total SelfWeight - spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total" - GiD_Groups edit state "SelfWeight//Total" hidden - set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]" - set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"] - $solidLoadNode setAttribute ov volume - set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Load Total - GiD_Groups edit parent Total Load - spdAux::AddIntervalGroup Load "Load//Total" - GiD_Groups edit state "Load//Total" hidden - set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Load$nd'\]" - set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "Load//Total"] - $solidLoadNode setAttribute ov surface - set props [list ByFunction No modulus 4.44e6 direction 0.0,-1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Spring Total - GiD_Groups edit parent Total Spring - spdAux::AddIntervalGroup Spring "Spring//Total" - GiD_Groups edit state "Spring//Total" hidden - set solidSpring "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Spring$nd'\]" - set solidSpringNode [customlib::AddConditionGroupOnXPath $solidSpring "Spring//Total"] - $solidSpringNode setAttribute ov surface - set props [list ByFunction No modulus 50e6 direction 0.0,1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidSpringNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Parallelism - set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] - set time_params_path [spdAux::getRoute "Parallelization"] - foreach {n v} $time_parameters { - [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - - # Solver - set solver_parameters [list Solver amgcl max_iteration 2000 tolerance 1e-6 krylov_type cg] - set solver_params_path [spdAux::getRoute "SLStaticlinear_solver_settings"] - foreach {n v} $solver_parameters { - [$root selectNodes "$solver_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - - spdAux::RequestRefresh -} -proc Solid::examples::TreeAssignationEccentricColumn2Da {args} { - Kratos::ResetModel -} -proc Solid::examples::TreeAssignationEccentricColumn2D {args} { - Kratos::ResetModel -} diff --git a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.geo b/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.geo deleted file mode 100644 index 59e6badc1..000000000 Binary files a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.geo and /dev/null differ diff --git a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.prj b/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.prj deleted file mode 100644 index 29a1ac92a..000000000 --- a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.prj +++ /dev/null @@ -1,31 +0,0 @@ - - -
-    
-    
-      
-      
-      
-      
-      
-      
-    
-    
-      
-        10 12
-        1 1
-        6 5
-      
-      
-        4 6 7 25 35
-        1x5
-        4x4 2
-      
-      
-        2:9
-        2x8
-        1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3
-      
-    
-  
-
diff --git a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv b/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv deleted file mode 100644 index 97c55a377..000000000 --- a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv +++ /dev/null @@ -1,37 +0,0 @@ -BeginZE /home/cpuigbo/GiDInterface/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv - x -3.94726991653442383 5.74480867385864258 - y 6.39163064956665039 -1.58742785453796387 - z -2.95716428756713867 3.97514200210571289 - e 2.76385402679443359 - v -0.0793274012290671182 0.899682501223218134 0.174501511325530018 - r 0.392208881101695939 - m -0.679758787155151367 -0.279621034860610962 0.678041458129882812 0 -0.00585686462000012398 0.926512777805328369 0.37621772289276123 0 -0.733412444591522217 0.251766085624694824 -0.631442904472351074 0 0 0 0 1 - c 0.508988738059997559 1.8859550952911377 -0.508988738059997559 - pd 0 - pno 0 - pfo 0 - pf 4 - pv 0 - NowUse 0 - DrawingType 1 - LightVector 90 90 150 0 - OGLShadow(UseShadows) 0 - OGLShadow(RenderMode) RenderNice - OGLShadow(ShadowBias) -0.002 - OGLShadow(AmbientShadows) 1 - OGLShadow(UseFBO) 0 - OGLShadow(FBOSize) 2048 - OGLShadow(DimmedLightFactor) 0.02 - OGLStereo(UseStereo) 0 - OGLStereo(RelativeEyeDistance) 1 - OGLStereo(FlipEyes) 0 - OGLStereo(StereoMode) AnaglyphColors - OGLStereo(EyeDistance) 0.075 - OGLStereo(LeftEyeDistance) 1 0 0 1 - OGLStereo(RightEyeDistance) 0 1 1 1 -EndZE /home/cpuigbo/GiDInterface/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv - -BeginMirror - Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror -EndMirror - diff --git a/kratos.gid/apps/Solid/examples/NotchedBeam.tcl b/kratos.gid/apps/Solid/examples/NotchedBeam.tcl deleted file mode 100644 index acd3a3688..000000000 --- a/kratos.gid/apps/Solid/examples/NotchedBeam.tcl +++ /dev/null @@ -1,164 +0,0 @@ - -proc ::Solid::examples::NotchedBeam {args} { - if {![Kratos::IsModelEmpty]} { - set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" - set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] - if { $retval == "cancel" } { return } - } - DrawNotchedBeamGeometry$::Model::SpatialDimension - TreeAssignationNotchedBeam$::Model::SpatialDimension - - GiD_Process 'Redraw - GidUtils::UpdateWindow GROUPS - GidUtils::UpdateWindow LAYER - GiD_Process 'Zoom Frame -} - - -# Draw Geometry -proc Solid::examples::DrawNotchedBeamGeometry3D {args} { - Kratos::ResetModel -} -proc Solid::examples::DrawNotchedBeamGeometry2D {args} { - Kratos::ResetModel - set dir [apps::getMyDir "Solid"] - set problemfile [file join $dir examples NotchedBeam2D.gid] - GiD_Process Mescape Files InsertGeom $problemfile -} -proc Solid::examples::DrawNotchedBeamGeometry2Da {args} { - Kratos::ResetModel -} -# Mesh sizes - - -# Tree assign -proc Solid::examples::TreeAssignationNotchedBeam3D {args} { - Kratos::ResetModel -} -proc Solid::examples::TreeAssignationNotchedBeam2D {args} { - set nd $::Model::SpatialDimension - set root [customlib::GetBaseRoot] - - set condtype line - if {$nd eq "3D"} { set condtype surface } - - # Quasi-static solution strategy set - spdAux::SetValueOnTreeItem v "Quasi-static" SLSoluType - spdAux::SetValueOnTreeItem v "Non-linear" SLAnalysisType - - # Time parameters - set time_parameters [list EndTime 200 DeltaTime 1] - set time_params_path [spdAux::getRoute SLTimeParameters] - foreach {name value} $time_parameters { - set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"] - if {$node ne ""} { - $node setAttribute v $value - } else { - W "Couldn't find $name - Check example script" - } - } - - # Solid Parts - set solidParts [spdAux::getRoute "SLParts"] - set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid] - $solidPartsNode setAttribute ov surface - set props [list Element SmallDisplacementElement$nd ConstitutiveLaw SmallStrainPlaneStress2DLaw.SimoJuExponentialDamageModel DENSITY 2500 YOUNG_MODULUS 2.8e10 POISSON_RATIO 0.1 THICKNESS 0.1 DAMAGE_THRESHOLD 19.1237 STRENGTH_RATIO 10.9375 FRACTURE_ENERGY 140] - foreach {prop val} $props { - set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - set solidConditions [spdAux::getRoute "SLNodalConditions"] - - # Solid Constraint - GiD_Groups clone ConstraintXY Total - GiD_Groups edit parent Total ConstraintXY - spdAux::AddIntervalGroup ConstraintXY "ConstraintXY//Total" - GiD_Groups edit state "ConstraintXY//Total" hidden - set solidConstraintXY {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintXYNode [customlib::AddConditionGroupOnXPath $solidConstraintXY "ConstraintXY//Total"] - $solidConstraintXYNode setAttribute ov line - set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z Not Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintXYNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Solid Constraint - GiD_Groups clone ConstraintY Total - GiD_Groups edit parent Total ConstraintY - spdAux::AddIntervalGroup ConstraintY "ConstraintY//Total" - GiD_Groups edit state "ConstraintY//Total" hidden - set solidConstraintY {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintYNode [customlib::AddConditionGroupOnXPath $solidConstraintY "ConstraintY//Total"] - $solidConstraintYNode setAttribute ov line - set props [list selector_component_X Not selector_component_Y Not selector_component_Z ByValue value_component_Z 0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintYNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Solid Loads - GiD_Groups clone LoadY Total - GiD_Groups edit parent Total LoadY - spdAux::AddIntervalGroup LoadY "LoadY//Total" - GiD_Groups edit state "LoadY//Total" hidden - set solidLoadY "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Load$nd'\]" - set solidLoadYNode [customlib::AddConditionGroupOnXPath $solidLoadY "LoadY//Total"] - $solidLoadYNode setAttribute ov line - set props [list ByFunction Yes function_modulus "3000*t" direction 0.0,-1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidLoadYNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone LoadYY Total - GiD_Groups edit parent Total LoadYY - spdAux::AddIntervalGroup LoadYY "LoadYY//Total" - GiD_Groups edit state "LoadYY//Total" hidden - set solidLoadYY "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Load$nd'\]" - set solidLoadYYNode [customlib::AddConditionGroupOnXPath $solidLoadYY "LoadYY//Total"] - $solidLoadYYNode setAttribute ov line - set props [list ByFunction Yes function_modulus "30000*t" direction 0.0,-1.0,0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidLoadYYNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Parallelism - set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] - set time_params_path [spdAux::getRoute "Parallelization"] - foreach {n v} $time_parameters { - [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - # Output - set output_parameters [list DAMAGE_VARIABLE Yes] - set output_params_path [spdAux::getRoute "ElementResults"] - foreach {n v} $output_parameters { - [$root selectNodes "$output_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - spdAux::RequestRefresh -} -proc Solid::examples::TreeAssignationNotchedBeam2Da {args} { - Kratos::ResetModel -} diff --git a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.geo b/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.geo deleted file mode 100644 index 4ee2b07dd..000000000 Binary files a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.geo and /dev/null differ diff --git a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.prj b/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.prj deleted file mode 100644 index 0da43773f..000000000 --- a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.prj +++ /dev/null @@ -1,25 +0,0 @@ - - -
-    
-    
-      
-      
-      
-      
-      
-    
-    
-      
-        21 24 27 30
-        1x4
-        3 2 4 5
-      
-      
-        3:5
-        1x3
-        1x3
-      
-    
-  
-
diff --git a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.vv b/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.vv deleted file mode 100644 index b1e32bd49..000000000 --- a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.vv +++ /dev/null @@ -1,37 +0,0 @@ -BeginZE /home/josep_maria/Desktop/damage/NotchedBeam2D.gid/NotchedBeam2D.vv - x -0.387526094913482666 1.22752606868743896 - y 0.564327478408813477 -0.364327490329742432 - z -1.39298248291015625 1.39298248291015625 - e 0.464327484369277954 - v -0 -0 -8.74227765734758577e-08 - r -1 - m 1 -1.74845553146951715e-07 0 0 1.74845553146951715e-07 1 0 0 0 0 1 0 0 0 0 1 - c 0.419999986886978149 0.118095241487026215 0 - pd 0 - pno 0 - pfo 0 - pf 4 - pv 0 - NowUse 0 - DrawingType 1 - LightVector 90 90 150 0 - OGLShadow(UseShadows) 0 - OGLShadow(RenderMode) RenderNice - OGLShadow(ShadowBias) -0.002 - OGLShadow(AmbientShadows) 1 - OGLShadow(UseFBO) 0 - OGLShadow(FBOSize) 2048 - OGLShadow(DimmedLightFactor) 0.02 - OGLStereo(UseStereo) 0 - OGLStereo(RelativeEyeDistance) 1 - OGLStereo(FlipEyes) 0 - OGLStereo(StereoMode) AnaglyphColors - OGLStereo(EyeDistance) 0.075 - OGLStereo(LeftEyeDistance) 1 0 0 1 - OGLStereo(RightEyeDistance) 0 1 1 1 -EndZE /home/josep_maria/Desktop/damage/NotchedBeam2D.gid/NotchedBeam2D.vv - -BeginMirror - Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror -EndMirror - diff --git a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.geo b/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.geo deleted file mode 100644 index 5f3a05b9f..000000000 Binary files a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.geo and /dev/null differ diff --git a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.prj b/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.prj deleted file mode 100644 index d92ec5512..000000000 --- a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.prj +++ /dev/null @@ -1,28 +0,0 @@ - - -
-    
-    
-      
-      
-      
-      
-      
-      
-      
-      
-    
-    
-      
-        1:6 18 27:32 100018
-        1x14
-        19 20 19 19 16 19 17 15x4 18 15 17
-      
-      
-        1:24 100001:100024 1000007:1000018 1000020:1000025
-        1x66
-        1x48 14x18
-      
-    
-  
-
diff --git a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.vv b/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.vv deleted file mode 100644 index f545aaa7e..000000000 --- a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.vv +++ /dev/null @@ -1,37 +0,0 @@ -BeginZE /home/jmaria/Desktop/StaticBeamLattice.gid/StaticBeamLattice.vv - x -6.89991378784179688 6.89991378784179688 - y 15.3079414367675781 -4.42514467239379883 - z -20.6997413635253906 20.6997413635253906 - e 6.89991378784179688 - v 0.257072094239774285 -0.00642424184424369993 0.00395524515450007726 - r -0.966362780489641304 - m 0.999886155128479004 0.00434141699224710464 0.0144498627632856369 0 -0.0109473904594779015 0.867796599864959717 0.496798992156982422 0 -0.0103827305138111115 -0.496900618076324463 0.867745339870452881 0 0 0 0 1 - c 0 5.44139814376831055 0 - pd 0 - pno 0 - pfo 0 - pf 4 - pv 0 - NowUse 0 - DrawingType 0 - LightVector 90 90 150 0 - OGLShadow(UseShadows) 0 - OGLShadow(RenderMode) RenderNice - OGLShadow(ShadowBias) -0.002 - OGLShadow(AmbientShadows) 1 - OGLShadow(UseFBO) 0 - OGLShadow(FBOSize) 2048 - OGLShadow(DimmedLightFactor) 0.02 - OGLStereo(UseStereo) 0 - OGLStereo(RelativeEyeDistance) 1 - OGLStereo(FlipEyes) 0 - OGLStereo(StereoMode) AnaglyphColors - OGLStereo(EyeDistance) 0.075 - OGLStereo(LeftEyeDistance) 1 0 0 1 - OGLStereo(RightEyeDistance) 0 1 1 1 -EndZE /home/jmaria/Desktop/StaticBeamLattice.gid/StaticBeamLattice.vv - -BeginMirror - Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror -EndMirror - diff --git a/kratos.gid/apps/Solid/examples/StaticBeamLattice.tcl b/kratos.gid/apps/Solid/examples/StaticBeamLattice.tcl deleted file mode 100644 index bffb42d84..000000000 --- a/kratos.gid/apps/Solid/examples/StaticBeamLattice.tcl +++ /dev/null @@ -1,204 +0,0 @@ - -proc ::Solid::examples::StaticBeamLattice {args} { - if {![Kratos::IsModelEmpty]} { - set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" - set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] - if { $retval == "cancel" } { return } - } - DrawStaticBeamLatticeGeometry$::Model::SpatialDimension - TreeAssignationStaticBeamLattice$::Model::SpatialDimension - - GiD_Process 'Redraw - GidUtils::UpdateWindow GROUPS - GidUtils::UpdateWindow LAYER - GiD_Process 'Zoom Frame -} - - -# Draw Geometry -proc Solid::examples::DrawStaticBeamLatticeGeometry3D {args} { - Kratos::ResetModel - set dir [apps::getMyDir "Solid"] - set problemfile [file join $dir examples StaticBeamLattice.gid] - GiD_Process Mescape Files InsertGeom $problemfile -} -proc Solid::examples::DrawStaticBeamLatticeGeometry2Da {args} { - Kratos::ResetModel -} -proc Solid::examples::DrawStaticBeamLatticeGeometry2D {args} { - Kratos::ResetModel -} -# Mesh sizes - - -# Tree assign -proc Solid::examples::TreeAssignationStaticBeamLattice3D {args} { - set nd $::Model::SpatialDimension - set root [customlib::GetBaseRoot] - - set condtype point - - # Static solution strategy set - spdAux::SetValueOnTreeItem v "Quasi-static" SLSoluType - spdAux::SetValueOnTreeItem v "StaticStep" SLScheme - - # Time parameters - set time_parameters [list EndTime 1.6e2 DeltaTime 5.0] - set time_params_path [spdAux::getRoute SLTimeParameters] - foreach {name value} $time_parameters { - set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"] - if {$node ne ""} { - $node setAttribute v $value - } else { - W "Couldn't find $name - Check example script" - } - } - - # Solid Parts - set solidParts [spdAux::getRoute "SLParts"] - set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Wires] - $solidPartsNode setAttribute ov line - set props [list Element LargeDisplacementBeamElement3D ConstitutiveLaw UserDefined3D DENSITY 2650 CROSS_SECTION_AREA 7.85e-4 YOUNG_MODULUS 83.0e15 INERTIA_X 4.9E-6 INERTIA_Y 4.9E-6] - foreach {prop val} $props { - set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Connectors] - $solidPartsNode setAttribute ov line - set props [list Element LargeDisplacementBeamElement3D ConstitutiveLaw UserDefined3D DENSITY 2650 CROSS_SECTION_AREA 7.85e-4 YOUNG_MODULUS 83.0e15 INERTIA_X 1.0E-6 INERTIA_Y 1.0E-6] - foreach {prop val} $props { - set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - spdAux::RequestRefresh - set solidConditions [spdAux::getRoute "SLNodalConditions"] - - # Solid Constraint - GiD_Groups clone Displacement1 Total - GiD_Groups edit parent Total Displacement1 - spdAux::AddIntervalGroup Displacement1 "Displacement1//Total" - GiD_Groups edit state "Displacement1//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement1//Total"] - $solidConstraintNode setAttribute ov point - 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 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Displacement2 Total - GiD_Groups edit parent Total Displacement2 - spdAux::AddIntervalGroup Displacement2 "Displacement2//Total" - GiD_Groups edit state "Displacement2//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement2//Total"] - $solidConstraintNode setAttribute ov point - set props [list selector_component_X Not selector_component_Y ByFunction function_component_Y "1.0e-2*t" selector_component_Z Not Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Displacement3 Total - GiD_Groups edit parent Total Displacement3 - spdAux::AddIntervalGroup Displacement3 "Displacement3//Total" - GiD_Groups edit state "Displacement3//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement3//Total"] - $solidConstraintNode setAttribute ov point - 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 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Displacement4 Total - GiD_Groups edit parent Total Displacement4 - spdAux::AddIntervalGroup Displacement4 "Displacement4//Total" - GiD_Groups edit state "Displacement4//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement4//Total"] - $solidConstraintNode setAttribute ov point - set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByFunction function_component_Y "1.0e-2*t" selector_component_Z ByValue value_component_Z 0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Displacement5 Total - GiD_Groups edit parent Total Displacement5 - spdAux::AddIntervalGroup Displacement5 "Displacement5//Total" - GiD_Groups edit state "Displacement5//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement5//Total"] - $solidConstraintNode setAttribute ov point - set props [list selector_component_X Not value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z Not Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - GiD_Groups clone Displacement6 Total - GiD_Groups edit parent Total Displacement6 - spdAux::AddIntervalGroup Displacement6 "Displacement6//Total" - GiD_Groups edit state "Displacement6//Total" hidden - set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']} - set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement6//Total"] - $solidConstraintNode setAttribute ov point - set props [list selector_component_X Not selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total] - foreach {prop val} $props { - set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"] - if {$propnode ne "" } { - $propnode setAttribute v $val - } else { - W "Warning - Couldn't find property Solid $prop" - } - } - - # Parallelism - set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4] - set time_params_path [spdAux::getRoute "Parallelization"] - foreach {n v} $time_parameters { - [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v - } - - - spdAux::RequestRefresh -} -proc Solid::examples::TreeAssignationStaticBeamLattice2Da {args} { - Kratos::ResetModel -} -proc Solid::examples::TreeAssignationStaticBeamLattice2D {args} { - Kratos::ResetModel -} diff --git a/kratos.gid/apps/Solid/examples/examples.tcl b/kratos.gid/apps/Solid/examples/examples.tcl deleted file mode 100644 index 046f1c732..000000000 --- a/kratos.gid/apps/Solid/examples/examples.tcl +++ /dev/null @@ -1,41 +0,0 @@ -namespace eval Solid::examples { - -} - -proc Solid::examples::Init { } { - uplevel #0 [list source [file join $::Solid::dir examples DynamicBeam.tcl]] - uplevel #0 [list source [file join $::Solid::dir examples CircularTank.tcl]] - uplevel #0 [list source [file join $::Solid::dir examples EccentricColumn.tcl]] - uplevel #0 [list source [file join $::Solid::dir examples DynamicRod.tcl]] - uplevel #0 [list source [file join $::Solid::dir examples NotchedBeam.tcl]] - uplevel #0 [list source [file join $::Solid::dir examples StaticBeamLattice.tcl]] -} - -proc Solid::examples::UpdateMenus3D { } { - set menu_id 7 - GiDMenu::InsertOption "Kratos" [list "DynamicBeam" ] [incr menu_id] PRE [list ::Solid::examples::DynamicBeam] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "CircularTank" ] [incr menu_id] PRE [list ::Solid::examples::CircularTank] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "EccentricColumn" ] [incr menu_id] PRE [list ::Solid::examples::EccentricColumn] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "DynamicRod" ] [incr menu_id] PRE [list ::Solid::examples::DynamicRod] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "StaticBeamLattice" ] [incr menu_id] PRE [list ::Solid::examples::StaticBeamLattice] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "---"] [incr menu_id] PRE "" "" "" insertbefore = - GiDMenu::UpdateMenus -} - -proc Solid::examples::UpdateMenus2D { } { - set menu_id 7 - GiDMenu::InsertOption "Kratos" [list "NotchedBeam" ] [incr menu_id] PRE [list ::Solid::examples::NotchedBeam] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "DynamicRod" ] [incr menu_id] PRE [list ::Solid::examples::DynamicRod] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "---"] [incr menu_id] PRE "" "" "" insertbefore = - GiDMenu::UpdateMenus -} - -proc Solid::examples::UpdateMenus2Da { } { - set menu_id 7 - GiDMenu::InsertOption "Kratos" [list "CircularTank" ] [incr menu_id] PRE [list ::Solid::examples::CircularTank] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "---"] [incr menu_id] PRE "" "" "" insertbefore = - GiDMenu::UpdateMenus -} - - -Solid::examples::Init diff --git a/kratos.gid/apps/Solid/images/2D.png b/kratos.gid/apps/Solid/images/2D.png deleted file mode 100644 index b7ea880e0..000000000 Binary files a/kratos.gid/apps/Solid/images/2D.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/2Da.png b/kratos.gid/apps/Solid/images/2Da.png deleted file mode 100644 index 177ed86fc..000000000 Binary files a/kratos.gid/apps/Solid/images/2Da.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/3D.png b/kratos.gid/apps/Solid/images/3D.png deleted file mode 100644 index 6b418ad8e..000000000 Binary files a/kratos.gid/apps/Solid/images/3D.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/analysis_type.png b/kratos.gid/apps/Solid/images/Black/analysis_type.png deleted file mode 100644 index e9518e1c7..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/analysis_type.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/beam_example.png b/kratos.gid/apps/Solid/images/Black/beam_example.png deleted file mode 100644 index a63274eab..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/beam_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/bodies.png b/kratos.gid/apps/Solid/images/Black/bodies.png deleted file mode 100644 index d25725f10..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/bodies.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/boundaryConditions.png b/kratos.gid/apps/Solid/images/Black/boundaryConditions.png deleted file mode 100644 index 7a53439e5..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/boundaryConditions.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/cancelProcess.png b/kratos.gid/apps/Solid/images/Black/cancelProcess.png deleted file mode 100644 index 6f0580957..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/cancelProcess.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/column_example.png b/kratos.gid/apps/Solid/images/Black/column_example.png deleted file mode 100644 index c79c11f1e..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/column_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/contactStrategy.png b/kratos.gid/apps/Solid/images/Black/contactStrategy.png deleted file mode 100644 index e5fec1056..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/contactStrategy.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/data.png b/kratos.gid/apps/Solid/images/Black/data.png deleted file mode 100644 index 0a9012afb..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/data.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/doRestart.png b/kratos.gid/apps/Solid/images/Black/doRestart.png deleted file mode 100644 index 4f5a443ac..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/doRestart.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/folder.png b/kratos.gid/apps/Solid/images/Black/folder.png deleted file mode 100644 index 9b967fc38..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/folder.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/groupCreated.png b/kratos.gid/apps/Solid/images/Black/groupCreated.png deleted file mode 100644 index f174a291e..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/groupCreated.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/linear_solver.png b/kratos.gid/apps/Solid/images/Black/linear_solver.png deleted file mode 100644 index 80f0f7307..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/linear_solver.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/meshingStrategies.png b/kratos.gid/apps/Solid/images/Black/meshingStrategies.png deleted file mode 100644 index 194b27976..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/meshingStrategies.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/modelProperties.png b/kratos.gid/apps/Solid/images/Black/modelProperties.png deleted file mode 100644 index 5bd3d0c2c..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/modelProperties.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/notched_example.png b/kratos.gid/apps/Solid/images/Black/notched_example.png deleted file mode 100644 index f1237083b..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/notched_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/parallel_type.png b/kratos.gid/apps/Solid/images/Black/parallel_type.png deleted file mode 100644 index 32ddaae50..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/parallel_type.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/rod_example.png b/kratos.gid/apps/Solid/images/Black/rod_example.png deleted file mode 100644 index aba87579f..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/rod_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/runSimulation.png b/kratos.gid/apps/Solid/images/Black/runSimulation.png deleted file mode 100644 index 37a16063a..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/runSimulation.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/seeResults.png b/kratos.gid/apps/Solid/images/Black/seeResults.png deleted file mode 100644 index 0137561eb..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/seeResults.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/select.png b/kratos.gid/apps/Solid/images/Black/select.png deleted file mode 100644 index 5e245deeb..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/select.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/setLoad.png b/kratos.gid/apps/Solid/images/Black/setLoad.png deleted file mode 100644 index 066f81048..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/setLoad.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/setUnits.png b/kratos.gid/apps/Solid/images/Black/setUnits.png deleted file mode 100644 index f9d191505..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/setUnits.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/sheets.png b/kratos.gid/apps/Solid/images/Black/sheets.png deleted file mode 100644 index d1d70413c..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/sheets.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/solid.png b/kratos.gid/apps/Solid/images/Black/solid.png deleted file mode 100644 index 29241370a..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/solid.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/solvers.png b/kratos.gid/apps/Solid/images/Black/solvers.png deleted file mode 100644 index 72773b5db..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/solvers.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/tank_example.png b/kratos.gid/apps/Solid/images/Black/tank_example.png deleted file mode 100644 index ae08e734a..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/tank_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/timeIntervals.png b/kratos.gid/apps/Solid/images/Black/timeIntervals.png deleted file mode 100644 index 5555fa5d7..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/timeIntervals.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/timeParameters.png b/kratos.gid/apps/Solid/images/Black/timeParameters.png deleted file mode 100644 index 2400bd6a5..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/timeParameters.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/tree.png b/kratos.gid/apps/Solid/images/Black/tree.png deleted file mode 100644 index c3839cc21..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/tree.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/Black/view.png b/kratos.gid/apps/Solid/images/Black/view.png deleted file mode 100644 index 84569e82d..000000000 Binary files a/kratos.gid/apps/Solid/images/Black/view.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/analysis_type.png b/kratos.gid/apps/Solid/images/analysis_type.png deleted file mode 100644 index cdb4a00a4..000000000 Binary files a/kratos.gid/apps/Solid/images/analysis_type.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/beam_example.png b/kratos.gid/apps/Solid/images/beam_example.png deleted file mode 100644 index ceaadf8df..000000000 Binary files a/kratos.gid/apps/Solid/images/beam_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/column_example.png b/kratos.gid/apps/Solid/images/column_example.png deleted file mode 100644 index 7be554b56..000000000 Binary files a/kratos.gid/apps/Solid/images/column_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/conditions/arrow.msh b/kratos.gid/apps/Solid/images/conditions/arrow.msh deleted file mode 100644 index 1b1accda0..000000000 --- a/kratos.gid/apps/Solid/images/conditions/arrow.msh +++ /dev/null @@ -1,53 +0,0 @@ -MESH dimension 3 ElemType Triangle Nnode 3 -Coordinates - 1 1 0 0 - 2 0.625 -0.0999999958 3.47613295e-08 - 3 0.625 0.0999999958 3.47613296e-08 - 4 0.625 0.07071064 0.0707107146 - 5 0.625 -0.07071064 0.0707107146 - 6 0.625 -0.0707106906 -0.0707106655 - 7 0.625 0.0707106906 -0.0707106655 - 8 0.625 0 0.1 - 9 0.625 2.32452946e-16 -0.1 - 10 0.625 -0.2 2.34324128e-10 - 11 0.625 0.141421356 -0.141421356 - 12 0.625 0.141421357 0.141421356 - 13 0.625 -0.141421356 -0.141421356 - 14 0.625 -0.141421356 0.141421356 - 15 0.625 0 -0.2 - 16 0.625 0 0.2 - 17 0.625 0.2 -2.31773376e-10 - 18 0 0.0707106781 -0.0707106782 - 19 0 -0.0707106781 0.0707106782 - 20 0 -0.1 1.1713931e-10 - 21 0 -0.0707106781 -0.0707106782 - 22 0 4.38538095e-14 -0.1 - 23 0 0.0707106783 0.070710678 - 24 0 0.1 -1.15863951e-10 - 25 0 0 0.1 -End Coordinates - -Elements -1 1 15 13 -2 1 13 10 -3 1 10 14 -4 1 14 16 -5 1 16 12 -6 1 12 17 -7 1 17 11 -8 1 11 15 -End Elements -MESH dimension 3 ElemType Quadrilateral Nnode 4 -Coordinates -End Coordinates - -Elements -9 8 4 23 25 -10 4 3 24 23 -11 3 7 18 24 -12 7 9 22 18 -13 25 19 5 8 -14 19 20 2 5 -15 20 21 6 2 -16 21 22 9 6 -End Elements diff --git a/kratos.gid/apps/Solid/images/conditions/displacement.png b/kratos.gid/apps/Solid/images/conditions/displacement.png deleted file mode 100644 index 0760c9778..000000000 Binary files a/kratos.gid/apps/Solid/images/conditions/displacement.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/conditions/selfweight.msh b/kratos.gid/apps/Solid/images/conditions/selfweight.msh deleted file mode 100644 index 7d29f3f3a..000000000 --- a/kratos.gid/apps/Solid/images/conditions/selfweight.msh +++ /dev/null @@ -1,38 +0,0 @@ -MESH dimension 3 ElemType Quadrilateral Nnode 4 -Coordinates - 1 1 -1 0 - 2 0.7 -0.7 1.8 - 3 1 1 0 - 4 -1 -1 0 - 5 0.0866025404 -0.05 1.8 - 6 -0 -0.1 1.8 - 7 0.0866025404 0.05 1.8 - 8 -0.0866025404 -0.05 1.8 - 9 0 0.1 1.8 - 10 -0.0866025404 0.05 1.8 - 11 0.0866025404 -0.05 2 - 12 -0 -0.1 2 - 13 0.0866025404 0.05 2 - 14 -0.0866025404 -0.05 2 - 15 0 0.1 2 - 16 -0.7 -0.7 1.8 - 17 0.7 0.7 1.8 - 18 -0.0866025404 0.05 2 - 19 -1 1 0 - 20 -0.7 0.7 1.8 -End Coordinates - -Elements -1 1 3 19 4 -2 2 17 20 16 -3 19 20 16 4 -4 3 17 20 19 -5 1 2 17 3 -6 4 16 2 1 -7 15 18 10 9 -8 18 14 8 10 -9 14 12 6 8 -10 12 11 5 6 -11 11 13 7 5 -12 13 15 9 7 -End Elements diff --git a/kratos.gid/apps/Solid/images/conditions/spring.msh b/kratos.gid/apps/Solid/images/conditions/spring.msh deleted file mode 100644 index c975aff16..000000000 --- a/kratos.gid/apps/Solid/images/conditions/spring.msh +++ /dev/null @@ -1,430 +0,0 @@ -MESH dimension 3 ElemType Quadrilateral Nnode 4 -Coordinates - 1 -0.473042225 0.0999999574 -0.000170817993 - 2 -0.451464987 0.0600173227 0.0355144756 - 3 -0.494619463 0.0599264309 -0.0357540131 - 4 -0.446077782 5.68310897e-05 0.044487789 - 5 -0.500006668 -5.67536713e-05 -0.0445743572 - 6 -0.451464987 -0.0599263528 0.0356674452 - 7 -0.494619463 -0.0600172453 -0.0356010438 - 8 -0.473042225 -0.09999988 8.42504496e-05 - 9 -0.412394709 -0.00113413693 -0.213688722 - 10 -0.409445417 -0.0592214763 -0.188921007 - 11 -0.433604215 0.0418324251 -0.252658609 - 12 -0.417370829 -0.116691352 -0.181507101 - 13 -0.455434501 -1.26195103e-05 -0.286058594 - 14 -0.463340162 -0.0573199773 -0.278729349 - 15 -0.460063768 -0.116378948 -0.255930246 - 16 -0.439268564 -0.158903572 -0.214478378 - 17 -0.0215911123 0.059917595 -0.0356329607 - 18 -0.0269718282 -5.67573843e-05 -0.0444817637 - 19 -7.38465577e-06 0.0999999537 -7.82245153e-05 - 20 -0.0606358858 -0.000948653155 0.213547484 - 21 -0.0636006475 -0.0591854703 0.189004673 - 22 -0.0215773059 -0.0600122514 -0.0355658013 - 23 -0.37337435 -0.171656331 -0.403069876 - 24 -0.373149861 -0.225228592 -0.363051339 - 25 0.021562222 0.0600288617 0.0356385962 - 26 -0.0556585388 -0.116653213 0.181606496 - 27 -0.039444155 0.0420875477 0.252545177 - 28 -0.393620517 -0.121087381 -0.453968101 - 29 0.0269570586 5.68273767e-05 0.0445803825 - 30 -0.3842853 -0.272577396 -0.340851864 - 31 7.38465577e-06 -0.0999999537 7.82245153e-05 - 32 0.0215771528 -0.0599314731 0.0357027744 - 33 -0.0176140688 0.000343668135 0.286029257 - 34 -0.0337644928 -0.15886067 0.214681884 - 35 -0.415740216 -0.164604661 -0.483835788 - 36 -0.42643651 -0.213064782 -0.462972731 - 37 -0.406366932 -0.317525081 -0.370950942 - 38 -0.00970907278 -0.0570286489 0.278847491 - 39 -0.425367901 -0.270085052 -0.426806687 - 40 -0.0129562193 -0.116110437 0.255986295 - 41 0.0394310248 0.0418312677 -0.252568382 - 42 0.0176001717 -1.30127824e-05 -0.285965809 - 43 0.0096946778 -0.057319981 -0.278636756 - 44 0.0606386744 -0.00112840734 -0.21359164 - 45 0.0129747094 -0.116385161 -0.255876988 - 46 0.0635894223 -0.0592214756 -0.188828406 - 47 0.0570944384 -0.119110851 -0.18777369 - 48 0.0337814184 -0.158905961 -0.214486298 - 49 -0.0996725106 -0.171754298 0.402851357 - 50 -0.0998904615 -0.22542601 0.362957017 - 51 -0.0887478591 -0.272799308 0.340840483 - 52 -0.0794294675 -0.121067189 0.453710987 - 53 -0.0573211882 -0.164489981 0.483741677 - 54 -0.0666616739 -0.317669264 0.371015636 - 55 -0.0466153205 -0.212990249 0.462968146 - 56 -0.047681739 -0.270135826 0.426891665 - 57 -0.338488232 -0.457382298 -0.42603612 - 58 -0.334977314 -0.411203146 -0.481037789 - 59 -0.353427848 -0.487914552 -0.400412032 - 60 -0.352511307 -0.357214916 -0.559383112 - 61 0.0794150955 -0.121092142 -0.453878125 - 62 0.0996575196 -0.171638636 -0.402972733 - 63 0.0998849765 -0.22522858 -0.362958736 - 64 0.0465983302 -0.213064786 -0.462880138 - 65 0.0572948107 -0.164604909 -0.483743612 - 66 0.0476651991 -0.270064767 -0.42675719 - 67 0.0938215271 -0.281554921 -0.351420516 - 68 -0.374968338 -0.532141031 -0.433146924 - 69 0.0666831242 -0.317534634 -0.370954973 - 70 -0.138061265 -0.411292895 0.480774053 - 71 -0.374688258 -0.39880045 -0.589090912 - 72 -0.134541177 -0.457593352 0.425854272 - 73 -0.388592327 -0.432869969 -0.562490944 - 74 -0.390088361 -0.486209383 -0.513177315 - 75 -0.119595378 -0.488150825 0.400318117 - 76 -0.120542192 -0.357198975 0.559113819 - 77 -0.0980587022 -0.532299625 0.43316728 - 78 -0.0983814859 -0.398696685 0.589014167 - 79 -0.0844658746 -0.432802896 0.562494008 - 80 -0.0829618617 -0.486255616 0.513226926 - 81 -0.299887102 -0.650760846 -0.421597649 - 82 -0.308932953 -0.688635726 -0.35691224 - 83 -0.326572534 -0.709502552 -0.348795823 - 84 -0.31002423 -0.614104467 -0.537520165 - 85 -0.173174882 -0.651128332 0.421096386 - 86 0.412396525 -0.000949502319 0.213676024 - 87 0.409434193 -0.059185474 0.189097266 - 88 -0.164071947 -0.688820081 0.35665983 - 89 0.446063012 -5.67610974e-05 -0.0443891702 - 90 0.451441779 0.0599315362 -0.0355039438 - 91 0.134546605 -0.457382274 -0.425943527 - 92 0.138053521 -0.411171996 -0.480954632 - 93 0.417376267 -0.116652992 0.181699004 - 94 0.120524351 -0.357225216 -0.559286613 - 95 0.451457534 -0.0600122552 -0.0354732078 - 96 -0.146442431 -0.709764408 0.348643443 - 97 0.128630875 -0.498887238 -0.404784827 - 98 0.433575511 0.0420855371 0.252738563 - 99 -0.163030166 -0.614081539 0.537199725 - 100 0.473012668 0.10000001 0.000113108598 - 101 -0.344560295 -0.753486953 -0.397872419 - 102 0.0844425131 -0.432869973 -0.562398351 - 103 0.0980810985 -0.532156977 -0.433138183 - 104 0.0829462731 -0.486192169 -0.513126121 - 105 0.0983480298 -0.398802175 -0.588999427 - 106 -0.330985601 -0.653639058 -0.579177229 - 107 -0.348317953 -0.673801888 -0.561076895 - 108 0.473042225 -0.0999999574 0.000170817993 - 109 0.494596229 0.0600123027 0.0357646773 - 110 -0.352868828 -0.720611868 -0.5016491 - 111 0.439269952 -0.158862031 0.214776764 - 112 -0.274900805 -0.820446363 -0.248531483 - 113 0.373363863 -0.171734839 0.402989248 - 114 0.373144379 -0.225426014 0.36304961 - 115 0.455395836 0.000355312578 0.286191626 - 116 0.499991881 5.68139203e-05 0.0446730962 - 117 0.494611984 -0.0599314881 0.0357954135 - 118 0.463325751 -0.0570287037 0.278940183 - 119 0.459481525 -0.117946413 0.259850196 - 120 -0.19817499 -0.821240456 0.247007149 - 121 0.384286575 -0.272799195 0.340933614 - 122 -0.28870327 -0.865818588 -0.189273912 - 123 -0.128472371 -0.753644554 0.397883775 - 124 0.393589959 -0.121076401 0.453901555 - 125 -0.142097664 -0.653552425 0.579086719 - 126 -0.268756751 -0.81693285 -0.379841954 - 127 -0.124752422 -0.673742894 0.56108214 - 128 -0.120153443 -0.720430402 0.501746642 - 129 -0.184280607 -0.866033948 0.189059171 - 130 -0.204276682 -0.816838585 0.379430693 - 131 -0.241621748 -0.895542188 -0.132166509 - 132 -0.231335348 -0.89542053 0.131725534 - 133 -0.302836178 -0.899902838 -0.210551459 - 134 0.406372461 -0.317674347 0.371110275 - 135 -0.262206008 -0.920097307 -0.0263224918 - 136 0.415690374 -0.164499826 0.483877335 - 137 -0.210821413 -0.920697436 0.0250368073 - 138 0.426419504 -0.212990334 0.463060801 - 139 0.424443109 -0.275353464 0.429527343 - 140 -0.170196318 -0.900247296 0.210355413 - 141 0.334972742 -0.411280534 0.480912204 - 142 0.338493663 -0.457593356 0.425946866 - 143 0.164101884 -0.688635698 -0.356819666 - 144 0.17314504 -0.650727979 -0.42154059 - 145 -0.283417205 -0.8680931 -0.449027016 - 146 0.353438022 -0.488152288 0.400411104 - 147 0.138673136 -0.729419174 -0.357349791 - 148 -0.311192642 -0.946607623 -0.284209629 - 149 0.163010619 -0.614116175 -0.537409528 - 150 0.35247749 -0.357216518 0.559291629 - 151 -0.302840309 -0.889384979 -0.456454205 - 152 -0.189667257 -0.867892778 0.448916899 - 153 -0.266906185 -0.990705034 0.0208958101 - 154 -0.236140511 -0.964443951 0.222073821 - 155 -0.236924796 -0.964723405 -0.222342918 - 156 -0.31021076 -0.930036797 -0.396189325 - 157 0.128487815 -0.753503113 -0.397846833 - 158 -0.206131501 -0.991011297 -0.021034935 - 159 0.124716888 -0.673801891 -0.560984302 - 160 -0.161866047 -0.946765629 0.284229888 - 161 0.120167395 -0.72059883 -0.501590978 - 162 -0.170251488 -0.889310267 0.456419446 - 163 0.142052542 -0.653643493 -0.579082364 - 164 0.37497559 -0.532309247 0.433255289 - 165 -0.162722433 -0.92948335 0.396684989 - 166 0.374629196 -0.398730009 0.589125558 - 167 0.299856433 -0.651121872 0.421226097 - 168 -0.269557034 -1.04009122 -0.0177181561 - 169 0.388568951 -0.432802991 0.562586621 - 170 0.389355802 -0.492391604 0.509606991 - 171 0.198136704 -0.820421257 -0.248493613 - 172 0.308962894 -0.688820085 0.356752424 - 173 -0.25039504 -1.01710589 -0.257607059 - 174 -0.203426714 -1.04012434 0.0181121216 - 175 -0.222705459 -1.01690784 0.257489987 - 176 0.184331567 -0.865818563 -0.189181356 - 177 0.309990774 -0.614100004 0.537356532 - 178 0.326589871 -0.709767156 0.348732078 - 179 -0.257065464 -1.0609955 -0.207917643 - 180 0.204275823 -0.816938024 -0.379717709 - 181 -0.265516969 -1.07904774 -0.107450925 - 182 -0.215798893 -1.06064012 0.20881164 - 183 0.274855286 -0.821231407 0.247127018 - 184 -0.207593148 -1.07913758 0.10743992 - 185 0.167191199 -0.915681151 -0.221671401 - 186 0.231407908 -0.895542307 -0.132037047 - 187 0.210831929 -0.920062444 -0.0262869274 - 188 0.241692108 -0.895421096 0.131857788 - 189 0.268747136 -0.816847195 0.379569335 - 190 0.288754234 -0.866033951 0.189151765 - 191 0.330916882 -0.653572052 0.579166873 - 192 0.344562759 -0.753655117 0.397960279 - 193 0.189622237 -0.868095684 -0.448922696 - 194 0.161853775 -0.946618482 -0.284169106 - 195 0.262211399 -0.920681391 0.0251523726 - 196 0.348282404 -0.673742979 0.561174716 - 197 0.170194531 -0.889384982 -0.456361612 - 198 0.353466204 -0.722983512 0.490511355 - 199 0.16282617 -0.930025323 -0.396125314 - 200 0.302835637 -0.900246128 0.210435879 - 201 0.206128648 -0.990705017 0.020988352 - 202 0.236113216 -0.964714087 -0.222229423 - 203 0.236885241 -0.964411558 0.222105725 - 204 0.283349894 -0.867897879 0.44896634 - 205 0.266903339 -0.991011301 -0.0209423415 - 206 0.203083676 -1.04701111 -0.0298928952 - 207 0.302783337 -0.889310327 0.456511992 - 208 0.311170489 -0.946772698 0.284294692 - 209 0.2226398 -1.01710589 -0.257514466 - 210 0.314417853 -0.926780626 0.381055841 - 211 0.250329367 -1.01690785 0.257582518 - 212 0.269606095 -1.04012325 0.0181882818 - 213 0.207526808 -1.07905034 -0.107399913 - 214 0.215971109 -1.06098421 -0.207847507 - 215 0.271839979 -1.06232372 0.194937089 - 216 0.265446036 -1.07913868 0.107495949 -End Coordinates - -Elements -1 6 12 16 8 -2 4 10 12 6 -3 12 30 37 16 -4 10 24 30 12 -5 30 59 68 37 -6 24 57 59 30 -7 59 83 101 68 -8 57 82 83 59 -9 83 133 148 101 -10 82 122 133 83 -11 133 168 181 148 -12 122 153 168 133 -13 168 182 184 181 -14 153 175 182 168 -15 182 165 160 184 -16 175 162 165 182 -17 165 128 123 160 -18 162 127 128 165 -19 128 80 77 123 -20 127 79 80 128 -21 80 56 54 77 -22 79 55 56 80 -23 56 40 34 54 -24 55 38 40 56 -25 40 32 31 34 -26 38 29 32 40 -27 2 9 10 4 -28 1 11 9 2 -29 9 23 24 10 -30 11 28 23 9 -31 23 58 57 24 -32 28 60 58 23 -33 58 81 82 57 -34 60 84 81 58 -35 81 112 122 82 -36 84 126 112 81 -37 112 135 153 122 -38 126 131 135 112 -39 135 154 175 153 -40 131 132 154 135 -41 154 152 162 175 -42 132 130 152 154 -43 152 125 127 162 -44 130 99 125 152 -45 125 78 79 127 -46 99 76 78 125 -47 78 53 55 79 -48 76 52 53 78 -49 53 33 38 55 -50 52 27 33 53 -51 33 25 29 38 -52 27 19 25 33 -53 7 15 14 5 -54 8 16 15 7 -55 15 39 36 14 -56 16 37 39 15 -57 39 74 73 36 -58 37 68 74 39 -59 74 110 107 73 -60 68 101 110 74 -61 110 156 151 107 -62 101 148 156 110 -63 156 179 173 151 -64 148 181 179 156 -65 179 174 158 173 -66 181 184 174 179 -67 174 140 129 158 -68 184 160 140 174 -69 140 96 88 129 -70 160 123 96 140 -71 96 75 72 88 -72 123 77 75 96 -73 75 51 50 72 -74 77 54 51 75 -75 51 26 21 50 -76 54 34 26 51 -77 26 22 18 21 -78 34 31 22 26 -79 3 13 11 1 -80 5 14 13 3 -81 13 35 28 11 -82 14 36 35 13 -83 35 71 60 28 -84 36 73 71 35 -85 71 106 84 60 -86 73 107 106 71 -87 106 145 126 84 -88 107 151 145 106 -89 145 155 131 126 -90 151 173 155 145 -91 155 137 132 131 -92 173 158 137 155 -93 137 120 130 132 -94 158 129 120 137 -95 120 85 99 130 -96 129 88 85 120 -97 85 70 76 99 -98 88 72 70 85 -99 70 49 52 76 -100 72 50 49 70 -101 49 20 27 52 -102 50 21 20 49 -103 20 17 19 27 -104 21 18 17 20 -105 32 47 48 31 -106 29 46 47 32 -107 47 67 69 48 -108 46 63 67 47 -109 67 97 103 69 -110 63 91 97 67 -111 97 147 157 103 -112 91 143 147 97 -113 147 185 194 157 -114 143 176 185 147 -115 185 206 213 194 -116 176 201 206 185 -117 206 215 216 213 -118 201 211 215 206 -119 215 210 208 216 -120 211 207 210 215 -121 210 198 192 208 -122 207 196 198 210 -123 198 170 164 192 -124 196 169 170 198 -125 170 139 134 164 -126 169 138 139 170 -127 139 119 111 134 -128 138 118 119 139 -129 119 117 108 111 -130 118 116 117 119 -131 25 44 46 29 -132 19 41 44 25 -133 44 62 63 46 -134 41 61 62 44 -135 62 92 91 63 -136 61 94 92 62 -137 92 144 143 91 -138 94 149 144 92 -139 144 171 176 143 -140 149 180 171 144 -141 171 187 201 176 -142 180 186 187 171 -143 187 203 211 201 -144 186 188 203 187 -145 203 204 207 211 -146 188 189 204 203 -147 204 191 196 207 -148 189 177 191 204 -149 191 166 169 196 -150 177 150 166 191 -151 166 136 138 169 -152 150 124 136 166 -153 136 115 118 138 -154 124 98 115 136 -155 115 109 116 118 -156 98 100 109 115 -157 22 45 43 18 -158 31 48 45 22 -159 45 66 64 43 -160 48 69 66 45 -161 66 104 102 64 -162 69 103 104 66 -163 104 161 159 102 -164 103 157 161 104 -165 161 199 197 159 -166 157 194 199 161 -167 199 214 209 197 -168 194 213 214 199 -169 214 212 205 209 -170 213 216 212 214 -171 212 200 190 205 -172 216 208 200 212 -173 200 178 172 190 -174 208 192 178 200 -175 178 146 142 172 -176 192 164 146 178 -177 146 121 114 142 -178 164 134 121 146 -179 121 93 87 114 -180 134 111 93 121 -181 93 95 89 87 -182 111 108 95 93 -183 17 42 41 19 -184 18 43 42 17 -185 42 65 61 41 -186 43 64 65 42 -187 65 105 94 61 -188 64 102 105 65 -189 105 163 149 94 -190 102 159 163 105 -191 163 193 180 149 -192 159 197 193 163 -193 193 202 186 180 -194 197 209 202 193 -195 202 195 188 186 -196 209 205 195 202 -197 195 183 189 188 -198 205 190 183 195 -199 183 167 177 189 -200 190 172 167 183 -201 167 141 150 177 -202 172 142 141 167 -203 141 113 124 150 -204 142 114 113 141 -205 113 86 98 124 -206 114 87 86 113 -207 86 90 100 98 -208 87 89 90 86 -End Elements diff --git a/kratos.gid/apps/Solid/images/lattice_example.png b/kratos.gid/apps/Solid/images/lattice_example.png deleted file mode 100644 index 3ef6589e8..000000000 Binary files a/kratos.gid/apps/Solid/images/lattice_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/logo.png b/kratos.gid/apps/Solid/images/logo.png deleted file mode 100644 index 1f9a4c9fb..000000000 Binary files a/kratos.gid/apps/Solid/images/logo.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/logo_beam.png b/kratos.gid/apps/Solid/images/logo_beam.png deleted file mode 100644 index c832c4af9..000000000 Binary files a/kratos.gid/apps/Solid/images/logo_beam.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/notched_example.png b/kratos.gid/apps/Solid/images/notched_example.png deleted file mode 100644 index ac4cab58c..000000000 Binary files a/kratos.gid/apps/Solid/images/notched_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/parallel_type.png b/kratos.gid/apps/Solid/images/parallel_type.png deleted file mode 100644 index 21cd04c90..000000000 Binary files a/kratos.gid/apps/Solid/images/parallel_type.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/rod_example.png b/kratos.gid/apps/Solid/images/rod_example.png deleted file mode 100644 index 8288474ff..000000000 Binary files a/kratos.gid/apps/Solid/images/rod_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/solid.png b/kratos.gid/apps/Solid/images/solid.png deleted file mode 100644 index 23573a2e1..000000000 Binary files a/kratos.gid/apps/Solid/images/solid.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/solvers.png b/kratos.gid/apps/Solid/images/solvers.png deleted file mode 100644 index 9ae99faee..000000000 Binary files a/kratos.gid/apps/Solid/images/solvers.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/tank_example.png b/kratos.gid/apps/Solid/images/tank_example.png deleted file mode 100644 index 5e6d01ae5..000000000 Binary files a/kratos.gid/apps/Solid/images/tank_example.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/timeIntervals.png b/kratos.gid/apps/Solid/images/timeIntervals.png deleted file mode 100644 index 1f167f758..000000000 Binary files a/kratos.gid/apps/Solid/images/timeIntervals.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/images/tree.png b/kratos.gid/apps/Solid/images/tree.png deleted file mode 100644 index 51156d9a0..000000000 Binary files a/kratos.gid/apps/Solid/images/tree.png and /dev/null differ diff --git a/kratos.gid/apps/Solid/python/RunSolid.py b/kratos.gid/apps/Solid/python/RunSolid.py deleted file mode 100644 index ebc2c9f39..000000000 --- a/kratos.gid/apps/Solid/python/RunSolid.py +++ /dev/null @@ -1,8 +0,0 @@ -import KratosMultiphysics -import KratosMultiphysics.ExternalSolversApplication -import KratosMultiphysics.SolidMechanicsApplication -import KratosMultiphysics.ConstitutiveModelsApplication -import KratosMultiphysics.SolidMechanicsApplication.MainSolid as MainSolid - -MainSolid.Solution(KratosMultiphysics.Model()).Run() - diff --git a/kratos.gid/apps/Solid/start.tcl b/kratos.gid/apps/Solid/start.tcl deleted file mode 100644 index 44f387284..000000000 --- a/kratos.gid/apps/Solid/start.tcl +++ /dev/null @@ -1,84 +0,0 @@ -namespace eval ::Solid { - # Variable declaration - variable dir - variable attributes - variable kratos_name -} - -proc ::Solid::Init { } { - # Variable initialization - variable dir - variable attributes - variable kratos_name - set kratos_name SolidMechanicsApplication - - set dir [apps::getMyDir "Solid"] - set ::Model::ValidSpatialDimensions [list 2D 2Da 3D] - set attributes [dict create] - - # Intervals - dict set attributes UseIntervals 1 - - # Restart available - dict set attributes UseRestart 1 - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - LoadMyFiles - #::spdAux::CreateDimensionWindow -} - -proc ::Solid::LoadMyFiles { } { - variable dir - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write validation.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - uplevel #0 [list source [file join $dir symbols symbols.tcl]] - uplevel #0 [list source [file join $dir examples examples.tcl]] -} - -proc ::Solid::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value -} - -proc ::Solid::CustomToolbarItems { } { - variable dir - # Reset the left toolbar - set Kratos::kratos_private(MenuItems) [dict create] - set img_dir [file join $dir images] - if {[gid_themes::GetCurrentTheme] eq "GiD_black"} { - set img_dir [file join $img_dir Black] - } - Kratos::ToolbarAddItem "Model" [file join $img_dir "modelProperties.png"] [list -np- gid_groups_conds::open_conditions menu] [= "Define the model properties"] - Kratos::ToolbarAddItem "Spacer" "" "" "" - Kratos::ToolbarAddItem "Run" [file join $img_dir "runSimulation.png"] {Utilities Calculate} [= "Run the simulation"] - Kratos::ToolbarAddItem "Output" [file join $img_dir "view.png"] [list -np- PWViewOutput] [= "View process info"] - Kratos::ToolbarAddItem "Stop" [file join $img_dir "cancelProcess.png"] {Utilities CancelProcess} [= "Cancel process"] - Kratos::ToolbarAddItem "Spacer" "" "" "" - # Add examples - if { $::Model::SpatialDimension eq "2Da" } { - Kratos::ToolbarAddItem "Example" [file join $img_dir "tank_example.png"] [list -np- ::Solid::examples::CircularTank] [= "Example\nCircular water tank"] - } - if { $::Model::SpatialDimension eq "2D" } { - Kratos::ToolbarAddItem "Example" [file join $img_dir "notched_example.png"] [list -np- ::Solid::examples::NotchedBeam] [= "Example\nNotched beam damage"] - Kratos::ToolbarAddItem "Example" [file join $img_dir "rod_example.png"] [list -np- ::Solid::examples::DynamicRod] [= "Example\nDynamic rod pendulus"] - } - if { $::Model::SpatialDimension eq "3D" } { - Kratos::ToolbarAddItem "Example" [file join $img_dir "beam_example.png"] [list -np- ::Solid::examples::DynamicBeam] [= "Example\nDynamic beam rotating"] - Kratos::ToolbarAddItem "Example" [file join $img_dir "tank_example.png"] [list -np- ::Solid::examples::CircularTank] [= "Example\nCircular water tank"] - Kratos::ToolbarAddItem "Example" [file join $img_dir "column_example.png"] [list -np- ::Solid::examples::EccentricColumn] [= "Example\nEccentric column"] - Kratos::ToolbarAddItem "Example" [file join $img_dir "rod_example.png"] [list -np- ::Solid::examples::DynamicRod] [= "Example\nDynamic rod pendulus"] - Kratos::ToolbarAddItem "Example" [file join $img_dir "lattice_example.png"] [list -np- ::Solid::examples::StaticBeamLattice] [= "Example\nStatic beam lattice"] - } - Kratos::ToolbarAddItem "Spacer" "" "" "" - -} - -proc ::Solid::CustomMenus { } { - Solid::examples::UpdateMenus$::Model::SpatialDimension -} - -::Solid::Init diff --git a/kratos.gid/apps/Solid/symbols/symbols.tcl b/kratos.gid/apps/Solid/symbols/symbols.tcl deleted file mode 100644 index 160590c70..000000000 --- a/kratos.gid/apps/Solid/symbols/symbols.tcl +++ /dev/null @@ -1,393 +0,0 @@ -package require gid_draw_opengl - -namespace eval Solid::symbols { -} - -#to be used directly as symbol proc (to draw a condition as a 3D shape without take into account any direction to be oriented) -#valuesList is unused, but necessary because it is automatically added when invokind the symbol proc -#e.g -proc Solid::symbols::draw_file_mesh { filename color_lines color_surfaces valuesList } { - set full_filename [file join $Solid::dir $filename] - if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh] != "" } { - set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces ""] - } else { - set list_id [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces ""] - } - return $list_id -} - -#valuesList will be like: {ByFunction No {}} {modulus 9.81 m/s^2} {direction 0.0,-1.0,0.0 {}} {compound_assignment direct {}} {Interval Total {}} -proc Solid::symbols::draw_selfweight { valuesList } { - set full_filename [file join $Solid::dir images conditions selfweight.msh] - set color_lines black - set color_surfaces blue - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set modulus $data(modulus) - if { $modulus == 0 } { - #the value could be set by other function field, intead as modulus, consider like positive modulus - set modulus 1.0 - } - set direction [split $data(direction) ,] - if { [llength $direction] == 2 } { - lappend direction 0.0 - } - set opposite_direction [math::linearalgebra::scale_vect -1.0 $direction] - if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh_oriented_z_direction] != "" } { - set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh_oriented_z_direction $full_filename $color_lines $color_surfaces $opposite_direction] - } else { - #to allow use it before the proc is available in next GiD 14.1.1d - set list_id [Solid::symbols::create_opengl_list_from_file_mesh_oriented_z_direction $full_filename $color_lines $color_surfaces $opposite_direction] - } - return $list_id -} - -#valuesList will be like: {ByFunction No {}} {modulus 2.0 N} {direction 1.0,0.0,0.0 {}} {compound_assignment direct {}} {Interval Total {}} -proc Solid::symbols::draw_load { valuesList } { - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set modulus $data(modulus) - if { $modulus == 0 } { - #the value could be set by other function field, intead as modulus, consider like positive modulus - set modulus 1.0 - } - set direction [split $data(direction) ,] - if { [llength $direction] == 2 } { - lappend direction 0.0 - } - set force [MathUtils::ScalarByVectorProd $modulus $direction] - set x_axis [math::linearalgebra::unitLengthVector $force] - lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis - set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1] - if { [info procs gid_draw_opengl::create_opengl_list_drawing] != "" } { - set list_id [gid_draw_opengl::create_opengl_list_drawing gid_draw_opengl::draw_point_load $transform_matrix] - } else { - #to allow use it before the proc is available in next GiD 14.1.1d - set list_id [Solid::symbols::create_opengl_list_drawing Solid::symbols::draw_point_load $transform_matrix] - } - return $list_id -} - -proc Solid::symbols::draw_arrow { valuesList } { - set full_filename [file join $Solid::dir images conditions arrow.msh] - set color_lines black - set color_surfaces blue - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set modulus $data(modulus) - if { $modulus == 0 } { - #the value could be set by other function field, intead as modulus, consider like positive modulus - set modulus 1.0 - } - set direction [split $data(direction) ,] - if { [llength $direction] == 2 } { - lappend direction 0.0 - } - set force [math::linearalgebra::scale_vect $modulus $direction] - set x_axis [math::linearalgebra::unitLengthVector $force] - lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis - set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1] - if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh] != "" } { - set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix] - } else { - #to allow use it before the proc is available in next GiD 14.1.1d - set list_id [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix] - } - return $list_id -} - -#valuesList will be like: {{ByFunction No {}} {value 4 Pa} {compound_assignment direct {}} {Interval Total {}}} -proc Solid::symbols::draw_surface_pressure { valuesList } { - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set modulus $data(value) - if { $modulus > 0 } { - set load_local_direction [list 0 0 -1] ;#considered positive pointing oposite to local normal - } elseif { $modulus < 0 } { - set load_local_direction [list 0 0 1] ;#considered positive pointing oposite to local normal - } else { - #the value could be set by other function field, intead as modulus, consider like positive modulus - set load_local_direction [list 0 0 -1] - } - set x_axis $load_local_direction - lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis - set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1] - if { [info procs gid_draw_opengl::create_opengl_list_drawing] != "" } { - set list_id [gid_draw_opengl::create_opengl_list_drawing gid_draw_opengl::draw_point_load $transform_matrix] - } else { - #to allow use it before the proc is available in next GiD 14.1.1d - set list_id [Solid::symbols::create_opengl_list_drawing Solid::symbols::draw_point_load $transform_matrix] - } - return $list_id -} - -#draw_loads mean that is returning a dictionary but real draw is made native inside GiD based on this dict -#in this case the XML declare orientation="loads", a special value to say GiD how to draw -#valuesList will be like: {{ByFunction No {}} {value 4 Pa} {compound_assignment direct {}} {Interval Total {}}} -#but to work well by now it is necessary to assign to surfaces the surface_Local_axes, else is drawn with wrong direction (eulerangles==NULL) -proc Solid::symbols::draw_loads_surface_pressure { valuesList } { - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set modulus $data(value) - if { $modulus > 0 } { - set load_local_direction [list 0 0 -1] ;#considered positive pointing oposite to local normal - } elseif { $modulus < 0 } { - set load_local_direction [list 0 0 1] ;#considered positive pointing oposite to local normal - } else { - #the value could be set by other function field, intead as modulus, consider like positive modulus - set load_local_direction [list 0 0 -1] - } - set dictionary [dict create load_type local load_vector $load_local_direction] - return $dictionary -} - -proc Solid::symbols::draw_moment { valuesList } { - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set modulus $data(modulus) - if { $modulus == 0 } { - #the value could be set by other function field, intead as modulus, consider like positive modulus - set modulus 1.0 - } - set direction [split $data(direction) ,] - if { [llength $direction] == 2 } { - lappend direction 0.0 - } - set force [MathUtils::ScalarByVectorProd $modulus $direction] - set x_axis [math::linearalgebra::unitLengthVector $force] - lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis - set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1] - if { [info procs gid_draw_opengl::create_opengl_list_drawing] != "" } { - set list_id [gid_draw_opengl::create_opengl_list_drawing gid_draw_opengl::draw_point_momentum $transform_matrix] - } else { - #to allow use it before the proc is available in next GiD 14.1.1d - set list_id [Solid::symbols::create_opengl_list_drawing Solid::symbols::draw_point_momentum $transform_matrix] - } - return $list_id -} - -proc Solid::symbols::draw_spring { valuesList } { - set full_filename [file join $Solid::dir images conditions spring.msh] - set color_lines black - set color_surfaces blue - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set modulus $data(modulus) - if { $modulus == 0 } { - #the value could be set by other function field, intead as modulus, consider like positive modulus - set modulus 1.0 - } - set direction [split $data(direction) ,] - if { [llength $direction] == 2 } { - lappend direction 0.0 - } - set momentum [math::linearalgebra::scale_vect $modulus $direction] - set x_axis [math::linearalgebra::unitLengthVector $momentum] - lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis - set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1] - if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh] != "" } { - set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix] - } else { - #to allow use it before the proc is available in next GiD 14.1.1d - set list_id [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix] - } - return $list_id -} - -proc Solid::symbols::draw_surface_ballast { valuesList } { - set full_filename [file join $Solid::dir images conditions spring.msh] - set color_lines black - set color_surfaces blue - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set modulus $data(value) - if { $modulus > 0 } { - set load_local_direction [list 0 0 1] - } elseif { $modulus < 0 } { - set load_local_direction [list 0 0 -1] - } else { - #the value could be set by other function field, intead as modulus, consider like positive modulus - set load_local_direction [list 0 0 1] - } - set x_axis $load_local_direction - lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis - set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1] - if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh] != "" } { - set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix] - } else { - #to allow use it before the proc is available in next GiD 14.1.1d - set list_id [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix] - } - return $list_id -} - -#cannot be used because now parts are for all types: shells, beams and solids, -#and cannot set at design time orientation='shell_thickness', 'section' and the appropriated proc for each case -#orientation='[some_proc]' cannot be used because the xml_node provided to some_proc is the one of -#that does not contain the element type -proc Solid::symbols::draw_parts_shell { valuesList } { - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set thickness $data(THICKNESS) - return [dict create thickness $thickness] -} - -proc Solid::symbols::draw_thickness { thickness } { - set z_max [expr $thickness*0.5] - set z_min [expr -1.0*$z_max] - GiD_OpenGL draw -color $::gid_draw_opengl::rgb(black) - GiD_OpenGL draw -polygonmode frontandback line - GiD_OpenGL draw -begin quads -vertex [list 0 -0.5 $z_min] -vertex [list 0 0.5 $z_min] -vertex [list 1 0.5 $z_min] -vertex [list 1 -0.5 $z_min] -end - GiD_OpenGL draw -begin quads -vertex [list 0 -0.5 $z_max] -vertex [list 0 0.5 $z_max] -vertex [list 1 0.5 $z_max] -vertex [list 1 -0.5 $z_max] -end - GiD_OpenGL draw -color $::gid_draw_opengl::rgb(green) - GiD_OpenGL draw -polygonmode frontandback fill - GiD_OpenGL draw -begin quads -vertex [list 0 -0.5 $z_min] -vertex [list 0 0.5 $z_min] -vertex [list 1 0.5 $z_min] -vertex [list 1 -0.5 $z_min] -end - GiD_OpenGL draw -begin quads -vertex [list 0 -0.5 $z_max] -vertex [list 0 0.5 $z_max] -vertex [list 1 0.5 $z_max] -vertex [list 1 -0.5 $z_max] -end -} - -proc Solid::symbols::draw_parts { valuesList } { - set list_id "" - foreach item $valuesList { - lassign $item key value unit - set data($key) $value - #set unit($key) $unit - } - set beam_elements { LargeDisplacementBeamElement3D LargeDisplacementBeamEMCElement3D } - set shell_elemenst { ShellThinElement ShellThickElement ShellThinCorotationalElement ShellThickCorotationalElement } - if { [lsearch $shell_elemenst $data(Element)] != -1 } { - set thickness $data(THICKNESS) - set drawing_procedure [list Solid::symbols::draw_thickness $thickness] - } elseif { [lsearch $beam_elements $data(Element)] != -1 } { - - #the kind of data depends on $data(ConstitutiveLaw) that is storing the kind of profile: UserDefined3D, RectangularSection3D, ... - set profile $data(ConstitutiveLaw) - set rotate_90 1 - if { $profile== "UserDefined3D" } { - #set area $data(AREA) - if { $data(INERTIA_Y) > $data(INERTIA_X) } { - set rotate_90 0 - } - } elseif { $profile== "RectangularSection3D" } { - if { $data(SECTION_WIDTH) > $data(SECTION_HEIGHT) } { - set rotate_90 0 - } - } else { - set rotate_90 1 - } - #draw a double t profile - set drawing_procedure [list gid_draw_opengl::draw_symbol_section_properties {0.0 0.0 0.0} {1.0 0.0 0.0} $rotate_90 1.0 1.0] - } else { - #assumed solid - return "" - } - set transform_matrix "" - if { [info procs gid_draw_opengl::create_opengl_list_drawing] != "" } { - set list_id [gid_draw_opengl::create_opengl_list_drawing $drawing_procedure $transform_matrix] - } else { - #to allow use it before the proc is available in next GiD 14.1.1d - set list_id [Solid::symbols::create_opengl_list_drawing $drawing_procedure $transform_matrix] - } - return $list_id -} - -#only to show how is called, without drawing nothing -proc Solid::symbols::draw_parts_free { valuesList geom_mesh ov num pnts points ent_type center scale } { - W "valuesList=$valuesList geom_mesh=$geom_mesh ov=$ov num=$num pnts=$pnts points=$points ent_type=$ent_type center=$center scale=$scale" - return "" -} - -######## START procs temporary defined copied from gid_draw_opengl package -#to allow use it before the proc is available in next GiD 14.1.1d -#to be deleted when this problemtype require this version or higher (and off course this version is available) - -#transform_matrix could be "" for identity -proc Solid::symbols::create_opengl_list_drawing { drawing_procedure transform_matrix } { - set list_id [GiD_OpenGL draw -genlists 1] - GiD_OpenGL draw -newlist $list_id compile - if { [llength $transform_matrix] } { - GiD_OpenGL draw -pushmatrix -multmatrix $transform_matrix - } - {*}$drawing_procedure - if { [llength $transform_matrix] } { - GiD_OpenGL draw -popmatrix - } - GiD_OpenGL draw -endlist - return $list_id -} - -#e.g. to draw a condition as a 3D shape defined in a GiD ASCII mesh file -#transform_matrix could be "" for the identity or a list with 16 values (representing a 4x4 opengl_matrix) -proc Solid::symbols::create_opengl_list_from_file_mesh { full_filename color_lines color_surfaces transform_matrix } { - package require customLib - set drawing_procedure [list gid_groups_conds::import_gid_mesh_as_openGL $full_filename $color_lines $color_surfaces] - return [Solid::symbols::create_opengl_list_drawing $drawing_procedure $transform_matrix] -} - -proc Solid::symbols::create_opengl_list_from_file_mesh_oriented_z_direction { full_filename color_lines color_surfaces z_direction } { - package require customLib - lassign [gid_groups_conds::calc_xy_shell $z_direction] x_axis y_axis z_axis - set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1] - return [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix] -} - -#arrow size 1 pointing to +x (arrow cone height 0.3, radius 0.05) -proc Solid::symbols::draw_point_load { } { - #GiD_OpenGL draw -linewidth 2.0 - GiD_OpenGL draw -begin lines -vertex [list 0 0 0] -vertex [list 1 0 0] -end - GiD_OpenGL draw -begin trianglefan -vertex [list 1 0 0] - foreach angle [GidUtils::GetRange 0.0 $MathUtils::2PI 9] { - GiD_OpenGL draw -vertex [list 0.7 [expr {0.05*cos($angle)}] [expr {0.05*sin($angle)}]] - } - GiD_OpenGL draw -end - #GiD_OpenGL draw -linewidth 1.0 -} - -#arc and double-arrow size 1 pointing to +x (arrow cone height 0.1, radius 0.05) -proc Solid::symbols::draw_point_momentum { } { - GiD_OpenGL draw -begin lines -vertex [list 0 0 0] -vertex [list 1 0 0] -end - foreach x_cone_start {0.9 0.7} x_cone_end {1 0.8} { - GiD_OpenGL draw -begin trianglefan -vertex [list $x_cone_end 0 0] - foreach angle [GidUtils::GetRange 0.0 [expr {2.0*$MathUtils::Pi}] 9] { - GiD_OpenGL draw -vertex [list $x_cone_start [expr {0.05*cos($angle)}] [expr {0.05*sin($angle)}]] - } - GiD_OpenGL draw -end - } - GiD_OpenGL draw -begin linestrip - foreach angle [GidUtils::GetRange 0.0 [expr {1.5*$MathUtils::Pi}] 13] { - GiD_OpenGL draw -vertex [list 0 [expr {0.5*cos($angle)}] [expr {0.5*sin($angle)}]] - } - GiD_OpenGL draw -end - GiD_OpenGL draw -begin trianglefan -vertex [list 0 0 -0.5] - foreach angle [GidUtils::GetRange 0.0 [expr {2.0*$MathUtils::Pi}] 9] { - GiD_OpenGL draw -vertex [list [expr {0.05*sin($angle)}] -0.1 [expr {-0.5+0.05*cos($angle)}] ] - } - GiD_OpenGL draw -end -} -######## END procs temporary defined copied from gid_draw_opengl package diff --git a/kratos.gid/apps/Solid/write/validation.tcl b/kratos.gid/apps/Solid/write/validation.tcl deleted file mode 100644 index c2d1004b3..000000000 --- a/kratos.gid/apps/Solid/write/validation.tcl +++ /dev/null @@ -1,137 +0,0 @@ - -# return 0 means ok; return [list 1 "Error message to be displayed"] -proc Solid::write::writeValidateEvent { } { - set problem_message [list ] - - # Entities assigned to parts validation - lappend problem_message {*}[Solid::write::validatePartsMesh] - - # Entities assigned to parts validation - lappend problem_message {*}[Solid::write::validateNodalConditionsMesh] - - # Entities assigned to parts validation - #lappend problem_message {*}[Solid::write::validateLoadsMesh] - - # Add more tests here - - return [list [llength $problem_message] $problem_message] -} - -proc Solid::write::validatePartsMesh {} { - set problem_messages [list ] - # Get the Parts node - set parts_un "SLParts" - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute $parts_un]/group" - # Foreach group assigned - foreach gNode [$root selectNodes $xp1] { - # Get group name - set group_name [$gNode @n] - # Get the assigned element - set element [write::getValueByNode [$gNode selectNodes "./value\[@n = 'Element'\]"]] - # Get the element available topologies - set topologies [Solid::write::GetTopologies [::Model::getElement $element]] - # Validate if the group has any of the valid topologies assigned - set has_any [Solid::write::ValidateGroupNotEmpty $group_name $topologies] - if {$has_any == 0} { - # Get the topologies to show the message - set valid_topologies [list ] - foreach topology $topologies { - lappend valid_topologies [$topology getGeometry] - } - # Add the message to the list of problems - lappend problem_messages "Parts > group: $group_name must have one of this elements assigned: $valid_topologies. Assign something in geometry and remesh" - } - } - return $problem_messages -} -proc Solid::write::validateNodalConditionsMesh {} { - set problem_messages [list ] - # Get the Nodal conditions node - set nodal_conditions_un "SLNodalConditions" - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute $nodal_conditions_un]/condition/group" - # Foreach group assigned - foreach gNode [$root selectNodes $xp1] { - # Get group name - set group_name [write::GetWriteGroupName [$gNode @n]] - # Get the assigned nodal condition - set nodal_condition [[$gNode parent] @n] - # Get the nodal condition available topologies - set topologies [list [::Model::Topology new "Point" 1 ""]] - # TODO: validate ov - # Validate if the group has any of the valid topologies assigned - set has_any [Solid::write::ValidateGroupNotEmpty $group_name $topologies] - if {$has_any == 0} { - # Get the topologies to show the message - set valid_topologies [list ] - foreach topology $topologies { - lappend valid_topologies [$topology getGeometry] - } - # Add the message to the list of problems - lappend problem_messages "Conditions > group: $group_name must have one of this elements assigned: $valid_topologies. Assign something in geometry and remesh" - } - } - return $problem_messages -} - -proc Solid::write::validateLoadsMesh {} { - set problem_messages [list ] - # Get the Conditions node - set conditions_un "SLLoads" - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute $conditions_un]/condition/group" - # Foreach group assigned - foreach gNode [$root selectNodes $xp1] { - # Get group name - set group_name [write::GetWriteGroupName [$gNode @n]] - # Get the assigned nodal condition - set condition [[$gNode parent] @n] - # Get the entity selected condition - if {[$gNode hasAttribute ov]} {set ov [$gNode getAttribute ov]} {set ov [[$gNode parent ] getAttribute ov]} - # Get the nodal condition available topologies - set topologies [Solid::write::GetTopologies [Model::getCondition $condition] ] - if {$topologies eq ""} {set topologies [list [::Model::Topology new "Point" 1 ""]]; set ov ""} - # Validate if the group has any of the valid topologies assigned - set has_any [Solid::write::ValidateGroupNotEmpty $group_name $topologies $ov] - if {$has_any == 0} { - # Get the topologies to show the message - set valid_topologies [list ] - foreach topology $topologies { - lappend valid_topologies [$topology getGeometry] - } - # Add the message to the list of problems - lappend problem_messages "Loads > group: $group_name must have one of this elements assigned: $valid_topologies. Assign something in geometry and remesh" - } - } - return $problem_messages -} - -proc Solid::write::GetTopologies { entity } { - if {$entity eq ""} {return [list ]} - return [$entity getTopologyFeatures] -} -proc Solid::write::ValidateGroupNotEmpty { group_name topologies {ov ""} } { - set any 0 - set isquadratic [write::isquadratic] - # W "$group_name ov: $ov topo: [llength $topologies] $topologies" - foreach topology $topologies { - set geo [$topology getGeometry] - if {$ov ne "" && [string tolower $geo] ne $ov} {continue} - if {$geo == "Point"} { - # W "Checking $group_name nodes: [GiD_EntitiesGroups get $group_name nodes -count]" - if {[GiD_EntitiesGroups get $group_name nodes -count] > 0} { - # TODO: check number of nodes if quadratic - set any 1 - break - } - } else { - if {[GiD_EntitiesGroups get $group_name elements -count -element_type $geo] > 0} { - # TODO: check number of nodes if quadratic - set any 1 - break - } - } - } - return $any -} \ No newline at end of file diff --git a/kratos.gid/apps/Solid/write/write.tcl b/kratos.gid/apps/Solid/write/write.tcl deleted file mode 100644 index fc2f7bbec..000000000 --- a/kratos.gid/apps/Solid/write/write.tcl +++ /dev/null @@ -1,377 +0,0 @@ -namespace eval Solid::write { - variable mat_dict - variable validApps - variable ConditionsDictGroupIterators - variable NodalConditionsGroup - variable writeCoordinatesByGroups -} - -proc Solid::write::Init { } { - # Namespace variables inicialization - variable mat_dict - set mat_dict "" - variable ConditionsDictGroupIterators - variable NodalConditionsGroup - set ConditionsDictGroupIterators [dict create] - set NodalConditionsGroup [list ] - - variable validApps - set validApps [list "Solid"] - - variable writeCoordinatesByGroups - set writeCoordinatesByGroups 0 -} - -proc Solid::write::AddValidApps {appList} { - variable validApps - - lappend validApps $appList -} - -proc Solid::write::writeCustomFilesEvent { } { - WriteMaterialsFile - - write::CopyFileIntoModel "python/RunSolid.py" - set paralleltype [write::getValue ParallelType] - set orig_name "RunSolid.py" - - write::RenameFileInModel $orig_name "MainKratos.py" -} - -proc Solid::write::SetCoordinatesByGroups {value} { - variable writeCoordinatesByGroups - set writeCoordinatesByGroups $value -} - -# MDPA Blocks - -proc Solid::write::writeModelPartEvent { } { - variable writeCoordinatesByGroups - variable validApps - variable ConditionsDictGroupIterators - write::initWriteData "SLParts" "SLMaterials" - - write::writeModelPartData - write::WriteString "Begin Properties 0" - write::WriteString "End Properties" - write::writeMaterials $validApps - #write::writeTables - if {$writeCoordinatesByGroups} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} - write::writeElementConnectivities - writeConditions - set basicConds [write::writeBasicSubmodelParts [getLastConditionId]] - set ConditionsDictGroupIterators [dict merge $ConditionsDictGroupIterators $basicConds] - writeMeshes - # W $ConditionsDictGroupIterators - #writeCustomBlock -} - - -proc Solid::write::writeConditions { } { - variable ConditionsDictGroupIterators - set ConditionsDictGroupIterators [write::writeConditions "SLLoads"] -} - -proc Solid::write::writeMeshes { } { - - write::writePartSubModelPart - - # Solo Malla , no en conditions - write::writeNodalConditions "SLNodalConditions" - - # A Condition y a meshes-> salvo lo que no tenga topologia - writeLoads -} - -proc Solid::write::writeLoads { } { - variable ConditionsDictGroupIterators - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute "SLLoads"]/condition/group" - foreach group [$root selectNodes $xp1] { - set groupid [$group @n] - set groupid [write::GetWriteGroupName $groupid] - #W "Writing mesh of Load $groupid" - if {$groupid in [dict keys $ConditionsDictGroupIterators]} { - ::write::writeGroupSubModelPart [[$group parent] @n] $groupid "Conditions" [dict get $ConditionsDictGroupIterators $groupid] - } else { - ::write::writeGroupSubModelPart [[$group parent] @n] $groupid "nodal" - } - } -} - - -proc Solid::write::writeCustomBlock { } { - write::WriteString "Begin Custom" - write::WriteString "Custom write for Solid, any app can call me, so be careful!" - write::WriteString "End Custom" - write::WriteString "" -} - -proc Solid::write::getLastConditionId { } { - variable ConditionsDictGroupIterators - set top 1 - if {$ConditionsDictGroupIterators ne ""} { - foreach {group iters} $ConditionsDictGroupIterators { - set top [expr max($top,[lindex $iters 1])] - } - } - return $top -} - -# Custom files -proc Solid::write::WriteMaterialsFile { } { - variable validApps - - set filename "Materials.json" - set mats_json [Solid::write::getPropertiesList SLParts] - - write::OpenFile $filename - write::WriteJSON $mats_json - write::CloseFile -} - -proc Solid::write::WriteMaterialsFileOld { } { - variable validApps - - set filename "Materials.json" - set mats_json [Solid::write::getPropertiesList SLParts] - - write::OpenFile $filename - write::WriteJSON $mats_json - write::CloseFile - - write::OpenFile "materials.py" - - set str " -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.SolidMechanicsApplication import * -from beam_sections_python_utility import SetProperties -from beam_sections_python_utility import SetMaterialProperties - -def AssignMaterial(Properties): - # material for solid material" - foreach {part mat} [write::getMatDict] { - if {[dict get $mat APPID] in $validApps} { - set law_name [dict get $mat ConstitutiveLaw] - set law_type [[Model::getConstitutiveLaw $law_name] getAttribute "Type"] - set public_name [[Model::getConstitutiveLaw $law_name] getAttribute "pn"] - if {$law_type eq "1D_UR"} { - append str " - prop_id = [dict get $mat MID]; - prop = Properties\[prop_id\] -" - if {$public_name eq "Circular"} { - append str " - section_type = \"$public_name\" - prop_list = \[\] - prop_list.append([dict get $mat DIAMETER]) - prop = SetProperties(section_type,prop_list,prop) -" - } elseif {$public_name eq "Tubular"} { - append str " - section_type = \"$public_name\" - prop_list = \[\] - prop_list.append([dict get $mat DIAMETER]) - prop_list.append([dict get $mat THICKNESS]) - prop = SetProperties(section_type,prop_list,prop) -" - } elseif {$public_name eq "Rectangular"} { - append str " - section_type = \"$public_name\" - prop_list = \[\] - prop_list.append([dict get $mat HEIGHT]) - prop_list.append([dict get $mat WIDTH]) - prop = SetProperties(section_type,prop_list,prop) -" - } elseif {$public_name eq "UserDefined"} { - append str " - section_type = \"$public_name\" - prop_list = \[\] - prop_list.append([dict get $mat AREA]) - prop_list.append([dict get $mat INERTIA_X]) - prop_list.append([dict get $mat INERTIA_Y]) - prop = SetProperties(section_type,prop_list,prop) -" - } elseif {$public_name eq "UserParameters"} { - append str " - section_type = \"UserDefined\" - prop_list = \[\] - prop_list.append([dict get $mat YOUNGxAREA]) - prop_list.append([dict get $mat SHEARxREDUCED_AREA]) - prop_list.append([dict get $mat YOUNGxINERTIA_X]) - prop_list.append([dict get $mat YOUNGxINERTIA_Y]) - prop_list.append([dict get $mat SHEARxPOLAR_INERTIA]) - prop = SetMaterialProperties(section_type,prop_list,prop) -" - } else { - append str " - section_type = \"$public_name\" - prop_list = \[\] - prop_list.append([dict get $mat SIZE]) - prop = SetProperties(section_type,prop_list,prop) -" - } - } { - append str " - prop_id = [dict get $mat MID]; - prop = Properties\[prop_id\] - mat = [dict get $mat ConstitutiveLaw]() - prop.SetValue(CONSTITUTIVE_LAW, mat.Clone()) -" - - } - } - } - -if 0 { - foreach {part mat} [write::getMatDict] { - if {[dict get $mat APPID] in $validApps} { - append str " - prop_id = [dict get $mat MID]; - prop = Properties\[prop_id\] - mat = [dict get $mat ConstitutiveLaw]() - prop.SetValue(CONSTITUTIVE_LAW, mat.Clone()) - " - } - } -} - write::WriteString $str - write::CloseFile - -} - - -proc Solid::write::ProcessVectorFunctionComponents { groupNode condition process} { - set processDict [write::GetProcessHeader $groupNode $process $condition] - set val [write::GetInputValue $groupNode [$process getInputPn component]] - foreach i $val { - if {$i == "null"} { - lappend value null - } { - lappend value $i - } - } - - dict set processDict Parameters compound_assignment [write::GetInputValue $groupNode [$process getInputPn compound_assignment]] - dict set processDict Parameters value $value - - - return $processDict -} - -proc Solid::write::getPropertiesList {parts_un} { - set mat_dict [write::getMatDict] - set props_dict [dict create] - set props [list ] - set sections [list ] - - set python_module "assign_materials_process" - set process_name "AssignMaterialsProcess" - set help "This process creates a material and assigns its properties" - - #set doc $gid_groups_conds::doc - #set root [$doc documentElement] - set root [customlib::GetBaseRoot] - - set xp1 "[spdAux::getRoute $parts_un]/group" - foreach gNode [$root selectNodes $xp1] { - set group [get_domnode_attribute $gNode n] - set sub_model_part [write::getSubModelPartId Parts $group] - if { [dict exists $mat_dict $group] } { - set law_id [dict get $mat_dict $group MID] - set law_name [dict get $mat_dict $group ConstitutiveLaw] - set law_type [[Model::getConstitutiveLaw $law_name] getAttribute "Type"] - set mat_name [dict get $mat_dict $group Material] - - if {$law_type eq "1D_UR"} { - set python_module "assign_sections_process" - set process_name "AssignSectionsProcess" - set help "This process creates a section and assigns its properties" - } - - set prop_dict [dict create] - set kratos_module [[Model::getConstitutiveLaw $law_name] getAttribute "kratos_module"] - dict set prop_dict "python_module" $python_module - dict set prop_dict "kratos_module" $kratos_module - dict set prop_dict "help" $help - dict set prop_dict "process_name" $process_name - - set exclusionList [list "MID" "APPID" "ConstitutiveLaw" "Material" "Element"] - set variables_dict [dict create] - foreach prop [dict keys [dict get $mat_dict $group] ] { - if {$prop ni $exclusionList} { - dict set variables_list $prop [write::getFormattedValue [dict get $mat_dict $group $prop]] - } - } - - set material_dict [dict create] - dict set material_dict "model_part_name" $sub_model_part - dict set material_dict "properties_id" $law_id - dict set material_dict "material_name" $mat_name - - if {$law_type eq "1D_UR"} { - set public_name [[Model::getConstitutiveLaw $law_name] getAttribute "pn"] - dict set material_dict "section_type" $public_name - } else { - set law_full_name [join [list "KratosMultiphysics" $kratos_module $law_name] "."] - dict set material_dict constitutive_law [dict create name $law_full_name] - } - dict set material_dict variables $variables_list - dict set material_dict tables dictnull - dict set prop_dict Parameters $material_dict - - lappend props $prop_dict - } - - } - - dict set props_dict material_models_list $props - - return $props_dict -} - -proc Solid::write::GetUsedElements { {get "Objects"} } { - set xp1 "[spdAux::getRoute SLParts]/group" - set lista [list ] - foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { - set elem_name [get_domnode_attribute [$gNode selectNodes ".//value\[@n='Element']"] v] - set e [Model::getElement $elem_name] - if {$get eq "Name"} { set e [$e getName] } - lappend lista $e - } - return $lista -} - -proc Solid::write::GetDefaultOutputDict { {appid ""} } { - set outputDict [dict create] - set resultDict [dict create] - - if {$appid eq ""} {set results_UN Results } {set results_UN [apps::getAppUniqueName $appid Results]} - set GiDPostDict [dict create] - dict set GiDPostDict GiDPostMode [write::getValue $results_UN GiDPostMode] - dict set GiDPostDict WriteDeformedMeshFlag [write::getValue $results_UN GiDWriteMeshFlag] - dict set GiDPostDict WriteConditionsFlag [write::getValue $results_UN GiDWriteConditionsFlag] - dict set GiDPostDict MultiFileFlag [write::getValue $results_UN GiDMultiFileFlag] - dict set resultDict gidpost_flags $GiDPostDict - - dict set resultDict file_label [write::getValue $results_UN FileLabel] - set outputCT [write::getValue $results_UN OutputControlType] - dict set resultDict output_control_type $outputCT - if {$outputCT eq "time"} {set frequency [write::getValue $results_UN OutputDeltaTime]} {set frequency [write::getValue $results_UN OutputDeltaStep]} - dict set resultDict output_frequency $frequency - - dict set resultDict node_output [write::getValue $results_UN NodeOutput] - - #dict set resultDict plane_output [write::GetCutPlanesList $results_UN] - - dict set resultDict nodal_results [write::GetResultsList $results_UN OnNodes] - dict set resultDict gauss_point_results [write::GetResultsList $results_UN OnElement] - - dict set outputDict "result_file_configuration" $resultDict - #dict set outputDict "point_data_configuration" [write::GetEmptyList] - return $outputDict -} - -Solid::write::Init diff --git a/kratos.gid/apps/Solid/write/writeProjectParameters.tcl b/kratos.gid/apps/Solid/write/writeProjectParameters.tcl deleted file mode 100644 index d1f6b228b..000000000 --- a/kratos.gid/apps/Solid/write/writeProjectParameters.tcl +++ /dev/null @@ -1,177 +0,0 @@ -# Project Parameters - -proc Solid::write::getParametersDict { } { - set model_name "Solid_Domain" - set projectParametersDict [dict create] - - # Problem data - set problemDataDict [dict create] - - # Add items - set model_name [Kratos::GetModelName] - dict set problemDataDict problem_name $model_name - - # Parallelization - set paralleltype [write::getValue ParallelType] - #dict set problemDataDict "parallel_type" $paralleltype - if {$paralleltype eq "OpenMP"} { - #set nthreads [write::getValue Parallelization OpenMPNumberOfThreads] - #dict set problemDataDict NumberofThreads $nthreads - } else { - #set nthreads [write::getValue Parallelization MPINumberOfProcessors] - #dict set problemDataDict NumberofProcessors $nthreads - } - - set echo_level [write::getValue Results EchoLevel] - dict set problemDataDict echo_level $echo_level - - # Add ProblemData to Parameters - dict set projectParametersDict problem_data $problemDataDict - - # Time settings - set timeDataDict [dict create] - dict set timeDataDict time_step [write::getValue SLTimeParameters DeltaTime] - dict set timeDataDict start_time [write::getValue SLTimeParameters StartTime] - dict set timeDataDict end_time [write::getValue SLTimeParameters EndTime] - - dict set projectParametersDict time_settings $timeDataDict - - # Model data - # Create section - set modelDataDict [dict create] - - # Add items - dict set modelDataDict model_name $model_name - set nDim [expr [string range [write::getValue nDim] 0 0] ] - dict set modelDataDict dimension $nDim - - dict set modelDataDict domain_parts_list [write::getSubModelPartNames "SLParts"] - dict set modelDataDict processes_parts_list [write::getSubModelPartNames "SLNodalConditions" "SLLoads"] - - # Add model import settings - set importDataDict [dict create] - #dict set importDataDict type "mdpa" - dict set importDataDict name $model_name - #dict set importDataDict label 0 - dict set modelDataDict input_file_settings $importDataDict - - # Add ModelData to Parameters - dict set projectParametersDict model_settings $modelDataDict - - # Solver settings - set solverDataDict [dict create] - - set currentStrategyId [write::getValue SLSolStrat] - set strategy_write_name [[::Model::GetSolutionStrategy $currentStrategyId] getAttribute "python_module"] - dict set solverDataDict solver_type $strategy_write_name - - # Solver parameters - set solverParametersDict [dict create] - - # Time integration settings - set integrationDataDict [dict create] - - dict set integrationDataDict solution_type [write::getValue SLSoluType] - - set solutiontype [write::getValue SLSoluType] - if {$solutiontype ne "Dynamic"} { - dict set integrationDataDict integration_method [write::getValue SLScheme] - dict set integrationDataDict analysis_type [write::getValue SLAnalysisType] - } else { - dict set integrationDataDict time_integration [write::getValue SLSolStrat] - dict set integrationDataDict integration_method [write::getValue SLScheme] - } - - # Solving strategy settings - set strategyDataDict [dict create] - - # Solution strategy parameters and Solvers - set strategyDataDict [dict merge $strategyDataDict [write::getSolutionStrategyParametersDict] ] - - # Get integration order as term for the integration settings - set exist_time_integration [dict exists $strategyDataDict time_integration_order] - if {$exist_time_integration eq 1} { - dict set integrationDataDict time_integration_order [dict get $strategyDataDict time_integration_order] - dict unset strategyDataDict time_integration_order - } - - dict set solverParametersDict time_integration_settings $integrationDataDict - - # Get convergence criterion settings - set convergenceDataDict [dict create] - set exist_convergence_criterion [dict exists $strategyDataDict convergence_criterion] - if {$exist_convergence_criterion eq 1} { - dict set convergenceDataDict convergence_criterion [dict get $strategyDataDict convergence_criterion] - dict unset strategyDataDict convergence_criterion - set exist_variable_tolerances [dict exists $strategyDataDict variable_relative_tolerance] - if {$exist_variable_tolerances eq 1} { - dict set convergenceDataDict variable_relative_tolerance [dict get $strategyDataDict variable_relative_tolerance] - dict set convergenceDataDict variable_absolute_tolerance [dict get $strategyDataDict variable_absolute_tolerance] - dict unset strategyDataDict variable_relative_tolerance - dict unset strategyDataDict variable_absolute_tolerance - } - set exist_residual_tolerances [dict exists $strategyDataDict residual_relative_tolerance] - if {$exist_residual_tolerances eq 1} { - dict set convergenceDataDict residual_relative_tolerance [dict get $strategyDataDict residual_relative_tolerance] - dict set convergenceDataDict residual_absolute_tolerance [dict get $strategyDataDict residual_absolute_tolerance] - dict unset strategyDataDict residual_relative_tolerance - dict unset strategyDataDict residual_absolute_tolerance - } - } - - dict set solverParametersDict convergence_criterion_settings $convergenceDataDict - - set strategy_data_size [dict size $strategyDataDict] - if { $strategy_data_size ne 0 } { - dict set solverParametersDict solving_strategy_settings $strategyDataDict - } - - # Linear solver settings - set solverParametersDict [dict merge $solverParametersDict [write::getSolversParametersDict Solid] ] - - # Add Dofs - dict set solverParametersDict dofs [list {*}[DofsInElements] ] - - dict set solverDataDict Parameters $solverParametersDict - - dict set projectParametersDict solver_settings $solverDataDict - - # Lists of processes - set nodal_conditions_dict [write::getConditionsParametersDict SLNodalConditions "Nodal"] - dict set projectParametersDict constraints_process_list $nodal_conditions_dict - - dict set projectParametersDict loads_process_list [write::getConditionsParametersDict SLLoads] - - # GiD output configuration - dict set projectParametersDict output_configuration [Solid::write::GetDefaultOutputDict] - - # restart options - set restartDict [dict create ] - dict set restartDict SaveRestart false - dict set restartDict RestartFrequency 0 - dict set restartDict LoadRestart false - dict set restartDict Restart_Step 0 - #dict set projectParametersDict restart_options $restartDict - - return $projectParametersDict -} - -proc Solid::write::DofsInElements { } { - set dofs [list ] - set root [customlib::GetBaseRoot] - set xp1 "[spdAux::getRoute SLParts]/group/value\[@n='Element'\]" - set elements [$root selectNodes $xp1] - foreach element_node $elements { - set elemid [$element_node @v] - set elem [Model::getElement $elemid] - foreach dof [split [$elem getAttribute "Dofs"] ","] { - if {$dof ni $dofs} {lappend dofs $dof} - } - } - return {*}$dofs -} - -proc Solid::write::writeParametersEvent { } { - write::WriteJSON [getParametersDict] - write::SetParallelismConfiguration -} diff --git a/kratos.gid/apps/Solid/xml/BoundaryConditions.spd b/kratos.gid/apps/Solid/xml/BoundaryConditions.spd deleted file mode 100644 index fc68d449e..000000000 --- a/kratos.gid/apps/Solid/xml/BoundaryConditions.spd +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/kratos.gid/apps/Solid/xml/Conditions.xml b/kratos.gid/apps/Solid/xml/Conditions.xml deleted file mode 100644 index 43c9a5463..000000000 --- a/kratos.gid/apps/Solid/xml/Conditions.xml +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/ConstitutiveLaws.xml b/kratos.gid/apps/Solid/xml/ConstitutiveLaws.xml deleted file mode 100644 index ea6ea7cc6..000000000 --- a/kratos.gid/apps/Solid/xml/ConstitutiveLaws.xml +++ /dev/null @@ -1,694 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/DeprecatedProcesses.xml b/kratos.gid/apps/Solid/xml/DeprecatedProcesses.xml deleted file mode 100644 index 5de58ec3f..000000000 --- a/kratos.gid/apps/Solid/xml/DeprecatedProcesses.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/Elements.xml b/kratos.gid/apps/Solid/xml/Elements.xml deleted file mode 100644 index 21a6ec0f1..000000000 --- a/kratos.gid/apps/Solid/xml/Elements.xml +++ /dev/null @@ -1,958 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/Fields.spd b/kratos.gid/apps/Solid/xml/Fields.spd deleted file mode 100644 index 4d781b83e..000000000 --- a/kratos.gid/apps/Solid/xml/Fields.spd +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/Functions.spd b/kratos.gid/apps/Solid/xml/Functions.spd deleted file mode 100644 index e2a9567a6..000000000 --- a/kratos.gid/apps/Solid/xml/Functions.spd +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/kratos.gid/apps/Solid/xml/Loads.spd b/kratos.gid/apps/Solid/xml/Loads.spd deleted file mode 100644 index f9fc3166e..000000000 --- a/kratos.gid/apps/Solid/xml/Loads.spd +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/kratos.gid/apps/Solid/xml/Main.spd b/kratos.gid/apps/Solid/xml/Main.spd deleted file mode 100644 index 14b4000ec..000000000 --- a/kratos.gid/apps/Solid/xml/Main.spd +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/Materials.spd b/kratos.gid/apps/Solid/xml/Materials.spd deleted file mode 100644 index 51f040cd2..000000000 --- a/kratos.gid/apps/Solid/xml/Materials.spd +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/kratos.gid/apps/Solid/xml/Materials.xml b/kratos.gid/apps/Solid/xml/Materials.xml deleted file mode 100644 index 5c769b544..000000000 --- a/kratos.gid/apps/Solid/xml/Materials.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/NodalConditions.xml b/kratos.gid/apps/Solid/xml/NodalConditions.xml deleted file mode 100644 index 1a409ff4e..000000000 --- a/kratos.gid/apps/Solid/xml/NodalConditions.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/Parts.spd b/kratos.gid/apps/Solid/xml/Parts.spd deleted file mode 100644 index 2ba7cf0f1..000000000 --- a/kratos.gid/apps/Solid/xml/Parts.spd +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/Processes.xml b/kratos.gid/apps/Solid/xml/Processes.xml deleted file mode 100644 index 386f279ef..000000000 --- a/kratos.gid/apps/Solid/xml/Processes.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/Procs.spd b/kratos.gid/apps/Solid/xml/Procs.spd deleted file mode 100644 index 172497ac8..000000000 --- a/kratos.gid/apps/Solid/xml/Procs.spd +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/kratos.gid/apps/Solid/xml/Results.spd b/kratos.gid/apps/Solid/xml/Results.spd deleted file mode 100644 index 9e10fab2a..000000000 --- a/kratos.gid/apps/Solid/xml/Results.spd +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/SolutionStrategy.spd b/kratos.gid/apps/Solid/xml/SolutionStrategy.spd deleted file mode 100644 index 63761ecdb..000000000 --- a/kratos.gid/apps/Solid/xml/SolutionStrategy.spd +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/StageInfo.spd b/kratos.gid/apps/Solid/xml/StageInfo.spd deleted file mode 100644 index cbb7c6d35..000000000 --- a/kratos.gid/apps/Solid/xml/StageInfo.spd +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/Strategies.xml b/kratos.gid/apps/Solid/xml/Strategies.xml deleted file mode 100644 index 23b66efb9..000000000 --- a/kratos.gid/apps/Solid/xml/Strategies.xml +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kratos.gid/apps/Solid/xml/XmlController.tcl b/kratos.gid/apps/Solid/xml/XmlController.tcl deleted file mode 100644 index b4c76bdc7..000000000 --- a/kratos.gid/apps/Solid/xml/XmlController.tcl +++ /dev/null @@ -1,152 +0,0 @@ -namespace eval Solid::xml { - variable dir -} - -proc Solid::xml::Init { } { - variable dir - Model::InitVariables dir $Solid::dir - - Model::getSolutionStrategies Strategies.xml - Model::getElements Elements.xml - Model::getMaterials Materials.xml - Model::getNodalConditions NodalConditions.xml - Model::getConstitutiveLaws ConstitutiveLaws.xml - Model::getProcesses DeprecatedProcesses.xml - Model::getProcesses Processes.xml - Model::getConditions Conditions.xml - Model::getSolvers "../../Common/xml/Solvers.xml" - - # Model::ForgetElement SmallDisplacementBbarElement2D - # Model::ForgetElement SmallDisplacementBbarElement3D - - # This solver is not working in kratos June 01 2018 - Model::ForgetSolver GMRESSolver -} - -proc Solid::xml::getUniqueName {name} { - return SL$name -} - -proc Solid::xml::CustomTree { args } { - - set root [customlib::GetBaseRoot] - - #set icon data as default - foreach node [$root getElementsByTagName value ] { $node setAttribute icon data } - - #intervals - spdAux::SetValueOnTreeItem icon timeIntervals Intervals - foreach node [$root selectNodes "[spdAux::getRoute Intervals]/blockdata"] { - $node setAttribute icon select - } - - #conditions - foreach node [$root selectNodes "[spdAux::getRoute SLNodalConditions]/condition" ] { - $node setAttribute icon select - $node setAttribute groups_icon groupCreated - } - - #loads - foreach node [$root selectNodes "[spdAux::getRoute SLLoads]/condition" ] { - $node setAttribute icon select - $node setAttribute groups_icon groupCreated - } - - #materials - foreach node [$root selectNodes "[spdAux::getRoute SLMaterials]/blockdata" ] { - $node setAttribute icon select - } - - #solver settings - foreach node [$root selectNodes "[spdAux::getRoute SLStratSection]/container\[@n = 'linear_solver_settings'\]" ] { - $node setAttribute icon solvers - } - - #linear solver parameters - spdAux::SetValueOnTreeItem v 2000 SLImplicitlinear_solver_settings max_iteration - spdAux::SetValueOnTreeItem v 1e-6 SLImplicitlinear_solver_settings tolerance - spdAux::SetValueOnTreeItem v cg SLImplicitlinear_solver_settings krylov_type - - #results - foreach result [list SPRING_2D BALLAST_2D AXIAL_TURN_2D AXIAL_VELOCITY_TURN_2D AXIAL_ACCELERATION_TURN_2D SPRING_3D BALLAST_3D AXIAL_TURN_3D AXIAL_VELOCITY_TURN_3D AXIAL_ACCELERATION_TURN_3D] { - set result_node [$root selectNodes "[spdAux::getRoute NodalResults]/value\[@n = '$result'\]"] - if { $result_node ne "" } {$result_node delete} - } - - #units - [$root selectNodes "/Kratos_data/blockdata\[@n = 'units'\]"] setAttribute icon setUnits - - # Initial state for Strategy Parameters - # set solutionType [get_domnode_attribute [$root selectNodes [spdAux::getRoute SLSoluType]] v] - # if {$solutionType ne "Dynamic"} { - # [$root selectNodes [spdAux::getRoute SLStratParams]] setAttribute state hidden - # } -} - - -proc Solid::xml::ProcGetSolutionStrategiesSolid { domNode args } { - set names [list ] - set pnames [list ] - set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute SLSoluType]] v] - set Sols [::Model::GetSolutionStrategies [list "SolutionType" $solutionType] ] - set ids [list ] - foreach ss $Sols { - lappend names [$ss getName] - lappend pnames [$ss getName] - lappend pnames [$ss getPublicName] - } - $domNode setAttribute values [join $names ","] - set dv [lindex $names 0] - if {[$domNode getAttribute v] eq ""} {$domNode setAttribute v $dv; spdAux::RequestRefresh} - if {[$domNode getAttribute v] ni $names} {$domNode setAttribute v $dv; spdAux::RequestRefresh} - - return [join $pnames ","] -} - -proc Solid::xml::ProcCheckNodalConditionStateSolid {domNode args} { - # Overwritten the base function to add Solution Type restrictions - set parts_un SLParts - if {[spdAux::getRoute $parts_un] ne ""} { - set conditionId [$domNode @n] - set elems [$domNode selectNodes "[spdAux::getRoute $parts_un]/group/value\[@n='Element'\]"] - set elemnames [list ] - foreach elem $elems { lappend elemnames [$elem @v]} - set elemnames [lsort -unique $elemnames] - - set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute SLSoluType]] v] - set params [list analysis_type $solutionType] - if {[::Model::CheckElementsNodalCondition $conditionId $elemnames $params]} {return "normal"} else {return "hidden"} - } {return "normal"} -} - -proc Solid::xml::ProcCheckGeometrySolid {domNode args} { - set ret "surface" - if {$::Model::SpatialDimension eq "3D"} { - set ret "line,surface,volume" - } elseif {$::Model::SpatialDimension eq "2D"} { - set ret "line,surface" - } elseif {$::Model::SpatialDimension eq "1D"} { - set ret "line" - } - return $ret -} - -proc Solid::xml::ProcCheckStratParamsState {domNode args} { - set ret "normal" - - set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute SLSoluType]] v] - set analysisType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute SLAnalysisType]] v] - - if {$solutionType ne "Dynamic"} { - # If Static or Quasi-static - if {$analysisType eq "Linear"} { - # If linear -> hide - set ret "hidden" - } - } - - return $ret -} - - -Solid::xml::Init diff --git a/kratos.gid/apps/StenosisWizard/app.json b/kratos.gid/apps/StenosisWizard/app.json new file mode 100644 index 000000000..fbf50f9cf --- /dev/null +++ b/kratos.gid/apps/StenosisWizard/app.json @@ -0,0 +1,28 @@ +{ + "id": "StenosisWizard", + "name": "Stenosis", + "prefix": "FL", + "themed": false, + "kratos_name": "FluidDynamicsApplication", + "dimensions": [ + "3D" + ], + "script_files": [ + "start.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "wizard/wizard_steps.tcl" + ], + "start_script":"::StenosisWizard::Init", + "requeriments":{ + "apps":["Fluid"], + "minimum_gid_version":"15.1.3d" + }, + "permissions": { + "open_tree": false, + "show_toolbar": true, + "intervals": true, + "wizard": true + }, + "main_launch_file": "../../exec/MainKratos.py" +} diff --git a/kratos.gid/apps/StenosisWizard/start.tcl b/kratos.gid/apps/StenosisWizard/start.tcl index 2ef261cd2..7542c013a 100644 --- a/kratos.gid/apps/StenosisWizard/start.tcl +++ b/kratos.gid/apps/StenosisWizard/start.tcl @@ -1,72 +1,47 @@ namespace eval ::StenosisWizard { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir - variable kratos_name - variable attributes + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::StenosisWizard::Init { } { +proc ::StenosisWizard::Init { app } { # Variable initialization variable dir - variable kratos_name - variable attributes + variable _app $app + + set must_open_wizard_window 1 # Init Working directory set dir [apps::getMyDir "StenosisWizard"] - # We'll work on 3D space - spdAux::SetSpatialDimmension "3D" - # Load Fluid App - apps::LoadAppById "Fluid" - + spdAux::processIncludes - set kratos_name $::Fluid::kratos_name - # Don't open the tree - set ::spdAux::TreeVisibility 0 - - dict set attributes UseIntervals 1 - - # Enable the Wizard Module - Kratos::LoadWizardFiles - LoadMyFiles -} - -proc ::StenosisWizard::LoadMyFiles { } { - variable dir - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] smart_wizard::LoadWizardDoc [file join $dir wizard Wizard_default.wiz] - uplevel #0 [list source [file join $dir wizard Wizard_Steps.tcl]] smart_wizard::ImportWizardData + + StenosisWizard::xml::Init + StenosisWizard::write::Init # Init the Wizard Window after 600 [::StenosisWizard::StartWizardWindow] } - proc ::StenosisWizard::StartWizardWindow { } { variable dir gid_groups_conds::close_all_windows smart_wizard::Init - uplevel #0 [list source [file join $dir wizard Wizard_Steps.tcl]] smart_wizard::SetWizardNamespace "::StenosisWizard::Wizard" smart_wizard::SetWizardWindowName ".gid.activewizard" smart_wizard::SetWizardImageDirectory [file join $dir images] smart_wizard::LoadWizardDoc [file join $dir wizard Wizard_default.wiz] smart_wizard::ImportWizardData - - smart_wizard::CreateWindow + smart_wizard::CreateWindow } -proc ::StenosisWizard::CustomToolbarItems { } { - return "-1" -} -proc ::StenosisWizard::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value -} - -::StenosisWizard::Init diff --git a/kratos.gid/apps/StenosisWizard/wizard/Wizard_Steps.tcl b/kratos.gid/apps/StenosisWizard/wizard/Wizard_Steps.tcl index bc9f93728..37b9e99fc 100644 --- a/kratos.gid/apps/StenosisWizard/wizard/Wizard_Steps.tcl +++ b/kratos.gid/apps/StenosisWizard/wizard/Wizard_Steps.tcl @@ -1,13 +1,21 @@ -namespace eval StenosisWizard::Wizard { +namespace eval ::StenosisWizard::Wizard { + namespace path ::StenosisWizard + Kratos::AddNamespace [namespace current] + # Namespace variables declaration variable curr_win + variable ogl_cuts } proc StenosisWizard::Wizard::Init { } { #W "Carga los pasos" variable curr_win set curr_win "" + variable draw_cuts_name + set draw_cuts_name StenosisWizard_cuts + variable draw_render_name + set draw_render_name StenosisWizard_render } proc StenosisWizard::Wizard::Geometry { win } { @@ -24,7 +32,7 @@ proc StenosisWizard::Wizard::GeometryTypeChange { } { if {[GiDVersionCmp 14.1.3d] >= 0} { switch $type { "Circular" { - smart_wizard::SetProperty Geometry Length,value 100 + smart_wizard::SetProperty Geometry Length,value 200 smart_wizard::SetProperty Geometry Delta,value 3.18 smart_wizard::SetProperty Geometry Precision,state normal smart_wizard::SetProperty Geometry SphRadius,state hidden @@ -107,6 +115,7 @@ proc StenosisWizard::Wizard::DrawGeometry {} { proc StenosisWizard::Wizard::DrawTriangular {length radius start end delta } { GidUtils::DisableGraphics + set origin_x [expr double($length)/-2] set end_x [expr double($length)/2] @@ -148,9 +157,7 @@ proc StenosisWizard::Wizard::DrawSpherical {length radius start end delta sphrad set origin_x [expr double($length)/-2] set end_x [expr double($length)/2] - # set m2 [expr double($end) / double ($delta)] - # set m1 [expr double($delta) / double($end) *-1.0] - # vGarate set ycenter [expr double($delta)/2-$m2*double($end)/2] + set hdelta [expr double($delta) - double($radius)] set ycenter [expr double ($hdelta) - double($sphradius)] @@ -193,7 +200,7 @@ proc StenosisWizard::Wizard::DrawPolygonal {length radius start end delta tpoly GidUtils::DisableGraphics set origin_x [expr double($length)/-2] set end_x [expr double($length)/2] - + set halfpoly [expr double($tpoly)/2] set hdelta [expr $delta - $radius] @@ -250,10 +257,12 @@ proc StenosisWizard::Wizard::DrawCircular {length radius start end delta precisi set zona [expr $end - $start] set delta_z [expr double($zona) / double($precision)] - + set origin_x [expr double($length)/-2] + set end_x [expr double($length)/2] + # Initial point - lappend points [list -$length $radius 0] - GiD_Geometry create point 1 $layer -$length $radius 0 + lappend points [list $origin_x $radius 0] + GiD_Geometry create point 1 $layer $origin_x $radius 0 # first cut lappend points [list $start $radius 0] @@ -269,8 +278,8 @@ proc StenosisWizard::Wizard::DrawCircular {length radius start end delta precisi # last cut lappend points [list $end $radius 0] # Final point - GiD_Geometry create point 2 $layer $length $radius 0 - lappend points [list $length $radius 0] + GiD_Geometry create point 2 $layer $end_x $radius 0 + lappend points [list $end_x $radius 0] set line [GiD_Geometry create line append nurbsline $layer 1 2 -interpolate [llength $points] {*}$points -tangents {1 0 0} {1 0 0}] @@ -378,10 +387,12 @@ proc StenosisWizard::Wizard::NextFluid { } { proc StenosisWizard::Wizard::Simulation { win } { smart_wizard::AutoStep $win Simulation - smart_wizard::SetWindowSize 450 500 + smart_wizard::SetWindowSize 450 600 } proc StenosisWizard::Wizard::Mesh { } { + LastStep + StenosisWizard::Wizard::UnregisterDrawCuts if {[lindex [GiD_Info Mesh] 0]>0} { #GiD_Process Mescape Meshing reset Yes GiD_Process Mescape Meshing CancelMesh PreserveFrozen Yes @@ -394,6 +405,7 @@ proc StenosisWizard::Wizard::Mesh { } { MeshGenerationOKDo $mesh } proc StenosisWizard::Wizard::Save { } { + LastStep GiD_Process Mescape Files Save } @@ -422,44 +434,241 @@ proc StenosisWizard::Wizard::LastStep { } { gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='TimeParameters']/value[@n='EndTime']} "v $end" gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='TimeParameters']/value[@n='DeltaTime']} "v $delta" + + PlaceCutPlanes + + #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='velocity_linear_solver_settings']/value[@n='Solver']} {v Conjugate_gradient} + #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='pressure_linear_solver_settings']/value[@n='Solver']} {v Conjugate_gradient} + spdAux::RequestRefresh + +} + +proc StenosisWizard::Wizard::PlaceCutPlanes { } { set ncuts [smart_wizard::GetProperty Simulation Cuts,value] set length [smart_wizard::GetProperty Geometry Length,value] - set delta [expr 2.0*double($length)/(double($ncuts)+1.0)] - #W "$length $delta" + set delta [expr double($length)/(double($ncuts)+1.0)] + set orig_x [ expr $length*-0.5] + + set angle [smart_wizard::GetProperty Simulation Bending,value] # Cut planes - #gid_groups_conds::copyNode {container[@n='Fluid']/container[@n='Results']/container[@n='CutPlanes']/blockdata[@n='CutPlane'][1]} {container[@n='Fluid']/container[@n='Results']/container[@n='CutPlanes']} - - #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='Results']/container[@n='CutPlanes']/blockdata[@n='CutPlane'][2]} {name Main} - #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='Results']/container[@n='CutPlanes']/blockdata[@n='CutPlane'][2]/value[@n='normal']} {v 0.0,1.0,0.0} - spdAux::ClearCutPlanes - set cutplane_xp "[spdAux::getRoute CutPlanes]/blockdata\[1\]" - - for {set i 1} {$i <= $ncuts} {incr i} { - set x [expr -$length + ($i * $delta)] - set x [expr double(round(100*$x))/100] + set cuts_enabled 1 + if {$cuts_enabled} { + spdAux::ClearCutPlanes + set cutplane_xp "[spdAux::getRoute CutPlanes]/blockdata\[1\]" + + for {set i 1} {$i <= $ncuts} {incr i} { + set x [expr $orig_x + ($i * $delta)] + set x [expr double(round(100*$x))/100] + gid_groups_conds::copyNode $cutplane_xp [spdAux::getRoute CutPlanes] + set cutplane "[spdAux::getRoute CutPlanes]/blockdata\[@n='CutPlane'\]\[[expr $i +1]\]" + gid_groups_conds::setAttributesF $cutplane "name CutPlane$i" + + set coords [list [objarray new doublearray -values [list $x $x $x]] [objarray new doublearray -values {0.0 1.0 0.0}] [objarray new doublearray -values {0.0 0.0 1.0}]] + set new_nodes [StenosisWizard::Wizard::BendNodes $orig_x $length [expr $angle/2] $coords] + set o [list [objarray get [lindex $new_nodes 0] 0] [objarray get [lindex $new_nodes 1] 0] [objarray get [lindex $new_nodes 2] 0] ] + set p1 [list [objarray get [lindex $new_nodes 0] 1] [objarray get [lindex $new_nodes 1] 1] [objarray get [lindex $new_nodes 2] 1] ] + set p2 [list [objarray get [lindex $new_nodes 0] 2] [objarray get [lindex $new_nodes 1] 2] [objarray get [lindex $new_nodes 2] 2] ] + set v1 [math::linearalgebra::sub $p1 $o] + set v2 [math::linearalgebra::sub $p2 $o] + set v_norm [::math::linearalgebra::crossproduct $v1 $v2] + gid_groups_conds::setAttributesF "$cutplane/value\[@n='normal'\]" "v [join $v_norm {,}]" + gid_groups_conds::setAttributesF "$cutplane/value\[@n='point'\]" "v [join $o {,}]" + } + + set x 0.0 + set coords [list [objarray new doublearray -values [list $x [expr $x +1] $x]] [objarray new doublearray -values {0.0 0.0 0.0}] [objarray new doublearray -values {0.0 0.0 1.0}]] + set new_nodes [StenosisWizard::Wizard::BendNodes $orig_x $length [expr $angle/2] $coords] + set o [list [objarray get [lindex $new_nodes 0] 0] [objarray get [lindex $new_nodes 1] 0] [objarray get [lindex $new_nodes 2] 0] ] + + set p1 [list [objarray get [lindex $new_nodes 0] 1] [objarray get [lindex $new_nodes 1] 1] [objarray get [lindex $new_nodes 2] 1] ] + set p2 [list [objarray get [lindex $new_nodes 0] 2] [objarray get [lindex $new_nodes 1] 2] [objarray get [lindex $new_nodes 2] 2] ] + set v1 [math::linearalgebra::sub $p1 $o] + set v2 [math::linearalgebra::sub $p2 $o] + set v_norm [::math::linearalgebra::crossproduct $v1 $v2] gid_groups_conds::copyNode $cutplane_xp [spdAux::getRoute CutPlanes] - set cutplane "[spdAux::getRoute CutPlanes]/blockdata\[@n='CutPlane'\]\[[expr $i +1]\]" - gid_groups_conds::setAttributesF $cutplane "name CutPlane$i" - gid_groups_conds::setAttributesF "$cutplane/value\[@n='normal'\]" "v 1.0,0.0,0.0" - gid_groups_conds::setAttributesF "$cutplane/value\[@n='point'\]" "v $x,0.0,0.0" + set cutplane "[spdAux::getRoute CutPlanes]/blockdata\[@n='CutPlane'\]\[[expr $ncuts +2]\]" + gid_groups_conds::setAttributesF $cutplane "name CutPlane[expr $ncuts +1]" + gid_groups_conds::setAttributesF "$cutplane/value\[@n='normal'\]" "v [join $v_norm {,}]" + gid_groups_conds::setAttributesF "$cutplane/value\[@n='point'\]" "v [join $o {,}]" } - gid_groups_conds::copyNode $cutplane_xp [spdAux::getRoute CutPlanes] - set cutplane "[spdAux::getRoute CutPlanes]/blockdata\[@n='CutPlane'\]\[[expr $ncuts +2]\]" - gid_groups_conds::setAttributesF $cutplane "name CutPlane[expr $ncuts +1]" - gid_groups_conds::setAttributesF "$cutplane/value\[@n='normal'\]" "v 0.0,1.0,0.0" - - #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='velocity_linear_solver_settings']/value[@n='Solver']} {v Conjugate_gradient} - #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='pressure_linear_solver_settings']/value[@n='Solver']} {v Conjugate_gradient} - spdAux::RequestRefresh - } proc StenosisWizard::AfterMeshGeneration { fail } { + GidUtils::CloseWindow MESHPROGRESS GiD_Process Mescape Mescape Mescape GiD_Process Mescape Files Save + StenosisWizard::Wizard::PostMeshBend + GiD_Process Mescape Files Save +} + + +proc StenosisWizard::Wizard::PostMeshBend { } { + + set length [ smart_wizard::GetProperty Geometry Length,value] + set orig_x [ expr $length*-0.5] + set angle [ smart_wizard::GetProperty Simulation Bending,value] + set angle [expr $angle/2] + GidUtils::DisableGraphics + StenosisWizard::Wizard::Bend $orig_x $length $angle + GidUtils::EnableGraphics + GiD_Process Mescape Meshing MeshView escape + GiD_Process 'Redraw +} + +proc StenosisWizard::Wizard::Bend { orig_x len angle} { + + lassign [GiD_Info Mesh nodes -array] ids coords + set moved_nodes [StenosisWizard::Wizard::BendNodes $orig_x $len $angle $coords] + lassign $moved_nodes coord_x coord_y coord_z + set size [objarray length $coord_x] + for {set i 0} {$i < $size} {incr i} { + set res_x [objarray get $coord_x $i] + set res_y [objarray get $coord_y $i] + set res_z [objarray get $coord_z $i] + GiD_Mesh edit node [objarray get $ids $i] [list $res_x $res_y $res_z] + } +} + +proc StenosisWizard::Wizard::BendNodes {orig_x len angle coords} { + lassign $coords coord_x coord_y coord_z + set size [objarray length $coord_x] + set result_x [objarray new doublearray $size 0.0] + set result_y [objarray new doublearray $size 0.0] + set result_z [objarray new doublearray $size 0.0] + + for {set i 0} {$i < $size} {incr i} { + # primera parte + set old_val_x [objarray get $coord_x $i] + set old_val_y [objarray get $coord_y $i] + set old_val_z [objarray get $coord_z $i] + set dist_x [expr $old_val_x - $orig_x] + set ang [expr $angle*$dist_x/$len] + set ang [expr {double(round(10000*$ang))/10000}] + set res_x [expr $old_val_x + sin($ang) * $old_val_y] + set res_y [expr cos($ang) *$old_val_y] + set res_z $old_val_z + + # segunda parte + set ang2 [expr $angle*($old_val_x - $orig_x)/$len] + set res_x_tmp $res_x + set x_rel [expr $res_x_tmp - $orig_x] + + # Store the nodes final position + objarray set $result_x $i [expr $orig_x + cos($ang2)*($x_rel) + sin($ang2)*$res_y] + objarray set $result_y $i [expr -sin($ang2)*($x_rel) + cos($ang2)*$res_y] + objarray set $result_z $i $old_val_z + } + return [list $result_x $result_y $result_z] +} + +proc StenosisWizard::Wizard::UnregisterDrawCuts { } { + variable draw_cuts_name + Drawer::Unregister $draw_cuts_name + GiD_Process 'Redraw + smart_wizard::SetProperty Simulation ViewCuts,name "Draw cuts" +} + +proc StenosisWizard::Wizard::DrawCuts { } { + variable draw_cuts_name + variable curr_win + if {[Drawer::IsRegistered $draw_cuts_name]} { + StenosisWizard::Wizard::UnregisterDrawCuts + } else { + set planes [write::GetCutPlanesList] + set glob_cuts [list ] + foreach plane $planes { + set center [dict get $plane point] + set normal [dict get $plane normal] + lassign [MathUtils::CalculateLocalAxisFromXAxis $normal] v1 v2 + + # set v1 [list [expr -1.0*[lindex $normal 0]] [lindex $normal 1] [lindex $normal 2]] + # set v2 [list [lindex $normal 0] [lindex $normal 1] 1] + set c1 [MathUtils::VectorSum $center [MathUtils::ScalarByVectorProd 30 $v1]] + set c2 [MathUtils::VectorSum $center [MathUtils::ScalarByVectorProd 30 $v2]] + set c3 [MathUtils::VectorSum $center [MathUtils::ScalarByVectorProd -30 $v1]] + set c4 [MathUtils::VectorSum $center [MathUtils::ScalarByVectorProd -30 $v2]] + + lappend glob_cuts [list $c1 $c2 $c3 $c4] + } + Drawer::Register $draw_cuts_name StenosisWizard::Wizard::RedrawCuts $glob_cuts + smart_wizard::SetProperty Simulation ViewCuts,name "End draw cuts" + } + GiD_Process 'Redraw + StenosisWizard::Wizard::Simulation $curr_win +} + +proc StenosisWizard::Wizard::RedrawCuts { } { + variable draw_cuts_name + # blue + GiD_OpenGL draw -color "0.0 0.0 1.0" + foreach cuadrado [Drawer::GetVars $draw_cuts_name] { + lassign $cuadrado c1 c2 c3 c4 + GiD_OpenGL draw -begin lineloop + GiD_OpenGL draw -vertex $c1 + GiD_OpenGL draw -vertex $c2 + GiD_OpenGL draw -vertex $c3 + GiD_OpenGL draw -vertex $c4 + GiD_OpenGL draw -end + } +} + +proc StenosisWizard::Wizard::PreviewCurvature {} { + variable draw_render_name + variable curr_win + if {[Drawer::IsRegistered $draw_render_name]} { + StenosisWizard::Wizard::UnregisterDrawPrecurvature + } else { + set surfaces [GiD_Geometry -v2 list surface] + + set x [list ] + set y [list ] + set z [list ] + + foreach surface_id $surfaces { + lassign [GiD_Geometry get surface $surface_id -force render_mesh] elemtype elementnnodes nodes elements normals uvs + foreach {cx cy cz} $nodes { + lappend x $cx + lappend y $cy + lappend z $cz + } + } + set coords [list [objarray new doublearray -values $x] [objarray new doublearray -values $y] [objarray new doublearray -values $z]] + + set length [ smart_wizard::GetProperty Geometry Length,value] + set orig_x [ expr $length*-0.5] + set angle [ smart_wizard::GetProperty Simulation Bending,value] + set angle [expr $angle/2] + set nodes [StenosisWizard::Wizard::BendNodes $orig_x $length $angle $coords] + + Drawer::Register $draw_render_name StenosisWizard::Wizard::RedrawRenderBended $nodes + + smart_wizard::SetProperty Simulation PreviewCurvature,name "End preview curvature" + } + GiD_Process 'Redraw + StenosisWizard::Wizard::Simulation $curr_win +} + + +proc StenosisWizard::Wizard::UnregisterDrawPrecurvature { } { + variable draw_render_name + Drawer::Unregister $draw_render_name + GiD_Process 'Redraw + smart_wizard::SetProperty Simulation PreviewCurvature,name "Preview curvature" +} + +proc StenosisWizard::Wizard::RedrawRenderBended { } { + variable draw_render_name + # blue + GiD_OpenGL draw -color "0.0 0.0 1.0" -pointsize 3 + lassign [Drawer::GetVars $draw_render_name] x y z + GiD_OpenGL draw -begin points + foreach cx $x cy $y cz $z { + GiD_OpenGL draw -vertex [list $cx $cy $cz] + } + GiD_OpenGL draw -end } StenosisWizard::Wizard::Init diff --git a/kratos.gid/apps/StenosisWizard/wizard/Wizard_default.wiz b/kratos.gid/apps/StenosisWizard/wizard/Wizard_default.wiz index b150d66b5..06344317c 100644 --- a/kratos.gid/apps/StenosisWizard/wizard/Wizard_default.wiz +++ b/kratos.gid/apps/StenosisWizard/wizard/Wizard_default.wiz @@ -8,13 +8,13 @@ - + - + @@ -49,15 +49,19 @@ + + + + - + diff --git a/kratos.gid/apps/StenosisWizard/write/write.tcl b/kratos.gid/apps/StenosisWizard/write/write.tcl index 52b18f534..efdbac8f2 100644 --- a/kratos.gid/apps/StenosisWizard/write/write.tcl +++ b/kratos.gid/apps/StenosisWizard/write/write.tcl @@ -1,4 +1,6 @@ -namespace eval StenosisWizard::write { +namespace eval ::StenosisWizard::write { + namespace path ::StenosisWizard + Kratos::AddNamespace [namespace current] } @@ -8,13 +10,11 @@ proc StenosisWizard::write::Init { } { proc StenosisWizard::write::writeCustomFilesEvent { } { - Fluid::write::WriteMaterialsFile - write::CopyFileIntoModel "../Fluid/python/KratosFluid.py" - write::RenameFileInModel "KratosFluid.py" "MainKratos.py" + ::Fluid::write::writeCustomFilesEvent + ::Fluid::write::SetAttribute main_launch_file [StenosisWizard::GetAttribute main_launch_file] } # MDPA Blocks - proc StenosisWizard::write::writeModelPartEvent { } { Fluid::write::AddValidApps StenosisWizard write::writeAppMDPA Fluid @@ -25,5 +25,3 @@ proc StenosisWizard::write::writeParametersEvent { } { set project_parameters_dict [::Fluid::write::getParametersDict] write::WriteJSON $project_parameters_dict } - -StenosisWizard::write::Init diff --git a/kratos.gid/apps/StenosisWizard/xml/Procs.spd b/kratos.gid/apps/StenosisWizard/xml/Procs.spd index 53779c99b..bb0205fb1 100644 --- a/kratos.gid/apps/StenosisWizard/xml/Procs.spd +++ b/kratos.gid/apps/StenosisWizard/xml/Procs.spd @@ -35,4 +35,9 @@ return $r ]]> + + + \ No newline at end of file diff --git a/kratos.gid/apps/StenosisWizard/xml/XmlController.tcl b/kratos.gid/apps/StenosisWizard/xml/XmlController.tcl index 581014677..9d047bed3 100644 --- a/kratos.gid/apps/StenosisWizard/xml/XmlController.tcl +++ b/kratos.gid/apps/StenosisWizard/xml/XmlController.tcl @@ -1,12 +1,12 @@ -namespace eval StenosisWizard::xml { - variable dir +namespace eval ::StenosisWizard::xml { + namespace path ::StenosisWizard + Kratos::AddNamespace [namespace current] } proc StenosisWizard::xml::Init { } { - variable dir - Model::InitVariables dir $StenosisWizard::dir + Model::InitVariables dir $::StenosisWizard::dir - spdAux::processIncludes + spdAux::processIncludes } proc StenosisWizard::xml::CustomTree {args} { @@ -16,14 +16,12 @@ proc StenosisWizard::xml::CustomTree {args} { } proc StenosisWizard::xml::getUniqueName {name} { - return StenWiz$name + return [::StenosisWizard::GetAttribute prefix]$name } proc ::StenosisWizard::xml::MultiAppEvent {args} { - if {$args eq "init"} { - spdAux::parseRoutes - spdAux::ConvertAllUniqueNames FL StenWiz - } + if {$args eq "init"} { + spdAux::parseRoutes + spdAux::ConvertAllUniqueNames FL StenWiz + } } - -StenosisWizard::xml::Init diff --git a/kratos.gid/apps/Stent/app.json b/kratos.gid/apps/Stent/app.json new file mode 100644 index 000000000..f2d076ebb --- /dev/null +++ b/kratos.gid/apps/Stent/app.json @@ -0,0 +1,30 @@ +{ + "id": "Stent", + "name": "Stent", + "prefix": "ST", + "themed": false, + "kratos_name": "StructuralMechanicsApplication", + "dimensions": [ + "3D" + ], + "script_files": [ + "start.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "wizard/StentGeometry.tcl" + ], + "start_script": "::Stent::Init", + "requeriments": { + "apps": [ + "Structural" + ], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": true + }, + "main_launch_file": "../../exec/MainKratos.py" +} \ No newline at end of file diff --git a/kratos.gid/apps/Stent/python/KratosStructural.py b/kratos.gid/apps/Stent/python/KratosStructural.py deleted file mode 100644 index ef6a15636..000000000 --- a/kratos.gid/apps/Stent/python/KratosStructural.py +++ /dev/null @@ -1,18 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -from KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis import StructuralMechanicsAnalysis - -""" -For user-scripting it is intended that a new class is derived -from StructuralMechanicsAnalysis to do modifications -""" - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = StructuralMechanicsAnalysis(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/Stent/start.tcl b/kratos.gid/apps/Stent/start.tcl index 4f318790c..4f9b994bf 100644 --- a/kratos.gid/apps/Stent/start.tcl +++ b/kratos.gid/apps/Stent/start.tcl @@ -1,56 +1,31 @@ namespace eval ::Stent { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir variable app_id + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::Stent::Init { } { +proc ::Stent::Init { app } { # Variable initialization variable dir - variable attributes - variable kratos_name - variable app_id + variable _app - if {[GiDVersionCmp 14.1.3d] < 0} { - W "Minimum GiD version recommended 14.1.3d" - W "Download it at https://www.gidhome.com/download/developer-versions/" - } - - set app_id Stent set dir [apps::getMyDir "Stent"] - - # We'll work on 3D space - spdAux::SetSpatialDimmension "3D" - # Load Fluid App - apps::LoadAppById "Structural" - + set _app $app + spdAux::processIncludes - set attributes [dict create] - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - - # Intervals - dict set attributes UseIntervals 1 - if {$::Kratos::kratos_private(DevMode) eq "dev"} {dict set attributes UseIntervals 1} - - set kratos_name StructuralMechanicsApplication - - # Enable the Wizard Module - Kratos::LoadWizardFiles - LoadMyFiles -} - -proc ::Stent::LoadMyFiles { } { - variable dir - - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - smart_wizard::LoadWizardDoc [file join $dir wizard StentGeometry_default.wiz] - uplevel #0 [list source [file join $dir wizard StentGeometry.tcl]] smart_wizard::ImportWizardData + + Stent::xml::Init + Stent::write::Init + } proc ::Stent::StartWizardWindow { } { @@ -71,13 +46,8 @@ proc ::Stent::CustomToolbarItems { } { variable dir Kratos::ToolbarAddItem "Generator" "example.png" [list -np- ::Stent::StartWizardWindow] [= "Geometry generator"] - - } proc ::Stent::BeforeMeshGeneration { size } { ::Structural::BeforeMeshGeneration $size } - - -::Stent::Init diff --git a/kratos.gid/apps/Stent/wizard/StentGeometry.tcl b/kratos.gid/apps/Stent/wizard/StentGeometry.tcl index c5fca9cf2..0bde434dd 100644 --- a/kratos.gid/apps/Stent/wizard/StentGeometry.tcl +++ b/kratos.gid/apps/Stent/wizard/StentGeometry.tcl @@ -1,4 +1,7 @@ -namespace eval Stent::Wizard { +namespace eval ::Stent::Wizard { + namespace path ::Stent + Kratos::AddNamespace [namespace current] + # Namespace variables declaration variable curr_win diff --git a/kratos.gid/apps/Stent/write/write.tcl b/kratos.gid/apps/Stent/write/write.tcl index f274715f2..7e5a9623a 100644 --- a/kratos.gid/apps/Stent/write/write.tcl +++ b/kratos.gid/apps/Stent/write/write.tcl @@ -1,26 +1,18 @@ -namespace eval Stent::write { -} +namespace eval ::Stent::write { + namespace path ::Stent + Kratos::AddNamespace [namespace current] + } -proc Stent::write::Init { } { - #Structural::write::Init -} +proc Stent::write::Init { } { } # MDPA Blocks -proc Stent::write::writeModelPartEvent { } { - Structural::write::writeModelPartEvent -} +proc Stent::write::writeModelPartEvent { } {Structural::write::writeModelPartEvent} -# Custom files -proc Stent::write::WriteMaterialsFile { } { - Structural::write::WriteMaterialsFile -} +# Materials +proc Stent::write::WriteMaterialsFile { } {Structural::write::WriteMaterialsFile} -proc Stent::write::writeCustomFilesEvent { } { - Structural::write::writeCustomFilesEvent -} -proc Stent::write::writeParametersEvent { } { - Structural::write::writeParametersEvent - -} +# Custom files +proc Stent::write::writeCustomFilesEvent { } {Structural::write::writeCustomFilesEvent} -Stent::write::Init +# Project parameters +proc Stent::write::writeParametersEvent { } {Structural::write::writeParametersEvent} diff --git a/kratos.gid/apps/Stent/xml/XmlController.tcl b/kratos.gid/apps/Stent/xml/XmlController.tcl index 59e354e21..f4c4ff587 100644 --- a/kratos.gid/apps/Stent/xml/XmlController.tcl +++ b/kratos.gid/apps/Stent/xml/XmlController.tcl @@ -1,10 +1,10 @@ -namespace eval Stent::xml { - variable dir +namespace eval ::Stent::xml { + namespace path ::Stent + Kratos::AddNamespace [namespace current] } proc Stent::xml::Init { } { - variable dir - Model::InitVariables dir $Stent::dir + Model::InitVariables dir $::Stent::dir # Import our elements Model::ForgetElements @@ -14,7 +14,7 @@ proc Stent::xml::Init { } { } proc Stent::xml::getUniqueName {name} { - return ST$name + return [::Stent::GetAttribute prefix]$name } @@ -23,7 +23,6 @@ proc Stent::xml::CustomTree { args } { Structural::xml::CustomTree {*}$args } - proc Structural::xml::ProcCheckGeometryStructural {domNode args} { set ret "line" return $ret @@ -33,4 +32,3 @@ proc Stent::xml::UpdateParts {domNode args} { Structural::xml::UpdateParts $domNode {*}$args } -Stent::xml::Init diff --git a/kratos.gid/apps/Structural/app.json b/kratos.gid/apps/Structural/app.json new file mode 100644 index 000000000..257d91b55 --- /dev/null +++ b/kratos.gid/apps/Structural/app.json @@ -0,0 +1,57 @@ +{ + "id": "Structural", + "name": "Structural", + "prefix": "ST", + "themed": false, + "kratos_name": "StructuralMechanicsApplication", + "python_packages": [ + "KratosStructuralMechanicsApplication", + "KratosContactStructuralMechanicsApplication" + ], + "dimensions": [ + "2D", + "2Da", + "3D" + ], + "script_files": [ + "start.tcl", + "examples/examples.tcl", + "examples/TrussCantilever.tcl", + "examples/HighRiseBuilding.tcl", + "examples/IncompressibleCookMembrane.tcl", + "xml/XmlController.tcl", + "write/write.tcl", + "write/writeProjectParameters.tcl", + "postprocess/formfinding.tcl" + ], + "start_script": "::Structural::Init", + "requeriments": { + "apps": [], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": true, + "show_toolbar": true, + "intervals": true, + "wizard": false, + "import_files": true + }, + "unique_names": { + "parts": "STParts", + "initial_conditions": "STInitialConditions", + "nodal_conditions": "STNodalConditions", + "conditions": "STLoads", + "time_parameters": "STTimeParameters", + "results": "STResults", + "materials": "STMaterials" + }, + "write": { + "coordinates": "all", + "materials_file": "StructuralMaterials.json", + "properties_location": "json", + "model_part_name": "Structure", + "output_model_part_name": "" + }, + "main_launch_file": "../../exec/MainKratos.py", + "examples": "examples/examples.xml" +} \ No newline at end of file diff --git a/kratos.gid/apps/Structural/examples/HighRiseBuilding.tcl b/kratos.gid/apps/Structural/examples/HighRiseBuilding.tcl index 57228e416..dbc2f6d6b 100644 --- a/kratos.gid/apps/Structural/examples/HighRiseBuilding.tcl +++ b/kratos.gid/apps/Structural/examples/HighRiseBuilding.tcl @@ -1,5 +1,10 @@ +namespace eval ::Structural::examples::HighRiseBuilding { + namespace path ::Structural::examples + Kratos::AddNamespace [namespace current] -proc ::Structural::examples::HighRiseBuilding {args} { +} + +proc ::Structural::examples::HighRiseBuilding::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] @@ -7,10 +12,10 @@ proc ::Structural::examples::HighRiseBuilding {args} { } Kratos::ResetModel - DrawHighRiseBuildingGeometry$::Model::SpatialDimension - AssignGroupsHighRiseBuilding$::Model::SpatialDimension - AssignHighRiseBuildingMeshSizes$::Model::SpatialDimension - TreeAssignationHighRiseBuilding$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignGroups$::Model::SpatialDimension + AssignMeshSizes$::Model::SpatialDimension + TreeAssignation$::Model::SpatialDimension GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -18,7 +23,7 @@ proc ::Structural::examples::HighRiseBuilding {args} { GiD_Process 'Zoom Frame } -proc Structural::examples::DrawHighRiseBuildingGeometry2D {args} { +proc ::Structural::examples::HighRiseBuilding::DrawGeometry2D {args} { GiD_Layers create Structure GiD_Layers edit to_use Structure @@ -43,7 +48,7 @@ proc Structural::examples::DrawHighRiseBuildingGeometry2D {args} { GiD_Process Mescape Geometry Create NurbsSurface {*}$structureLines escape escape } -proc Structural::examples::AssignGroupsHighRiseBuilding2D {args} { +proc ::Structural::examples::HighRiseBuilding::AssignGroups2D {args} { # Group creation GiD_Groups create Structure GiD_Groups create Ground @@ -54,14 +59,14 @@ proc Structural::examples::AssignGroupsHighRiseBuilding2D {args} { GiD_EntitiesGroups assign InterfaceStructure lines {1 2 3} } -proc Structural::examples::AssignHighRiseBuildingMeshSizes2D {args} { +proc ::Structural::examples::HighRiseBuilding::AssignMeshSizes2D {args} { set structure_mesh_size 5.0 GiD_Process Mescape Meshing ElemType Quadrilateral [GiD_EntitiesGroups get Structure surfaces] escape GiD_Process Mescape Meshing Structured Surfaces Size {*}[GiD_EntitiesGroups get Structure surfaces] escape $structure_mesh_size {*}[GiD_EntitiesGroups get InterfaceStructure lines] escape escape escape escape } -proc Structural::examples::TreeAssignationHighRiseBuilding2D {args} { +proc ::Structural::examples::HighRiseBuilding::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -99,9 +104,8 @@ proc Structural::examples::TreeAssignationHighRiseBuilding2D {args} { spdAux::SetValuesOnBaseNode $LoadNode $props # Structure domain time parameters - set parameters [list EndTime 25.0 DeltaTime 0.05] - set xpath [spdAux::getRoute STTimeParameters] - spdAux::SetValuesOnBasePath $xpath $parameters - + [$root selectNodes "[spdAux::getRoute STTimeParameters]/value\[@n = 'EndTime'\]"] setAttribute v 25.0 + [$root selectNodes "[spdAux::getRoute STTimeParameters]/container\[@n = 'TimeStep'\]/blockdata\[1\]/value\[@n = 'DeltaTime'\]"] setAttribute v 0.05 + spdAux::RequestRefresh } diff --git a/kratos.gid/apps/Structural/examples/incompressible_cook_membrane.tcl b/kratos.gid/apps/Structural/examples/IncompressibleCookMembrane.tcl similarity index 87% rename from kratos.gid/apps/Structural/examples/incompressible_cook_membrane.tcl rename to kratos.gid/apps/Structural/examples/IncompressibleCookMembrane.tcl index 94b996b83..e1da6b08f 100644 --- a/kratos.gid/apps/Structural/examples/incompressible_cook_membrane.tcl +++ b/kratos.gid/apps/Structural/examples/IncompressibleCookMembrane.tcl @@ -1,5 +1,9 @@ +namespace eval ::Structural::examples::IncompressibleCookMembrane { + namespace path ::Structural::examples + Kratos::AddNamespace [namespace current] -proc ::Structural::examples::IncompressibleCookMembrane {args} { +} +proc ::Structural::examples::IncompressibleCookMembrane::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] @@ -7,10 +11,10 @@ proc ::Structural::examples::IncompressibleCookMembrane {args} { } Kratos::ResetModel - DrawIncompressibleCookMembraneGeometry$::Model::SpatialDimension - AssignGroupsIncompressibleCookMembrane$::Model::SpatialDimension - AssignIncompressibleCookMembraneMeshSizes$::Model::SpatialDimension - TreeAssignationIncompressibleCookMembrane$::Model::SpatialDimension + DrawGeometry$::Model::SpatialDimension + AssignGroups$::Model::SpatialDimension + AssignMeshSizes$::Model::SpatialDimension + TreeAssignation$::Model::SpatialDimension GiD_Process 'Redraw GidUtils::UpdateWindow GROUPS @@ -22,7 +26,7 @@ proc ::Structural::examples::IncompressibleCookMembrane {args} { GiD_Process 'Zoom Frame } -proc Structural::examples::DrawIncompressibleCookMembraneGeometry2D {args} { +proc ::Structural::examples::IncompressibleCookMembrane::DrawGeometry2D {args} { GiD_Layers create Structure GiD_Layers edit to_use Structure @@ -47,15 +51,15 @@ proc Structural::examples::DrawIncompressibleCookMembraneGeometry2D {args} { GiD_Process Mescape Geometry Create NurbsSurface {*}$structureLines escape escape } -proc Structural::examples::DrawIncompressibleCookMembraneGeometry3D {args} { +proc ::Structural::examples::IncompressibleCookMembrane::DrawGeometry3D {args} { # Create layers and draw in plane geometry - DrawIncompressibleCookMembraneGeometry2D + DrawGeometry2D # Extrude the xy-plane geometry 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 Mescape } -proc Structural::examples::AssignGroupsIncompressibleCookMembrane2D {args} { +proc ::Structural::examples::IncompressibleCookMembrane::AssignGroups2D {args} { # Group creation GiD_Groups create Structure GiD_Groups create LeftEdge @@ -66,7 +70,7 @@ proc Structural::examples::AssignGroupsIncompressibleCookMembrane2D {args} { GiD_EntitiesGroups assign RightEdge lines 2 } -proc Structural::examples::AssignGroupsIncompressibleCookMembrane3D {args} { +proc ::Structural::examples::IncompressibleCookMembrane::AssignGroups3D {args} { # Group creation GiD_Groups create Structure GiD_Groups create LeftSurface @@ -79,18 +83,18 @@ proc Structural::examples::AssignGroupsIncompressibleCookMembrane3D {args} { GiD_EntitiesGroups assign SideSurfaces surfaces {1 6} } -proc Structural::examples::AssignIncompressibleCookMembraneMeshSizes2D {args} { +proc ::Structural::examples::IncompressibleCookMembrane::AssignMeshSizes2D {args} { set edges_divisions 64 GiD_Process Mescape Meshing Structured Surfaces 1 escape $edges_divisions 1 2 3 4 escape escape escape Mescape Meshing ElemType Quadrilateral 1 escape } -proc Structural::examples::AssignIncompressibleCookMembraneMeshSizes3D {args} { +proc ::Structural::examples::IncompressibleCookMembrane::AssignMeshSizes3D {args} { set side_edges_divisions 64 set thickness_edges_divisions 1 GiD_Process Mescape Meshing ElemType Hexahedra 1 escape Mescape Meshing Structured Volumes 1 escape $side_edges_divisions 1 3 5 7 2 6 escape $thickness_edges_divisions 11 escape escape escape escape escape escape } -proc Structural::examples::TreeAssignationIncompressibleCookMembrane2D {args} { +proc ::Structural::examples::IncompressibleCookMembrane::TreeAssignation2D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -131,7 +135,7 @@ proc Structural::examples::TreeAssignationIncompressibleCookMembrane2D {args} { spdAux::RequestRefresh } -proc Structural::examples::TreeAssignationIncompressibleCookMembrane3D {args} { +proc ::Structural::examples::IncompressibleCookMembrane::TreeAssignation3D {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] diff --git a/kratos.gid/apps/Structural/examples/TrussCantilever.tcl b/kratos.gid/apps/Structural/examples/TrussCantilever.tcl index f52ef761a..2451deaba 100644 --- a/kratos.gid/apps/Structural/examples/TrussCantilever.tcl +++ b/kratos.gid/apps/Structural/examples/TrussCantilever.tcl @@ -1,16 +1,20 @@ +namespace eval ::Structural::examples::TrussCantilever { + namespace path ::Structural::examples + Kratos::AddNamespace [namespace current] -proc ::Structural::examples::TrussCantilever {args} { +} +proc ::Structural::examples::TrussCantilever::Init {args} { if {![Kratos::IsModelEmpty]} { set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?" set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] if { $retval == "cancel" } { return } } - DrawTrussCantileverGeometry - AssignTrussCantileverMeshSizes - TreeAssignationTrussCantilever + DrawGeometry + AssignMeshSizes + TreeAssignation } -proc Structural::examples::DrawTrussCantileverGeometry {args} { +proc ::Structural::examples::TrussCantilever::DrawGeometry {args} { Kratos::ResetModel set structure_layer Structure GiD_Process Mescape 'Layers ChangeName Layer0 $structure_layer escape @@ -57,12 +61,11 @@ proc Structural::examples::DrawTrussCantileverGeometry {args} { GidUtils::UpdateWindow GROUPS } -proc Structural::examples::AssignTrussCantileverMeshSizes {args} { +proc ::Structural::examples::TrussCantilever::AssignMeshSizes {args} { GiD_Process Mescape Meshing Structured Lines 1 {*}[GiD_EntitiesGroups get Structure lines] escape escape } - -proc Structural::examples::TreeAssignationTrussCantilever {args} { +proc ::Structural::examples::TrussCantilever::TreeAssignation {args} { set nd $::Model::SpatialDimension set root [customlib::GetBaseRoot] @@ -125,9 +128,10 @@ proc Structural::examples::TreeAssignationTrussCantilever {args} { spdAux::SetValuesOnBaseNode $LoadNode $props # Structure domain time parameters - set chanparameterse_list [list EndTime 25.0 DeltaTime 0.1] + #set change_list [list EndTime 25.0 DeltaTime 0.1]; # Commented delta time since the case is static + set change_list [list EndTime 25.0] set xpath [spdAux::getRoute STTimeParameters] - spdAux::SetValuesOnBasePath $xpath $parameters + spdAux::SetValuesOnBasePath $xpath $change_list spdAux::RequestRefresh } diff --git a/kratos.gid/apps/Structural/examples/examples.tcl b/kratos.gid/apps/Structural/examples/examples.tcl index f428c82ae..da1da84b0 100644 --- a/kratos.gid/apps/Structural/examples/examples.tcl +++ b/kratos.gid/apps/Structural/examples/examples.tcl @@ -1,22 +1,12 @@ -namespace eval Structural::examples { +namespace eval ::Structural::examples { + namespace path ::Structural + Kratos::AddNamespace [namespace current] } -proc Structural::examples::Init { } { - uplevel #0 [list source [file join $::Structural::dir examples TrussCantilever.tcl]] - uplevel #0 [list source [file join $::Structural::dir examples HighRiseBuilding.tcl]] - uplevel #0 [list source [file join $::Structural::dir examples incompressible_cook_membrane.tcl]] -} +proc ::Structural::examples::Init { } { -proc Structural::examples::UpdateMenus { } { - set menu_id 7 - GiDMenu::InsertOption "Kratos" [list "Truss cantilever" ] [incr menu_id] PRE [list ::Structural::examples::TrussCantilever] "" "" insertbefore = - if {$::Model::SpatialDimension eq "2D"} { - GiDMenu::InsertOption "Kratos" [list "High-rise building" ] [incr menu_id] PRE [list ::Structural::examples::HighRiseBuilding] "" "" insertbefore = - } - GiDMenu::InsertOption "Kratos" [list "Incompressible Cook membrane" ] [incr menu_id] PRE [list ::Structural::examples::IncompressibleCookMembrane] "" "" insertbefore = - GiDMenu::InsertOption "Kratos" [list "---"] [incr menu_id] PRE "" "" "" insertbefore = - GiDMenu::UpdateMenus } -Structural::examples::Init \ No newline at end of file +proc ::Structural::examples::UpdateMenus { } { +} diff --git a/kratos.gid/apps/Structural/examples/examples.xml b/kratos.gid/apps/Structural/examples/examples.xml new file mode 100644 index 000000000..dc226be6f --- /dev/null +++ b/kratos.gid/apps/Structural/examples/examples.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kratos.gid/apps/Structural/images/HighRiseBuilding2D.png b/kratos.gid/apps/Structural/images/HighRiseBuilding2D.png new file mode 100644 index 000000000..abfb308f8 Binary files /dev/null and b/kratos.gid/apps/Structural/images/HighRiseBuilding2D.png differ diff --git a/kratos.gid/apps/Structural/images/IncompressibleCookMembrane2D.png b/kratos.gid/apps/Structural/images/IncompressibleCookMembrane2D.png new file mode 100644 index 000000000..56c783be8 Binary files /dev/null and b/kratos.gid/apps/Structural/images/IncompressibleCookMembrane2D.png differ diff --git a/kratos.gid/apps/Structural/images/IncompressibleCookMembrane3D.png b/kratos.gid/apps/Structural/images/IncompressibleCookMembrane3D.png new file mode 100644 index 000000000..ad0c256ad Binary files /dev/null and b/kratos.gid/apps/Structural/images/IncompressibleCookMembrane3D.png differ diff --git a/kratos.gid/apps/Examples/images/Structural/TrussCantilever2D.png b/kratos.gid/apps/Structural/images/TrussCantilever2D.png similarity index 100% rename from kratos.gid/apps/Examples/images/Structural/TrussCantilever2D.png rename to kratos.gid/apps/Structural/images/TrussCantilever2D.png diff --git a/kratos.gid/apps/Examples/images/Structural/TrussCantilever3D.png b/kratos.gid/apps/Structural/images/TrussCantilever3D.png similarity index 100% rename from kratos.gid/apps/Examples/images/Structural/TrussCantilever3D.png rename to kratos.gid/apps/Structural/images/TrussCantilever3D.png diff --git a/kratos.gid/apps/Structural/postprocess/formfinding.tcl b/kratos.gid/apps/Structural/postprocess/formfinding.tcl index 18ce5f95b..57e09dda8 100644 --- a/kratos.gid/apps/Structural/postprocess/formfinding.tcl +++ b/kratos.gid/apps/Structural/postprocess/formfinding.tcl @@ -1,11 +1,12 @@ namespace eval ::Structural::Formfinding { - # Variable declaration + namespace path ::Structural + Kratos::AddNamespace [namespace current] } # copy problem folder to restore the formfinding problem -proc Structural::Formfinding::CopyFormfinding {} { +proc ::Structural::Formfinding::CopyFormfinding {} { #delete formfinding folder if it exists # set script_file [file nativename [GiD_Info project modelname].gid] set script_folder [GiD_Info project modelname].gid @@ -28,7 +29,7 @@ proc Structural::Formfinding::CopyFormfinding {} { } # update nodal coordinates -proc Structural::Formfinding::ModifyNodes {} { +proc ::Structural::Formfinding::ModifyNodes {} { set node_list [GiD_Result get {Displacement Kratos 1.1}] set counter 0 foreach node $node_list { @@ -55,7 +56,7 @@ proc Structural::Formfinding::ModifyNodes {} { GidUtils::SetWarnLine "Preprocess mesh is now updated" } -proc Structural::Formfinding::UpdateGeometry { } { +proc ::Structural::Formfinding::UpdateGeometry { } { CopyFormfinding ModifyNodes } diff --git a/kratos.gid/apps/Structural/python/KratosStructural.py b/kratos.gid/apps/Structural/python/KratosStructural.py deleted file mode 100755 index ef6a15636..000000000 --- a/kratos.gid/apps/Structural/python/KratosStructural.py +++ /dev/null @@ -1,18 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -import KratosMultiphysics -from KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis import StructuralMechanicsAnalysis - -""" -For user-scripting it is intended that a new class is derived -from StructuralMechanicsAnalysis to do modifications -""" - -if __name__ == "__main__": - - with open("ProjectParameters.json",'r') as parameter_file: - parameters = KratosMultiphysics.Parameters(parameter_file.read()) - - model = KratosMultiphysics.Model() - simulation = StructuralMechanicsAnalysis(model,parameters) - simulation.Run() diff --git a/kratos.gid/apps/Structural/start.tcl b/kratos.gid/apps/Structural/start.tcl index 456d82055..bd791418c 100644 --- a/kratos.gid/apps/Structural/start.tcl +++ b/kratos.gid/apps/Structural/start.tcl @@ -1,76 +1,45 @@ namespace eval ::Structural { + Kratos::AddNamespace [namespace current] + # Variable declaration variable dir - variable attributes - variable kratos_name - variable app_id + variable _app + + proc GetAttribute {name} {variable _app; return [$_app getProperty $name]} + proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]} + proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]} } -proc ::Structural::Init { } { +proc ::Structural::Init { app } { # Variable initialization variable dir - variable attributes - variable kratos_name - variable app_id - - set app_id Structural - set dir [apps::getMyDir "Structural"] - set attributes [dict create] - - # Allow to open the tree - set ::spdAux::TreeVisibility 1 - - # Intervals - dict set attributes UseIntervals 1 - if {$::Kratos::kratos_private(DevMode) eq "dev"} {dict set attributes UseIntervals 1} - - set kratos_name StructuralMechanicsApplication - - LoadMyFiles -} - -proc ::Structural::LoadMyFiles { } { - variable dir + variable _app + set _app $app - uplevel #0 [list source [file join $dir xml XmlController.tcl]] - uplevel #0 [list source [file join $dir write write.tcl]] - uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]] - uplevel #0 [list source [file join $dir postprocess formfinding.tcl]] - uplevel #0 [list source [file join $dir examples examples.tcl]] -} - -proc ::Structural::CustomToolbarItems { } { - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Structural::examples::TrussCantilever] [= "Example\nTruss cantilever"] - if {$::Model::SpatialDimension eq "2D"} { - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Structural::examples::HighRiseBuilding] [= "Example\nHigh-rise building"] - } - Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Structural::examples::IncompressibleCookMembrane] [= "Example\nIncompressible Cook membrane"] -} - -proc ::Structural::CustomMenus { } { - Structural::examples::UpdateMenus - - GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter = - GiDMenu::InsertOption "Kratos" [list "Formfinding - Update geometry" ] end POST [list ::Structural::Formfinding::UpdateGeometry] "" "" insert = - GiDMenu::UpdateMenus -} - -proc ::Structural::GetAttribute {name} { - variable attributes - set value "" - if {[dict exists $attributes $name]} {set value [dict get $attributes $name]} - return $value + ::Structural::xml::Init + ::Structural::write::Init } +# Create the old-gid condition relation_line_geo_mesh to link geometry and mesh entities. +# Topic: Local axes, beams +# TODO: remove this when GiD creates this relation automatically proc ::Structural::BeforeMeshGeneration { size } { foreach group [GiD_Groups list] { GiD_AssignData condition relation_line_geo_mesh Lines {0} [GiD_EntitiesGroups get $group lines] } } +# Some conditions applied over small displacement parts must change the topology name... una chufa proc ::Structural::ApplicationSpecificGetCondition {condition group etype nnodes} { return [Structural::write::ApplicationSpecificGetCondition $condition $group $etype $nnodes] } -::Structural::Init +# Add formfinding button in Kratos menu in postprocess +proc ::Structural::CustomMenus { } { + Structural::examples::UpdateMenus + + GiDMenu::InsertOption "Kratos" [list "---"] 8 POST "" "" "" insertafter = + GiDMenu::InsertOption "Kratos" [list "Formfinding - Update geometry" ] end POST [list ::Structural::Formfinding::UpdateGeometry] "" "" insert = + GiDMenu::UpdateMenus +} \ No newline at end of file diff --git a/kratos.gid/apps/Structural/write/write.tcl b/kratos.gid/apps/Structural/write/write.tcl index 4ffbdae0a..7af56fa63 100644 --- a/kratos.gid/apps/Structural/write/write.tcl +++ b/kratos.gid/apps/Structural/write/write.tcl @@ -1,11 +1,14 @@ -namespace eval Structural::write { +namespace eval ::Structural::write { + namespace path ::Structural + Kratos::AddNamespace [namespace current] + variable ConditionsDictGroupIterators variable NodalConditionsGroup variable writeAttributes variable ContactsDict } -proc Structural::write::Init { } { +proc ::Structural::write::Init { } { variable ConditionsDictGroupIterators variable NodalConditionsGroup set ConditionsDictGroupIterators [dict create] @@ -16,25 +19,28 @@ proc Structural::write::Init { } { variable writeAttributes set writeAttributes [dict create] + SetAttribute validApps [list "Structural"] - SetAttribute writeCoordinatesByGroups 0 - SetAttribute properties_location json - SetAttribute parts_un STParts - SetAttribute time_parameters_un STTimeParameters - SetAttribute results_un STResults - SetAttribute materials_un STMaterials - SetAttribute initial_conditions_un STInitialConditions - SetAttribute nodal_conditions_un STNodalConditions - SetAttribute conditions_un STLoads + SetAttribute writeCoordinatesByGroups [::Structural::GetWriteProperty coordinates] + SetAttribute properties_location [::Structural::GetWriteProperty properties_location] + + SetAttribute parts_un [::Structural::GetUniqueName parts] + SetAttribute time_parameters_un [::Structural::GetUniqueName time_parameters] + SetAttribute results_un [::Structural::GetUniqueName results] + SetAttribute materials_un [::Structural::GetUniqueName materials] + SetAttribute initial_conditions_un [::Structural::GetUniqueName initial_conditions] + SetAttribute nodal_conditions_un [::Structural::GetUniqueName nodal_conditions] + SetAttribute conditions_un [::Structural::GetUniqueName conditions] + SetAttribute nodal_conditions_no_submodelpart [list CONDENSED_DOF_LIST CONDENSED_DOF_LIST_2D CONTACT CONTACT_SLAVE] - SetAttribute materials_file "StructuralMaterials.json" - SetAttribute main_script_file "KratosStructural.py" - SetAttribute model_part_name "Structure" - SetAttribute output_model_part_name "" + SetAttribute materials_file [::Structural::GetWriteProperty materials_file] + SetAttribute main_launch_file [::Structural::GetAttribute main_launch_file] + SetAttribute model_part_name [::Structural::GetWriteProperty model_part_name] + SetAttribute output_model_part_name [::Structural::GetWriteProperty output_model_part_name] } # MDPA Blocks -proc Structural::write::writeModelPartEvent { } { +proc ::Structural::write::writeModelPartEvent { } { variable ConditionsDictGroupIterators initLocalWriteConfiguration write::initWriteConfiguration [GetAttributes] @@ -45,7 +51,7 @@ proc Structural::write::writeModelPartEvent { } { write::WriteString "End Properties" # Nodal coordinates (1: Print only Structural nodes | 0: the whole mesh ) - if {[GetAttribute writeCoordinatesByGroups]} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} + if {[GetAttribute writeCoordinatesByGroups] ne "all"} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates} # Element connectivities (Groups on STParts) write::writeElementConnectivities @@ -68,15 +74,15 @@ proc Structural::write::writeModelPartEvent { } { } -proc Structural::write::writeConditions { } { +proc ::Structural::write::writeConditions { } { variable ConditionsDictGroupIterators - set ConditionsDictGroupIterators [write::writeConditions [GetAttribute conditions_un] ] + set ConditionsDictGroupIterators [::write::writeConditions [GetAttribute conditions_un] ] set last_iter [Structural::write::getLastConditionId] writeContactConditions $last_iter } -proc Structural::write::writeMeshes { } { +proc ::Structural::write::writeMeshes { } { # There are some Conditions and nodalConditions that dont generate a submodelpart # Add them to this list @@ -103,7 +109,7 @@ proc Structural::write::writeMeshes { } { writeContacts } -proc Structural::write::writeContactConditions { last_iter } { +proc ::Structural::write::writeContactConditions { last_iter } { variable ConditionsDictGroupIterators set root [customlib::GetBaseRoot] set ov "line" @@ -122,7 +128,7 @@ proc Structural::write::writeContactConditions { last_iter } { } } -proc Structural::write::writeLoads { } { +proc ::Structural::write::writeLoads { } { variable ConditionsDictGroupIterators set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group" @@ -138,7 +144,7 @@ proc Structural::write::writeLoads { } { } } -proc Structural::write::writeContacts { } { +proc ::Structural::write::writeContacts { } { variable ConditionsDictGroupIterators variable ContactsDict @@ -151,7 +157,7 @@ proc Structural::write::writeContacts { } { foreach slave_group [$root selectNodes $xp_slave] { if {$slave_group ne ""} { set slave_groupid_raw [$slave_group @n] - set slave_group_pair_id [get_domnode_attribute [$slave_group selectNodes "./value\[@n='pair'\]"] v] + set slave_group_pair_id [write::getValueByNode [$slave_group selectNodes "./value\[@n='pair'\]"] ] set slave_groupid [write::GetWriteGroupName $slave_groupid_raw] set prev [list ] if {[dict exists $ContactsDict Slaves $slave_group_pair_id]} {set prev [dict get $ContactsDict Slaves $slave_group_pair_id]} @@ -165,7 +171,7 @@ proc Structural::write::writeContacts { } { if {$master_group ne ""} { set master_groupid_raw [$master_group @n] set master_groupid [write::GetWriteGroupName $master_groupid_raw] - set master_group_pair_id [get_domnode_attribute [$master_group selectNodes "./value\[@n='pair'\]"] v] + set master_group_pair_id [write::getValueByNode [$master_group selectNodes "./value\[@n='pair'\]"] ] set prev [list ] if {[dict exists $ContactsDict Masters $master_group_pair_id]} { set prev [dict get $ContactsDict Masters $master_group_pair_id] @@ -179,14 +185,14 @@ proc Structural::write::writeContacts { } { } } -proc Structural::write::writeCustomBlock { } { +proc ::Structural::write::writeCustomBlock { } { write::WriteString "Begin Custom" write::WriteString "Custom write for Structural, any app can call me, so be careful!" write::WriteString "End Custom" write::WriteString "" } -proc Structural::write::getLastConditionId { } { +proc ::Structural::write::getLastConditionId { } { variable ConditionsDictGroupIterators set top 1 if {$ConditionsDictGroupIterators ne ""} { @@ -198,21 +204,22 @@ proc Structural::write::getLastConditionId { } { } # Custom files -proc Structural::write::WriteMaterialsFile { } { +proc ::Structural::write::WriteMaterialsFile { } { write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] True [GetAttribute model_part_name] } -proc Structural::write::GetUsedElements { {get "Objects"} } { +proc ::Structural::write::GetUsedElements { {get "Objects"} } { set lista [list ] foreach gNode [Structural::write::GetPartsGroups] { - set elem_name [get_domnode_attribute [$gNode selectNodes ".//value\[@n='Element']"] v] + set elem_name [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element']"] ] set e [Model::getElement $elem_name] if {$get eq "Name"} { set e [$e getName] } lappend lista $e } return $lista } -proc Structural::write::GetPartsGroups { {get "Objects"} } { + +proc ::Structural::write::GetPartsGroups { {get "Objects"} } { set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group" set lista [list ] foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { @@ -223,10 +230,10 @@ proc Structural::write::GetPartsGroups { {get "Objects"} } { return $lista } -proc Structural::write::writeLocalAxes { } { +proc ::Structural::write::writeLocalAxes { } { set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group" foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] { - set elem_name [get_domnode_attribute [$gNode selectNodes ".//value\[@n='Element']"] v] + set elem_name [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element']"] ] set e [Model::getElement $elem_name] if {[write::isBooleanTrue [$e getAttribute "RequiresLocalAxes"]]} { set group [$gNode @n] @@ -236,7 +243,7 @@ proc Structural::write::writeLocalAxes { } { } # This is the kind of code I hate -proc Structural::write::writeHinges { } { +proc ::Structural::write::writeHinges { } { # format for writing ids set id_f [dict get $write::formats_dict ID] @@ -266,25 +273,25 @@ proc Structural::write::writeHinges { } { set first_list [list ] set last_list [list ] if {$::Model::SpatialDimension eq "3D"} { - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementX']"] v]]} {lappend first_list 0} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementY']"] v]]} {lappend first_list 1} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementZ']"] v]]} {lappend first_list 2} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstMomentX']"] v]]} {lappend first_list 3} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstMomentY']"] v]]} {lappend first_list 4} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstMomentZ']"] v]]} {lappend first_list 5} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementX']"] v]]} {lappend last_list 6} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementY']"] v]]} {lappend last_list 7} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementZ']"] v]]} {lappend last_list 8} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondMomentX']"] v]]} {lappend last_list 9} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondMomentY']"] v]]} {lappend last_list 10} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondMomentZ']"] v]]} {lappend last_list 11} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementX']"] ]]} {lappend first_list 0} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementY']"] ]]} {lappend first_list 1} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementZ']"] ]]} {lappend first_list 2} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstMomentX']"] ]]} {lappend first_list 3} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstMomentY']"] ]]} {lappend first_list 4} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstMomentZ']"] ]]} {lappend first_list 5} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementX']"] ]]} {lappend last_list 6} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementY']"] ]]} {lappend last_list 7} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementZ']"] ]]} {lappend last_list 8} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondMomentX']"] ]]} {lappend last_list 9} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondMomentY']"] ]]} {lappend last_list 10} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondMomentZ']"] ]]} {lappend last_list 11} } else { - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementX']"] v]]} {lappend first_list 0} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementY']"] v]]} {lappend first_list 1} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstMomentZ']"] v]]} {lappend first_list 2} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementX']"] v]]} {lappend last_list 3} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementY']"] v]]} {lappend last_list 4} - if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondMomentZ']"] v]]} {lappend last_list 5} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementX']"] ]]} {lappend first_list 0} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementY']"] ]]} {lappend first_list 1} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstMomentZ']"] ]]} {lappend first_list 2} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementX']"] ]]} {lappend last_list 3} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementY']"] ]]} {lappend last_list 4} + if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondMomentZ']"] ]]} {lappend last_list 5} } # Write Left and Rigth end of each geometrical bar @@ -308,10 +315,10 @@ proc Structural::write::writeHinges { } { } } -proc Structural::write::initLocalWriteConfiguration { } { +proc ::Structural::write::initLocalWriteConfiguration { } { } -proc Structural::write::usesContact { } { +proc ::Structural::write::usesContact { } { set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute STNodalConditions]/condition\[@n = 'CONTACT'\]/group"] if {$result_node ne ""} { @@ -322,7 +329,7 @@ proc Structural::write::usesContact { } { } # return 0 means ok; return [list 1 "Error message to be displayed"] -proc Structural::write::writeValidateEvent { } { +proc ::Structural::write::writeValidateEvent { } { set problem 0 set problem_message [list ] @@ -334,7 +341,7 @@ proc Structural::write::writeValidateEvent { } { return [list $problem $problem_message] } -proc Structural::write::validateTrussMesh { } { +proc ::Structural::write::validateTrussMesh { } { # Elements to be checked set truss_element_names [list "TrussLinearElement2D" "TrussElement2D" "TrussLinearElement3D" "TrussElement3D"] set error 0 @@ -367,7 +374,7 @@ proc Structural::write::validateTrussMesh { } { return [list $error $error_message] } -proc Structural::write::ApplicationSpecificGetCondition {condition group etype nnodes} { +proc ::Structural::write::ApplicationSpecificGetCondition {condition group etype nnodes} { # Prepare the return, if nothing to apply, return the same condition set ret $condition @@ -388,20 +395,22 @@ proc Structural::write::ApplicationSpecificGetCondition {condition group etype n if {[Structural::write::GroupUsesSmallDisplacement $group $used_small_disp_elements]} { set new_cond [Model::Clone $condition] set topology [$new_cond getTopologyFeature $etype $nnodes] - set new_kname [$topology getAttribute KratosNameSmallDisplacement] - if {$new_kname ne ""} {$topology setKratosName $new_kname} - set ret $new_cond + if {$topology ne "" && [$topology hasAttribute KratosNameSmallDisplacement]} { + set new_kname [$topology getAttribute KratosNameSmallDisplacement] + if {$new_kname ne ""} {$topology setKratosName $new_kname} + set ret $new_cond + } } } return $ret } -proc Structural::write::GroupUsesSmallDisplacement {group used_small_disp_elements} { +proc ::Structural::write::GroupUsesSmallDisplacement {group used_small_disp_elements} { set ret 0 set group_nodes [GiD_EntitiesGroups get $group nodes] foreach part_group_small_disp [Structural::write::GetPartsGroups] { - set elem_name [get_domnode_attribute [$part_group_small_disp selectNodes ".//value\[@n='Element']"] v] + set elem_name [write::getValueByNode [$part_group_small_disp selectNodes ".//value\[@n='Element']"] ] set elem [Model::getElement $elem_name] if {$elem in $used_small_disp_elements} { if {[objarray length [objarray intersection -sorted $group_nodes [GiD_EntitiesGroups get [$part_group_small_disp @n] nodes] ] ] > 0} {set ret 1; break} @@ -410,53 +419,63 @@ proc Structural::write::GroupUsesSmallDisplacement {group used_small_disp_elemen return $ret } +proc ::Structural::write::PrepareSubGroupsAssignChildEntitiesOnParents { } { + # list of groups sorted by lenght. so we always treat childs first and parents last + set groups_list [lsort -command {apply {{a b} {expr {[string length $a] - [string length $b]}}}} [GiD_Groups list]] + foreach group $groups_list { + set parent [GiD_Groups get parent $group] + if {$parent ne ""} { + foreach elem [GiD_Groups get allowed_types $parent] { + if {$elem ni [list "edges" "faces"]} { + GiD_EntitiesGroups assign $parent $elem [GiD_EntitiesGroups get $group $elem] + } + } + } + } +} -proc Structural::write::writeCustomFilesEvent { } { +proc ::Structural::write::writeCustomFilesEvent { } { WriteMaterialsFile write::SetParallelismConfiguration + write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file] - set orig_name [GetAttribute main_script_file] - write::CopyFileIntoModel [file join "python" $orig_name ] - write::RenameFileInModel $orig_name "MainKratos.py" } -proc Structural::write::SetCoordinatesByGroups {value} { +proc ::Structural::write::SetCoordinatesByGroups {value} { SetAttribute writeCoordinatesByGroups $value } -proc Structural::write::GetAttribute {att} { +proc ::Structural::write::GetAttribute {att} { variable writeAttributes return [dict get $writeAttributes $att] } -proc Structural::write::GetAttributes {} { +proc ::Structural::write::GetAttributes {} { variable writeAttributes return $writeAttributes } -proc Structural::write::SetAttribute {att val} { +proc ::Structural::write::SetAttribute {att val} { variable writeAttributes dict set writeAttributes $att $val } -proc Structural::write::AddAttribute {att val} { +proc ::Structural::write::AddAttribute {att val} { variable writeAttributes dict append writeAttributes $att $val] } -proc Structural::write::AddAttributes {configuration} { +proc ::Structural::write::AddAttributes {configuration} { variable writeAttributes set writeAttributes [dict merge $writeAttributes $configuration] } -proc Structural::write::AddValidApps {appList} { +proc ::Structural::write::AddValidApps {appList} { AddAttribute validApps $appList } -proc Structural::write::ApplyConfiguration { } { +proc ::Structural::write::ApplyConfiguration { } { variable writeAttributes write::SetConfigurationAttributes $writeAttributes } - -Structural::write::Init diff --git a/kratos.gid/apps/Structural/write/writeProjectParameters.tcl b/kratos.gid/apps/Structural/write/writeProjectParameters.tcl index aa3c87be8..9c66b0b7d 100644 --- a/kratos.gid/apps/Structural/write/writeProjectParameters.tcl +++ b/kratos.gid/apps/Structural/write/writeProjectParameters.tcl @@ -1,22 +1,32 @@ # Project Parameters -proc Structural::write::getOldParametersDict { } { +proc ::Structural::write::getOldParametersDict { } { set model_part_name [GetAttribute model_part_name] set projectParametersDict [dict create] # Problem data # Create section - set problemDataDict [write::GetDefaultProblemDataDict $Structural::app_id] + set problemDataDict [write::GetDefaultProblemDataDict [::Structural::GetAttribute id]] set solutiontype [write::getValue STSoluType] + # Time Parameters + set timeSteppingDict [dict create] if {$solutiontype eq "Static" || $solutiontype eq "eigen_value"} { set time_step "1.1" dict set problemDataDict start_time "0.0" dict set problemDataDict end_time "1.0" + + # Time stepping settings for static + dict set timeSteppingDict "time_step" $time_step + } { - set time_step [write::getValue STTimeParameters DeltaTime] + set time_step_table [write::GetTimeStepIntervals] + + # Time stepping settings for dynamic + dict set timeSteppingDict "time_step_table" $time_step_table } + # Add section to document dict set projectParametersDict problem_data $problemDataDict @@ -50,6 +60,8 @@ proc Structural::write::getOldParametersDict { } { # TODO: Use default # Solution strategy set solverSettingsDict [dict create] + # Time stepping + dict set solverSettingsDict time_stepping $timeSteppingDict set currentStrategyId [write::getValue STSolStrat] # set strategy_write_name [[::Model::GetSolutionStrategy $currentStrategyId] getAttribute "n"] set solver_type_name $solutiontype @@ -76,11 +88,6 @@ proc Structural::write::getOldParametersDict { } { dict set materialsDict materials_filename [GetAttribute materials_file] dict set solverSettingsDict material_import_settings $materialsDict - # Time stepping settings - set timeSteppingDict [dict create] - dict set timeSteppingDict "time_step" $time_step - dict set solverSettingsDict time_stepping $timeSteppingDict - # Solution strategy parameters and Solvers set solverSettingsDict [dict merge $solverSettingsDict [write::getSolutionStrategyParametersDict STSolStrat STScheme STStratParams] ] set solverSettingsDict [dict merge $solverSettingsDict [write::getSolversParametersDict Structural] ] @@ -145,7 +152,7 @@ proc Structural::write::getOldParametersDict { } { dict set projectParametersDict processes $processesDict # GiD output configuration - dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict $Structural::app_id] + dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict [::Structural::GetAttribute id]] set check_list [list "UpdatedLagrangianElementUP2D" "UpdatedLagrangianElementUPAxisym"] foreach elem $check_list { @@ -163,7 +170,7 @@ proc Structural::write::getOldParametersDict { } { return $projectParametersDict } -proc Structural::write::GetContactConditionsDict { } { +proc ::Structural::write::GetContactConditionsDict { } { variable ContactsDict set root [customlib::GetBaseRoot] @@ -211,18 +218,19 @@ proc Structural::write::GetContactConditionsDict { } { return $contacts } - -proc Structural::write::writeParametersEvent { } { +proc ::Structural::write::writeParametersEvent { } { write::WriteJSON [getParametersDict] } - # Project Parameters -proc Structural::write::getParametersDict { } { +proc ::Structural::write::getParametersDict { } { # Get the base dictionary for the project parameters set project_parameters_dict [getOldParametersDict] + # Analysis stage field + dict set project_parameters_dict analysis_stage "KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis" + # If using any element with the attribute RotationDofs set to true dict set project_parameters_dict solver_settings rotation_dofs [UsingSpecificDofElements RotationDofs] dict set project_parameters_dict solver_settings volumetric_strain_dofs [UsingSpecificDofElements VolumetricStrainDofs] @@ -234,11 +242,11 @@ proc Structural::write::getParametersDict { } { return $project_parameters_dict } -proc Structural::write::writeParametersEvent { } { +proc ::Structural::write::writeParametersEvent { } { write::WriteJSON [::Structural::write::getParametersDict] } -proc Structural::write::UsingSpecificDofElements { SpecificDof } { +proc ::Structural::write::UsingSpecificDofElements { SpecificDof } { set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group/value\[@n='Element'\]" set elements [$root selectNodes $xp1] @@ -252,7 +260,7 @@ proc Structural::write::UsingSpecificDofElements { SpecificDof } { return $bool } -proc Structural::write::UsingFileInPrestressedMembrane { } { +proc ::Structural::write::UsingFileInPrestressedMembrane { } { set root [customlib::GetBaseRoot] set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group/value\[@n='Element'\]" set elements [$root selectNodes $xp1] diff --git a/kratos.gid/apps/Structural/xml/Elements.xml b/kratos.gid/apps/Structural/xml/Elements.xml index b8c2f2abf..cde1ffbf5 100644 --- a/kratos.gid/apps/Structural/xml/Elements.xml +++ b/kratos.gid/apps/Structural/xml/Elements.xml @@ -458,8 +458,8 @@ - - + + @@ -478,10 +478,9 @@ - - + - + diff --git a/kratos.gid/apps/Structural/xml/SolutionStrategy.spd b/kratos.gid/apps/Structural/xml/SolutionStrategy.spd index e5409e525..a34a9f98a 100644 --- a/kratos.gid/apps/Structural/xml/SolutionStrategy.spd +++ b/kratos.gid/apps/Structural/xml/SolutionStrategy.spd @@ -1,11 +1,6 @@ - - - - - - + diff --git a/kratos.gid/apps/Structural/xml/XmlController.tcl b/kratos.gid/apps/Structural/xml/XmlController.tcl index 1a0c25749..6168ff5b4 100644 --- a/kratos.gid/apps/Structural/xml/XmlController.tcl +++ b/kratos.gid/apps/Structural/xml/XmlController.tcl @@ -1,10 +1,10 @@ -namespace eval Structural::xml { - variable dir +namespace eval ::Structural::xml { + namespace path ::Structural + Kratos::AddNamespace [namespace current] } -proc Structural::xml::Init { } { - variable dir - Model::InitVariables dir $Structural::dir +proc ::Structural::xml::Init { } { + Model::InitVariables dir $::Structural::dir Model::getSolutionStrategies Strategies.xml Model::getElements Elements.xml @@ -19,26 +19,24 @@ proc Structural::xml::Init { } { Model::getSolvers Solvers.xml } -proc Structural::xml::getUniqueName {name} { - return ST$name +proc ::Structural::xml::getUniqueName {name} { + return [::Structural::GetAttribute prefix]$name } -proc ::Structural::xml::MultiAppEvent {args} { - -} - -proc Structural::xml::CustomTree { args } { +proc ::Structural::xml::CustomTree { args } { spdAux::SetValueOnTreeItem state hidden STResults CutPlanes spdAux::SetValueOnTreeItem v SingleFile GiDOptions GiDMultiFileFlag spdAux::SetValueOnTreeItem v 1 GiDOptions EchoLevel - set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'CONDENSED_DOF_LIST_2D'\]"] + set nodal_results_node [[customlib::GetBaseRoot] selectNodes [spdAux::getRoute NodalResults]] + + set result_node [$nodal_results_node selectNodes "./value\[@n = 'CONDENSED_DOF_LIST_2D'\]"] if {$result_node ne "" } {$result_node delete} - set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'CONDENSED_DOF_LIST'\]"] + set result_node [$nodal_results_node selectNodes "./value\[@n = 'CONDENSED_DOF_LIST'\]"] if {$result_node ne "" } {$result_node delete} - set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'CONTACT'\]"] + set result_node [$nodal_results_node selectNodes "./value\[@n = 'CONTACT'\]"] if {$result_node ne "" } {$result_node delete} - set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'CONTACT_SLAVE'\]"] + set result_node [$nodal_results_node selectNodes "./value\[@n = 'CONTACT_SLAVE'\]"] if {$result_node ne "" } {$result_node delete} set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute STNodalConditions]/condition\[@n = 'VOLUMETRIC_STRAIN'\]"] if {$result_node ne "" } {$result_node delete} @@ -52,7 +50,7 @@ proc Structural::xml::CustomTree { args } { } } -proc Structural::xml::ProcCheckGeometryStructural {domNode args} { +proc ::Structural::xml::ProcCheckGeometryStructural {domNode args} { set ret "line,surface" if {$::Model::SpatialDimension eq "3D"} { set ret "line,surface,volume" @@ -60,7 +58,7 @@ proc Structural::xml::ProcCheckGeometryStructural {domNode args} { return $ret } -proc Structural::xml::ProcGetSolutionStrategiesStructural { domNode args } { +proc ::Structural::xml::ProcGetSolutionStrategiesStructural { domNode args } { set names "" set pnames "" set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute STSoluType]] v] @@ -82,7 +80,7 @@ proc Structural::xml::ProcGetSolutionStrategiesStructural { domNode args } { return $pnames } -proc Structural::xml::ProcCheckNodalConditionStateStructural {domNode args} { +proc ::Structural::xml::ProcCheckNodalConditionStateStructural {domNode args} { # Overwritten the base function to add Solution Type restrictions set parts_un STParts if {[spdAux::getRoute $parts_un] ne ""} { @@ -103,7 +101,7 @@ proc Structural::xml::ProcCheckNodalConditionStateStructural {domNode args} { } {return "normal"} } -proc Structural::xml::ProcCheckGeometryStructural {domNode args} { +proc ::Structural::xml::ProcCheckGeometryStructural {domNode args} { set ret "surface" if {$::Model::SpatialDimension eq "3D"} { set ret "surface,volume" @@ -112,7 +110,7 @@ proc Structural::xml::ProcCheckGeometryStructural {domNode args} { } -proc Structural::xml::UpdateParts {domNode args} { +proc ::Structural::xml::UpdateParts {domNode args} { set current [lindex [$domNode selectNodes "./group"] end] set element_name [get_domnode_attribute [$current selectNodes "./value\[@n = 'Element'\]"] v] set element [Model::getElement $element_name] @@ -122,7 +120,7 @@ proc Structural::xml::UpdateParts {domNode args} { } } -proc Structural::xml::AddLocalAxesToBeamElement { current } { +proc ::Structural::xml::AddLocalAxesToBeamElement { current } { # set y_axis_deviation [get_domnode_attribute [$current selectNodes "./value\[@n = 'LOCAL_AXIS_ROTATION'\]"] v] # W $y_axis_deviation set group [get_domnode_attribute $current n] @@ -136,7 +134,7 @@ proc Structural::xml::AddLocalAxesToBeamElement { current } { ############# procs ################# -proc Structural::xml::ProcGetElementsStructural { domNode args } { +proc ::Structural::xml::ProcGetElementsStructural { domNode args } { set nodeApp [spdAux::GetAppIdFromNode $domNode] set sol_stratUN [apps::getAppUniqueName $nodeApp SolStrat] set schemeUN [apps::getAppUniqueName $nodeApp Scheme] @@ -194,6 +192,4 @@ proc Structural::xml::ProcGetElementsStructural { domNode args } { } #spdAux::RequestRefresh return $diction -} - -Structural::xml::Init +} \ No newline at end of file diff --git a/kratos.gid/apps/ThermicLauncher/app.json b/kratos.gid/apps/ThermicLauncher/app.json new file mode 100644 index 000000000..aac9d4568 --- /dev/null +++ b/kratos.gid/apps/ThermicLauncher/app.json @@ -0,0 +1,23 @@ +{ + "id": "Thermic Launcher", + "name": "Thermic", + "script_files": [ + "start.tcl" + ], + "start_script": "::ThermicLauncher::Init", + "requeriments": { + "apps_exist": [ + "ConvectionDiffusion", + "Buoyancy", + "ConjugateHeatTransfer" + ], + "minimum_gid_version": "15.1.3d" + }, + "permissions": { + "open_tree": false, + "show_toolbar": true, + "intervals": false, + "wizard": false + }, + "description": "Thermal applications \n-Convection diffusion\n-Buoyancy\n-Conjugate heat transfer" +} \ No newline at end of file diff --git a/kratos.gid/apps/ThermicLauncher/start.tcl b/kratos.gid/apps/ThermicLauncher/start.tcl index 860325b96..f58e460a9 100644 --- a/kratos.gid/apps/ThermicLauncher/start.tcl +++ b/kratos.gid/apps/ThermicLauncher/start.tcl @@ -1,20 +1,20 @@ namespace eval ::ThermicLauncher { + Kratos::AddNamespace [namespace current] + variable available_apps } -proc ::ThermicLauncher::Init { } { +proc ::ThermicLauncher::Init { app } { variable available_apps + # TODO: Get apps from json set available_apps [list ConvectionDiffusion Buoyancy ConjugateHeatTransfer] - # Allow to open the tree - set ::spdAux::TreeVisibility 0 ::ThermicLauncher::AppSelectorWindow } proc ::ThermicLauncher::AppSelectorWindow { } { variable available_apps - set initwind $::spdAux::initwind set root [customlib::GetBaseRoot] set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v] @@ -25,10 +25,9 @@ proc ::ThermicLauncher::AppSelectorWindow { } { } { [$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait - set initwind .gid.win_example - if { [ winfo exist $initwind]} { - destroy $initwind - } + set initwind $::spdAux::application_window_id + spdAux::DestroyWindows + spdAux::RegisterWindow $initwind toplevel $initwind wm withdraw $initwind @@ -45,21 +44,30 @@ proc ::ThermicLauncher::AppSelectorWindow { } { ttk::frame $w.top ttk::label $w.top.title_text -text [_ "Select a Thermic application"] - ttk::frame $w.information -relief ridge + ttk::frame $w.applications -relief ridge set i 0 foreach app $available_apps { set img [::apps::getImgFrom $app] set app_publicname [[::apps::getAppById $app] getPublicName] - set but [ttk::button $w.information.img$app -image $img -command [list ::ThermicLauncher::ChangeAppTo $app] ] - ttk::label $w.information.text$app -text $app_publicname - grid $w.information.img$app -column $i -row 0 - grid $w.information.text$app -column $i -row 1 + set but [ttk::button $w.applications.img$app -image $img -command [list ::ThermicLauncher::ChangeAppTo $app] ] + bind $w.applications.img$app {::spdAux::PlaceInformationWindowByPath %W applications} + ttk::label $w.applications.text$app -text $app_publicname + grid $w.applications.img$app -column $i -row 0 + grid $w.applications.text$app -column $i -row 1 incr i } grid $w.top grid $w.top.title_text - grid $w.information + grid $w.applications + + # Information panel + set spdAux::info_main_window_text "" + ttk::labelframe $w.info -text " Information " -relief ridge + ttk::label $w.info.text -textvariable spdAux::info_main_window_text + grid $w.info.text + grid $w.info -sticky we + } } @@ -68,5 +76,3 @@ proc ::ThermicLauncher::ChangeAppTo {appid} { spdAux::SetSpatialDimmension undefined apps::setActiveApp $appid } - -::ThermicLauncher::Init diff --git a/kratos.gid/exec/MainKratos.py b/kratos.gid/exec/MainKratos.py new file mode 100644 index 000000000..fa3674d25 --- /dev/null +++ b/kratos.gid/exec/MainKratos.py @@ -0,0 +1,45 @@ +import sys +import time +import importlib + +import KratosMultiphysics + +def CreateAnalysisStageWithFlushInstance(cls, global_model, parameters): + class AnalysisStageWithFlush(cls): + + def __init__(self, model,project_parameters, flush_frequency=10.0): + super().__init__(model,project_parameters) + self.flush_frequency = flush_frequency + self.last_flush = time.time() + sys.stdout.flush() + + def Initialize(self): + super().Initialize() + sys.stdout.flush() + + def FinalizeSolutionStep(self): + super().FinalizeSolutionStep() + + if self.parallel_type == "OpenMP": + now = time.time() + if now - self.last_flush > self.flush_frequency: + sys.stdout.flush() + self.last_flush = now + + return AnalysisStageWithFlush(global_model, parameters) + +if __name__ == "__main__": + + with open("ProjectParameters.json", 'r') as parameter_file: + parameters = KratosMultiphysics.Parameters(parameter_file.read()) + + analysis_stage_module_name = parameters["analysis_stage"].GetString() + analysis_stage_class_name = analysis_stage_module_name.split('.')[-1] + analysis_stage_class_name = ''.join(x.title() for x in analysis_stage_class_name.split('_')) + + analysis_stage_module = importlib.import_module(analysis_stage_module_name) + analysis_stage_class = getattr(analysis_stage_module, analysis_stage_class_name) + + global_model = KratosMultiphysics.Model() + simulation = CreateAnalysisStageWithFlushInstance(analysis_stage_class, global_model, parameters) + simulation.Run() diff --git a/kratos.gid/exec/compiled.unix.bat b/kratos.gid/exec/compiled.unix.bat new file mode 100644 index 000000000..c2e89e6cc --- /dev/null +++ b/kratos.gid/exec/compiled.unix.bat @@ -0,0 +1,45 @@ +#!/bin/bash +# OutputFile: "$2/$1.info" +# ErrorFile: "$2/$1.err" +#delete previous result file +rm -f "$2/$1*.post.bin" +rm -f "$2/$1*.post.res" +rm -f "$2/$1*.post.msh" +rm -f "$2/$1.info" +rm -f "$2/$1.err" +rm -f "$2/$1.flavia.dat" + +# include .bashrc if it exists +if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" +fi + +# gid redefines LD_LIBRARY_PATH to its own libs directory +# and maintains OLD_LD_LIBRARY_PATH with previous settings +# therefore, we use the OLD_LD_LIBRARY_PATH and prepend the path to the kratos libs +if [ "$OLD_LD_LIBRARY_PATH" != "" ]; then + export LD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs":$OLD_LD_LIBRARY_PATH +else + # do not add the ':' + export LD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs" +fi + +# Prevents the PYTHONHOME error from happening and isolate possible python repacks present +# in the system and interfeering with runkratos +export PYTHONPATH="$3/exec/Kratos":$PYTHONPATH + + +# if mac +KERNEL=`uname -s` +if [ $KERNEL = "Darwin" ]; then + KERNEL_NAME="macosx" + export DYLD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs":$DYLD_LIBRARY_PATH + export DYLD_FALLBACK_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs":$DYLD_FALLBACK_LIBRARY_PATH + export PYTHONPATH="$3/exec/Kratos/Lib":"$3/exec/Kratos/Lib/lib-dynload/":$PYTHONPATH + export PYTHONHOME="$3/exec/Kratos" +else + KERNEL_NAME="linux" +fi + +# Run Python using the script MainKratos.py +"$3/exec/Kratos/runkratos" MainKratos.py > "$2/$1.info" 2> "$2/$1.err" \ No newline at end of file diff --git a/kratos.gid/exec/compiled.win.bat b/kratos.gid/exec/compiled.win.bat new file mode 100644 index 000000000..6807e92e0 --- /dev/null +++ b/kratos.gid/exec/compiled.win.bat @@ -0,0 +1,16 @@ +REM @ECHO OFF +REM Identification for arguments +REM basename = %1 +REM Project directory = %2 +REM Problem directory = %3 + +REM OutputFile: "%2\%1.info" +REM ErrorFile: "%2\%1.err" + +DEL "%2\%1.info" +DEL "%2\%1.err" + +set PATH=%3\\exec\\kratos;%3\\exec\\kratos\\libs;%PATH% + +REM Run Python using the script MainKratos.py +"%3\\exec\\kratos\\runkratos" MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err" \ No newline at end of file diff --git a/kratos.gid/exec/global_pip.win.bat b/kratos.gid/exec/global_pip.win.bat new file mode 100644 index 000000000..6094cf4b1 --- /dev/null +++ b/kratos.gid/exec/global_pip.win.bat @@ -0,0 +1,22 @@ +REM @ECHO OFF +REM Identification for arguments +REM basename = %1 +REM Project directory = %2 +REM Problem directory = %3 + +REM OutputFile: "%2\%1.info" +REM ErrorFile: "%2\%1.err" + +REM Remove previous calculation files and results +DEL "%2\%1.info" +DEL "%2\%1.err" +DEL "%2\%1*.post.bin" +DEL "%2\%1*.post.res" +DEL "%2\%1*.post.msh" + +REM Install dependencies if needed +pip install numpy +pip install KratosFluidDynamicsApplication + +@REM Calculate! +python MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err" diff --git a/kratos.gid/exec/install_python.win.bat b/kratos.gid/exec/install_python.win.bat new file mode 100644 index 000000000..073c54183 --- /dev/null +++ b/kratos.gid/exec/install_python.win.bat @@ -0,0 +1,14 @@ +@echo off + +@REM +cd %1 + +rem --Download python installer +rem Curl is included in windows since 2018 +curl -ss "https://www.python.org/ftp/python/3.9.9/python-3.9.9-amd64.exe" -o python-installer.exe + +rem --Install python +python-installer.exe /quiet InstallAllUsers=1 PrependPath=1 +del python-installer.exe + +pause \ No newline at end of file diff --git a/kratos.gid/exec/install_python_and_dependencies.unix.sh b/kratos.gid/exec/install_python_and_dependencies.unix.sh new file mode 100755 index 000000000..809c3287c --- /dev/null +++ b/kratos.gid/exec/install_python_and_dependencies.unix.sh @@ -0,0 +1,2 @@ +#!/bin/sh +apt install -qq -y python3 python3-distutils python3-apt python3-pip 2>1 > /dev/null diff --git a/kratos.gid/exec/install_python_and_dependencies.win.bat b/kratos.gid/exec/install_python_and_dependencies.win.bat new file mode 100644 index 000000000..ea0c5ea38 --- /dev/null +++ b/kratos.gid/exec/install_python_and_dependencies.win.bat @@ -0,0 +1,13 @@ +@echo off +cd %1 +echo "Installing python 3.9.9 from www.python.org" +rem --Download python installer +rem Curl is included in windows since 2018 +curl -ssL "https://www.python.org/ftp/python/3.9.9/python-3.9.9-amd64.exe" -o python-installer.exe + +rem --Install python +python-installer.exe /quiet InstallAllUsers=1 PrependPath=1 +del python-installer.exe +echo "Python 3.9.9 installed" + +pause \ No newline at end of file diff --git a/kratos.gid/exec/launch.json b/kratos.gid/exec/launch.json new file mode 100644 index 000000000..a3b91337a --- /dev/null +++ b/kratos.gid/exec/launch.json @@ -0,0 +1,26 @@ +{ + "configurations": [ + { + "name": "Launch via pip", + "script": "pip", + "pip_packages": "KratosMultiphysics-all", + "dependency_check": "Kratos::CheckDependenciesPipMode" + }, + { + "name": "Launch via pip with local packages", + "script": "local_pip", + "pip_packages": "exec/packages/**.whl", + "dependency_check": "Kratos::CheckDependenciesLocalPipMode" + }, + { + "name": "Launch local compiled version", + "script": "compiled", + "dependency_check": "Kratos::CheckDependenciesLocalMode" + }, + { + "name": "Docker", + "script": "", + "dependency_check": "Kratos::CheckDependenciesDockerMode" + } + ] +} \ No newline at end of file diff --git a/kratos.gid/exec/pip.unix.bat b/kratos.gid/exec/pip.unix.bat new file mode 100755 index 000000000..81bfccc67 --- /dev/null +++ b/kratos.gid/exec/pip.unix.bat @@ -0,0 +1,13 @@ +#!/bin/bash +# OutputFile: "$2/$1.info" +# ErrorFile: "$2/$1.err" +#delete previous result file +rm -f "$2/$1*.post.bin" +rm -f "$2/$1*.post.res" +rm -f "$2/$1*.post.msh" +rm -f "$2/$1.info" +rm -f "$2/$1.err" +rm -f "$2/$1.flavia.dat" + +# Run Python using the script MainKratos.py +python3 MainKratos.py > "$2/$1.info" 2> "$2/$1.err" \ No newline at end of file diff --git a/kratos.gid/exec/pip.win.bat b/kratos.gid/exec/pip.win.bat new file mode 100644 index 000000000..8b0194437 --- /dev/null +++ b/kratos.gid/exec/pip.win.bat @@ -0,0 +1,18 @@ +REM @ECHO OFF +REM Identification for arguments +REM basename = %1 +REM Project directory = %2 +REM Problem directory = %3 + +REM OutputFile: "%2\%1.info" +REM ErrorFile: "%2\%1.err" + +REM Remove previous calculation files and results +DEL "%2\%1.info" +DEL "%2\%1.err" +DEL "%2\%1*.post.bin" +DEL "%2\%1*.post.res" +DEL "%2\%1*.post.msh" + +@REM Calculate! +python MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err" diff --git a/kratos.gid/images/files.png b/kratos.gid/images/files.png new file mode 100644 index 000000000..cb5fd2b02 Binary files /dev/null and b/kratos.gid/images/files.png differ diff --git a/kratos.gid/images/losta.png b/kratos.gid/images/losta.png new file mode 100644 index 000000000..c10ff7e13 Binary files /dev/null and b/kratos.gid/images/losta.png differ diff --git a/kratos.gid/images/settings.png b/kratos.gid/images/settings.png new file mode 100644 index 000000000..92b312731 Binary files /dev/null and b/kratos.gid/images/settings.png differ diff --git a/kratos.gid/images/time1.png b/kratos.gid/images/time1.png new file mode 100644 index 000000000..26b6c4600 Binary files /dev/null and b/kratos.gid/images/time1.png differ diff --git a/kratos.gid/kratos.tcl b/kratos.gid/kratos.tcl index 6709fcfd5..78a1bfdeb 100644 --- a/kratos.gid/kratos.tcl +++ b/kratos.gid/kratos.tcl @@ -3,11 +3,14 @@ # Do not change anything here unless it's strictly necessary. ################################################################################## -namespace eval Kratos { +namespace eval ::Kratos { variable kratos_private - + variable must_write_calc_data variable must_exist_calc_data + + variable tmp_init_mesh_time + variable namespaces } # Hard minimum GiD Version is 14 @@ -16,25 +19,25 @@ if {[GidUtils::VersionCmp "14.0.1"] >=0 } { # GiD Developer versions proc GiD_Event_InitProblemtype { dir } { Kratos::Event_InitProblemtype $dir - } + } } { # GiD Official versions proc InitGIDProject { dir } { Kratos::Event_InitProblemtype $dir - } + } } } { - # GiD versions previous to 14 are no longer allowed + # GiD versions previous to 15 are no longer allowed # As we dont register the event InitProblemtype, the rest of events are also unregistered # So no chance to open anything in GiD 13.x or earlier - WarnWin "The minimum GiD Version for Kratos is 14 or later \nUpdate at gidhome.com" + WarnWin "The minimum GiD Version for Kratos is 15 or later \nUpdate at gidhome.com" } proc Kratos::Events { } { variable kratos_private # Recommended GiD Version is the latest developer always - if {[GidUtils::VersionCmp "14.1.4d"] <0 } { + if {[GidUtils::VersionCmp "15.0.0"] <0 } { set dir [file dirname [info script]] uplevel #0 [list source [file join $kratos_private(Path) scripts DeprecatedEvents.tcl]] Kratos::ModifyPreferencesWindowOld @@ -46,68 +49,76 @@ proc Kratos::Events { } { proc Kratos::RegisterGiDEvents { } { # Unregister previous events GiD_UnRegisterEvents PROBLEMTYPE Kratos - + # Init / Load # After new gid project #GiD_RegisterEvent GiD_Event_InitProblemtype Kratos::Event_InitProblemtype PROBLEMTYPE Kratos GiD_RegisterEvent GiD_Event_LoadModelSPD Kratos::Event_LoadModelSPD PROBLEMTYPE Kratos - + # Groups / Layers GiD_RegisterEvent GiD_Event_AfterRenameGroup Kratos::Event_AfterRenameGroup PROBLEMTYPE Kratos - + # Mesh GiD_RegisterEvent GiD_Event_BeforeMeshGeneration Kratos::Event_BeforeMeshGeneration PROBLEMTYPE Kratos + GiD_RegisterEvent GiD_Event_MeshProgress Kratos::Event_MeshProgress PROBLEMTYPE Kratos GiD_RegisterEvent GiD_Event_AfterMeshGeneration Kratos::Event_AfterMeshGeneration PROBLEMTYPE Kratos - + # Write - Calculation GiD_RegisterEvent GiD_Event_AfterWriteCalculationFile Kratos::Event_AfterWriteCalculationFile PROBLEMTYPE Kratos GiD_RegisterEvent GiD_Event_BeforeRunCalculation Kratos::Event_BeforeRunCalculation PROBLEMTYPE Kratos - + GiD_RegisterEvent GiD_Event_SelectGIDBatFile Kratos::Event_SelectGIDBatFile PROBLEMTYPE Kratos + # Postprocess GiD_RegisterEvent GiD_Event_InitGIDPostProcess Kratos::Event_InitGIDPostProcess PROBLEMTYPE Kratos GiD_RegisterEvent GiD_Event_EndGIDPostProcess Kratos::Event_EndGIDPostProcess PROBLEMTYPE Kratos - + # Save GiD_RegisterEvent GiD_Event_BeforeSaveGIDProject Kratos::Event_BeforeSaveGIDProject PROBLEMTYPE Kratos GiD_RegisterEvent GiD_Event_SaveModelSPD Kratos::Event_SaveModelSPD PROBLEMTYPE Kratos - + # Extra GiD_RegisterEvent GiD_Event_ChangedLanguage Kratos::Event_ChangedLanguage PROBLEMTYPE Kratos - + # End GiD_RegisterEvent GiD_Event_EndProblemtype Kratos::Event_EndProblemtype PROBLEMTYPE Kratos - + # Preferences window - GiD_RegisterPluginPreferencesProc Kratos::Event_ModifyPreferencesWindow + GiD_RegisterPluginPreferencesProc Kratos::Event_ModifyPreferencesWindow + CreateWidgetsFromXml::ClearCachePreferences } proc Kratos::Event_InitProblemtype { dir } { variable kratos_private - + # Init Kratos problemtype global vars with default values Kratos::InitGlobalVariables $dir # Load all common tcl files (not the app ones) Kratos::LoadCommonScripts - + # GiD Versions earlier than recommended get a message Kratos::WarnAboutMinimumRecommendedGiDVersion # Register the rest of events Kratos::Events - + # Start the log and register the initial information Kratos::LogInitialData # Problemtype libraries as CustomLib Kratos::LoadProblemtypeLibraries + # Load launch modes + Kratos::LoadLaunchModes + # Load the Kratos problemtype global and user environment (stored preferences) Kratos::LoadEnvironment + Kratos::SetDefaultLaunchMode + # Customize GiD menus to add the Kratos entry Kratos::UpdateMenus - + # Start the spd as new project. Mandatory even if we are opening an old case, because this loads the default spd for the future transform spdAux::StartAsNewProject @@ -117,21 +128,23 @@ proc Kratos::Event_InitProblemtype { dir } { #open a window to allow the user select the app after 500 [list spdAux::CreateWindow] } + + Kratos::CheckDependencies } proc Kratos::InitGlobalVariables {dir} { variable kratos_private - + # clean and start private variables array unset -nocomplain kratos_private set kratos_private(Path) $dir - + # This variables allows us to Write only and to run only variable must_write_calc_data set must_write_calc_data 1 variable must_exist_calc_data set must_exist_calc_data 1 - + # User environment (stored for future sessions) # DevMode in preferences window set kratos_private(DevMode) "release" ; #can be dev or release @@ -139,6 +152,19 @@ proc Kratos::InitGlobalVariables {dir} { set kratos_private(echo_level) 0 # indent in mdpa files | 0 ASCII unindented | 1 ASCII indented pretty set kratos_private(mdpa_format) 1 + # kratos debug env for VSCode debug + set kratos_private(debug_folder) "" + # Version of the kratos executable + set kratos_private(exec_version) "dev" + # Allow logs -> 0 No | 1 Only local | 2 Share with dev team + set Kratos::kratos_private(allow_logs) 1 + # git hash of the problemtype + set Kratos::kratos_private(problemtype_git_hash) 0 + # Place were the logs will be placed + set Kratos::kratos_private(model_log_folder) "" + # Check exec/launch.json + set Kratos::kratos_private(configurations) [list ] + set Kratos::kratos_private(launch_configuration) "" # Variable to store the Kratos menu items set kratos_private(MenuItems) [dict create] @@ -152,43 +178,62 @@ proc Kratos::InitGlobalVariables {dir} { set kratos_private(UseWizard) 0 # Project New 1/0 set kratos_private(ProjectIsNew) 1 + # Is using files modules + set kratos_private(UseFiles) 0 # Variables from the problemtype definition (kratos.xml) array set kratos_private [ReadProblemtypeXml [file join $kratos_private(Path) kratos.xml] Infoproblemtype {Name Version CheckMinimumGiDVersion}] + + variable namespaces + set namespaces [list ] + + variable pip_packages_required + set pip_packages_required [list KratosMultiphysics KratosFluidDynamicsApplication KratosConvectionDiffusionApplication \ + KratosDEMApplication numpy KratosDamApplication KratosSwimmingDEMApplication KratosStructuralMechanicsApplication KratosMeshMovingApplication \ + KratosMappingApplication KratosParticleMechanicsApplication KratosLinearSolversApplication KratosContactStructuralMechanicsApplication \ + KratosFSIApplication==9.0.3] + #set pip_packages_required KratosMultiphysics-all==9.0.2 } proc Kratos::LoadCommonScripts { } { variable kratos_private - + # append to auto_path only folders that must include tcl packages (loaded on demand with package require mechanism) if { [lsearch -exact $::auto_path [file join $kratos_private(Path) scripts]] == -1 } { lappend ::auto_path [file join $kratos_private(Path) scripts] } - + if { [lsearch -exact $::auto_path [file join $kratos_private(Path) libs]] == -1 } { + lappend ::auto_path [file join $kratos_private(Path) libs] + } + # Writing common scripts - foreach filename {Writing.tcl WriteHeadings.tcl WriteMaterials.tcl WriteNodes.tcl - WriteElements.tcl WriteConditions.tcl WriteConditionsByGiDId.tcl WriteConditionsByUniqueId.tcl - WriteProjectParameters.tcl WriteSubModelPart.tcl WriteProcess.tcl} { - uplevel #0 [list source [file join $kratos_private(Path) scripts Writing $filename]] + foreach filename {Writing WriteHeadings WriteMaterials WriteNodes + WriteElements WriteConditions WriteConditionsByGiDId WriteConditionsByUniqueId + WriteProjectParameters WriteSubModelPart WriteProcess} { + uplevel #0 [list source [file join $kratos_private(Path) scripts Writing $filename.tcl]] } # Common scripts - foreach filename {Utils.tcl Logs.tcl Applications.tcl spdAuxiliar.tcl Menus.tcl Deprecated.tcl} { - uplevel #0 [list source [file join $kratos_private(Path) scripts $filename]] + foreach filename {Utils Launch Applications spdAuxiliar Menus Deprecated Logs} { + uplevel #0 [list source [file join $kratos_private(Path) scripts $filename.tcl]] } # Common controllers - foreach filename {ApplicationMarketWindow.tcl CommonProcs.tcl PreferencesWindow.tcl TreeInjections.tcl MdpaImportMesh.tcl} { - uplevel #0 [list source [file join $kratos_private(Path) scripts Controllers $filename]] + foreach filename {ApplicationMarketWindow ExamplesWindow CommonProcs PreferencesWindow TreeInjections MdpaImportMesh Drawer ImportFiles} { + uplevel #0 [list source [file join $kratos_private(Path) scripts Controllers $filename.tcl]] } # Model class - foreach filename {Model.tcl Entity.tcl Parameter.tcl Topology.tcl Solver.tcl ConstitutiveLaw.tcl Condition.tcl Element.tcl Material.tcl SolutionStrategy.tcl Process.tcl} { - uplevel #0 [list source [file join $kratos_private(Path) scripts Model $filename]] + foreach filename {Model Entity Parameter Topology Solver ConstitutiveLaw Condition Element Material SolutionStrategy Process} { + uplevel #0 [list source [file join $kratos_private(Path) scripts Model $filename.tcl]] } # Libs - foreach filename {SimpleXMLViewer.tcl FileManager.tcl } { - uplevel #0 [list source [file join $kratos_private(Path) libs $filename]] + foreach filename {SimpleXMLViewer} { + uplevel #0 [list source [file join $kratos_private(Path) libs $filename.tcl]] } } proc Kratos::Event_LoadModelSPD { filespd } { + after 1 [list Kratos::LoadModelSPD $filespd] +} + +proc Kratos::LoadModelSPD { filespd } { variable kratos_private # Event called if a model exists, so close all the windows while tree isn't loaded @@ -200,10 +245,10 @@ proc Kratos::Event_LoadModelSPD { filespd } { # Need this check for old gid compatibility. Sometimes this event was called by mistake. Kratos::CheckProjectIsNew $filespd - + # If the spd file does not exist, sorry if { ![file exists $filespd] } { WarnWin "Could not find the spd file\n$filespd" ;return } - + #### TRANSFORM SECTION #### # Need transform? Define concepts: Model spd = old version || Problemtype spd = new version || Result of transform == Valid spd # Get PT version @@ -213,11 +258,13 @@ proc Kratos::Event_LoadModelSPD { filespd } { set old_doc [gid_groups_conds::open_XML_file_gzip $filespd] set old_root [$old_doc documentElement] set old_versionData [$old_root @version] - + set version_data [dict create model_version $old_versionData ] + Kratos::Log "Load model -> [write::tcl2json $version_data]" + # Compare the version number if { [package vcompare $versionPT $old_versionData] != 0 } { # If the spd versions are different, transform (no matter which is greater) - + # Do the transform after idle [list Kratos::TransformProblemtype $old_root ${filespd}] @@ -229,7 +276,7 @@ proc Kratos::Event_LoadModelSPD { filespd } { # Refresh the cache customlib::UpdateDocument - + # Load default files (if any) (file selection values store the filepaths in the spd) spdAux::LoadModelFiles @@ -239,17 +286,27 @@ proc Kratos::Event_LoadModelSPD { filespd } { # Reactive the previous app spdAux::reactiveApp + apps::ExecuteOnCurrentApp LoadModelEvent $filespd + # Open the tree spdAux::OpenTree + + after 500 {set ::Kratos::kratos_private(model_log_folder) [file join [GiD_Info Project ModelName].gid Logs]} } + } proc Kratos::Event_EndProblemtype { } { + Kratos::Log "End session" # New event system need an unregister if {[GidUtils::VersionCmp "14.1.4d"] >= 0 } { GiD_UnRegisterEvents PROBLEMTYPE Kratos + GiD_UnRegisterPluginPreferencesProc Kratos::Event_ModifyPreferencesWindow } if {[array exists ::Kratos::kratos_private]} { + # Close the log and moves them to the folder + Kratos::FlushLog + # Restore GiD variables that were modified by kratos and must be restored (maybe mesher) Kratos::RestoreVariables @@ -270,16 +327,22 @@ proc Kratos::Event_EndProblemtype { } { # Clear private global variable unset -nocomplain ::Kratos::kratos_private + } + Drawer::UnregisterAll + + # Clear namespaces + Kratos::DestroyNamespaces } proc Kratos::RestoreVariables { } { variable kratos_private - + # Restore GiD variables that kratos modified (maybe the mesher...) if {[info exists kratos_private(RestoreVars)]} { foreach {k v} $kratos_private(RestoreVars) { + # W "$k $v" set $k $v } } @@ -291,7 +354,7 @@ proc Kratos::AddRestoreVar {varName} { # Add a variable (and value) to the list of variables that will be restored before exiting if {[info exists $varName]} { - set val [set $varName] + set val [set $varName] lappend kratos_private(RestoreVars) $varName $val } } @@ -303,11 +366,18 @@ proc Kratos::LoadWizardFiles { } { package require gid_smart_wizard Kratos::UpdateMenus } +proc Kratos::LoadImportFiles { } { + variable kratos_private + # Load the wizard package + set kratos_private(UseFiles) 1 + package require gid_pt_file_manager + Kratos::UpdateMenus +} proc Kratos::TransformProblemtype {old_dom old_filespd} { # Check if current problemtype allows transforms if {[GiDVersionCmp 14.1.1d] < 0} { W "The minimum GiD version for a transform is '14.1.1d'\n Click Ok to try it anyway (You may lose data)" } - + # set ::Kratos_AskToTransform to 0 to not not ask if transform and old model, and automatically act like ok was pressed (e.g. to automatize in batch) if { ![info exists ::Kratos_AskToTransform] || $::Kratos_AskToTransform } { # Ask the user if it's ready to tranform @@ -323,7 +393,7 @@ proc Kratos::TransformProblemtype {old_dom old_filespd} { set old_activeapp [get_domnode_attribute $old_activeapp_node v] } else { WarnWin "Unable to get the active application in your model" - return "" + return "" } # Get the old dimmension set old_nd [ [$old_dom selectNodes "value\[@n='nDim'\]"] getAttribute v] @@ -333,7 +403,7 @@ proc Kratos::TransformProblemtype {old_dom old_filespd} { # Load the previous files (file selection values store the filepaths in the spd) spdAux::LoadModelFiles $old_dom - + # Refresh the cache customlib::UpdateDocument @@ -342,7 +412,7 @@ proc Kratos::TransformProblemtype {old_dom old_filespd} { # Prepare the new spd (and model) active application apps::setActiveApp $old_activeapp - apps::ExecuteOnCurrentXML CustomTree "" + apps::ExecuteOnCurrentXML CustomTree "" # Call to customlib transform and pray gid_groups_conds::transform_problemtype $old_filespd @@ -356,13 +426,15 @@ proc Kratos::TransformProblemtype {old_dom old_filespd} { proc Kratos::Event_BeforeMeshGeneration {elementsize} { # Prepare things before meshing - - + variable tmp_init_mesh_time + set inittime [clock seconds] + set tmp_init_mesh_time $inittime + Kratos::Log "Mesh BeforeMeshGeneration start" GiD_Process Mescape Meshing MeshCriteria NoMesh Lines 1:end escape escape escape GiD_Process Mescape Meshing MeshCriteria NoMesh Surfaces 1:end escape escape escape GiD_Process Mescape Meshing MeshCriteria NoMesh Volumes 1:end escape escape escape - # We need to mesh every line and surface assigned to a group that appears in the tree + # We need to mesh every line and surface assigned to a group that appears in the tree foreach group [spdAux::GetAppliedGroups] { GiD_Process Mescape Meshing MeshCriteria Mesh Lines {*}[GiD_EntitiesGroups get $group lines] escape escape escape GiD_Process Mescape Meshing MeshCriteria Mesh Surfaces {*}[GiD_EntitiesGroups get $group surfaces] escape escape escape @@ -370,12 +442,26 @@ proc Kratos::Event_BeforeMeshGeneration {elementsize} { } # Maybe the current application needs to do some extra job set ret [apps::ExecuteOnCurrentApp BeforeMeshGeneration $elementsize] + set endtime [clock seconds] + set ttime [expr {$endtime-$inittime}] + Kratos::Log "Mesh BeforeMeshGeneration end in [Duration $ttime]" return $ret } +proc Kratos::Event_MeshProgress { total_percent partial_percents_0 partial_percents_1 partial_percents_2 partial_percents_3 n_nodes n_elems } { + # Maybe the current application needs to do some extra job + apps::ExecuteOnCurrentApp MeshProgress $total_percent $partial_percents_0 $partial_percents_1 $partial_percents_2 $partial_percents_3 $n_nodes n_elems +} + proc Kratos::Event_AfterMeshGeneration {fail} { + variable tmp_init_mesh_time # Maybe the current application needs to do some extra job apps::ExecuteOnCurrentApp AfterMeshGeneration $fail + set endtime [clock seconds] + set ttime [expr {$endtime-$tmp_init_mesh_time}] + Kratos::Log "Mesh end process in [Duration $ttime]" + set mesh_data [Kratos::GetMeshBasicData] + Kratos::Log "Mesh data -> [write::tcl2json $mesh_data]" } proc Kratos::Event_AfterRenameGroup { oldname newname } { @@ -405,7 +491,7 @@ proc Kratos::Event_EndGIDPostProcess {} { proc Kratos::Event_BeforeRunCalculation { batfilename basename dir problemtypedir gidexe args } { # Let's launch the Kratos rocket! set run 1 - + catch { # If the user selected MPI, stop it! set paralleltype [write::getValue ParallelType] @@ -415,6 +501,17 @@ proc Kratos::Event_BeforeRunCalculation { batfilename basename dir problemtypedi if {!$run} { return [list "-cancel-" [= "You have selected MPI parallelism system.\nInput files have been written.\nRun the MPILauncher.sh script" ]] } + set app_run_brake [apps::ExecuteOnCurrentApp BreakRunCalculation] + if {[write::isBooleanTrue $app_run_brake]} {return "-cancel-"} + +} + +proc Kratos::Event_SelectGIDBatFile { dir basename } { + if {[info exists Kratos::kratos_private(launch_configuration)]} { + set launch_mode $Kratos::kratos_private(launch_configuration) + ::GidUtils::SetWarnLine "Launch mode: $launch_mode" + return [Kratos::ExecuteLaunchByMode $launch_mode] + } } proc Kratos::Event_AfterWriteCalculationFile { filename errorflag } { @@ -422,10 +519,11 @@ proc Kratos::Event_AfterWriteCalculationFile { filename errorflag } { if {$Kratos::must_write_calc_data} { set errcode [Kratos::WriteCalculationFilesEvent $filename] if {$errcode} {return "-cancel-"} - } + } } proc Kratos::WriteCalculationFilesEvent { {filename ""} } { + # W "Kratos::WriteCalculationFilesEvent" # Write the calculation files (mdpa, json...) if {$filename eq ""} { # Model must be saved @@ -437,14 +535,14 @@ proc Kratos::WriteCalculationFilesEvent { {filename ""} } { } } # The calculation process may need the files of the file selector entries inside the model folder - FileSelector::CopyFilesIntoModel [file dirname $filename] + if {$Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file dirname $filename]} # Start the write configuration clean write::Init - + # Start the writing process set errcode [::write::writeEvent $filename] - + # Kindly inform the user if {$errcode} { ::GidUtils::SetWarnLine "Error writing mdpa or json" @@ -457,7 +555,7 @@ proc Kratos::WriteCalculationFilesEvent { {filename ""} } { proc Kratos::Event_BeforeSaveGIDProject { modelname} { # There are some restrictions in the filenames set fail [::Kratos::CheckValidProjectName $modelname] - + if {$fail} { W [= "Wrong project name. Avoid boolean and numeric names."] return "-cancel-" @@ -472,9 +570,18 @@ proc Kratos::Event_SaveModelSPD { filespd } { Kratos::RegisterEnvironment # User files (in file selectors) copied into the model (if required) - FileSelector::CopyFilesIntoModel [file dirname $filespd] + if {$Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file dirname $filespd]} + + # Let the current app implement it's Save event + apps::ExecuteOnCurrentApp AfterSaveModel $filespd + + # Log it + set Kratos::kratos_private(model_log_folder) [file join [GiD_Info Project ModelName].gid Logs] + Kratos::Log "Save model [file tail $filespd ]" + } + proc Kratos::Event_ChangedLanguage { newlan } { Kratos::UpdateMenus } @@ -488,10 +595,25 @@ proc Kratos::Quicktest {example_app example_dim example_cmd} { # We can only test examples from the Examples app apps::setActiveApp Examples - + # So launch the example ::Examples::LaunchExample $example_app $example_dim $example_cmd # And close the windows Kratos::DestroyWindows } + +proc Kratos::AddNamespace { namespace_name } { + variable namespaces + lappend namespaces $namespace_name + +} + +proc Kratos::DestroyNamespaces { } { + variable namespaces + + foreach name $namespaces { + catch {namespace delete $name} + } + uplevel #0 [list namespace delete ::Kratos] +} \ No newline at end of file diff --git a/kratos.gid/kratos.unix.bat b/kratos.gid/kratos.unix.bat index a32e79334..3ea4ad5d3 100755 --- a/kratos.gid/kratos.unix.bat +++ b/kratos.gid/kratos.unix.bat @@ -45,4 +45,4 @@ else fi # Run Python using the script MainKratos.py -"$3/exec/Kratos/runkratos" MainKratos.py > "$2/$1.info" 2> "$2/$1.err" +python3 MainKratos.py > "$2/$1.info" 2> "$2/$1.err" diff --git a/kratos.gid/kratos.unix_release.bat b/kratos.gid/kratos.unix_release.bat index 4f8b7547b..b81b0283d 100755 --- a/kratos.gid/kratos.unix_release.bat +++ b/kratos.gid/kratos.unix_release.bat @@ -24,6 +24,10 @@ else export LD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs" fi +# Mpi +export PWD=`pwd` +export OPAL_PREFIX="$PWD/exec/Kratos/OpenMPI" + # Prevents the PYTHONHOME error from happening and isolate possible python repacks present # in the system and interfeering with runkratos export PYTHONHOME="$3/exec/Kratos" diff --git a/kratos.gid/kratos.xml b/kratos.gid/kratos.xml index 33d28da6c..81386b6ce 100644 --- a/kratos.gid/kratos.xml +++ b/kratos.gid/kratos.xml @@ -3,9 +3,9 @@ Kratos - 7.1.6 + 9.0.1 - 14.1.2d + 15.1.3d 0 1 images/ImageFileBrowser.gif @@ -44,51 +44,6 @@ Kratos is OPEN SOURCE. The main code and program structure is available and aime Kratos is FREE because is devoted mainly to developers, researchers and students and, therefore, is the most fruitful way to share knowledge and built a robust numerical methods laboratory adapted to their users' needs. Free because you have the freedom to modify and distribute the software. The one thing you're not able to do with free software is take away other people's freedom. Please, read the license for more detailed information. - - * What is new? - * Solid: - - New examples - * Structural: - - Hinges - - Eigen analysis - - - * What is new? - * Bug fix - - - * What is new? - * Removed Dam Application due to Copyright issues - - - * What is new? - * FSI: - - Bug correction in the update utilities - - Removed deprecated Python FSI solvers - * Fixed display version number - - - * What is new? - * Several bug fixes in core and applications: - - Better MPI portability (Linux) - - More consistence support of json configuration file - * Structural Mechanic: - - Linear and nonlinear beam element (for small and large displacement) - - Linear and nonlinear truss element (for small and large displacement) - - Initial support for beam orientation - - Truss element now available - - New Hyperelastic Law - - Corrections in the Updated Lagrangian Element - - Membrane and shells of both 3 and 4 nodes now available - * Fluid Dynamics: - - Several improvements under the hood for the Embedded CFD solver - - New monolithic version of the embedded solver based on Ausas shape functions - - New slip model for embedded CFD - * FSI: - - Improved precision of the solvers - * Added Dam application - * New GUI - diff --git a/kratos.gid/kratos_default.spd b/kratos.gid/kratos_default.spd index 6ff0a2c53..639ab2ca2 100644 --- a/kratos.gid/kratos_default.spd +++ b/kratos.gid/kratos_default.spd @@ -1,6 +1,6 @@ - + @@ -9,7 +9,6 @@ - @@ -18,19 +17,21 @@ - + - - - + + + - + + + @@ -170,12 +171,19 @@ @@ -309,7 +317,24 @@ + + + + + + + diff --git a/kratos.gid/libs/FileManager.tcl b/kratos.gid/libs/FileManager.tcl deleted file mode 100644 index ffa9db1f6..000000000 --- a/kratos.gid/libs/FileManager.tcl +++ /dev/null @@ -1,173 +0,0 @@ -# Usage: -# source {E:\PROYECTOS\FileWizard\NativeFileManager\NativeFileOpener.tcl} -# FileSelector::InitWindow W -# FileSelector::InitWindow puts -# W $::FileSelector::files_to_model -# puts W $::FileSelector::files_to_model -# FileSelector::CopyFilesIntoModel {E:\TEMP\aaaa} - -namespace eval FileSelector { - variable selected_file - variable save_to_model - variable result_proc_name - variable result_proc_args - variable w - variable files_to_model - variable files_list -} - -proc FileSelector::Start {} { - variable selected_file - set selected_file "" - - variable result_proc_name - set result_proc_name "" - variable result_proc_args - set result_proc_args "" - - variable w - set w .gid.fileSelector - - variable files_to_model - set files_to_model [list ] - - variable files_list - set files_list [list ] -} -FileSelector::Start - -# PUBLIC FUNCTIONS -proc FileSelector::InitWindow {updateProcname args} { - set ::FileSelector::selected_file "" - set ::FileSelector::save_to_model 0 - variable result_proc_name - variable result_proc_args - set result_proc_name $updateProcname - set result_proc_args $args - FileSelector::_OpenFileSelector -} -proc FileSelector::FinishWindow {result} { - variable result_proc_name - variable result_proc_args - - if {$result} { - variable save_to_model - variable files_to_model - variable selected_file - variable files_list - - if {$save_to_model} { - lappend files_to_model $selected_file - set selected_file [file join . [file tail $selected_file] ] - } - lappend files_list $selected_file - $result_proc_name $selected_file $result_proc_args - } else { - $result_proc_name "" $result_proc_args - } - catch {variable w; destroy $w} -} - -proc FileSelector::CopyFilesIntoModel { dir } { - variable files_to_model - variable files_list - foreach f $files_to_model { - set files_list [lsearch -all -inline -not -exact $files_list $f] - file copy -force $f $dir - lappend files_list [file join $dir $f] - } - set files_to_model [list ] -} - -proc FileSelector::GetAllFiles { } { - variable files_list - return $files_list -} -proc FileSelector::AddFile { fileid } { - variable files_list - if {$fileid ne "" && $fileid ni $files_list} {lappend files_list $fileid} -} - - -# PRIVATE FUNCTIONS -proc FileSelector::_OpenFileSelector2 { } { - variable w - catch {destroy $w} - toplevel $w - wm title $w "Select a file" - wm minsize $w 400 200 - wm resizable $w 0 0 - # Top frame - set fr1 [ttk::frame $w.fr1 -borderwidth 10] - - # Label - set lab1 [ttk::label $fr1.lab1 -text {Filename: } -justify left -anchor w ] - grid $lab1 -row 0 -column 0 -sticky ew - - # Entry - grid [ttk::entry $fr1.ent1 -width 40 -textvariable ::FileSelector::selected_file] -column 1 -row 0 -sticky we; # -state readonly - - # Button browse - grid [ttk::button $fr1.browse -text "Browse" -command "set ::FileSelector::selected_file \[tk_getOpenFile\]" ] -column 2 -row 0 -sticky we - - # Checkbutton - grid [ttk::checkbutton $fr1.check -text "Save file into model?" -variable ::FileSelector::save_to_model] -column 0 -row 1 -columnspan 3 -sticky we - grid $fr1 -column 0 -row 0 -sticky nw - - # Bottom frame - set fr2 [ttk::frame $w.fr2 -borderwidth 10] - - # Button browse - grid [ttk::button $fr2.cancel -text "Cancel" -command [list FileSelector::FinishWindow 0 ]] -column 0 -row 0 -sticky w - grid [ttk::button $fr2.ok -text "Ok" -command [list FileSelector::FinishWindow 1] ] -column 1 -row 0 -sticky e - - grid $fr2 -column 0 -row 1 -sticky swe -} - -proc FileSelector::_OpenFileSelector { } { - variable w - ::InitWindow $w [_ "Select a file"] PreFileSelectorWindowGeom FileSelector - if { ![winfo exists $w] } return ;# windows disabled || usemorewindows == 0 - - # Top frame - set fr1 [ttk::frame $w.fr1 -borderwidth 10] - - # Label - set lab1 [ttk::label $fr1.lab1 -text {Filename: } -justify left -anchor w ] - grid $lab1 -row 0 -column 0 -sticky ew - - # Entry - grid [ttk::entry $fr1.ent1 -width 40 -textvariable ::FileSelector::selected_file] -column 1 -row 0 -sticky we; # -state readonly - - # Button browse - grid [ttk::button $fr1.browse -text "Browse" -command "set ::FileSelector::selected_file \[tk_getOpenFile\]" ] -column 2 -row 0 -sticky we - - # Checkbutton - grid [ttk::checkbutton $fr1.check -text "Save file into model?" -variable ::FileSelector::save_to_model] -column 0 -row 1 -columnspan 3 -sticky we - - grid $fr1 -column 0 -row 0 -sticky nw - - ttk::frame $w.but -style BottomFrame.TFrame - ttk::button $w.but.accept -text [_ "Apply"] -command "[list FileSelector::FinishWindow 1 ]" -underline 0 -style BottomFrame.TButton - ttk::button $w.but.close -text [_ "Close"] -command "[list FileSelector::FinishWindow 0 ]" -underline 0 -style BottomFrame.TButton - - - grid columnconfigure $w.fr1 1 -weight 1 - - grid $w.but.accept -row 1 -column 1 -padx 5 -pady 6 - grid $w.but.close -row 1 -column 3 -padx 5 -pady 6 - grid $w.but -row 4 -column 0 -sticky ews -columnspan 7 - if { $::tcl_version >= 8.5 } { grid anchor $w.but center } - - grid $w.but -row 3 -sticky ews -columnspan 7 - - grid columnconfigure $w 0 -weight 1 - grid rowconfigure $w 3 -weight 1 - # - ## Resize behavior management - #wm minsize $w 180 200 - - focus $w.but.accept - bind $w "$w.but.close invoke" - bind $w "$w.but.close invoke" -} \ No newline at end of file diff --git a/kratos.gid/libs/gid-pt-file-manager/LICENSE b/kratos.gid/libs/gid-pt-file-manager/LICENSE new file mode 100644 index 000000000..67afb7f1e --- /dev/null +++ b/kratos.gid/libs/gid-pt-file-manager/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 GiD + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/kratos.gid/libs/gid-pt-file-manager/README.md b/kratos.gid/libs/gid-pt-file-manager/README.md new file mode 100644 index 000000000..96ec9a5f6 --- /dev/null +++ b/kratos.gid/libs/gid-pt-file-manager/README.md @@ -0,0 +1 @@ +# gid-pt-file-manager \ No newline at end of file diff --git a/kratos.gid/libs/gid-pt-file-manager/gid_pt_file_manager.tcl b/kratos.gid/libs/gid-pt-file-manager/gid_pt_file_manager.tcl new file mode 100644 index 000000000..db1752ae7 --- /dev/null +++ b/kratos.gid/libs/gid-pt-file-manager/gid_pt_file_manager.tcl @@ -0,0 +1,272 @@ +package provide gid_pt_file_manager 1.0 + +# Usage: + # set FileSelector::callback_after_new_file "PFEM::xml::SaveModelFile" + # set FileSelector::callback_view_file "PFEM::xml::ViewFile" + # set FileSelector::callback_delete_file "PFEM::xml::DeleteFile" + # FileSelector::InitFileHandler + +namespace eval ::FileSelector { + + + variable selected_file + variable save_to_model + variable w + variable w_list + variable files_to_model + variable files_list + + variable callback_after_new_file + variable callback_view_file + variable callback_delete_file +} + +proc ::FileSelector::Start {} { + variable selected_file + set selected_file "" + + variable w + set w .gid.fileSelector + variable w_list + set w_list .gid.fileList + + variable files_to_model + set files_to_model [list ] + + variable files_list + set files_list [list ] +} +FileSelector::Start + +# PUBLIC FUNCTIONS +proc ::FileSelector::InitFileHandler { } { + + variable w_list + catch {destroy $w_list} + toplevel $w_list + wm title $w_list "File handler" + wm minsize $w_list 400 200 + wm resizable $w_list 0 0 + + ttk::frame $w_list.frame#2 -style groove.TFrame -borderwidth 3 + ttk::frame $w_list.frame#6 -style BottomFrame.TFrame + ttk::frame $w_list.frame#1 -borderwidth 2 -style groove.TFrame + label $w_list.label#1 -text [_ "File name"] + listbox $w_list.listbox#1 \ + -height 8 \ + -width 40 \ + -xscrollcommand "$w_list.scrollbar#1 set" \ + -yscrollcommand "$w_list.scrollbar#2 set" -selectmode single + + ttk::scrollbar $w_list.scrollbar#2 -command [list $w_list.listbox#1 yview] -orient vertical + ttk::scrollbar $w_list.scrollbar#1 -command [list $w_list.listbox#1 xview] -orient horizontal + + menu $w_list.runprocmenu + bind $w_list.listbox#1 <1> "focus $w_list.listbox#1" + if { [esMac] } { + bind $w_list.listbox#1 <$::gid_central_button> "event generate $w_list.listbox#1 <1> -rootx %X -rooty %Y ; ShowRunprocMenu $w_list %X %Y" + } else { + bind $w_list.listbox#1 <$::gid_right_button> "event generate $w_list.listbox#1 <1> -rootx %X -rooty %Y ; ShowRunprocMenu $w_list %X %Y" + } + + ttk::button $w_list.button#1 -text [_ "View file"] -command [list FileSelector::ViewFile] -style BottomFrame.TButton + ttk::button $w_list.button#2 -text [_ "Delete file"] -command [list FileSelector::DeleteFile] -style BottomFrame.TButton + + ttk::button $w_list.button#4 -text [_ "Add file"] -command [list FileSelector::InitWindow] -style BottomFrame.TButton + + focus $w_list.button#4 + ttk::button $w_list.button#5 -text [_ "Close"] -command [list destroy $w_list] -style BottomFrame.TButton + + # Geometry management + grid $w_list.frame#2 -in $w_list.frame#1 -row 4 -column 1 -sticky nw -padx 1 -pady 1 + grid $w_list.frame#6 -in $w_list -row 3 -column 1 -sticky ew + grid anchor $w_list.frame#6 center + grid $w_list.frame#1 -in $w_list -row 1 -column 1 -sticky nesw -columnspan 2 -padx 3 -pady 3 + grid $w_list.label#1 -in $w_list.frame#1 -row 1 -column 1 -sticky w -pady 3 -padx 3 + grid $w_list.listbox#1 -in $w_list.frame#1 -row 2 -column 1 -sticky nesw + grid $w_list.scrollbar#2 -in $w_list.frame#1 -row 2 -column 2 -sticky ns + grid $w_list.scrollbar#1 -in $w_list.frame#1 -row 3 -column 1 -sticky ew + grid $w_list.button#4 -in $w_list.frame#2 -row 1 -column 1 -sticky w -padx 3 + grid $w_list.button#1 -in $w_list.frame#2 -row 1 -column 2 -sticky w -padx 3 + grid $w_list.button#2 -in $w_list.frame#2 -row 1 -column 3 -sticky w -padx 3 + + grid $w_list.button#5 -in $w_list.frame#6 -padx 3 -pady 3 + + grid columnconfigure $w_list.frame#2 "1 2" -weight 1 + + grid rowconfigure $w_list 1 -weight 1 + grid columnconfigure $w_list 1 -weight 1 + + grid rowconfigure $w_list.frame#1 2 -weight 1 + grid columnconfigure $w_list.frame#1 1 -weight 1 + + FileSelector::FillFileList +} + +# what can be: current or window +proc ::FileSelector::DeleteFile { } { + variable w_list + variable files_list + + set wbase $w_list + set w $w_list.listbox#1 + if { [$w size] == 1 } { $w sel set 0} + set sel [$w curselection] + if {$sel eq ""} {return ""} + set fil [$w get $sel] + set idx [lsearch $files_list $fil] + set files_list [lreplace $files_list $idx $idx] + FileSelector::FillFileList + + variable callback_delete_file + $callback_delete_file $fil +} + +proc ::FileSelector::ViewFile { } { + variable w_list + + set wbase $w_list + set w $w_list.listbox#1 + if { [$w size] == 1 } { $w sel set 0} + set sel [$w curselection] + if {$sel eq ""} {return ""} + set fil [$w get $sel] + + variable callback_view_file + $callback_view_file $fil +} + +proc ::FileSelector::FillFileList { } { + variable w_list + variable files_list + if { [GidUtils::AreWindowsDisabled] } { + return + } + if { ![winfo exists $w_list] } { + return + } + + $w_list.listbox#1 delete 0 end + foreach name $files_list { + $w_list.listbox#1 insert end $name + } +} + +proc ::FileSelector::InitWindow {} { + set ::FileSelector::selected_file "" + set ::FileSelector::save_to_model 0 + FileSelector::_OpenFileSelector +} + +proc ::FileSelector::FinishWindow {result} { + variable result_proc_name + variable result_proc_args + + if {$result} { + variable save_to_model + variable files_to_model + variable selected_file + variable files_list + + if {$save_to_model} { + lappend files_to_model $selected_file + set selected_file [file join . [file tail $selected_file] ] + + } + variable callback_after_new_file + if {$callback_after_new_file ne ""} {$callback_after_new_file $selected_file} + } + catch {variable w; destroy $w} + + variable w_list + + if { ![winfo exists $w_list] } { + return + } + FileSelector::FillFileList + + focus $w_list.button#4 + +} + +proc ::FileSelector::CopyFilesIntoModel { dir } { + variable files_to_model + # variable files_list + foreach f $files_to_model { + # set files_list [lsearch -all -inline -not -exact $files_list $f] + file copy -force $f $dir + #lappend files_list [file join $dir $f] + } + set files_to_model [list ] +} + +proc ::FileSelector::GetAllFiles { } { + variable files_list + return $files_list +} +proc ::FileSelector::AddFile { fileid } { + variable files_list + + if {$fileid ne "" && $fileid ni $files_list} { + lappend files_list $fileid + } +} + +proc ::FileSelector::ClearFileList { } { + variable files_list + set files_list [list ] +} + +# PRIVATE FUNCTIONS +proc ::FileSelector::_OpenFileSelector { } { + variable w + ::InitWindow $w [_ "Select a file"] PreFileSelectorWindowGeom FileSelector + if { ![winfo exists $w] } return ;# windows disabled || usemorewindows == 0 + + # Top frame + set fr1 [ttk::frame $w.fr1 -borderwidth 10] + + # Label + set lab1 [ttk::label $fr1.lab1 -text {Filename: } -justify left -anchor w ] + grid $lab1 -row 0 -column 0 -sticky ew + + # Entry + grid [ttk::entry $fr1.ent1 -width 40 -textvariable ::FileSelector::selected_file] -column 1 -row 0 -sticky we; # -state readonly + + # Button browse + grid [ttk::button $fr1.browse -text "Browse" -command "set ::FileSelector::selected_file \[tk_getOpenFile\]" ] -column 2 -row 0 -sticky we + + # Checkbutton + set ::FileSelector::save_to_model 1 + grid [ttk::label $fr1.check -text "File will be copied into your model folder" ] -column 0 -row 1 -columnspan 3 -sticky we + #grid [ttk::checkbutton $fr1.check -text "Save file into model?" -variable ::FileSelector::save_to_model] -column 0 -row 1 -columnspan 3 -sticky we + + grid $fr1 -column 0 -row 0 -sticky nw + + ttk::frame $w.but -style BottomFrame.TFrame + ttk::button $w.but.accept -text [_ "Apply"] -command "[list FileSelector::FinishWindow 1 ]" -underline 0 -style BottomFrame.TButton + ttk::button $w.but.close -text [_ "Close"] -command "[list FileSelector::FinishWindow 0 ]" -underline 0 -style BottomFrame.TButton + + + grid columnconfigure $w.fr1 1 -weight 1 + + grid $w.but.accept -row 1 -column 1 -padx 5 -pady 6 + grid $w.but.close -row 1 -column 3 -padx 5 -pady 6 + grid $w.but -row 4 -column 0 -sticky ews -columnspan 7 + if { $::tcl_version >= 8.5 } { grid anchor $w.but center } + + grid $w.but -row 3 -sticky ews -columnspan 7 + + grid columnconfigure $w 0 -weight 1 + grid rowconfigure $w 3 -weight 1 + # + ## Resize behavior management + #wm minsize $w 180 200 + + focus $w.but.accept + bind $w "$w.but.close invoke" + bind $w "$w.but.close invoke" +} +set FileSelector::callback_after_new_file "" +set FileSelector::callback_view_file "" +set FileSelector::callback_delete_file "" \ No newline at end of file diff --git a/kratos.gid/libs/gid-pt-file-manager/pkgIndex.tcl b/kratos.gid/libs/gid-pt-file-manager/pkgIndex.tcl new file mode 100644 index 000000000..cc7fc27de --- /dev/null +++ b/kratos.gid/libs/gid-pt-file-manager/pkgIndex.tcl @@ -0,0 +1,2 @@ + +package ifneeded gid_pt_file_manager 1.0 [list source [file join $dir gid_pt_file_manager.tcl]] diff --git a/kratos.gid/scripts/Applications.tcl b/kratos.gid/scripts/Applications.tcl index 67af6d9b6..1049e5b5d 100644 --- a/kratos.gid/scripts/Applications.tcl +++ b/kratos.gid/scripts/Applications.tcl @@ -3,7 +3,9 @@ # Do not change anything here unless it's strictly necessary. ################################################################################## -namespace eval apps { +namespace eval ::apps { + Kratos::AddNamespace [namespace current] + variable activeApp variable appList } @@ -24,7 +26,7 @@ proc apps::ClearActiveApp {} { proc apps::setActiveApp {appid} { variable activeApp variable appList - + foreach app $appList { if {[$app getName] eq $appid} { set activeApp $app @@ -80,21 +82,37 @@ proc apps::NewApp {appid publicname prefix} { return $ap } -proc apps::getAllApplicationsName {} { +# also_tools => 0 all apps no tools | 1 all apps and tools | 2 only tools +proc apps::getAppsList {{also_tools 1}} { variable appList - - set appnames [list ] + set list [list ] foreach app $appList { + set is_tool [$app isTool] + set pass 0 + switch $also_tools { + 0 { if {!$is_tool} {set pass 1} } + 1 { set pass 1 } + 2 { if {$is_tool} {set pass 1} } + } + if {$pass} { + lappend list $app + } + } + return $list +} +proc apps::getAllApplicationsName {{also_tools 1}} { + + set appnames [list ] + foreach app [apps::getAppsList $also_tools] { lappend appnames [$app getPublicName] } return $appnames } -proc apps::getAllApplicationsID {} { - variable appList - +proc apps::getAllApplicationsID {{also_tools 1}} { + set appnames [list ] - foreach app $appList { + foreach app [apps::getAppsList $also_tools] { lappend appnames [$app getName] } return $appnames @@ -105,7 +123,7 @@ proc apps::getImgFrom { appName {img "logo" } } { } proc apps::getImgPathFrom { appName {img "logo" } } { variable appList - + set imagespath "" foreach app $appList { if {[$app getName] eq $appName} {set imagespath [expr {$img == "logo" ? [$app getIcon] : [$app getImagePath $img] }]; break} @@ -137,7 +155,7 @@ proc apps::ExecuteOnCurrentXML { func args} { proc apps::ExecuteOnAppXML { appid func args} { set response "" set app [getAppById $appid] - set response [$app executexml $func {*}$args] + set response [$app executexml $func {*}$args] return $response } @@ -145,7 +163,7 @@ proc apps::ExecuteOnAppXML { appid func args} { proc apps::ExecuteOnApp {appid func args} { set response "" set app [getAppById $appid] - set response [$app execute $func {*}$args] + set response [$app execute $func {*}$args] return $response } @@ -175,7 +193,7 @@ proc apps::isPublic {appId} { proc apps::CheckElemState {elem inputid {arg ""} } { variable activeApp - + return [$activeApp executexml CheckElemState $elem $inputid $arg] } @@ -192,7 +210,10 @@ oo::class create App { variable writeValidateEvent variable prefix variable release - + variable is_tool + + variable properties + constructor {n} { variable name variable publicname @@ -203,7 +224,9 @@ oo::class create App { variable writeValidateEvent variable prefix variable public - + variable is_tool + variable properties + set name $n set publicname $n set imagepath [file nativename [file join $::Kratos::kratos_private(Path) apps $n images] ] @@ -221,32 +244,33 @@ oo::class create App { append writeValidateEvent "::writeValidateEvent" set prefix "" set public 0 + set is_tool 0 + + set properties [dict create ] + apps::LoadAppProperties [self] } - - method activate { } { - variable name - apps::ActivateApp_do $name - } - + + method activate { } {apps::ActivateApp_do [self]} + method getPrefix { } {variable prefix; return $prefix} method setPrefix { p } {variable prefix; set prefix $p} - + method getPublicName { } {variable publicname; return $publicname} method setPublicName { pn } {variable publicname; set publicname $pn} - + method getName { } {variable name; return $name} - + method getIcon { } {return [my getImagePath logo.png]} method getImagePath { imgName } {variable imagepath; return [file nativename [file join $imagepath $imgName] ]} - + method getWriteModelPartEvent { } {variable writeModelPartEvent; return $writeModelPartEvent} - + method getWriteParametersEvent { } {variable writeParametersEvent; return $writeParametersEvent} - + method getWriteCustomEvent { } {variable writeCustomEvent; return $writeCustomEvent} method getValidateWriteEvent { } {variable writeValidateEvent; return $writeValidateEvent} - + method executexml { func args } { variable name set f ::${name}::xml::${func} @@ -257,33 +281,73 @@ oo::class create App { set f ::${name}::${func} if {[info procs $f] ne ""} {$f {*}$args} } - - method setPublic {v} { - variable public - set public $v + + method setPublic {v} {variable public; set public $v} + method isPublic { } {variable public; return $public} + + method setIsTool {v} {variable is_tool; set is_tool $v} + method isTool { } {variable is_tool; return $is_tool} + + method getKratosApplicationName { } {return [::${name}::GetAttribute kratos_name]} + + method setProperties {props} {variable properties; set properties $props} + method getProperty {n} {variable properties; if {[dict exists $properties $n]} {return [dict get $properties $n]}} + method getProperties {} {variable properties; return $properties} + method getPermission {n} {variable properties; if {[dict exists $properties permissions $n]} {return [dict get $properties permissions $n]} } + method getPermissions {} {variable properties; return [dict get $properties permissions]} + method getUniqueName {n} {variable properties; if {[dict exists $properties unique_names $n]} {return [dict get $properties unique_names $n]} } + method getUniqueNames {} {variable properties; return [dict get $properties unique_names} + method getWriteProperty {n} {variable properties; if {[dict exists $properties write $n]} {return [dict get $properties write $n]} } + method getWriteProperties {} {variable properties; return [dict get $properties write} +} + +proc apps::LoadAppProperties {app} { + set dir [file join $::Kratos::kratos_private(Path) apps [$app getName]] + set app_definition_file [file join $dir app.json] + if {[file exists $app_definition_file]} { + set props [Kratos::ReadJsonDict $app_definition_file] + $app setProperties $props + } else { + W "MISSING app.json file for app [$app getName]" } - method isPublic { } { - variable public - return $public +} + +proc apps::ActivateApp_do {app} { + set dir [file join $::Kratos::kratos_private(Path) apps [$app getName]] + # Load app dependences + if {[dict exists [$app getProperty requeriments] apps]} { + foreach app_id [dict get [$app getProperty requeriments] apps] { + apps::LoadAppById $app_id + } } - method getKratosApplicationName { } { - return [set ::${name}::kratos_name] + + # Then load the app files, so we can overwrite functions loaded in dependences + if {[$app getProperty script_files] ne ""} { + foreach source_file [$app getProperty script_files] { + set fileName [file join $dir $source_file] + apps::loadAppFile $fileName + } } -} -proc apps::ActivateApp_do {app_name} { - # set ::Kratos::must_quit 0 - set dir [file join $::Kratos::kratos_private(Path) apps $app_name] - set fileName [file join $dir start.tcl] - apps::loadAppFile $fileName + set app_minimum_gid_version [dict get [$app getProperty requeriments] minimum_gid_version] + if {[GiDVersionCmp $app_minimum_gid_version] < 0} {W "Caution. Minimum GiD version is $app_minimum_gid_version"} + if {[write::isBooleanTrue [$app getPermission import_files]]} { Kratos::LoadImportFiles } + if {[write::isBooleanTrue [$app getPermission wizard]]} { Kratos::LoadWizardFiles } + if {[$app getProperty start_script] ne ""} {eval [$app getProperty start_script] $app} + apps::ApplyAppPreferences $app + + if {[gid_themes::GetCurrentTheme] eq "GiD_black"} { set gid_groups_conds::imagesdirList [lsearch -all -inline -not -exact $gid_groups_conds::imagesdirList [list [file join $dir images]]] gid_groups_conds::add_images_dir [file join $dir images Black] - } + } gid_groups_conds::add_images_dir [file join $dir images] } -proc apps::loadAppFile {fileName} { - uplevel 2 [list source $fileName] +proc apps::ApplyAppPreferences {app} { + if {[write::isBooleanTrue [$app getPermission open_tree]]} {set spdAux::TreeVisibility 1} {set spdAux::TreeVisibility 0} + if {[$app getProperty dimensions] ne ""} { set ::Model::ValidSpatialDimensions [$app getProperty dimensions] } } +proc apps::loadAppFile {fileName} {uplevel #0 [list source $fileName]} + apps::Init diff --git a/kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl b/kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl index b7520e85b..04a4f4391 100644 --- a/kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl +++ b/kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl @@ -1,138 +1,135 @@ -proc spdAux::reactiveApp { } { - #W "Reactive" - variable initwind - if { ![GidUtils::IsTkDisabled] } { - if { [winfo exists $initwind] } { - destroy $initwind - } - } - set root [customlib::GetBaseRoot] - set ::Model::SpatialDimension [[$root selectNodes "value\[@n='nDim'\]"] getAttribute v ] - set appname [[$root selectNodes "hiddenfield\[@n='activeapp'\]"] @v ] - - apps::setActiveApp $appname -} - -proc spdAux::deactiveApp { appid } { - - set root [customlib::GetBaseRoot] - [$root selectNodes "hiddenfield\[@n='activeapp'\]"] setAttribute v "" - foreach elem [$root getElementsByTagName "appLink"] { - if {$appid eq [$elem getAttribute "appid"] && [$elem getAttribute "active"] eq "1"} { - $elem setAttribute "active" 0 - break - } - } -} -proc spdAux::activeApp { appid } { - #W "Active $appid" - variable initwind - catch { - set root [customlib::GetBaseRoot] - [$root selectNodes "hiddenfield\[@n='activeapp'\]"] setAttribute v $appid - foreach elem [$root getElementsByTagName "appLink"] { - if {$appid eq [$elem getAttribute "appid"] && [$elem getAttribute "active"] eq "0"} { - $elem setAttribute "active" 1 - set must_open_init_window 0 - } else { - $elem setAttribute "active" 0 - } - } - } - - set nd [$root selectNodes "value\[@n='nDim'\]"] - if {[$nd getAttribute v] ne "wait"} { - if {[$nd getAttribute v] ne "undefined"} { - set ::Model::SpatialDimension [$nd getAttribute v] - spdAux::SwitchDimAndCreateWindow $::Model::SpatialDimension - spdAux::TryRefreshTree - } { - ::spdAux::CreateDimensionWindow - } - } -} - -proc spdAux::SetActiveAppFromDOM { } { - set activeapp_dom "" - set root [customlib::GetBaseRoot] - set activeapp_node [$root selectNodes "//hiddenfield\[@n='activeapp'\]"] - if {$activeapp_node ne ""} { - set activeapp_dom [get_domnode_attribute $activeapp_node v] - if { $activeapp_dom != "" } { - apps::setActiveApp $activeapp_dom - } - } - return $activeapp_dom +namespace eval ::spdAux { + variable info_main_window_text + variable application_window_id + set application_window_id .gid.win_app_selection } proc spdAux::CreateWindow {} { variable initwind variable must_open_init_window + variable application_window_id + # No graphics, no window if { [GidUtils::IsTkDisabled] } { return 0 } + # Sometimes we dont need the window (load event) if {$must_open_init_window == 0} {return ""} + # If we have an active app, dont open this window if {[apps::getActiveApp] ne ""} {return ""} - gid_groups_conds::close_all_windows + # Window creation + set w $application_window_id + set initwind $w + # Close everything else + gid_groups_conds::close_all_windows spdAux::DestroyInitWindow - if {[winfo exist .gid.win_example]} {destroy .gid.win_example} - - set w .gid.win_example + if {[winfo exist $initwind]} {destroy $initwind} toplevel $w wm withdraw $w - set x [expr [winfo rootx .gid]+[winfo width .gid]/2-[winfo width $w]/2] set y [expr [winfo rooty .gid]+[winfo height .gid]/2-[winfo height $w]/2] - wm geom $w +$x+$y wm transient $w .gid - InitWindow $w [_ "Kratos Multiphysics"] Kratos "" "" 1 - set initwind $w + InitWindow $w [_ "Kratos Multiphysics - Application market"] Kratos "" "" 1 + ttk::frame $w.top - ttk::label $w.top.title_text -text [_ " Application market"] - ttk::frame $w.information -relief ridge + spdAux::RegisterWindow $initwind - set appsid [::apps::getAllApplicationsID] - set appspn [::apps::getAllApplicationsName] + # List of applications -> by family + ttk::labelframe $w.applications -text " Applications " -relief ridge + + set appsid [::apps::getAllApplicationsID 0] + set appspn [::apps::getAllApplicationsName 0] set col 0 set row 0 foreach appname $appspn appid $appsid { if {[apps::isPublic $appid]} { set img [::apps::getImgFrom $appid] - ttk::button $w.information.img$appid -image $img -command [list apps::setActiveApp $appid] - ttk::label $w.information.text$appid -text $appname + ttk::button $w.applications.img$appid -image $img -command [list apps::setActiveApp $appid] + ttk::label $w.applications.text$appid -text $appname + + grid $w.applications.img$appid -column $col -row $row + grid $w.applications.text$appid -column $col -row [expr $row +1] - grid $w.information.img$appid -column $col -row $row - grid $w.information.text$appid -column $col -row [expr $row +1] + bind $w.applications.img$appid {::spdAux::PlaceInformationWindowByPath %W applications} + + incr col + if {$col >= 5} {set col 0; incr row; incr row} + } + } + + # List of tools + ttk::labelframe $w.tools -text " Tools " -relief ridge + set toolsid [::apps::getAllApplicationsID 2] + set toolspn [::apps::getAllApplicationsName 2] + set col 0 + set row 0 + foreach toolname $toolspn toolid $toolsid { + if {[apps::isPublic $toolid]} { + set img [::apps::getImgFrom $toolid] + set img_button $w.tools.img$toolid + ttk::button $img_button -image $img -command [list apps::setActiveApp $toolid] + ttk::label $w.tools.text$toolid -text $toolname + grid $img_button -column $col -row $row + grid $w.tools.text$toolid -column $col -row [expr $row +1] + bind $w.tools.img$toolid {::spdAux::PlaceInformationWindowByPath %W tools} + incr col if {$col >= 5} {set col 0; incr row; incr row} } } # More button - if {$::Kratos::kratos_private(DevMode) eq "dev"} { + if {[Kratos::IsDeveloperMode]} { set more_path [file nativename [file join $::Kratos::kratos_private(Path) images "more.png"] ] set img [gid_themes::GetImage $more_path Kratos] - ttk::button $w.information.img_more -image $img -command [list VisitWeb "https://github.com/KratosMultiphysics/GiDInterface"] - ttk::label $w.information.text_more -text "More..." - - grid $w.information.img_more -column $col -row $row - grid $w.information.text_more -column $col -row [expr $row +1] + ttk::button $w.tools.img_more -image $img -command [list VisitWeb "https://github.com/KratosMultiphysics/GiDInterface"] + ttk::label $w.tools.text_more -text "More..." + + grid $w.tools.img_more -column $col -row $row + grid $w.tools.text_more -column $col -row [expr $row +1] + incr col + if {$col >= 5} {set col 0; incr row; incr row} } + + # Information panel + ttk::labelframe $w.info -text " Information " -relief ridge + ttk::label $w.info.text -textvariable spdAux::info_main_window_text + grid $w.info.text + + # Settings + set settings_path [file nativename [file join $::Kratos::kratos_private(Path) images "settings.png"] ] + set img [gid_themes::GetImage $settings_path Kratos] + if {[GidUtils::VersionCmp "14.1.4d"] <0 } { set cmd [list ChangeVariables kratos_preferences] } {set cmd [list PreferencesWindow kratos_preferences]} + ttk::button $w.tools.img_preferences -image $img -command $cmd + ttk::label $w.tools.text_preferences -text "Preferences" + grid $w.tools.img_preferences -column $col -row $row + grid $w.tools.text_preferences -column $col -row [expr $row +1] + incr col + if {$col >= 5} {set col 0; incr row; incr row} grid $w.top - grid $w.top.title_text + # grid $w.top.title_text - grid $w.information + grid $w.applications + grid $w.tools -columnspan 5 -sticky w + grid $w.info -columnspan 5 -sticky we +} + +proc spdAux::PlaceInformationWindowByPath {win_path what} { + variable application_window_id + set app_id [string trimleft $win_path $application_window_id.$what.img] + set app [::apps::getAppById $app_id] + set description [$app getProperty description] + set ::spdAux::info_main_window_text $description } proc spdAux::DestroyInitWindow { } { @@ -141,12 +138,11 @@ proc spdAux::DestroyInitWindow { } { } proc spdAux::CreateDimensionWindow { } { - #package require anigif 1.3 - variable initwind variable must_open_dim_window if {$must_open_dim_window == 0} {return ""} - + + spdAux::DestroyWindows set root [customlib::GetBaseRoot] set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v] @@ -161,7 +157,7 @@ proc spdAux::CreateDimensionWindow { } { } set dir $::Kratos::kratos_private(Path) - set initwind .gid.win_example + set initwind .gid.win_dimension if { [ winfo exist $initwind]} { destroy $initwind } @@ -178,6 +174,7 @@ proc spdAux::CreateDimensionWindow { } { InitWindow $w [_ "Kratos Multiphysics"] Kratos "" "" 1 set initwind $w + spdAux::RegisterWindow $initwind ttk::frame $w.top ttk::label $w.top.title_text -text [_ " Dimension selection"] @@ -212,9 +209,8 @@ proc spdAux::SetSpatialDimmension {ndim} { proc spdAux::SwitchDimAndCreateWindow { ndim } { variable TreeVisibility - SetSpatialDimmension $ndim - spdAux::DestroyWindow + spdAux::DestroyWindows processIncludes parseRoutes @@ -234,4 +230,71 @@ proc spdAux::SwitchDimAndCreateWindow { ndim } { } ::Kratos::CreatePreprocessModelTBar ::Kratos::UpdateMenus -} \ No newline at end of file +} + +proc spdAux::reactiveApp { } { + #W "Reactive" + variable initwind + if { ![GidUtils::IsTkDisabled] } { + if { [winfo exists $initwind] } { + destroy $initwind + } + } + set root [customlib::GetBaseRoot] + set ::Model::SpatialDimension [[$root selectNodes "value\[@n='nDim'\]"] getAttribute v ] + set appname [[$root selectNodes "hiddenfield\[@n='activeapp'\]"] @v ] + + apps::setActiveApp $appname +} + +proc spdAux::deactiveApp { appid } { + + set root [customlib::GetBaseRoot] + [$root selectNodes "hiddenfield\[@n='activeapp'\]"] setAttribute v "" + foreach elem [$root getElementsByTagName "appLink"] { + if {$appid eq [$elem getAttribute "appid"] && [$elem getAttribute "active"] eq "1"} { + $elem setAttribute "active" 0 + break + } + } +} + +proc spdAux::activeApp { appid } { + #W "Active $appid" + catch { + set root [customlib::GetBaseRoot] + [$root selectNodes "hiddenfield\[@n='activeapp'\]"] setAttribute v $appid + foreach elem [$root getElementsByTagName "appLink"] { + if {$appid eq [$elem getAttribute "appid"] && [$elem getAttribute "active"] eq "0"} { + $elem setAttribute "active" 1 + set must_open_init_window 0 + } else { + $elem setAttribute "active" 0 + } + } + } + + set nd [$root selectNodes "value\[@n='nDim'\]"] + if {[$nd getAttribute v] ne "wait"} { + if {[$nd getAttribute v] ne "undefined"} { + set ::Model::SpatialDimension [$nd getAttribute v] + spdAux::SwitchDimAndCreateWindow $::Model::SpatialDimension + spdAux::TryRefreshTree + } { + ::spdAux::CreateDimensionWindow + } + } +} + +proc spdAux::SetActiveAppFromDOM { } { + set activeapp_dom "" + set root [customlib::GetBaseRoot] + set activeapp_node [$root selectNodes "//hiddenfield\[@n='activeapp'\]"] + if {$activeapp_node ne ""} { + set activeapp_dom [get_domnode_attribute $activeapp_node v] + if { $activeapp_dom != "" } { + apps::setActiveApp $activeapp_dom + } + } + return $activeapp_dom +} diff --git a/kratos.gid/scripts/Controllers/CommonProcs.tcl b/kratos.gid/scripts/Controllers/CommonProcs.tcl index 621d98fb0..8327ad9eb 100644 --- a/kratos.gid/scripts/Controllers/CommonProcs.tcl +++ b/kratos.gid/scripts/Controllers/CommonProcs.tcl @@ -79,10 +79,10 @@ proc spdAux::ProcGetElementsDict { domNode args } { proc spdAux::ProcGetSolutionStrategies {domNode args} { set names [list ] set pnames [list ] - #W $args - set Sols [::Model::GetSolutionStrategies {*}$args] - #W $Sols - foreach ss $Sols { + # W $args + set sols [::Model::GetSolutionStrategies {*}$args] + # W $sols + foreach ss $sols { lappend names [$ss getName] lappend pnames [$ss getName] lappend pnames [$ss getPublicName] @@ -90,7 +90,7 @@ proc spdAux::ProcGetSolutionStrategies {domNode args} { $domNode setAttribute values [join $names ","] set dv [lindex $names 0] - #W "dv $dv" + # W "dv $dv" if {[$domNode getAttribute v] eq ""} {$domNode setAttribute v $dv; spdAux::RequestRefresh} if {[$domNode getAttribute v] ni $names} {$domNode setAttribute v $dv; spdAux::RequestRefresh} @@ -99,16 +99,11 @@ proc spdAux::ProcGetSolutionStrategies {domNode args} { proc spdAux::ProcGetSchemes {domNode args} { set nodeApp [GetAppIdFromNode $domNode] - #W $nodeApp + # W $nodeApp set sol_stratUN [apps::getAppUniqueName $nodeApp SolStrat] - set sol_stat_path [spdAux::getRoute $sol_stratUN] - #if {[get_domnode_attribute [$domNode selectNodes $sol_stat_path] v] eq ""} { - #W "entra" - get_domnode_attribute [$domNode selectNodes $sol_stat_path] dict - get_domnode_attribute [$domNode selectNodes $sol_stat_path] values - #} - set solStratName [::write::getValue $sol_stratUN] + set solStratName [::write::getValue $sol_stratUN "" force] + if {$solStratName eq "" } {error "No solution strategy"} #W "Unique name: $sol_stratUN - Nombre $solStratName" set schemes [::Model::GetAvailableSchemes $solStratName {*}$args] @@ -144,13 +139,16 @@ proc spdAux::SetNoneValue {domNode} { proc spdAux::ProcGetConstitutiveLaws { domNode args } { set Elementname [$domNode selectNodes {string(../value[@n='Element']/@v)}] set Claws [::Model::GetAvailableConstitutiveLaws $Elementname] - #W "Const Laws que han pasado la criba: $Claws" + #WV Elementname + #W "Const Laws que han pasado la criba: $Claws $args" if {[llength $Claws] == 0} { set names [list "None"] } { set names [list ] foreach cl $Claws { - lappend names [$cl getName] + if {[$cl cumple {*}$args]} { + lappend names [$cl getName] + } } } set values [join $names ","] @@ -399,9 +397,11 @@ proc spdAux::ProcPartParamState { domNode args } { set resp [::Model::CheckElemParamState $domNode] if {$resp eq "0"} { set id [$domNode getAttribute n] - set constLaw [get_domnode_attribute [[$domNode parent] selectNodes "./value\[@n='ConstitutiveLaw'\]"] v] - if {$constLaw eq ""} {return hidden} - set resp [Model::CheckConstLawParamState $constLaw $id] + set const_law "" + set const_law_node [[$domNode parent] selectNodes "./value\[@n='ConstitutiveLaw'\]"] + if {$const_law_node ne ""} {set const_law [get_domnode_attribute $const_law_node v]} + if {$const_law eq ""} {return hidden} + set resp [Model::CheckConstLawParamState $const_law $id] } #W "Calculando estado de [$domNode @pn] : $resp" @@ -542,21 +542,13 @@ proc spdAux::ProcDirectorVectorNonZero { domNode args } { proc spdAux::ProcShowInMode { domNode args } { set kw [lindex $args 0] if {$kw ni [list "Release" "Developer"]} {return "hidden"} - if {$::Kratos::kratos_private(DevMode) eq "dev"} { + if {[Kratos::IsDeveloperMode]} { if {$kw eq "Developer"} {return "normal"} {return "hidden"} - } - if {$::Kratos::kratos_private(DevMode) eq "release"} { + } else { if {$kw eq "Developer"} {return "hidden"} {return "normal"} } } -proc spdAux::ProcGetFilesValues { } { - lappend listilla "- No file" - lappend listilla {*}[FileSelector::GetAllFiles] - lappend listilla "- Add new file" - return [join $listilla ","] -} - proc spdAux::ProcGetIntervals {domNode args} { set lista [::spdAux::getIntervals] if {$lista eq ""} {$domNode setAttribute state "hidden"; spdAux::RequestRefresh} @@ -582,18 +574,84 @@ proc spdAux::PreChargeTree { } { } } -proc spdAux::ProcGive_materials_list {domNode args} { + +proc spdAux::ProcEdit_database_list {domNode args} { + set root [customlib::GetBaseRoot] + set matname "" + set xnode "[$domNode @n]:" + # TODO: REMOVE THIS CHAPUZA + set baseframe ".gid.central.boundaryconds.gg.data.f0" + set things [winfo children $baseframe] + foreach thing $things { + if {[winfo class $thing] eq "TLabel"} { + set lab [$thing cget -text] + if {$lab eq $xnode} { + set id [string range [lindex [split $thing "."] end] 1 end] + set cbo ${baseframe}.e$id + set matname [$cbo get] + break + } + } + } + if {$matname ne ""} { + foreach thing $things { + set found 0 + #set id "" + if {[winfo class $thing] eq "TPanedwindow"} { + #set id [string range [lindex [split $thing "."] end] 1 end] + set thing "${thing}.e" + } + if {[winfo class $thing] eq "TEntry"} { + #if {$id eq "" } {set id [string range [lindex [split $thing "."] end] 1 end]} + #set prop ${baseframe}.e$id + set varname [$thing cget -textvariable] + set propname [lindex [split [lindex [split [lindex [split $varname "::"] end] "("] end] ")"] 0] + #W $propname + set appid [spdAux::GetAppIdFromNode $domNode] + set mats_un [apps::getAppUniqueName $appid Materials] + set xp3 [spdAux::getRoute $mats_un] + append xp3 [format_xpath {/blockdata[@n="material" and @name=%s]/value} $matname] + + foreach valueNode [$root selectNodes $xp3] { + if {$propname eq [$valueNode getAttribute n] } { + set val [$valueNode getAttribute v] + set $varname $val + #set found 1 + break + } + } + #if {$found} {W "mat $matname value $val"} + + } + } + } + return "" +} + +proc spdAux::ProcCambioMat {domNode args} { + set matname [get_domnode_attribute $domNode v] + set exclusion [list "Element" "ConstitutiveLaw" "Material"] + set nodes [$domNode selectNodes "../value"] + foreach node $nodes { + if {[$node @n] ni $exclusion} { + #W "[$node @n] [CheckPartParamValue $node $matname]" + $node setAttribute v [spdAux::CheckPartParamValue $node $matname] + } + } + RequestRefresh +} + +proc spdAux::ProcGetMaterialsList { domNode args } { set optional { { -has_container container_name "" } { -icon icon_name material16 } { -types_icon types_icon_name ""} { -database database_name materials } } - #W $args set compulsory "" parse_args $optional $compulsory $args set restList "" - + proc database_append_list { parentNode database_name level container_name icon_name types_icon_name filters} { set l "" # We guess the keywords of the levels of the database @@ -660,17 +718,22 @@ proc spdAux::ProcGive_materials_list {domNode args} { } return [list $primary_level $secondary_level] } - #W $database + set appid [spdAux::GetAppIdFromNode $domNode] set mats_un [apps::getAppUniqueName $appid Materials] set xp3 [spdAux::getRoute $mats_un] + + # set xp3 [spdAux::getRoute $mats_un] set parentNode [$domNode selectNodes $xp3] - set const_law_name [get_domnode_attribute [$domNode selectNodes "../value\[@n = 'ConstitutiveLaw'\]"] v] set filters [list ] - if {$const_law_name != ""} { - set const_law [Model::getConstitutiveLaw $const_law_name] - if {$const_law != ""} { - set filters [$const_law getMaterialFilters] + set const_law_node [$domNode selectNodes "../value\[@n = 'ConstitutiveLaw'\]"] + if {$const_law_node ne ""} { + set const_law_name [write::getValueByNode $const_law_node ] + if {$const_law_name != ""} { + set const_law [Model::getConstitutiveLaw $const_law_name] + if {$const_law != ""} { + set filters [$const_law getMaterialFilters] + } } } #W [$parentNode asXML] @@ -682,75 +745,68 @@ proc spdAux::ProcGive_materials_list {domNode args} { set res_raw_list [list ] foreach m $resList {lappend res_raw_list [lindex $m 1]} - set v [get_domnode_attribute [$domNode selectNodes "../value\[@n = 'Material'\]"] v] - if {$v ni $res_raw_list} {[$domNode selectNodes "../value\[@n = 'Material'\]"] setAttribute v $v} - return [join $resList ","] -} - -proc spdAux::ProcEdit_database_list {domNode args} { - set root [customlib::GetBaseRoot] - set matname "" - set xnode "[$domNode @n]:" - # TODO: REMOVE THIS CHAPUZA - set baseframe ".gid.central.boundaryconds.gg.data.f0" - set things [winfo children $baseframe] - foreach thing $things { - if {[winfo class $thing] eq "TLabel"} { - set lab [$thing cget -text] - if {$lab eq $xnode} { - set id [string range [lindex [split $thing "."] end] 1 end] - set cbo ${baseframe}.e$id - set matname [$cbo get] - break - } - } - } - if {$matname ne ""} { - foreach thing $things { - set found 0 - #set id "" - if {[winfo class $thing] eq "TPanedwindow"} { - #set id [string range [lindex [split $thing "."] end] 1 end] - set thing "${thing}.e" - } - if {[winfo class $thing] eq "TEntry"} { - #if {$id eq "" } {set id [string range [lindex [split $thing "."] end] 1 end]} - #set prop ${baseframe}.e$id - set varname [$thing cget -textvariable] - set propname [lindex [split [lindex [split [lindex [split $varname "::"] end] "("] end] ")"] 0] - #W $propname - set appid [spdAux::GetAppIdFromNode $domNode] - set mats_un [apps::getAppUniqueName $appid Materials] - set xp3 [spdAux::getRoute $mats_un] - append xp3 [format_xpath {/blockdata[@n="material" and @name=%s]/value} $matname] - - foreach valueNode [$root selectNodes $xp3] { - if {$propname eq [$valueNode getAttribute n] } { - set val [$valueNode getAttribute v] - set $varname $val - #set found 1 - break - } + set v [get_domnode_attribute $domNode v] + if {$v ni $res_raw_list} { + $domNode setAttribute v [lindex $res_raw_list 0] + } + return [join $res_raw_list ","] + +} + +proc spdAux::ProcEditDatabaseList { domNode dict dict_units boundary_conds args } { + set part [$domNode parent] + set has_container "" + set database materials + set title [= "Material database"] + set list_name [$domNode @n] + set x_path {//container[@n="materials"]} + set dom_materials [$domNode selectNodes $x_path] + if { $dom_materials == "" } { + error [= "xpath '%s' not found in the spd file" $x_path] + } + set primary_level material + if { [dict exists $dict $list_name] } { + set xps $x_path + append xps [format_xpath {/blockdata[@n=%s and @name=%s]} $primary_level [dict get $dict $list_name]] + } else { + set xps "" + } + # Launches the window and gets the selected material in domNodes + set domNodes [gid_groups_conds::edit_tree_parts_window -accepted_n $primary_level -select_only_one 1 $boundary_conds $title $x_path $xps] + + set ret_dict [dict create] + set ret_dict_units [dict create] + if {$domNodes ne ""} { + foreach k [dict keys $dict] { + set Selected_$k [dict get $dict $k] + set has_unit [dict exists $dict_units $k] + if {$has_unit} {set Selected_unit_$k [dict get $dict_units $k]} + + if { [llength $domNodes] } { + set domNode [lindex $domNodes 0] + if { [$domNode @n] == $primary_level } { + dict set ret_dict $list_name [$domNode @name] } - #if {$found} {W "mat $matname value $val"} - + set Selected_$k [$domNode selectNodes "value\[@n='$k'\]/@v"] + if {$has_unit} {set Selected_unit_$k [$domNode selectNodes "value\[@n='$k'\]/@units"]} } - } - } - return "" -} + + set name Selected_$k + if {$has_unit} {set name_unit Selected_unit_$k} -proc spdAux::ProcCambioMat {domNode args} { - set matname [get_domnode_attribute $domNode v] - set exclusion [list "Element" "ConstitutiveLaw" "Material"] - set nodes [$domNode selectNodes "../value"] - foreach node $nodes { - if {[$node @n] ni $exclusion} { - #W "[$node @n] [CheckPartParamValue $node $matname]" - $node setAttribute v [spdAux::CheckPartParamValue $node $matname] + set node [$part selectNodes "value\[@n='$k'\]"] + if {$node ne "" && [set $name] ne ""} { + + #dict set ret_dict $k [set $name] + #if {$has_unit} {dict set ret_dict_units $k [set $name_unit]} + gid_groups_conds::setAttributes [gid_groups_conds::nice_xpath $node] {*}[set $name] + if {$has_unit} {gid_groups_conds::setAttributes [gid_groups_conds::nice_xpath $node] {*}[set $name_unit] } + dict set ret_dict $k [dict get [lindex [set $name] 0] v] + if {$has_unit} {dict set ret_dict_units $k [dict get [lindex [set $name_unit] 0] units]} + } } } - RequestRefresh + return [list $ret_dict $ret_dict_units] } proc spdAux::ProcOkNewCondition {domNode args} { @@ -816,7 +872,7 @@ proc spdAux::ProcConditionParameterState {domNode args} { set parent_dependency_node [$domNode selectNodes "../value\[@n='$depN'\]"] set current_parent_dep_state [$parent_dependency_node getAttribute cal_state ""] if {$current_parent_dep_state eq ""} { - set current_parent_dep_state [get_domnode_attribute $current_parent_dep_state state] + set current_parent_dep_state [get_domnode_attribute $parent_dependency_node state] } set realV [get_domnode_attribute $parent_dependency_node v] if {$realV ni $depV || $current_parent_dep_state eq "hidden"} {set ret hidden} diff --git a/kratos.gid/scripts/Controllers/Drawer.tcl b/kratos.gid/scripts/Controllers/Drawer.tcl new file mode 100644 index 000000000..41165817a --- /dev/null +++ b/kratos.gid/scripts/Controllers/Drawer.tcl @@ -0,0 +1,56 @@ +namespace eval ::Drawer { + Kratos::AddNamespace [namespace current] + + variable registered_procs + variable vars +} + +proc Drawer::Init { } { + variable registered_procs + set registered_procs [dict create] + variable vars + set vars [dict create ] + variable ids + set ids [dict create ] +} + +proc Drawer::Register {name procedure varis} { + variable registered_procs + dict set registered_procs $name $procedure + variable vars + dict set vars $name $varis + variable ids + dict set ids $name [GiD_OpenGL register $procedure] +} + +proc Drawer::Unregister {name} { + variable registered_procs + variable vars + variable ids + if {[dict exist $ids $name]} { + set id [dict get $ids $name] + GiD_OpenGL unregister $id + dict unset registered_procs $name + dict unset vars $name + dict unset ids $name + } +} + +proc Drawer::UnregisterAll {} { + variable ids + foreach key [dict keys $ids] { + Unregister $key + } +} + +proc Drawer::GetVars {name} { + variable vars + return [dict get $vars $name] +} + +proc Drawer::IsRegistered {name} { + variable ids + return [dict exist $ids $name] +} + +Drawer::Init \ No newline at end of file diff --git a/kratos.gid/scripts/Controllers/ExamplesWindow.tcl b/kratos.gid/scripts/Controllers/ExamplesWindow.tcl new file mode 100644 index 000000000..dca8bd90c --- /dev/null +++ b/kratos.gid/scripts/Controllers/ExamplesWindow.tcl @@ -0,0 +1,268 @@ +namespace eval ::Examples { + Kratos::AddNamespace [namespace current] + + # Variable declaration + variable dir + variable doc + variable examples_window + variable filter_entry + variable groups_of_examples + + variable _canvas_scroll + variable _canvas_scroll_w + + variable info_main_window_text +} + +proc Examples::Init { } { + # Variable initialization + variable dir + variable examples_window + set examples_window .gid.examples_window + + set dir [apps::getMyDir "Examples"] + + # Don't open the tree + set ::spdAux::TreeVisibility 0 + + LoadMyFiles + + variable filter_entry + set filter_entry "" + variable groups_of_examples + set groups_of_examples [dict create] +} + +proc Examples::LoadMyFiles { } { + variable dir + variable doc + + # uplevel #0 [list source [file join $dir xml GetFromXML.tcl]] + set xmlfd [tDOM::xmlOpenFile [file join $dir xml examples.xml]] + set doc [dom parse -channel $xmlfd] + close $xmlfd + ResolveLinks +} + +proc ::Examples::StartWindowEmpty {args} { + Examples::StartWindow +} + +proc Examples::StartWindow { {filter ""} } { + variable examples_window + variable _canvas_scroll + variable _canvas_scroll_w + + set ::spdAux::must_open_dim_window 0 + + if { [GidUtils::IsTkDisabled] } { + return 0 + } + + spdAux::DestroyInitWindow + Examples::DestroyExamplesWindow + toplevel $examples_window + wm withdraw $examples_window + + set x [expr [winfo rootx .gid]+[winfo width .gid]/2-[winfo width $examples_window]/2] + set y [expr [winfo rooty .gid]+[winfo height .gid]/2-[winfo height $examples_window]/2] + + wm geom $examples_window +$x+$y + wm transient $examples_window .gid + + InitWindow $examples_window [_ "Kratos Multiphysics - Examples"] Kratos "" "" 1 + + spdAux::RegisterWindow $examples_window + + set c_to_scroll [CreateScrolledCanvas $examples_window.center] + set fcenter [tk::frame $c_to_scroll.fcenter] + set _canvas_scroll $fcenter + set _canvas_scroll_w $examples_window.center + AddToScrolledCanvas $examples_window.center $fcenter + grid $examples_window.center -row 0 -column 0 -sticky nsew + + set Examples::filter_entry $filter + set filter_txt [ttk::label $fcenter.filter_text -text [_ "Search an example:"]] + set filter_ent [ttk::entry $fcenter.filter_entry -textvariable Examples::filter_entry] + set filter_btn [ttk::button $fcenter.filter_button -text "Filter" -command [list Examples::PrintGroups]] + grid $filter_txt $filter_ent $filter_btn -sticky ew + + # Information panel + ttk::labelframe $examples_window.info -text " Information " -relief ridge + ttk::label $examples_window.info.text -textvariable Examples::info_main_window_text + grid $examples_window.info.text + grid $examples_window.info -sticky ew + + set groups [GetGroupsFromXML] + + PrintGroups +} + +proc Examples::getImgFrom {group_name example_logo} { + return [apps::getImgFrom $group_name $example_logo] +} + +proc Examples::PrintGroups { } { + variable groups_of_examples + variable examples_window + variable _canvas_scroll + variable _canvas_scroll_w + variable filter_entry + + set filter $filter_entry + + foreach group_id [dict keys $groups_of_examples] { + set group [dict get $groups_of_examples $group_id] + set group_name [dict get $group name] + + if {[winfo exists $_canvas_scroll.title_text$group_id]} {destroy $_canvas_scroll.title_text$group_id} + set parent [ttk::labelframe $_canvas_scroll.title_text$group_id -text $group_name] + set buttons_frame [ttk::frame $parent.buttonframe] + set col 0 + set row 0 + foreach example_id [dict keys [dict get $group examples]] { + set example [dict get $group examples $example_id] + if {[IsAproved $example $group_name $filter]} { + set inner_id "$group_id*$example_id" + set example_name [subst -nocommands -novariables [dict get $example name]] + set example_logo [dict get $example logo] + set example_dim [dict get $example dim] + set example_app [dict get $example app] + set example_cmd [dict get $example cmd] + set img [Examples::getImgFrom $example_app $example_logo] + ttk::button $buttons_frame.img~$inner_id -image $img -command [list Examples::LaunchExample $example_app $example_dim $example_cmd ] + ttk::label $buttons_frame.title$example_id -text $example_app -font {bold} + ttk::label $buttons_frame.text$example_id -text $example_name + grid $buttons_frame.img~$inner_id -column $col -row $row + grid $buttons_frame.title$example_id -column $col -row [expr $row +1] + grid $buttons_frame.text$example_id -column $col -row [expr $row +2] + + bind $buttons_frame.img~$inner_id {::Examples::PlaceInformationWindowByPath %W} + + incr col + if {$col >= 4} {set col 0; incr row; incr row; incr row} + } + } + if {$col > 0 || $row > 0 } { + grid $parent -sticky ew -columnspan 3 + grid $buttons_frame + grid columnconfigure $parent 0 -weight 1 + } + } + + grid columnconfigure $examples_window 0 -weight 1 + grid rowconfigure $examples_window 0 -weight 1 + wm minsize $examples_window 700 500 + update + + ResizeScrolledCanvas $_canvas_scroll_w +} + +proc Examples::PlaceInformationWindowByPath {win_path} { + variable examples_window + variable groups_of_examples + set inner_id [lindex [split $win_path "~"] end] + lassign [split $inner_id "*"] example_group example_id + set example [dict get $groups_of_examples $example_group examples $example_id] + if {$example ne ""} { + $examples_window.info configure -text "Information: [dict get $example name]" + set description [dict get $example description] + set ::Examples::info_main_window_text $description + } +} + +proc Examples::getExampleById {example_id} { + variable groups_of_examples + + foreach group_id [dict keys $groups_of_examples] { + set group [dict get $groups_of_examples $group_id] + foreach example [dict keys [dict get $group examples]] { + if {$example_id eq $example} {return [dict get $group examples $example]} + } + } +} + +proc Examples::IsAproved {example group filter} { + # if empty, no filter, go + if {$filter eq ""} {return 1} + set filter [string tolower $filter] + # filter by app id + set app_name [string tolower [dict get $example app]] + if {[string first $filter $app_name] > -1} {return 2} + # filter by app name + set group [string tolower $group] + if {[string first $filter $group] > -1} {return 3} + # filter by example name + set example_name [string tolower [dict get $example name]] + if {[string first $filter $example_name] > -1} {return 4} + + return 0 +} + +proc Examples::GetGroupsFromXML {} { + variable doc + variable groups_of_examples + + set root [$doc documentElement] + set groups [$root getElementsByTagName "Group"] + foreach group $groups { + set group_id [$group @id] + if {[$group hasAttribute name]} {dict set groups_of_examples $group_id name [$group @name]} + set examples [$group getElementsByTagName "Example"] + foreach example $examples { + set example_id [$example @id] + dict set groups_of_examples $group_id examples $example_id name [subst -nocommands -novariables [$example @name]] + dict set groups_of_examples $group_id examples $example_id logo [$example @logo] + dict set groups_of_examples $group_id examples $example_id dim [$example @dim] + dict set groups_of_examples $group_id examples $example_id app [$example @app] + dict set groups_of_examples $group_id examples $example_id cmd [$example @cmd] + dict set groups_of_examples $group_id examples $example_id description [[$example getElementsByTagName "Description"] text] + } + } +} + +proc Examples::LaunchExample {example_app example_dim example_cmd} { + if {![Kratos::IsModelEmpty]} { + set txt "We are going to draw the example geometry. You should save your work first.\nDo you want to lose your unsaved work?" + set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel] + if { $retval == "cancel" } { return } + } + Examples::DestroyExamplesWindow + Kratos::ResetModel + Model::DestroyEverything + set ::problemtype_current(CustomLibAutomatic) 1 + gid_common_problemtype_init_customlib_automatic $Kratos::kratos_private(Path) + set ::problemtype_current(CustomLibAutomatic) 0 + spdAux::SetSpatialDimmension $example_dim + apps::setActiveApp $example_app + $example_cmd + spdAux::OpenTree +} + +proc Examples::DestroyExamplesWindow {} { + + variable examples_window + if { ![GidUtils::IsTkDisabled] } { + if {[winfo exists $examples_window]} {destroy $examples_window} + } +} + +proc Examples::ResolveLinks { } { + variable doc + + set examples_node [$doc selectNodes "/examples"] + foreach link [$examples_node getElementsByTagName link] { + catch { + set xmlfd [tDOM::xmlOpenFile [file join $::Kratos::kratos_private(Path) [$link @path]]] + set nodes [[dom parse -channel $xmlfd] getElementsByTagName Group] + close $xmlfd + foreach node $nodes { + $examples_node insertBefore $node $link + } + $link delete + } + } + +} + +Examples::Init diff --git a/kratos.gid/scripts/Controllers/ImportFiles.tcl b/kratos.gid/scripts/Controllers/ImportFiles.tcl new file mode 100644 index 000000000..cd97fbf59 --- /dev/null +++ b/kratos.gid/scripts/Controllers/ImportFiles.tcl @@ -0,0 +1,74 @@ + +# Handle file input +proc ::spdAux::LaunchFileWindow { } { + if {[GiD_Info Project Modelname] eq "UNNAMED"} { + MessageBoxOk [_ "Model error"] [_ "Save your model first"] error + return + } + set FileSelector::callback_after_new_file "::spdAux::SaveModelFile" + set FileSelector::callback_view_file "::spdAux::ViewFile" + set FileSelector::callback_delete_file "::spdAux::DeleteFile" + FileSelector::InitFileHandler +} + +proc ::spdAux::ViewFile {file_id} { + exec {*}[auto_execok start] "" [file join [file nativename [GiD_Info Project ModelName].gid] $file_id] +} + +proc ::spdAux::LoadModelFiles { {root "" }} { + if {$root eq ""} { + set root [customlib::GetBaseRoot] + customlib::UpdateDocument + } + set files [$root getElementsByTagName "file"] + if {[llength $files] > 0} { + Kratos::LoadImportFiles + foreach elem $files { + FileSelector::AddFile [$elem @n] + } + } +} + +proc ::spdAux::SaveModelFile { fileid } { + customlib::UpdateDocument + FileSelector::AddFile $fileid + gid_groups_conds::addF {container[@n='files']} file [list n ${fileid}] + customlib::UpdateDocument + FileSelector::CopyFilesIntoModel [file nativename [GiD_Info Project ModelName] ].gid +} + +proc ::spdAux::ProcGetFilesValues { domNode } { + Kratos::LoadImportFiles + customlib::UpdateDocument + spdAux::LoadModelFiles + lappend listilla $::spdAux::no_file_string + lappend listilla {*}[FileSelector::GetAllFiles] + if {[get_domnode_attribute $domNode v] ni $listilla} {$domNode setAttribute v [lindex $listilla 0]} + return [join $listilla ","] +} + +proc ::spdAux::DeleteFile { fileid } { + customlib::UpdateDocument + + set used_nodes [[customlib::GetBaseRoot] selectNodes "//value\[@type = 'file' and @v = '$fileid'\]"] + foreach used_node $used_nodes { + W "Warning: Deleted file $fileid was used in [[$used_node parent] @pn] > [$used_node @pn]" + } + + set file_node [[customlib::GetBaseRoot] selectNodes "//file\[@n = '$fileid'\]"] + if {$file_node ne ""} {$file_node delete} + RequestRefresh +} + +proc ::spdAux::UpdateFileField { fileid domNode} { + if {$fileid ne ""} { + $domNode setAttribute v $fileid + spdAux::SaveModelFile $fileid + RequestRefresh + } +} + +namespace eval ::spdAux { + variable no_file_string + set no_file_string "- No file - (add files using File handler toolbar)" +} \ No newline at end of file diff --git a/kratos.gid/scripts/Controllers/Preferences.xml b/kratos.gid/scripts/Controllers/Preferences.xml index c269f223f..0a22c7cf0 100644 --- a/kratos.gid/scripts/Controllers/Preferences.xml +++ b/kratos.gid/scripts/Controllers/Preferences.xml @@ -8,11 +8,24 @@