def Initialize(self):

        # Set the Trilinos space
        self.trilinos_space = KratosTrilinos.TrilinosSparseSpace()

        # Set the Epetra communicator
        self.epetra_communicator = KratosTrilinos.CreateCommunicator()

        # Construct the coupling partitioned strategy
        coupling_utility_parameters = self.settings[
            "coupling_solver_settings"]["coupling_strategy"]
        self.coupling_utility = convergence_accelerator_factory.CreateTrilinosConvergenceAccelerator(
            self._GetFluidInterfaceSubmodelPart(), self.epetra_communicator,
            coupling_utility_parameters)

        # Get the domain size
        self.domain_size = self._GetDomainSize()

        # Get the nodal update FSI utilities
        self.nodal_update_utilities = self._GetNodalUpdateUtilities()

        # Get the partitioned FSI utilities
        self.trilinos_partitioned_fsi_utilities = self._GetPartitionedFSIUtilities(
        )

        # Python structure solver initialization
        self.structure_solver.Initialize()

        # Ensure that the fluid reaction fluxes are computed if D-N scheme is considered
        if self.fluid_solver.settings["compute_reactions"].GetBool() == False:
            self.fluid_solver.settings["compute_reactions"].SetBool(True)

        # Python fluid solver initialization
        self.fluid_solver.Initialize()

        # Python mesh solver initialization
        self.mesh_solver.Initialize()

        # Initialize the Dirichlet-Neumann interface
        self._InitializeDirichletNeumannInterface()

        # Construct the interface mapper
        self._SetUpMapper()

        # Set the Neumann B.C. in the structure interface
        self._SetStructureNeumannCondition(
        )  #TODO change when the interface is able to correctly transfer distributed forces

        # Initialize the iteration value vector
        self._InitializeIterationValueVector()

        # Compute the fluid domain NODAL_AREA values (required as weight in the residual norm computation)
        KratosMultiphysics.CalculateNodalAreaProcess(
            self.fluid_solver.GetComputingModelPart(),
            self.domain_size).Execute()

        # Strategies initialization
        super(TrilinosPartitionedFSIDirichletNeumannSolver, self).Initialize()
예제 #2
0
    def test_resize(self):
        comm = KratosTrilinos.CreateEpetraCommunicator(
            KratosMultiphysics.DataCommunicator.GetDefault())
        space = KratosTrilinos.TrilinosSparseSpace()

        pb = space.CreateEmptyVectorPointer(comm)
        space.ResizeVector(pb, 2)

        n = space.Size(pb.GetReference())
        self.assertEqual(n, 2)
예제 #3
0
    def Initialize(self):
        # Set the Trilinos space
        self.trilinos_space = KratosTrilinos.TrilinosSparseSpace()

        # Get the domain size
        self.domain_size = self._GetDomainSize()

        # Get the nodal update FSI utilities
        self.nodal_update_utilities = self._GetNodalUpdateUtilities()

        # Get the partitioned FSI utilities
        self.partitioned_fsi_utilities = self._GetPartitionedFSIUtilities()

        # Python structure solver initialization
        self.structure_solver.Initialize()

        # Ensure that the fluid reaction fluxes are computed if D-N scheme is considered
        if self.fluid_solver.settings["compute_reactions"].GetBool() == False:
            self.fluid_solver.settings["compute_reactions"].SetBool(True)

        # Python fluid solver initialization
        self.fluid_solver.Initialize()

        # Python mesh solver initialization
        self.mesh_solver.Initialize()

        # Initialize the Dirichlet-Neumann interface
        self._InitializeDirichletNeumannInterface()

        # Construct the interface mapper
        self._SetUpMapper()

        # Set the Neumann B.C. in the structure interface
        self._SetStructureNeumannCondition(
        )  #TODO change when the interface is able to correctly transfer distributed forces

        # Initialize the iteration value for the residual computation, which is defined in terms of the fluid interface
        # In case a shell structure is analised, only one of the two interfaces is considered for the residual vector computation
        # This is due to the fact that the same mesh_solver displacement is map to both fluid sides.
        self.iteration_value = self.partitioned_fsi_utilities.SetUpInterfaceVector(
            self._GetFluidInterfaceSubmodelPart())

        # Compute the fluid domain NODAL_AREA values (required as weight in the residual norm computation)
        KratosMultiphysics.CalculateNodalAreaProcess(
            self.fluid_solver.GetComputingModelPart(),
            self.domain_size).Execute()

        # Coupling utility initialization
        # The _GetConvergenceAccelerator is supposed to construct the convergence accelerator in here
        self._GetConvergenceAccelerator().Initialize()
    def setUp(self):

        # So far, the MPI convergence accelerator tests must be run with 2 processes
        if (mpi.size != 2):
            raise Exception("The MPI convergence accelerator tests must be run with 2 processes.")

        self.print_gid_output = False
        self.aitken_tolelance = 1e-10
        self.aitken_iterations = 50
        self.assert_delta = 1e-7

        self.model_part = self.ReadModelPart(GetPartitionedFilePath("box_fluid"))

        self.space = KratosTrilinos.TrilinosSparseSpace()
        self.epetra_comm = KratosTrilinos.CreateCommunicator()

        self.partitioned_utilities = KratosTrilinos.TrilinosPartitionedFSIUtilities3D(self.epetra_comm)
    def setUp(self):

        # So far, the MPI convergence accelerator tests must be run with 2 processes
        if KratosMultiphysics.ParallelEnvironment.GetDefaultSize() != 2:
            raise Exception(
                "The MPI convergence accelerator tests must be run with 2 processes."
            )

        self.print_gid_output = False
        self.accelerator_tolerance = 1e-10
        self.accelerator_iterations = 50
        self.assert_delta = 1e-7

        self.model_part = self.ReadModelPart(
            GetPartitionedFilePath("box_fluid"))
        self.model_part.ProcessInfo.SetValue(KratosMultiphysics.DOMAIN_SIZE, 3)

        self.space = KratosTrilinos.TrilinosSparseSpace()
        self.epetra_comm = KratosTrilinos.CreateCommunicator()

        self.partitioned_utilities = KratosTrilinos.TrilinosPartitionedFSIUtilitiesArray3D(
            self.epetra_comm)