The Open FUSION Toolkit 1.0.0-beta6
Modeling tools for plasma and fusion research and engineering
Loading...
Searching...
No Matches
oft_petsc_solvers Module Reference

Detailed Description

PETSc solver implementations.

Wrappers for PETSc solvers implementing the common oft_solver interface.

  • Conjugate-Gradient
  • Generalized Minimum Residual
  • LU Factorization (SUPERLU, MUMPS, etc.)

Wrappers for PETSc preconditioners implementing the common oft_solver interface.

  • Diagonal scaling
  • Additive Schwarz
  • Block Jacobi
  • Multi-Grid
  • LU Factorization (SUPERLU, MUMPS, etc.)
Authors
Chris Hansen
Date
January 2013

Data Types

type  oft_petsc_asprecond
 PETSc Additive-Schwarz preconditioner. More...
type  oft_petsc_cg_solver
 PETSc Conjugate-Gradient solver. More...
type  oft_petsc_diagprecond
 PETSc diagonal preconditioning. More...
type  oft_petsc_direct_solver
 PETSc direct solver (LU factorization). More...
type  oft_petsc_factordef
 PETSc factorization package information. More...
type  oft_petsc_gmres_solver
 PETSc GMRES solver. More...
type  oft_petsc_jacobi_solver
 PETSc Point-Jacobi solver. More...
type  oft_petsc_luprecond
 PETSc LU factorization/solve. More...
type  oft_petsc_mgprecond
 PETSc multi-grid preconditioner. More...
type  oft_petsc_precond
 PETSc abstract preconditioner class. More...
type  oft_petsc_sjacobi_solver
 PETSc symmetric Point-Jacobi solver. More...
type  oft_petsc_solver
 PETSc abstract solver class. More...

Functions/Subroutines

subroutine asprecond_setup (self, pc, dist)
 Setup additiv Schwarz preconditioner.
subroutine asprecond_setup_xml (self, solver_node, level)
 Setup additive Schwarz preconditioner from XML definition.
subroutine cg_setup_ksp (self, ksp)
 Setup PETSc ksp object for CG.
subroutine cg_setup_xml (self, solver_node, level)
 Setup CG solver from XML definition.
subroutine cg_solver_apply (self, u, g)
 Solve a linear system using PETSc's implementation of the Conjugate-Gradient method.
subroutine cg_view (self)
 Print solver configuration.
subroutine create_lu_pc (self, pc)
 Create PETSc LU PC object.
subroutine diagprecond_setup (self, pc, dist)
 Setup diagonal preconditioner.
subroutine diagprecond_view (self)
 Print solver configuration.
subroutine direct_setup_ksp (self, ksp)
 Setup PETSc ksp object for direct solver.
subroutine direct_setup_xml (self, solver_node, level)
 Setup direct solver from XML definition.
subroutine direct_solver_apply (self, u, g)
 Solve a linear system using a direct solver through PETSc (LU factorization).
subroutine direct_view (self)
 Print solver configuration.
subroutine gmres_setup_ksp (self, ksp)
 Setup PETSc ksp object for FGMRES.
subroutine gmres_setup_xml (self, solver_node, level)
 Setup FGMRES solver from XML definition.
subroutine gmres_solver_apply (self, u, g)
 Solve a linear system using PETSc's implementation of the FGMRES method.
subroutine gmres_view (self)
 Print solver configuration.
subroutine jacobi_solver_apply (self, u, g)
 Solve a linear system using PETSc's implementation of the Point-Jacobi method.
subroutine lu_pc_load_xml (self, solver_node, level)
 Setup LU preconditioner object from XML definition.
subroutine luprecond_setup (self, pc, dist)
 Setup LU factorization preconditioner.
subroutine mgprecond_setup (self, pc, dist)
 Setup multi-grid preconditioner.
logical function petsc_cg_solver_cast (self, source)
 Cast a solver object to a oft_petsc_cg_solver.
logical function petsc_diagprecond_cast (self, source)
 Cast a solver object to a oft_petsc_diagprecond.
logical function petsc_direct_solver_cast (self, source)
 Cast a solver object to a oft_petsc_direct_solver.
