DL_MG
Functions/Subroutines | Variables
dl_mg_defco_fd Module Reference

computes higher order finite differences in parallel More...

Functions/Subroutines

subroutine, public dl_mg_defco_fd_initialise ()
 Initialises the finite differences by completing the computation of the finite difference coefficients that have been half-prepared by the DATA statements. There is no need to call this subroutine explicitly – it will be called upon first use of any computational FD subroutine. You can call it explicitly if you like, and any number of times. More...
 
subroutine dl_mg_defco_fd_derivative (fcn_der, fcn, n, d, order, square_result)
 
subroutine, public dl_mg_defco_fd_gradient (grad_fcn, fcn, order)
 
subroutine, public dl_mg_defco_fd_laplacian (lap_fcn, fcn, order)
 
subroutine, public dl_mg_defco_fd_mod_grad_sqd (mod_grad_sqd_fcn, fcn, order)
 
subroutine parallel_prepare_fd_halos (fcn, axis)
 
subroutine parallel_destroy_fd_halos
 

Variables

integer, parameter, public max_order = 12
 
logical dl_mg_defco_fd_initialised = .false.
 
real(kind=wp), dimension(:,:,:), allocatable halo_left
 
real(kind=wp), dimension(:,:,:), allocatable halo_right
 
integer, parameter max_order_half = max_order/2
 
integer, parameter ndata1 = (2*max_order+1)
 
integer, parameter ndata = (max_order+1)*ndata1
 
real(kind=wp), dimension(-max_order:max_order, -max_order_half:max_order_half, max_order, 2) coeff
 
real(kind=wp), dimension(max_order, 2), parameter norms = reshape( source = (/0D0, 1D0/2D0, 0D0, 1D0/12D0, 0D0, 1D0/60D0, 0D0, 1D0/840D0, 0D0, 1D0/2520D0, 0D0, 1D0/27720D0, 0D0, 1D0, 0D0, 1D0/12D0,0D0,1D0/180D0,0D0,1D0/5040D0,0D0,1D0/25200D0, 0D0,1D0/831600D0 /), shape = (/max_order, 2/) )
 

Detailed Description

computes higher order finite differences in parallel

Adapted from ONETEP's finite_differences module.

Written by Jacek Dziedzic in 08/2010.

Modified for use within DL_MG by J. C. Womack, 2016

Optimised by Lucian Anton, 2017

This module defines the subroutines for finite-difference calculations of the gradient, squared-modulus-of-gradient and the laplacian for a quantity on a GRID_INFO grid.

Finite differences of orders {2,4,6,8,10,12} can be used. Where 2nd order formulas are unavailable, 12th order is used instead. Slab-parallelism is automatically taken care of by internally using halos. Grid boundaries are taken care of by using progressively more forward- or backward-FD's.

Function/Subroutine Documentation

◆ dl_mg_defco_fd_derivative()

subroutine dl_mg_defco_fd::dl_mg_defco_fd_derivative ( real(kind=wp), dimension(isx:,isy:,isz:), intent(inout)  fcn_der,
real(kind=wp), dimension(isx:,isy:,isz:), intent(in)  fcn,
integer, intent(in)  n,
integer, intent(in)  d,
integer, intent(in)  order,
logical, intent(in), optional  square_result 
)
Parameters
[in,out]fcn_deroutput array
[in]fcninput array
[in]orderfinite difference order
[in]nderivative order
[in]ddimension (1=x, 2=y, 3=z)

◆ dl_mg_defco_fd_gradient()

subroutine, public dl_mg_defco_fd::dl_mg_defco_fd_gradient ( real(kind=wp), dimension(:,:,:,:), intent(out)  grad_fcn,
real(kind=wp), dimension(:,:,:), intent(in)  fcn,
integer, intent(in)  order 
)

◆ dl_mg_defco_fd_initialise()

subroutine, public dl_mg_defco_fd::dl_mg_defco_fd_initialise

Initialises the finite differences by completing the computation of the finite difference coefficients that have been half-prepared by the DATA statements. There is no need to call this subroutine explicitly – it will be called upon first use of any computational FD subroutine. You can call it explicitly if you like, and any number of times.

Written by Jacek Dziedzic, 08/2010

◆ dl_mg_defco_fd_laplacian()

subroutine, public dl_mg_defco_fd::dl_mg_defco_fd_laplacian ( real(kind=wp), dimension(:,:,:), intent(out)  lap_fcn,
real(kind=wp), dimension(:,:,:), intent(in)  fcn,
integer, intent(in)  order 
)

◆ dl_mg_defco_fd_mod_grad_sqd()

subroutine, public dl_mg_defco_fd::dl_mg_defco_fd_mod_grad_sqd ( real(kind=wp), dimension(:,:,:), intent(out)  mod_grad_sqd_fcn,
real(kind=wp), dimension(:,:,:), intent(in)  fcn,
integer, intent(in)  order 
)

◆ parallel_destroy_fd_halos()

subroutine dl_mg_defco_fd::parallel_destroy_fd_halos

◆ parallel_prepare_fd_halos()

subroutine dl_mg_defco_fd::parallel_prepare_fd_halos ( real(kind=wp), dimension(isx:,isy:,isz:), intent(in)  fcn,
integer, intent(in)  axis 
)
Parameters
[in]axisxyz

Variable Documentation

◆ coeff

real(kind=wp), dimension(-max_order:max_order, -max_order_half:max_order_half, max_order, 2) dl_mg_defco_fd::coeff
private

◆ dl_mg_defco_fd_initialised

logical dl_mg_defco_fd::dl_mg_defco_fd_initialised = .false.
private

◆ halo_left

real(kind=wp), dimension(:,:,:), allocatable dl_mg_defco_fd::halo_left
private

◆ halo_right

real(kind=wp), dimension(:,:,:), allocatable dl_mg_defco_fd::halo_right
private

◆ max_order

integer, parameter, public dl_mg_defco_fd::max_order = 12

◆ max_order_half

integer, parameter dl_mg_defco_fd::max_order_half = max_order/2
private

◆ ndata

integer, parameter dl_mg_defco_fd::ndata = (max_order+1)*ndata1
private

◆ ndata1

integer, parameter dl_mg_defco_fd::ndata1 = (2*max_order+1)
private

◆ norms

real(kind=wp), dimension(max_order,2), parameter dl_mg_defco_fd::norms = reshape( source = (/0D0, 1D0/2D0, 0D0, 1D0/12D0, 0D0, 1D0/60D0, 0D0, 1D0/840D0, 0D0, 1D0/2520D0, 0D0, 1D0/27720D0, 0D0, 1D0, 0D0, 1D0/12D0,0D0,1D0/180D0,0D0,1D0/5040D0,0D0,1D0/25200D0, 0D0,1D0/831600D0 /), shape = (/max_order, 2/) )
private