|
CLASSpp Manual
Cosmology reference and developer manual
|
#include <dncdm_species.h>
Inheritance diagram for DNCDMSpecies:Data Structures | |
| struct | FloorReport |
Public Member Functions | |
| const std::optional< double > & | Omega_dncdmdr_reserve () const |
| void | BackfillOmega0FromToday (const double *pvecback_today, double H0, double h) |
| void | RegisterBackgroundIndices (int &index_bg) override |
| void | RegisterIntegrationIndices (int &index_bi) override |
| void | SetBackgroundInitialConditions (const BackgroundICContext &ctx) override |
| void | ComputeBackground (double a, const double *pvecback_B, double *pvecback) override |
| void | BackgroundDerivs (double tau, const double *y, double *dy, const double *pvecback) override |
| double | Rho (const double *pvecback) const override |
| double | P (const double *pvecback) const override |
| double | PPrime (double a, double H, const double *, const double *pvecback) const override |
| void | PerturbDerivs (const BaseSpecies::PerturbLayout &base, double tau, const double *y, double *dy, const perturb_parameters_and_workspace &ppaw) const override |
| void | ApplyInitialConditions (const BaseSpecies::PerturbLayout &base, double *y, const PerturbIcContext &ctx) override |
| StressEnergyContribution | StressEnergy (const BaseSpecies::PerturbLayout &base, const perturb_vector *pv, const double *y, const double *pvecback, const perturb_workspace *ppw) const override |
| void | FillSources (const BaseSpecies::PerturbLayout &layout, const double *y, const double *dy, PerturbSourceContext &ctx) const override |
| void | WriteOutputColumns (PerturbColumnWriter &writer, const PerturbationsModule &mod, file_format fmt, TransferColumnSection section=TransferColumnSection::all) const override |
| bool | IsFreestreaming () const override |
| void | WriteBackgroundColumnTitles (BackgroundColumnWriter &w) const override |
| void | WriteBackgroundData (const double *pvecback, BackgroundColumnWriter &w) const override |
| std::tuple< double, double, double > | RescaledPerturbations (const NCDMBaseSpecies::PerturbLayout &layout, double a, double k, const double *y, const perturb_workspace *ppw) const |
Public Member Functions inherited from NCDMBaseSpecies | |
| int | MaxMultipole (const precision *ppr, bool) const override |
| int | LMax (const precision *ppr) const |
| void | SetLMaxInput (int l_max) |
| bool | HasNcdm () const override |
| std::unique_ptr< BaseSpecies::PerturbLayout > | CreatePerturbLayout () const override |
| double | GetOmega0 () const override |
| double | GetT () const |
| double | GetKsi () const |
| bool | UsesPsdFile () const |
| double | rho_nu_rel () const |
| bool | ClustersAsMatter () const override |
| bool | IsColdMatterSpecies () const override |
| double | BackgroundAIni (double a_proposed, double tol) const override |
| double | BackgroundDensityOverH0Sq (double a, double H0) const override |
| void | PrintNeffInfo () const override |
| void | PrintMassInfo () const override |
| double | NeutrinoOmega0 () const override |
| double | NeffContribution (double z) const override |
| double | TensorMasslessRelativisticRho (const double *pvecback) const override |
| double | DeviationFromRadiation (const double *pvecback) const override |
| void | WarnIfNonlinearUnreliable (double m_ev_threshold) const override |
| std::vector< double > | FreeStreamingWavenumbers () const override |
| void | SetBackgroundModule (const BackgroundModule *bgm) override |
| void | SetPerturbs (const perturbs *ppt) override |
| void | RegisterTransferSourceIndices (int &index_tp, const SourceRequestContext &ctx) override |
| void | PerturbTensorDerivs (const BaseSpecies::PerturbLayout &base, double tau, const double *y, double *dy, const perturb_parameters_and_workspace &ppaw) const override |
| void | ApplyTensorInitialConditions (const BaseSpecies::PerturbLayout &base, double *y, double f0, const double *pvecback) const override |
| void | ContributeTensorGwSource (const BaseSpecies::PerturbLayout &base, double a, const double *y, perturb_workspace *ppw) const override |
| void | MarkUsedInSources (const BaseSpecies::PerturbLayout &base, const perturb_workspace *ppw, int *used_in_sources) const override |
| void | PerturbSynchronousToNewtonian (const BaseSpecies::PerturbLayout &base, double *y, const PerturbIcContext &ctx) override |
| void | CopyPerturbationsAcrossSwitch (const BaseSpecies::PerturbLayout &old_base, const BaseSpecies::PerturbLayout &new_base, const double *old_y, double *new_y, const PerturbSwitchContext &ctx) const override |
Public Member Functions inherited from BaseSpecies | |
| virtual void | SetThermodynamicsModule (const ThermodynamicsModule *) |
| virtual std::optional< double > | GetParam (const std::string &) const |
| virtual void | BackgroundDerivsDiagonal (double tau, const double *y, double *diag, const double *pvecback) |
| virtual void | FinalizeBackground (double a, double H, const double *pvecback_B, double *pvecback) |
| virtual double | FreestreamingRho (const double *pvecback) const |
| bool | IsPresent () const |
| int | bg_rho_index () const |
| virtual void | ProcessBackgroundTable (const double *, int, int, const double *) |
| virtual void | PerturbDerivsDiagonal (const PerturbLayout &, double, const double *, double *, const perturb_parameters_and_workspace &) const |
| virtual void | PerturbVectorDerivs (const PerturbLayout &, double, const double *, double *, const perturb_parameters_and_workspace &) const |
| virtual void | WriteTensorOutputColumnTitles (std::string &) const |
| virtual void | PrintVariables (PerturbColumnWriter &, const PerturbLayout *, double, const double *, const PerturbationsModule &, const perturb_workspace *) const |
| virtual int | ApproximationCount () const |
| virtual int | ApproximationRegimeAt (int, double, const double *) const |
| int | ApproximationRegime (const perturb_workspace *ppw, int which=0) const |
| int | ApproximationRegimeBefore (const PerturbSwitchContext &ctx, int which=0) const |
| virtual bool | SupportsNewtonianGauge () const |
| virtual bool | SupportsIsocurvatureInitialConditions () const |
| virtual double | RhoPrimeOverRho (const double *pvecback, double a_prime_over_a) const |
| virtual double | GetRadiationOmega0 () const |
| virtual double | DarkRadiationRhoToday (const double *) const |
| virtual void | PrintBackgroundDetails (const double *, double) const |
| virtual std::optional< double > | ChildOmega0 (const std::string &) const |
| bool | ClustersAsMatterCached () const |
| virtual void | FinalizeMatterClassification () |
| virtual bool | HasWarmMatter () const |
| virtual double | NonClusteringOmega0 () const |
| virtual double | ColdMatterRho (const double *pvecback) const |
| virtual double | ColdMatterOmega0 () const |
| virtual double | SourceSamplingRate (const double *) const |
| virtual bool | SupportsExplicitPerturbationEvolver () const |
| virtual bool | PrefersExponentialPerturbationEvolver () const |
| virtual bool | SupportsExponentialPerturbationEvolver () const |
Static Public Attributes | |
| static constexpr double | kFScale = 1e150 |
Protected Member Functions | |
| double | GetDlnf0Dlnq (int iq, const double *pvecback) const override |
| double | GetW0ForGwSource (int iq, const double *pvecback) const override |
Protected Member Functions inherited from NCDMBaseSpecies | |
| virtual double | EvaluatePsdAnalytic (double q) const |
| virtual quadrature_method | DefaultQuadratureStrategy () const |
| virtual void | FillQuadratureParams (GBQuadParams &) const |
| void | BuildQuadratureAndMass (const NcdmSettings &settings) |
Protected Member Functions inherited from BaseSpecies | |
| void | ApplyFluidLikeNewtonianShift (double *y, int idx_delta, int idx_theta, const double *pvecback, const PerturbIcContext &ctx) const |
Additional Inherited Members | |
Public Types inherited from BaseSpecies | |
| enum class | EnergyType |
Protected Attributes inherited from NCDMBaseSpecies | |
| int | l_max_input_ = -1 |
| double | dlnf0_dlnq_cut_ = 0. |
| bool | normalise_drivers_ = true |
Decaying Non-Cold Dark Matter (DNCDM). Inherits NCDMBaseSpecies; owns per-species quadrature, distribution function, Gamma decay rate, and dq volume elements absorbed from DecayDRProperties.
| struct DNCDMSpecies::FloorReport |
Whether the collision-owned parent's occupation went under kFParentFloor during the background solve, and whether it later came back out.
touched alone is benign: the species has decayed into irrelevance and its published ln f column simply plateaus, which splines fine.
left is the one that matters – inverse decays repopulated the parent from below the floor, so the plateau was hiding real physics AND the column now has a rise whose height is set by the floor rather than by the solution. The soft floor keeps such a recovery smooth, but it still says kFParentFloor is too high for the configuration being run.
negative is stronger than either: the integrator produced a NEGATIVE occupation on a stored row. Unphysical whatever the floor is, and clamped to zero only so the logarithm stays total.
ALL THREE are evaluated on STORED rows only. An earlier version tested every ComputeBackground call, including the trial states the evolver proposes and rejects, and its false positives condemned configurations whose accepted solution stayed dozens of decades clear of the floor.
|
inline |
The budget reserve the shooter wrote (initial and deg modes), in Omega units.
|
inline |
Backfill this species' today density fraction Omega0_ from its integrated density at a=1. In combined/initial modes the matter child is normalized via deg, never SetOmega0, so GetOmega0() stays 0 — which drops it from fnu (GetOmega0NcdmTot) and the budget-print neutrino line. BackgroundModule calls this post-integration. (SetOmega0 is protected; this public wrapper lets the module trigger the backfill.)
|
overridevirtual |
Claim consecutive slots in pvecback. Called once during background_indices(). Implementation must assign index_bg_rho_ (and any other needed indices) and increment index_bg accordingly.
Implements BaseSpecies.
|
overridevirtual |
Claim slots in the ODE integration vector y. Called during background_indices(). Default: no integrated variables (analytic species do not need this).
Reimplemented from BaseSpecies.
|
overridevirtual |
Set initial conditions for ODE-integrated background variables.
| ctx | Background initial-condition context (a_ini, rho_rad, and the integration vector to fill). |
Reimplemented from BaseSpecies.
|
overridevirtual |
Compute species background quantities at scale factor a. pvecback_B is the current ODE integration vector. Write density (and any other owned quantities) into pvecback.
Implements BaseSpecies.
|
overridevirtual |
Contribute to dy/dtau for species with ODE-integrated background variables. pvecback already contains all evaluated background quantities. Default: nothing (species with analytic rho(a) don't override this).
Reimplemented from BaseSpecies.
|
inlineoverridevirtual |
Energy density at current background state.
Implements BaseSpecies.
|
inlineoverridevirtual |
Pressure at current background state.
Implements BaseSpecies.
|
inlineoverridevirtual |
Post-Friedmann. This species' conformal-time pressure derivative p' (a' / a = a*H). pvecback_B is the ODE state (IN); pvecback is fully populated through H. Default 0 (matter / Lambda).
Reimplemented from BaseSpecies.
|
overridevirtual |
Contribute to dy for the scalar perturbation ODE at conformal time tau. The PerturbScalarContext inside ppaw->ppw has pre-computed metric terms, cross-species state (delta_g, theta_g, theta_b, ...), and approximation flags. The layout is this species' PerturbLayout slot (ppw->pv->species_layouts[i]); composites receive their own layout and pass nested sub-layouts to children.
Implements BaseSpecies.
|
overridevirtual |
Write synchronous-gauge initial conditions for this species into y[]. y[] == ppw->pv->y. The module pre-computes ctx.delta_g_ic, ctx.delta_ur, etc. Guard each IC type: if (ctx.index_ic == ctx.p_mod->index_ic_ad_) { ... } Newtonian gauge transformation is handled by the module after this loop. Default: no-op.
Reimplemented from BaseSpecies.
|
overridevirtual |
Fused override: one RescaledPerturbations call for delta/theta/shear; DeltaP uses its own independent loop (different weights), matching the individual methods' per-term expressions and operand order exactly.
Implements BaseSpecies.
|
overridevirtual |
Transfer sources for the parent's own delta/theta. The slots have always been allocated (NCDMBaseSpecies::RegisterTransferSourceIndices) but were never filled and never named, so the decaying parent was the one member of its own sector absent from mTk/vTk output while both daughters were present — which made the sector's total delta unassemblable from a single run. Mirrors DrPsdSpecies.
Reimplemented from BaseSpecies.
|
overridevirtual |
Append this species' output columns (delta, theta) to writer. Called from perturb_output_titles (title mode) and perturb_output_data (data mode). In class_format, the module may call this separately for density and velocity sections to preserve the historical transfer-column ordering. Use writer.Add(title, mod.index_tp_XXX_, active) — writer looks up tk[tp_index].
Reimplemented from BaseSpecies.
|
inlineoverridevirtual |
True for species that are free-streaming and massless at IC time (deep radiation domination). Used to accumulate rho_nu / fracnu in perturbation IC setup. Static at construction time. Default: false.
Reimplemented from BaseSpecies.
|
overridevirtual |
Write this species' background column titles into writer. Called by BackgroundModule::background_output_titles(). Default: no-op (species with no background output need not override).
Reimplemented from BaseSpecies.
|
overridevirtual |
Write this species' background data values into writer. pvecback is the full background vector at the current time step. Called by BackgroundModule::background_output_data(). Default: no-op.
Reimplemented from BaseSpecies.
| std::tuple< double, double, double > DNCDMSpecies::RescaledPerturbations | ( | const NCDMBaseSpecies::PerturbLayout & | layout, |
| double | a, | ||
| double | k, | ||
| const double * | y, | ||
| const perturb_workspace * | ppw | ||
| ) | const |
Returns rescaled (delta, theta, shear) for this decaying NCDM flavor. Rescaling subtracts a common lnN from every lnf to prevent exp(lnf) underflow near the precision floor; lnN cancels in the delta/theta/shear ratios, so this is mathematically equivalent to the unrescaled form but numerically stable.
| layout | this species' per-pv NCDM layout (provides index_per_q). |
| a | Scale factor at the current integration time. |
| k | Fourier wavenumber of the perturbation mode. |
| y | State vector to contract. Must be the y the caller was handed, NOT ppw->pv->y: the evolvers call the RHS at their own trial vectors (ndf15's ynew / numerical-Jacobian yydel), so ppw->pv->y is stale there. |
| ppw | Perturbation workspace (background lnf for the weights). |
|
inlineoverrideprotectedvirtual |
Return d ln f_0 / d ln q for momentum bin iq. NCDMSpecies reads a static table; DNCDMSpecies reads pvecback. Used by PerturbTensorDerivs.
Implements NCDMBaseSpecies.
|
inlineoverrideprotectedvirtual |
Return the quadrature weight w_0[iq] for the GW source integral. NCDMBaseSpecies returns the static w_[iq]; DNCDMSpecies overrides.
Reimplemented from NCDMBaseSpecies.
|
staticconstexpr |
Units of the collision-owned parent's background f-slot: the integrator carries kFScale*f, not f.
Both solvers control error with max(threshold, |y|) against a HARD-CODED abstol = 1e-15 that tol_background_integration cannot move (rkdp45: threshold = abstol/rtol, so the effective absolute bound is abstol again; ndf15: threshold = abstol outright). This species' f starts near 0.5 and decays hundreds of decades below that, so unrescaled it is integrated as noise the moment it drops under ~1e-9 – f chatters against zero, the published ln f column acquires square wells, and the perturbation module's cubic spline of that column turns P(k) into NaN.
Rescaling is EXACT, a change of units rather than an approximation, and it moves the noise floor below anything this species can reach while carrying energy. It works here because the decay is MONOTONE: ln f falls smoothly, reaches kFParentFloor and stays there, and a flat plateau is something a spline can represent. A configuration in which inverse decays genuinely REPOPULATE the parent from ~0 would come back off that plateau and needs the FLOOR addressed too, not just the scale.
Public because the composite converts at the kernel boundary; see DNCDMInvSpecies::ApplyKernelBackgroundDerivs.