vice.singlezone.run

Run the simulation.

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

Parameters

xsinglezone

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.

Returns

outoutput [only returned if capture == True]

An output object produced from this simulation’s output.

Raises

  • TypeError
    • Any functional attribute evaluates to a non-numerical value.

  • ValueError
    • Any element of output_times is negative.

    • An inflow metallicity evaluates to a negative value.

  • ArithmeticError
    • Any functional attribute evaluates to NaN or inf.

  • UserWarning
    • Any yield settings or class attributes are callable and the user does not have dill installed.

    • Output times are more finely spaced than the timestep size.

  • ScienceWarning
    • Any element tracked by the simulation is enriched in signifcant part by r-process nucleosynthesis.

    • Any element tracked by the simulation has a weakly constrained solar abundance measurement.

  • VisibleRuntimeWarning
    • The attribute RIa is a user-defined function.

    • Any of the elements tracked by the simulation have AGB star yields described by a user-defined function.

    • The model is running with a mass-lifetime relation which requires numerical solutions to the inverse function (i.e. mass as a function of lifetime).

Notes

Note

Calling this function only causes VICE to produce the output files. The output 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.

Example Code

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