Skip to content

Commit

Permalink
Merge pull request #857 from KratosMultiphysics/hotfix-fluid-dem-#855
Browse files Browse the repository at this point in the history
Fix FluidDem #855
  • Loading branch information
jginternational authored Feb 8, 2022
2 parents 77904b6 + 2eb50d1 commit 626c849
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 19 deletions.
8 changes: 5 additions & 3 deletions kratos.gid/apps/DEM/write/write.tcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace eval ::DEM::write {
namespace path ::DEM
Kratos::AddNamespace [namespace current]

variable writeAttributes
variable partsProperties
variable inletProperties
Expand Down Expand Up @@ -92,7 +92,7 @@ proc ::DEM::write::writeModelPartEvent { } {

proc ::DEM::write::writeCustomFilesEvent { } {
write::RenameFileInModel "ProjectParameters.json" "ProjectParametersDEM.json"
DEM::write::writeMaterialsFile
DEM::write::writeMaterialsFile
write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file]
}

Expand Down Expand Up @@ -163,13 +163,15 @@ proc ::DEM::write::Validate {} {
}

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
}

7 changes: 3 additions & 4 deletions kratos.gid/apps/DEM/write/writeMDPA_Walls.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ proc ::DEM::write::WriteMDPAWalls { } {
WriteWallCustomSmp
}


proc ::DEM::write::processRigidWallMaterials { } {
variable wallsProperties
set walls_xpath [DEM::write::GetRigidWallXPath]
Expand All @@ -39,10 +38,10 @@ proc ::DEM::write::processRigidWallMaterials { } {
}

proc ::DEM::write::processPhantomWallMaterials { } {
variable wallsProperties
variable phantomwallsProperties
set phantom_walls_xpath [DEM::write::GetPhantomWallXPath]
write::processMaterials $phantom_walls_xpath/group
set phantomwallsProperties [write::processMaterials $phantom_walls_xpath]
set phantomwallsProperties [write::getPropertiesListByConditionXPath $phantom_walls_xpath 0]
}

proc ::DEM::write::WriteRigidWallProperties { } {
Expand Down Expand Up @@ -535,6 +534,6 @@ proc ::DEM::write::DefineFEMExtraConditions {props} {
set GraphPrintval 0
if {[write::isBooleanTrue $GraphPrint]} {
set GraphPrintval 1
}
}
write::WriteString " FORCE_INTEGRATION_GROUP $GraphPrintval"
}
14 changes: 9 additions & 5 deletions kratos.gid/apps/DEM/write/writeProjectParameters.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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]}

dict set project_parameters_dict "Dimension" [expr $dimension]
dict set project_parameters_dict "PeriodicDomainOption" [write::getValue Boundingbox PeriodicDomain]
Expand Down Expand Up @@ -54,10 +54,8 @@ proc ::DEM::write::getParametersDict { } {
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]

set used_elements [spdAux::GetUsedElements]
set ElementType [lindex $used_elements 0]
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]
Expand Down Expand Up @@ -113,6 +111,12 @@ proc ::DEM::write::getParametersDict { } {
return $project_parameters_dict
}

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
Expand Down
8 changes: 8 additions & 0 deletions kratos.gid/apps/FluidDEM/write/write.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ proc FluidDEM::write::Validate { } {
proc FluidDEM::write::writeCustomFilesEvent { } {
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 { } {
Expand Down
11 changes: 8 additions & 3 deletions kratos.gid/apps/FluidDEM/write/writeProjectParameters.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ proc ::FluidDEM::write::getParametersDict { } {
# 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
Expand Down Expand Up @@ -313,3 +313,8 @@ proc FluidDEM::write::InitExternalProjectParameters { } {

apps::setActiveAppSoft FluidDEM
}

proc ::DEM::write::GetElementType { } {
return "SphericPartDEMElement3D"
}

2 changes: 1 addition & 1 deletion kratos.gid/scripts/Writing/WriteConditionsByUniqueId.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ proc write::writeGroupConditionByUniqueId {groupid kname nnodes iter ConditionMa
set cndid 0
set new 0
if {$nnodes != 1} {
set eid [lindex $elems $i]
set eid [objarray get $elems $i]
set cndid [objarray get $ConditionMap $eid]
}
if {$cndid == 0} {
Expand Down
6 changes: 3 additions & 3 deletions kratos.gid/scripts/Writing/WriteProjectParameters.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ proc write::getSolutionStrategyParametersDict { {solStratUN ""} {schemeUN ""} {S
if {$StratParamsUN eq ""} {
set StratParamsUN [apps::getCurrentUniqueName StratParams]
}
set solstratName [write::getValue $solStratUN]
set schemeName [write::getValue $schemeUN]

set solstratName [write::getValue $solStratUN "" force]
set schemeName [write::getValue $schemeUN "" force]
set sol [::Model::GetSolutionStrategy $solstratName]
set sch [$sol getScheme $schemeName]

Expand Down

0 comments on commit 626c849

Please sign in to comment.