logical function petsc_gmres_solver_cast (self, source)
 Cast a solver object to a oft_petsc_gmres_solver.
logical function petsc_jacobi_solver_cast (self, source)
 Cast a solver object to a oft_petsc_jacobi_solver.
logical function petsc_precond_cast (self, source)
 Cast a solver object to a oft_petsc_precond.
logical function petsc_sjacobi_solver_cast (self, source)
 Cast a solver object to a oft_petsc_sjacobi_solver.
logical function petsc_solver_cast (self, source)
 Cast a vector object to a oft_petsc_vector.
subroutine petsc_solver_delete (self)
 Delete PETSc solver.
subroutine petsc_solver_setup (self)
 Update solver after changing settings/operators.
subroutine petsc_solver_setup_ksp (self, ksp)
 Setup PETSc ksp object.
subroutine petsc_solver_setup_pm (ksp)
 Setup performance monitor for PETSc solver.
recursive subroutine petsc_solver_update (self, new_pattern)
 Update solver after updating settings/matrix.
subroutine precond_apply (self, u, g)
 Precondition a linear system using one iteration of a PETSc preconditioner.
subroutine precond_delete (self)
 Delete PETSc solver.
subroutine precond_dummy_setup (self, pc, dist)
 Setup preconditioner.
recursive subroutine precond_update (self, new_pattern)
 Update preconditioner after changing settings/operators.
subroutine set_solver_package (pc, sol_type, ierr)
 Set factorization package for PETSc PC object.
subroutine sjacobi_setup_xml (self, solver_node, level)
 Setup symmetric Jacobi solver from XML definition.
subroutine sjacobi_solver_apply (self, u, g)
 Apply 1-step of a symmetric Jacobi smoother with PETSc matrices.

Function/Subroutine Documentation

◆ asprecond_setup()

subroutine asprecond_setup ( class(oft_petsc_asprecond), intent(inout) self,
type(tpc), intent(inout) pc,
logical, intent(in) dist )

Setup additiv Schwarz preconditioner.

Parameters
[in,out]selfSolver object
[in,out]pcPETSc PC object
[in]distFlag for local vs distributed solve?

◆ asprecond_setup_xml()

subroutine asprecond_setup_xml ( class(oft_petsc_asprecond), intent(inout) self,
type(xml_node), intent(in), pointer solver_node,
integer(i4), intent(in), optional level )

Setup additive Schwarz preconditioner from XML definition.

Parameters
[in,out]selfSolver object
[in]solver_nodeXML element containing solver definition
[in]levelLevel in MG hierarchy (optional)

◆ cg_setup_ksp()

subroutine cg_setup_ksp ( class(oft_petsc_cg_solver), intent(inout) self,
type(tksp), intent(inout) ksp )

Setup PETSc ksp object for CG.

Parameters
[in,out]selfSolver object
[in,out]kspPETSc KSP object

◆ cg_setup_xml()

subroutine cg_setup_xml ( class(oft_petsc_cg_solver), intent(inout) self,
type(xml_node), intent(in), pointer solver_node,
integer(i4), intent(in), optional level )

Setup CG solver from XML definition.

Parameters
[in,out]selfSolver object
[in]solver_nodeXML element containing solver definition
[in]levelLevel in MG hierarchy (optional)

◆ cg_solver_apply()

subroutine cg_solver_apply ( class(oft_petsc_cg_solver), intent(inout) self,
class(oft_vector), intent(inout) u,
class(oft_vector), intent(inout) g )

Solve a linear system using PETSc's implementation of the Conjugate-Gradient method.

Parameters
[in,out]selfSolver object
[in,out]uGuess (input), Solution (output)
[in,out]gRHS (input), Residual (output)

◆ cg_view()

subroutine cg_view ( class(oft_petsc_cg_solver), intent(inout) self)

Print solver configuration.

Parameters
[in,out]selfSolver object

◆ create_lu_pc()

subroutine create_lu_pc ( class(oft_petsc_factordef), intent(inout) self,
type(tpc), intent(inout) pc )

Create PETSc LU PC object.

