evTools
Tools to manipulate and display output from the binary stellar-evolution code ev/STARS/TWIN
 All Classes Files Functions Variables Pages
Data Types | Functions/Subroutines
functions.f90 File Reference

(evTools version 0.4.1, revision 191, hash 60997ac (2015-04-25))

Shared modules, functions and subroutines for the evTools package. More...

Data Types

module  ubvdata
 Contains data to compute magnitudes and colours from L,T,g. More...
 
module  constants
 Contains the 'constants' used in the evTools package. More...
 

Functions/Subroutines

subroutine setconstants ()
 Define the 'constants' in the evTools package. More...
 
subroutine lt2ubv (logl, logt, mass, logz, mbol, bolc, mv, uminb, bminv, vminr, rmini)
 Computes values of Mv, U-B, B-V and V-I for a star with given log L, log T, mass and log(Z/0.02) More...
 
subroutine num_sp_type_2_lt (sptyp, lumcl, lum, teff)
 Convert spectral type and luminosity class to L, Teff using De Jager & Nieuwenhuijzen 1987. More...
 
integer function getos ()
 Determine the operating system type: 1-Linux, 2-MacOSX. More...
 
character function, dimension(99) findfile (match)
 Find a file that matches match in the current directory. More...
 
subroutine findfiles (match, nff, all, fnames, nf)
 Find files that match match in the current directory. More...
 
subroutine rswap (x, y)
 Swap two real numbers. More...
 
integer function find_index (v, arr, narr)
 Finds index of value v in monotonously increasing or decreasing array arr of length narr. More...
 
subroutine locate (arr, narr, v, i)
 Locate the index of array arr such that v lies between arr(i) and arr(i+1) More...
 
subroutine locater (rarr, narr, rv, i)
 Single-precision wrapper for of locate() More...
 
real(double) function a2j (m1, m2, a)
 Convert orbital separation to orbital angular momentum. More...
 
real(double) function j2a (m1, m2, j)
 Convert orbital angular momentum to orbital separation. More...
 
real(double) function p2j (m1, m2, p)
 Convert orbital period to orbital angular momentum, all in cgs units. More...
 
real(double) function j2p (m1, m2, j)
 Convert orbital angular momentum to orbital period, all in cgs units. More...
 
subroutine p2a (mtot, p, a)
 Convert orbital period to orbital separation, in cgs units. More...
 
subroutine a2p (mtot, a, p)
 Convert orbital separation to orbital period, in cgs units. More...
 
real(double) function a2rl (m1, m2, a)
 Compute Roche-lobe radius, using Eggleton (1983) More...
 
real(double) function rl2a (m1, m2, rl1)
 Convert Roche-lobe radius to orbital separation, using Eggleton (1983) More...
 
real(double) function p2rl (m1, m2, p)
 Convert orbital period to Roche-lobe radius, all in cgs units. More...
 
real(double) function rl2p (m1, m2, rl1)
 Convert Roche-lobe radius to orbital period, all in cgs units. More...
 
subroutine quit_program (message)
 Print an exit message and stop the program. More...
 
subroutine bin_data_1d (n, x, norm, nbin, xmin1, xmax1, xbin, ybin)
 Bin data in one dimension, by counting data points in each bin. More...
 
real(double) function time_stamp (os)
 Get time stamp in seconds since 1970-01-01 00:00:00 UTC. More...
 
subroutine set_pgps_title (PSfile, PStitle)
 Set the title in a Postscript file generated by PGPlot. More...
 
subroutine evtools_settings ()
 Read/create evTools settings file ~/.evTools. More...
 
subroutine pgxy2szrat_bitmap (x, y, size, ratio)
 Convert PGPlot x,y dimensions to paper size and ratio for bitmap. More...
 
subroutine pgszrat2xy_bitmap (size, ratio, x, y)
 Convert PGPlot x,y dimensions to paper size and ratio for bitmap. More...
 
subroutine pgxy2szrat_screen (horiz, vert, dpi, size, ratio)
 Convert x,y screen dimensions to PGPlot paper size and ratio for a screen. More...
 
subroutine pgszrat2xy_screen (size, ratio, dpi, horiz, vert)
 Convert PGPlot paper size and ratio to screen dimensions. More...
 

