|
CLASSpp Manual
Cosmology reference and developer manual
|
#include <scalar_tensor_species.h>
Inheritance diagram for ScalarTensorSpecies:Public Member Functions | |
| double | F (double phi) const |
| double | GetOmega0 () const override |
| double | BackgroundDensityOverH0Sq (double a, double H0) const override |
| std::optional< double > | GetParam (const std::string &name) const override |
| void | SetBackgroundModule (const BackgroundModule *bgm) override |
| 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 *pvecback_B, const double *pvecback) const override |
| void | WriteBackgroundColumnTitles (BackgroundColumnWriter &w) const override |
| void | WriteBackgroundData (const double *pvecback, BackgroundColumnWriter &w) const override |
| void | ProcessBackgroundTable (const double *background_table, int n_rows, int row_stride, const double *z_table) override |
| double | SourceSamplingRate (const double *pvecback) const override |
| void | CloseFriedmann (double a, double K, const double *pvecback_B, double *pvecback, double &rho_tot, double &p_tot, double &rho_r, double &rho_m) const override |
| double | HPrime (double k, const double *y, const perturb_workspace *ppw) const override |
| double | EtaPrime (double k, const double *y, const perturb_workspace *ppw) const override |
| double | HPrimePrime (double k, const double *y, const perturb_workspace *ppw) const override |
| double | AlphaPrime (double k, const double *y, const perturb_workspace *ppw) const override |
| std::unique_ptr< BaseSpecies::PerturbLayout > | CreatePerturbLayout () const override |
| void | PerturbDerivs (const BaseSpecies::PerturbLayout &base, double tau, const double *y, double *dy, const perturb_parameters_and_workspace &ppaw) const override |
| StressEnergyContribution | StressEnergy (const BaseSpecies::PerturbLayout &base, const perturb_vector *pv, const double *y, const double *pvecback, const perturb_workspace *ppw) const override |
| void | ApplyInitialConditions (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 |
| void | PrintVariables (PerturbColumnWriter &writer, const BaseSpecies::PerturbLayout *base, double tau, const double *y, const PerturbationsModule &mod, const perturb_workspace *ppw) const override |
Public Member Functions inherited from BaseSpecies | |
| virtual void | SetThermodynamicsModule (const ThermodynamicsModule *) |
| virtual void | SetPerturbs (const perturbs *) |
| 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 bool | IsFreestreaming () const |
| virtual double | FreestreamingRho (const double *pvecback) const |
| bool | IsPresent () const |
| int | bg_rho_index () const |
| virtual void | RegisterTransferSourceIndices (int &, const SourceRequestContext &) |
| 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 | PerturbTensorDerivs (const PerturbLayout &, double, const double *, double *, const perturb_parameters_and_workspace &) const |
| virtual void | ApplyTensorInitialConditions (const PerturbLayout &, double *, double, const double *) const |
| virtual void | WriteTensorOutputColumnTitles (std::string &) const |
| virtual void | ContributeTensorGwSource (const PerturbLayout &, double, const double *, perturb_workspace *) const |
| virtual void | WriteOutputColumns (PerturbColumnWriter &, const PerturbationsModule &, file_format, TransferColumnSection=TransferColumnSection::all) const |
| virtual void | FillSources (const PerturbLayout &, const double *, const double *, PerturbSourceContext &) 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 void | PerturbSynchronousToNewtonian (const PerturbLayout &, double *, const PerturbIcContext &) |
| virtual void | MarkUsedInSources (const PerturbLayout &, const perturb_workspace *, int *) const |
| virtual double | GetRadiationOmega0 () const |
| virtual double | DarkRadiationRhoToday (const double *) const |
| virtual double | NeutrinoOmega0 () const |
| virtual double | NeffContribution (double) const |
| virtual void | PrintNeffInfo () const |
| virtual void | PrintMassInfo () const |
| virtual void | PrintBackgroundDetails (const double *, double) const |
| virtual double | TensorMasslessRelativisticRho (const double *) const |
| virtual double | DeviationFromRadiation (const double *) const |
| virtual std::vector< double > | FreeStreamingWavenumbers () const |
| virtual void | WarnIfNonlinearUnreliable (double) const |
| virtual std::optional< double > | ChildOmega0 (const std::string &) const |
| virtual double | BackgroundAIni (double a_proposed, double) const |
| bool | ClustersAsMatterCached () const |
| virtual void | FinalizeMatterClassification () |
| virtual bool | ClustersAsMatter () const |
| virtual bool | IsColdMatterSpecies () const |
| virtual bool | HasWarmMatter () const |
| virtual double | NonClusteringOmega0 () const |
| virtual double | ColdMatterRho (const double *pvecback) const |
| virtual double | ColdMatterOmega0 () const |
| virtual bool | HasNcdm () const |
| virtual int | MaxMultipole (const precision *, bool) const |
| virtual bool | SupportsExplicitPerturbationEvolver () const |
| virtual bool | PrefersExponentialPerturbationEvolver () const |
| virtual bool | SupportsExponentialPerturbationEvolver () const |
Additional Inherited Members | |
Public Types inherited from BaseSpecies | |
| enum class | EnergyType |
Protected Member Functions inherited from BaseSpecies | |
| void | ApplyFluidLikeNewtonianShift (double *y, int idx_delta, int idx_theta, const double *pvecback, const PerturbIcContext &ctx) const |
A scalar field non-minimally coupled to gravity, in the Jordan frame:
S = ∫ d^4x √-g [ f(φ) R/2 − (∂φ)²/2 − V(φ) ] + S_m , M_pl = 1, f(φ) = N_st + ξ_st φ² , V(φ) = 3 H0² Omega_Lambda_st + λ_st M_pl² φ⁴ / 4 ,
with matter minimally coupled. That covers Early Modified Gravity (H0 Olympics, arXiv:2107.10291 sec. 2.4.6; Braglia et al. 2011.12934) at N = 1; the massless non-minimally coupled scalar at λ = 0; induced gravity, i.e. Brans–Dicke with ω = 1/(4ξ), at N = 0; and Rock 'n' Roll early dark energy at ξ = 0. φ is in units of the reduced Planck mass, and λ_st is the dimensionless coupling of the action.
The coupling modifies gravity, so besides being a species this implements ModifiedGravity:
Synchronous gauge, scalar modes, adiabatic initial conditions and a flat universe only; the factory refuses anything else.
Design: docs/superpowers/specs/2026-09-24-scalar-tensor-gravity-design.md
|
inline |
The coupling f(φ) = F/M_pl² and the potential V(φ), in CLASS units (1/Mpc²).
|
inlineoverridevirtual |
The effective density today is shot to zero; see the class comment.
Implements BaseSpecies.
|
overridevirtual |
Refused: there is no density before the background is solved, because this species changes H itself.
Reimplemented from BaseSpecies.
|
overridevirtual |
Generic species-param accessor for the Python wrapper layer and cross-module readers that don't want to downcast. Each species may opt in by overriding this and returning the named param; default is std::nullopt.
Reimplemented from BaseSpecies.
|
inlineoverridevirtual |
Called by BackgroundModule after construction to provide access to its indices (index_bg_a_, index_bg_H_, etc.) and background state. Species that need it override this; default is no-op.
Reimplemented from BaseSpecies.
|
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.
|
overridevirtual |
The canonical scalar's p' only: the effective pressure's derivative would need H'', and the two consumers of p_tot' (N-body gauge, PPF) are refused.
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.
|
overridevirtual |
Called once after the full background table is built. Lets a species run table-scope analysis over its own columns. Default no-op.
Reimplemented from BaseSpecies.
|
overridevirtual |
omega / pi for the field's oscillation in conformal time, from the period of the quartic oscillator at the amplitude its energy implies; 0 for lambda = 0. See BaseSpecies::SourceSamplingRate.
Reimplemented from BaseSpecies.
|
overridevirtual |
Close the Friedmann equations. Called in background_functions after every species has computed its background, with the running totals of all of them; the modified-gravity species itself has contributed nothing yet.
On return the species' own density and pressure are the effective ones that make GR's expressions exact, H = sqrt(rho_tot - K/a^2) and H' = -3/2 (rho_tot + p_tot) a + K/a, and they have been added to rho_tot and p_tot. rho_r and rho_m, the radiation- and matter-like parts of rho_tot, are updated to match.
Implements ModifiedGravity.
|
overridevirtual |
h' from the 00 (energy) constraint.
Implements ModifiedGravity.
|
overridevirtual |
eta' from the 0i (momentum) constraint.
Implements ModifiedGravity.
|
overridevirtual |
h'' from the trace of the ij equation.
Implements ModifiedGravity.
|
overridevirtual |
alpha' from the traceless part of the ij equation.
Implements ModifiedGravity.
|
inlineoverridevirtual |
Produce a fresh layout for this species. Called once per pv during perturb_vector_init, before Register*PerturbationIndices. Default: empty base PerturbLayout (suitable for species with no perturbation slots, or as a placeholder during migration).
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 |
All scalar stress-energy perturbations in one call.
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 |
Copy perturbation state from one layout to another across an approximation switch. Called when the perturbation vector is reallocated (e.g., NCDM FA collapse from full Boltzmann hierarchy to fluid variables delta/theta/shear). Default: no-op. Most species have no approximation switches.
Reimplemented from BaseSpecies.
|
overridevirtual |
Append this species' time-evolution variables to writer. Called from perturb_prepare_k_output (title mode, tau=0/y=nullptr/ppw=nullptr) and perturb_print_variables (data mode). Guard computation behind: if (!writer.IsTitleMode()) { ... compute ... } Use writer.Add(title, computed_value, active).
layout is NULL in title mode (there is no perturb_vector yet) and is the species' own sub-layout otherwise — passed in rather than resolved from collection_index_ so that CompositeSpecies can chain this to children, which are not registered in the collection and have no valid collection_index_.
Reimplemented from BaseSpecies.