コード例 #1
0
def CreateConvergenceAccelerator(configuration):

    if (type(configuration) != KratosMultiphysics.Parameters):
        raise Exception(
            "Input is expected to be provided as a Kratos Parameters object.")

    convergence_accelerator_type = configuration["solver_type"].GetString()

    if (convergence_accelerator_type == "constant_relaxation"):
        return KratosFSI.ConstantRelaxationConvergenceAccelerator(
            configuration)

    elif (convergence_accelerator_type == "Relaxation"):
        return KratosFSI.AitkenConvergenceAccelerator(configuration)

    elif (convergence_accelerator_type == "MVQN"):
        return KratosFSI.MVQNFullJacobianConvergenceAccelerator(configuration)

    elif (convergence_accelerator_type == "MVQN_recursive"):
        return KratosFSI.MVQNRecursiveJacobianConvergenceAccelerator(
            configuration)

    elif (convergence_accelerator_type == "IBQN_MVQN"):
        return KratosFSI.IBQNMVQNConvergenceAccelerator(configuration)

    else:
        raise Exception("Convergence accelerator not found. Asking for : " +
                        convergence_accelerator_type)

    return convergence_accelerator
コード例 #2
0
 def __CreatePartitionedFSIUtilities(self):
     if self.domain_size == 2:
         return KratosFSI.PartitionedFSIUtilitiesArray2D()
     elif self.domain_size == 3:
         return KratosFSI.PartitionedFSIUtilitiesArray3D()
     else:
         raise Exception("Domain size expected to be 2 or 3. Got " + str(self.domain_size))
コード例 #3
0
 def _create_partitioned_fsi_utilities(self):
     domain_size = self.GetFatherModelPart().ProcessInfo[KratosMultiphysics.DOMAIN_SIZE]
     if domain_size == 2:
         return KratosFSI.PartitionedFSIUtilitiesArray2D()
     elif domain_size == 3:
         return KratosFSI.PartitionedFSIUtilitiesArray3D()
     else:
         raise Exception("Domain size expected to be 2 or 3. Got " + str(self.domain_size))
コード例 #4
0
    def _GetNodalUpdateUtilities(self):

        if (self.domain_size == 2):
            return KratosFSI.NodalUpdateNewmark2D(
                self.settings["fluid_solver_settings"]["alpha"].GetDouble())
        else:
            return KratosFSI.NodalUpdateNewmark3D(
                self.settings["fluid_solver_settings"]["alpha"].GetDouble())
コード例 #5
0
    def _GetPartitionedFSIUtilities(self):

        if (self.domain_size == 2):
            return KratosFSI.PartitionedFSIUtilities2D(
                self._GetFluidInterfaceSubmodelPart(),
                self._GetStructureInterfaceSubmodelPart())
        else:
            return KratosFSI.PartitionedFSIUtilities3D(
                self._GetFluidInterfaceSubmodelPart(),
                self._GetStructureInterfaceSubmodelPart())
コード例 #6
0
def CreateConvergenceAccelerator(configuration):

    if (type(configuration) != KratosMultiphysics.Parameters):
        raise Exception(
            "Input is expected to be provided as a Kratos Parameters object.")

    convergence_accelerator_type = configuration["solver_type"].GetString()

    if (convergence_accelerator_type == "Relaxation"):

        defaults_relaxation = KratosMultiphysics.Parameters("""{
                                                                "solver_type"       : "Relaxation",
                                                                "acceleration_type" : "Aitken",
                                                                "w_0"               : 0.825
                                                               }""")

        configuration.ValidateAndAssignDefaults(defaults_relaxation)

        if (configuration["acceleration_type"].GetString() == "Aitken"):
            convergence_accelerator = KratosFSI.AitkenConvergenceAccelerator(
                configuration["w_0"].GetDouble())

    elif (convergence_accelerator_type == "MVQN"):

        defaults_MVQN = KratosMultiphysics.Parameters("""{
                                                          "solver_type" : "MVQN",
                                                          "w_0"         : 0.825
                                                         }""")

        configuration.ValidateAndAssignDefaults(defaults_MVQN)

        convergence_accelerator = KratosFSI.MVQNFullJacobianConvergenceAccelerator(
            configuration["w_0"].GetDouble())

    elif (convergence_accelerator_type == "MVQN_recursive"):

        defaults_MVQN_recursive = KratosMultiphysics.Parameters("""{
                                                                    "solver_type" : "MVQN_recursive",
                                                                    "w_0"         : 0.825,
                                                                    "buffer_size" : 7
                                                                   }""")

        configuration.ValidateAndAssignDefaults(defaults_MVQN_recursive)

        convergence_accelerator = KratosFSI.MVQNRecursiveJacobianConvergenceAccelerator(
            configuration["w_0"].GetDouble(),
            configuration["buffer_size"].GetInt())

    else:
        raise Exception("Convergence accelerator not found. Asking for : " +
                        convergence_accelerator_type)

    return convergence_accelerator
コード例 #7
0
    def _GetNodalUpdateUtilities(self):
        structure_time_scheme = self.structure_solver.dynamic_settings["scheme_type"].GetString()
        if (structure_time_scheme == "newmark"):
            damp_factor_m = 0.0
        elif (structure_time_scheme == "bossak"):
            damp_factor_m = -0.3
        else:
            err_msg =  "Requested structure time scheme type \"" + structure_time_scheme + "\" is not available!\n"
            err_msg += "Available options are: \"newmark\", \"bossak\", \"relaxation\""
            raise Exception(err_msg)

        if (self.domain_size == 2):
            return KratosFSI.NodalUpdateNewmark2D(damp_factor_m)
        else:
            return KratosFSI.NodalUpdateNewmark3D(damp_factor_m)
コード例 #8
0
 def _create_partitioned_fsi_utilities(self):
     domain_size = self.GetFatherModelPart().ProcessInfo[
         KratosMultiphysics.DOMAIN_SIZE]
     if not self.GetFatherModelPart().IsDistributed():
         if domain_size == 2:
             if self.scalar_output:
                 return KratosFSI.PartitionedFSIUtilitiesDouble2D()
             else:
                 return KratosFSI.PartitionedFSIUtilitiesArray2D()
         elif domain_size == 3:
             if self.scalar_output:
                 return KratosFSI.PartitionedFSIUtilitiesDouble3D()
             else:
                 return KratosFSI.PartitionedFSIUtilitiesArray3D()
         else:
             raise Exception("Domain size expected to be 2 or 3. Got " +
                             str(self.domain_size))
     else:
         self._epetra_communicator = KratosTrilinos.CreateCommunicator()
         if domain_size == 2:
             if self.scalar_output:
                 return KratosTrilinos.TrilinosPartitionedFSIUtilitiesDouble2D(
                     self._epetra_communicator)
             else:
                 return KratosTrilinos.TrilinosPartitionedFSIUtilitiesArray2D(
                     self._epetra_communicator)
         elif domain_size == 3:
             if self.scalar_output:
                 return KratosTrilinos.TrilinosPartitionedFSIUtilitiesDouble3D(
                     self._epetra_communicator)
             else:
                 return KratosTrilinos.TrilinosPartitionedFSIUtilitiesArray3D(
                     self._epetra_communicator)
         else:
             raise Exception("Domain size expected to be 2 or 3. Got " +
                             str(self.domain_size))
コード例 #9
0
 def _GetPartitionedFSIUtilities(self):
     if (self.domain_size == 2):
         return KratosFSI.PartitionedFSIUtilitiesArray2D()
     else:
         return KratosFSI.PartitionedFSIUtilitiesArray3D()
コード例 #10
0
 def _get_partitioned_FSI_utilities(self):
     if (self.domain_size == 2):
         return KratosFSI.PartitionedFSIUtilitiesDouble2D()
     else:
         return KratosFSI.PartitionedFSIUtilitiesDouble3D()