DL_MG
Private Member Functions | List of all members
dl_mg::dl_mg_solver Interface Reference

Private Member Functions

subroutine dl_mg_solver_poisson (eps, eps_mid, alpha, rho, pot, fd_order, tol_res_rel, tol_res_abs, tol_pot_rel, tol_pot_abs, tol_cg_res_rel, tol_cg_res_abs, tol_vcycle_res_rel, tol_vcycle_res_abs, tol_level_1_res_rel, tol_level_1_res_abs, mg_max_conv_rate, max_iters_defco, max_iters_cg, max_iters_vcycle, max_iters_level_1, v_iterations, omega_sor, use_cg, use_pot_in, use_damping, res, ierror)
 Poisson Equation driver. More...
 
subroutine dl_mg_solver_pbe (eps, eps_mid, alpha, rho, lambda, temp, nion, c, q, pot, fd_order, tol_res_rel, tol_res_abs, tol_pot_rel, tol_pot_abs, tol_newton_res_rel, tol_newton_res_abs, tol_cg_res_rel, tol_cg_res_abs, tol_vcycle_res_rel, tol_vcycle_res_abs, tol_level_1_res_rel, tol_level_1_res_abs, tol_mu_rel, tol_mu_abs, mg_max_conv_rate, max_iters_defco, max_iters_cg, max_iters_vcycle, max_iters_level_1, max_iters_newton, v_iterations, use_cg, omega_sor, linearised, der_pot, steric_weight, expcap, res, use_fas, use_pot_in, use_damping, neutralisation_method, neutralisation_ion_ratios, betamu_electrostatic, steric_weight_average, used_ion_concentrations, used_neutralisation_ratios, ierror)
 solves PBE with steric potential More...
 

Member Function/Subroutine Documentation

◆ dl_mg_solver_pbe()

subroutine dl_mg::dl_mg_solver::dl_mg_solver_pbe ( real(wp), dimension(:,:,:), intent(in)  eps,
real(wp), dimension(:, :, :, :), intent(in), target  eps_mid,
real(wp), intent(in)  alpha,
real(wp), dimension(:, :, :), intent(in)  rho,
real(wp), intent(in)  lambda,
real(wp), intent(in)  temp,
integer, intent(in)  nion,
real(wp), dimension(nion), intent(in)  c,
real(wp), dimension(nion), intent(in)  q,
real(wp), dimension(:, :, :), intent(inout)  pot,
integer, intent(in)  fd_order,
real(wp), intent(in), optional  tol_res_rel,
real(wp), intent(in), optional  tol_res_abs,
real(wp), intent(in), optional  tol_pot_rel,
real(wp), intent(in), optional  tol_pot_abs,
real(wp), intent(in), optional  tol_newton_res_rel,
real(wp), intent(in), optional  tol_newton_res_abs,
real(wp), intent(in), optional  tol_cg_res_rel,
real(wp), intent(in), optional  tol_cg_res_abs,
real(wp), intent(in), optional  tol_vcycle_res_rel,
real(wp), intent(in), optional  tol_vcycle_res_abs,
real(wp), intent(in), optional  tol_level_1_res_rel,
real(wp), intent(in), optional  tol_level_1_res_abs,
real(wp), intent(in), optional  tol_mu_rel,
real(wp), intent(in), optional  tol_mu_abs,
real(wp), intent(in), optional  mg_max_conv_rate,
integer, intent(in), optional  max_iters_defco,
integer, intent(in), optional  max_iters_cg,
integer, intent(in), optional  max_iters_vcycle,
integer, intent(in), optional  max_iters_level_1,
integer, intent(in), optional  max_iters_newton,
integer, dimension(2), intent(in), optional  v_iterations,
logical, intent(in), optional  use_cg,
real(wp), intent(in), optional  omega_sor,
logical, intent(in), optional  linearised,
real(wp), dimension(:,:,:), intent(in), optional  der_pot,
real(wp), dimension(:,:,:), intent(in), optional  steric_weight,
real(wp), intent(in), optional  expcap,
real(wp), dimension(:, :, :), intent(out), optional  res,
logical, intent(in), optional  use_fas,
logical, intent(in), optional  use_pot_in,
logical, intent(in), optional  use_damping,
integer, intent(in), optional  neutralisation_method,
real(wp), dimension(nion), intent(in), optional  neutralisation_ion_ratios,
real(wp), dimension(nion), intent(out), optional  betamu_electrostatic,
real(wp), intent(out), optional  steric_weight_average,
real(wp), dimension(nion), intent(out), optional  used_ion_concentrations,
real(wp), dimension(nion), intent(out), optional  used_neutralisation_ratios,
integer, intent(out), optional  ierror 
)
private

solves PBE with steric potential

Parameters
[in]epsrelative permitivity on the grid points, ignored if the finite difference order is 2
[in]eps_midrelative permitivity, at the points located halfway between the grid points in each direction E.g.: eps_mid(i,j,k,1) is associated with the middle point of grid segment between (i,j,k) and (i+1,j,k).
[in]alphamultiplicative constant for \(\rho\) defined by the units used
[in]rhocharge density
[in]temptemperature in Kelvin
[in]nionNumber of ionic species
[in]cConcentrations of ionic species in \( r_{Bohr}^{-3}\), where \( r_{Bohr}\) is the Bohr radius. Note: the concentration must be defined in relation to the accesible ion volume, not the grid domain volume. These quantities differ when steric weight is used, see this note.
[in]qElectric charge in electron charge units of each ionic specie present in solution.
[in,out]potsolution to be sought, see embeded
[in]fd_orderderivatives approximation order in finite diferences
[in]tol_res_relrelative tolerance parameter for the residual of the top iteration (defect correction if fd_order > 2, else applies to Newton or linearised PBE). See Convergence Criteria
[in]tol_res_absabsolute tolerace ...
[in]tol_pot_relrelative tolerance parameter for the potential of the top iteration (used only in defect correction)
[in]tol_pot_absabsolute tolerace for the potential
[in]tol_newton_res_relrelative tol for newton iteration
[in]tol_newton_res_absabsolute ...
[in]tol_cg_res_relrelative tol for CG
[in]tol_cg_res_absabsolute ...
[in]tol_vcycle_res_relrelative tol for V cycle iterations
[in]tol_vcycle_res_absabsolute ...
[in]tol_level_1_res_reltolerance for multgrig coarse loop, used only if number of levels > 1
[in]tol_level_1_res_absabsolute tolerance ...
[in]tol_mu_relrelative tolerance for excess electrostatic potential
[in]tol_mu_absabsolute tolerance for excess electrostatic potential
[in]mg_max_conv_ratelargest allowed convergence rate, i.e. the inverse ratio of two consecutive residuals in the multigrid solver
[in]max_iters_defcomaximum number of iterations for the higher order correction
[in]max_iters_newtonmaximum number of iteration for Newton
[in]max_iters_cgmaximum number of CG iterations
[in]max_iters_vcyclemaximum number of V cycles (recommended value not more that 50) at the coarsest level
[in]max_iters_level_1max number of iteration
[in]v_iterationsnumber of relaxation iteration on the V-cycle branches
[in]omega_sorSOR relaxation parameter
[in]lineariseduse linereased version
[in]der_potpotential function at which the derivative of the Boltzmann term is computed (if not present defaults to 0)
[in]steric_weightsteric weight in the Boltzmann term, i.e. \( e^{(-\beta V_{steric}(r))} \)
[in]expcapcap of the exponential argument in the Boltzmann term
[out]resresidual at the of computation
[in]use_fasuse Full Approximation Scheme to solve non-linear PBE, the default is Newton method
[in]use_pot_instart iterating from this potential, if not present starts from 0
[in]use_dampingif present and true use error damping in defect correction loop
[in]neutralisation_methodselect the neutralisation method for PBE with PBC
[in]neutralisation_ion_ratiosratios of ion mixing when neutralisation_method is set to dl_mg_neutralise_with_ions_fixed non-negative reals, no need to be normalised to 1.
[out]betamu_electrostaticarray containing \( \mu_i /(k_B T) \) computed in the Newton solver or in the defect correction section see Periodic boundary conditions (PBC) for PBE
[out]used_ion_concentrationsarray containing the bulk ion concentration used in PBE solution. It might differ from the input concentration when neutralisation_method is set to dl_mg_neutralise_with_ions_fixed or to dl_mg_neutralise_with_ions_auto.
[out]used_neutralisation_ratiosarray containing the neutralisation ratios used to shift the bulk concentrations. Relevant only if neutralisation_method is set to dl_mg_neutralise_with_ions_fixed or to dl_mg_neutralise_with_ions_auto
[out]steric_weight_average\( (1/V) \int_V e^{(-\beta V_{steric}(r))} dv\) useful if the calling app wants to compute the ions distribution functions

