Memosa-FVM  0.2
ILU0Solver Class Reference

#include <ILU0Solver.h>

Inheritance diagram for ILU0Solver:
Collaboration diagram for ILU0Solver:

Public Member Functions

 ILU0Solver ()
 
virtual ~ILU0Solver ()
 
virtual MFRPtr solve (LinearSystem &ls)
 
virtual void cleanup ()
 
virtual void smooth (LinearSystem &ls)
 
 DEFINE_TYPENAME ("ILU0Solver")
 
- Public Member Functions inherited from LinearSolver
 LinearSolver ()
 

Private Member Functions

void doSweeps (LinearSystem &ls, const int nSweeps)
 
 ILU0Solver (const ILU0Solver &)
 

Additional Inherited Members

- Public Attributes inherited from LinearSolver
int nMaxIterations
 
int verbosity
 
double relativeTolerance
 
double absoluteTolerance
 

Detailed Description

Solve a linear system using Jacobi iterations

Definition at line 20 of file ILU0Solver.h.

Constructor & Destructor Documentation

ILU0Solver::ILU0Solver ( )

Definition at line 15 of file ILU0Solver.cpp.

References logCtor.

16 {
17  logCtor();
18 
19 }
#define logCtor()
Definition: RLogInterface.h:26
ILU0Solver::~ILU0Solver ( )
virtual

Definition at line 21 of file ILU0Solver.cpp.

References logDtor.

22 {
23  logDtor();
24 }
#define logDtor()
Definition: RLogInterface.h:33
ILU0Solver::ILU0Solver ( const ILU0Solver )
private

Member Function Documentation

void ILU0Solver::cleanup ( )
virtual

Implements LinearSolver.

Definition at line 42 of file ILU0Solver.cpp.

43 {
44 }
ILU0Solver::DEFINE_TYPENAME ( "ILU0Solver"  )
void ILU0Solver::doSweeps ( LinearSystem ls,
const int  nSweeps 
)
private

Definition at line 27 of file ILU0Solver.cpp.

References LinearSystem::getB(), LinearSystem::getDelta(), LinearSystem::getMatrix(), LinearSystem::getResidual(), and MultiFieldMatrix::iluSolve().

Referenced by smooth(), and solve().

28 {
29  const MultiFieldMatrix& m = ls.getMatrix();
30  MultiField& delta = ls.getDelta();
31  const MultiField& b = ls.getB();
32  MultiField& r = ls.getResidual();
33 
34  for(int i=0; i<nSweeps; i++)
35  {
36  m.iluSolve(delta,b,r);
37  }
38 }
virtual void iluSolve(IContainer &xB, const IContainer &bB, IContainer &tempB) const
MultiField & getResidual()
Definition: LinearSystem.h:35
MultiField & getDelta()
Definition: LinearSystem.h:34
MultiField & getB()
Definition: LinearSystem.h:33
MultiFieldMatrix & getMatrix()
Definition: LinearSystem.h:37
void ILU0Solver::smooth ( LinearSystem ls)
virtual

Implements LinearSolver.

Definition at line 98 of file ILU0Solver.cpp.

References doSweeps().

99 {
100  doSweeps(ls,1);
101 }
void doSweeps(LinearSystem &ls, const int nSweeps)
Definition: ILU0Solver.cpp:27
MFRPtr ILU0Solver::solve ( LinearSystem ls)
virtual

Implements LinearSolver.

Definition at line 47 of file ILU0Solver.cpp.

References LinearSolver::absoluteTolerance, MultiFieldMatrix::computeResidual(), doSweeps(), LinearSystem::getB(), LinearSystem::getDelta(), LinearSystem::getMatrix(), MultiField::getOneNorm(), LinearSystem::getResidual(), LinearSolver::nMaxIterations, LinearSolver::relativeTolerance, and LinearSolver::verbosity.

48 {
50  ls.getB(),
51  ls.getResidual());
52  MFRPtr rNorm0(ls.getResidual().getOneNorm());
53 
54 #ifdef FVM_PARALLEL
55  if (verbosity >0 && MPI::COMM_WORLD.Get_rank() == 0 )
56  cout << "0: " << *rNorm0 << "procID = " << MPI::COMM_WORLD.Get_rank() << endl;
57 #endif
58 
59 #ifndef FVM_PARALLEL
60  if ( verbosity > 0 )
61  cout << "0: " << *rNorm0 << endl;
62 #endif
63 
64  if (*rNorm0 < absoluteTolerance )
65  return rNorm0;
66 
67  for(int i=1; i<nMaxIterations; i++)
68  {
69  doSweeps(ls,1);
70 
72  ls.getB(),
73  ls.getResidual());
74  MFRPtr rNorm(ls.getResidual().getOneNorm());
75  MFRPtr normRatio((*rNorm)/(*rNorm0));
76 
77 #ifndef FVM_PARALLEL
78  if (verbosity >0 )
79  cout << i << ": " << *rNorm << endl;
80 #endif
81 
82 
83 #ifdef FVM_PARALLEL
84  if (*rNorm < absoluteTolerance || *normRatio < relativeTolerance || i == nMaxIterations-1)
85  if (verbosity >0 && MPI::COMM_WORLD.Get_rank() == 0 )
86  cout <<i << ": " << "procID = " << MPI::COMM_WORLD.Get_rank() << *rNorm << endl;
87 #endif
88 
89  if (*rNorm < absoluteTolerance || *normRatio < relativeTolerance)
90  break;
91 
92  }
93  return rNorm0;
94 }
MultiField & getResidual()
Definition: LinearSystem.h:35
void doSweeps(LinearSystem &ls, const int nSweeps)
Definition: ILU0Solver.cpp:27
MultiField & getDelta()
Definition: LinearSystem.h:34
int nMaxIterations
Definition: LinearSolver.h:31
shared_ptr< MultiFieldReduction > getOneNorm() const
Definition: MultiField.cpp:216
double relativeTolerance
Definition: LinearSolver.h:33
virtual void computeResidual(const IContainer &xB, const IContainer &bB, IContainer &rB) const
double absoluteTolerance
Definition: LinearSolver.h:34
MultiField & getB()
Definition: LinearSystem.h:33
shared_ptr< MultiFieldReduction > MFRPtr
MultiFieldMatrix & getMatrix()
Definition: LinearSystem.h:37

The documentation for this class was generated from the following files: