Class SimControls

Class Documentation

class SimControls

A class to hold simulation control flow information and physics settings.

Originally two separate classes – SimControls (control flow: IO, trial count, output timing) and SimPhysics (physics choices: IMF, tracks, spectral synthesis) – merged into one, since in practice almost every consumer (Cluster, SimCluster, OutputManager, every Specsyn-derived constructor) needed both together anyway, and keeping them separate produced duplicated state (e.g. the integrator tolerances below, which used to be copied into Specsyn and Cluster independently at construction time). Every object built by this class that itself needs the integrator tolerances – the spectral synthesizer built by readSpectra() – holds a live reference back to this object (see Specsyn’s own controls_ member) rather than a snapshot, so this object is neither copyable nor movable: its address must stay fixed for the lifetime of anything holding such a reference.

Public Types

enum class OutputMode : std::uint8_t

An enum to hold output modes.

Values:

enumerator h5

HDF5 output, consolidated into a single file (see OutputManagerH5’s own header comment on what this means when built with OpenMP)

enumerator h5divided

Same as h5, but skips the final consolidation step when built with OpenMP, leaving one HDF5 file per thread – preferable for very large runs where consolidating into a single file would itself be costly

enumerator ascii

ASCII output

enum class SimType : std::uint8_t

An enum to hold simulation types.

Values:

enumerator cluster

Cluster simulation

enumerator galaxy

Galaxy simulation

enumerator none

Dummy value

Public Functions

SimControls() = default

Default-construct a SimControls with all defaults.

Produces a SimControls with every control-flow parameter at its default value (simType = none, verbosity = 0, nTrial = 1, etc.) and every physics setting left invalid/empty (no IMF, no tracks, no spectral synthesizer, …). Intended for use where only the control-flow defaults (in particular the integrator tolerances) matter, not the physics settings – see io::defaultControls() in the Python bindings for the shared instance used for exactly this purpose.

explicit SimControls(const toml::table &inputDeck)

Initialize the simulation controls and physics settings from the input deck.

Parameters:

inputDeck – A toml table holding the input deck

SimControls(const SimControls&) = delete
auto operator=(const SimControls&) -> SimControls& = delete
SimControls(SimControls&&) = delete
auto operator=(SimControls&&) -> SimControls& = delete
~SimControls() = default
inline auto simType() const

Return simulation type.

Returns:

Simulation type

inline auto outputMode() const

Return output mode.

Returns:

Output mode

inline auto modelName() const

Return model name.

Returns:

Model name

inline auto outDir() const

Return output directory.

This is the directory into which output will be written. An empty string (the default) means output will be written into the current working directory.

Returns:

Output directory

inline auto verbosity() const

Return verbosity level.

Returns:

Verbosity level

inline auto strictInput() const

Whether an input-deck key that is never used is an error.

Returns:

The value of the optional top-level strict_input key, false by default. If false, such a key only produces a warning (see unusedKeys()).

inline auto unusedKeys() const -> const std::vector<utils::DeckKeyReport>&

Input-deck keys that were never used.

Returns:

One report per key, in path order: its path, its line in the deck (0 if the deck was not parsed from text), and a hint for what it may have been meant to be (empty if none). Empty for a deck with no stray keys. Filled in at the end of construction, and empty for a default-constructed SimControls.

inline auto ignoredKeys() const -> const std::vector<utils::DeckKeyReport>&

Input-deck keys that were valid but deliberately not read.

Returns:

One report per key, in path order, each with the reason it was skipped, e.g. “nebular.compute_neb is false”. These are not stray: the key is fine, but nothing in this simulation uses it.

inline auto nTrial() const

Return number of trials in the simulation.

Returns:

Number of trials

inline auto outTimes() const -> std::vector<double>

Return the times at which output should occur.

If explicit output times were specified in the input deck (either directly, or as a uniformly- or log-spaced grid), returns a copy of that array. If instead a distribution of output times was specified, returns a single-element vector containing one time drawn from that distribution.

Returns:

A vector of output times

inline auto intRelTol() const

Return the relative tolerance for PDF integration.

Returns:

Relative tolerance passed to PDFIntegrator (default 1e-2)

inline auto intAbsTol() const

Return the absolute tolerance for PDF integration.

Returns:

Absolute tolerance passed to PDFIntegrator (default 1e-3)

inline auto intMaxIter() const

Return the maximum number of bisection iterations for PDF integration.

Returns:

Max bisection iterations passed to PDFIntegrator (0 = unlimited; default 2^19 – see intMaxIter_’s own comment for why); not a count of raw integrand evaluations, which each iteration costs several of – see GKIntegrator:: integrate()’s own comment

inline auto z() const

Return the redshift.

Returns:

Redshift applied by every Specsyn’s and Extinct’s own wlObs() (default 0, i.e. no redshift)

inline auto checkpointInterval() const

Return the checkpoint interval, in trials.

Returns:

The number of trials between checkpoints; 0 (the default) means checkpointing is disabled. See OutputManagerH5::checkpoint()’s own comment for what a non-zero value actually does.

inline auto inputDeckStr() const -> const std::string&

Return the input deck’s own text.

Read by OutputManagerH5/OutputManagerAscii to record the deck verbatim into the output file for provenance, so that a SimControls built without a backing input deck at all (e.g. from Python) still gives them something equivalent to record – unlike the six output.write_* flags (see writeCluster() and its own siblings, just below), computed and cached once, at construction, this has no corresponding setter: unlike those flags, there is no legitimate reason for a caller to override what deck actually built this SimControls.

Returns:

The toml table this SimControls was constructed from, re-serialized back to text – not necessarily byte-identical to whatever text/file originally produced that table (toml++’s own operator<<, not the original source, does the formatting), but parses back to an equivalent table. Empty if this SimControls was built by the default constructor, with no input deck at all.

inline auto writeCluster() const

Whether the clusters group/file should be written.

Returns:

True (the default) unless output.write_cluster was set to false in the input deck; see OutputManager’s own constructor for how this is enforced

inline auto writeClusterSpec() const

Whether the cluster_spectra group/file should be written.

Returns:

True (the default) unless output.write_cluster_spec was set to false in the input deck; see OutputManager’s own constructor for how this is enforced

inline auto writeClusterPhot() const

Whether the cluster_phot group/file should be written.

Returns:

True (the default) unless output.write_cluster_phot was set to false in the input deck; see OutputManager’s own constructor for how this is enforced

inline auto writeGalaxy() const

Whether the galaxy group/file should be written.

Returns:

