Skip to content
Snippets Groups Projects
Commit 3a5a6876 authored by Josh Borrow's avatar Josh Borrow
Browse files

Removed legacy sphinx modules

Removed some tags that were causing compilation issues

Moved old RTD around.

Added rtd-specific gitignore

Added 'new' RTD system

Added tempaltes of how to add new items to the documentation

Added HydroSchemes information

Added information from the onboarding guide into the online documentation, as well as adding the makefile

Add Equation of State documentation

Added the onboarding guide stuff

Added initial conditions section

Add eos documentation

Removed git marks

added minor change to the particle type table to make it fully consistent with SWIFT

Implemented Matthieu's changes

Updated information about minimalsph

removed statement about balsara switch

Add Cooling doc

Add cooling and update structure

Minor tidy up

Renamed section
parent 1d2a43c0
No related branches found
No related tags found
1 merge request!554Documentation update
.. Hydrodynamics Schemes
Josh Borrow 4th April 2018
.. _hydro:
Hydrodynamics Schemes
=====================
This section of the documentation includes information on the hydrodynamics
schemes available in SWIFT, as well as how to implement your own.
.. toctree::
:maxdepth: 2
:caption: Contents:
traditional_sph
minimal_sph
hopkins_sph
gizmo
adding_your_own
.. Minimal SPH
Josh Borrow 4th April 2018
Minimal (Density-Energy) SPH
============================
.. toctree::
:maxdepth: 2
:hidden:
:caption: Contents:
This scheme is a textbook implementation of Density-Energy SPH, and can be used
as a pedagogical example. It also implements a Monaghan AV scheme, like the
GADGET-2 scheme. It uses very similar equations, but differs in implementation
details.
.. Traditional SPH (GADGET-2)
Josh Borrow 4th April 2018
Traditional (Density-Entropy) SPH
=================================
.. toctree::
:maxdepth: 2
:hidden:
:caption: Contents:
Traditional, GADGET-2-like, Density-Entropy SPH is available in SWIFT with
a Monaghan artificial viscosity scheme and Balsara switch.
To use this hydro scheme, you need no extra configuration options -- it is the
default!
.. Initial Conditions
Josh Borrow, 5th April 2018
Initial Conditions
==================
To run anything more than examples from our suite, you will need to be able to
produce your own initial conditions for SWIFT. We use the same initial conditions
as the popular GADGET-2 code, which uses the HDF5 file format.
As the original documentation for the GADGET-2 initial conditions format is
quite sparse, we lay out here all of the necessary components. If you are generating
your initial conditions from python, we recommend you use the h5py package. We
provide a writing wrapper for this for our initial conditions in
``examples/KeplerianRing/write_gadget.py``.
You can find out more about the HDF5 format on their webpages, here:
https://support.hdfgroup.org/HDF5/doc/H5.intro.html
Structure of the File
---------------------
There are several groups that contain 'auxilliary' information, such as ``Header``.
Particle data is placed in groups that signify particle type.
+---------------------+------------------------+
| Group Name | Physical Particle Type |
+=====================+========================+
| ``PartType0`` | Gas |
+---------------------+------------------------+
| ``PartType1`` | Dark Matter |
+---------------------+------------------------+
| ``PartType2`` | Ignored |
+---------------------+------------------------+
| ``PartType3`` | Ignored |
+---------------------+------------------------+
| ``PartType4`` | Stars |
+---------------------+------------------------+
| ``PartType5`` | Black Holes |
+---------------------+------------------------+
Currently, not all of these particle types are included in SWIFT. Note that the
only particles that have hydrodynamical forces calculated between them are those
in ``PartType0``.
Necessary Components
--------------------
There are several necessary components (in particular header information) in a
SWIFT initial conditions file. Again, we recommend that you use the ``write_gadget``
script.
Header
~~~~~~
In ``Header``, the following attributes are required:
+ ``BoxSize``, a floating point number or N-dimensional (usually 3) array
that describes the size of the box.
+ ``Flag_Entropy_ICs``, a historical value that tells the code if you have
included entropy or internal energy values in your intial conditions files.
Acceptable values are 0 or 1.
+ ``NumPart_Total``, a length 6 array of integers that tells the code how many
particles are of each type are in the initial conditions file.
+ ``NumPart_Total_HighWord``, a historical length-6 array that tells the code
the number of high word particles in the initial conditions there are. If
you are unsure, just set this to ``[0, 0, 0, 0, 0, 0]``. This does have to be
present, but unlike GADGET-2, this can be a set of 0s unless you have more than
2^31 particles.
+ ``NumFilesPerSnapshot``, again a historical integer value that tells the code
how many files there are per snapshot. You will probably want to set this to 1
and simply have a single HDF5 file for your initial conditions; SWIFT can
leverage parallel-HDF5 to read from this single file in parallel.
+ ``NumPart_ThisFile``, a length 6 array of integers describing the number of
particles in this file. If you have followed the above advice, this will be
exactly the same as the ``NumPart_Total`` array.
You may want to include the following for backwards-compatibility with many
GADGET-2 based analysis programs:
+ ``MassTable``, an array of length 6 which gives the masses of each particle
type. SWIFT ignores this and uses the individual particle masses, but some
programs will crash if it is not included.
+ ``Time``, the internal code time of the start (set this to 0).
RuntimePars
~~~~~~~~~~~
In ``RuntimePars``, the following attributes are required:
+ ``PeriodicBoundaryConditionsOn``, a flag to tell the code whether or not you
have periodic boundaries switched on. Again, this is historical; it should be
set to 1 (default) if you have the code running in periodic mode, or 0 otherwise.
Units
~~~~~
In ``Units``, you will need to specify what units your initial conditions are
in. If these are not present, the code assumes that you are using the same
units for your initial conditions as are in your parameterfile, but it is best
to include them to be on the safe side. You will need:
+ ``Unit current in cgs (U_I)``
+ ``Unit length in cgs (U_L)``
+ ``Unit mass in cgs (U_M)``
+ ``Unit temperature in cgs (U_T)``
+ ``Unit time in cgs (U_t)``
These are all floating point numbers.
Particle Data
~~~~~~~~~~~~~
Now for the interesting part! You can include particle data groups for each
individual particle type (e.g. ``PartType0``) that have the following _datasets_:
+ ``Coordinates``, an array of shape (N, 3) where N is the number of particles
of that type, that are the cartesian co-ordinates of the particles. Co-ordinates
must be positive, but will be wrapped on reading to be within the periodic box.
+ ``Velocities``, an array of shape (N, 3) that is the cartesian velocities
of the particles.
+ ``ParticleIDs``, an array of length N that are unique identifying numbers for
each particle. Note that these have to be unique to a particle, and cannot be
the same even between particle types. Please ensure that your IDs are positive
integer numbers.
+ ``Masses``, an array of length N that gives the masses of the particles.
For ``PartType0`` (i.e. particles that interact through hydrodynamics), you will
need the following auxilliary items:
+ ``InternalEnergy``, an array of length N that gives the internal energies of
the particles. For PressureEntropy, you can specify ``Entropy`` instead.
+ ``SmoothingLength``, the smoothing lenghts of the particles. These will be
tidied up a bit, but it is best if you provide accurate numbers.
Summary
~~~~~~~
You should have an HDF5 file with the following structure:
.. code-block:: bash
Header/
BoxSize=[x, y, z]
Flag_Entropy_ICs=1
NumPart_Total=[0, 1, 2, 3, 4, 5]
NumPart_Total_HighWord=[0, 0, 0, 0, 0, 0]
NumFilesPerSnapshot=1
NumPart_ThisFile=[0, 1, 2, 3, 4, 5]
RuntimePars/
PeriodicBoundariesOn=1
Units/
Unit current in cgs (U_I)=1.0
Unit length in cgs (U_L)=1.0
Unit mass in cgs (U_M)=1.0
Unit temperature in cgs (U_T)=1.0
Unit time in cgs (U_t)=1.0
PartType0/
Coordinates=[[x, y, z]]
Velocities=[[vx, vy, vz]]
ParticleIDs=[...]
Masses=[...]
InternalEnergy=[...]
SmoothingLength=[...]
PartType1/
Coordinates=[[x, y, z]]
Velocities=[[vx, vy, vz]]
ParticleIDs=[...]
Masses=[...]
.. Equation of State
Loic Hausammann, 7th April 2018
.. _new_option:
General information for adding new schemes
==========================================
The following steps are required for any new options (such as new
:ref:`hydro`, :ref:`chemistry`, :ref:`cooling`,
:ref:`equation_of_state`, :ref:`stars` or :ref:`gravity`)
In order to add a new scheme, you will need to:
1. Create a new subdirectory inside the option directory (e.g.
``src/equation_of_state`` or ``src/hydro``) with an explicit name.
2. Create the required new files (depending on your option, you will need
different files). Copy the structure of the most simple option (e.g.
``src/hydro/Gadget2``, ``src/gravity/Default``, ``src/stars/Default``,
``src/cooling/none``, ``src/chemistry/none`` or
``src/equation_of_state/ideal_gas``)
3. Add the right includes in the option file (e.g. ``src/hydro.h``,
``src/gravity.h``, ``src/stars.h``, ``src/cooling.h``, ``src/chemistry.h``
or ``src/equation_of_state.h``) and the corresponding io file if present.
4. Add the new option in ``configure.ac``. This file generates the
``configure`` script and you just need to add a new option under the right
``case``.
5. Add your files in ``src/Makefile.am``. In order to generate the Makefiles
during the configuration step, a list of files is required. In
``nobase_noinst_HEADERS``, add your new header files.
6. Update the documentation. Add your equations/documentation to ``doc/RTD``.
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'SWIFT: SPH WIth Fine-grained inter-dependent Tasking'
copyright = '2018, SWIFT Collaboration'
author = 'SWIFT Team'
# The short X.Y version
version = '0.7'
# The full version, including alpha/beta/rc tags
release = '0.7.0'
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.todo',
'sphinx.ext.mathjax',
'sphinx.ext.githubpages',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['.templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['.static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'SWIFTSPHWIthFine-grainedinter-dependentTaskingdoc'
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'SWIFTSPHWIthFine-grainedinter-dependentTasking.tex', 'SWIFT: SPH WIth Fine-grained inter-dependent Tasking Documentation',
'Josh Borrow', 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'swiftsphwithfine-grainedinter-dependenttasking', 'SWIFT: SPH WIth Fine-grained inter-dependent Tasking Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'SWIFTSPHWIthFine-grainedinter-dependentTasking', 'SWIFT: SPH WIth Fine-grained inter-dependent Tasking Documentation',
author, 'SWIFTSPHWIthFine-grainedinter-dependentTasking', 'One line description of project.',
'Miscellaneous'),
]
# -- Extension configuration -------------------------------------------------
# -- Options for todo extension ----------------------------------------------
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
.. Welcome!
sphinx-quickstart on Wed Apr 4 15:03:50 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to SWIFT: SPH WIth Fine-grained inter-dependent Tasking's documentation!
================================================================================
Want to get started using SWIFT? Check out the on-boarding guide available
here. SWIFT can be used as a drop-in replacement for Gadget-2 and initial
conditions in hdf5 format for Gadget can directly be read by SWIFT. The only
difference is the parameter file that will need to be adapted for SWIFT.
.. toctree::
:maxdepth: 2
GettingStarted/index
InitialConditions/index
HydroSchemes/index
Cooling/index
EquationOfState/index
NewOption/index
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment