def Initialize(self): self.time = 0.0 self.time_old_print = 0.0 self.ReadModelParts() self.SetAnalyticFaceWatcher() self.post_normal_impact_velocity_option = False if "PostNormalImpactVelocity" in self.DEM_parameters.keys(): if self.DEM_parameters["PostNormalImpactVelocity"].GetBool(): self.post_normal_impact_velocity_option = True self.FillAnalyticSubModelParts() # Setting up the buffer size self.procedures.SetUpBufferSizeInAllModelParts( self.spheres_model_part, 1, self.cluster_model_part, 1, self.dem_inlet_model_part, 1, self.rigid_face_model_part, 1) self.KratosPrintInfo("Initializing Problem...") self.GraphicalOutputInitialize() # Perform a partition to balance the problem self.SetSearchStrategy() self.SolverBeforeInitialize() self.parallelutils.Repart(self.spheres_model_part) #Setting up the BoundingBox self.bounding_box_time_limits = self.procedures.SetBoundingBoxLimits( self.all_model_parts, self.creator_destructor) #Finding the max id of the nodes... (it is necessary for anything that will add spheres to the self.spheres_model_part, for instance, the INLETS and the CLUSTERS read from mdpa file.z #max_Id = self.procedures.FindMaxNodeIdAccrossModelParts(self.creator_destructor, self.all_model_parts) # TODO this seems not be longer required #self.creator_destructor.SetMaxNodeId(max_Id) self.creator_destructor.SetMaxNodeId( self.all_model_parts.MaxNodeId) #TODO check functionalities self.DEMFEMProcedures = DEM_procedures.DEMFEMProcedures( self.DEM_parameters, self.graphs_path, self.spheres_model_part, self.rigid_face_model_part) self.DEMEnergyCalculator = DEM_procedures.DEMEnergyCalculator( self.DEM_parameters, self.spheres_model_part, self.cluster_model_part, self.graphs_path, "EnergyPlot.grf") self.materialTest.Initialize(self.DEM_parameters, self.procedures, self._GetSolver(), self.graphs_path, self.post_path, self.spheres_model_part, self.rigid_face_model_part) self.KratosPrintInfo("Initialization Complete") self.report.Prepare(timer, self.DEM_parameters["ControlTime"].GetDouble()) self.materialTest.PrintChart() self.materialTest.PrepareDataForGraph() self.post_utils = DEM_procedures.PostUtils(self.DEM_parameters, self.spheres_model_part) self.report.total_steps_expected = int(self.end_time / self._GetSolver().dt) super().Initialize() self.seed = self.DEM_parameters["seed"].GetInt() #Constructing a model part for the DEM inlet. It contains the DEM elements to be released during the simulation #Initializing the DEM solver must be done before creating the DEM Inlet, because the Inlet configures itself according to some options of the DEM model part self.SetInlet() self.SetInitialNodalValues() self.KratosPrintInfo(self.report.BeginReport(timer)) if self.DEM_parameters["output_configuration"][ "print_number_of_neighbours_histogram"].GetBool(): self.PreUtilities.PrintNumberOfNeighboursHistogram( self.spheres_model_part, os.path.join(self.graphs_path, "number_of_neighbours_histogram.txt"))
def Initialize(self): self.step = 0 self.time = 0.0 self.AddVariables() self.ReadModelParts() self.SetAnalyticFaceWatcher() # TODO check order self.post_normal_impact_velocity_option = False if "PostNormalImpactVelocity" in self.DEM_parameters.keys(): if self.DEM_parameters["PostNormalImpactVelocity"].GetBool(): self.post_normal_impact_velocity_option = True self.FillAnalyticSubModelParts() # Setting up the buffer size self.procedures.SetUpBufferSizeInAllModelParts(self.spheres_model_part, 1, self.cluster_model_part, 1, self.dem_inlet_model_part, 1, self.rigid_face_model_part, 1) # Adding dofs # self.AddAllDofs() # Calls to this method are deprecated. self.AddDofs() #-----------os.chdir(self.main_path) self.KratosPrintInfo("Initializing Problem...") self.GraphicalOutputInitialize() # Perform a partition to balance the problem self.SetSearchStrategy() self.SolverBeforeInitialize() self.parallelutils.Repart(self.spheres_model_part) #Setting up the BoundingBox self.bounding_box_time_limits = self.procedures.SetBoundingBoxLimits(self.all_model_parts, self.creator_destructor) #Finding the max id of the nodes... (it is necessary for anything that will add spheres to the self.spheres_model_part, for instance, the INLETS and the CLUSTERS read from mdpa file.z max_Id = self.procedures.FindMaxNodeIdAccrossModelParts(self.creator_destructor, self.all_model_parts) #self.creator_destructor.SetMaxNodeId(max_Id) self.creator_destructor.SetMaxNodeId(self.all_model_parts.MaxNodeId) #TODO check functionalities #Strategy Initialization #-------------os.chdir(self.main_path) self.SolverInitialize() #Constructing a model part for the DEM inlet. It contains the DEM elements to be released during the simulation #Initializing the DEM solver must be done before creating the DEM Inlet, because the Inlet configures itself according to some options of the DEM model part self.SetInlet() self.SetInitialNodalValues() self.DEMFEMProcedures = DEM_procedures.DEMFEMProcedures(self.DEM_parameters, self.graphs_path, self.spheres_model_part, self.rigid_face_model_part) #------------os.chdir(self.graphs_path) self.DEMEnergyCalculator = DEM_procedures.DEMEnergyCalculator(self.DEM_parameters, self.spheres_model_part, self.cluster_model_part, self.graphs_path, "EnergyPlot.grf") self.materialTest.Initialize(self.DEM_parameters, self.procedures, self.solver, self.graphs_path, self.post_path, self.spheres_model_part, self.rigid_face_model_part) self.KratosPrintInfo("Initialization Complete") self.report.Prepare(timer, self.DEM_parameters["ControlTime"].GetDouble()) #self.procedures.ModelData(self.spheres_model_part, self.solver) #check link with ModelDataInfo = "OFF" self.materialTest.PrintChart() self.materialTest.PrepareDataForGraph() self.post_utils = DEM_procedures.PostUtils(self.DEM_parameters, self.spheres_model_part) self.report.total_steps_expected = int(self.end_time / self.solver.dt) self.KratosPrintInfo(self.report.BeginReport(timer))