Beispiel #1
0
 def CG_Jacobi(self):
     solution = doublevec.DoubleVec(0)
     pc = preconditioner.JacobiPreconditioner()
     solver = matrixmethod.ConjugateGradient(pc, self.tolerance,
                                             self.max_iterations)
     solver.solveMatrix(self.matrix, self.rhs, solution)
     self.assertAlmostEqual(self.ref.norm(), solution.norm(), 9)
Beispiel #2
0
 def coreProcess(self, meshctxt, subp):
     subp.solver_mode = solvermode.AdvancedSolverMode(
         time_stepper=staticstep.StaticDriver(),
         nonlinear_solver=nonlinearsolver.NoNonlinearSolver(),
         symmetric_solver=matrixmethod.ConjugateGradient(
             preconditioner.ILUPreconditioner(),
             1.e-5,          # tolerance
             1000            # max_iterations
             ),
         asymmetric_solver=matrixmethod.BiConjugateGradient(
             preconditioner.ILUPreconditioner(),
             1.e-5,          # tolerance
             1000            # max_iterations
             )
         )
     meshctxt.begin_writing()
     try:
         try:
             evolve.evolve(meshctxt, 0.0)
         except:
             # TODO: Be more explicit about what exceptions
             # should be handled here, to distinguish actual
             # convergence failures from programming errors.
             self.solver_converged = False
         else:
             self.solver_converged = True
     finally:
         meshctxt.end_writing()
Beispiel #3
0
    def coreProcess(self, meshctxt, subp):
        subp.solver = staticstep.StaticDriver(
            matrixmethod.ConjugateGradient(
                preconditioner.ILUPreconditioner(),
                1.e-5,  # tolerance
                1000  # max_iterations
            ))
        subp.solver_linearity = linearity.Linear()

        meshctxt.begin_writing()
        try:
            meshctxt.solver_precompute()
            try:
                evolve.evolve(meshctxt, 0.0, 0.0, False)
            except:
                # TODO 3.1: Be more explicit about what exceptions should
                # be handled here, to distinguish actual convergence
                # failures from programming errors.
                self.solver_converged = False
            else:
                self.solver_converged = True
        finally:
            meshctxt.end_writing()