Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions dem/use_cases/a_simple_3D_DEM_case/MainKratos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import time
import sys

import KratosMultiphysics
from KratosMultiphysics.DEMApplication.DEM_analysis_stage import DEMAnalysisStage
from KratosMultiphysics import *
from KratosMultiphysics.DEMApplication import *
from KratosMultiphysics import Logger

class DEMAnalysisStageWithFlush(DEMAnalysisStage):

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()

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

if __name__ == "__main__":
Logger.GetDefaultOutput().SetSeverity(Logger.Severity.INFO)
with open("ProjectParametersDEM.json", 'r') as parameter_file:
parameters = KratosMultiphysics.Parameters(parameter_file.read())

global_model = KratosMultiphysics.Model()
DEMAnalysisStageWithFlush(global_model, parameters).Run()
60 changes: 60 additions & 0 deletions dem/use_cases/a_simple_3D_DEM_case/MaterialsDEM.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"materials" : [{
"material_name" : "DEM-P",
"material_id" : 1,
"Variables" : {
"PARTICLE_DENSITY" : 2200,
"YOUNG_MODULUS" : 9.0e9,
"POISSON_RATIO" : 0.25,
"PARTICLE_SPHERICITY" : 1.0
}
},{
"material_name" : "DEM-S",
"material_id" : 2,
"Variables" : {
"YOUNG_MODULUS" : 202e9,
"POISSON_RATIO" : 0.25,
"PARTICLE_SPHERICITY" : 1.0,
"COMPUTE_WEAR" : false
}
}],
"material_relations" : [{
"material_names_list" : ["DEM-P","DEM-P"],
"material_ids_list" : [1,1],
"Variables" : {
"PARTICLE_MATERIAL": 1,
"DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME" : "DEM_D_Linear_viscous_Coulomb",
"STATIC_FRICTION" : 0.25,
"DYNAMIC_FRICTION" : 0.24,
"FRICTION_DECAY" : 500,
"COEFFICIENT_OF_RESTITUTION" : 0.189,
"K_ALPHA" : 45.0,
"DEM_ROLLING_FRICTION_MODEL_NAME" : "DEMRollingFrictionModelConstantTorque",
"ROLLING_FRICTION" : 0.01,
"ROLLING_FRICTION_WITH_WALLS" : 0.01

}
},{
"material_names_list" : ["DEM-P","DEM-S"],
"material_ids_list" : [1,2],
"Variables" : {
"PARTICLE_MATERIAL": 1,
"DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME": "DEM_D_Linear_viscous_Coulomb",
"STATIC_FRICTION": 0.5,
"DYNAMIC_FRICTION": 0.49,
"FRICTION_DECAY": 500,
"WALL_COHESION": 0.0,
"SEVERITY_OF_WEAR": 0.001,
"IMPACT_WEAR_SEVERITY": 0.001,
"BRINELL_HARDNESS": 200.0,
"COEFFICIENT_OF_RESTITUTION": 0.189,
"K_ALPHA": 45.0,
"DEM_ROLLING_FRICTION_MODEL_NAME" : "DEMRollingFrictionModelConstantTorque",
"ROLLING_FRICTION": 0.01,
"ROLLING_FRICTION_WITH_WALLS": 0.0
}
}],
"material_assignation_table" : [["SpheresPart.DEMParts_Body","DEM-P"],
["RigidFacePart.DEM-FEM-Wall_TOP","DEM-S"],
["RigidFacePart.DEM-FEM-Wall_BOTTOM","DEM-S"]]
}
92 changes: 92 additions & 0 deletions dem/use_cases/a_simple_3D_DEM_case/ProjectParametersDEM.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"Dimension" : 3,
"PeriodicDomainOption" : false,
"BoundingBoxOption" : false,
"AutomaticBoundingBoxOption" : false,
"BoundingBoxEnlargementFactor" : 1.1,
"BoundingBoxStartTime" : 0.0,
"BoundingBoxStopTime" : 1000.0,
"BoundingBoxMaxX" : 10,
"BoundingBoxMaxY" : 10,
"BoundingBoxMaxZ" : 10,
"BoundingBoxMinX" : -10,
"BoundingBoxMinY" : -10,
"BoundingBoxMinZ" : -10,
"dem_inlet_option" : false,
"GravityX" : 0.0,
"GravityY" : 0.0,
"GravityZ" : 0.0,
"RotationOption" : true,
"CleanIndentationsOption" : false,
"VirtualMassCoefficient" : 1.0,
"RollingFrictionOption" : false,
"GlobalDamping" : 0.0,
"ContactMeshOption" : true,
"OutputFileType" : "Binary",
"Multifile" : "multiple_files",
"ElementType" : "SphericContPartDEMElement3D",
"TranslationalIntegrationScheme" : "Symplectic_Euler",
"RotationalIntegrationScheme" : "Direct_Integration",
"MaxTimeStep" : 1e-5,
"FinalTime" : 0.1,
"NeighbourSearchFrequency" : 1,
"SearchTolerance" : 0.02,
"GraphExportFreq" : 1e-2,
"VelTrapGraphExportFreq" : 1e-2,
"OutputTimeStep" : 1e-2,
"PostBoundingBox" : true,
"PostLocalContactForce" : true,
"PostDisplacement" : true,
"PostRadius" : true,
"PostVelocity" : true,
"PostAngularVelocity" : true,
"PostElasticForces" : true,
"PostContactForces" : true,
"PostRigidElementForces" : false,
"PostStressStrainOption" : true,
"PostTangentialElasticForces" : false,
"PostTotalForces" : true,
"PostPressure" : false,
"PostShearStress" : false,
"PostSkinSphere" : true,
"PostNonDimensionalVolumeWear" : false,
"PostParticleMoment" : true,
"PostEulerAngles" : false,
"PostRollingResistanceMoment" : false,
"problem_name" : "test_PBM",
"DeltaOption" : "Absolute",
"CoordinationNumber" : 10,
"AmplifiedSearchRadiusExtension" : 1.1,
"PoissonEffectOption" : false,
"ShearStrainParallelToBondOption" : false,
"ComputeStressTensorOption" : false,
"MaxAmplificationRatioOfSearchRadius" : 1000,
"PostContactFailureId" : true,

"EnergyCalculationOption" : false,
"VelocityTrapOption" : false,
"solver_settings" : {
"RemoveBallsInitiallyTouchingWalls" : false,
"strategy" : "sphere_strategy"
},
"ModelDataInfo" : false,
"DontSearchUntilFailure" : false,
"MaxNumberOfIntactBondsToConsiderASphereBroken" : 0,
"AutomaticTimestep" : false,
"DeltaTimeSafetyFactor" : 1.0,
"ControlTime" : 4.0,
"PostPoissonRatio" : false,
"PostCharacteristicLength" : false,
"PostNodalArea" : false,
"PostContactSigma" : true,
"PostContactTau" : true,
"PostFailureCriterionState" : true,
"PostMeanContactArea" : false,
"PostRHS" : false,
"PostDampForces" : false,
"PostAppliedForces" : true,
"PostGroupId" : false,
"PostExportId" : false,
"post_vtk_option" : false
}

55 changes: 55 additions & 0 deletions dem/use_cases/a_simple_3D_DEM_case/test_PBMDEM.mdpa
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Begin ModelPartData
// VARIABLE_NAME value
End ModelPartData

Begin Properties 0
End Properties

Begin Nodes
1 -0.1 0.0 0.1
2 0.1 0.0 0.1
3 -0.1 0.0 -0.1
4 0.1 0.0 -0.1
5 0.0 0.141421356237 0.0
6 0.0 -0.141421356237 0.0
End Nodes


Begin Elements SphericParticle3D// GUI group identifier: Body
1 0 1
2 0 2
3 0 3
4 0 4
5 0 5
6 0 6
End Elements

Begin NodalData RADIUS // GUI group identifier: Body
1 0 0.1
2 0 0.1
3 0 0.1
4 0 0.1
5 0 0.1
6 0 0.1
End NodalData

Begin SubModelPart DEMParts_Body // Group Body // Subtree DEMParts
Begin SubModelPartNodes
1
2
3
4
5
6
End SubModelPartNodes
Begin SubModelPartElements
1
2
3
4
5
6
End SubModelPartElements
Begin SubModelPartConditions
End SubModelPartConditions
End SubModelPart
88 changes: 88 additions & 0 deletions dem/use_cases/a_simple_3D_DEM_case/test_PBMDEM_FEM_boundary.mdpa
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Begin ModelPartData
// VARIABLE_NAME value
End ModelPartData

Begin Properties 0
End Properties

Begin Nodes
1 -0.2 0.241421356237 0.2
2 -0.2 0.241421356237 -0.2
3 0.2 0.241421356237 -0.2
4 0.2 0.241421356237 0.2
5 -0.2 -0.241421356237 0.2
6 -0.2 -0.241421356237 -0.2
7 0.2 -0.241421356237 -0.2
8 0.2 -0.241421356237 0.2
End Nodes


Begin Conditions RigidFace3D4N// GUI group identifier: TOP
1001 0 1 2 3 4
End Conditions

Begin Conditions RigidFace3D4N// GUI group identifier: BOTTOM
2001 0 5 6 7 8
End Conditions

Begin SubModelPart DEM-FEM-Wall_TOP // DEM-FEM-Wall - group identifier: TOP
Begin SubModelPartData // DEM-FEM-Wall. Group name: TOP
LINEAR_VELOCITY [3] (-0.0, -0.05, -0.0)
VELOCITY_PERIOD 0.0
ANGULAR_VELOCITY [3] (0.0,0.0,0.0)
ROTATION_CENTER [3] (0.0,0.0,0.0)
ANGULAR_VELOCITY_PERIOD 0.0
VELOCITY_START_TIME 0.0
VELOCITY_STOP_TIME 100.0
ANGULAR_VELOCITY_START_TIME 0.0
ANGULAR_VELOCITY_STOP_TIME 100.0
FIXED_MESH_OPTION 0
RIGID_BODY_MOTION 1
FREE_BODY_MOTION 0
IS_GHOST 0
IDENTIFIER TOP
FORCE_INTEGRATION_GROUP 0
End SubModelPartData
Begin SubModelPartNodes
1
2
3
4
End SubModelPartNodes

Begin SubModelPartConditions
1001
End SubModelPartConditions

End SubModelPart

Begin SubModelPart DEM-FEM-Wall_BOTTOM // DEM-FEM-Wall - group identifier: BOTTOM
Begin SubModelPartData // DEM-FEM-Wall. Group name: BOTTOM
LINEAR_VELOCITY [3] (0.0, 0.05, 0.0)
VELOCITY_PERIOD 0.0
ANGULAR_VELOCITY [3] (0.0,0.0,0.0)
ROTATION_CENTER [3] (0.0,0.0,0.0)
ANGULAR_VELOCITY_PERIOD 0.0
VELOCITY_START_TIME 0.0
VELOCITY_STOP_TIME 100.0
ANGULAR_VELOCITY_START_TIME 0.0
ANGULAR_VELOCITY_STOP_TIME 100.0
FIXED_MESH_OPTION 0
RIGID_BODY_MOTION 1
FREE_BODY_MOTION 0
IS_GHOST 0
IDENTIFIER BOTTOM
FORCE_INTEGRATION_GROUP 0
End SubModelPartData
Begin SubModelPartNodes
5
6
7
8
End SubModelPartNodes
Begin SubModelPartConditions
2001
End SubModelPartConditions

End SubModelPart