Detailed Description

Shared modules, functions and subroutines for the evTools package.

For general functions and routines that need PGPlot, see plotfunctions.f90

Function/Subroutine Documentation

real(double) function a2j ( real(double), intent(in)  m1,
real(double), intent(in)  m2,
real(double), intent(in)  a 
)

Convert orbital separation to orbital angular momentum.

Parameters
m1Mass 1 (Mo)
m2Mass 2 (Mo)
aOrbital separation (Ro)
Return values
a2jOrbital angular momentum (cgs)

Referenced by read_bse().

subroutine a2p ( real(double), intent(in)  mtot,
real(double), intent(in)  a,
real(double), intent(out)  p 
)

Convert orbital separation to orbital period, in cgs units.

Parameters
mtotTotal mass of the binary (g)
aBinary orbital separation (cm)
Return values
pBinary period (s)

Referenced by compute_mdl_variables(), j2p(), read_bse(), and rl2p().

real(double) function a2rl ( real(double), intent(in)  m1,
real(double), intent(in)  m2,
real(double), intent(in)  a 
)

Compute Roche-lobe radius, using Eggleton (1983)

Parameters
m1Mass 1 (arbitrary unit)
m2Mass 2 (same unit as m1)
aOrbital separation (arbitrary unit)
Return values
a2rlRoche-lobe radius of star 1 (same unit as a)

Referenced by p2rl().

subroutine bin_data_1d ( integer, intent(in)  n,
real, dimension(n), intent(in)  x,
integer, intent(in)  norm,
integer, intent(in)  nbin,
real, intent(inout)  xmin1,
real, intent(inout)  xmax1,
real, dimension(nbin+1), intent(out)  xbin,
real, dimension(nbin+1), intent(out)  ybin 
)

Bin data in one dimension, by counting data points in each bin.

