26 use,
intrinsic :: iso_fortran_env
53 type(poisson_corr_t) :: corrector
54 type(multigrid_t) :: mgrid
55 type(mg_solver_t) :: mg_solver
57 integer :: multigrid_cycle
65 type(poisson_mg_solver_t),
intent(out) :: this
66 type(namespace_t),
intent(in) :: namespace
67 class(space_t),
intent(in) :: space
68 type(mesh_t),
intent(inout) :: mesh
69 type(derivatives_t),
intent(in) :: der
70 type(stencil_t),
intent(in) :: stencil
71 type(multicomm_t),
intent(in) :: mc
72 integer,
intent(in) :: ml
73 real(real64),
intent(in) :: thr
81 call multigrid_init(this%mgrid, namespace, space, mesh, der, stencil, mc)
85 do i = 1, this%mgrid%n_levels
86 this%mgrid%level(i - 1)%der%lapl%coarser => this%mgrid%level(i)%der%lapl
111 type(poisson_mg_solver_t),
intent(inout) :: this
126 type(poisson_mg_solver_t),
intent(in) :: this
127 type(namespace_t),
intent(in) :: namespace
128 type(derivatives_t),
intent(in) :: der
129 real(real64),
intent(out) :: pot(:)
130 real(real64),
contiguous,
intent(in) :: rho(:)
133 real(real64),
allocatable :: vh_correction(:), res(:), cor(:)
138 safe_allocate(vh_correction(1:der%mesh%np_part))
139 safe_allocate(res(1:der%mesh%np_part))
140 safe_allocate(cor(1:der%mesh%np_part))
142 call correct_rho(this%corrector, der, rho, res, vh_correction)
145 select case (this%multigrid_cycle)
149 cor, res, this%multigrid_cycle)
151 call multigrid_fmg_solver(this%mg_solver, namespace, this%mgrid%level(0)%der, this%mgrid%level(0)%der%lapl, cor, res)
156 do ip = 1, der%mesh%np
157 pot(ip) = cor(ip) + vh_correction(ip)
160 safe_deallocate_a(vh_correction)
161 safe_deallocate_a(res)
162 safe_deallocate_a(cor)
scales a vector by a constant
Module implementing boundary conditions in Octopus.
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
real(real64), parameter, public m_zero
real(real64), parameter, public m_four
real(real64), parameter, public m_pi
some mathematical constants
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
This module handles the communicators for the various parallelization strategies.
subroutine, public multigrid_end(mgrid)
subroutine, public multigrid_init(mgrid, namespace, space, mesh, der, stencil, mc, nlevels)
This modules provides the routines for solving Ax=b using the V-shaped multigrid method.
recursive subroutine, public multigrid_fmg_solver(this, namespace, der, op, sol, rhs)
Full multigrid (FMG) solver.
subroutine, public multigrid_iterative_solver(this, namespace, der, op, sol, rhs, multigrid_shape)
An iterative multigrid solver.
subroutine, public multigrid_solver_init(this, namespace, space, mesh, thr)
integer, parameter, public mg_fmg
integer, parameter, public mg_v_shape
integer, parameter, public mg_w_shape
subroutine, public poisson_corrections_end(this)
subroutine, public poisson_corrections_init(this, namespace, space, ml, mesh)
subroutine, public correct_rho(this, der, rho, rho_corrected, vh_correction)
subroutine, public poisson_multigrid_solver(this, namespace, der, pot, rho)
A multigrid Poisson solver with corrections at the boundaries.
subroutine, public poisson_multigrid_end(this)
subroutine, public poisson_multigrid_init(this, namespace, space, mesh, der, stencil, mc, ml, thr)
This module defines stencils used in Octopus.