Parameters
[in,out]selfSolver object
[in,out]pcPETSc PC object

◆ diagprecond_setup()

subroutine diagprecond_setup ( class(oft_petsc_diagprecond), intent(inout) self,
type(tpc), intent(inout) pc,
logical, intent(in) dist )

Setup diagonal preconditioner.

Parameters
[in,out]selfSolver object
[in,out]pcPETSc PC object
[in]distFlag for local vs distributed solve?

◆ diagprecond_view()

subroutine diagprecond_view ( class(oft_petsc_diagprecond), intent(inout) self)

Print solver configuration.

Parameters
[in,out]selfSolver object

◆ direct_setup_ksp()

subroutine direct_setup_ksp ( class(oft_petsc_direct_solver), intent(inout) self,
type(tksp), intent(inout) ksp )

Setup PETSc ksp object for direct solver.

Parameters
[in,out]selfSolver object
[in,out]kspPETSc KSP solver object

◆ direct_setup_xml()

subroutine direct_setup_xml ( class(oft_petsc_direct_solver), intent(inout) self,
type(xml_node), intent(in), pointer solver_node,
integer(i4), intent(in), optional level )

Setup direct solver from XML definition.

Parameters
[in,out]selfSolver object
[in]solver_nodeXML element containing solver definition
[in]levelLevel in MG hierarchy (optional)

◆ direct_solver_apply()

subroutine direct_solver_apply ( class(oft_petsc_direct_solver), intent(inout) self,
class(oft_vector), intent(inout) u,
class(oft_vector), intent(inout) g )

Solve a linear system using a direct solver through PETSc (LU factorization).

Parameters
[in,out]selfSolver object
[in,out]uGuess (input), Solution (output)
[in,out]gRHS (input), Residual (output)

◆ direct_view()

subroutine direct_view ( class(oft_petsc_direct_solver), intent(inout) self)

Print solver configuration.

Parameters
[in,out]selfSolver object

◆ gmres_setup_ksp()

subroutine gmres_setup_ksp ( class(oft_petsc_gmres_solver), intent(inout) self,
type(tksp), intent(inout) ksp )

Setup PETSc ksp object for FGMRES.

Parameters
[in,out]selfSolver object
[in,out]kspPETSc KSP object

◆ gmres_setup_xml()

subroutine gmres_setup_xml ( class(oft_petsc_gmres_solver), intent(inout) self,
type(xml_node), intent(in), pointer solver_node,
integer(i4), intent(in), optional level )

Setup FGMRES solver from XML definition.

Parameters
[in,out]selfSolver object
[in]solver_nodeXML element containing solver definition
[in]levelLevel in MG hierarchy (optional)

◆ gmres_solver_apply()

subroutine gmres_solver_apply ( class(oft_petsc_gmres_solver), intent(inout) self,
class(oft_vector), intent(inout) u,
class(oft_vector), intent(inout) g )

Solve a linear system using PETSc's implementation of the FGMRES method.

Parameters
[in,out]selfSolver object
[in,out]uGuess (input), Solution (output)
[in,out]gRHS (input), Residual (output)

◆ gmres_view()

subroutine gmres_view ( class(oft_petsc_gmres_solver), intent(inout) self)

Print solver configuration.

Parameters
[in,out]selfSolver object

◆ jacobi_solver_apply()

subroutine jacobi_solver_apply ( class(oft_petsc_jacobi_solver), intent(inout) self,
class(oft_vector), intent(inout) u,
class(oft_vector), intent(inout) g )

Solve a linear system using PETSc's implementation of the Point-Jacobi method.

Parameters
[in,out]selfSolver object
[in,out]uGuess (input), Solution (output)
[in,out]gRHS (input), Residual (output)

◆ lu_pc_load_xml()

subroutine lu_pc_load_xml ( class(oft_petsc_factordef), intent(inout) self,
type(xml_node), intent(in), pointer solver_node,
integer(i4), intent(in), optional level )

Setup LU preconditioner object from XML definition.

Parameters
[in,out]selfSolver object
[in]solver_nodeXML element containing solver definition
[in]levelLevel in MG hierarchy (optional)

