Octopus
multigrid_solver_oct_m Module Reference

This modules provides the routines for solving Ax=b using the V-shaped multigrid method. More...

Detailed Description

This modules provides the routines for solving Ax=b using the V-shaped multigrid method.

Data Types

type  mg_solver_t
 

Functions/Subroutines

subroutine, public multigrid_solver_init (this, namespace, space, mesh, thr)
 
recursive subroutine, public multigrid_solver_v_cycle (this, der, op, sol, rhs)
 Performs one cycle of a V-shaped multigrid solver. More...
 
recursive subroutine, public multigrid_solver_w_cycle (this, der, op, sol, rhs)
 Performs one cycle of a W-shaped multigrid solver. More...
 
subroutine, public multigrid_iterative_solver (this, namespace, der, op, sol, rhs, multigrid_shape)
 An iterative multigrid solver. More...
 
recursive subroutine, public multigrid_fmg_solver (this, namespace, der, op, sol, rhs)
 Full multigrid (FMG) solver. More...
 
subroutine multigrid_solver_solve_coarsest (this, der, op, sol, rhs, residue)
 Computes the solution on the coarsest grid. More...
 
subroutine get_residual (op, der, sol, rhs, residue)
 Computes the residual. More...
 
subroutine multigrid_relax (this, mesh, der, op, sol, rhs, steps)
 Given a nonlocal operator op, perform the relaxation operator. More...
 

Variables

integer, parameter gauss_seidel = 1
 
integer, parameter weighted_jacobi = 2
 
integer, parameter, public mg_v_shape = 1
 
integer, parameter, public mg_w_shape = 2
 
integer, parameter, public mg_fmg = 3
 

Function/Subroutine Documentation

◆ multigrid_solver_init()

subroutine, public multigrid_solver_oct_m::multigrid_solver_init ( type(mg_solver_t), intent(out)  this,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(mesh_t), intent(inout)  mesh,
real(real64), intent(in)  thr 
)

Definition at line 172 of file multigrid_solver.F90.

◆ multigrid_solver_v_cycle()

recursive subroutine, public multigrid_solver_oct_m::multigrid_solver_v_cycle ( type(mg_solver_t), intent(in)  this,
type(derivatives_t), intent(in)  der,
type(nl_operator_t), intent(in)  op,
real(real64), dimension(:), intent(inout), contiguous  sol,
real(real64), dimension(:), intent(in), contiguous  rhs 
)

Performs one cycle of a V-shaped multigrid solver.

This method is called recursively from the finest grid to the coarsest and then back to the finest grid

Parameters
[in]opLinear operator
[in,out]solSolution to the problem
[in]rhsRight-hand side of the linear problem

Definition at line 273 of file multigrid_solver.F90.

◆ multigrid_solver_w_cycle()

recursive subroutine, public multigrid_solver_oct_m::multigrid_solver_w_cycle ( type(mg_solver_t), intent(in)  this,
type(derivatives_t), intent(in)  der,
type(nl_operator_t), intent(in)  op,
real(real64), dimension(:), intent(inout), contiguous  sol,
real(real64), dimension(:), intent(in), contiguous  rhs 
)

Performs one cycle of a W-shaped multigrid solver.

This method is called recursively from the finest grid to the coarsest and then back to the finest grid

Parameters
[in]opLinear operator
[in,out]solSolution to the problem
[in]rhsRight-hand side of the linear problem

Definition at line 343 of file multigrid_solver.F90.

◆ multigrid_iterative_solver()

subroutine, public multigrid_solver_oct_m::multigrid_iterative_solver ( type(mg_solver_t), intent(in)  this,
type(namespace_t), intent(in)  namespace,
type(derivatives_t), intent(in)  der,
type(nl_operator_t), intent(in)  op,
real(real64), dimension(:), intent(inout), contiguous  sol,
real(real64), dimension(:), intent(inout), contiguous  rhs,
integer, intent(in)  multigrid_shape 
)

