Esempio n. 1
0
    def SPPostProcessResults(self, time):
        DemFem.DemStructuresCouplingUtilities().MarkBrokenSpheres(
            self.ring_submodelpart)

        center = Kratos.Array3()
        center[0] = self.sp_parameters["problem_data"]["center"][0].GetDouble()
        center[1] = self.sp_parameters["problem_data"]["center"][1].GetDouble()
        center[2] = self.sp_parameters["problem_data"]["center"][2].GetDouble()
        axis = Kratos.Array3()
        axis[0] = self.sp_parameters["problem_data"]["axis"][0].GetDouble()
        axis[1] = self.sp_parameters["problem_data"]["axis"][1].GetDouble()
        axis[2] = self.sp_parameters["problem_data"]["axis"][2].GetDouble()

        radius = 0
        if self.test_number == 1:
            radius = 0.0036195
            #95% of the real hole. CTW16 specimen
        elif self.test_number == 2:
            radius = 0.012065
            #95% of the real hole. CTW10 specimen
        elif self.test_number == 3:
            radius = 0.036195
            #95% of the real hole. Blind Test

        self.dem_solution.creator_destructor.MarkParticlesForErasingGivenCylinder(
            self.ring_submodelpart, center, axis, radius)

        if self.test_number == 1 or self.test_number == 2:
            if self.structural_solution._GetSolver(
            ).main_model_part.ProcessInfo[Kratos.DOMAIN_SIZE] == 2:
                self.outer_walls_model_part = self.model[
                    "Structure.LinePressure2D_Outer_line"]
            else:
                self.outer_walls_model_part = self.model[
                    "Structure.SurfacePressure3D_lateral_pressure"]
            DemFem.DemStructuresCouplingUtilities(
            ).ComputeSandProductionWithDepthFirstSearchNonRecursiveImplementation(
                self.ring_submodelpart, self.outer_walls_model_part, time)
            DemFem.DemStructuresCouplingUtilities().ComputeSandProduction(
                self.ring_submodelpart, self.outer_walls_model_part, time)
        elif self.test_number == 3:
            if self.structural_solution._GetSolver(
            ).main_model_part.ProcessInfo[Kratos.DOMAIN_SIZE] == 2:
                self.outer_walls_model_part_1 = self.model[
                    "Structure.LinePressure2D_Left_line"]
                # self.outer_walls_model_part_2 = self.model["Structure.LinePressure2D_Bot_line"]
            else:
                self.outer_walls_model_part_1 = self.model[
                    "Structure.SurfacePressure3D_sigmaXpos"]
                # self.outer_walls_model_part_2 = self.model["Structure.SurfacePressure3D_sigmaYpos"]
            # NOTE: The stress printed in this case will also be the SigmaZ, but probably SigmaX is more appropriate
            DemFem.DemStructuresCouplingUtilities(
            ).ComputeSandProductionWithDepthFirstSearchNonRecursiveImplementation(
                self.ring_submodelpart, self.outer_walls_model_part_1, time)
            DemFem.DemStructuresCouplingUtilities().ComputeSandProduction(
                self.ring_submodelpart, self.outer_walls_model_part_1, time)
    def PrintResultsForGid(self, time):
        super(DEMAnalysisStage2DSpRigidFem, self).PrintResultsForGid(time)

        DemFem.DemStructuresCouplingUtilities().MarkBrokenSpheres(
            self.ring_submodelpart)
        self.creator_destructor.MarkParticlesForErasingGivenCylinder(
            self.ring_submodelpart, self.center, self.axis,
            self.radius_to_delete_sp)

        DemFem.DemStructuresCouplingUtilities(
        ).ComputeSandProductionWithDepthFirstSearchNonRecursiveImplementation(
            self.ring_submodelpart, self.rigid_face_model_part, self.time)
        DemFem.DemStructuresCouplingUtilities().ComputeSandProduction(
            self.ring_submodelpart, self.rigid_face_model_part, self.time)
 def _TransferStructuresSkinToDem(self):
     self.structural_mp = self.structural_solution._GetSolver(
     ).GetComputingModelPart()
     self.skin_mp = self.structural_mp.GetSubModelPart(
         "DetectedByProcessSkinModelPart")
     dem_walls_mp = self.dem_solution.rigid_face_model_part.CreateSubModelPart(
         "SkinTransferredFromStructure")
     max_prop_id = 0
     for prop in dem_walls_mp.Properties:
         if prop.Id > max_prop_id:
             max_prop_id = prop.Id
     props = Kratos.Properties(max_prop_id + 1)
     # NOTE: this should be more general
     props[Dem.STATIC_FRICTION] = 0.2
     props[Dem.DYNAMIC_FRICTION] = 0.2
     props[Dem.WALL_COHESION] = 0.0
     props[Dem.COMPUTE_WEAR] = False
     props[Dem.SEVERITY_OF_WEAR] = 0.001
     props[Dem.IMPACT_WEAR_SEVERITY] = 0.001
     props[Dem.BRINELL_HARDNESS] = 200.0
     props[Kratos.YOUNG_MODULUS] = 7e9
     props[Kratos.POISSON_RATIO] = 0.16
     dem_walls_mp.AddProperties(props)
     DemFem.DemStructuresCouplingUtilities().TransferStructuresSkinToDem(
         self.skin_mp, dem_walls_mp, props)
