vice.multizone.run

Run the simulation.

Signature: x.run(output_times, capture = False, overwrite = False)

Parameters

xmultizone

An instance of this class.

output_timesarray-like [elements are real numbers]

The times in Gyr at which VICE should record output from the simulation. These need not be sorted from least to greatest.

capturebool [defaultFalse]

If True, an output object containing the results of the simulation will be returned.

overwritebool [defaultFalse]

If True, will force overwrite any files with the same name as the simulation output files.

picklebool [defaultTrue]

If True, VICE will save the attributes of this object with the output. See below.

Returns

outmultioutput [only returned if capture == True]

A multioutput object produced from this simulation’s output.

Raises

  • RuntimeError
    • A migration matrix cannot be setup properly according to the current specifications.

    • Any of the zones have duplicate names.

    • The timestep size is not uniform across all zones.

  • ScienceWarning
    • Any of the attributes IMF, recycling, delay, RIa, schmidt, schmidt_index, MgSchmidt, m_upper, m_lower, or Z_solar aren’t uniform across all zones.

Other exceptions are raised by vice.singlezone.run.

Notes

Note

Calling this function only causes VICE to produce the output files. The multioutput class handles the reading and storing of the simulation results.

Note

Saving functional attributes with VICE outputs requires the package dill, an extension to pickle in the python standard library. It is recommended that VICE users install dill >= 0.2.0.

Note

When overwrite == False, and there are files under the same name as the output produced, this acts as a halting function. VICE will wait for the user’s approval to overwrite existing files in this case. If users are running multiple simulations and need their integrations not to stall, they must specify overwrite = True.

Note

VICE will always write output at the final timestep of the simulation. This may be one timestep beyond the last element of the specified output_times array.

Note

If the keyword argument pickle == True, VICE will attempt to save a pickle of each attribute of this class. VICE may not be able to save some attributes, in particular those that are themselves instances of another class, especially if they have data or C-extensions attached to them.

These data make up a significant fraction of the disk usage of output files. Therefore, if many multizone models are to be ran, users are recommended to specify pickle = False to lower the storage space required. This will, however, render the vice.multizone.from_output function useless for that output.

Example Code

>>> import numpy as np
>>> import vice
>>> mz = vice.multizone(name = "example")
>>> outtimes = np.linspace(0, 10, 1001)
>>> mz.run(outtimes)