Protocols

Numerical codes used to produce simulation data or post-process them are called Protocols in the Simulation Datamodel vocabulary. They can be of two types :

Any Protocol contains a set of Algorithm and a set of InputParameter. In addition, a SimulationCode contains a set of PhysicalProcess :

../_images/protocol_inheritance.png

Simu/Post-pro codes

To initialize a SimulationCode, you only need to set name and code_name properties. Here is a more complete example of a SimulationCode initialization with all optional attributes :

>>> from astrophysix.simdm.protocol import SimulationCode
>>> ramses = SimulationCode(name="Ramses 3 (MHD)", code_name="RAMSES", code_version="3.10.1",
...                         alias="RAMSES_3", url="https://www.ics.uzh.ch/~teyssier/ramses/RAMSES.html",
...                         description="This is a fair description of the Ramses code")

The same applies to the initialization of a PostProcessingCode.

Warning

Setting the SimulationCode.alias and PostProcessingCode.alias properties is necessary only if you wish to upload your study on the Galactica simulation database. See Why an alias ? and How can I check validity for Galactica ?

See also

Input parameters

To add InputParameter objects into any Protocol, use :

>>> from astrophysix.simdm.protocol import InputParameter
>>> # One-liner
>>> lmin = ramses.input_parameters.add(InputParameter(key="levelmin", name="Lmin",
...                                                   description="min. level of AMR refinement"))
# Or
>>> lmax = InputParameter(key="levelmax", name="Lmax", description="max. level of AMR refinement")
>>> ramses.input_parameters.add(lmax)

To initialize an InputParameter, only the InputParameter.name property must be set :

>>> # Input parameters should be initialised with at least a 'name' attribute.
>>> rho_min = InputParameter()
AttributeError : Input parameter 'name' attribute is not defined (mandatory).

See also

InputParameter API reference.

Algorithms

To add Algorithm objects into any Protocol, use :

>>> from astrophysix.simdm.protocol import Algorithm, AlgoType
>>> # One-liner
>>> voronoi = arepo.algorithms.add(Algorithm(algo_type=AlgoType.VoronoiMovingMesh,
...                                          description="Moving mesh based on a Voronoi-Delaunay tesselation."))
# Or
>>> voronoi = Algorithm(algo_type=AlgoType.VoronoiMovingMesh,
...                     description="Moving mesh based on a Voronoi-Delaunay tesselation.")
>>> arepo.algorithms.add(voronoi)

To initialize an Algorithm, only the Algorithm.algo_type property must be set :

>>> # Algorithm should be initialised with at least an 'algo_type' attribute.
>>> algo = Algorithm()
AttributeError : Algorithm 'algo_type' attribute is not defined (mandatory).

Available algorithm types are :

See also

Algorithm and AlgoType API references.

Physical processes

Note

For SimulationCode only.

To add PhysicalProcess objects into a SimulationCode, use the SimulationCode.physical_processes property.

>>> from astrophysix.simdm.protocol import PhysicalProcess, Physics
>>> # One-liner
>>> sf = ramses.physical_processes.add(PhysicalProcess(physics=Physics.StarFormation,
...                                                    description="Conversion of gas into massive star particles."))
# Or
>>> sf = PhysicalProcess(physics=Physics.StarFormation, description="Conversion of gas into massive star particles.")
>>> ramses.physical_processes.add(sf)

To initialize a PhysicalProcess, only the PhysicalProcess.physics property must be set :

>>> # PhysicalProcess should be initialised with at least a 'physics' attribute.
>>> process = PhysicalProcess()
AttributeError : PhysicalProcess 'physics' attribute is not defined (mandatory).

Available physics are :

See also

PhysicalProcess and Physics API references.