◆ luprecond_setup()

subroutine luprecond_setup ( class(oft_petsc_luprecond), intent(inout) self,
type(tpc), intent(inout) pc,
logical, intent(in) dist )

Setup LU factorization preconditioner.

Parameters
[in,out]selfSolver object
[in,out]pcPETSc PC object
[in]distFlag for local vs distributed solve?

◆ mgprecond_setup()

subroutine mgprecond_setup ( class(oft_petsc_mgprecond), intent(inout) self,
type(tpc), intent(inout) pc,
logical, intent(in) dist )

Setup multi-grid preconditioner.

Parameters
[in,out]selfSolver object
[in,out]pcPETSc PC object
[in]distFlag for local vs distributed solve?

◆ petsc_cg_solver_cast()

logical function petsc_cg_solver_cast ( type(oft_petsc_cg_solver), intent(out), pointer self,
class(oft_solver), intent(in), target source )

Cast a solver object to a oft_petsc_cg_solver.

The source solver must be oft_petsc_cg_solver or a child class, otherwise pointer will be returned as null and success == .FALSE.

Parameters
[out]selfReference to source object with desired class
[in]sourceSource solver to cast
Returns
Cast success flag

◆ petsc_diagprecond_cast()

logical function petsc_diagprecond_cast ( type(oft_petsc_diagprecond), intent(out), pointer self,
class(oft_solver), intent(in), target source )

Cast a solver object to a oft_petsc_diagprecond.

The source solver must be oft_petsc_diagprecond or a child class, otherwise pointer will be returned as null and success == .FALSE.

Parameters
[out]selfReference to source object with desired class
[in]sourceSource solver to cast
Returns
Cast success flag

◆ petsc_direct_solver_cast()

logical function petsc_direct_solver_cast ( type(oft_petsc_direct_solver), intent(out), pointer self,
class(oft_solver), intent(in), target source )

Cast a solver object to a oft_petsc_direct_solver.

The source solver must be oft_petsc_direct_solver or a child class, otherwise pointer will be returned as null and success == .FALSE.

Parameters
[out]selfReference to source object with desired class
[in]sourceSource solver to cast
Returns
Cast success flag

◆ petsc_gmres_solver_cast()

logical function petsc_gmres_solver_cast ( type(oft_petsc_gmres_solver), intent(out), pointer self,
class(oft_solver), intent(in), target source )

Cast a solver object to a oft_petsc_gmres_solver.

The source solver must be oft_petsc_gmres_solver or a child class, otherwise pointer will be returned as null and success == .FALSE.

Parameters
[out]selfReference to source object with desired class
[in]sourceSource solver to cast
Returns
Cast success flag

◆ petsc_jacobi_solver_cast()

logical function petsc_jacobi_solver_cast ( type(oft_petsc_jacobi_solver), intent(out), pointer self,
class(oft_solver), intent(in), target source )

Cast a solver object to a oft_petsc_jacobi_solver.

The source solver must be oft_petsc_jacobi_solver or a child class, otherwise pointer will be returned as null and success == .FALSE.

Parameters
[out]selfReference to source object with desired class
[in]sourceSource solver to cast
Returns
Cast success flag

◆ petsc_precond_cast()

logical function petsc_precond_cast ( class(oft_petsc_precond), intent(out), pointer self,
class(oft_solver), intent(in), target source )

Cast a solver object to a oft_petsc_precond.

The source solver must be oft_petsc_precond or a child class, otherwise pointer will be returned as null and success == .FALSE.

Parameters
[out]selfReference to source object with desired class
[in]sourceSource solver to cast
Returns
Cast success flag

◆ petsc_sjacobi_solver_cast()

logical function petsc_sjacobi_solver_cast ( type(oft_petsc_sjacobi_solver), intent(out), pointer self,
class(oft_solver), intent(in), target source )

Cast a solver object to a oft_petsc_sjacobi_solver.

The source solver must be oft_petsc_sjacobi_solver or a child class, otherwise pointer will be returned as null and success == .FALSE.