Esempio n. 4
0
    def TransferFEMSkinToDEM(self):
        fem_skin_mp = self.FEM_Solution.main_model_part.GetSubModelPart(
            "SkinDEMModelPart")

        if self.DEM_Solution.rigid_face_model_part.HasSubModelPart(
                "SkinTransferredFromStructure"):
            self.EraseConditionsAndNodesSubModelPart()
            dem_walls_mp = self.DEM_Solution.rigid_face_model_part.GetSubModelPart(
                "SkinTransferredFromStructure")
            dem_walls_mp.SetValue(KratosDEM.RIGID_BODY_OPTION, False)
            props = self.DEM_Solution.spheres_model_part.GetProperties()[2]
            DemFem.DemStructuresCouplingUtilities(
            ).TransferStructuresSkinToDem(fem_skin_mp, dem_walls_mp, props)
        else:  # have to create it
            # props = self.CreateFEMPropertiesForDEFEContact()
            props = self.DEM_Solution.spheres_model_part.GetProperties()[2]
            dem_walls_mp = self.DEM_Solution.rigid_face_model_part.CreateSubModelPart(
                "SkinTransferredFromStructure")
            dem_walls_mp.SetValue(KratosDEM.RIGID_BODY_OPTION, False)
            # dem_walls_mp.AddProperties(props)
            DemFem.DemStructuresCouplingUtilities(
            ).TransferStructuresSkinToDem(fem_skin_mp, dem_walls_mp, props)
Esempio n. 5
0
 def _TransferStructuresSkinToDem(self):
     self.structural_mp = self.structural_solution._GetSolver(
     ).GetComputingModelPart()
     self.skin_mp = self.structural_mp.GetSubModelPart(
         "DetectedByProcessSkinModelPart")
     dem_walls_mp = self.dem_solution.rigid_face_model_part
     props = Kratos.Properties(0)
     props[Dem.WALL_FRICTION] = 0.5773502691896257
     props[Dem.WALL_COHESION] = 0.0
     props[Dem.COMPUTE_WEAR] = False
     props[Dem.SEVERITY_OF_WEAR] = 0.001
     props[Dem.IMPACT_WEAR_SEVERITY] = 0.001
     props[Dem.BRINELL_HARDNESS] = 200.0
     props[Kratos.YOUNG_MODULUS] = 1e20
     props[Kratos.POISSON_RATIO] = 0.25
     dem_walls_mp.AddProperties(props)
     DemFem.DemStructuresCouplingUtilities().TransferStructuresSkinToDem(
         self.skin_mp, dem_walls_mp, props)
Esempio n. 6
0
    def RunSolutionLoop(self):

        self.dem_solution.step = 0
        self.dem_solution.time = 0.0
        self.dem_solution.time_old_print = 0.0
        self.time_dem = 0.0
        self.Dt_structural = self.structural_solution._GetSolver(
        ).settings["time_stepping"]["time_step"].GetDouble()

        while self.structural_solution.time < self.structural_solution.end_time:

            portion_of_the_force_which_is_new = 0.4
            DemFem.DemStructuresCouplingUtilities().SmoothLoadTrasferredToFem(
                self.dem_solution.rigid_face_model_part,
                portion_of_the_force_which_is_new)

            self.structural_solution.time = self.structural_solution._GetSolver(
            ).AdvanceInTime(self.structural_solution.time)

            self.structural_solution.InitializeSolutionStep()
            if self.test_number:
                self.control_module_fem_dem_utility.ExecuteInitializeSolutionStep(
                )
            self.structural_solution._GetSolver().Predict()
            self.structural_solution._GetSolver().SolveSolutionStep()
            self.structural_solution.FinalizeSolutionStep()
            self.structural_solution.OutputSolutionStep()

            time_final_DEM_substepping = self.structural_solution.time

            self.Dt_DEM = self.dem_solution.spheres_model_part.ProcessInfo.GetValue(
                Kratos.DELTA_TIME)

            DemFem.InterpolateStructuralSolutionForDEM(
            ).SaveStructuralSolution(self.structural_mp)

            DemFem.ComputeDEMFaceLoadUtility().ClearDEMFaceLoads(self.skin_mp)

            if self.test_number == 1 or self.test_number == 2:
                self.outer_walls_model_part = self.model[
                    "Structure.SurfacePressure3D_lateral_pressure"]
                DemFem.DemStructuresCouplingUtilities(
                ).ComputeSandProductionWithDepthFirstSearch(
                    self.dem_solution.spheres_model_part,
                    self.outer_walls_model_part, self.structural_solution.time)
                DemFem.DemStructuresCouplingUtilities().ComputeSandProduction(
                    self.dem_solution.spheres_model_part,
                    self.outer_walls_model_part, self.structural_solution.time)
            elif self.test_number == 3:
                self.outer_walls_model_part_1 = self.model[
                    "Structure.SurfacePressure3D_sigmaXpos"]
                self.outer_walls_model_part_2 = self.model[
                    "Structure.SurfacePressure3D_sigmaYpos"]
                DemFem.DemStructuresCouplingUtilities(
                ).ComputeTriaxialSandProduction(
                    self.dem_solution.spheres_model_part,
                    self.outer_walls_model_part_1,
                    self.outer_walls_model_part_2,
                    self.structural_solution.time)

            for self.dem_solution.time_dem in self.yield_DEM_time(
                    self.dem_solution.time, time_final_DEM_substepping,
                    self.Dt_DEM):
                self.dem_solution.time = self.dem_solution.time + self.dem_solution._GetSolver(
                ).dt

                self.dem_solution.step += 1

                self.dem_solution.DEMFEMProcedures.UpdateTimeInModelParts(
                    self.dem_solution.all_model_parts, self.dem_solution.time,
                    self.dem_solution._GetSolver().dt, self.dem_solution.step)

                self.dem_solution.InitializeSolutionStep()

                self.dem_solution._GetSolver().Predict()

                DemFem.InterpolateStructuralSolutionForDEM(
                ).InterpolateStructuralSolution(
                    self.structural_mp, self.Dt_structural,
                    self.structural_solution.time,
                    self.dem_solution._GetSolver().dt, self.dem_solution.time)

                self.dem_solution.SolverSolve()

                DemFem.DemStructuresCouplingUtilities().MarkBrokenSpheres(
                    self.dem_solution.spheres_model_part)

                center = Kratos.Array3()
                center[0] = self.sp_parameters["problem_data"]["center"][
                    0].GetDouble()
                center[1] = self.sp_parameters["problem_data"]["center"][
                    1].GetDouble()
                center[2] = self.sp_parameters["problem_data"]["center"][
                    2].GetDouble()
                axis = Kratos.Array3()
                axis[0] = self.sp_parameters["problem_data"]["axis"][
                    0].GetDouble()
                axis[1] = self.sp_parameters["problem_data"]["axis"][
                    1].GetDouble()
                axis[2] = self.sp_parameters["problem_data"]["axis"][
                    2].GetDouble()

                radius = 0
                if self.test_number == 1:
                    radius = 0.0036195
                    #95% of the real hole. CTW16 specimen
                elif self.test_number == 2:
                    radius = 0.012065
                    #95% of the real hole. CTW10 specimen
                elif self.test_number == 3:
                    radius = 0.036195
                    #95% of the real hole. Blind Test

                self.dem_solution.creator_destructor.MarkParticlesForErasingGivenCylinder(
                    self.dem_solution.spheres_model_part, center, axis, radius)

                self.dem_solution.FinalizeSolutionStep()

                DemFem.ComputeDEMFaceLoadUtility().CalculateDEMFaceLoads(
                    self.skin_mp,
                    self.dem_solution._GetSolver().dt, self.Dt_structural)

                #### PRINTING GRAPHS ####
                os.chdir(self.dem_solution.graphs_path)
                self.dem_solution.post_utils.ComputeMeanVelocitiesInTrap(
                    "Average_Velocity.txt", self.dem_solution.time,
                    self.dem_solution.graphs_path)

                self.dem_solution.materialTest.MeasureForcesAndPressure()
                self.dem_solution.materialTest.PrintGraph(
                    self.dem_solution.time)

                self.dem_solution.DEMFEMProcedures.PrintGraph(
                    self.dem_solution.time)
                self.dem_solution.DEMFEMProcedures.PrintBallsGraph(
                    self.dem_solution.time)

                self.dem_solution.DEMEnergyCalculator.CalculateEnergyAndPlot(
                    self.dem_solution.time)

                self.dem_solution.BeforePrintingOperations(
                    self.dem_solution.time)

                #### GiD IO ##########################################
                if self.dem_solution.IsTimeToPrintPostProcess():
                    self.dem_solution._GetSolver().PrepareElementsForPrinting()
                    if self.dem_solution.DEM_parameters[
                            "ContactMeshOption"].GetBool():
                        self.dem_solution._GetSolver(
                        ).PrepareContactElementsForPrinting()
                    self.dem_solution.PrintResultsForGid(
                        self.dem_solution.time)
                    self.dem_solution.demio.PrintMultifileLists(
                        self.dem_solution.time, self.dem_solution.post_path)
                    self.dem_solution.time_old_print = self.dem_solution.time

                    if self.test_number:
                        self.stress_failure_check_utility.ExecuteFinalizeSolutionStep(
                        )

                self.dem_solution.FinalizeTimeStep(self.dem_solution.time)

            DemFem.InterpolateStructuralSolutionForDEM(
            ).RestoreStructuralSolution(self.structural_mp)

            if self.test_number:
                self.control_module_fem_dem_utility.ExecuteFinalizeSolutionStep(
                )

            # Write SP data
            if self.IsPostProcessWriteStep():
                self.sp_post_process_tool.WriteData()
