def Initialize(self): ## Construct the communicator self.EpetraCommunicator = KratosTrilinos.CreateCommunicator() ## Get the computing model part 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 Trilinos convergence criteria self.conv_criteria = KratosTrilinos.TrilinosUPCriteria(self.settings["relative_velocity_tolerance"].GetDouble(), self.settings["absolute_velocity_tolerance"].GetDouble(), self.settings["relative_pressure_tolerance"].GetDouble(), self.settings["absolute_pressure_tolerance"].GetDouble(), self.EpetraCommunicator) ## Constructing the BDF process (time coefficients update) self.bdf_process = KratosMultiphysics.ComputeBDFCoefficientsProcess(self.computing_model_part,self.settings["time_order"].GetInt()) ## Creating the Trilinos incremental update time scheme (the time integration is defined within the embedded element) self.time_scheme = KratosTrilinos.TrilinosResidualBasedIncrementalUpdateStaticSchemeSlip(self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE], # Domain size (2,3) self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE]+1) # DOFs (3,4) ## Set the guess_row_size (guess about the number of zero entries) for the Trilinos builder and solver if self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 3: guess_row_size = 20*4 elif self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2: guess_row_size = 10*3 ## Construct the Trilinos builder and solver if self.settings["consider_periodic_conditions"].GetBool() == True: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolverPeriodic(self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver, KratosFluid.PATCH_INDEX) else: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolver(self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver) ## Construct the Trilinos Newton-Raphson strategy self.solver = KratosTrilinos.TrilinosNewtonRaphsonStrategy(self.main_model_part, self.time_scheme, self.trilinos_linear_solver, self.conv_criteria, self.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.solver).Initialize() (self.solver).Check() self.main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DYNAMIC_TAU, self.settings["dynamic_tau"].GetDouble())
def Initialize(self): ## Construct the communicator self.EpetraCommunicator = TrilinosApplication.CreateCommunicator() ## Get the computing model part self.computing_model_part = self.GetComputingModelPart() domain_size = self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] if self.settings["response_function_settings"]["response_type"].GetString() == "drag": if (domain_size == 2): self.response_function = FluidDynamicsApplication.DragResponseFunction2D(self.settings["response_function_settings"]["custom_settings"], self.main_model_part) elif (domain_size == 3): self.response_function = FluidDynamicsApplication.DragResponseFunction3D(self.settings["response_function_settings"]["custom_settings"], self.main_model_part) else: raise Exception("Invalid DOMAIN_SIZE: " + str(domain_size)) else: raise Exception("invalid response_type: " + self.settings["response_function_settings"]["response_type"].GetString()) self.sensitivity_builder = KratosMultiphysics.SensitivityBuilder(self.settings["sensitivity_settings"], self.main_model_part, self.response_function) if self.settings["scheme_settings"]["scheme_type"].GetString() == "bossak": self.time_scheme = TrilinosApplication.TrilinosResidualBasedAdjointBossakScheme(self.settings["scheme_settings"], self.response_function) elif self.settings["scheme_settings"]["scheme_type"].GetString() == "steady": self.time_scheme = TrilinosApplication.TrilinosResidualBasedAdjointSteadyScheme(self.response_function) else: raise Exception("invalid scheme_type: " + self.settings["scheme_settings"]["scheme_type"].GetString()) if self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 3: guess_row_size = 20*4 elif self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2: guess_row_size = 10*3 self.builder_and_solver = TrilinosApplication.TrilinosBlockBuilderAndSolver(self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver) self.solver = TrilinosApplication.TrilinosLinearStrategy(self.main_model_part, self.time_scheme, self.trilinos_linear_solver, self.builder_and_solver, False, False, False, False) (self.solver).SetEchoLevel(self.settings["echo_level"].GetInt()) (self.solver).Initialize() (self.response_function).Initialize() (self.sensitivity_builder).Initialize() self.main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DYNAMIC_TAU, self.settings["dynamic_tau"].GetDouble()) self.main_model_part.ProcessInfo.SetValue(KratosMultiphysics.OSS_SWITCH, self.settings["oss_switch"].GetInt()) if self._IsPrintingRank(): KratosMultiphysics.Logger.PrintInfo(self.__class__.__name__,"Monolithic MPI solver initialization finished.")
def _create_builder_and_solver(self): linear_solver = self.get_linear_solver() epetra_communicator = self.get_epetra_communicator() if (self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2): guess_row_size = 15 else: guess_row_size = 45 if (self.settings["block_builder"].GetBool() == True): builder_and_solver = TrilinosApplication.TrilinosBlockBuilderAndSolver( epetra_communicator, guess_row_size, linear_solver) else: builder_and_solver = TrilinosApplication.TrilinosEliminationBuilderAndSolver( epetra_communicator, guess_row_size, linear_solver) return builder_and_solver
def _ConstructBuilderAndSolver(self, block_builder): if (self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2): guess_row_size = 15 else: guess_row_size = 45 if (block_builder): builder_and_solver = TrilinosApplication.TrilinosBlockBuilderAndSolver( self.EpetraCommunicator, guess_row_size, self.linear_solver) else: builder_and_solver = TrilinosApplication.TrilinosEliminationBuilderAndSolver( self.EpetraCommunicator, guess_row_size, self.linear_solver) return builder_and_solver
def _create_builder_and_solver(self): if self.settings["multi_point_constraints_used"].GetBool(): raise Exception("MPCs not yet implemented in MPI") linear_solver = self.get_linear_solver() epetra_communicator = self.get_epetra_communicator() if (self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2): guess_row_size = 15 else: guess_row_size = 45 if (self.settings["block_builder"].GetBool() == True): builder_and_solver = TrilinosApplication.TrilinosBlockBuilderAndSolver( epetra_communicator, guess_row_size, linear_solver) else: builder_and_solver = TrilinosApplication.TrilinosEliminationBuilderAndSolver( epetra_communicator, guess_row_size, linear_solver) return builder_and_solver
def _CreateBuilderAndSolver(self): # Set the guess_row_size (guess about the number of zero entries) for the Trilinos builder and solver domain_size = self.GetComputingModelPart().ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE] if domain_size == 3: guess_row_size = 20 * 4 else: guess_row_size = 10 * 3 # Construct the Trilinos builder and solver trilinos_linear_solver = self._GetLinearSolver() epetra_communicator = self._GetEpetraCommunicator() if self.settings["consider_periodic_conditions"].GetBool(): builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolverPeriodic( epetra_communicator, guess_row_size, trilinos_linear_solver, KratosFluid.PATCH_INDEX) else: builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolver( epetra_communicator, guess_row_size, trilinos_linear_solver) return builder_and_solver
def _create_builder_and_solver(self): if self.settings["multi_point_constraints_used"].GetBool(): raise Exception("MPCs not yet implemented in MPI") if (self.GetComputingModelPart().NumberOfMasterSlaveConstraints() > 0): self.print_warning_on_rank_zero("Constraints are not yet implemented in MPI and will therefore not be considered!") linear_solver = self.get_linear_solver() epetra_communicator = self.get_epetra_communicator() if(self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2): guess_row_size = 15 else: guess_row_size = 45 if(self.settings["block_builder"].GetBool() == True): builder_and_solver = TrilinosApplication.TrilinosBlockBuilderAndSolver(epetra_communicator, guess_row_size, linear_solver) else: builder_and_solver = TrilinosApplication.TrilinosEliminationBuilderAndSolver(epetra_communicator, guess_row_size, linear_solver) return builder_and_solver
def Initialize(self): ## Construct the communicator self.EpetraCommunicator = KratosTrilinos.CreateCommunicator() ## Get the computing model part 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( ) # Set the time discretization utility to compute the BDF coefficients time_order = self.settings["time_order"].GetInt() if time_order == 2: self.time_discretization = KratosMultiphysics.TimeDiscretization.BDF( time_order) else: raise Exception( "Only \"time_order\" equal to 2 is supported. Provided \"time_order\": " + str(time_order)) ## Creating the Trilinos convergence criteria self.conv_criteria = KratosTrilinos.TrilinosUPCriteria( self.settings["relative_velocity_tolerance"].GetDouble(), self.settings["absolute_velocity_tolerance"].GetDouble(), self.settings["relative_pressure_tolerance"].GetDouble(), self.settings["absolute_pressure_tolerance"].GetDouble()) (self.conv_criteria).SetEchoLevel(self.settings["echo_level"].GetInt()) ## Creating the Trilinos incremental update time scheme (the time integration is defined within the embedded element) self.time_scheme = KratosTrilinos.TrilinosResidualBasedIncrementalUpdateStaticSchemeSlip( self.main_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE], # Domain size (2,3) self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] + 1) # DOFs (3,4) ## Set the guess_row_size (guess about the number of zero entries) for the Trilinos builder and solver if self.main_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE] == 3: guess_row_size = 20 * 4 elif self.main_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE] == 2: guess_row_size = 10 * 3 ## Construct the Trilinos builder and solver if self.settings["consider_periodic_conditions"].GetBool() == True: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolverPeriodic( self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver, KratosFluid.PATCH_INDEX) else: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolver( self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver) ## Construct the Trilinos Newton-Raphson strategy self.solver = KratosTrilinos.TrilinosNewtonRaphsonStrategy( self.main_model_part, self.time_scheme, self.trilinos_linear_solver, self.conv_criteria, self.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.solver).Initialize() # For the primitive Ausas formulation, set the find nodal neighbours process # Recall that the Ausas condition requires the nodal neighbouts. if (self.settings["formulation"]["element_type"].GetString() == "embedded_ausas_navier_stokes"): number_of_avg_elems = 10 number_of_avg_nodes = 10 self.find_nodal_neighbours_process = KratosMultiphysics.FindNodalNeighboursProcess( self.GetComputingModelPart(), number_of_avg_elems, number_of_avg_nodes) KratosMultiphysics.Logger.PrintInfo( "NavierStokesMPIEmbeddedMonolithicSolver", "Solver initialization finished.")
def Initialize(self): ## Construct the communicator self.EpetraCommunicator = KratosTrilinos.CreateCommunicator() ## Get the computing model part 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 Trilinos convergence criteria self.conv_criteria = KratosTrilinos.TrilinosUPCriteria(self.settings["relative_velocity_tolerance"].GetDouble(), self.settings["absolute_velocity_tolerance"].GetDouble(), self.settings["relative_pressure_tolerance"].GetDouble(), self.settings["absolute_pressure_tolerance"].GetDouble()) ## Creating the Trilinos time scheme if (self.settings["turbulence_model"].GetString() == "None"): if self.settings["consider_periodic_conditions"].GetBool() == True: self.time_scheme = KratosTrilinos.TrilinosPredictorCorrectorVelocityBossakSchemeTurbulent(self.settings["alpha"].GetDouble(), self.settings["move_mesh_strategy"].GetInt(), self.computing_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE], KratosCFD.PATCH_INDEX) else: self.time_scheme = KratosTrilinos.TrilinosPredictorCorrectorVelocityBossakSchemeTurbulent(self.settings["alpha"].GetDouble(), self.settings["move_mesh_strategy"].GetInt(), self.computing_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE]) ## Set the guess_row_size (guess about the number of zero entries) for the Trilinos builder and solver if self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 3: guess_row_size = 20*4 elif self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2: guess_row_size = 10*3 ## Construct the Trilinos builder and solver if self.settings["consider_periodic_conditions"].GetBool() == True: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolverPeriodic(self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver, KratosCFD.PATCH_INDEX) else: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolver(self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver) ## Construct the Trilinos Newton-Raphson strategy self.solver = KratosTrilinos.TrilinosNewtonRaphsonStrategy(self.main_model_part, self.time_scheme, self.trilinos_linear_solver, self.conv_criteria, self.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.solver).Initialize() (self.solver).Check() self.main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DYNAMIC_TAU, self.settings["dynamic_tau"].GetDouble()) self.main_model_part.ProcessInfo.SetValue(KratosMultiphysics.OSS_SWITCH, self.settings["oss_switch"].GetInt()) print ("Monolithic MPI solver initialization finished.")
def Initialize(self): self.epetra_comm = TrilinosApplication.CreateCommunicator() self.computing_model_part = self.GetComputingModelPart() domain_size = self.main_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE] if self.settings["response_function_settings"][ "response_type"].GetString() == "drag": if (domain_size == 2): self.response_function = AdjointFluidApplication.DragResponseFunction2D( self.main_model_part, self.settings["response_function_settings"]) elif (domain_size == 3): self.response_function = AdjointFluidApplication.DragResponseFunction3D( self.main_model_part, self.settings["response_function_settings"]) else: raise Exception("Invalid DOMAIN_SIZE: " + str(domain_size)) else: raise Exception("invalid response_type: " + self.settings["response_function_settings"] ["response_type"].GetString()) if self.settings["scheme_settings"]["scheme_type"].GetString( ) == "bossak": self.time_scheme = TrilinosApplication.TrilinosAdjointBossakScheme( self.settings["scheme_settings"], self.response_function) elif self.settings["scheme_settings"]["scheme_type"].GetString( ) == "steady": self.time_scheme = TrilinosApplication.TrilinosAdjointSteadyScheme( self.settings["scheme_settings"], self.response_function) else: raise Exception( "invalid scheme_type: " + self.settings["scheme_settings"]["scheme_type"].GetString()) if self.main_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE] == 3: guess_row_size = 20 * 4 elif self.main_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE] == 2: guess_row_size = 10 * 3 self.builder_and_solver = TrilinosApplication.TrilinosBlockBuilderAndSolver( self.epetra_comm, guess_row_size, self.trilinos_linear_solver) self.solver = TrilinosApplication.TrilinosLinearStrategy( self.main_model_part, self.time_scheme, self.trilinos_linear_solver, self.builder_and_solver, False, False, False, False) (self.solver).SetEchoLevel(self.settings["echo_level"].GetInt()) self.solver.Check() self.main_model_part.ProcessInfo.SetValue( KratosMultiphysics.DYNAMIC_TAU, self.settings["dynamic_tau"].GetDouble()) self.main_model_part.ProcessInfo.SetValue( KratosMultiphysics.OSS_SWITCH, self.settings["oss_switch"].GetInt()) print("Monolithic MPI solver initialization finished.")
def Initialize(self): ## Construct the communicator self.EpetraCommunicator = KratosTrilinos.CreateCommunicator() ## Get the computing model part self.computing_model_part = self.GetComputingModelPart() KratosMultiphysics.NormalCalculationUtils().CalculateOnSimplex(self.computing_model_part, self.computing_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE]) self.neighbour_search = KratosMultiphysics.FindNodalNeighboursProcess(self.computing_model_part) (self.neighbour_search).Execute() self.accelerationLimitationUtility = KratosMultiphysics.FluidDynamicsApplication.AccelerationLimitationUtilities(self.computing_model_part, 5.0) ## If needed, create the estimate time step utility if (self.settings["time_stepping"]["automatic_time_step"].GetBool()): self.EstimateDeltaTimeUtility = self._GetAutomaticTimeSteppingUtility() # Set the time discretization utility to compute the BDF coefficients time_order = self.settings["time_order"].GetInt() if time_order == 2: self.time_discretization = KratosMultiphysics.TimeDiscretization.BDF(time_order) else: raise Exception("Only \"time_order\" equal to 2 is supported. Provided \"time_order\": " + str(time_order)) ## Creating the Trilinos convergence criteria self.conv_criteria = KratosTrilinos.TrilinosUPCriteria(self.settings["relative_velocity_tolerance"].GetDouble(), self.settings["absolute_velocity_tolerance"].GetDouble(), self.settings["relative_pressure_tolerance"].GetDouble(), self.settings["absolute_pressure_tolerance"].GetDouble()) (self.conv_criteria).SetEchoLevel(self.settings["echo_level"].GetInt()) #### ADDING NEW PROCESSES : level-set-convection and variational-distance-process self.level_set_convection_process = self._set_level_set_convection_process() self.variational_distance_process = self._set_variational_distance_process() ## Creating the Trilinos incremental update time scheme (the time integration is defined within the TwoFluidNavierStokes element) self.time_scheme = KratosTrilinos.TrilinosResidualBasedIncrementalUpdateStaticSchemeSlip(self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE], # Domain size (2,3) self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE]+1) # DOFs (3,4) ## Set the guess_row_size (guess about the number of zero entries) for the Trilinos builder and solver if self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 3: guess_row_size = 20*4 elif self.main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2: guess_row_size = 10*3 ## Construct the Trilinos builder and solver if self.settings["consider_periodic_conditions"].GetBool() == True: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolverPeriodic(self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver, KratosFluid.PATCH_INDEX) else: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolver(self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver) ## Construct the Trilinos Newton-Raphson strategy self.solver = KratosTrilinos.TrilinosNewtonRaphsonStrategy(self.main_model_part, self.time_scheme, self.trilinos_linear_solver, self.conv_criteria, self.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.solver).Initialize() (self.solver).Check() self.main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DYNAMIC_TAU, self.settings["formulation"]["dynamic_tau"].GetDouble())
def Initialize(self): ## Construct the communicator self.EpetraCommunicator = KratosTrilinos.CreateCommunicator() ## Get the computing model part 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 Trilinos convergence criteria self.conv_criteria = KratosTrilinos.TrilinosUPCriteria( self.settings["relative_velocity_tolerance"].GetDouble(), self.settings["absolute_velocity_tolerance"].GetDouble(), self.settings["relative_pressure_tolerance"].GetDouble(), self.settings["absolute_pressure_tolerance"].GetDouble()) (self.conv_criteria).SetEchoLevel(self.settings["echo_level"].GetInt()) ## Creating the Trilinos time scheme if (self.element_integrates_in_time): # "Fake" scheme for those cases in where the element manages the time integration # It is required to perform the nodal update once the current time step is solved self.time_scheme = KratosTrilinos.TrilinosResidualBasedIncrementalUpdateStaticSchemeSlip( self.computing_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE], self.computing_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE] + 1) # In case the BDF2 scheme is used inside the element, set the time discretization utility to compute the BDF coefficients if (self.settings["time_scheme"].GetString() == "bdf2"): time_order = self.settings["time_order"].GetInt() if time_order == 2: self.time_discretization = KratosMultiphysics.TimeDiscretization.BDF( time_order) else: raise Exception( "Only \"time_order\" equal to 2 is supported. Provided \"time_order\": " + str(time_order)) else: err_msg = "Requested elemental time scheme " + self.settings[ "time_scheme"].GetString() + " is not available.\n" err_msg += "Available options are: \"bdf2\"" raise Exception(err_msg) else: if (self.settings["turbulence_model"].GetString() == "None"): if self.settings["consider_periodic_conditions"].GetBool( ) == True: self.time_scheme = KratosTrilinos.TrilinosPredictorCorrectorVelocityBossakSchemeTurbulent( self.settings["alpha"].GetDouble(), self.computing_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE], KratosCFD.PATCH_INDEX) else: self.time_scheme = KratosTrilinos.TrilinosPredictorCorrectorVelocityBossakSchemeTurbulent( self.settings["alpha"].GetDouble(), self.settings["move_mesh_strategy"].GetInt(), self.computing_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE]) ## Set the guess_row_size (guess about the number of zero entries) for the Trilinos builder and solver if self.main_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE] == 3: guess_row_size = 20 * 4 elif self.main_model_part.ProcessInfo[ KratosMultiphysics.DOMAIN_SIZE] == 2: guess_row_size = 10 * 3 ## Construct the Trilinos builder and solver if self.settings["consider_periodic_conditions"].GetBool() == True: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolverPeriodic( self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver, KratosCFD.PATCH_INDEX) else: self.builder_and_solver = KratosTrilinos.TrilinosBlockBuilderAndSolver( self.EpetraCommunicator, guess_row_size, self.trilinos_linear_solver) ## Construct the Trilinos Newton-Raphson strategy self.solver = KratosTrilinos.TrilinosNewtonRaphsonStrategy( self.main_model_part, self.time_scheme, self.trilinos_linear_solver, self.conv_criteria, self.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.Print( "Monolithic MPI solver initialization finished.")
def TrilinosBlockBuilderAndSolver(linear_solver, communicator): return KratosTrilinos.TrilinosBlockBuilderAndSolver( communicator, 30, linear_solver)