Parameters
[out]selfReference to source object with desired class
[in]sourceSource solver to cast
Returns
Cast success flag

◆ petsc_solver_cast()

logical function petsc_solver_cast ( class(oft_petsc_solver), intent(out), pointer self,
class(oft_solver), intent(in), target source )

Cast a vector object to a oft_petsc_vector.

The source vector must be oft_petsc_vector or a child class, otherwise pointer will be returned as null and success == .FALSE.

Parameters
[out]selfReference to source object with desired class
[in]sourceSource solver to cast
Returns
Cast success flag

◆ petsc_solver_delete()

subroutine petsc_solver_delete ( class(oft_petsc_solver), intent(inout) self)

Delete PETSc solver.

Parameters
[in,out]selfSolver object

◆ petsc_solver_setup()

subroutine petsc_solver_setup ( class(oft_petsc_solver), intent(inout) self)

Update solver after changing settings/operators.

Parameters
[in,out]selfSolver object

◆ petsc_solver_setup_ksp()

subroutine petsc_solver_setup_ksp ( class(oft_petsc_solver), intent(inout) self,
type(tksp), intent(inout) ksp )

Setup PETSc ksp object.

Parameters
[in,out]selfSolver object

◆ petsc_solver_setup_pm()

subroutine petsc_solver_setup_pm ( type(tksp), intent(inout) ksp)

Setup performance monitor for PETSc solver.

◆ petsc_solver_update()

recursive subroutine petsc_solver_update ( class(oft_petsc_solver), intent(inout) self,
logical, intent(in), optional new_pattern )

Update solver after updating settings/matrix.

Parameters
[in,out]selfSolver object
[in]new_patternUpdate matrix pattern (optional)

◆ precond_apply()

subroutine precond_apply ( class(oft_petsc_precond), intent(inout) self,
class(oft_vector), intent(inout) u,
class(oft_vector), intent(inout) g )

Precondition a linear system using one iteration of a PETSc preconditioner.

Parameters
[in,out]selfSolver object
[in,out]uGuess (input), Solution (output)
[in,out]gRHS (input), Residual (output)

◆ precond_delete()

subroutine precond_delete ( class(oft_petsc_precond), intent(inout) self)

Delete PETSc solver.

Parameters
[in,out]selfSolver object

◆ precond_dummy_setup()

subroutine precond_dummy_setup ( class(oft_petsc_precond), intent(inout) self,
type(tpc), intent(inout) pc,
logical, intent(in) dist )

Setup preconditioner.

Parameters
[in,out]selfSolver object
[in,out]pcPETSc PC object
[in]distFlag for local vs distributed solve?

◆ precond_update()

recursive subroutine precond_update ( class(oft_petsc_precond), intent(inout) self,
logical, intent(in), optional new_pattern )

Update preconditioner after changing settings/operators.

Parameters
[in,out]selfSolver object
[in]new_patternUpdate matrix pattern (optional)

◆ set_solver_package()

subroutine set_solver_package ( type(tpc), intent(inout) pc,
character(len=*), intent(in) sol_type,
integer(i4), intent(out) ierr )

Set factorization package for PETSc PC object.

Parameters
[in,out]pcPETSc PC object
[in]sol_typeSolver type
[out]ierrError flag

◆ sjacobi_setup_xml()

subroutine sjacobi_setup_xml ( class(oft_petsc_sjacobi_solver), intent(inout) self,
type(xml_node), intent(in), pointer solver_node,
integer(i4), intent(in), optional level )

Setup symmetric Jacobi solver from XML definition.

Parameters
[in,out]selfSolver object
[in]solver_nodeXML element containing solver definition
[in]levelLevel in MG hierarchy (optional)

◆ sjacobi_solver_apply()

subroutine sjacobi_solver_apply ( class(oft_petsc_sjacobi_solver), intent(inout) self,
class(oft_vector), intent(inout) u,
class(oft_vector), intent(inout) g )

Apply 1-step of a symmetric Jacobi smoother with PETSc matrices.

Parameters
[in,out]selfSolver object
[in,out]uGuess (input), Solution (output)
[in,out]gRHS (input), Residual (output)