True (the default) unless output.write_galaxy was set to false in the input deck; only meaningful for a galaxy-type simulation – see OutputManager’s own constructor for how this is enforced

inline auto writeGalaxySpec() const

Whether the galaxy_spectra group/file should be written.

Returns:

True (the default) unless output.write_galaxy_spec was set to false in the input deck; only meaningful for a galaxy-type simulation – see OutputManager’s own constructor for how this is enforced

inline auto writeGalaxyPhot() const

Whether the galaxy_phot group/file should be written.

Returns:

True (the default) unless output.write_galaxy_phot was set to false in the input deck; only meaningful for a galaxy-type simulation – see OutputManager’s own constructor for how this is enforced

inline auto writeClusterYields() const

Whether the cluster_yields group/file should be written.

Returns:

True (the default) unless output.write_cluster_yields was set to false in the input deck; see OutputManager’s own constructor for how this is enforced

inline auto writeGalaxyYields() const

Whether the galaxy_yields group/file should be written.

Returns:

True (the default) unless output.write_galaxy_yields was set to false in the input deck; only meaningful for a galaxy-type simulation – see OutputManager’s own constructor for how this is enforced

inline auto writeClusterFeedback() const

Whether the cluster_feedback group/file should be written.

Returns:

True (the default) unless output.write_cluster_feedback was set to false in the input deck; see OutputManager’s own constructor for how this is enforced

inline auto writeGalaxyFeedback() const

Whether the galaxy_feedback group/file should be written.

Returns:

True (the default) unless output.write_galaxy_feedback was set to false in the input deck; only meaningful for a galaxy-type simulation – see OutputManager’s own constructor for how this is enforced

inline void setIntRelTol(double tol)

Set the relative tolerance for PDF integration.

Any spectral synthesizer built by this SimControls (see specsyn()) reads this value live, not a snapshot, so the new tolerance takes effect the next time it integrates – no need to rebuild the synthesizer or any Cluster built from this SimControls.

Parameters:

tol – New relative tolerance

inline void setIntAbsTol(double tol)

Set the absolute tolerance for PDF integration.

See setIntRelTol()’s own comment on live (not snapshotted) effect.

Parameters:

tol – New absolute tolerance

inline void setIntMaxIter(std::size_t n)

Set the maximum number of bisection iterations for PDF integration.

See setIntRelTol()’s own comment on live (not snapshotted) effect.

Parameters:

n – New maximum (0 = unlimited); not a count of raw integrand evaluations – see intMaxIter_’s own comment

inline void setZ(double z)

Set the redshift.

Every Specsyn/Extinct built by this SimControls reads this value live, not a snapshot (see z()), so the new redshift takes effect the next time their own wlObs() is called – no need to rebuild them.

Parameters:

z – New redshift

inline void setCheckpointInterval(unsigned long interval)

Set the checkpoint interval, in trials.

Unlike setting output.checkpoint_interval in an input deck, this plain setter does not check outputMode() – a caller (e.g. from Python) could use it to set up the same illegal combination (a non-zero interval with ascii output) the constructor rejects when parsing a real input deck. That combination is instead caught defensively where it would actually matter, by OutputManagerAscii::checkpoint() throwing (see its own comment), rather than here.

Parameters:

interval – New checkpoint interval; 0 disables checkpointing

inline void setModelName(std::string name)

Set the model name.

Like modelName_ itself, this is read by an OutputManager at its own construction, not live, so assigning this only affects an OutputManager built from this SimControls afterward, not one already built from it.

Parameters:

name – New model name (base name of output file(s))

inline void setOutDir(std::string dir)

Set the output directory.

Like outDir_ itself, this is read by an OutputManager at its own construction, not live, so assigning this only affects an OutputManager built from this SimControls afterward, not one already built from it.

Parameters:

dir – New output directory path; empty string means the current working directory

inline void setNTrial(unsigned long n)

Set the number of trials.

Parameters:

n – New number of trials

inline void setOutputMode(OutputMode mode)

Set the output mode.

Like outputMode_ itself, this determines what kind of OutputManager is built, so assigning this only affects an OutputManager built from this SimControls afterward, not one already built from it.

Parameters:

mode – New output mode

inline void setVerbosity(unsigned int verbosity)

Set the verbosity level.

Parameters:

verbosity – New verbosity level (0 = no extra output)

inline void setOutTimes(std::vector<double> times)

Set the output times.

Replaces any times or time distribution set by the input deck. Clears outTimeDist_ since outTimes_ and outTimeDist_ are mutually exclusive: outTimes() returns the explicit vector when non-empty, and draws from outTimeDist_ only when outTimes_ is empty (see outTimes()’s own body).

Parameters:

times – New output times, in years

inline void setWriteCluster(bool value)

Set whether the clusters group/file should be written.

Lets a caller (e.g. from Python, where there is no output.write_cluster input-deck entry to set this through) enable or suppress cluster output on an already-constructed SimControls. Unlike setIntRelTol()/setZ()/etc., this is not read live by an already-built OutputManagerH5/ OutputManagerAscii: each one decides once, at its own construction, which groups/files to create at all (see OutputManager’s own constructor), so this setter only affects an OutputManagerH5/OutputManagerAscii built from this SimControls afterward, not one already built from it.

Parameters:

value – New value for writeCluster()

inline void setWriteClusterSpec(bool value)

Set whether the cluster_spectra group/file should be written.

See setWriteCluster()’s own comment on when this does (and does not) take effect.

Parameters:

value – New value for writeClusterSpec()

inline void setWriteClusterPhot(bool value)

Set whether the cluster_phot group/file should be written.

See setWriteCluster()’s own comment on when this does (and does not) take effect.

Parameters:

value – New value for writeClusterPhot()

inline void setWriteGalaxy(bool value)

Set whether the galaxy group/file should be written.

Only meaningful for a galaxy-type simulation. See setWriteCluster()’s own comment on when this does (and does not) take effect.

Parameters:

value – New value for writeGalaxy()

inline void setWriteGalaxySpec(bool value)

Set whether the galaxy_spectra group/file should be written.

Only meaningful for a galaxy-type simulation. See setWriteCluster()’s own comment on when this does (and does not) take effect.

Parameters:

value – New value for writeGalaxySpec()

inline void setWriteGalaxyPhot(bool value)

Set whether the galaxy_phot group/file should be written.

Only meaningful for a galaxy-type simulation. See setWriteCluster()’s own comment on when this does (and does not) take effect.

Parameters:

value – New value for writeGalaxyPhot()

inline void setWriteClusterYields(bool value)