Parameters
nSize of data array
xInput data array
normNormalise (1) or not (0)
nbinNumber of bins
xmin1Minimum x value (left side of first bin (I/O: set xmin=xmax to auto-determine)
xmax1Maximum x value (right side of last bin (I/O: set xmin=xmax to auto-determine)
Return values
xbinBinned data. The x values are the left side of the bin!
ybinBinned data.
subroutine evtools_settings ( )

Read/create evTools settings file ~/.evTools.

References pgxy2szrat_screen().

Referenced by plotmdl(), plotmdln(), plotmod(), and plotplt().

integer function find_index ( real(double), intent(in)  v,
real(double), dimension(narr), intent(in)  arr,
integer, intent(in)  narr 
)

Finds index of value v in monotonously increasing or decreasing array arr of length narr.

Parameters
vValue to match to arr (double)
arrArray to match v to (double)
narrSize of arr (integer)
Return values
find_indexIndex for value v in array arr (integer)

Referenced by lt2ubv().

character function, dimension(99) findfile ( character, dimension(*), intent(in)  match)

Find a file that matches match in the current directory.

Parameters
matchMatch string
Return values
findfileFile name (if found)

References system().

Referenced by listmdl(), listmod(), listplt(), plotmdl(), plotmdln(), and plotmod().

subroutine findfiles ( character, dimension(*), intent(in)  match,
integer, intent(in)  nff,
integer, intent(in)  all,
character, dimension(99), intent(out)  fnames,
integer, intent(out)  nf 
)

Find files that match match in the current directory.

Parameters
matchSearch string to match
nffMaximum number of files to return
all0-select manually from list, 1-always return all files in list
Return values
fnamesArray that contains the files found; make sure it has the same length as the array in the calling programme
nfThe actual number of files returned in fnames ( = min(number found, nff))

References system().

Referenced by plotplt(), plt2ce(), plt2dat(), plt2obs(), and selplt().

integer function getos ( )

Determine the operating system type: 1-Linux, 2-MacOSX.

References system().

real(double) function j2a ( real(double), intent(in)  m1,
real(double), intent(in)  m2,
real(double), intent(in)  j 
)

Convert orbital angular momentum to orbital separation.

Parameters
m1Mass 1 (Mo)
m2Mass 2 (Mo)
jOrbital angular momentum (cgs)
Return values
j2aOrbital separation (Ro)
real(double) function j2p ( real(double), intent(in)  m1,
real(double), intent(in)  m2,
real(double), intent(in)  j 
)

Convert orbital angular momentum to orbital period, all in cgs units.

Parameters
m1Mass 1 (g)
m2Mass 2 (g)
jOrbital angular momentum (cgs)
Return values
j2pOrbital period (s)

References a2p().

subroutine locate ( real(double), dimension(narr), intent(in)  arr,
integer, intent(in)  narr,
real(double), intent(in)  v,
integer, intent(out)  i 
)

Locate the index of array arr such that v lies between arr(i) and arr(i+1)

Parameters
arrmonotonic array (double)
narrlength of arr (integer)
vvalue to look for (double)
Return values
ireturned index, such that v is between arr(i) and arr(i+1). If i=0 or narr, v is out of range

Referenced by locater(), and plotplt().

subroutine locater ( real, dimension(narr), intent(in)  rarr,
integer, intent(in)  narr,
real, intent(in)  rv,
integer, intent(out)  i 
)

Single-precision wrapper for of locate()

Parameters
rarrmonotonic array
narrlength of rarr
rvvalue to look for
Return values
ireturned index, such that v is between arr(i) and arr(i+1). If i=0 or narr, v is out of range

References locate().

subroutine lt2ubv ( real(double), intent(in)  logl,
real(double), intent(in)  logt,
real(double), intent(in)  mass,
real(double), intent(in)  logz,
real(double), intent(out)  mbol,
real(double), intent(out)  bolc,
real(double), intent(out)  mv,
real(double), intent(out)  uminb,
real(double), intent(out)  bminv,
real(double), intent(out)  vminr,
real(double), intent(out)  rmini 
)

Computes values of Mv, U-B, B-V and V-I for a star with given log L, log T, mass and log(Z/0.02)

Parameters
logl10-log of the stellar luminosity/Lo
logt10-log of the effective temperature/K
massstellar mass (Mo)
logz10-log of Z/0.02
Return values
mbolBolometric magnitude
bolcBolometric correction
mvVisual absolute magnitude
uminbColour U-B
bminvColour B-V
vminrColour V-I
rminiColour R-I
See Also
http://vizier.cfa.harvard.edu/viz-bin/ftp-index?/ftp/cats/J/MNRAS/298/525/evgrid

Needs one of:

  • UBVRI.Kur: table of synthetic BC and UBVRI colours, from Kurucz model atmospheres (1992, IAU Symp 149, p.225)
  • UBVRI.LBC: empirically corrected version of the above, from Lejeune, Cuisinier & Buser (1997, A&AS 125, 229)

References find_index().

Referenced by changepltvars(), findplt(), listplt(), and plt2obs().

subroutine num_sp_type_2_lt ( real(double), intent(in)  sptyp,
real(double), intent(in)  lumcl,
real(double), intent(out)  lum,
real(double), intent(out)  teff 
)

Convert spectral type and luminosity class to L, Teff using De Jager & Nieuwenhuijzen 1987.

Parameters
sptypSpectral type (0.0-8.5 for O0-M10)
lumclLumonosity class (0.0-5.0 for Ia+-V)
Return values
lumLuminosity (Lo)
teffEffective temperature (K)
See Also
1987A&A...177..217D
subroutine p2a ( real(double), intent(in)  mtot,
real(double), intent(in)  p,
real(double), intent(out)  a 
)

Convert orbital period to orbital separation, in cgs units.

Parameters
mtotTotal mass of the binary (g)
pBinary period (s)
Return values
aBinary orbital separation (cm)

Referenced by changepltvars(), p2j(), and p2rl().

real(double) function p2j ( real(double), intent(in)  m1,
real(double), intent(in)  m2,
real(double), intent(in)  p 
)

Convert orbital period to orbital angular momentum, all in cgs units.

Parameters
m1Mass 1 (g)
m2Mass 2 (g)
pOrbital period (s)
Return values
p2jOrbital angular momentum (cgs)

References p2a().

real(double) function p2rl ( real(double), intent(in)  m1,
real(double), intent(in)  m2,
real(double), intent(in)  p 
)

Convert orbital period to Roche-lobe radius, all in cgs units.

Parameters
m1Mass 1 (g)
m2Mass 2 (g)
pOrbital period (s)
Return values
p2rlRoche-lobe radius of star 1 (cm)

References a2rl(), and p2a().

subroutine pgszrat2xy_bitmap ( real, intent(in)  size,
real, intent(in)  ratio,
integer, intent(out)  x,
integer, intent(out)  y 
)

Convert PGPlot x,y dimensions to paper size and ratio for bitmap.

Parameters
sizePGPlot plot size
ratioPGPlot plot ratio
Return values
xHorizontal plot size in pixels
yVertical plot size in pixels
subroutine pgszrat2xy_screen ( real, intent(in)  size,
real, intent(in)  ratio,
integer, intent(in)  dpi,
integer, intent(out)  horiz,
integer, intent(out)  vert 
)

Convert PGPlot paper size and ratio to screen dimensions.

Parameters
sizePGPlot screen size
ratioPGPlot screen ratio
dpiScreen resolution in dots per inch
Return values
horizHorizontal screen size (pixels)
vertVertical screen size (pixels)
subroutine pgxy2szrat_bitmap ( integer, intent(in)  x,
integer, intent(in)  y,
real, intent(out)  size,
real, intent(out)  ratio 
)

Convert PGPlot x,y dimensions to paper size and ratio for bitmap.

Parameters
xHorizontal plot size in pixels
yVertical plot size in pixels
Return values
sizePGPlot plot size
ratioPGPlot plot ratio
subroutine pgxy2szrat_screen ( integer, intent(in)  horiz,
integer, intent(in)  vert,
integer, intent(in)  dpi,
real, intent(out)  size,
real, intent(out)  ratio 
)

Convert x,y screen dimensions to PGPlot paper size and ratio for a screen.

Parameters
horizHorizontal screen size (pixels)
vertVertical screen size (pixels)
dpiScreen resolution in dots per inch
Return values
sizePGPlot screen size
ratioPGPlot screen ratio

Referenced by evtools_settings().

subroutine quit_program ( character, dimension(*), intent(in)  message)

Print an exit message and stop the program.

Parameters
messageExit message

Referenced by copy_mod(), listmdl(), read_bse(), and read_plt().

real(double) function rl2a ( real(double), intent(in)  m1,
real(double), intent(in)  m2,
real(double), intent(in)  rl1 
)

Convert Roche-lobe radius to orbital separation, using Eggleton (1983)

Parameters
m1Mass 1 (arbitrary unit)
m2Mass 2 (same unit as m1)
rl1Roche-lobe radius of star 1 (arbitrary unit)
Return values
rl2aOrbital separation (same unit as rl1)

Referenced by compute_mdl_variables(), and rl2p().

real(double) function rl2p ( real(double), intent(in)  m1,
real(double), intent(in)  m2,
real(double), intent(in)  rl1 
)

Convert Roche-lobe radius to orbital period, all in cgs units.

Parameters
m1Mass 1 (g)
m2Mass 2 (g)
rl1Roche-lobe radius of star 1 (cm)
Return values
rl2pOrbital period (s)

References a2p(), and rl2a().

subroutine rswap ( real, intent(inout)  x,
real, intent(inout)  y 
)

Swap two real numbers.

Parameters
xReal number 1
yReal number 2
subroutine set_pgps_title ( character, dimension(*), intent(in)  PSfile,
character, dimension(*), intent(in)  PStitle 
)

Set the title in a Postscript file generated by PGPlot.

Parameters
PSfileName of the PS file
PStitleTitle for the PS file

References system().

Referenced by plotplt().

subroutine setconstants ( )

Define the 'constants' in the evTools package.

Referenced by dat2plt(), findplt(), listmdl(), listmod(), listplt(), plotmdl(), plotmdln(), plotmod(), plotplt(), plt2dat(), plt2obs(), and selplt().

real(double) function time_stamp ( integer, intent(in)  os)

Get time stamp in seconds since 1970-01-01 00:00:00 UTC.

Parameters
osOperating system: 1-Linux, 2-BSD/MacOS

References system().