◆ dl_mg_solver_poisson()

subroutine dl_mg::dl_mg_solver::dl_mg_solver_poisson ( real(wp), dimension(:, :, :), intent(in)  eps,
real(wp), dimension(:, :, :, :), intent(in)  eps_mid,
real(wp), intent(in)  alpha,
real(wp), dimension(:, :, :), intent(in)  rho,
real(wp), dimension(:, :, :), intent(inout)  pot,
integer, intent(in)  fd_order,
real(wp), intent(in), optional  tol_res_rel,
real(wp), intent(in), optional  tol_res_abs,
real(wp), intent(in), optional  tol_pot_rel,
real(wp), intent(in), optional  tol_pot_abs,
real(wp), intent(in), optional  tol_cg_res_rel,
real(wp), intent(in), optional  tol_cg_res_abs,
real(wp), intent(in), optional  tol_vcycle_res_rel,
real(wp), intent(in), optional  tol_vcycle_res_abs,
real(wp), intent(in), optional  tol_level_1_res_rel,
real(wp), intent(in), optional  tol_level_1_res_abs,
real(wp), intent(in), optional  mg_max_conv_rate,
integer, intent(in), optional  max_iters_defco,
integer, intent(in), optional  max_iters_cg,
integer, intent(in), optional  max_iters_vcycle,
integer, intent(in), optional  max_iters_level_1,
integer, dimension(2), intent(in), optional  v_iterations,
real(wp), intent(in), optional  omega_sor,
logical, intent(in), optional  use_cg,
logical, intent(in), optional  use_pot_in,
logical, intent(in), optional  use_damping,
real(wp), dimension(:, :, :), intent(out), optional  res,
integer, intent(out), optional  ierror 
)
private

Poisson Equation driver.

Parameters
[in]epsrelative permitivity on the grid points, ignored if the finite difference order is 2
[in]eps_midrelative permitivity, at the points located halfway between the grid points in each direction. the fourth index stores the direction: 1 -> x, 2 ->y, 3 -> z E.g.: eps_mid(i,j,k,1) is associated with the middle point of grid segment between (i,j,k) and (i+1,j,k).
[in]alphamultiplicative constant for \(\rho\) defined by the units used
[in]rhor.h.s. term (charge density)
[in,out]potthe potential to be computed, see embeded
[in]fd_orderfinite difference order used in defect correction
[out]resthe residual
[in]use_pot_instart iterating from this potential, if not present starts from 0 inside the domain
[in]tol_res_relrelative tolerance parameter for the residual of the top iteration (defect correction if fd_order > 2, else multigrid). See Convergence Criteria
[in]tol_res_absabsolute tolerace ...
[in]tol_pot_relrelative tolerance parameter for the potential of the top iteration (used only in defect correction)
[in]tol_pot_absabsolute tolerace for the potential
[in]tol_cg_res_relrelative tol for conjugate gradient iterations
[in]tol_cg_res_absabsolute ...
[in]tol_vcycle_res_relrelative tol for V cycle iterations
[in]tol_vcycle_res_absabsolute ...
[in]tol_level_1_res_reltolerance for multgrig coarse loop, used only if number of levels > 1
[in]tol_level_1_res_absabsolute tolerance ...
[in]mg_max_conv_ratelargest allowed convergence rate, i.e. the inverse ratio of two consecutive residuals in the multigrid solver
[in]max_iters_defcomaximum number of iterations for the higher order correction
[in]max_iters_cgmaximum number of CG iterations
[in]max_iters_vcyclemaximum number of V cycles (recommended value not more that 50) at the coarsest level
[in]max_iters_level_1max number of iteration
[in]v_iterationsnumber of relaxation iteration on the V-cycle branches
[in]omega_sorSOR relaxation parameter
[in]use_dampingif true use error damping in defect correction loop
[out]ierrorerror flag