Code Monkey home page Code Monkey logo

accretiondisc's Introduction

accretiondisc

A simple model of a thin alpha-accretion disc. We use Paczyńsky-Wiita (PW) potential:

iliustration

to arrive at and solve the viscous diffusion equation:

iliustration

assuming a stable thin accretion disc.

Accretion disc is fed by distributing packets of gas over annuli comprising the disc about some chosen radius.

iliustration

This is meant to iliustrate accretion of SPH particles onto an accretion disc sink particle used in hydrodynamical code Gadget-3.

Installation

Package is managed with Poetry:

poetry install

Poetry should manage dependencies automatically. If for whatever reason it does not a combination of:

  • numba
  • numpy
  • matplotlib is required to run the model and examples, although matplotlib is only used for plotting.

Usage

The main model dataclass and functions are in disc.py. Model makes use of code units and some constants found in units.py.

A quick example below:

import accretiondisc.disc as ad
import accretiondisc.units as unt

# accretion disc is initiated with 
# (default values in given example in code units)
disc = ad.Disc(
    bh_mass=0.8,  # SMBH mass
    n_rings=200,  # number of rings comprizing the disc
    mdot=0,  # SMBH accretion rate
    mesc=0,  # amount of matter that escaped the disc
    rin=1.147e-06,  # inner boundary, assumed ISCO
    rout=0.01,  # outer boundary
    ctime=0.01,  # courant factor
    disc_alpha = 0.1,  # accretion disc alpha (~0.1 is ok)
    h_r_init=0.002,  # height to radius ratio
    PW=True  # using Paczyńsky-Wiita potential
    )        # diffusion reduces to Kepler if False


# a simulation of steady accretion over a period 
# of time is performed with "do_the_evolution" function; 
# it returns disc object at the last step and some storage arrays
(disc,  # disc object 
 sigma_arr,  # surface density
 ring_luminosity_from_teff_arr,  # luminosity from Teff 
 ring_luminosity_from_mdot_arr,  # luminosity from mdot
 nu_arr,  # viscosity
 tau_arr,  # optical depth
 bh_mass_arr,  # SMBH mass
 mesc_arr,  # escaped mass
 mass_arr,  # mass of the disc (sigma * area)
 bh_mdot_arr,  # SMBH accretion rate
 temperature_effective_arr,  # effective temperature
 temperature_center_arr,  # central temperature
 current_time_arr  # time in code units
 ) = ad.do_the_evolution(
     disc,  # disc object 
     total_time=75,  # total time of simulation run
     fraction_of_time_feed=0.2,  # fraction of time that the disc is fed
     total_mass_to_feed=0.02,  # total mass fed to the disc
     dt=5e-3,  # "outer" timestep - intervals between 
             # disc feeding, diffusion step determination and data storage
     mass_portion=8e-8,  # size of mass portion (discrete SPH particle)
     hsml=0.01,  # smoothing lenght (minimum in an SPH simulation)
     r_circ=0.003  # mass insertion radius
     )

An example of a unit mass spreading by diffusion in a disc with constant viscosity is in examples/diffusion_example.py. Results should be compared to Fig. 5.1. (page 83) Accretion Power in Astrophysics or Fig. 1. from Accretion discs in astrophysics

An example of steadily accreting disc model is in examples/steady_accretion_example.py.

License

This repository uses the MIT license.

See the LICENSE file for license rights and limitations (MIT).

accretiondisc's People

Contributors

caradryan avatar dependabot[bot] avatar

Stargazers

Aman Kumar avatar  avatar  avatar

Watchers

Jonas Bialopetravičius avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.