stretchmap
Module
Description
This module implements stretch mapping to create one dimensional density profiles from uniform arrangements of SPH particles
The implementation is quite general, allowing the density function to be specified in any of the coordinate dimensions in either cartesian, cylindrical, spherical or toroidal coordinates. It is a generalisation of the spherical stretch map described in Herant (1994) and of the cartesian version used in Price (2004)
- References:
Herant, M. (1994) “Dirty Tricks for SPH”, MmSAI 65, 1013
Price (2004), “Magnetic fields in Astrophysics”, PhD Thesis, University of Cambridge
- Owner:
Daniel Price
- Runtime parameters:
None
- Dependencies:
geometry, table_utils
Quick access
- Variables:
get_mass
,get_mass_rcyl
,get_mass_tab
,get_mass_tab_r
,get_mass_tab_rcyl
,ierr_memory_allocation
,ierr_not_converged
,ierr_table_size_differs
,ierr_zero_size_density_table
,is_rcylindrical
,is_rspherical
,mass_func
,maxits
,maxits_nr
,ngrid
,pi
,rho_func
,tol
,unknown_abstract_interface
- Routines:
Variables
- stretchmap/get_mass [private]
- stretchmap/get_mass_rcyl [private]
- stretchmap/get_mass_tab [private]
- stretchmap/get_mass_tab_r [private]
- stretchmap/get_mass_tab_rcyl [private]
- stretchmap/ierr_memory_allocation [integer,public/parameter/optional/default=2]
error code
- stretchmap/ierr_not_converged [integer,public/parameter/optional/default=-1]
error code
- stretchmap/ierr_table_size_differs [integer,public/parameter/optional/default=3]
error code
- stretchmap/ierr_zero_size_density_table [integer,public/parameter/optional/default=1]
error code
- stretchmap/is_rcylindrical [private]
- stretchmap/is_rspherical [private]
- stretchmap/mass_func [public]
- stretchmap/maxits [integer,private/parameter/optional/default=100]
max number of iterations
- stretchmap/maxits_nr [integer,private/parameter/optional/default=30]
max iterations with Newton-Raphson
- stretchmap/ngrid [integer,private/optional/default=8192]
number of points used when integrating rho to get mass
- stretchmap/pi [real,private/parameter/optional/default=4.*atan(1.)]
- stretchmap/rho_func [public]
- stretchmap/tol [real,private/parameter/optional/default=1e-10]
tolerance on iterations
- stretchmap/unknown_abstract_interface [private]
Subroutines and functions
- subroutine stretchmap/set_density_profile(np, xyzh, min_bn, max_bn, rhofunc, massfunc[, rhotab[, xtab[, start[, geom[, coord[, verbose[, err]]]]]]])
Subroutine to implement the stretch mapping procedure
The function rhofunc is assumed to be a real function with a single argument:
real function rho(r) real, intent(in) :: r rho = 1./r**2 end function rho
If the ctab array is not present, the table rhotab(:) is assumed to contain density values on equally spaced bins between cmin and cmax
- Parameters:
xyzh (,) [real,inout] :: particle coordinates and smoothing length
np [integer,in] :: number of particles
min_bn [real,in] :: min range in the coordinate to apply transformation
max_bn [real,in] :: max range in the coordinate to apply transformation
start [integer,in,] :: only consider particles between start and np (optional)
geom [integer,in,] ::
- geometry in which stretch mapping is to be performed (optional)
1 - cartesian 2 - cylindrical 3 - spherical 4 - toroidal
(if not specified, assumed to be cartesian)
coord [integer,in,] :: coordinate direction in which stretch mapping is to be performed (optional) (if not specified, assumed to be the first coordinate)
rhofunc [real] :: function containing the desired density function rho(r) or rho(x) (optional)
xtab (*) [real,in,] :: tabulated coordinate values (optional)
rhotab (*) [real,in,] :: tabulated density profile (optional) ctab : tabulated coordinate positions for density bins in table (optional)
verbose [logical,in,] :: turn on/off verbose output (optional)
err [integer,out,] :: error code (0 on successful run)
massfunc [integer]
- Use :
geometry
(coord_transform()
,maxcoordsys()
,labelcoord()
,igeom_cartesian()
),table_utils
(yinterp()
,linspace()
)- Called from:
- Call to:
- function stretchmap/get_mass_r(rhofunc, r, rmin)
mass integrated along spherical radius
- Parameters:
rhofunc [real]
r [real,in]
rmin [real,in]
- Return:
get_mass_r [real]
- Called from: