Code Monkey home page Code Monkey logo

jkeger / seagen Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 146 KB

Stretched Equal Area (SEA) Generator - Make spherically symmetric arrangements of particles with accurate particle densities, e.g. for SPH initial conditions that precisely match an arbitrary density profile (Kegerreis et al. 2019, MNRAS 487:4, https://doi.org/10.1093/mnras/stz1606). See also https://github.com/srbonilla/WoMa for making the initial profiles, placing particles with SEAGen, and modifications for spinning planets!

License: Other

Python 100.00%
particles arrangement density sph sphere shell python

seagen's Introduction

SEAGen

A python implementation of the stretched equal area (SEA) algorithm for generating spherically symmetric arrangements of particles with accurate particle densities, e.g. for SPH initial conditions that precisely match an arbitrary density profile, as presented in Kegerreis et al. (2019), MNRAS 487:4, 5029-5040, https://doi.org/10.1093/mnras/stz1606.

See also https://github.com/srbonilla/WoMa for making input planetary profiles, placing particles with SEAGen, and modifications for spinning bodies.

Jacob Kegerreis (2020) [email protected]
Josh Borrow

Visit https://github.com/jkeger/seagen to download the code including examples and for support.

This program has been tested for a wide range of cases but not exhaustively. If you find any bugs, potential improvements, or features worth adding, then please let us know!

Contents

  • seagen.py The main program classes and functions.
  • examples.py Examples to demonstrate how to use the SEAGen module.
  • setup.py, setup.cfg, __init__.py, MANIFEST.in Python package files.
  • LICENSE.txt GNU general public license v3+.

Basic Usage

  • See the doc strings in seagen.py for all the details.
  • Create a single shell of particles and print their positions:
    import seagen
    N = 100
    r = 1
    
    particles = seagen.GenShell(N, r)
    
    print(particles.x, particles.y, particles.z)
  • Create a full sphere of particles on a simple density profile and print their positions and masses:
    import seagen
    import numpy as np
    N = 100000
    radii = np.arange(0.01, 10, 0.01)
    densities = np.ones(len(radii))     # e.g. constant density
    
    particles = seagen.GenSphere(N, radii, densities)
    
    print(particles.x, particles.y, particles.z, particles.m)
  • See examples.py for other working examples, e.g. an arbitrary density profile with multiple layers and extra temperature information.

Installation

  • PyPI: Automatically install the package with pip install seagen, see https://pypi.org/project/seagen/
  • Direct download: The single seagen.py file can be imported and used without any extra installation, so you can just download this repository and place the file in a local directory or wherever your python will look for modules.

Requirements

  • Python 3 (tested with 3.6.0).

Notation etc.

  • Formatted with black.
  • Arrays are explicitly labelled with a prefix A1_, or An_ for an n-dimensional array.
  • Particle is abbreviated to picle.

seagen's People

Contributors

jborrow avatar jkeger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.