rochePlot
Modules | Functions/Subroutines | Variables
rochePlot.f90 File Reference

Schematically plot the evolution of a binary star. More...

Modules

module  input_data
 Contains data from the input file and derived data.
 
module  plot_settings
 Contains plot settings.
 
module  roche_data
 Contains Roche-lobe data.
 

Functions/Subroutines

program rocheplot
 Plots Roche lobes for given binaries. More...
 
subroutine find_example_input_file (inputfile)
 If no input file is specified, try to find the example input file called rochePlot.dat. More...
 
subroutine read_input_file (inputfile)
 Read the lines of the input file containting evolutionary states and compute positions of the Roche lobes. More...
 
subroutine initialise_plot ()
 Initialise plot output; open output file, set page, create a white background, print plot title and column headers. More...
 
subroutine pgwhitebg ()
 Create a white background when plotting to screen; swap black (ci=0) and white (ci=1) More...
 
subroutine plot_disc (xL1, xc, yc, radin, radout)
 Draws an accretion disc centered on xc,yc between radin and radout. More...
 
subroutine plot_binary (itel)
 Plot each binary; Roche lobes, stars and labels. More...
 
real function xmap (il, nl, l1, lim, lr)
 Map the x-array to plot a right-hand Roche lobe. More...
 
real function rtsafe (funcd, x1, x2, xacc)
 Find the root of a function bracketed by x1,x2 using a combination of a Newton-Raphson and bisection methods. More...
 
subroutine rlimit (x, f, df)
 Calculates outer limit of Roche lobe. More...
 
subroutine rline (y, f, df)
 Calculates value of y^2 for given x^2 value. More...
 
subroutine plot_scale_bar ()
 Plot scale bar. More...
 
subroutine plot_rotation_axis ()
 Plot axis of rotation for the binaries. More...
 

Variables

integer, parameter input_data::npl =100
 
integer, parameter input_data::ng =10
 
integer input_data::klabel
 
integer input_data::ktel
 
integer input_data::blen
 
integer input_data::iscr
 
real input_data::csep
 
real, dimension(ng) input_data::rm1
 
real, dimension(ng) input_data::rm2
 
real, dimension(ng) input_data::pb
 
real, dimension(ng) input_data::rad1
 
real, dimension(ng) input_data::rad2
 
real, dimension(ng) input_data::age_mc
 
real, dimension(ng) input_data::rsep
 
real, dimension(ng) input_data::rlag
 
real, dimension(ng) input_data::rlef
 
real, dimension(ng) input_data::rrig
 
real, dimension(ng) input_data::hei
 
real, dimension(5) input_data::xtl
 
real input_data::xt
 
real input_data::yt
 
logical, dimension(ng) input_data::ce
 
character, dimension(50) input_data::txt
 
character, dimension(50) input_data::label
 
character, dimension(50) input_data::text
 
character, dimension(50) input_data::title
 
integer plot_settings::lw
 
real, dimension(npl) plot_settings::xpl
 
real, dimension(npl) plot_settings::ypl
 
real, dimension(npl) plot_settings::ypl2
 
real plot_settings::xleft
 
real plot_settings::xrigh
 
real plot_settings::ymargin
 
real plot_settings::ysize
 
real plot_settings::xlen
 
real plot_settings::yshift
 
character, dimension(50) plot_settings::outputfile
 
logical plot_settings::use_colour
 
real roche_data::q
 
real roche_data::q11
 
real roche_data::const1
 
real roche_data::const2
 
real, dimension(ng) roche_data::cediff
 
real roche_data::xsq
 
real roche_data::onexsq
 

Detailed Description

Schematically plot the evolution of a binary star.

Function/Subroutine Documentation

program rocheplot ( )

Plots Roche lobes for given binaries.

For each graph, read m1, m2, a, r1, r2:

  • m1, m2 = masses of left and right star, respectively
  • a = distance between stars (in solar radii)
  • r1, r2 = radii of left and right stars in solar radii
  • if (r1,r2) > 1.e5 the Roche lobe is filled
  • if both stars fill their Roche lobes, a common envelope is assumed
  • if (r1,r2) < 0. a circle with radius (r1,r2) + disc is drawn

The plot is scaled automatically:

  • first all required parameters are read
  • then lobe sizes and positions are estimated
  • finally, the individual graphs are made
Todo:
  • move BW/colour selection to input file

References input_data::csep, find_example_input_file(), initialise_plot(), input_data::ktel, input_data::label, plot_settings::outputfile, plot_binary(), plot_rotation_axis(), plot_scale_bar(), read_input_file(), input_data::text, plot_settings::use_colour, input_data::xt, and input_data::yt.

Here is the call graph for this function:

subroutine find_example_input_file ( character, dimension(*), intent(out)  inputfile)

If no input file is specified, try to find the example input file called rochePlot.dat.

Return values
inputfileName of the input file

Referenced by rocheplot().

Here is the caller graph for this function:

subroutine read_input_file ( character, dimension(*), intent(in)  inputfile)

Read the lines of the input file containting evolutionary states and compute positions of the Roche lobes.

Parameters
inputfileName of the input file
Todo:
  • use dynamic arrays for more freedom in the number of binaries drawn (ng)

References input_data::age_mc, input_data::blen, input_data::ce, roche_data::cediff, roche_data::const1, input_data::csep, input_data::hei, input_data::iscr, input_data::klabel, input_data::ktel, input_data::label, input_data::ng, input_data::pb, roche_data::q, roche_data::q11, input_data::rad1, input_data::rad2, input_data::rlag, input_data::rlef, rlimit(), input_data::rm1, input_data::rm2, input_data::rrig, input_data::rsep, input_data::text, input_data::title, input_data::txt, plot_settings::xleft, plot_settings::xrigh, input_data::xt, input_data::xtl, plot_settings::ymargin, plot_settings::ysize, and input_data::yt.

Referenced by rocheplot().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine initialise_plot ( )

Initialise plot output; open output file, set page, create a white background, print plot title and column headers.

References input_data::iscr, input_data::klabel, input_data::label, plot_settings::lw, plot_settings::outputfile, pgwhitebg(), input_data::title, plot_settings::use_colour, plot_settings::xleft, plot_settings::xrigh, input_data::xtl, plot_settings::ymargin, and plot_settings::ysize.

Referenced by rocheplot().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine pgwhitebg ( )

Create a white background when plotting to screen; swap black (ci=0) and white (ci=1)

Referenced by initialise_plot().

Here is the caller graph for this function:

subroutine plot_disc ( real, intent(in)  xL1,
real, intent(in)  xc,
real, intent(in)  yc,
real, intent(in)  radin,
real, intent(in)  radout 
)

Draws an accretion disc centered on xc,yc between radin and radout.

Parameters
xL1Horizontal position of L1 point
xcHorizontal position of centre of disc
ycVertical position of centre of disc
radinInner radius of the disc
radoutOuter radius of the disc

Referenced by plot_binary().

Here is the caller graph for this function:

subroutine plot_binary ( integer, intent(in)  itel)
real function xmap ( integer, intent(in)  il,
integer, intent(in)  nl,
real, intent(in)  l1,
real, intent(in)  lim,
integer, intent(in)  lr 
)

Map the x-array to plot a right-hand Roche lobe.

Parameters
ilCurrent point number in array (1-nl)
nlTotal number of points in array
l1L1 position
limExtreme extent of Roche lobe (farthest from L1)
lrLeft (1) or right (2) Roche lobe
Return values
xmapMapped position of il-th x value
real function rtsafe (   funcd,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(in)  xacc 
)

Find the root of a function bracketed by x1,x2 using a combination of a Newton-Raphson and bisection methods.

Parameters
funcdUser-provided function
x1Lower limit for solution
x2Upper limit for solution
xaccDesired accuracy for solution
See also
Numerical recipes, par.9.4 (p.258 / 359)
subroutine rlimit ( real, intent(in)  x,
real, intent(out)  f,
real, intent(out)  df 
)

Calculates outer limit of Roche lobe.

Parameters
xPosition along binary axis
fRoche potential
dfFirst derivative of f w.r.t. x

References roche_data::const1, roche_data::q, and roche_data::q11.

Referenced by read_input_file().

Here is the caller graph for this function:

subroutine rline ( real, intent(in)  y,
real, intent(out)  f,
real, intent(out)  df 
)

Calculates value of y^2 for given x^2 value.

Parameters
yPosition along binary axis
fPosition of Roche surface
dfFirst derivative of f w.r.t. x

References roche_data::const2, roche_data::onexsq, roche_data::q, and roche_data::xsq.

Referenced by plot_binary().

Here is the caller graph for this function:

subroutine plot_scale_bar ( )

Plot scale bar.

References input_data::blen, input_data::hei, input_data::ktel, plot_settings::ymargin, and plot_settings::yshift.

Referenced by rocheplot().

Here is the caller graph for this function:

subroutine plot_rotation_axis ( )

Plot axis of rotation for the binaries.

References plot_settings::ymargin, and plot_settings::yshift.

Referenced by rocheplot().

Here is the caller graph for this function: