poisson_logspirals

Module

Description

$Id$

This module contains (more or less) a replica of poisson.f90, implementing the version of poisson equation solving that I have been building (the method outlined in Clement Baruteau’s thesis).

The derivatives of the poisson equation on a cylindrical grid is inverted, giving the radial and azimuthal components of gravitational acceleration as integrals over cylindrical coordinates. The integrals may be replaced by convolution products, by switching to radial coordinate u=ln(r/rmin), spacing radial points logarithmically (such that u is evenly spaced), and making the smoothing factor proportional to the radius. Given that these conditions are met, the resulting convolution product is computed in Fourier space and transformed to physical space at expense O(nlogn) over a grid with n points, compared to O(n^2) for the integral.

In order to avoid forcing the periodicity of the Fourier space representation on the final result, a grid with twice as many gridpoints in every non-periodic dimension must be used for the Fourier analysis. In cylindrical coordinates, this means there must be twice as many points in the radial direction (and in the z direction for 3d computations) as there are holding the region of physical interest.

** AUTOMATIC CPARAM.INC GENERATION ************************ Declare (for generation of cparam.inc) the number of f array variables and auxiliary variables added by this module

CPARAM logical, parameter :: lpoisson=.true.

MVAR CONTRIBUTION 0 MAUX CONTRIBUTION 0 COMMUNITCATED AUXILIARIES 0


Quick access

Variables:

apply_boundcond, b, bessel_grid, bsmooth, calc_potential, check_setup, compute_acceleration, construct_large_grid, copy_density_large_grid, copy_potential_small_grid, coslt, decide_fourier_routine, dkr, dphi, dr, dr1, dth, dth1, du, dxc1, dxlt, dyc1, dz1, fft_fouriergrid, fourier_cosine_terms, fourier_to_physical_proc, fourier_to_physical_procs, gauss_seidel_iterate, generate_coordinates, generate_fourier_density, generate_kernals, generate_massfields, get_communication_matrix, gnewton, gphi, gr, innerradius, inverse_laplacian_expandgrid, inverse_laplacian_fft, inverse_laplacian_isoz, inverse_laplacian_logradial_fft, ipoisson_method, iproc_fourier, ipx_fourier, ipy_fourier, iregion, irl, iroot, iru, iteration_threshold, ixlower_fourier, ixupper_fourier, iylower_fourier, iyupper_fourier, jrl, jru, kkx_fft, kky_fft, kphi, kphi_fft_imag, kphi_fft_real, kr_fft, kr_fft_imag, kr_fft_real, krl, kru, legendre_qmod, lexpand_grid, lisoz, lklimit_shear, lkmax, lkmin, lmakecartoon, lnorepeatsumming, lprecalcdists, lrazor_thin, lreadoctree, lsemispectral, lshowtime, lsolve_bessel, lsolve_cyl2cart, lsolve_relax_sor, lsquareregions, ltreestatus, luseprevioussum, lwriteoctree, m_fft, mmax, ngroup, niter_poisson, nkhgrid, nkr, nkt, nktgrid, nlt, nnx, nny, nprecalc, nsingle, nslice, nth, nthgrid, octree_maxdist, octree_smoothdist, octree_theta, phi2d, phi2d_global, phi_previous_step, physical_to_fourier_proc, physical_to_fourier_procs, r2_ext, r2_int, rad1, refine, regdist1_group, regdist1_single, regsmooth_group, regsmooth_single, remap_to_pencil_fouriergrid, residual, restrict, rhs_previous_step, rjac, rn, sinlt, smooth_full_weight, sphi, sphi_fft_imag, sphi_fft_real, sqrtrad_1, sr, sr_fft_imag, sr_fft_real, stop_fatal, themap_group, themap_single, theta0, theta1, tht, transp_pencil_fouriergrid, trilinear_interpolate, u2d, u2d_global, unmap_from_pencil_fouriergrid, v_cycle, vols, xc0, xlt, xmesh, xrecv, yc0, ymesh, yrecv, zed, zmesh, zrecv

Routines:

calculate_cross_bessel_functions(), calculate_cross_legendre_functions(), do_barneshut(), five_point_solver(), get_acceleration(), get_border_values(), get_dist(), get_serial_array(), initialize_poisson(), integrate_border(), inverse_laplacian(), inverse_laplacian_bessel(), inverse_laplacian_cyl2cart(), inverse_laplacian_fft_z(), inverse_laplacian_semispectral(), inverse_laplacian_sor(), inverse_laplacian_z_2nd_neumann(), mkmap(), read_octree(), read_poisson_init_pars(), read_poisson_run_pars(), roundtwo(), sincoslf(), write_octree(), write_poisson_init_pars(), write_poisson_run_pars()

Needed modules

Variables

  • poisson/b [real,private]
  • poisson/b2 [real,private]
  • poisson/bsmooth [real,private/optional/default=0.01]
  • poisson/check_setup [private]
  • poisson/compute_acceleration [private]
  • poisson/decide_fourier_routine [private]
  • poisson/dphi [real,private]
  • poisson/du [real,private]
  • poisson/fft_fouriergrid [private]
  • poisson/fourier_to_physical_proc [private]
  • poisson/fourier_to_physical_procs [private]
  • poisson/generate_coordinates [private]
  • poisson/generate_fourier_density [private]
  • poisson/generate_kernals [private]
  • poisson/generate_massfields [private]
  • poisson/gnewton [real,private/optional/default=g_newton_cgs]
  • poisson/gphi (nx,ny) [real,private]
  • poisson/gr (nx,ny) [real,private]
  • poisson/innerradius [real,private]
  • poisson/inverse_laplacian_logradial_fft [private]
  • poisson/iproc_fourier [integer,private]
  • poisson/ipx_fourier [integer,private]
  • poisson/ipy_fourier [integer,private]
  • poisson/ixlower_fourier [integer,private]
  • poisson/ixupper_fourier [integer,private]
  • poisson/iylower_fourier [integer,private]
  • poisson/iyupper_fourier [integer,private]
  • poisson/kphi (2 * nx,ny) [real,private]
  • poisson/kphi_fft_imag (2 * nx,ny) [real,private]
  • poisson/kphi_fft_real (2 * nx,ny) [real,private]
  • poisson/kr (2 * nx,ny) [real,private]
  • poisson/kr_fft_imag (2 * nx,ny) [real,private]
  • poisson/kr_fft_real (2 * nx,ny) [real,private]
  • poisson/luse_fourier_transform [logical,private/optional/default=.false.]
  • poisson/phi2d (2 * nx,ny) [real,private]
  • poisson/phi2d_global (2 * nxgrid,nygrid) [real,private]
  • poisson/physical_to_fourier_proc [private]
  • poisson/physical_to_fourier_procs [private]
  • poisson/remap_to_pencil_fouriergrid [private]
  • poisson/sigma (2 * nx,ny) [real,private]
  • poisson/sphi (2 * nx,ny) [real,private]
  • poisson/sphi_fft_imag (2 * nx,ny) [real,private]
  • poisson/sphi_fft_real (2 * nx,ny) [real,private]
  • poisson/sr (2 * nx,ny) [real,private]
  • poisson/sr_fft_imag (2 * nx,ny) [real,private]
  • poisson/sr_fft_real (2 * nx,ny) [real,private]
  • poisson/stop_fatal [private]
  • poisson/transp_pencil_fouriergrid [private]
  • poisson/u2d (2 * nx,ny) [real,private]
  • poisson/u2d_global (2 * nxgrid,nygrid) [real,private]
  • poisson/unmap_from_pencil_fouriergrid [private]

Subroutines and functions

subroutine  poisson/initialize_poisson()

Perform any post-parameter-read initialization i.e. calculate derived parameters.

18-oct-07/anders: adapted

Use :

sharedvariables (get_shared_variable())

Call to:

fatal_error(), cffti(), cfftf(), cfftb(), die_immediately(), die_gracefully()

subroutine  poisson/inverse_laplacian(phi)

Dispatch solving the Poisson equation to inverse_laplacian_fft or inverse_laplacian_semispectral, based on the boundary conditions

17-jul-2007/wolf: coded wrapper

Parameters:

phi (nx,ny,nz) [real,inout]

Call to:

fatal_error(), cffti(), cfftf(), cfftb(), die_immediately(), die_gracefully()

subroutine  poisson/inverse_laplacian_semispectral(phi)

dummy subroutine

19-dec-2006/anders: coded

Parameters:

phi (nx,ny,nz) [real]

Call to:

fatal_error(), cffti(), cfftf(), cfftb(), die_immediately(), die_gracefully()

subroutine  poisson/read_poisson_init_pars(iomsg)
Parameters:

iomsg [character,out]

Use :

file_io (parallel_unit())

Call to:

fatal_error(), cffti(), cfftf(), cfftb(), die_immediately(), die_gracefully()

subroutine  poisson/write_poisson_init_pars(unit)
Parameters:

unit [integer,in]

Call to:

fatal_error(), cffti(), cfftf(), cfftb(), die_immediately(), die_gracefully()

subroutine  poisson/read_poisson_run_pars(iomsg)
Parameters:

iomsg [character,out]

Use :

file_io (parallel_unit())

Call to:

fatal_error(), cffti(), cfftf(), cfftb(), die_immediately(), die_gracefully()

subroutine  poisson/write_poisson_run_pars(unit)
Parameters:

unit [integer,in]

Call to:

fatal_error(), cffti(), cfftf(), cfftb(), die_immediately(), die_gracefully()

subroutine  poisson/inverse_laplacian_fft_z(phi)

15-may-2006/anders+jeff: dummy

Parameters:

phi (nx,ny,nz) [real,in]

Call to:

fatal_error(), cffti(), cfftf(), cfftb(), die_immediately(), die_gracefully()

subroutine  poisson/inverse_laplacian_z_2nd_neumann(f)

15-may-2006/anders+jeff: dummy

Parameters:

f (,,*,*) [real,in]

Call to:

fatal_error(), cffti(), cfftf(), cfftb(), die_immediately(), die_gracefully()

subroutine  poisson/get_acceleration(acceleration)

Passes the accelerations out of this module for use in selfgravity_logspirals

Parameters:

acceleration (nx,ny,nz,3) [real,out]