An iterative multigrid solver.

It performs multiple V- or W-cycles up to convergence

Parameters
[in]opLinear operator
[in,out]solSolution to the problem
[in,out]rhsRight-hand side of the linear problem
[in]multigrid_shapeThe shape of each cycle

Definition at line 442 of file multigrid_solver.F90.

◆ multigrid_fmg_solver()

recursive subroutine, public multigrid_solver_oct_m::multigrid_fmg_solver ( type(mg_solver_t), intent(in)  this,
type(namespace_t), intent(in)  namespace,
type(derivatives_t), intent(in)  der,
type(nl_operator_t), intent(in)  op,
real(real64), dimension(:), intent(inout), contiguous  sol,
real(real64), dimension(:), intent(inout), contiguous  rhs 
)

Full multigrid (FMG) solver.

There is no starting point needed in this case. The code does N V cycles at each level of the full multigrid, in order to reach convergence at each level

Parameters
[in]opLinear operator
[in,out]solSolution to the problem
[in,out]rhsRight-hand side of the linear problem

Definition at line 505 of file multigrid_solver.F90.

◆ multigrid_solver_solve_coarsest()

subroutine multigrid_solver_oct_m::multigrid_solver_solve_coarsest ( type(mg_solver_t), intent(in)  this,
type(derivatives_t), intent(in)  der,
type(nl_operator_t), intent(in)  op,
real(real64), dimension(:), intent(inout), contiguous  sol,
real(real64), dimension(:), intent(in), contiguous  rhs,
real(real64), dimension(:), intent(inout), contiguous  residue 
)
private

Computes the solution on the coarsest grid.

Parameters
[in]opLinear operator
[in,out]solSolution to the problem
[in]rhsRight-hand side of the linear problem
[in,out]residueA work array for the residue

Definition at line 561 of file multigrid_solver.F90.

◆ get_residual()

subroutine multigrid_solver_oct_m::get_residual ( type(nl_operator_t), intent(in)  op,
type(derivatives_t), intent(in)  der,
real(real64), dimension(:), intent(inout), contiguous  sol,
real(real64), dimension(:), intent(in), contiguous  rhs,
real(real64), dimension(:), intent(inout), contiguous  residue 
)
private

Computes the residual.

Definition at line 596 of file multigrid_solver.F90.

◆ multigrid_relax()

subroutine multigrid_solver_oct_m::multigrid_relax ( type(mg_solver_t), intent(in)  this,
type(mesh_t), intent(in)  mesh,
type(derivatives_t), intent(in)  der,
type(nl_operator_t), intent(in)  op,
real(real64), dimension(:), intent(inout), contiguous  sol,
real(real64), dimension(:), intent(in), contiguous  rhs,
integer, intent(in)  steps 
)
private

Given a nonlocal operator op, perform the relaxation operator.

This is needed to solve the linear problem Op sol = rhs steps times

Parameters
[in]opLinear operator
[in,out]solSolution to the problem
[in]rhsRight-hand side of the linear problem
[in]stepsNumber of steps to be performed

Definition at line 618 of file multigrid_solver.F90.

Variable Documentation

◆ gauss_seidel

integer, parameter multigrid_solver_oct_m::gauss_seidel = 1

Definition at line 138 of file multigrid_solver.F90.

◆ weighted_jacobi

integer, parameter multigrid_solver_oct_m::weighted_jacobi = 2

Definition at line 138 of file multigrid_solver.F90.

◆ mg_v_shape

integer, parameter, public multigrid_solver_oct_m::mg_v_shape = 1

Definition at line 164 of file multigrid_solver.F90.

◆ mg_w_shape

integer, parameter, public multigrid_solver_oct_m::mg_w_shape = 2

Definition at line 164 of file multigrid_solver.F90.

◆ mg_fmg

integer, parameter, public multigrid_solver_oct_m::mg_fmg = 3

Definition at line 164 of file multigrid_solver.F90.