70  use, 
intrinsic :: iso_fortran_env
 
   94    type(grid_t), 
pointer :: sys_grid
 
   95    logical, 
public       :: compute_surface_correction
 
   96    integer, 
allocatable  :: surface_points(:)
 
   97    integer, 
allocatable  :: inner_stencil(:)
 
   99    logical               :: enforce_coulomb_gauge
 
  101    real(real64)          :: coulomb_gauge_tolerance
 
  104    real(real64)          :: poisson_prefactor
 
  105    type(poisson_t)       :: poisson_solver
 
  111    procedure :: dapply_inner_stencil_mask, zapply_inner_stencil_mask
 
  112    generic   :: apply_inner_stencil_mask => dapply_inner_stencil_mask, zapply_inner_stencil_mask
 
  114    procedure :: dget_vector_potential, zget_vector_potential
 
  115    generic   :: get_vector_potential => dget_vector_potential, zget_vector_potential
 
  117    procedure :: dget_scalar_potential, zget_scalar_potential
 
  118    generic   :: get_scalar_potential => dget_scalar_potential, zget_scalar_potential
 
  120    procedure :: dget_trans_field, zget_trans_field
 
  121    generic   :: get_trans_field => dget_trans_field, zget_trans_field
 
  123    procedure :: dget_long_field, zget_long_field
 
  124    generic   :: get_long_field => dget_long_field, zget_long_field
 
  133    class(helmholtz_decomposition_t), 
intent(inout) :: this
 
  134    type(namespace_t),                
intent(in)    :: namespace
 
  135    type(grid_t), 
target,             
intent(in)    :: sys_grid
 
  136    type(multicomm_t),                
intent(in)    :: system_mc
 
  137    class(space_t),                   
intent(in)    :: space
 
  139    logical, 
allocatable  :: mask(:)
 
  140    logical               :: visualize_boxes
 
  141    integer               :: number_of_points
 
  146    this%sys_grid => sys_grid
 
  149    call poisson_init(this%poisson_solver, namespace, space, sys_grid%der, system_mc, sys_grid%stencil, label = 
"Helmholtz")
 
  153    safe_allocate(mask(1:sys_grid%np))
 
  156    number_of_points = count(mask)
 
  158    safe_allocate(this%inner_stencil(1:number_of_points))
 
  170    call parse_variable(namespace, 
'HelmholtzEnforceCoulombGauge', .
true., this%enforce_coulomb_gauge)
 
  171    if (this%enforce_coulomb_gauge) 
then 
  180      call parse_variable(namespace, 
'HelmholtzCoulombGaugeTolerance', 1e-5_real64, this%coulomb_gauge_tolerance)
 
  192    call parse_variable(namespace, 
'SurfaceCorrection', .false., this%compute_surface_correction)
 
  193    if (this%compute_surface_correction) 
then 
  197    if (this%compute_surface_correction) 
then 
  199      mask = sys_grid%box%get_surface_points(namespace, sys_grid%spacing, sys_grid%np, sys_grid%x)
 
  200      number_of_points = count(mask)
 
  203      safe_allocate(this%surface_points(1:number_of_points))
 
  207      select case (sys_grid%box%dim)
 
  215        message(1) = 
"Internal error: surface correction for helmholtz decomposition can only be called for 1D, 2D or 3D." 
  219    safe_deallocate_a(mask)
 
  234    call parse_variable(namespace, 
'HelmholtzVisualizeBoxes', .false., visualize_boxes)
 
  235    if (visualize_boxes) 
then 
  243    integer, 
intent(in)  :: np
 
  244    logical, 
intent(in)  :: mask(:)
 
  245    integer, 
intent(out) :: indices(:)
 
  267    safe_deallocate_a(this%inner_stencil)
 
  268    safe_deallocate_a(this%surface_points)
 
  277    class(
space_t),    
intent(in)                  :: space
 
  279    real(real64)         :: coords(space%dim), normal_vector(space%dim), surface_element, ra
 
  280    integer              :: ip, ii, iunit
 
  285    iunit = 
io_open(
"system_box_volume_points", namespace, action=
'write')
 
  286    write(iunit, 
'(a6, 5X, a1, 12X, a1, 12X, a1)') 
"#point", 
"x", 
"y", 
"z" 
  287    do ip = 1, this%sys_grid%np
 
  288      call mesh_r(this%sys_grid, ip, ra, coords = coords)
 
  289      write(iunit, 
'(i7, 3f12.7)') ip, coords(:)
 
  294    iunit = 
io_open(
"system_box_inner_stencil", namespace, action=
'write')
 
  295    write(iunit, 
'(a6, 5X, a1, 12X, a1, 12X, a1)') 
"#point", 
"x", 
"y", 
"z" 
  296    do ip = 1, 
SIZE(this%inner_stencil, dim = 1)
 
  297      ii = this%inner_stencil(ip)
 
  298      call mesh_r(this%sys_grid, ii, ra, coords = coords)
 
  299      write(iunit, 
'(i7, 3f12.7)') ip, coords(:)
 
  304    if (this%compute_surface_correction) 
then 
  305      iunit = 
io_open(
"system_box_surface_points", namespace, action=
'write')
 
  306      write(iunit, 
'(a,12X,a,12X,a,12X,a,12X,a,12X,a,12X,a)') 
"x", 
"y", 
"z", 
"norm_x", 
"norm_y", 
"norm_z", 
"surf_element" 
  307      do ip = 1, 
SIZE(this%surface_points, dim = 1)
 
  308        ii = this%surface_points(ip)
 
  309        call mesh_r(this%sys_grid, ii, ra, coords = coords)
 
  310        call this%sys_grid%box%get_surface_point_info(coords, this%sys_grid%spacing, normal_vector, surface_element)
 
  311        write(iunit, 
'(7f12.7)') coords(:), normal_vector(:), surface_element
 
  320#include "complex.F90" 
  321#include "helmholtz_decomposition_inc.F90" 
  325#include "helmholtz_decomposition_inc.F90" 
This module contains interfaces for BLAS routines You should not use these routines directly....
 
Module, implementing a factory for boxes.
 
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
 
logical function, dimension(1:this%mesh%np), public derivatives_get_inner_boundary_mask(this)
This function tells whether a point in the grid is contained in a layer of the width of the stencil b...
 
real(real64), parameter, public m_two
 
real(real64), parameter, public m_four
 
real(real64), parameter, public m_pi
some mathematical constants
 
real(real64), parameter, public m_twothird
 
real(real64), parameter, public m_one
 
real(real64), parameter, public m_three
 
This module implements the underlying real-space grid.
 
The Helmholtz decomposition is intended to contain "only mathematical" functions and procedures to co...
 
subroutine helmholtz_finalize(this)
 
subroutine get_indices_from_mask(np, mask, indices)
 
subroutine helmholtz_decomposition_init(this, namespace, sys_grid, system_mc, space)
Initialize Helmholtz decomposition object.
 
subroutine helmholtz_visualize_boxes(this, namespace, space)
Visualise boxes for use in Helmholtz Decomposition.
 
subroutine, public io_close(iunit, grp)
 
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
 
This module is intended to contain "only mathematical" functions and procedures.
 
This module defines various routines, operating on mesh functions.
 
This module defines the meshes, which are used in Octopus.
 
pure subroutine, public mesh_r(mesh, ip, rr, origin, coords)
return the distance to the origin for a given grid point
 
subroutine, public messages_not_implemented(feature, namespace)
 
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
 
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
 
This module handles the communicators for the various parallelization strategies.
 
subroutine, public poisson_init(this, namespace, space, der, mc, stencil, qtot, label, solver, verbose, force_serial, force_cmplx)
 
subroutine, public poisson_end(this)
 
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
 
This module defines the unit system, used for input and output.