|
IPPL (Independent Parallel Particle Layer)
IPPL
|
The preconditioner class in the IPPL framework serves as an abstract base class for different preconditioning strategies applied in iterative solvers. It encapsulates common functionalities and interfaces that are essential for all types of preconditioners. Structure of the Preconditioner Base Class
Template Parameter: The class template Field determines the type of the numerical field the preconditioner will operate on.
Constructor: Constructors initialize the preconditioner, optionally setting a type name to identify the preconditioner strategy.
Virtual Function ('operator()'): This is a pure virtual function in the base class that must be implemented by derived classes to define the specific preconditioning behavior.
Steps to Create a Custom Preconditioner
Begin by defining a new class that inherits from the 'preconditioner<Field>' provided by the IPPL framework. This new class should implement all abstract methods from the base class and can add additional members as needed for its specific strategy.
Use the constructor of your custom preconditioner to initialize any data members and forward any necessary parameters to the base class constructor, which sets the type name of the preconditioner.
Implement the 'operator()' function to apply your preconditioning logic to the input field. This method is crucial as it defines how the preconditioner modifies the input data, aligning with the specific algorithmic needs of your solver.
The 'jacobi_preconditioner' provided by IPPL is a derived class of preconditioner. It implements a specific preconditioning strategy using an inverse diagonal matrix and a damping factor. Here is how it extends the base class:
A simple example of a custom preconditioner that scales the input field can be structured as follows:
To utilize your custom preconditioner in a solver, instantiate it and configure the solver to use it.