diff --git a/doc/RTD/Makefile b/doc/RTD/Makefile index 22ff80ae32739df7d7ca97d8d2a6c6c8159b8248..3148a13d592b7aec337bd2db4e05b45c06713be0 100644 --- a/doc/RTD/Makefile +++ b/doc/RTD/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = SWIFTSPHWIthFine-grainedinter-dependentTasking +SPHINXPROJ = SWIFT-documentation SOURCEDIR = source BUILDDIR = build @@ -17,4 +17,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/RTD/README.md b/doc/RTD/README.md index 1d0582386390ab20d48f835805cdaa43e8da496e..1c2aff85989d50e4e6fc97b9faf887473a3d8a6b 100644 --- a/doc/RTD/README.md +++ b/doc/RTD/README.md @@ -11,4 +11,8 @@ package which is used as the theme. To build the documentation (from this directory), `make html` and the output files will be created in `build/html/`. +To build the latex manual (from this directory), `make latexpdf` and the output +files will be `build/latex/SWIFT-user-manual.pdf`. + + Please consider adding documentation when you add code! diff --git a/doc/RTD/source/GettingStarted/compiling_code.rst b/doc/RTD/source/GettingStarted/compiling_code.rst index e04d081c0bb635b3334c05b5438cbbfcd7f2bd7a..9e207faec21b2f1c4860efaa0a84fdf52ad3357c 100644 --- a/doc/RTD/source/GettingStarted/compiling_code.rst +++ b/doc/RTD/source/GettingStarted/compiling_code.rst @@ -21,7 +21,7 @@ We suggest: We have specific issues with the following compilers: -+ GCC 7.3.0 with the -mskylake-avx512 flag. ++ GCC 7.3.0 with the ``-mskylake-avx512`` flag. Dependencies ------------ @@ -34,7 +34,7 @@ HDF5 Version 1.8.x or higher is required. Input and output files are stored as HDF5 and are compatible with the existing GADGET-2 specification. Please consider using a build of parallel-HDF5, as SWIFT can leverage this when writing and -reading snapshots. We recommend using HDF5 > 1.10.x as this is `vastly superior` +reading snapshots. We recommend using HDF5 > 1.10.x as this is *vastly superior* in parallel. MPI @@ -63,10 +63,6 @@ ParMETIS or METIS ~~~~~~~~~~~~~~~~~ One is required for domain decomposition and load balancing. -libNUMA -~~~~~~~ -libNUMA is used to pin threads (but see INSTALL.swift). - GSL ~~~ The GSL is required for cosmological integration. @@ -75,7 +71,11 @@ The GSL is required for cosmological integration. Optional Dependencies --------------------- -There are also the following _optional_ dependencies. +There are also the following *optional* dependencies. + +libNUMA +~~~~~~~ +libNUMA is used to pin threads (but see INSTALL.swift). TCmalloc/Jemalloc ~~~~~~~~~~~~~~~~~ @@ -87,7 +87,8 @@ You can build documentation for SWIFT with DOXYGEN. Python ~~~~~~ -To run the examples, you will need python and some of the standard scientific libraries (numpy, matplotlib). Some examples use Python 2 scripts, but the more recent ones use Python 3 (this is specified in individual READMEs). +To run the examples, you will need python 3 and some of the standard scientific libraries (numpy, matplotlib). +Some examples make use of the `swiftsimio <https://swiftsimio.readthedocs.io/en/latest/>`_ library. GRACKLE ~~~~~~~ @@ -108,6 +109,7 @@ Initial Setup ------------- We use autotools for setup. To get a basic running version of the code use: + .. code-block:: bash ./autogen.sh @@ -129,7 +131,7 @@ MacOS, so it is best to leave it out. To configure: When using the clang compiler, the hand-written vectorized routines have to be disabled. This is done at configuration time by adding -the flag `--disable-hand-vec`. +the flag ``--disable-hand-vec``. Trouble Finding Libraries ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -141,7 +143,7 @@ HDF5 library, .. code-block:: bash - ./configure --with-hdf5=/path/to/h5cc + ./configure --with-hdf5=/path/to/hdf5_root More information about what needs to be provided to these flags is given in ``./configure --help``. diff --git a/doc/RTD/source/GettingStarted/configuration_options.rst b/doc/RTD/source/GettingStarted/configuration_options.rst index 7dca5cddb0012b9a2146640b9373cfbe81c8dbdd..d3416d1ff96c6022ae8c571a9adb37a05d1e9439 100644 --- a/doc/RTD/source/GettingStarted/configuration_options.rst +++ b/doc/RTD/source/GettingStarted/configuration_options.rst @@ -13,7 +13,7 @@ configuration flag. A description of the available options of the below flags can be found by using ``./configure --help``. -``--with-hydro=gadget2`` +``--with-hydro=sphenix`` ~~~~~~~~~~~~~~~~~~~~~~~~ There are several hydrodynamical schemes available in SWIFT. You can choose between them at compile-time with this option. diff --git a/doc/RTD/source/GettingStarted/running_example.rst b/doc/RTD/source/GettingStarted/running_example.rst index a5614fb2a2e2068a8188d82182042feb95251a73..b35725e60de16cb0e1b10fb4394898f67bef822d 100644 --- a/doc/RTD/source/GettingStarted/running_example.rst +++ b/doc/RTD/source/GettingStarted/running_example.rst @@ -1,26 +1,34 @@ .. Running an Example Josh Borrow, 5th April 2018 + Mladen Ivkovic, Jan 2023 Running an Example ================== -Now that you have built the code, you will want to run an example! To do that, -you need to follow the following instructions (requires ``python2`` or -``python3`` with the ``h5py`` and other standard scientific packages, as well -as ``wget`` for grabbing the glass). +Now that you have built the code, you will want to run an example! +Let's start with a hydrodynamics only example, the 3D Sod Shock. + + +Sod Shock +~~~~~~~~~ + +To run the Sod Shock example, you need to follow the following instructions +(requires ``python3`` with the ``h5py`` and other standard scientific packages, +as well as ``wget`` for grabbing the glass). + .. code-block:: bash cd examples/HydroTests/SodShock_3D ./getGlass.sh - python makeIC.py + python3 makeIC.py ../swift --hydro --threads=4 sodShock.yml - python plotSolution.py 1 + python3 plotSolution.py 1 This will run the 'SodShock' in 3D and produce a nice plot that shows you how the density has varied. Try running with GIZMO-MFV (this will take -_significantly_ longer than with SPH) to see the difference. For that, you +*significantly* longer than with SPH) to see the difference. For that, you will need to reconfigure with the following options: .. code-block:: bash @@ -29,9 +37,55 @@ will need to reconfigure with the following options: --with-hydro=gizmo-mfv \ --with-riemann-solver=hllc - To see the results that you should get, you should check out our developer wiki at https://gitlab.cosma.dur.ac.uk/swift/swiftsim/wikis/Sod_3D. If you don't get these results, please contact us on our GitHub page at https://github.com/SWIFTSIM/swiftsim/issues. + + + + +Small Cosmological Volume +~~~~~~~~~~~~~~~~~~~~~~~~~ + +As a second example, we run a small cosmolgical +volume containing dark matter only starting at redshift :math:`z = 50`. +Like for the Sod Shock example, it suffices to configure (``./configure``) and +compile (``make``) the code without any extra flags. + +After downloading the initial conditions, we run the code with cosmology and +self-gravity: + +.. code-block:: bash + + cd examples/SmallCosmoVolume/SmallCosmoVolume_DM + ./getIC.sh + ../../../swift --cosmology --self-gravity --threads=8 small_cosmo_volume_dm.yml + + +We can plot the solution with the included python script +as follows: + +.. code-block:: bash + + python3 plotProjection.py 31 + + +The ``plotProjection.py`` script requires the `swiftsimio <https://swiftsimio.readthedocs.io/en/latest/>`_ +library, which is a dedicated and maintained visualisation and analysis +library for SWIFT. + + +An additional example containing both baryonic and dark matter is +``examples/SmallCosmoVolume/SmallCosmoVolume_hydro``. To run with +hydrodynamics, the ``--hydro`` flag needs to be provided as well: + +.. code-block:: bash + + cd examples/SmallCosmoVolume/SmallCosmoVolume_hydro + ./getIC.sh + ../../../swift --cosmology --self-gravity --hydro --threads=8 small_cosmo_volume.yml + +The solution can again be plotted using the ``plotProjection.py`` script. + diff --git a/doc/RTD/source/GettingStarted/running_on_large_systems.rst b/doc/RTD/source/GettingStarted/running_on_large_systems.rst index 42beedf790dc3d87895cd9bd6db13f25942b0a16..799525824958bd8b2027a207770f323622353a2b 100644 --- a/doc/RTD/source/GettingStarted/running_on_large_systems.rst +++ b/doc/RTD/source/GettingStarted/running_on_large_systems.rst @@ -29,13 +29,14 @@ system (i.e. over MPI on several nodes). Here are some recommendations: + Ensure that you compile with ParMETIS or METIS. These are required if want to load balance between MPI ranks. -Your batch script should look something like the following (to run on 16 nodes -each with 2x16 core processors for a total of 512 cores): + +Your batch script should look something like the following (to run on 8 nodes each +with 2x18 core processors for a total of 288 cores): .. code-block:: bash - #SBATCH -N 16 # Number of nodes to run on - #SBATCH --tasks-per-node=2 # This system has 2 chips per node - - mpirun -np 32 swift_mpi --threads=16 --pin parameter.yml + #SBATCH -N 8 # Number of nodes to run on + #SBATCH --tasks-per-node=2 # This system has 2 chips per node + + mpirun -n 16 swift_mpi --threads=18 --pin parameter.yml diff --git a/doc/RTD/source/GettingStarted/special_modes.rst b/doc/RTD/source/GettingStarted/special_modes.rst index bf19bc7f679eed7d37cefb38ab8f05972ac68b30..724d0e9f01d811a350cbeb67c601430083e4313b 100644 --- a/doc/RTD/source/GettingStarted/special_modes.rst +++ b/doc/RTD/source/GettingStarted/special_modes.rst @@ -98,7 +98,7 @@ To run SWIFT in this mode, configure the code with computed for every :math:`N^{th}` particle based on their ID (i.e., to compute the exact forces for all particles set ``N=1``). -Two `.dat` files will be output during each timestep, one containing the forces +Two ``.dat`` files will be output during each timestep, one containing the forces (really it is the accelerations that are stored) as computed by ``_swift_``, and another containing the ``_exact_`` forces. The total force (``a_swift``), along with the contributed force from each component of the tree (P2P, M2P and M2L) diff --git a/doc/RTD/source/GettingStarted/what_about_mpi.rst b/doc/RTD/source/GettingStarted/what_about_mpi.rst index 98141049f3e36506d6033259e7f5bb9394daf997..531032780159a126ee883df25afc20a7f46517b2 100644 --- a/doc/RTD/source/GettingStarted/what_about_mpi.rst +++ b/doc/RTD/source/GettingStarted/what_about_mpi.rst @@ -7,6 +7,35 @@ What about MPI? Running SWIFT on more than one node After compilation, you will be left with two binaries. One is called ``swift``, and the other ``swift_mpi``. Current wisdom is to run ``swift`` if you are only using one node (i.e. without any interconnect), and one MPI rank per NUMA -region using ``swift_mpi`` for anything larger. You will need some GADGET-2 -HDF5 initial conditions to run SWIFT, as well as a compatible yaml -parameter file. +region using ``swift_mpi`` for anything larger. You will need some initial +conditions in the GADGET-2 HDF5 format (see :ref:`Initial Conditions <Initial_Conditions_label>`) +to run SWIFT, as well as a compatible :ref:`yaml parameter file <Parameter_File_label>`. + + + +SLURM Submission Script Example +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +Below is an example submission script for the SLURM +batch system. This runs SWIFT with thread pinning, SPH, +and self-gravity. + +.. code-block:: bash + + #SBATCH --partition=<queue> + #SBATCH --account-name=<groupName> + #SBATCH --job-name=<jobName> + #SBATCH --nodes=<nNodes> + #SBATCH --ntasks-per-node=<nMPIRank> + #SBATCH --cpus-per-task=<nThreadsPerMPIRank> + #SBATCH --output=outFile.out + #SBATCH --error=errFile.err + + ## expected runtime + #SBATCH --time-<hh>:<mm>:<ss> + + ./swift_mpi --pin --threads=<nThreadsPerMPIRank> \ + --hydro --self-gravity \ + parameter_file.yml + diff --git a/doc/RTD/source/InitialConditions/index.rst b/doc/RTD/source/InitialConditions/index.rst index 552a4a3e95809f1c453523e4aba43b063559c14b..e325d7b88662c5042cae22ed1709bf6e72dbe550 100644 --- a/doc/RTD/source/InitialConditions/index.rst +++ b/doc/RTD/source/InitialConditions/index.rst @@ -1,6 +1,8 @@ .. Initial Conditions Josh Borrow, 5th April 2018 +.. _Initial_Conditions_label: + Initial Conditions ================== diff --git a/doc/RTD/source/ParameterFiles/parameter_description.rst b/doc/RTD/source/ParameterFiles/parameter_description.rst index 2d8f95cb8f74b9e3b8cbcb55780701aac1639e66..ebfd3f3faab167006410ed2fe18ef43aa4f7f8c6 100644 --- a/doc/RTD/source/ParameterFiles/parameter_description.rst +++ b/doc/RTD/source/ParameterFiles/parameter_description.rst @@ -176,15 +176,15 @@ If unspecified these parameters default to the default The radiation density :math:`\Omega_r` can also be specified by setting an alternative optional parameter: -* The number of ultra-relativistic degrees of freedom :math:`N_\rm{ur}`: +* The number of ultra-relativistic degrees of freedom :math:`N_{\rm{ur}}`: ``N_ur``. The radiation density :math:`\Omega_r` is then automatically inferred from -:math:`N_\rm{ur}` and the present-day CMB temperature +:math:`N_{\rm{ur}}` and the present-day CMB temperature :math:`T_{\rm{CMB},0}=2.7255` Kelvin. This parametrization cannot be used together with :math:`\Omega_r`. If neither parameter is used, SWIFT -defaults to :math:`\Omega_r = 0`. Note that :math:`N_\rm{ur}` differs from -:math:`N_\rm{eff}`, the latter of which also includes massive neutrinos. +defaults to :math:`\Omega_r = 0`. Note that :math:`N_{\rm{ur}}` differs from +:math:`N_{\rm{eff}}`, the latter of which also includes massive neutrinos. Massive neutrinos can be included by specifying the optional parameters: @@ -196,7 +196,7 @@ Massive neutrinos can be included by specifying the optional parameters: When including massive neutrinos, only ``N_nu`` and ``M_nu_eV`` are necessary. By default, SWIFT will assume non-degenerate species and :math:`T_{\nu,0}=(4/11)^{1/3}T_{\rm{CMB},0}`. Neutrinos do not contribute to -:math:`\Omega_m = \Omega_\rm{cdm} + \Omega_b` in our conventions. +:math:`\Omega_m = \Omega_{\rm{cdm}} + \Omega_b` in our conventions. For a Planck+13 cosmological model (ignoring radiation density as is commonly done) and running from :math:`z=127` to :math:`z=0`, one would hence diff --git a/doc/RTD/source/RadiativeTransfer/RTTaskDependencies.webp b/doc/RTD/source/RadiativeTransfer/RTTaskDependencies.webp deleted file mode 100644 index b47231dcaf53bdbad0fe47b83a0f474e85dad396..0000000000000000000000000000000000000000 Binary files a/doc/RTD/source/RadiativeTransfer/RTTaskDependencies.webp and /dev/null differ diff --git a/doc/RTD/source/RadiativeTransfer/RT_notes_for_developers.rst b/doc/RTD/source/RadiativeTransfer/RT_notes_for_developers.rst index 286418d09d8976ba8900f312d0d4633114137a88..70a5a439ebe6ebad44c94b0904af9f5c4d5e321c 100644 --- a/doc/RTD/source/RadiativeTransfer/RT_notes_for_developers.rst +++ b/doc/RTD/source/RadiativeTransfer/RT_notes_for_developers.rst @@ -99,7 +99,7 @@ section <rt_subcycling_documentation>`. This was done with SWIFT v0.9.0. -.. figure:: RTTaskDependencies.webp +.. figure:: full_dependency_graph_RT.png :width: 400px :align: center :figclass: align-center diff --git a/doc/RTD/source/RadiativeTransfer/full_dependency_graph_RT.dot b/doc/RTD/source/RadiativeTransfer/full_dependency_graph_RT.dot new file mode 100644 index 0000000000000000000000000000000000000000..e2461ee9ec083226ac868412ee85d5d0be0930cd --- /dev/null +++ b/doc/RTD/source/RadiativeTransfer/full_dependency_graph_RT.dot @@ -0,0 +1,369 @@ +digraph task_dep { + # Header + label="Task dependencies for SWIFT v0.9.0-1189-g3424fa24"; + compound=true; + ratio=0.66; + node[nodesep=0.15, fontsize=18, penwidth=3.]; + edge[fontsize=12, penwidth=0.5]; + ranksep=0.8; + + # Special tasks + sort[color=blue3]; + self_density[color=blue3]; + self_gradient[color=blue3]; + self_force[color=blue3]; + self_grav[color=red3]; + self_stars_density[color=darkorange1]; + self_stars_feedback[color=darkorange1]; + self_rt_gradient[color=springgreen]; + self_rt_transport[color=springgreen]; + pair_density[color=blue3]; + pair_gradient[color=blue3]; + pair_force[color=blue3]; + pair_grav[color=red3]; + pair_stars_density[color=darkorange1]; + pair_stars_feedback[color=darkorange1]; + pair_rt_gradient[color=springgreen]; + pair_rt_transport[color=springgreen]; + sub_self_density[color=blue3]; + sub_self_gradient[color=blue3]; + sub_self_force[color=blue3]; + sub_self_stars_density[color=darkorange1]; + sub_self_stars_feedback[color=darkorange1]; + sub_self_rt_gradient[color=springgreen]; + sub_self_rt_transport[color=springgreen]; + sub_pair_density[color=blue3]; + sub_pair_gradient[color=blue3]; + sub_pair_force[color=blue3]; + sub_pair_stars_density[color=darkorange1]; + sub_pair_stars_feedback[color=darkorange1]; + sub_pair_rt_gradient[color=springgreen]; + sub_pair_rt_transport[color=springgreen]; + init_grav[color=red3]; + init_grav_out[style=filled,fillcolor=grey90,color=red3]; + ghost_in[style=filled,fillcolor=grey90,color=blue3]; + ghost[color=blue3]; + ghost_out[style=filled,fillcolor=grey90,color=blue3]; + extra_ghost[color=blue3]; + drift_part[color=blue3]; + drift_spart[color=darkorange1]; + drift_gpart[color=red3]; + drift_gpart_out[style=filled,fillcolor=grey90,color=red3]; + hydro_end_force[color=blue3]; + kick2[color=black]; + timestep[color=black]; + collect[color=black]; + send_gradient[shape=diamond,style=filled,fillcolor=azure,color=blue3]; + send_xv[shape=diamond,style=filled,fillcolor=azure,color=blue3]; + send_rho[shape=diamond,style=filled,fillcolor=azure,color=blue3]; + send_gpart[shape=diamond,style=filled,fillcolor=azure,color=red3]; + send_spart_density[shape=diamond,style=filled,fillcolor=azure,color=darkorange1]; + send_rt_gradient[shape=diamond,style=filled,fillcolor=azure,color=springgreen]; + send_rt_transport[shape=diamond,style=filled,fillcolor=azure,color=springgreen]; + recv_gradient[shape=diamond,style=filled,fillcolor=azure,color=blue3]; + recv_xv[shape=diamond,style=filled,fillcolor=azure,color=blue3]; + recv_rho[shape=diamond,style=filled,fillcolor=azure,color=blue3]; + recv_gpart[shape=diamond,style=filled,fillcolor=azure,color=red3]; + recv_spart_density[shape=diamond,style=filled,fillcolor=azure,color=darkorange1]; + recv_rt_gradient[shape=diamond,style=filled,fillcolor=azure,color=springgreen]; + recv_rt_transport[shape=diamond,style=filled,fillcolor=azure,color=springgreen]; + grav_long_range[color=red3]; + grav_mm[color=red3]; + grav_down_in[style=filled,fillcolor=grey90,color=red3]; + grav_down[color=red3]; + grav_end_force[color=red3]; + stars_in[style=filled,fillcolor=grey90,color=darkorange1]; + stars_out[style=filled,fillcolor=grey90,color=darkorange1]; + stars_density_ghost[color=darkorange1]; + stars_sort[color=darkorange1]; + rt_in[style=filled,fillcolor=grey90,color=springgreen]; + rt_out[style=filled,fillcolor=grey90,color=springgreen]; + rt_ghost1[color=springgreen]; + rt_ghost2[color=springgreen]; + rt_transport_out[style=filled,fillcolor=grey90,color=springgreen]; + rt_tchem[color=springgreen]; + rt_advance_cell_time[color=springgreen]; + rt_sorts[color=springgreen]; + recv_tend[shape=diamond,style=filled,fillcolor=azure,color=black]; + kick1[color=black]; + send_tend[shape=diamond,style=filled,fillcolor=azure,color=black]; + rt_collect_times[color=springgreen]; + + # Clusters + subgraph clusterDensity { + label=""; + bgcolor="grey99"; + pair_density; + self_density; + sub_pair_density; + sub_self_density; + }; + + subgraph clusterForce { + label=""; + bgcolor="grey99"; + pair_force; + self_force; + sub_pair_force; + sub_self_force; + }; + + subgraph clusterGradient { + label=""; + bgcolor="grey99"; + pair_gradient; + self_gradient; + sub_pair_gradient; + sub_self_gradient; + }; + + subgraph clusterGravity { + label=""; + bgcolor="grey99"; + grav_long_range; + grav_mm; + pair_grav; + self_grav; + }; + + subgraph clusterRTgradient { + label=""; + bgcolor="grey99"; + pair_rt_gradient; + self_rt_gradient; + sub_pair_rt_gradient; + sub_self_rt_gradient; + }; + + subgraph clusterRTtransport { + label=""; + bgcolor="grey99"; + pair_rt_transport; + self_rt_transport; + sub_pair_rt_transport; + sub_self_rt_transport; + }; + + subgraph clusterStarsDensity { + label=""; + bgcolor="grey99"; + pair_stars_density; + self_stars_density; + sub_pair_stars_density; + sub_self_stars_density; + }; + + subgraph clusterStarsFeedback { + label=""; + bgcolor="grey99"; + pair_stars_feedback; + self_stars_feedback; + sub_pair_stars_feedback; + sub_self_stars_feedback; + }; + + + # Dependencies + sort->pair_density[color=blue3,fontcolor=blue3] + sort->pair_force[color=blue3,fontcolor=blue3] + sort->pair_rt_transport[color=blue3,fontcolor=blue3] + sort->pair_stars_density[color=blue3,fontcolor=blue3] + sort->pair_rt_gradient[color=blue3,fontcolor=blue3] + sort->sub_pair_density[color=blue3,fontcolor=blue3] + sort->sub_pair_force[color=blue3,fontcolor=blue3] + sort->sub_pair_rt_transport[color=blue3,fontcolor=blue3] + sort->sub_pair_stars_density[color=blue3,fontcolor=blue3] + sort->sub_pair_rt_gradient[color=blue3,fontcolor=blue3] + sort->rt_sorts[color=blue3,fontcolor=blue3] + sort->recv_rt_gradient[color=blue3,fontcolor=blue3] + sort->recv_rho[color=blue3,fontcolor=blue3] + sort->recv_gradient[color=blue3,fontcolor=blue3] + sort->sub_self_density[color=blue3,fontcolor=blue3] + sort->sub_self_stars_density[color=blue3,fontcolor=blue3] + sort->sub_self_rt_gradient[color=blue3,fontcolor=blue3] + self_density->ghost_in[color=blue3,fontcolor=blue3] + self_gradient->extra_ghost[color=blue3,fontcolor=blue3] + self_force->hydro_end_force[color=blue3,fontcolor=blue3] + self_grav->grav_down_in[color=red3,fontcolor=red3] + self_stars_density->stars_density_ghost[color=darkorange1,fontcolor=darkorange1] + self_stars_feedback->stars_out[color=darkorange1,fontcolor=darkorange1] + self_rt_gradient->rt_ghost2[color=springgreen,fontcolor=springgreen] + self_rt_transport->rt_transport_out[color=springgreen,fontcolor=springgreen] + pair_density->ghost_in[color=blue3,fontcolor=blue3] + pair_density->recv_rho[color=blue3,fontcolor=blue3] + pair_gradient->extra_ghost[color=blue3,fontcolor=blue3] + pair_gradient->recv_gradient[color=blue3,fontcolor=blue3] + pair_force->hydro_end_force[color=blue3,fontcolor=blue3] + pair_force->recv_tend[color=blue3,fontcolor=blue3] + pair_force->recv_rt_gradient[color=blue3,fontcolor=blue3] + pair_grav->grav_down_in[color=red3,fontcolor=red3] + pair_grav->recv_tend[color=red3,fontcolor=red3] + pair_stars_density->stars_density_ghost[color=darkorange1,fontcolor=darkorange1] + pair_stars_density->recv_spart_density[color=darkorange1,fontcolor=darkorange1] + pair_stars_feedback->stars_out[color=darkorange1,fontcolor=darkorange1] + pair_stars_feedback->recv_tend[color=darkorange1,fontcolor=darkorange1] + pair_rt_gradient->rt_ghost2[color=springgreen,fontcolor=springgreen] + pair_rt_gradient->recv_rt_transport[color=springgreen,fontcolor=springgreen] + pair_rt_transport->rt_transport_out[color=springgreen,fontcolor=springgreen] + pair_rt_transport->recv_tend[color=springgreen,fontcolor=springgreen] + pair_rt_transport->rt_advance_cell_time[color=springgreen,fontcolor=springgreen] + sub_self_density->ghost_in[color=blue3,fontcolor=blue3] + sub_self_gradient->extra_ghost[color=blue3,fontcolor=blue3] + sub_self_force->hydro_end_force[color=blue3,fontcolor=blue3] + sub_self_stars_density->stars_density_ghost[color=darkorange1,fontcolor=darkorange1] + sub_self_stars_feedback->stars_out[color=darkorange1,fontcolor=darkorange1] + sub_self_rt_gradient->rt_ghost2[color=springgreen,fontcolor=springgreen] + sub_self_rt_transport->rt_transport_out[color=springgreen,fontcolor=springgreen] + sub_pair_density->ghost_in[color=blue3,fontcolor=blue3] + sub_pair_density->recv_rho[color=blue3,fontcolor=blue3] + sub_pair_gradient->extra_ghost[color=blue3,fontcolor=blue3] + sub_pair_gradient->recv_gradient[color=blue3,fontcolor=blue3] + sub_pair_force->hydro_end_force[color=blue3,fontcolor=blue3] + sub_pair_force->recv_tend[color=blue3,fontcolor=blue3] + sub_pair_force->recv_rt_gradient[color=blue3,fontcolor=blue3] + sub_pair_stars_density->stars_density_ghost[color=darkorange1,fontcolor=darkorange1] + sub_pair_stars_density->recv_spart_density[color=darkorange1,fontcolor=darkorange1] + sub_pair_stars_feedback->stars_out[color=darkorange1,fontcolor=darkorange1] + sub_pair_stars_feedback->recv_tend[color=darkorange1,fontcolor=darkorange1] + sub_pair_rt_gradient->rt_ghost2[color=springgreen,fontcolor=springgreen] + sub_pair_rt_gradient->recv_rt_transport[color=springgreen,fontcolor=springgreen] + sub_pair_rt_transport->rt_transport_out[color=springgreen,fontcolor=springgreen] + sub_pair_rt_transport->recv_tend[color=springgreen,fontcolor=springgreen] + sub_pair_rt_transport->rt_advance_cell_time[color=springgreen,fontcolor=springgreen] + init_grav->grav_long_range[color=red3,fontcolor=red3] + init_grav->init_grav_out[color=red3,fontcolor=red3] + init_grav_out->pair_grav[color=red3,fontcolor=red3] + init_grav_out->self_grav[color=red3,fontcolor=red3] + init_grav_out->init_grav_out[color=red3,fontcolor=red3] + init_grav_out->grav_mm[color=red3,fontcolor=red3] + ghost_in->ghost[color=blue3,fontcolor=blue3] + ghost->ghost_out[color=blue3,fontcolor=blue3] + ghost_out->pair_gradient[color=blue3,fontcolor=blue3] + ghost_out->sub_self_gradient[color=blue3,fontcolor=blue3] + ghost_out->sub_pair_gradient[color=blue3,fontcolor=blue3] + ghost_out->send_rho[color=blue3,fontcolor=blue3] + ghost_out->self_gradient[color=blue3,fontcolor=blue3] + extra_ghost->pair_force[color=blue3,fontcolor=blue3] + extra_ghost->sub_self_force[color=blue3,fontcolor=blue3] + extra_ghost->sub_pair_force[color=blue3,fontcolor=blue3] + extra_ghost->send_gradient[color=blue3,fontcolor=blue3] + extra_ghost->self_force[color=blue3,fontcolor=blue3] + drift_part->pair_density[color=blue3,fontcolor=blue3] + drift_part->pair_stars_density[color=blue3,fontcolor=blue3] + drift_part->pair_rt_gradient[color=blue3,fontcolor=blue3] + drift_part->sub_self_density[color=blue3,fontcolor=blue3] + drift_part->sub_self_stars_density[color=blue3,fontcolor=blue3] + drift_part->sub_self_rt_gradient[color=blue3,fontcolor=blue3] + drift_part->sub_pair_density[color=blue3,fontcolor=blue3] + drift_part->sub_pair_stars_density[color=blue3,fontcolor=blue3] + drift_part->sub_pair_rt_gradient[color=blue3,fontcolor=blue3] + drift_part->sort[color=blue3,fontcolor=blue3] + drift_part->send_rho[color=blue3,fontcolor=blue3] + drift_part->send_xv[color=blue3,fontcolor=blue3] + drift_part->send_rt_gradient[color=blue3,fontcolor=blue3] + drift_part->send_rt_transport[color=blue3,fontcolor=blue3] + drift_part->self_density[color=blue3,fontcolor=blue3] + drift_part->self_stars_density[color=blue3,fontcolor=blue3] + drift_part->self_rt_gradient[color=blue3,fontcolor=blue3] + drift_spart->kick2[color=darkorange1,fontcolor=darkorange1] + drift_spart->pair_stars_density[color=darkorange1,fontcolor=darkorange1] + drift_spart->sub_self_stars_density[color=darkorange1,fontcolor=darkorange1] + drift_spart->sub_pair_stars_density[color=darkorange1,fontcolor=darkorange1] + drift_spart->stars_sort[color=darkorange1,fontcolor=darkorange1] + drift_spart->send_spart_density[color=darkorange1,fontcolor=darkorange1] + drift_spart->self_stars_density[color=darkorange1,fontcolor=darkorange1] + drift_gpart->drift_gpart_out[color=red3,fontcolor=red3] + drift_gpart->send_gpart[color=red3,fontcolor=red3] + drift_gpart_out->pair_grav[color=red3,fontcolor=red3] + drift_gpart_out->self_grav[color=red3,fontcolor=red3] + drift_gpart_out->drift_gpart_out[color=red3,fontcolor=red3] + hydro_end_force->kick2[color=blue3,fontcolor=blue3] + kick2->timestep[color=black,fontcolor=black] + kick2->stars_in[color=black,fontcolor=black] + kick2->rt_in[color=black,fontcolor=black] + timestep->kick1[color=black,fontcolor=black] + timestep->collect[color=black,fontcolor=black] + collect->send_tend[color=black,fontcolor=black] + send_gradient->hydro_end_force[color=blue3,fontcolor=blue3] + send_xv->send_rho[color=blue3,fontcolor=blue3] + send_xv->ghost_in[color=blue3,fontcolor=blue3] + send_xv->send_rt_gradient[color=blue3,fontcolor=blue3] + send_rho->send_gradient[color=blue3,fontcolor=blue3] + send_rho->extra_ghost[color=blue3,fontcolor=blue3] + send_gpart->grav_down[color=red3,fontcolor=red3] + send_spart_density->stars_out[color=darkorange1,fontcolor=darkorange1] + send_rt_gradient->send_rt_transport[color=springgreen,fontcolor=springgreen] + send_rt_gradient->rt_ghost2[color=springgreen,fontcolor=springgreen] + send_rt_transport->rt_transport_out[color=springgreen,fontcolor=springgreen] + recv_gradient->recv_rt_gradient[color=blue3,fontcolor=blue3] + recv_gradient->pair_force[color=blue3,fontcolor=blue3] + recv_gradient->sub_pair_force[color=blue3,fontcolor=blue3] + recv_xv->recv_rho[color=blue3,fontcolor=blue3] + recv_xv->recv_gradient[color=blue3,fontcolor=blue3] + recv_xv->recv_rt_gradient[color=blue3,fontcolor=blue3] + recv_xv->sort[color=blue3,fontcolor=blue3] + recv_xv->pair_density[color=blue3,fontcolor=blue3] + recv_xv->sub_pair_density[color=blue3,fontcolor=blue3] + recv_rho->recv_gradient[color=blue3,fontcolor=blue3] + recv_rho->recv_rt_gradient[color=blue3,fontcolor=blue3] + recv_rho->pair_gradient[color=blue3,fontcolor=blue3] + recv_rho->pair_stars_density[color=blue3,fontcolor=blue3] + recv_rho->sub_pair_gradient[color=blue3,fontcolor=blue3] + recv_rho->sub_pair_stars_density[color=blue3,fontcolor=blue3] + recv_gpart->pair_grav[color=red3,fontcolor=red3] + recv_spart_density->stars_sort[color=darkorange1,fontcolor=darkorange1] + recv_spart_density->pair_stars_feedback[color=darkorange1,fontcolor=darkorange1] + recv_spart_density->sub_pair_stars_feedback[color=darkorange1,fontcolor=darkorange1] + recv_rt_gradient->rt_sorts[color=springgreen,fontcolor=springgreen] + recv_rt_gradient->recv_rt_transport[color=springgreen,fontcolor=springgreen] + recv_rt_gradient->rt_advance_cell_time[color=springgreen,fontcolor=springgreen] + recv_rt_gradient->pair_rt_gradient[color=springgreen,fontcolor=springgreen] + recv_rt_gradient->sub_pair_rt_gradient[color=springgreen,fontcolor=springgreen] + recv_rt_transport->rt_advance_cell_time[color=springgreen,fontcolor=springgreen] + recv_rt_transport->pair_rt_transport[color=springgreen,fontcolor=springgreen] + recv_rt_transport->sub_pair_rt_transport[color=springgreen,fontcolor=springgreen] + grav_long_range->grav_down[color=red3,fontcolor=red3] + grav_mm->grav_down_in[color=red3,fontcolor=red3] + grav_down_in->grav_down[color=red3,fontcolor=red3] + grav_down_in->grav_down_in[color=red3,fontcolor=red3] + grav_down->grav_end_force[color=red3,fontcolor=red3] + grav_end_force->kick2[color=red3,fontcolor=red3] + stars_in->pair_stars_density[color=darkorange1,fontcolor=darkorange1] + stars_in->sub_self_stars_density[color=darkorange1,fontcolor=darkorange1] + stars_in->sub_pair_stars_density[color=darkorange1,fontcolor=darkorange1] + stars_in->self_stars_density[color=darkorange1,fontcolor=darkorange1] + stars_out->timestep[color=darkorange1,fontcolor=darkorange1] + stars_out->rt_in[color=darkorange1,fontcolor=darkorange1] + stars_density_ghost->pair_stars_feedback[color=darkorange1,fontcolor=darkorange1] + stars_density_ghost->sub_self_stars_feedback[color=darkorange1,fontcolor=darkorange1] + stars_density_ghost->sub_pair_stars_feedback[color=darkorange1,fontcolor=darkorange1] + stars_density_ghost->send_spart_density[color=darkorange1,fontcolor=darkorange1] + stars_density_ghost->self_stars_feedback[color=darkorange1,fontcolor=darkorange1] + stars_sort->pair_stars_feedback[color=darkorange1,fontcolor=darkorange1] + stars_sort->sub_pair_stars_feedback[color=darkorange1,fontcolor=darkorange1] + stars_sort->pair_stars_density[color=darkorange1,fontcolor=darkorange1] + stars_sort->sub_self_stars_density[color=darkorange1,fontcolor=darkorange1] + stars_sort->sub_pair_stars_density[color=darkorange1,fontcolor=darkorange1] + rt_in->rt_ghost1[color=springgreen,fontcolor=springgreen] + rt_out->timestep[color=springgreen,fontcolor=springgreen] + rt_out->collect[color=springgreen,fontcolor=springgreen] + rt_ghost1->pair_rt_gradient[color=springgreen,fontcolor=springgreen] + rt_ghost1->sub_self_rt_gradient[color=springgreen,fontcolor=springgreen] + rt_ghost1->sub_pair_rt_gradient[color=springgreen,fontcolor=springgreen] + rt_ghost1->send_rt_gradient[color=springgreen,fontcolor=springgreen] + rt_ghost1->self_rt_gradient[color=springgreen,fontcolor=springgreen] + rt_ghost2->pair_rt_transport[color=springgreen,fontcolor=springgreen] + rt_ghost2->sub_self_rt_transport[color=springgreen,fontcolor=springgreen] + rt_ghost2->sub_pair_rt_transport[color=springgreen,fontcolor=springgreen] + rt_ghost2->send_rt_transport[color=springgreen,fontcolor=springgreen] + rt_ghost2->self_rt_transport[color=springgreen,fontcolor=springgreen] + rt_transport_out->rt_tchem[color=springgreen,fontcolor=springgreen] + rt_tchem->rt_advance_cell_time[color=springgreen,fontcolor=springgreen] + rt_advance_cell_time->rt_collect_times[color=springgreen,fontcolor=springgreen] + rt_advance_cell_time->rt_out[color=springgreen,fontcolor=springgreen] + rt_advance_cell_time->send_tend[color=springgreen,fontcolor=springgreen] + rt_advance_cell_time->recv_tend[color=springgreen,fontcolor=springgreen] + rt_sorts->recv_rt_transport[color=springgreen,fontcolor=springgreen] + rt_sorts->pair_rt_gradient[color=springgreen,fontcolor=springgreen] + rt_sorts->sub_pair_rt_gradient[color=springgreen,fontcolor=springgreen] +} \ No newline at end of file diff --git a/doc/RTD/source/RadiativeTransfer/make_graphs.py b/doc/RTD/source/RadiativeTransfer/make_graphs.py new file mode 100644 index 0000000000000000000000000000000000000000..db026ac078f0e38359504298004820bcd37b5c6f --- /dev/null +++ b/doc/RTD/source/RadiativeTransfer/make_graphs.py @@ -0,0 +1,5 @@ +import os + +# Yes... this is overkill... but the main sphinx conf script looks for python +# scripts to execute... So we piggy back on this. +os.system("dot -Tpng full_dependency_graph_RT.dot -o full_dependency_graph_RT.png") diff --git a/doc/RTD/source/SubgridModels/AGNSpinJets/plots.py b/doc/RTD/source/SubgridModels/AGNSpinJets/plots.py index c16a46651c32a9fd9c358b26813017c5c3e33dd3..6c4045d07be9a771ce00a7c3021517ddf044973e 100644 --- a/doc/RTD/source/SubgridModels/AGNSpinJets/plots.py +++ b/doc/RTD/source/SubgridModels/AGNSpinJets/plots.py @@ -1,10 +1,10 @@ import os if ( - os.path.exists("efficiencies.svg") - and os.path.exists("modes.svg") - and os.path.exists("spec_ang_mom.svg") - and os.path.exists("spinup.svg") + os.path.exists("efficiencies.png") + and os.path.exists("modes.png") + and os.path.exists("spec_ang_mom.png") + and os.path.exists("spinup.png") ): # no need to rerun script exit() @@ -257,7 +257,7 @@ plt.tick_params( labelsize=16, ) -plt.savefig("modes.svg", bbox_inches="tight") +plt.savefig("modes.png", bbox_inches="tight") plt.close() phi = -20.2 * a ** 3 - 14.9 * a ** 2 + 34.0 * a + 52.6 @@ -526,7 +526,7 @@ plt.tick_params( ) plt.title("Slim disc", fontsize=16) -plt.savefig("efficiencies.svg", bbox_inches="tight") +plt.savefig("efficiencies.png", bbox_inches="tight") L_isco1 = [2 / 3 * 1 / np.sqrt(3) * (1 + 2 * np.sqrt(3 * r_isco(x) - 2)) for x in a] @@ -609,7 +609,7 @@ plt.tick_params( labelsize=16, ) -plt.savefig("spec_ang_mom.svg", bbox_inches="tight") +plt.savefig("spec_ang_mom.png", bbox_inches="tight") plt.close() z1 = np.array( @@ -831,4 +831,4 @@ plt.tick_params( ) plt.title("Slim disc", fontsize=16) -plt.savefig("spinup.svg", bbox_inches="tight") +plt.savefig("spinup.png", bbox_inches="tight") diff --git a/doc/RTD/source/SubgridModels/AGNSpinJets/theory.rst b/doc/RTD/source/SubgridModels/AGNSpinJets/theory.rst index d57747b958abb5c0c91d562e442e6e295b43e3c6..b61564aef0da52895d7b04a060a9eb25e8e6a58b 100644 --- a/doc/RTD/source/SubgridModels/AGNSpinJets/theory.rst +++ b/doc/RTD/source/SubgridModels/AGNSpinJets/theory.rst @@ -18,7 +18,7 @@ The thick disk appears at low accretion rates, has very strong jets and is ineff Transitions from one accretion state to another ----------------------------------------------- -.. figure:: modes.svg +.. figure:: modes.png :width: 600px :align: center :figclass: align-center @@ -61,7 +61,7 @@ in region c). The jet efficiency also depends on the slope :math:`\eta`. Classical jet theory (`Meier 2001 <https://ui.adsabs.harvard.edu/abs/2001Sci...291...84M/abstract>`_) suggests that jet powers depend on the aspect ratio linearly, so :math:`\eta=1`. This is also in line with some simulations finding a reduction in jet efficiencies with the aspect ratio (e.g. `Tchekhovskoy et al. 2014 <https://ui.adsabs.harvard.edu/abs/2014MNRAS.437.2744T/abstract>`_). In this scenario, jets launched from thin disks are of order :math:`\approx100` times less powerful than those launched from thick disks. On the other hand, some simulations of thin disks have found jet efficiencies similar to thick disk ones (e.g. `Liska et al. 2019 <https://ui.adsabs.harvard.edu/abs/2019MNRAS.487..550L/abstract>`_), which is supported by observations of blazars (`Ghisellini et al. 2014 <https://ui.adsabs.harvard.edu/abs/2014Natur.515..376G/abstract>`_). In this picture, thin jets are approximately as efficient as thick disk ones, which can in our case be implemented as :math:`\eta=0`. The reality is likely to be somwhere in between. Note that the choice of :math:`\eta` likely has a strong impact on the evolution of galaxies and BHs; our default choice is the classical picture in which :math:`\eta=1`. -.. figure:: efficiencies.svg +.. figure:: efficiencies.png :width: 1200px :align: center :figclass: align-center @@ -99,12 +99,12 @@ For slim disks we take the radiative efficiency based on GRMHD simulations of su .. math:: \epsilon_\mathrm{r,SD}=\frac{0.1}{\dot{m}}A(a)\bigg( \frac{0.985}{1.6/\dot{m}+B(a)}+\frac{0.015}{1.6/\dot{m}+C(a)}\bigg), -where the three spin-dependant functions are given by :math:`A(a)=(0.9663-0.9292a)^{−0.5639}`, :math:`B(a)=(4.627-4.445a)^{−0.5524}` and :math:`C(a)=(827.3-718.1a)^{−0.7060}`. The radiative efficiency of slim disks, based on this formula, matches the thin disk radiative efficiency (given at the beginning of the section) at low accretion rates. At high accretion rates (:math:`\dot{m}\gtrapprox1`, but depending on spin), the radiative efficiency drops. These two formulas are used to decide when a disk transitions from thin to slim. +where the three spin-dependant functions are given by :math:`A(a)=(0.9663-0.9292a)^{-0.5639}`, :math:`B(a)=(4.627-4.445a)^{-0.5524}` and :math:`C(a)=(827.3-718.1a)^{-0.7060}`. The radiative efficiency of slim disks, based on this formula, matches the thin disk radiative efficiency (given at the beginning of the section) at low accretion rates. At high accretion rates (:math:`\dot{m}\gtrapprox1`, but depending on spin), the radiative efficiency drops. These two formulas are used to decide when a disk transitions from thin to slim. Evolution of the black hole spin magnitude ------------------------------------------ -.. figure:: spec_ang_mom.svg +.. figure:: spec_ang_mom.png :width: 600px :align: center :figclass: align-center @@ -130,7 +130,7 @@ For the thick and slim disk, these lower specific angular momenta lead to a non- (see `Benson & Babul 2009 <https://ui.adsabs.harvard.edu/abs/2009MNRAS.397.1302B/abstract>`_ for a derivation, which we have independently verified). Including jet spindown leads to even lower equilibrium spin values; e.g. for the thick disk this is only :math:`a_\mathrm{eq}\approx0.25`. -.. figure:: spinup.svg +.. figure:: spinup.png :width: 1200px :align: center :figclass: align-center diff --git a/doc/RTD/source/SubgridModels/EAGLE/index.rst b/doc/RTD/source/SubgridModels/EAGLE/index.rst index 4bb21f3b9478247c01adfe4c32c7d6c99ea3a6ba..25272911352a41ecb10f4144ab54153a2afeb29a 100644 --- a/doc/RTD/source/SubgridModels/EAGLE/index.rst +++ b/doc/RTD/source/SubgridModels/EAGLE/index.rst @@ -33,7 +33,7 @@ used to prevent the fragmentation of high-density gas into clumps that cannot be resolved by the coupled hydro+gravity solver. The two limits are sketched on the following figure. -.. figure:: EAGLE_entropy_floor.svg +.. figure:: EAGLE_entropy_floor.png :width: 400px :align: center :figclass: align-center @@ -443,7 +443,7 @@ designed such that star formation threshold decreases with increasing metallicity. This relationship with the YAML parameters defining it is shown on the figure below. -.. figure:: EAGLE_SF_Z_dep.svg +.. figure:: EAGLE_SF_Z_dep.png :width: 400px :align: center :figclass: align-center @@ -470,7 +470,7 @@ densities. Note that unlike the entropy floor, this is applied at *all* densities and not only above a certain threshold. This equation of state with the relevant YAML parameters defining it is shown on the figure below. -.. figure:: EAGLE_SF_EOS.svg +.. figure:: EAGLE_SF_EOS.png :width: 400px :align: center :figclass: align-center diff --git a/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_SF_EOS.py b/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_SF_EOS.py index e5c954127c0ed88aef8a277a1ea9a4dc1f8bff70..a24788915816bdc57fbf27d5e7a906b4ccdfe9e1 100644 --- a/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_SF_EOS.py +++ b/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_SF_EOS.py @@ -1,6 +1,6 @@ import os -if os.path.exists("EAGLE_SF_EOS.svg"): +if os.path.exists("EAGLE_SF_EOS.png"): # do not generate plot again exit() @@ -81,4 +81,4 @@ xlim(3e-8, 3e3) ylim(20.0, 2e5) -savefig("EAGLE_SF_EOS.svg", dpi=200) +savefig("EAGLE_SF_EOS.png", dpi=200) diff --git a/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_SF_Z_dep.py b/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_SF_Z_dep.py index 26cda85bea458731906e80126b160626fbee2edd..7ae006c90dce4f7bb3d79d6255897193366a8e9f 100644 --- a/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_SF_Z_dep.py +++ b/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_SF_Z_dep.py @@ -1,6 +1,6 @@ import os -if os.path.exists("EAGLE_SF_Z_dep.svg"): +if os.path.exists("EAGLE_SF_Z_dep.png"): # do not generate plot again exit() @@ -102,4 +102,4 @@ ylabel("SF threshold number density $n_{\\rm H, thresh}$ [cm$^{-3}$]", labelpad= xlim(1e-7, 1.0) ylim(0.0002, 50) -savefig("EAGLE_SF_Z_dep.svg", dpi=200) +savefig("EAGLE_SF_Z_dep.png", dpi=200) diff --git a/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_entropy_floor.py b/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_entropy_floor.py index 66d38c2b47cbc6b984cc45f3ce316f3134a706e0..a643ed81252ed76377dbf834c9d27777d2e85565 100644 --- a/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_entropy_floor.py +++ b/doc/RTD/source/SubgridModels/EAGLE/plot_EAGLE_entropy_floor.py @@ -1,6 +1,6 @@ import os -if os.path.exists("EAGLE_entropy_floor.svg"): +if os.path.exists("EAGLE_entropy_floor.png"): # do not generate plot again exit() @@ -115,4 +115,4 @@ ylabel("Temperature $T$ [K]", labelpad=2) xlim(3e-8, 3e3) ylim(20.0, 2e5) -savefig("EAGLE_entropy_floor.svg", dpi=200) +savefig("EAGLE_entropy_floor.png", dpi=200) diff --git a/doc/RTD/source/conf.py b/doc/RTD/source/conf.py index c14bfc6263af7bfe75e95f793638846d52b301e4..59c8ba737102291177bd901e7d9fd262c0e71f53 100644 --- a/doc/RTD/source/conf.py +++ b/doc/RTD/source/conf.py @@ -19,7 +19,7 @@ # -- Project information ----------------------------------------------------- project = "SWIFT: SPH With Inter-dependent Fine-grained Tasking" -copyright = "2014-2022, SWIFT Collaboration" +copyright = "2014-2023, SWIFT Collaboration" author = "SWIFT Team" # The short X.Y version @@ -77,7 +77,7 @@ master_doc = "index" # # 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 +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -128,7 +128,7 @@ htmlhelp_basename = "SWIFTSPHWIthFine-grainedinter-dependentTaskingdoc" latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # - # 'papersize': 'letterpaper', + "papersize": "a4paper", # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', @@ -146,9 +146,9 @@ latex_elements = { latex_documents = [ ( master_doc, - "SWIFTSPHWIthFine-grainedinter-dependentTasking.tex", - "SWIFT: SPH WIth Fine-grained inter-dependent Tasking Documentation", - "Josh Borrow", + "SWIFT-user-manual.tex", + "SWIFT user \& developer documentation", + "SWIFT Collaboration", "manual", ) ] diff --git a/doc/onboardingGuide/Makefile b/doc/onboardingGuide/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b9fa825763f21a1574d394ce5d58b8b4c25b5b8f --- /dev/null +++ b/doc/onboardingGuide/Makefile @@ -0,0 +1,21 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + diff --git a/doc/onboardingGuide/README.md b/doc/onboardingGuide/README.md new file mode 100644 index 0000000000000000000000000000000000000000..53ab61249453e58faa7bcec715eeef9ef85c0d5e --- /dev/null +++ b/doc/onboardingGuide/README.md @@ -0,0 +1,11 @@ +SWIFT Onboarding Guide +====================== + +This is an onboarding guide for SWIFT that can be found on `swiftsim.com/onboarding.pdf`. + +You will need the `sphinx` and python package (pip install it), as well as a working +TeX distribution. + +To build the documentation (from this directory), run ``make latexpdf`` and the output +files will be created in `build/latex/`. + diff --git a/doc/onboardingGuide/source/conf.py b/doc/onboardingGuide/source/conf.py new file mode 100644 index 0000000000000000000000000000000000000000..09be4bc3c1d300b3dcd855f5502265eba87d794e --- /dev/null +++ b/doc/onboardingGuide/source/conf.py @@ -0,0 +1,172 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- 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 Onboarding Guide" +copyright = "2023, SWIFT Collaboration" +author = "SWIFT Collaboration" + +# The full version, including alpha/beta/rc tags +release = "0.0" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# 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 = [] + + +# -- 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 = "alabaster" + +# 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"] + + +# -- Options for LaTeX-PDF output -------------------------------------------- +# See https://www.sphinx-doc.org/en/master/latex.html for more options + +latex_theme = "howto" + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + "papersize": "a4paper", + # The font size ('10pt', '11pt' or '12pt'). + "pointsize": "10pt", + # Font package inclusion. + "fontpkg": r""" +\usepackage[sfdefault]{AlegreyaSans} %% Option 'black' gives heavier bold face +\renewcommand*\oldstylenums[1]{{\AlegreyaSansOsF #1}} +""", + # Other possible choices: + # \usepackage[sfdefault]{ClearSans} %% option 'sfdefault' activates Clear Sans as the default text font + # \usepackage[sfdefault,light]{merriweather} %% Option 'black' gives heavier bold face + # %\usepackage[sfdefault,book]{FiraSans} %% option 'sfdefault' activates Fira Sans as the default text font + # %\usepackage{marcellus} %% option 'sfdefault' activates Fira Sans as the default text font + # ------------------------------------------ + # override use of fncychap + "fncychap": r""" +""", + # pass options to packages sphinx already loads + "passoptionstopackages": r""" +\PassOptionsToPackage{top=6.1cm, bottom=1cm, left=0.6cm, right=0.6cm}{geometry} +""", + # Additional stuff for the LaTeX preamble. + "preamble": r""" +\usepackage{multicol} % use two columns throughout the document + +\setcounter{secnumdepth}{0} % turn off chapter numbering + +% Reduce spacing after headings +%------------------------------------ +% https://tex.stackexchange.com/questions/53338/reducing-spacing-after-headings +\usepackage{titlesec} + +\titlespacing\title{0pt}{0pt plus 0pt minus 0pt}{0pt plus 0pt minus 0pt} +\titlespacing\chapter{0pt}{0pt plus 0pt minus 0pt}{0pt plus 0pt minus 0pt} +\titlespacing\section{0pt}{4pt plus 0pt minus 8pt}{4pt plus 0pt minus 4pt} +\titlespacing\subsection{0pt}{1pt plus 0pt minus 4pt}{0pt plus 0pt minus 8pt} +\titlespacing\subsubsection{0pt}{1pt plus 0pt minus 2pt}{0pt plus 0pt minus 8pt} + +% Reduce section font sizes +%------------------------------------ +\titleformat*{\section}{\Large\bf} +\titleformat*{\subsection}{\normalsize\bf} +\titleformat*{\subsubsection}{\small\bf} + + + +% Modify the way inline verbatim behaves. +%------------------------------------------ +% this version changes the text color. +%\definecolor{inlineVerbatimTextColor}{rgb}{0.6, 0.4, 0.5} +%\protect\renewcommand{\sphinxcode}[1]{\textcolor{inlineVerbatimTextColor}{\texttt{#1}}} + +% this version keeps the text color, but adds a colorful box. +\definecolor{inlineVerbatimBorderColor}{rgb}{0.90, 1.00, 0.95} + +\protect\renewcommand{\sphinxcode}[1]{\colorbox{inlineVerbatimBorderColor}{\texttt{#1}}} + + +% Drawing and image positioning +%--------------------------------- +\usepackage{tikz} +\usetikzlibrary{positioning} + + +% Reduce space between \item +%---------------------------------- + +\let\tempone\itemize +\let\temptwo\enditemize +\renewenvironment{itemize}{\tempone\addtolength{\itemsep}{-0.5\baselineskip}}{\temptwo} +""", + # last thing before \begin{document}: + "makeindex": r""" +\pagestyle{empty} +""", + # override title making. + "maketitle": r""" +\begin{multicols}{2} % make two columns +""", + # additional footer content + "atendofbody": r""" +\end{multicols} % make two columns +""", + # override ToC. + "tableofcontents": r""" +""", + "extraclassoptions": r""" +""", + # sphinx related stuff + "sphinxsetup": r""" +VerbatimColor={rgb}{0.90, 1.00, 0.95}, +verbatimwithframe=false, +hmargin={0.6cm, 0.6cm}, +vmargin={5.2cm, 1cm}, +TitleColor={rgb}{0.40,0.00,0.33}, +OuterLinkColor={rgb}{0., 0.40, 0.27}, +""", +} + +latex_documents = [ + ( + "index", # startdocname + "onboarding.tex", # targetname + "SWIFT Onboarding Guide", # title + "SWIFT Collaboration", # author + "howto", # theme + False, # toctree only + ) +] diff --git a/doc/onboardingGuide/source/dependencies.rst b/doc/onboardingGuide/source/dependencies.rst new file mode 100644 index 0000000000000000000000000000000000000000..f2314174610bc2c3c217871994e7680afda4028a --- /dev/null +++ b/doc/onboardingGuide/source/dependencies.rst @@ -0,0 +1,78 @@ +.. dependencies + +Dependencies +============ + +To compile SWIFT, you will need the following libraries: + +HDF5 +~~~~ + +Version 1.8.x or higher is required. Input and output files are stored as HDF5 +and are compatible with the existing GADGET-2 specification. A parallel-HDF5 build +and HDF5 > 1.10.x is strongly recommended. + +.. Please consider using a build of parallel-HDF5, as SWIFT can leverage this + when writing and reading snapshots. We recommend using HDF5 > 1.10.x as + this is *vastly superior* in parallel. + +MPI +~~~ +A recent implementation of MPI, such as Open MPI (v3.x or higher), is required, +or any library that implements at least the MPI 3 standard. + +Libtool +~~~~~~~ +The build system depends on libtool. + +FFTW +~~~~ +Version 3.3.x or higher is required for periodic gravity. + +ParMETIS or METIS +~~~~~~~~~~~~~~~~~ +One is required for domain decomposition and load balancing. + +GSL +~~~ +The GSL is required for cosmological integration. + + + +Optional Dependencies +===================== + +There are also the following *optional* dependencies: + +libNUMA +~~~~~~~ +libNUMA is used to pin threads. + +TCmalloc/Jemalloc +~~~~~~~~~~~~~~~~~ +TCmalloc/Jemalloc are used for faster memory allocations when available. + +DOXYGEN +~~~~~~~ +You can build documentation for SWIFT with DOXYGEN. + +Python +~~~~~~ +To run the examples, you will need python 3 and some of the standard scientific libraries (numpy, matplotlib). +Some examples make use of the `swiftsimio <https://swiftsimio.readthedocs.io/en/latest/>`_ library, +which is a dedicated and maintained visualisation and analysis library for SWIFT. + +GRACKLE +~~~~~~~ +GRACKLE cooling is implemented in SWIFT. If you wish to take advantage of it, you will need it installed. + +HEALPix C library +~~~~~~~~~~~~~~~~~ +This is required for making light cone HEALPix maps. + +CFITSIO +~~~~~~~ +This may be required as a dependency of HEALPix. + + + diff --git a/doc/onboardingGuide/source/getting_help.rst b/doc/onboardingGuide/source/getting_help.rst new file mode 100644 index 0000000000000000000000000000000000000000..d2fe40be5d404e17272e0cfda47bed59b5aab4ea --- /dev/null +++ b/doc/onboardingGuide/source/getting_help.rst @@ -0,0 +1,14 @@ +.. getting help + +Getting Help +============ + + +Feel free to contact us on `Gitter (gitter.im/swiftsim) <https://gitter.im/swiftsim>`_ +or on our `GitHub (github.com/swiftsim/swiftsim) <https://github.com/swiftsim/swiftsim>`_ +by creating an issue. + +The code documentation is available on `swiftsim.com/docs <https://swiftsim.com/docs>`_, and +is also shipped along with the code in the ``docs/RTD`` directory. +This onboarding guide is available online as well on +`swiftsim.com/onboarding.pdf <http://www.swiftsim.com/onboarding.pdf>`_ diff --git a/doc/onboardingGuide/source/getting_the_code.rst b/doc/onboardingGuide/source/getting_the_code.rst new file mode 100644 index 0000000000000000000000000000000000000000..2447486dd781e5bb5e339ca5ed3fb2a359bc45c6 --- /dev/null +++ b/doc/onboardingGuide/source/getting_the_code.rst @@ -0,0 +1,13 @@ +.. Getting The Code + + +Getting The Code +================= + +The code is available from our GitLab (core developers) and GitHub (public mirror) +repositories. You can download it over https from the following locations: + ++ https://github.com/swiftsim/swiftsim.git ++ https://gitlab.cosma.dur.ac.uk/swift/swiftsim.git + + diff --git a/doc/onboardingGuide/source/header_first_page.rst b/doc/onboardingGuide/source/header_first_page.rst new file mode 100644 index 0000000000000000000000000000000000000000..c1b6b4b55d24fdf148bd5b218b20cbee08e58f42 --- /dev/null +++ b/doc/onboardingGuide/source/header_first_page.rst @@ -0,0 +1,16 @@ +.. Produce the header title on the first page. + +.. raw:: latex + + % remove all headers/footers + \pagestyle{empty} + + % Add image + \tikz[remember picture,overlay] + \node[opacity=1.0,inner sep=0pt, anchor=north] at (current page.north) + {\includegraphics[width=\paperwidth,height=5cm]{../../source/header_page1.jpg}}; + + % for whatever reason, an ugly spacing is added. Remove it here. + \vspace{-1.8\baselineskip} + + diff --git a/doc/onboardingGuide/source/header_page1.jpg b/doc/onboardingGuide/source/header_page1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b032908a9a82fa9e5e74d2cb0a8ff338573bafe9 Binary files /dev/null and b/doc/onboardingGuide/source/header_page1.jpg differ diff --git a/doc/onboardingGuide/source/header_page2.jpg b/doc/onboardingGuide/source/header_page2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..04d69f146a7d7731c7c05deb292bcef5e022e55f Binary files /dev/null and b/doc/onboardingGuide/source/header_page2.jpg differ diff --git a/doc/onboardingGuide/source/header_second_page.rst b/doc/onboardingGuide/source/header_second_page.rst new file mode 100644 index 0000000000000000000000000000000000000000..3a84f4f0ec80f2ac2d23aa2fef6094f7e2b2114e --- /dev/null +++ b/doc/onboardingGuide/source/header_second_page.rst @@ -0,0 +1,20 @@ +.. Produce the header title on the second page. + + +.. raw:: latex + + % remove all headers/footers + \pagestyle{empty} + + % Add background image + \tikz[remember picture,overlay] + \node[opacity=1.0,inner sep=0pt, anchor=north] at (current page.north) + {\includegraphics[width=\paperwidth,height=5cm]{../../source/header_page2.jpg}}; + + % Add logo + \tikz[remember picture,overlay] + \node[below left = -1.9cm and -1.5cm] at (current page.north) + {\includegraphics[height=8cm]{../../source/logo/BirdW.pdf}}; + + % for whatever reason, an ugly spacing is added. Remove it here. + \vspace{-3.3\baselineskip} diff --git a/doc/onboardingGuide/source/index.rst b/doc/onboardingGuide/source/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..fa7c1ee6954b1392cd1b7a995a2e3ace6301e280 --- /dev/null +++ b/doc/onboardingGuide/source/index.rst @@ -0,0 +1,50 @@ +.. Onboarding Guide + Mladen Ivkovic, January 2023 + +====================== +SWIFT Onboarding Guide +====================== + +.. Note: There seems to be some issue with sphinx, where the first and highest + heading in the hierarchy will be skipped when generating pdfs. We don't make + a title for this guide anyway, so add the title of the guide above so the + first section will be displayed correctly. + + +.. This is the first page of the onboarding guide + ----------------------------------------------------------------- + +.. include:: header_first_page.rst + +.. include:: what_swift_can_do.rst +.. include:: getting_the_code.rst +.. include:: getting_help.rst +.. include:: initial_setup.rst + +.. raw:: latex + + % fill column. + \vfill\null + +.. include:: dependencies.rst + + + + +.. This is the second page of the onboarding guide + ----------------------------------------------------------------- + +.. raw:: latex + + \vfill\null + \newpage + +.. include:: header_second_page.rst + +.. include:: useful_configuration_flags.rst +.. include:: runtime_options.rst +.. include:: running_example.rst +.. include:: submission_script.rst + + + diff --git a/doc/onboardingGuide/source/initial_setup.rst b/doc/onboardingGuide/source/initial_setup.rst new file mode 100644 index 0000000000000000000000000000000000000000..947aa1973a2ba656ef0a7d0e4e24fb154f4e5fb6 --- /dev/null +++ b/doc/onboardingGuide/source/initial_setup.rst @@ -0,0 +1,29 @@ +Initial Setup +============= + +We use autotools for setup. To get a basic running version of the code (the executable binaries are found in the top directory), use: + +.. code-block:: bash + + ./autogen.sh + ./configure + make + + +MacOS Specific Oddities +~~~~~~~~~~~~~~~~~~~~~~~ + +To build on MacOS you will need to disable compiler warnings due to an +incomplete implementation of pthread barriers. DOXYGEN also has some issues on +MacOS, so it is best to leave it out. To configure: + +.. code-block:: bash + + ./configure --disable-compiler-warnings \ + --disable-doxygen-doc + +When using the ``clang`` compiler, the hand-written vectorized routines +have to be disabled. This is done at configuration time by adding +the flag ``--disable-hand-vec``. + + diff --git a/doc/onboardingGuide/source/logo/BirdBW.pdf b/doc/onboardingGuide/source/logo/BirdBW.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1f7edcc34222b693f8660f7e4b4c0476d60887e9 Binary files /dev/null and b/doc/onboardingGuide/source/logo/BirdBW.pdf differ diff --git a/doc/onboardingGuide/source/logo/BirdW.pdf b/doc/onboardingGuide/source/logo/BirdW.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fb1a27a726c328f295f4100bbcfb5eb6d714f23a Binary files /dev/null and b/doc/onboardingGuide/source/logo/BirdW.pdf differ diff --git a/doc/onboardingGuide/source/logo/JustTheBird.pdf b/doc/onboardingGuide/source/logo/JustTheBird.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2c3584f01df3fc6ec02bdcf6d1763e134dceae8b Binary files /dev/null and b/doc/onboardingGuide/source/logo/JustTheBird.pdf differ diff --git a/doc/onboardingGuide/source/running_example.rst b/doc/onboardingGuide/source/running_example.rst new file mode 100644 index 0000000000000000000000000000000000000000..cbd41644f5882f5b315231bf820bdf03f6994b2a --- /dev/null +++ b/doc/onboardingGuide/source/running_example.rst @@ -0,0 +1,88 @@ +.. Running an Example + Josh Borrow, 5th April 2018 + Mladen Ivkovic, Jan 2023 + +Running an Example +================== + +SWIFT provides a number of examples that you can run in the ``examples/`` directory. +Many are detailed in their respective ``README`` files, and contain python scripts +(files with the suffix ``.py``) to both generate initial conditions and plot results. +The python scripts usually contain their respective documentation at the top of the +script file itself. + + +Sod Shock +~~~~~~~~~ + +In this example, we will run the 3D SodShock test. You will need to configure and +compile the code as follows: + +.. code-block:: bash + + ./configure + make + +Then to run the code, we first download and build the +initial conditions: + +.. code-block:: bash + + cd examples/HydroTests/SodShock_3D + ./getGlass.sh + python3 makeIC.py + ../../../swift --hydro --threads=4 sodShock.yml + +We can plot the solution with the included python script +as follows: + +.. code-block:: bash + + python3 plotSolution.py 1 + +The argument ``1`` tells the python plotting script to use the snapshot with number +1 for the plot. + + + +Small Cosmological Volume +~~~~~~~~~~~~~~~~~~~~~~~~~ + +As a second example, we run a small cosmolgical +volume containing dark matter only starting at redshift :math:`z = 50`. +Like for the Sod Shock example, it suffices to configure (``./configure``) and +compile (``make``) the code without any extra flags. + +After downloading the initial conditions, we run the code with cosmology and +self-gravity: + +.. code-block:: bash + + cd examples/SmallCosmoVolume/SmallCosmoVolume_DM + ./getIC.sh + ../../../swift --cosmology --self-gravity \ + --threads=8 small_cosmo_volume_dm.yml + + +We can plot the solution with the included python script +as follows: + +.. code-block:: bash + + python3 plotProjection.py 31 + +The ``plotProjection.py`` script requires the +`swiftsimio <https://swiftsimio.readthedocs.io/en/latest/>`_ +library. + +An example containing both baryonic and dark matter is +``examples/SmallCosmoVolume/SmallCosmoVolume_hydro``. To run with +hydrodynamics, the ``--hydro`` flag needs to be provided as well: + +.. code-block:: bash + + ../../../swift --cosmology --self-gravity \ + --hydro --threads=8 small_cosmo_volume.yml + + + diff --git a/doc/onboardingGuide/source/runtime_options.rst b/doc/onboardingGuide/source/runtime_options.rst new file mode 100644 index 0000000000000000000000000000000000000000..f0166a58d6dd0270599918b33cec98e7a2794f86 --- /dev/null +++ b/doc/onboardingGuide/source/runtime_options.rst @@ -0,0 +1,22 @@ +.. Runtime Options + Josh Borrow, 5th April 2018 + +Runtime Options and Parameter Files +=================================== + +SWIFT requires a number of runtime options to run and get any sensible output. +For instance, just running the ``swift`` binary will not use any SPH or gravity; +the particles will just sit still! + +A list of command line options can be found by running the compiled binary with +the ``-h`` or ``--help`` flag: + +.. code-block:: bash + + ./swift --help + + +You will also need to specify a number of runtime parameters that are dependent +on your compile-time configuration in a parameter file. A list of all of these +parameters can be found in ``examples/parameter_example.yml``, and you can check +out examples in the ``examples/`` directory. diff --git a/doc/onboardingGuide/source/submission_script.rst b/doc/onboardingGuide/source/submission_script.rst new file mode 100644 index 0000000000000000000000000000000000000000..500038b725a98bffa0be635cce349e7dc0b5e028 --- /dev/null +++ b/doc/onboardingGuide/source/submission_script.rst @@ -0,0 +1,23 @@ +.. Submission Script + +Submission Script +================= + + +Below is an example submission script for the SLURM batch system. This runs +SWIFT with MPI, thread pinning, hydrodynamics, and self-gravity. + +.. code-block:: bash + + #SBATCH --partition=<queue> + #SBATCH --account-name=<groupName> + #SBATCH --job-name=<jobName> + #SBATCH --nodes=<nNodes> + #SBATCH --ntasks-per-node=<nMPIRank> + #SBATCH --cpus-per-task=<nThreadsPerMPIRank> + #SBATCH --time=<hh>:<mm>:<ss> + + srun -n $SLURM_NTASKS ./swift_mpi \ + --threads=$SLURM_CPUS_PER_TASK --pin \ + --hydro --self-gravity parameter_file.yml + diff --git a/doc/onboardingGuide/source/useful_configuration_flags.rst b/doc/onboardingGuide/source/useful_configuration_flags.rst new file mode 100644 index 0000000000000000000000000000000000000000..586a5222c2bcfb442c703a0109f863c76fd51449 --- /dev/null +++ b/doc/onboardingGuide/source/useful_configuration_flags.rst @@ -0,0 +1,46 @@ +.. Configuration Options + Josh Borrow, 5th April 2018 + +Useful Configuration Flags +========================== + +A description of the available options for all flags including the examples +below can be found by using +``./configure --help``. + +``--with-hydro=sphenix`` +~~~~~~~~~~~~~~~~~~~~~~~~ +There are several hydrodynamical schemes available in SWIFT. You can choose +between them at compile-time with this option. + +``--with-riemann-solver=none`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Some hydrodynamical schemes, for example GIZMO, require a Riemann solver. + +``--with-kernel=cubic-spline`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Several kernels are made available for use with the hydrodynamical schemes. +Choose between them with this compile-time flag. + +``--with-hydro-dimension=3`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Run problems in 1, 2, and 3 (default) dimensions. + +``--with-equation-of-state=ideal-gas`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Several equations of state are made available with this flag. + +``--with-cooling=none`` +~~~~~~~~~~~~~~~~~~~~~~~ +Several cooling implementations (including GRACKLE) are available. + +``--with-ext-potential=none`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Many external potentials are available for use with SWIFT. + +.. You can choose + between them at compile time. Some examples include a central potential, a + softened central potential, and a sinusoidal potential. You will need to + configure, for example, the mass in your parameter file at runtime. + + diff --git a/doc/onboardingGuide/source/what_swift_can_do.rst b/doc/onboardingGuide/source/what_swift_can_do.rst new file mode 100644 index 0000000000000000000000000000000000000000..cf97c7a2cb947e68a8487cae4304b2a183f8debd --- /dev/null +++ b/doc/onboardingGuide/source/what_swift_can_do.rst @@ -0,0 +1,21 @@ +What SWIFT can do +================= + +SWIFT can solve a variety of problems aimed at cosmological and +astrophysical applications. SWIFT's features include: + ++ Hydrodynamics, using a variety of particle methods ++ Planetary science, with e.g. multiple equations of state ++ Dark Matter ++ Neutrinos ++ Gravity: self-gravity and external potentials ++ Cosmology ++ Radiative cooling ++ Radiative transfer ++ On-the-fly analysis: halo finding (FOF), power spectra ++ And more! + +To enable and use these features, SWIFT needs to be compiled accordingly +and corresponding flags need to be passed at runtime. Please consult the +instructions provided in the `documentation <https://swiftsim.com/docs>`_ +for full details. diff --git a/examples/SmallCosmoVolume/SmallCosmoVolume_DM/plotProjection.py b/examples/SmallCosmoVolume/SmallCosmoVolume_DM/plotProjection.py new file mode 100644 index 0000000000000000000000000000000000000000..a13666ec4e53ccd7055f6f1c6bb826a30c2c5db6 --- /dev/null +++ b/examples/SmallCosmoVolume/SmallCosmoVolume_DM/plotProjection.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 + +# ------------------------------------------------ +# Plots a projection of the DM mass. +# usage: +# $ python3 plotProjection.py <snapnr> +# where <snapnr> is number of snapshot to plot +# ------------------------------------------------ + +import sys +import os +import matplotlib + +matplotlib.use("Agg") +from matplotlib import pyplot as plt +from matplotlib.colors import LogNorm + +from swiftsimio import load +from swiftsimio.visualisation.projection import project_pixel_grid +from swiftsimio.visualisation.smoothing_length_generation import ( + generate_smoothing_lengths, +) + + +# Grab snapshot + +snapshot_basename = "snap" + +try: + snapnr = sys.argv[1] +except IndexError: + print("You need to provide the index of the snapshot to plot.") + print("E.g. python3 plotProjection.py 3") + quit() + +try: + snapnr_int = int(snapnr) +except ValueError: + print("<snapnr> must be an integer.") + print("You provided :'" + snapnr + "'") + +file = snapshot_basename + "_" + str(snapnr_int).zfill(4) + ".hdf5" + +if not os.path.isfile(file): + print("Didn't find snapshot", file) + quit() + + +# Load data +data = load(file) +meta = data.metadata +boxsize = meta.boxsize +extent = [0, boxsize[0].v, 0, boxsize[1].v] + +# Generate smoothing lengths for the dark matter +data.dark_matter.smoothing_length = generate_smoothing_lengths( + data.dark_matter.coordinates, + data.metadata.boxsize, + kernel_gamma=1.8, + neighbours=57, + speedup_fac=2, + dimension=3, +) + +# Project the dark matter mass +dm_mass = project_pixel_grid( + # Note here that we pass in the dark matter dataset not the whole + # data object, to specify what particle type we wish to visualise + data=data.dark_matter, + boxsize=data.metadata.boxsize, + resolution=1024, + project="masses", + parallel=True, + region=None, +) + + +# Make figure an plot +fig = plt.figure(figsize=(6, 5), dpi=200) +ax = fig.add_subplot(111) +im = ax.imshow(dm_mass.T, origin="lower", extent=extent, cmap="inferno", norm=LogNorm()) +plt.colorbar(im) + +# Add xlabels +xunits = data.dark_matter.coordinates.units.latex_representation() +ax.set_xlabel("x [" + xunits + "]", usetex=True) +ax.set_ylabel("y [" + xunits + "]", usetex=True) + + +# Add title +title = file.replace("_", r"\_") # exception handle underscore for latex +if meta.cosmology is not None: + title += ", $z$ = {0:.3f}".format(meta.z) +title += ", $t$ = {0:.2e}".format(meta.time.to("Gyr")) +fig.suptitle(title, usetex=True) + +# Save figure +plt.tight_layout() +figname = file[:-5] + ".png" +plt.savefig(figname) +plt.close() + + +print("saved", figname) diff --git a/examples/SmallCosmoVolume/SmallCosmoVolume_hydro/plotProjection.py b/examples/SmallCosmoVolume/SmallCosmoVolume_hydro/plotProjection.py new file mode 100755 index 0000000000000000000000000000000000000000..5f3385eb17add9353e5493ae3dfd2d0a231bcd7b --- /dev/null +++ b/examples/SmallCosmoVolume/SmallCosmoVolume_hydro/plotProjection.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 + +# ------------------------------------------------ +# Plots a projection of the DM and baryon mass +# usage: +# $ python3 plotProjection.py <snapnr> +# where <snapnr> is number of snapshot to plot +# ------------------------------------------------ + +import sys +import os +import matplotlib + +matplotlib.use("Agg") +from matplotlib import pyplot as plt +from matplotlib.colors import LogNorm +from mpl_toolkits.axes_grid1 import make_axes_locatable + +from swiftsimio import load +from swiftsimio.visualisation.projection import project_pixel_grid, project_gas +from swiftsimio.visualisation.smoothing_length_generation import ( + generate_smoothing_lengths, +) + +from unyt import msun, kpc + + +def set_colorbar(ax, im): + """ + Adapt the colorbar a bit for axis object <ax> and + imshow instance <im> + """ + divider = make_axes_locatable(ax) + cax = divider.append_axes("right", size="5%", pad=0.05) + plt.colorbar(im, cax=cax) + return + + +# Grab snapshot + +snapshot_basename = "snapshots/snap" + +try: + snapnr = sys.argv[1] +except IndexError: + print("You need to provide the index of the snapshot to plot.") + print("E.g. python3 plotProjection.py 3") + quit() + +try: + snapnr_int = int(snapnr) +except ValueError: + print("<snapnr> must be an integer.") + print("You provided :'" + snapnr + "'") + +file = snapshot_basename + "_" + str(snapnr_int).zfill(4) + ".hdf5" + +if not os.path.isfile(file): + print("Didn't find snapshot", file) + quit() + + +# Load data +data = load(file) +meta = data.metadata +boxsize = meta.boxsize +extent = [0, boxsize[0].v, 0, boxsize[1].v] + +# Generate smoothing lengths for the dark matter +data.dark_matter.smoothing_length = generate_smoothing_lengths( + data.dark_matter.coordinates, + data.metadata.boxsize, + kernel_gamma=1.8, + neighbours=57, + speedup_fac=2, + dimension=3, +) + +# Project the dark matter mass +dm_mass = project_pixel_grid( + # Note here that we pass in the dark matter dataset not the whole + # data object, to specify what particle type we wish to visualise + data=data.dark_matter, + boxsize=data.metadata.boxsize, + resolution=1024, + project="masses", + parallel=True, + region=None, +) + + +# Project the gas mass +mass_map = project_gas(data, resolution=1024, project="masses", parallel=True) +mass_map.convert_to_units(msun / kpc ** 2) + + +# Make figure an plot +fig = plt.figure(figsize=(12, 5), dpi=200) + +ax1 = fig.add_subplot(121) +im1 = ax1.imshow( + dm_mass.T, origin="lower", extent=extent, cmap="inferno", norm=LogNorm() +) +ax1.set_title("Dark Matter Mass", usetex=True) +set_colorbar(ax1, im1) + +ax2 = fig.add_subplot(122) +im2 = ax2.imshow( + mass_map.T, origin="lower", extent=extent, cmap="inferno", norm=LogNorm() +) +ax2.set_title("Baryon Mass", usetex=True) +set_colorbar(ax2, im2) + + +# Add xlabels +xunits = data.dark_matter.coordinates.units.latex_representation() +for ax in [ax1, ax2]: + ax.set_xlabel("x [" + xunits + "]", usetex=True) + ax.set_ylabel("y [" + xunits + "]", usetex=True) + + +# Add title +title = file.replace("_", r"\_") # exception handle underscore for latex +if meta.cosmology is not None: + title += ", $z$ = {0:.3f}".format(meta.z) +title += ", $t$ = {0:.2e}".format(meta.time.to("Gyr")) +fig.suptitle(title, usetex=True) + +# Save figure +plt.tight_layout() +figname = file[:-5] + ".png" +plt.savefig(figname) +plt.close() + +print("saved", figname)