def ExecuteBeforeSolutionLoop(self): dimension = self.model_part.ProcessInfo[KM.DOMAIN_SIZE] num_of_avg_elems = 10 num_of_avg_nodes = 10 neighbor_search = KM.FindNodalNeighboursProcess(self.model_part) neighbor_search.Execute() neighbor_elements_search = KM.FindElementalNeighboursProcess( self.model_part, dimension, num_of_avg_elems) neighbor_elements_search.Execute() max_num_of_particles = 8 * dimension if dimension == 2: self.moveparticles = PFEM2.MoveParticleUtilityPFEM22D( self.model_part, max_num_of_particles) else: self.moveparticles = PFEM2.MoveParticleUtilityPFEM23D( self.model_part, max_num_of_particles) self.moveparticles.MountBin() if self.print_particles: self.moveparticles.ExecuteParticlesPritingTool( self.lagrangian_model_part, self.filter_factor) self.initial_water_volume = self._get_water_volume_utility().Calculate( )
def _ApplyBoundaryConditions(self): KM.BodyNormalCalculationUtils().CalculateBodyNormals(self.model_part, self.domain_size) if self.domain_size == 2: self.addBC = PFEM2.AddFixedPressureCondition2D(self.model_part) else: self.addBC = PFEM2.AddFixedPressureCondition3D(self.model_part) self.addBC.AddThem()
def _create_water_volume_utility(self): water_volume_utility = None dimension = self.model_part.ProcessInfo[KM.DOMAIN_SIZE] if dimension == 2: water_volume_utility = PFEM2.CalculateWaterFraction2D( self.model_part) else: water_volume_utility = PFEM2.CalculateWaterFraction3D( self.model_part) return water_volume_utility
def ExecuteBeforeSolutionLoop(self): num_of_avg_elems = 10 num_of_avg_nodes = 10 neighbour_search = KratosMultiphysics.FindNodalNeighboursProcess(self.model_part, num_of_avg_elems, num_of_avg_nodes) neighbour_search.Execute() neighbour_elements_search = KratosMultiphysics.FindElementalNeighboursProcess(self.model_part, self.dimension, num_of_avg_elems) neighbour_elements_search.Execute() if self.dimension == 2: self.moveparticles = Pfem2.MoveParticleUtilityPFEM22D(self.model_part, self.max_num_of_particles) else: self.moveparticles = Pfem2.MoveParticleUtilityPFEM23D(self.model_part, self.max_num_of_particles) self.moveparticles.MountBin()
def Initialize(self): self.computing_model_part = self.GetComputingModelPart() # If needed, create the estimate time step utility if (self.settings["time_stepping"]["automatic_time_step"].GetBool()): self.EstimateDeltaTimeUtility = self._GetAutomaticTimeSteppingUtility( ) # Creating the solution strategy self.convergence_criterion = KratosMultiphysics.MixedGenericCriteria([ (KratosMultiphysics.VELOCITY, self.settings["relative_velocity_tolerance"].GetDouble(), self.settings["absolute_velocity_tolerance"].GetDouble()), (KratosMultiphysics.PRESSURE, self.settings["relative_pressure_tolerance"].GetDouble(), self.settings["absolute_pressure_tolerance"].GetDouble()) ]) (self.conv_criteria).SetEchoLevel(self.settings["echo_level"].GetInt()) if (self.settings["turbulence_model"].GetString() == "None"): if self.settings["time_scheme"].GetString() == "bossak": if self.settings["consider_periodic_conditions"].GetBool( ) == True: self.time_scheme = KratosPFEM2.ResidualBasedPredictorCorrectorVelocityBossakAleScheme( self.settings["alpha"].GetDouble(), self.computing_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE], KratosCFD.PATCH_INDEX) else: self.time_scheme = KratosPFEM2.ResidualBasedPredictorCorrectorVelocityBossakAleScheme( self.settings["alpha"].GetDouble(), self.settings["move_mesh_strategy"].GetInt(), self.computing_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE]) elif self.settings["time_scheme"].GetString() == "bdf2": self.time_scheme = KratosCFD.BDF2TurbulentScheme() elif self.settings["time_scheme"].GetString() == "steady": self.time_scheme = KratosCFD.ResidualBasedSimpleSteadyScheme( self.settings["velocity_relaxation"].GetDouble(), self.settings["pressure_relaxation"].GetDouble(), self.computing_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE]) else: raise Exception("Turbulence models are not added yet.") if self.settings["consider_periodic_conditions"].GetBool() == True: builder_and_solver = KratosCFD.ResidualBasedBlockBuilderAndSolverPeriodic( self.linear_solver, KratosCFD.PATCH_INDEX) else: builder_and_solver = KratosMultiphysics.ResidualBasedBlockBuilderAndSolver( self.linear_solver) self.solver = KratosMultiphysics.ResidualBasedNewtonRaphsonStrategy( self.computing_model_part, self.time_scheme, self.linear_solver, self.conv_criteria, builder_and_solver, self.settings["maximum_iterations"].GetInt(), self.settings["compute_reactions"].GetBool(), self.settings["reform_dofs_at_each_step"].GetBool(), self.settings["move_mesh_flag"].GetBool()) (self.solver).SetEchoLevel(self.settings["echo_level"].GetInt()) self.formulation.SetProcessInfo(self.computing_model_part) (self.solver).Initialize() KratosMultiphysics.Logger.PrintInfo( "PFEM2NavierStokesMonolithicSolver", "Solver initialization finished.")
def Initialize(self): super(PFEM2MonolithicSolver, self).Initialize() # Pressure projection calculation model_part = self.GetComputingModelPart() self.explicit_strategy = PFEM2.PFEM2_Explicit_Strategy(model_part,self.domain_size, self.settings["move_mesh_flag"].GetBool())