Esempio n. 7
0
    def RunSolutionLoop(self):

        self.dem_solution.step = 0
        self.dem_solution.time = 0.0
        self.dem_solution.time_old_print = 0.0
        self.time_dem = 0.0
        self.Dt_structural = self.structural_solution._GetSolver(
        ).settings["time_stepping"]["time_step"].GetDouble()

        while self.structural_solution.time < self.structural_solution.end_time:

            portion_of_the_force_which_is_new = 0.4
            DemFem.DemStructuresCouplingUtilities().SmoothLoadTrasferredToFem(
                self.dem_solution.rigid_face_model_part,
                portion_of_the_force_which_is_new)

            self.structural_solution.time = self.structural_solution._GetSolver(
            ).AdvanceInTime(self.structural_solution.time)

            self.structural_solution.InitializeSolutionStep()
            self.structural_solution._GetSolver().Predict()
            self.structural_solution._GetSolver().SolveSolutionStep()
            self.structural_solution.FinalizeSolutionStep()
            self.structural_solution.OutputSolutionStep()

            time_final_DEM_substepping = self.structural_solution.time

            self.Dt_DEM = self.dem_solution.spheres_model_part.ProcessInfo.GetValue(
                Kratos.DELTA_TIME)

            DemFem.InterpolateStructuralSolutionForDEM(
            ).SaveStructuralSolution(self.structural_mp)

            DemFem.ComputeDEMFaceLoadUtility().ClearDEMFaceLoads(self.skin_mp)

            for self.dem_solution.time_dem in self.yield_DEM_time(
                    self.dem_solution.time, time_final_DEM_substepping,
                    self.Dt_DEM):
                self.dem_solution.time = self.dem_solution.time + self.dem_solution._GetSolver(
                ).dt

                self.dem_solution.step += 1

                self.dem_solution.DEMFEMProcedures.UpdateTimeInModelParts(
                    self.dem_solution.all_model_parts, self.dem_solution.time,
                    self.dem_solution._GetSolver().dt, self.dem_solution.step)

                self.dem_solution.InitializeSolutionStep()

                DemFem.InterpolateStructuralSolutionForDEM(
                ).InterpolateStructuralSolution(
                    self.structural_mp, self.Dt_structural,
                    self.structural_solution.time,
                    self.dem_solution._GetSolver().dt, self.dem_solution.time)

                self.dem_solution.SolverSolve()

                self.dem_solution.FinalizeSolutionStep()

                DemFem.ComputeDEMFaceLoadUtility().CalculateDEMFaceLoads(
                    self.skin_mp,
                    self.dem_solution._GetSolver().dt, self.Dt_structural)

                self.dem_solution.DEMFEMProcedures.MoveAllMeshes(
                    self.dem_solution.all_model_parts, self.dem_solution.time,
                    self.dem_solution._GetSolver().dt)
                #DEMFEMProcedures.MoveAllMeshesUsingATable(rigid_face_model_part, time, dt)

                #### PRINTING GRAPHS ####
                os.chdir(self.dem_solution.graphs_path)
                self.dem_solution.post_utils.ComputeMeanVelocitiesInTrap(
                    "Average_Velocity.txt", self.dem_solution.time,
                    self.dem_solution.graphs_path)

                self.dem_solution.materialTest.MeasureForcesAndPressure()
                self.dem_solution.materialTest.PrintGraph(
                    self.dem_solution.time)

                self.dem_solution.DEMFEMProcedures.PrintGraph(
                    self.dem_solution.time)
                self.dem_solution.DEMFEMProcedures.PrintBallsGraph(
                    self.dem_solution.time)

                self.dem_solution.DEMEnergyCalculator.CalculateEnergyAndPlot(
                    self.dem_solution.time)

                self.dem_solution.BeforePrintingOperations(
                    self.dem_solution.time)

                #### GiD IO ##########################################
                if self.dem_solution.IsTimeToPrintPostProcess():
                    self.dem_solution._GetSolver().PrepareElementsForPrinting()
                    if self.dem_solution.DEM_parameters[
                            "ContactMeshOption"].GetBool():
                        self.dem_solution._GetSolver(
                        ).PrepareContactElementsForPrinting()
                    self.dem_solution.PrintResultsForGid(
                        self.dem_solution.time)
                    self.dem_solution.demio.PrintMultifileLists(
                        self.dem_solution.time, self.dem_solution.post_path)
                    self.dem_solution.time_old_print = self.dem_solution.time

                self.dem_solution.FinalizeTimeStep(self.dem_solution.time)

            DemFem.InterpolateStructuralSolutionForDEM(
            ).RestoreStructuralSolution(self.structural_mp)