Set whether the cluster_yields group/file should be written.

See setWriteCluster()’s own comment on when this does (and does not) take effect.

Parameters:

value – New value for writeClusterYields()

inline void setWriteGalaxyYields(bool value)

Set whether the galaxy_yields group/file should be written.

Only meaningful for a galaxy-type simulation. See setWriteCluster()’s own comment on when this does (and does not) take effect.

Parameters:

value – New value for writeGalaxyYields()

inline void setWriteClusterFeedback(bool value)

Set whether the cluster_feedback group/file should be written.

See setWriteCluster()’s own comment on when this does (and does not) take effect.

Parameters:

value – New value for writeClusterFeedback()

inline void setWriteGalaxyFeedback(bool value)

Set whether the galaxy_feedback group/file should be written.

Only meaningful for a galaxy-type simulation. See setWriteCluster()’s own comment on when this does (and does not) take effect.

Parameters:

value – New value for writeGalaxyFeedback()

inline void setYieldsChannelDecomposed(bool value)

Set whether yields should be reported decomposed by channel.

Unlike setWriteCluster()/etc., this is read live by Cluster::computeYields()/Galaxy::computeYields() (to decide how many entries their own yields_/fieldYields_ accumulate) and by OutputManagerH5::openClusterYieldsGroup()/ openGalaxyYieldsGroup() (to size the “yields” dataset’s own column count) every time each runs, not cached once – so this takes effect immediately, the same as setZ()/ setIntRelTol(), rather than only affecting an object built afterward. Changing this on a SimControls with an already-running simulation partway through a cluster’s/ galaxy’s own lifetime would leave that cluster’s/galaxy’s own yields_ inconsistent with the new setting until its next advance() call recomputes it from scratch – not a concern for the ordinary use case of setting this once, before a run starts.

Parameters:

value – New value for yieldsChannelDecomposed()

inline void setNoDecay(bool value)

Set whether radioactive decay should be excluded from computed yields.

See noDecay()’s own comment for what this controls. Like setYieldsChannelDecomposed(), this is read live by Yields::yield()/yieldSum() every time either runs, not cached once, so it takes effect immediately rather than only affecting a Yields built afterward.

Parameters:

value – New value for noDecay()

void setMinIsotopeLifetime(double value)

Set the minimum isotope lifetime below which isotopes are treated as decaying instantly.

Unlike setNoDecay(), this changes which isotopes yields() tabulates, so if yields() is non-null it is rebuilt at once, via Yields::rebuildYieldGrid(), passing that Yields’ own requestedIsotopes() so that any isotope restriction (e.g. from yields.isotopes) is kept. If that rebuild throws (e.g. because every requested isotope would now be skipped), the old value is restored, yields() rebuilt with it, and the exception rethrown. Clusters or galaxies already holding yields computed on the old isotope list are not updated – as with any rebuildYieldGrid() call, set this before a run starts.

Parameters:

value – New value for minIsotopeLifetime(), in yr; any non-negative value, including +infinity (every unstable isotope decays instantly), is allowed

Throws:

std::invalid_argument – if value is negative or NaN; this SimControls is then left unchanged

inline auto imf() const -> const auto&

Get simulation initial mass function.

Returns:

Pointer to the simulation initial mass function

inline auto cmf() const -> const auto&

Get simulation cluster mass function.

Returns:

Pointer to the simulation cluster mass function

inline auto fehDist() const -> const auto&

Get simulation [Fe/H] distribution.

Returns:

Pointer to the simulation [Fe/H] distribution

inline auto constFeH() const

Check whether the simulation has a spread in [Fe/H].

Returns:

True if the simulation has a fixed value of [Fe/H]

inline auto sfr() const -> const auto&

Get simulation star formation rate.

Returns:

A const reference to the star formation rate, in Msun/yr as a function of time – see buildConstantSFR()’s own comment for the exact meaning; invalid/empty if galaxy.sfr_dist was given instead of galaxy.sfr (see sfrDist()’s own comment)

inline auto sfrDist() const -> const auto&

Get the distribution from which a single, constant star formation rate is drawn.

Unlike sfr() itself (a rate as a function of time, in general), this is a distribution over a single, scalar rate value – exactly one of galaxy.sfr/galaxy.sfr_dist is required for a galaxy-type simulation (see the constructor’s own comment, in the .cpp file, for the exact rule). When sfr_dist is the one given, no SimControls-level rate exists at all: each Galaxy instead draws its own, independent constant rate from this distribution at construction, via buildConstantSFR() – see Galaxy::Galaxy()’s own comment.

Returns:

A const reference to the distribution requested via galaxy.sfr_dist; invalid/empty if galaxy.sfr was given instead (see sfr()’s own comment)

inline auto clf() const -> const auto&

Get simulation cluster lifetime function.

Returns:

Pointer to the simulation cluster lifetime function

inline auto fCluster() const

Get the fraction of stellar mass formed in stochastically-treated clusters.

Returns:

The fraction of a galaxy simulation’s stellar mass that forms in clusters treated stochastically (as individual Cluster objects); the remaining (1 - fCluster()) is treated as a stellar population continuous in both mass and time. Defaults to 1.0 (every star forms in a stochastic cluster); only meaningful for, and only read from, a galaxy-type simulation’s own clusters.f_cluster.

inline auto tracks() const -> std::shared_ptr<const tracks::Tracks3D>

Get simulation stellar tracks.

Returns:

A shared_ptr to the simulation stellar tracks; null only if this SimControls was default-constructed (no input deck, e.g. io::defaultControls() in the Python bindings) – like specsyn()/extinct()/nebular()/yields(), no code is expected to call this on such an instance. Once built from an input deck, this is never null, and setTracks() does not accept null either. Returned by shared_ptr, not raw pointer/reference, so a caller that read this before a later setTracks() call keeps its own copy of the original tracks fully valid and usable, independent of whatever tracks_ points to afterward.

inline auto tracks2D() const -> std::shared_ptr<const tracks::Tracks2D>

Get the tracks sliced to this simulation’s fixed [Fe/H].

Only valid to call if constFeH() is true. This slice is computed once, in the constructor, and cached for the lifetime of this SimControls object, so that Cluster objects sharing a single [Fe/H] value across a simulation can all query it directly instead of each computing (or racing to compute) their own copy. Returned by shared_ptr – see tracks()’s own comment on why.

Returns:

A shared_ptr to a Tracks2D object sliced at fehDist_’s (single) value, or nullptr if constFeH() is false

inline auto minStochMass() const

Get minimum mass for fully stochastic treatment.

Returns:

Minimum mass for fully stochastic treatment

inline auto fracStochMass() const

Get fraction of stellar mass being treated stochastically.

Returns:

Fraction of stellar mass being treated stochastically: the fraction of the total mass of a population drawn from imf() that is in stars of mass >= minStochMass() – see updateFracStochMass()’s own comment

inline auto nonStochIMFMass() const -> double

Get the mass per star, averaged over the whole IMF, of the part of the IMF treated non-stochastically.

This is the normalization that converts an integral of a per-star quantity f(m) against imf() over the non-stochastic mass range, int f(m) p(m) dm, into that quantity per unit mass of non-stochastic stars: a non-stochastic population of total mass M contains M * p(m) dm / nonStochIMFMass() stars in [m, m + dm], so the total of f over it is M * int f(m) p(m) dm / nonStochIMFMass(). Equal to (1 - fracStochMass()) times the mean stellar mass of the whole IMF.

Returns:

The integral of m p(m) dm from imf().getMin() to minStochMass() (clamped to imf()’s own range), where p is imf() itself (normalized by number, so that p integrates to 1 over imf()’s whole range); 0 if minStochMass() <= imf().getMin(), i.e. if nothing is treated non-stochastically. For a delta-function IMF at a mass m0 below minStochMass(), this is m0 itself – the range [m0, m0] has zero width, but contains the whole IMF

inline auto specsyn() const -> std::shared_ptr<const specsyn::Specsyn>

Get the spectral synthesizer, if any.

Returns:

A shared_ptr to the spectral synthesizer requested via spectra.model, or nullptr if spectra.model was not given. Returned by shared_ptr, not raw pointer – see tracks()’s own comment on why (a caller that read this before a later setSpecsyn() call keeps its own copy fully valid, independent of what specsyn_ points to afterward).

inline auto filters() const -> std::shared_ptr<const phot::FilterCollection>

Get the filter collection used to compute photometry, if any.

Returns:

A shared_ptr to the filter collection requested via phot.filters, or nullptr if phot.filters was not given – see tracks()’s own comment on why this is a shared_ptr

inline auto avDist() const -> const auto&

Get the distribution of V-band extinction for clustered stars, if any.

Returns:

A const reference to the A_V distribution requested via extinct.AV; if neither extinct.AV nor extinct.AV_field was given, an invalid/empty PDF. If extinct.AV_field was given but extinct.AV was not, a valid delta function PDF at 0 (see readExtinct()’s own comment for why) – so avDist()/avDistField() are always either both valid or both invalid, never just one.

inline auto avDistField() const -> const auto&

Get the distribution of V-band extinction for field stars, if any.

Returns:

A const reference to the A_V distribution requested via extinct.AV_field – see avDist()’s own comment for the identical validity rules this mirrors (with extinct.AV_field/ extinct.AV’s own roles swapped)

inline auto avNebFac() const -> const auto&

Get the distribution of the ratio of nebular to stellar V-band extinction.

Returns:

A const reference to the distribution requested via the optional extinct.neb_factor key: the factor by which the V-band extinction applied to nebular emission exceeds that applied to the stellar light it accompanies (A_V,neb = f A_V), reflecting the observation that nebular emission is often more heavily extinguished than the starlight. Always valid: a delta function at 1 (nebular and stellar extinction equal) if extinct.neb_factor was not given, including when no extinction is applied at all. Always finite and never extends below 0 – see setAVNebFac().

inline auto outTimeDist() const -> const auto&

Get the distribution output times are drawn from.

Returns:

A const reference to the distribution requested via output.output_times, when that names a PDF; invalid/empty if output times were instead given as an explicit array (see outTimes())

inline auto allPDFs() const -> std::vector<std::pair<std::string, const pdfs::PDF*>>

List every PDF this SimControls holds, by name.

The single list of this class’s PDF members, for code that needs to handle all of them uniformly, e.g. writing them to an output file (see OutputManagerH5). The pointers are non-owning and valid for as long as this SimControls is, until the corresponding setting is changed.

Returns:

One (name, PDF) pair per PDF-valued setting, named by its own accessor – imf, cmf, fehDist, sfr, sfrDist, clf, avDist, avDistField, avNebFac, outTimeDist – including ones that are invalid/unused for this simulation (check PDF::valid() before using them)

inline auto extinct() const -> std::shared_ptr<const extinct::Extinct>

Get the extinction curve, if any.

Returns:

A shared_ptr to the extinction curve requested via extinct.model, or nullptr if neither extinct.AV nor extinct.AV_field was given – see tracks()’s own comment on why this is a shared_ptr

inline auto yieldChannels() const -> const std::vector<yields::YieldChannelDescriptor>&

Get the yield channels requested via the input deck’s own [yields] stanza.

Returns:

A const reference to the descriptors parsed from yields.channel1, yields.channel2, etc. (see readYields()’s own comment), empty if no yields.channelN table was found

inline auto yields() const -> std::shared_ptr<const yields::Yields>

Get the Yields built from yieldChannels(), if any.

Returns:

A shared_ptr to the Yields built from yieldChannels() and yields.registry (see readYields()), or nullptr if yieldChannels() is empty – see tracks()’s own comment on why this is a shared_ptr

inline auto yieldsChannelDecomposed() const

Whether yields should be reported decomposed by channel, or summed over all channels.

Meaningful only if yields() is non-null. True means each yield channel’s own contribution should be kept separate (one row per channel); false means every channel’s contribution should be summed together into one combined total per isotope – mirroring Yields::yield()’s own per-channel rows versus Yields::yieldSum()’s combined total.

Returns:

The value of the optional yields.channel_decomposed key (see readYields()), true by default

inline auto noDecay() const

Whether radioactive decay should be excluded from computed yields.

Meaningful only if yields() is non-null. False (the default) means Yields::yield()/yieldSum() report the amount of each isotope actually present at the requested output time, including whatever radioactive decay has occurred since it was produced; true means they instead report the cumulative amount of each isotope ever produced, regardless of whether some of it has since decayed into something else.

Returns:

The value of the optional yields.no_decay key (see readYields()), false by default

inline auto minIsotopeLifetime() const

Minimum isotope lifetime below which isotopes are treated as decaying instantly.

Meaningful only if yields() is non-null. Every unstable isotope with a shorter lifetime is dropped from yields()’s isotope list and treated as decaying the instant it is produced – see Yields::rebuildYieldGrid()’s own comment. This is accurate for yields at times long compared to this lifetime, and makes decay much cheaper to compute. 0 skips nothing.

Returns:

The value of the optional yields.min_isotope_lifetime key (see readYields()), in yr; yields:: defaultMinIsotopeLifetime (1e4 yr) by default

inline auto snMassLimits() const -> const std::vector<double>&

Get the stellar mass limits over which supernovae occur.

Returns:

The mass limits, in Msun: consecutive pairs (lower, upper) of limits, each pair giving one mass interval in which stars end their lives as supernovae – more than one pair describes disjoint intervals. Empty if no explicit limits were set, in which case hasSN() defers to yields() instead – see its own comment

void setSNMassLimits(std::vector<double> limits)

Set the stellar mass limits over which supernovae occur.

An empty limits is valid, and means hasSN() defers to yields() – see its own comment.

Parameters:

limits – New mass limits, in Msun, in the format described in snMassLimits()’s own comment

Throws:

std::invalid_argument – if limits has an odd number of elements, if any element is not finite and strictly positive, or if its elements are not strictly increasing; snMassLimits_ is left unchanged in this case

auto hasSN(double mass) const -> bool

Check whether a star of a given mass ends its life as a supernova.

for how this is decided

If snMassLimits() is non-empty, returns true if mass lies within any of its (lower, upper) intervals, inclusive of both ends, and false otherwise, regardless of yields(). If snMassLimits() is empty and yields() is non-null, returns yields()->hasYield(mass, yields::Channel::ccsn_), i.e. whether mass lies within the mass range of any core-collapse supernova yield channel loaded. If snMassLimits() is empty and yields() is null, returns false.

Parameters:

mass – Stellar mass (Msun)

Returns:

Whether a star of this mass ends its life as a supernova – see

auto hasSN(double mass, double feH) const -> bool

Check whether a star of a given mass and [Fe/H] ends its life as a supernova.

for how this is decided

Identical to hasSN(mass), including in giving snMassLimits(), if non-empty, precedence over yields() (in which case feH is ignored), except that when it defers to yields() it returns yields()->hasYield(mass, feH, yields::Channel::ccsn_) rather than yields()->hasYield(mass, yields::Channel::ccsn_) – so it also catches gaps within the core-collapse supernova yield channels’ own mass ranges where their tabulated yields are zero for every isotope, i.e. failed supernovae (see YieldChannel::hasYield(mass, feH)’s own comment).

Parameters:
  • mass – Stellar mass (Msun)

  • feH – [Fe/H] of the star

Returns:

Whether a star of this mass and [Fe/H] ends its life as a supernova – see

inline auto wrWindModel() const -> feedback::WRwindModel

Get the Wolf-Rayet wind velocity model.

Read live by Winds::vWindWR() on every call – see its own comment for what each model does – so changing it takes effect immediately, with no need to rebuild winds().

Returns:

The model selected by the optional feedback.wr_winds key (see readFeedback()), or set via setWRWindModel(); feedback::WRwindModel::nugisLamers00_ by default

inline void setWRWindModel(const feedback::WRwindModel model)

Set the Wolf-Rayet wind velocity model.

Parameters:

model – The new model – see wrWindModel()’s own comment

inline auto obWindModel() const -> feedback::OBwindModel

Get the O and B star wind velocity model.

Read live by Winds::vWindOB() on every call – see its own comment for what each model does – so changing it takes effect immediately, with no need to rebuild winds().

Returns:

The model selected by the optional feedback.ob_winds key (see readFeedback()), or set via setOBWindModel(); feedback::OBwindModel::vinkSander21_ by default

inline void setOBWindModel(const feedback::OBwindModel model)

Set the O and B star wind velocity model.

Parameters:

model – The new model – see obWindModel()’s own comment

inline auto agbWindModel() const -> feedback::AGBwindModel

Get the AGB star wind velocity model.

Read live by Winds::vWindAGB() on every call – see its own comment for what each model does – so changing it takes effect immediately, with no need to rebuild winds().

Returns:

The model selected by the optional feedback.agb_winds key (see readFeedback()), or set via setAGBWindModel(); feedback::AGBwindModel::slug2_ by default

inline void setAGBWindModel(const feedback::AGBwindModel model)

Set the AGB star wind velocity model.

Parameters:

model – The new model – see agbWindModel()’s own comment

inline auto otherWindModel() const -> feedback::OtherwindModel

Get the wind velocity model for all stars not covered by wrWindModel(), obWindModel(), or agbWindModel()

Read live by Winds::vWindOther() on every call – see its own comment for what each model does – so changing it takes effect immediately, with no need to rebuild winds().

Returns:

The model selected by the optional feedback.other_winds key (see readFeedback()), or set via setOtherWindModel(); feedback::OtherwindModel::vesc_ by default

inline void setOtherWindModel(const feedback::OtherwindModel model)

Set the wind velocity model for all other stars.

Parameters:

model – The new model – see otherWindModel()’s own comment

inline auto winds() const -> std::shared_ptr<const feedback::Winds>

Get the stellar wind calculator.

Returns:

A shared_ptr to the Winds built by readFeedback(), or later installed via setWinds(); nullptr for a SimControls built without an input deck, until one is installed – see tracks()’s own comment on why this is a shared_ptr

inline auto nebControls() const -> const nebular::NebularControls&

Get the nebular emission control parameters.

Returns:

A const reference to the control parameters populated from the input deck’s own [nebular] stanza (see readNebular()), or their own defaults for any key that was not given – except computeNeb_, which defaults to true only if a spectral synthesizer is available (see readNebular()’s own comment)

inline auto nebular() const -> std::shared_ptr<const nebular::Nebular>

Get the nebular emission grid, if any.

Returns:

A shared_ptr to the nebular emission grid built from nebControls() and the [nebular] stanza’s own table/track settings (see readNebular()), or nullptr if nebControls().computeNeb_ is false – see tracks()’s own comment on why this is a shared_ptr

inline auto computeLbol() const

Check whether the bolometric luminosity was requested as an output.

Returns:

True if “Lbol” was included in phot.filters

inline void setComputeLbol(bool value)

Set whether the bolometric luminosity should be computed as an output.

Lets a caller (e.g. from Python, where there is no phot.filters input-deck entry to set “Lbol” through) request or suppress Lbol output on an already-constructed SimControls.

Parameters:

value – New value for computeLbol()

void setIMF(const std::string &imf)

Set the initial mass function.

Like the constructor, also prints a warning (from the I/O rank only) if the new IMF extends below the tracks’ minimum mass – see checkIMFWithinTracks()’s own comment.

Parameters:

imf – A numerical value (interpreted as a delta-function IMF at that mass) or the name of an IMF PDF file, resolved relative to SLUG_DIR/REPO_DIR under data/imfs – the same way stars.IMF is resolved by the constructor

Throws:
  • std::runtime_error – if imf is not numeric and does not name a file that can be found

  • std::invalid_argument – if the new IMF’s maximum mass exceeds the current stellar tracks’ maximum mass, mMax(); this SimControls is then left unchanged

inline void setCMF(const std::string &cmf)

Set the cluster mass function.

Parameters:

cmf – A numerical value (interpreted as a delta-function CMF at that mass) or the name of a CMF PDF file

Throws:

std::runtime_error – if cmf is not numeric and does not name a file that can be found

void setFeH(const std::string &feH)

Set the [Fe/H] distribution.

Rejects (rather than accepts and later failing to interpolate) any new distribution whose [min, max] range is not a subset of tracks_’s own [fehMin(), fehMax()] – the range it was actually constructed to cover (via readTracks()), which tracks_ retains regardless of how fehDist_ has been amended since. Checking against tracks_ itself, rather than against fehDist_’s own current range, matters because fehDist_ may already have been narrowed by an earlier call to this method: were the check against fehDist_’s current range instead, a second amendment could be rejected for being broader than the first one even though both are within what tracks_ actually covers (e.g. narrow to [-1, 0], then try to narrow again to the unrelated but still in-range [-2, -1]). tracks_ is only ever loaded once, at construction, never re-loaded afterward, so widening fehDist_ past what tracks_ actually covers would risk interpolating it outside its own data. Narrowing, or otherwise staying within, that range is always safe and always accepted.

If the new fehDist_ is fixed (constFeH() becomes true), also recomputes tracks2D() (the [Fe/H]-sliced cache) from the current tracks_, mirroring the constructor’s own post-readTracks() step.

Parameters:

feH – A numerical value (interpreted as a fixed [Fe/H]) or the name of a [Fe/H] PDF file

Throws:

std::runtime_error – if feH is not numeric and does not name a file that can be found, or if its own [min, max] range is broader than tracks_’s own [fehMin(), fehMax()], or tracks_’s own range is NaN (a default-constructed Tracks3D), or it extends beyond the [requestedFehMin(), requestedFehMax()] range of the installed specsyn() or yields(), if any; this SimControls is then left unchanged

void setAVDist(const std::string &avDist)

Set the distribution of V-band extinction for clustered stars.

If this SimControls already has an extinction curve (extinct() is not null), also calls its own Extinct::rebuildCache() – avDist() itself is never actually read by Extinct (only avDistField() is, via applyExtinctionCts()/applyExtinctionCtsLines()), so this call is harmless rather than strictly necessary, but kept for symmetry with setAVDistField()’s own identical behavior, where it is actually needed.

Parameters:

avDist – A numerical value (interpreted as a delta- function A_V at that value) or the name of an A_V PDF file

Throws:

std::runtime_error – if avDist is not numeric and does not name a file that can be found

void setAVDistField(const std::string &avDistField)

Set the distribution of V-band extinction for field stars.

If this SimControls already has an extinction curve (extinct() is not null), also calls its own Extinct::rebuildCache(), so that its cached extinctionFacCts()/extinctionFacCtsLines() (used by applyExtinctionCts()/applyExtinctionCtsLines()) stay in sync with the new avDistField() – see Extinct::rebuildCache()’s own comment for why those aren’t simply recomputed on every access instead. If that call throws, avDistField() is left exactly as it was beforehand (rather than the new, rejected value): rebuildCache() reads avDistField() live, so avDistField_ must already hold the new value for that call to have any effect, but since rebuildCache() is itself failure-atomic, its own cache stays at its previous, valid state on failure either way – leaving avDistField_ at the new value in that case would make it describe a distribution extinct()’s own cache doesn’t actually reflect.

Parameters:

avDistField – A numerical value (interpreted as a delta-function A_V at that value) or the name of an A_V PDF file

Throws:

std::runtime_error – if avDistField is not numeric and does not name a file that can be found

void setAVNebFac(const std::string &avNebFac)

Set the distribution of the ratio of nebular to stellar V-band extinction.

If this SimControls already has an extinction curve (extinct() is not null), also calls its own Extinct::rebuildCache(), since its cached nebular extinction factors (used by applyExtinctionCts() with nebular = true, and applyExtinctionCtsLines()) depend on avNebFac() – with avNebFac() restored to its previous value if that call throws, exactly as setAVDistField() does for avDistField().

Parameters:

avNebFac – A numerical value (interpreted as a delta- function factor at that value) or the name of a PDF file – see avNebFac()’s own comment for what this factor is

Throws:

std::runtime_error – if avNebFac is not numeric and does not name a file that can be found, or if the resulting distribution extends below 0 (a negative extinction factor is unphysical) or is not finite (e.g. “nan” or “inf”); avNebFac() is left unchanged in either case

inline void setCLF(const std::string &clf)

Set the cluster lifetime function.

Parameters:

clf – A numerical value (interpreted as a delta-function CLF at that lifetime) or the name of a CLF PDF file

Throws:

std::runtime_error – if clf is not numeric and does not name a file that can be found

void setSFR(const std::string &sfr)

Set the star formation rate.

Mirrors the special handling the constructor itself applies to galaxy.sfr, unlike every setter above: a numerical value is not interpreted as a delta function, but as the normalization of a non-normalized PDF that is constant in time (see the .cpp file for the exact construction). A file name, unlike every setter above, is not resolved via utils::getFilePath – it is passed to pdfs::parsePDFDescriptor() as-is, exactly mirroring the constructor’s own galaxy.sfr handling. Also clears sfrDist_ back to invalid – see setSFRDist()’s own comment for why.

Parameters:

sfr – A numerical value (interpreted as a constant star formation rate, in Msun/yr) or the name of an SFR PDF file

Throws:

std::runtime_error – if sfr is neither numeric nor names a file that can be parsed as a PDF descriptor

inline void setSFRDist(const std::string &sfrDist)

Set the distribution from which a single, constant star formation rate is drawn.

Unlike setSFR(), this is a plain PDF-valued setter (a numerical value becomes a delta function, exactly as setCLF()/setCMF()/etc. already work) – see sfrDist()’s own comment for why sfrDist_ is a genuine distribution, not itself a rate as a function of time the way sfr_ is. Also clears sfr_ back to invalid: only one of sfr_/sfrDist_ is ever meant to be valid at a time (mirroring the exclusive-or rule the constructor enforces between galaxy.sfr/ galaxy.sfr_dist when parsing a real input deck), so setting one via its own setter invalidates the other, regardless of which was set first.

