def InitializeSolutionAfterRemeshing(self): # Initialize the "flag" IS_DEM in all the nodes KratosMultiphysics.VariableUtils().SetNonHistoricalVariable(KratosFemDem.IS_DEM, False, self.FEM_Solution.main_model_part.Nodes) # Initialize the "flag" NODAL_FORCE_APPLIED in all the nodes KratosMultiphysics.VariableUtils().SetNonHistoricalVariable(KratosFemDem.NODAL_FORCE_APPLIED, False, self.FEM_Solution.main_model_part.Nodes) # Initialize the "flag" RADIUS in all the nodes KratosMultiphysics.VariableUtils().SetNonHistoricalVariable(KratosMultiphysics.RADIUS, False, self.FEM_Solution.main_model_part.Nodes) if self.FEM_Solution.ProjectParameters.Has("pressure_load_extrapolation") == False: self.PressureLoad = False else: self.PressureLoad = self.FEM_Solution.ProjectParameters["pressure_load_extrapolation"].GetBool() if self.PressureLoad: KratosFemDem.AssignPressureIdProcess(self.FEM_Solution.main_model_part).Execute() # Remove DEMS from previous mesh self.SpheresModelPart.Elements.clear() self.SpheresModelPart.Nodes.clear() self.InitializeDummyNodalForces() self.InitializeMMGvariables() self.FEM_Solution.model_processes = self.FEM_Solution.AddProcesses() self.FEM_Solution.model_processes.ExecuteInitialize() self.FEM_Solution.model_processes.ExecuteBeforeSolutionLoop() self.FEM_Solution.model_processes.ExecuteInitializeSolutionStep() # Search the skin nodes for the remeshing skin_detection_process = KratosMultiphysics.SkinDetectionProcess2D(self.FEM_Solution.main_model_part, self.SkinDetectionProcessParameters) skin_detection_process.Execute() self.GenerateDemAfterRemeshing()
def Initialize(self): if self.domain_size == 2: self.number_of_nodes_element = 3 else: # 3D self.number_of_nodes_element = 4 self.FEM_Solution.main_model_part.ProcessInfo[ KratosFemDem. ERASED_VOLUME] = 0.0 # Sand Production Calculations self.FEM_Solution.Initialize() self.DEM_Solution.Initialize() nodes = self.FEM_Solution.main_model_part.Nodes utils = KratosMultiphysics.VariableUtils() # Initialize the "flag" IS_DEM in all the nodes utils.SetNonHistoricalVariable(KratosFemDem.IS_DEM, False, nodes) # Initialize the "flag" NODAL_FORCE_APPLIED in all the nodes utils.SetNonHistoricalVariable(KratosFemDem.NODAL_FORCE_APPLIED, False, nodes) # Initialize the "flag" RADIUS in all the nodes utils.SetNonHistoricalVariable(KratosMultiphysics.RADIUS, 0.0, nodes) # Initialize the var to track volume erased for each pressure utils.SetNonHistoricalVariable(KratosFemDem.PRESSURE_VOLUME, 0.0, nodes) utils.SetNonHistoricalVariable(KratosFemDem.PRESSURE_INITIAL_VOLUME, 0.0, nodes) self.SpheresModelPart = self.DEM_Solution.spheres_model_part self.DEMParameters = self.DEM_Solution.DEM_parameters self.DEMProperties = self.SpheresModelPart.GetProperties()[1] self.ParticleCreatorDestructor = PCD.FemDemParticleCreatorDestructor( self.SpheresModelPart, self.DEMProperties, self.DEMParameters) if self.domain_size == 3: self.nodal_neighbour_finder = KratosMultiphysics.FindNodalNeighboursProcess( self.FEM_Solution.main_model_part, 4, 5) if self.DoRemeshing: self.InitializeMMGvariables() self.RemeshingProcessMMG.ExecuteInitialize() if self.FEM_Solution.ProjectParameters.Has( "transfer_dem_contact_forces") == False: self.TransferDEMContactForcesToFEM = True else: self.TransferDEMContactForcesToFEM = self.FEM_Solution.ProjectParameters[ "transfer_dem_contact_forces"].GetBool() if self.FEM_Solution.ProjectParameters.Has( "pressure_load_extrapolation") == False: self.PressureLoad = False else: self.PressureLoad = self.FEM_Solution.ProjectParameters[ "pressure_load_extrapolation"].GetBool() if self.FEM_Solution.ProjectParameters.Has("DEM_FEM_contact") == False: self.DEMFEM_contact = False else: self.DEMFEM_contact = self.FEM_Solution.ProjectParameters[ "DEM_FEM_contact"].GetBool() self.FEM_Solution.main_model_part.ProcessInfo[ KratosFemDem.DEMFEM_CONTACT] = self.DEMFEM_contact # Initialize IP variables to zero self.InitializeIntegrationPointsVariables() if self.PressureLoad: KratosFemDem.AssignPressureIdProcess( self.FEM_Solution.main_model_part).Execute() KratosFemDem.ComputeInitialVolumeProcess( self.FEM_Solution.main_model_part).Execute() if self.FEM_Solution.ProjectParameters.Has("tangent_operator") == True: # 0 -> Elastic , 1 -> Secant , 2 -> Tangent , 3 -> Tangent 2nd Order tangent_type = self.FEM_Solution.ProjectParameters[ "tangent_operator"].GetInt() self.FEM_Solution.main_model_part.ProcessInfo[ KratosFemDem.TANGENT_CONSTITUTIVE_TENSOR] = tangent_type else: self.FEM_Solution.main_model_part.ProcessInfo[ KratosFemDem.TANGENT_CONSTITUTIVE_TENSOR] = 2 self.SkinDetectionProcessParameters = KratosMultiphysics.Parameters(""" { "name_auxiliar_model_part" : "SkinDEMModelPart", "name_auxiliar_condition" : "Condition", "echo_level" : 0 }""") # for the dem contact forces coupling self.InitializeDummyNodalForces() # Just to find neighbours the 1st time self.FEM_Solution.main_model_part.ProcessInfo[ KratosFemDem.GENERATE_DEM] = True if self.domain_size == 3: self.FEM_Solution.main_model_part.ProcessInfo[ KratosFemDem.RECOMPUTE_NEIGHBOURS] = True self.FEM_Solution.KratosPrintInfo("") self.FEM_Solution.KratosPrintInfo( " ______ ___ ____ ") self.FEM_Solution.KratosPrintInfo( " / ____/___ ____ ___ |__ \ / __ \ ___ ____ ___ ") self.FEM_Solution.KratosPrintInfo( " / /_ / _ \ / __ `__ \ __/ / / / / // _ \ / __ `__ \ ") self.FEM_Solution.KratosPrintInfo( " / __/ / __// / / / / // __/ / /_/ // __// / / / / /") self.FEM_Solution.KratosPrintInfo( "/_/ \___//_/ /_/ /_//____//_____/ \___//_/ /_/ /_/ Application" ) self.FEM_Solution.KratosPrintInfo( " Developed by Alejandro Cornejo") self.FEM_Solution.KratosPrintInfo("") if self.echo_level > 0: self.FEM_Solution.KratosPrintInfo("FEM-DEM Solution initialized") if self.domain_size == 3: # only in 3D # We assign the flag to recompute neighbours inside the 3D elements the 1st time utils = KratosMultiphysics.VariableUtils() utils.SetNonHistoricalVariable( KratosFemDem.RECOMPUTE_NEIGHBOURS, True, self.FEM_Solution.main_model_part.Elements) # We assign the flag to recompute neighbours inside the 3D elements the 1st time utils = KratosMultiphysics.VariableUtils() utils.SetNonHistoricalVariable( KratosFemDem.RECOMPUTE_NEIGHBOURS, True, self.FEM_Solution.main_model_part.Elements) if self.FEM_Solution.ProjectParameters.Has( "create_initial_skin") == False: self.CreateInitialSkin = False else: self.CreateInitialSkin = self.FEM_Solution.ProjectParameters[ "create_initial_skin"].GetBool() # Initialize the coupled post process if not self.is_slave: self.InitializePostProcess()
def Initialize(self): self.number_of_nodes_element = 4 self.FEM_Solution.Initialize() self.DEM_Solution.Initialize() # Initialize the "flag" IS_DEM in all the nodes KratosMultiphysics.VariableUtils().SetNonHistoricalVariable( KratosFemDem.IS_DEM, False, self.FEM_Solution.main_model_part.Nodes) # Initialize the "flag" NODAL_FORCE_APPLIED in all the nodes KratosMultiphysics.VariableUtils().SetNonHistoricalVariable( KratosFemDem.NODAL_FORCE_APPLIED, False, self.FEM_Solution.main_model_part.Nodes) # Initialize the "flag" RADIUS in all the nodes KratosMultiphysics.VariableUtils().SetNonHistoricalVariable( KratosMultiphysics.RADIUS, False, self.FEM_Solution.main_model_part.Nodes) # Initialize IP variables to zero self.InitializeIntegrationPointsVariables() self.SpheresModelPart = self.DEM_Solution.spheres_model_part self.DEMParameters = self.DEM_Solution.DEM_parameters self.DEMProperties = self.SpheresModelPart.GetProperties()[1] self.ParticleCreatorDestructor = PCD.FemDemParticleCreatorDestructor( self.SpheresModelPart, self.DEMProperties, self.DEMParameters) self.nodal_neighbour_finder = KratosMultiphysics.FindNodalNeighboursProcess( self.FEM_Solution.main_model_part, 4, 5) if self.DoRemeshing: self.InitializeMMGvariables() self.RemeshingProcessMMG.ExecuteInitialize() if self.FEM_Solution.ProjectParameters.Has( "pressure_load_extrapolation") == False: self.PressureLoad = False else: self.PressureLoad = self.FEM_Solution.ProjectParameters[ "pressure_load_extrapolation"].GetBool() if self.PressureLoad: KratosFemDem.AssignPressureIdProcess( self.FEM_Solution.main_model_part).Execute() # for the dem contact forces coupling self.InitializeDummyNodalForces() # Just to find neighbours the 1st time self.FEM_Solution.main_model_part.ProcessInfo[ KratosFemDem.GENERATE_DEM] = True self.FEM_Solution.main_model_part.ProcessInfo[ KratosFemDem.RECOMPUTE_NEIGHBOURS] = True KratosMultiphysics.Logger.PrintInfo( " /$$$$$$$$ /$$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$$ /$$ /$$" ) KratosMultiphysics.Logger.PrintInfo( "| $$_____/| $$_____/| $$$ /$$$ /$$__ $$| $$__ $$| $$_____/| $$$ /$$$" ) KratosMultiphysics.Logger.PrintInfo( "| $$ | $$ | $$$$ /$$$$|__/ \ $$| $$ \ $$| $$ | $$$$ /$$$$" ) KratosMultiphysics.Logger.PrintInfo( "| $$$$$ | $$$$$ | $$ $$/$$ $$ /$$$$$$/| $$ | $$| $$$$$ | $$ $$/$$ $$" ) KratosMultiphysics.Logger.PrintInfo( "| $$__/ | $$__/ | $$ $$$| $$ /$$____/ | $$ | $$| $$__/ | $$ $$$| $$" ) KratosMultiphysics.Logger.PrintInfo( "| $$ | $$ | $$\ $ | $$| $$ | $$ | $$| $$ | $$\ $ | $$" ) KratosMultiphysics.Logger.PrintInfo( "| $$ | $$$$$$$$| $$ \/ | $$| $$$$$$$$| $$$$$$$/| $$$$$$$$| $$ \/ | $$" ) KratosMultiphysics.Logger.PrintInfo( "|__/ |________/|__/ |__/|________/|_______/ |________/|__/ |__/ 3D Application" ) KratosMultiphysics.Logger.PrintInfo("") if self.echo_level > 0: KratosMultiphysics.Logger.PrintInfo("FEM-DEM Solution initialized") # We assign the flag to recompute neighbours inside the 3D elements the 1st time utils = KratosMultiphysics.VariableUtils() utils.SetNonHistoricalVariable( KratosFemDem.RECOMPUTE_NEIGHBOURS, True, self.FEM_Solution.main_model_part.Elements)
def Initialize(self): self.number_of_nodes_element = 3 self.FEM_Solution.Initialize() self.DEM_Solution.Initialize() nodes = self.FEM_Solution.main_model_part.Nodes # Initialize the "flag" IS_DEM in all the nodes KratosMultiphysics.VariableUtils().SetNonHistoricalVariable(KratosFemDem.IS_DEM, False, nodes) # Initialize the "flag" NODAL_FORCE_APPLIED in all the nodes KratosMultiphysics.VariableUtils().SetNonHistoricalVariable(KratosFemDem.NODAL_FORCE_APPLIED, False, nodes) # Initialize the "flag" RADIUS in all the nodes KratosMultiphysics.VariableUtils().SetNonHistoricalVariable(KratosMultiphysics.RADIUS, 0.0, nodes) # Initialize IP variables to zero self.InitializeIntegrationPointsVariables() self.SpheresModelPart = self.DEM_Solution.spheres_model_part self.DEMParameters = self.DEM_Solution.DEM_parameters self.DEMProperties = self.SpheresModelPart.GetProperties()[1] self.ParticleCreatorDestructor = PCD.FemDemParticleCreatorDestructor(self.SpheresModelPart, self.DEMProperties, self.DEMParameters) if self.DoRemeshing: self.InitializeMMGvariables() self.RemeshingProcessMMG.ExecuteInitialize() if self.FEM_Solution.ProjectParameters.Has("pressure_load_extrapolation") == False: self.PressureLoad = False else: self.PressureLoad = self.FEM_Solution.ProjectParameters["pressure_load_extrapolation"].GetBool() if self.PressureLoad: KratosFemDem.AssignPressureIdProcess(self.FEM_Solution.main_model_part).Execute() if self.FEM_Solution.ProjectParameters.Has("displacement_perturbed_tangent") == False: self.DisplacementPerturbedTangent = False else: self.DisplacementPerturbedTangent = self.FEM_Solution.ProjectParameters["displacement_perturbed_tangent"].GetBool() self.SkinDetectionProcessParameters = KratosMultiphysics.Parameters(""" { "name_auxiliar_model_part" : "SkinDEMModelPart", "name_auxiliar_condition" : "Condition", "echo_level" : 0 }""") # for the dem contact forces coupling self.InitializeDummyNodalForces() # Just to find neighbours the 1st time self.FEM_Solution.main_model_part.ProcessInfo[KratosFemDem.GENERATE_DEM] = True KratosMultiphysics.Logger.PrintInfo(" /$$$$$$$$ /$$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$$ /$$ /$$") KratosMultiphysics.Logger.PrintInfo("| $$_____/| $$_____/| $$$ /$$$ /$$__ $$| $$__ $$| $$_____/| $$$ /$$$") KratosMultiphysics.Logger.PrintInfo("| $$ | $$ | $$$$ /$$$$|__/ \ $$| $$ \ $$| $$ | $$$$ /$$$$") KratosMultiphysics.Logger.PrintInfo("| $$$$$ | $$$$$ | $$ $$/$$ $$ /$$$$$$/| $$ | $$| $$$$$ | $$ $$/$$ $$") KratosMultiphysics.Logger.PrintInfo("| $$__/ | $$__/ | $$ $$$| $$ /$$____/ | $$ | $$| $$__/ | $$ $$$| $$") KratosMultiphysics.Logger.PrintInfo("| $$ | $$ | $$\ $ | $$| $$ | $$ | $$| $$ | $$\ $ | $$") KratosMultiphysics.Logger.PrintInfo("| $$ | $$$$$$$$| $$ \/ | $$| $$$$$$$$| $$$$$$$/| $$$$$$$$| $$ \/ | $$") KratosMultiphysics.Logger.PrintInfo("|__/ |________/|__/ |__/|________/|_______/ |________/|__/ |__/ 2D Application") if self.echo_level > 0: KratosMultiphysics.Logger.PrintInfo("FEM-DEM Solution initialized")