scheme = TaylorScheme() elif DEM_parameters.IntegrationScheme == 'Newmark_Beta_Method': scheme = NewmarkBetaScheme(0.5, 0.25) elif DEM_parameters.IntegrationScheme == 'Verlet_Velocity': scheme = VerletVelocityScheme() else: KRATOSprint( 'Error: selected scheme not defined. Please select a different scheme') if DEM_parameters.ElementType == "SwimmingNanoParticle": scheme = TerminalVelocityScheme() # Creating a solver object and set the search strategy solver = SolverStrategy.ExplicitStrategy(spheres_model_part, rigid_face_model_part, cluster_model_part, DEM_inlet_model_part, creator_destructor, dem_fem_search, scheme, DEM_parameters, procedures) # Add variables procedures.AddCommonVariables(spheres_model_part, DEM_parameters) procedures.AddSpheresVariables(spheres_model_part, DEM_parameters) procedures.AddMpiVariables(spheres_model_part) solver.AddAdditionalVariables(spheres_model_part, DEM_parameters) procedures.AddCommonVariables(cluster_model_part, DEM_parameters) procedures.AddClusterVariables(cluster_model_part, DEM_parameters) procedures.AddMpiVariables(cluster_model_part) procedures.AddCommonVariables(DEM_inlet_model_part, DEM_parameters) procedures.AddSpheresVariables(DEM_inlet_model_part, DEM_parameters) solver.AddAdditionalVariables(DEM_inlet_model_part, DEM_parameters) procedures.AddCommonVariables(rigid_face_model_part, DEM_parameters)
mp_list.append(rigid_face_model_part) mp_list.append(cluster_model_part) mp_list.append(DEM_inlet_model_part) mp_list.append(mapping_model_part) mp_list.append(contact_model_part) all_model_parts = DEM_procedures.SetOfModelParts(mp_list) # Constructing a utilities objects creator_destructor = ParticleCreatorDestructor() dem_fem_search = DEM_FEM_Search() scheme = procedures.SetScheme() #solver = SolverStrategy.ExplicitStrategy(spheres_model_part, rigid_face_model_part, cluster_model_part, DEM_inlet_model_part, contact_model_part, creator_destructor, dem_fem_search, scheme, DEM_parameters, procedures) solver = SolverStrategy.ExplicitStrategy(all_model_parts, creator_destructor, dem_fem_search, scheme, DEM_parameters, procedures) procedures.AddAllVariablesInAllModelParts(solver, scheme, all_model_parts, DEM_parameters) os.chdir(main_path) DEM_parameters.problem_name = 'benchmark' + str(benchmark_number) # Reading the model_part spheres_mp_filename = DEM_parameters.problem_name + "DEM" model_part_io_spheres = model_part_reader(spheres_mp_filename) if (hasattr(DEM_parameters, "do_not_perform_initial_partition") and DEM_parameters.do_not_perform_initial_partition == 1): pass
procedures.PreProcessModel(DEM_parameters) # Prepare modelparts spheres_model_part = ModelPart("SpheresPart") rigid_face_model_part = ModelPart("RigidFace_Part") mixed_model_part = ModelPart("Mixed_Part") cluster_model_part = ModelPart("Cluster_Part") DEM_inlet_model_part = ModelPart("DEMInletPart") mapping_model_part = ModelPart("Mappingmodel_part") contact_model_part = "" # Constructing a creator/destructor object creator_destructor = ParticleCreatorDestructor() # Creating a solver object and set the search strategy solver = SolverStrategy.ExplicitStrategy( spheres_model_part, rigid_face_model_part, cluster_model_part, DEM_inlet_model_part, creator_destructor, DEM_parameters) # Add variables procedures.AddCommonVariables(spheres_model_part, DEM_parameters) procedures.AddSpheresVariables(spheres_model_part, DEM_parameters) procedures.AddMpiVariables(spheres_model_part) solver.AddAdditionalVariables(spheres_model_part, DEM_parameters) procedures.AddCommonVariables(cluster_model_part, DEM_parameters) procedures.AddClusterVariables(cluster_model_part, DEM_parameters) procedures.AddMpiVariables(cluster_model_part) procedures.AddCommonVariables(DEM_inlet_model_part, DEM_parameters) procedures.AddSpheresVariables(DEM_inlet_model_part, DEM_parameters) solver.AddAdditionalVariables(DEM_inlet_model_part, DEM_parameters) # procedures.AddCommonVariables(rigid_face_model_part, DEM_parameters) procedures.AddRigidFaceVariables(rigid_face_model_part, DEM_parameters)
# creating a custom functions calculator for the implementation of additional custom functions custom_functions_tool = swim_proc.FunctionsCalculator(ProjectParameters) # creating a CreatorDestructor object, responsible for any adding or removing of elements during the simulation creator_destructor = ParticleCreatorDestructor() max_fluid_node_Id = swim_proc.FindMaxNodeIdInFLuid(fluid_model_part) creator_destructor.SetMaxNodeId(max_fluid_node_Id) # setting up a bounding box for the DEM balls (it is used for erasing remote balls) DEM_proc.SetBoundingBox(balls_model_part, creator_destructor) # creating a Solver object for the DEM part. It contains the sequence of function calls necessary for the evolution of the DEM system at every time step dem_solver = DEMSolverStrategy.ExplicitStrategy(balls_model_part, clusters_model_part, rigid_faces_model_part, creator_destructor, ProjectParameters.dem) # 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) dem_solver.Initialize() # creating a distance calculation process for the embedded technology # (used to calculate elemental distances defining the structure embedded in the fluid mesh) if (ProjectParameters.embedded_option): calculate_distance_process = CalculateSignedDistanceTo3DSkinProcess( rigid_faces_model_part, fluid_model_part) calculate_distance_process.Execute() # constructing a model part for the DEM inlet. it contains the DEM elements to be released during the simulation