Parameters:

sfrDist – A numerical value (interpreted as a delta function at that rate – equivalent to just using setSFR() directly, but supported for consistency with every other PDF-valued setter) or the name of an SFR-distribution PDF file

Throws:

std::runtime_error – if sfrDist is not numeric and does not name a file that can be found

inline void setFCluster(double fCluster)

Set the fraction of stellar mass formed in stochastically-treated clusters.

Unlike setCLF()/setSFR(), fCluster_ is a plain double (not a pdfs::PDF), so this is a direct assignment, mirroring setZ()’s/setIntRelTol()’s own simple setters rather than setCLF()’s/setSFR()’s string-parsing ones.

Parameters:

fCluster – New fraction; see fCluster()’s own comment

inline void setNebControls(const nebular::NebularControls &nebControls)

Set the nebular emission control parameters.

Like setFCluster(), a plain direct assignment for logU_/covFac_/lineWidth_ – all three are read live, so updating them here takes effect the next time Nebular::getCluster()/getGalaxy() runs, with no need to rebuild anything. computeNeb_ is deliberately excluded from that assignment and left at whatever this SimControls was actually constructed with: unlike the other three fields, computeNeb_ only ever takes effect once, at construction (it decides whether readNebular() builds nebular_ at all – see nebular()’s own comment), so nebular()’s own null-ness cannot be changed after the fact by assigning here. Setting it here without also rebuilding/discarding nebular_ would silently desynchronize nebControls().computeNeb_ from nebular() itself (e.g. reporting computeNeb_ == false while nebular() stays non-null and Cluster/Galaxy keep computing nebular products from it, since they gate on nebular() being non-null, not on this flag).

Parameters:

nebControls – New control parameters; see nebControls()’s own comment

inline void setSpecsyn(std::unique_ptr<specsyn::Specsyn> specsyn)

Set the spectral synthesizer.

Lets a caller replace this SimControls’s spectral synthesizer with its own, without needing an input deck. If this SimControls already has an extinction curve (extinct() is not null), also calls its own Extinct::rebuildCache() – extinct_ reads controls_.specsyn()->wl() live every time it rebuilds (see Extinct::rebuildCache()’s own comment on why that isn’t simply re-read on every access instead), so without this, its cached wl()/extinct()/extinctionFacCts()/ extinctionFacCtsLines() would keep describing the previous spectral synthesizer’s own wavelength grid rather than this new one’s – mirrors setAVDistField()’s own identical amendment exactly.

Parameters:

specsyn – The spectral synthesizer to use; ownership is transferred to this SimControls. May be null, to remove the current one.

Throws:

std::invalid_argument – if specsyn is not null and was constructed against a different SimControls than *this (see Specsyn::controls()’s own comment) – a live reference bound elsewhere can’t be re-bound after the fact, so installing it here would leave it reading that other SimControls’s own tolerances/redshift live, not this one’s – or was constructed for a narrower [Fe/H] range than the current one (see checkSpecsynReplacement()); this SimControls is then left unchanged

inline void setFilters(std::unique_ptr<phot::FilterCollection> filters)

Set the photometric filter collection.

Lets a caller replace this SimControls’s filter collection with its own, without needing an input deck.

Parameters:

filters – The filter collection to use; ownership is transferred to this SimControls

void setTracks(std::unique_ptr<tracks::Tracks3D> tracks)

Set the stellar tracks.

Lets a caller replace this SimControls’s stellar tracks with its own, without needing an input deck. Rejecting tracks that do not cover fehDist() is the counterpart of setFeH()’s own check: every [Fe/H] the simulation can ask the tracks about is drawn from, or integrated over, fehDist(). On rejection, this SimControls is left unchanged. If constFeH() is true, also recomputes tracks2D() (the [Fe/H]-sliced cache) from the new tracks, mirroring setFeH()’s own amendment (see its comment) so the cache never goes stale relative to whichever of tracks_/fehDist_ changed most recently.

Parameters:

tracks – The stellar tracks to use; ownership is transferred to this SimControls. Must not be null – unlike specsyn_/extinct_/nebular_/filters_/yields_, tracks_ is never null once this SimControls is fully constructed, and no code path anywhere in this codebase checks for a “no tracks” state, so this method preserves that invariant rather than accepting null to mean “remove.”

Throws:

std::invalid_argument – if tracks is null, or if its own [fehMin(), fehMax()] (the [Fe/H] range it was loaded over) does not cover fehDist()’s own [min, max], or is NaN (a default-constructed Tracks3D), or if its maximum mass, mMax(), is below the current IMF’s maximum mass

void checkTracksCoverFeH(const tracks::Tracks3D &tracks) const

Check that stellar tracks cover the current [Fe/H] distribution.

The check setTracks() applies before installing new tracks. Public so that a caller can validate tracks it does not want to give up ownership of on failure – e.g. the Python bindings, which would otherwise transfer a Tracks3D’s ownership into setTracks()’s own argument before the check runs.

Parameters:

tracks – The stellar tracks to check

Throws:

std::invalid_argument – if tracks’ own [fehMin(), fehMax()] does not cover fehDist()’s own [min, max], or is NaN (a default-constructed Tracks3D)

void checkTracksCoverIMF(const tracks::Tracks3D &tracks) const

Check that stellar tracks extend up to the current IMF’s maximum mass.

The IMF half of the check setTracks() applies before installing new tracks, public for the same reason as checkTracksCoverFeH(). Does nothing if no IMF has been set yet, or if tracks is default-constructed (NaN [Fe/H] range, no mass range at all), which checkTracksCoverFeH() rejects. Unlike setTracks() itself, prints no warning about the IMF’s minimum mass – see checkIMFWithinTracks().

Parameters:

tracks – The stellar tracks to check

Throws:

std::invalid_argument – if the current IMF’s maximum mass exceeds tracks.mMax()

inline void setExtinct(std::unique_ptr<extinct::Extinct> extinct)

Set the extinction curve.

Lets a caller replace this SimControls’s extinction curve with its own, without needing an input deck – including installing one for the first time on a SimControls whose extinct() was previously null (neither extinct.AV nor extinct.AV_field was given), or passing nullptr to remove one already present.

Like Specsyn (see setSpecsyn()’s own comment), an Extinct stores a live reference to whichever SimControls it was built against, for the rest of its lifetime, and this method cannot re-bind it – extinct must therefore already have been constructed with its own controls argument equal to *this (e.g. from Python, extinct::Extinct(name, controls=this_same_sim_controls)), which this method verifies (via Extinct::controls()) rather than letting its cached quantities silently end up describing the wavelength grid/nebular emission grid/A_V distribution of whatever other SimControls it actually was built against.

