Skip to content

Commit

Permalink
Added Model Doc Page (#26)
Browse files Browse the repository at this point in the history
* Added Model Doc Page

* Added files for new CSVY doc page
  • Loading branch information
marxwillia authored and wkerzendorf committed Jul 22, 2019
1 parent 0149d89 commit e0f5a04
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/models/examples/abundancecust.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _abundancecust:

*************************************
Using a custom stratified composition
*************************************
Expand Down
30 changes: 30 additions & 0 deletions docs/models/examples/csvy_full_rad.csvy
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: csvy_full
model_density_time_0: 1 day
description: Example csvy config file for TARDIS.
tardis_model_config_version: v1.0
datatype:
fields:
- name: velocity
unit: km/s
desc: velocities of shell outer bounderies.
- name: density
unit: g/cm^3
desc: density of shell.
- name: t_rad
unit: K
desc: radiative temperature.
- name: H
desc: fractional H abundance
- name: He
desc: fractional He abundance
- name: Ni56
desc: fractional Ni56 abundance

v_inner_boundary: 9000 km/s
v_outer_boundary: 12000 km/s
---
velocity,density,t_rad,H,He,Ni56
9000, 5e-10, 7000, 1.0, 1.0, 1.0
10500, 2.0e-10, 7000, 0.0, 0.99, 0.01
12000, 9e-11, 7000, 0.4, 0.58, 0.02
2 changes: 2 additions & 0 deletions docs/models/examples/densitycust.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _densitycust:

******************************
Using a custom density profile
******************************
Expand Down
2 changes: 2 additions & 0 deletions docs/models/examples/modelconfig.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _modelconfig:

**************************
Ejecta Model Configuration
**************************
Expand Down
43 changes: 43 additions & 0 deletions docs/models/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,47 @@
Model
*****

TARDIS requires a model of the homologously expanding ejecta in order to run a simulation.
A model will include information like the velocity shell structure, abundances, density, etc.
TARDIS offers two ways of specifying the model: either directly in the configuration yaml file
or separately in a model.csvy file. See `here <https://csvy.org/>`_ for an explanation of
the csvy file format and :ref:`here <../running/configuration/config-file>` for a link to the csvy_model schema.

.. note::
We highly recommend using the cleaner csvy format.

CSVY Model
==========

The TARDIS YAML delimiter for csvy files is ``---``. This means that each csvy model
file has the following structure: The first line of the file is the YAML delimiter,
followed by the YAML portion of the csvy model. A line consisting of only the YAML
delimiter separates the YAML portion of the csvy file from the csv part. The YAML part
of the csvy file is for setting model parameters like **v_inner_boundary** or
**model_density_time_0** while the csv part of the file is for setting profiles of
physical parameters of the model (e.g. abundances, radiative temperature, dilution factor, etc).
If you use the csvy model, then you will need to specify the path to the csvy model file
in the main TARDIS configuration file:

.. code-block::
csvy_model: /path/to/model.csvy
Example CSVY Model
==================

Below we provide an example model.csvy file.

.. literalinclude:: examples/csvy_full_rad.csvy

Using the Config Model
======================

Although we strongly recommend using the CSVY Model, TARDIS also allows the user
to define custom density and abundance profiles in separate files and reference
these files directly in the main TARDIS configuration file. For further details,
see the following links:

* For general information: :ref:`modelconfig`
* For defining a custom density file: :ref:`densitycust`
* For defining a custom abundance file: :ref:`abundancecust`
152 changes: 152 additions & 0 deletions docs/running/configuration/schemas/csvy_model.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
$schema: http://json-schema.org/draft-04/schema#
type: object
additionalProperties: false
properties:
name:
type: string
description: name of the model being run

model_density_time_0:
type: quantity
description: Initial time for the density in the model

model_isotope_time_0:
type: quantity
default: -1 day
description: initial time for isotope decay

description:
type: string
description: description of the model being run

tardis_model_config_version:
type: string
description: Version of the configuration file

# datatype name used for consistency with astropy ecsv files.
datatype:
type: object
description: fields found in csv part of csvy file
additionalProperties: False
properties:
fields:
type: array

v_inner_boundary:
type: quantity
description: velocity of the inner boundary

v_outer_boundary:
type: quantity
description: velocity of the outer boundary of the last shell

velocity:
type: object
properties:
start:
type: quantity
stop:
type: quantity
num:
type: number
multipleOf: 1.0

density:
oneOf:
- $ref: '#/definitions/density/branch85_w7'
- $ref: '#/definitions/density/exponential'
- $ref: '#/definitions/density/power_law'
- $ref: '#/definitions/density/uniform'

abundance:
$ref: '#/definitions/abundance/uniform'

required:
- tardis_model_config_version

definitions:
density:
branch85_w7:
type: object
additionalProperties: false
properties:
type:
enum:
- branch85_w7
w7_time_0:
type: quantity
default: 0.000231481 day
description: This needs no change - DO NOT TOUCH
w7_rho_0:
type: quantity
default: 3e29 g/cm^3
description: This needs no change - DO NOT TOUCH
w7_v_0:
type: quantity
default: 1 km/s
description: This needs no change - DO NOT TOUCH
exponential:
type: object
additionalProperties: false
properties:
type:
enum:
- exponential
time_0:
type: quantity
description: Time at which the pure model densities are right
rho_0:
type: quantity
description: density at time_0
v_0:
type: quantity
description: at what velocity the density rho_0 applies
required:
- rho_0
- v_0
power_law:
type: object
additionalProperties: false
properties:
type:
enum:
- power_law
time_0:
type: quantity
description: Time at which the pure model densities are right
rho_0:
type: quantity
description: density at time_0
v_0:
type: quantity
description: at what velocity the density rho_0 applies
exponent:
type: number
description: exponent for exponential density profile
required:
- rho_0
- v_0
- exponent
uniform:
type: object
additionalProperties: false
properties:
type:
enum:
- uniform
time_0:
type: quantity
description: Time at which the pure model densities are right
value:
type: quantity
description: value for uniform density
required:
- value
abundance:
uniform:
type: object
additionalProperties: true
properties:
type:
enum:
- uniform
9 changes: 5 additions & 4 deletions tardis/io/schemas/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ properties:
tardis_config_version:
type: string
description: Version of the configuration file. The current version is 1.0 and no other versions are allowed
csvy_model:
type: string
description: Path to the csvy model file.
supernova:
$ref: supernova.yml
description: a section pertaining to observations of the supernova
Expand All @@ -17,9 +14,13 @@ properties:
plasma:
$ref: plasma.yml
description: configuration of the plasma microphysics
csvy_model:
type: string
$ref: csvy_model.yml
description: defining the model using csvy format
model:
$ref: model.yml
description: defining the model
description: defining the model in the config yaml file
montecarlo:
$ref: montecarlo.yml
description: configuring the physics of the monte carlo radiative transfer
Expand Down

0 comments on commit e0f5a04

Please sign in to comment.