(1) | ### Start Time Loop #### |
(2) | while dem_analysis.time < dem_analysis.end_time: |
(3) | # update time parameters |
(4) | dem_analysis.AdvanceInTime() |
(5) | structural_analysis.AdvanceInTime() |
(6) | # save the current position, forces, velocity, etc., of the DEM wall condition and particles |
(7) | dem_analysis.SaveCurrentData() |
(8) | # initialize time step |
(9) | structural_analysis.InitializeSolutionStep() |
(10) | # initial interface residuals |
(11) | InitializeResiduals() |
(12) | while interface_residual > interface_tolerance: |
(13) | ### Solve DEM Problem #### |
(14) | # reset the previous saved data of the particle to keep it at the same reference position in each inner loop step |
(15) | dem_analysis.SetOldDataParticles() |
(16) | # search and find neighbouring elements/particles which are in contact |
(17) | dem_analysis.SearchOperations() |
(18) | # calculate contact forces |
(19) | dem_analysis.ForceOperations() |
(20) | # integrate in time to obtain new position and velocity of DEM particles |
(21) | dem_analysis.IntegrationOfMotion() |
(22) | ### Map Contact Forces #### |
(23) | # DEM to Structure |
(24) | mapper.Map(DEMApplication.CONTACT_FORCES, StructuralMechanicsApplication.POINT_LOAD) |
(25) | ### Calculate Interface Residual #### |
(26) | interface_residual = calculate_force_residual() |
(27) | ### Relax Exchange Data #### |
(28) | dem_analysis.RelaxForces() |
(29) | dem_analysis.SetRelaxedForces() |
(30) | # prediction step for solution scheme (if necessary) |
(31) | structural_analysis.Predict() |
(32) | # solve the FEM system of equations or explicitly integrate in time |
(33) | structural_analysis.SolveSolutionStep() |
(34) | ### Map Velocity and Displacement #### |
(35) | # Structure to DEM |
(36) | mapper.InverseMap(VELOCITY) |
(37) | mapper.InverseMap(DISPLACEMENT) |
(38) | ### Update DEM #### |
(39) | # update position of DEM wall |
(40) | dem_analysis.MoveMesh() |
(41) | # use the current position of the DEM wall condition and the last converged position to calculate the difference in displacement, which is used to calculate |
(42) | dem_analysis.CalculateDeltaDispFromIntermediatePos() |
(43) | # finalize time step by updating state variables and spatial position |
(44) | structural_analysis.FinalizeSolutionStep() |
(45) | dem_analysis.FinalizeSingleTimeStep() |
(46) | ### Finalize Applications #### |
(47) | dem_analysis.Finalize() |
(48) | structural_analysis.Finalize() |