Parameters:

extinct – The extinction curve to use; ownership is transferred to this SimControls. May be null, to remove the current one.

Throws:

std::invalid_argument – if extinct is not null and was constructed against a different SimControls than *this (see Extinct::controls()’s own comment)

inline void setNebular(std::unique_ptr<nebular::Nebular> nebular)

Set the nebular emission grid.

Lets a caller replace this SimControls’s nebular emission grid with its own, without needing an input deck – including installing one for the first time on a SimControls whose nebular() was previously null, or passing nullptr to remove one already present. Does not touch nebControls().computeNeb_ either way – see setNebControls()’s own comment on why that flag and nebular()’s own null-ness can therefore end up disagreeing if set independently.

Like Specsyn/Extinct (see setSpecsyn()’s/setExtinct()’s own comments), a Nebular stores a live reference to whichever SimControls it was built against, for the rest of its lifetime, and this method cannot re-bind it – nebular must therefore already have been constructed with its own simControls argument equal to *this, which this method verifies (via Nebular::simControls()) rather than letting its cached quantities silently end up describing the settings of whatever other SimControls it actually was built against.

Parameters:

nebular – The nebular emission grid to use; ownership is transferred to this SimControls. May be null, to remove the current one.

Throws:

std::invalid_argument – if nebular is not null and was constructed against a different SimControls than *this (see Nebular::simControls()’s own comment)

inline void setYields(std::unique_ptr<yields::Yields> yields)

Set the Yields built from yieldChannels()

Lets a caller replace this SimControls’s own Yields with its own, without needing an input deck – including installing one for the first time on a SimControls whose yields() was previously null, or passing nullptr to remove one already present. Does not touch yieldChannels_ either way – see yieldChannels()’s own comment; yields() and yieldChannels() can therefore end up disagreeing if set independently.

Like Specsyn/Extinct/Nebular (see setSpecsyn()’s/ setExtinct()’s/setNebular()’s own comments), a Yields stores a live reference to whichever SimControls it was built against, for the rest of its lifetime, and this method cannot re-bind it – yields must therefore already have been constructed with its own controls argument equal to *this, which this method verifies (via Yields::controls()) rather than letting its yieldChannels()/fehDist() be silently read from whatever other SimControls it actually was built against.

Parameters:

yields – The Yields to use; ownership is transferred to this SimControls. May be null, to remove the current one.

Throws:

std::invalid_argument – if yields is not null and was constructed against a different SimControls than *this (see Yields::controls()’s own comment), or covers a narrower [Fe/H] range than the current one (see checkYieldsReplacement()); this SimControls is then left unchanged

inline void setWinds(std::unique_ptr<feedback::Winds> winds)

Set the stellar wind calculator.

Lets a caller replace this SimControls’s wind calculator with its own, without needing an input deck. Like a Yields (see setYields()’s own comment), a Winds stores a live reference to whichever SimControls it was built against – it reads wrWindModel() from it on every call – and this method cannot re-bind it, so winds must already have been constructed with its own controls argument equal to *this.

Parameters:

winds – The Winds to use, or nullptr to remove the current one; ownership is transferred to this SimControls

Throws:

std::invalid_argument – if winds is not null and was constructed against a different SimControls than *this – see checkWindsReplacement(); winds() is left unchanged in this case

inline void checkSpecsynReplacement(const specsyn::Specsyn &specsyn) const

Check that a spectral synthesizer may replace the current one.

The checks setSpecsyn() applies before installing specsyn. The [Fe/H] check stops a synthesizer built for a narrower range (e.g. while fehDist() was temporarily narrowed, or from Python with its own explicit feh_min/feh_max) from replacing one that covers every [Fe/H] the simulation can ask about. Public so that a caller can validate a synthesizer it does not want to give up ownership of on failure – e.g. the Python bindings, which would otherwise transfer ownership into setSpecsyn()’s own argument before the check runs.

Parameters:

specsyn – The candidate spectral synthesizer

Throws:

std::invalid_argument – if specsyn was constructed against a different SimControls than *this (see setSpecsyn()’s own comment), or if its own [requestedFehMin(), requestedFehMax()] does not contain the current specsyn()’s own – or, if there is no current one, fehDist()’s own [min, max] (no [Fe/H] check at all if fehDist() is not valid, e.g. a SimControls built without an input deck, since there is then no [Fe/H] to cover)

inline void checkYieldsReplacement(const yields::Yields &yields) const

Check that a Yields may replace the current one.

The checks setYields() applies before installing yields – see checkSpecsynReplacement()’s own comment, which applies here identically.

Parameters:

yields – The candidate Yields

Throws:

std::invalid_argument – if yields was constructed against a different SimControls than *this (see setYields()’s own comment), or if its own [requestedFehMin(), requestedFehMax()] does not contain the current yields()’s own – or, if there is no current one and fehDist() is valid, fehDist()’s own [min, max]

inline void checkWindsReplacement(const feedback::Winds &winds) const

Check that a Winds may replace the current one.

The check setWinds() applies before installing winds. Public for the same reason as checkSpecsynReplacement() – see its own comment. Unlike it and checkYieldsReplacement(), there is no [Fe/H] range to check: a Winds has no [Fe/H]-dependent data of its own.

Parameters:

winds – The candidate Winds

Throws:

std::invalid_argument – if winds was constructed against a different SimControls than *this (see setWinds()’s own comment)

inline void setMinStochMass(double minStochMass)

Set the minimum mass for fully stochastic treatment.

Also recomputes fracStochMass() via updateFracStochMass(), exactly as the constructor does when stars.min_stoch_mass is given.

Parameters:

minStochMass – New minimum mass for fully stochastic treatment

Public Static Functions

static auto buildConstantSFR(double sfr) -> pdfs::PDF

Build a PDF representing a fixed star formation rate, constant in time.

Exposed as a public static method (rather than a private implementation detail of the constructor’s own galaxy.sfr handling and setSFR(), which both use it internally) so that Galaxy::Galaxy() can build the same kind of PDF itself, from a rate it draws from sfrDist() rather than one read directly from galaxy.sfr – see its own comment.

Parameters:

sfr – The (constant) star formation rate, in Msun/yr

Returns:

A PDF over time (in yr) whose integral over any [a, b] gives sfr * (b - a) – see the .cpp file’s own comment for the exact construction