NcmHOAA

NcmHOAA — Abstract class for Harmonic Oscillator calculation through AA variables.

Functions

Properties

double abstol Read / Write / Construct
double k Read / Write / Construct
NcmHOAAOpt opt Read / Write / Construct Only
double reltol Read / Write / Construct
gboolean save-evol Read / Write / Construct
double tf Read / Write / Construct
double ti Read / Write / Construct

Types and Values

Object Hierarchy

    GEnum
    ├── NcmHOAAOpt
    ├── NcmHOAASingType
    ╰── NcmHOAAVar
    GObject
    ╰── NcmHOAA
        ├── NcHIPertAdiab
        ╰── NcHIPertGW

Description

This object represents a generic time dependent harmonic oscillator for the variables $q$ and its momentum $p$. The Hamiltonian of the system is given by \begin{equation}\label{eq:H} H = \frac{P_q^2}{2m} + \frac{m(\nu^2 - V)q^2}{2}, \end{equation} where the mass $m$, frequency $\nu$ and the potential $V$ are functions of the time $t$ and mode $k$. The mass $m$ and frequency $\nu$ are assumed to be positive definite functions. For details about this system see Appendix A of Celani et al (2016).

Each child should implement the functions ncm_hoaa_eval_mnu(), ncm_hoaa_eval_nu() and ncm_hoaa_eval_system(). The potential term is optional, if not implemented then $V$ is assumed to be zero.

The Action Angle variables are defined through \begin{align} q &= \sqrt{\frac{2I}{m\nu}}\sin\theta, \\ P_q &= \sqrt{2Im\nu}\cos\theta. \end{align} Therefore, the new Hamiltonian is \begin{equation}\label{eq:HAA} H = I\nu + \frac{\mathrm{d}\ln(\sqrt{m\nu})}{\mathrm{d}t}I\sin2\theta - \frac{V}{\nu}I\sin^2\theta. \end{equation} The Hamilton equations for these variables are: \begin{align} \frac{\mathrm{d}\theta}{\mathrm{d}t} &= \nu - \frac{V}{\nu}\sin^2\theta + \frac{\mathrm{d}\ln(\sqrt{m\nu})}{\mathrm{d}t}\sin2\theta, \\ \frac{\mathrm{d}\ln(I)}{\mathrm{d}t} &= - 2\frac{\mathrm{d}\ln(\sqrt{m\nu})}{\mathrm{d}t}\cos2\theta + \frac{V}{\nu}I\sin2\theta. \end{align}

Functions

ncm_hoaa_ref ()

NcmHOAA *
ncm_hoaa_ref (NcmHOAA *hoaa);

Increases the reference count of hoaa .

Parameters

hoaa

a NcmHOAA

 

Returns

hoaa .

[transfer full]


ncm_hoaa_free ()

void
ncm_hoaa_free (NcmHOAA *hoaa);

Decreases the reference count of hoaa .

Parameters

hoaa

a NcmHOAA

 

ncm_hoaa_clear ()

void
ncm_hoaa_clear (NcmHOAA **hoaa);

Decreases the reference count of *hoaa and sets the pointer *hoaa to NULL.

Parameters

hoaa

a NcmHOAA

 

ncm_hoaa_set_reltol ()

void
ncm_hoaa_set_reltol (NcmHOAA *hoaa,
                     const gdouble reltol);

Sets the relative tolerance to reltol .

Parameters

hoaa

a NcmHOAA

 

reltol

relative tolerance

 

ncm_hoaa_set_abstol ()

void
ncm_hoaa_set_abstol (NcmHOAA *hoaa,
                     const gdouble abstol);

Sets the absolute tolerance to abstol .

Parameters

hoaa

a NcmHOAA

 

abstol

absolute tolerance

 

ncm_hoaa_set_k ()

void
ncm_hoaa_set_k (NcmHOAA *hoaa,
                const gdouble k);

Sets the mode $k$ to k .

Parameters

hoaa

a NcmHOAA

 

k

mode $k$

 

ncm_hoaa_set_ti ()

void
ncm_hoaa_set_ti (NcmHOAA *hoaa,
                 const gdouble ti);

Sets the initial time $t_i$ to ti .

Parameters

hoaa

a NcmHOAA

 

ti

mode $t_i$

 

ncm_hoaa_set_tf ()

void
ncm_hoaa_set_tf (NcmHOAA *hoaa,
                 const gdouble tf);

Sets the initial time $t_f$ to tf .

Parameters

hoaa

a NcmHOAA

 

tf

mode $t_f$

 

ncm_hoaa_save_evol ()

void
ncm_hoaa_save_evol (NcmHOAA *hoaa,
                    gboolean save_evol);

If true saves all evolution to be evaluted later through.

Parameters

hoaa

a NcmHOAA

 

save_evol

whether to save all evolution

 

ncm_hoaa_prepare ()

void
ncm_hoaa_prepare (NcmHOAA *hoaa,
                  NcmModel *model);

Prepares the object using model .

[virtual prepare]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

ncm_hoaa_get_t0_t1 ()

void
ncm_hoaa_get_t0_t1 (NcmHOAA *hoaa,
                    NcmModel *model,
                    gdouble *t0,
                    gdouble *t1);

Gets the time interval where the numerical evolution was calculated;

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t0

$t_0$.

[out]

t1

$t_1$.

[out]

ncm_hoaa_eval_adiabatic_approx ()

void
ncm_hoaa_eval_adiabatic_approx (NcmHOAA *hoaa,
                                NcmModel *model,
                                const gdouble t,
                                gdouble *thetab,
                                gdouble *upsilon,
                                gdouble *gamma);

Calculates the adiabatic approximation at $t$ and $k$.

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

thetab

$\theta_b$.

[out]

upsilon

$\upsilon$.

[out]

gamma

$\ln(I)$.

[out]

ncm_hoaa_eval_adiabatic_LnI_approx ()

void
ncm_hoaa_eval_adiabatic_LnI_approx (NcmHOAA *hoaa,
                                    NcmModel *model,
                                    const gdouble t,
                                    const gdouble theta,
                                    const gdouble psi,
                                    gdouble *LnI,
                                    gdouble *LnJ);

Calculates the adiabatic approximation at $t$ and $k$.

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

theta

$\theta$

 

psi

$\psi$

 

LnI

$\ln(I)$.

[out]

LnJ

$\ln(J)$.

[out]

ncm_hoaa_eval_AA ()

void
ncm_hoaa_eval_AA (NcmHOAA *hoaa,
                  NcmModel *model,
                  const gdouble t,
                  gdouble *upsilon,
                  gdouble *gamma,
                  gdouble *qbar,
                  gdouble *pbar);

Calculates the AA variables at $t$ and $k$.

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

upsilon

$\theta$.

[out]

gamma

$\psi$.

[out]

qbar

$\ln(I)$.

[out]

pbar

$\ln(J)$.

[out]

ncm_hoaa_eval_AA2QV ()

void
ncm_hoaa_eval_AA2QV (NcmHOAA *hoaa,
                     NcmModel *model,
                     const gdouble t,
                     const gdouble upsilon,
                     const gdouble gamma,
                     const gdouble qbar,
                     const gdouble pbar,
                     gdouble *q,
                     gdouble *v,
                     gdouble *Pq,
                     gdouble *Pv);

Change the variables from AA to QV.

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

upsilon

$\upsilon$

 

gamma

$\gamma$

 

qbar

$\sin (\theta_b)$

 

pbar

$\cos (\theta_b)$

 

q

$u$.

[out]

v

$v$.

[out]

Pq

$P_q$.

[out]

Pv

$P_v$.

[out]

ncm_hoaa_eval_QV2AA ()

void
ncm_hoaa_eval_QV2AA (NcmHOAA *hoaa,
                     NcmModel *model,
                     const gdouble t,
                     const gdouble q,
                     const gdouble v,
                     const gdouble Pq,
                     const gdouble Pv,
                     gdouble *upsilon,
                     gdouble *gamma,
                     gdouble *qbar,
                     gdouble *pbar);

Change the variables from complex to AA.

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

q

$q$

 

v

$v$

 

Pq

$P_q$

 

Pv

$P_v$

 

upsilon

$\upsilon$.

[out]

gamma

$\gamma$.

[out]

qbar

$\sin (\theta_b)$.

[out]

pbar

$\cos (\theta_b)$.

[out]

ncm_hoaa_eval_QV ()

void
ncm_hoaa_eval_QV (NcmHOAA *hoaa,
                  NcmModel *model,
                  const gdouble t,
                  gdouble *q,
                  gdouble *v,
                  gdouble *Pq,
                  gdouble *Pv);

Calculates the complex variables at $t$ and $k$.

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

q

$q$.

[out]

v

$v$.

[out]

Pq

$P_q$.

[out]

Pv

$P_v$.

[out]

ncm_hoaa_eval_Delta ()

void
ncm_hoaa_eval_Delta (NcmHOAA *hoaa,
                     NcmModel *model,
                     const gdouble t,
                     gdouble *Delta_phi,
                     gdouble *Delta_Pphi);

Calculates the power spectra.

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

Delta_phi

$\Delta_\phi$.

[out]

Delta_Pphi

$\Delta_{P_\phi}$.

[out]

ncm_hoaa_eval_solution ()

void
ncm_hoaa_eval_solution (NcmHOAA *hoaa,
                        NcmModel *model,
                        const gdouble t,
                        const gdouble S,
                        const gdouble PS,
                        gdouble *Aq,
                        gdouble *Av);

Calculates the coefficients $A_q$ and $A_v$ of the solution with initial conditions $S,\;P_S$ at $t$.

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

S

$S$

 

PS

$P_S$

 

Aq

$A_q$.

[out]

Av

$A_v$.

[out]

ncm_hoaa_eval_nu ()

gdouble
ncm_hoaa_eval_nu (NcmHOAA *hoaa,
                  NcmModel *model,
                  const gdouble t,
                  const gdouble k);

Evaluates the frequency term at $t$ and $k$.

[virtual eval_nu]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

k

mode $k$

 

Returns

the frequency $\nu$.


ncm_hoaa_eval_mnu ()

gdouble
ncm_hoaa_eval_mnu (NcmHOAA *hoaa,
                   NcmModel *model,
                   const gdouble t,
                   const gdouble k);

Evaluates the mass term at $t$ and $k$.

[virtual eval_mnu]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

k

mode $k$

 

Returns

the mass $m$.


ncm_hoaa_eval_dlnmnu ()

gdouble
ncm_hoaa_eval_dlnmnu (NcmHOAA *hoaa,
                      NcmModel *model,
                      const gdouble t,
                      const gdouble k);

Evaluates the derivative $\mathrm{d}(m\nu)/\mathrm{d}t$ term at $t$ and $k$.

[virtual eval_dlnmnu]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

k

mode $k$

 

Returns

the potential $\mathrm{d}(m\nu)/\mathrm{d}t$.


ncm_hoaa_eval_V ()

gdouble
ncm_hoaa_eval_V (NcmHOAA *hoaa,
                 NcmModel *model,
                 const gdouble t,
                 const gdouble k);

Evaluates the potential term at $t$ and $k$.

[virtual eval_V]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

k

mode $k$

 

Returns

the potential $V$.


ncm_hoaa_eval_system ()

void
ncm_hoaa_eval_system (NcmHOAA *hoaa,
                      NcmModel *model,
                      const gdouble t,
                      const gdouble k,
                      gdouble *nu,
                      gdouble *dlnmnu,
                      gdouble *Vnu);

Evaluates the system functions at $t$ and $k$.

[virtual eval_system]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t

time $t$

 

k

mode $k$

 

nu

the frequency $\nu$.

[out]

dlnmnu

the derivative $\mathrm{d}(m\nu)/\mathrm{d}t$.

[out]

Vnu

the potential over frequency term $V/\nu$.

[out]

ncm_hoaa_nsing ()

guint
ncm_hoaa_nsing (NcmHOAA *hoaa,
                NcmModel *model,
                const gdouble k);

Gets the number of singular points $m(t_s) = 0$ for the problem in hand.

[virtual nsing]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

k

mode $k$

 

Returns

the number of singular points.


ncm_hoaa_get_sing_info ()

void
ncm_hoaa_get_sing_info (NcmHOAA *hoaa,
                        NcmModel *model,
                        const gdouble k,
                        const guint sing,
                        gdouble *ts,
                        gdouble *dts_i,
                        gdouble *dts_f,
                        NcmHOAASingType *st);

Gets the time $t_s$ where the sing -th singularity occour.

[virtual get_sing_info]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

k

mode $k$

 

sing

singularity index

 

ts

singularity time $t_s$.

[out]

dts_i

singularity time interval $t_s - t_i$.

[out]

dts_f

singularity time interval $t_f - t_s$.

[out]

st

singularity type.

[out]

ncm_hoaa_eval_sing_mnu ()

gdouble
ncm_hoaa_eval_sing_mnu (NcmHOAA *hoaa,
                        NcmModel *model,
                        const gdouble t_m_ts,
                        const gdouble k,
                        const guint sing);

Evaluates the mass term at $t$ and $k$.

[virtual eval_sing_mnu]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t_m_ts

time $t - t_s$

 

k

mode $k$

 

sing

singularity index

 

Returns

the mass $m$.


ncm_hoaa_eval_sing_dlnmnu ()

gdouble
ncm_hoaa_eval_sing_dlnmnu (NcmHOAA *hoaa,
                           NcmModel *model,
                           const gdouble t_m_ts,
                           const gdouble k,
                           const guint sing);

Evaluates the derivative $\mathrm{d}(m\nu)/\mathrm{d}t$ term at $t$ and $k$.

[virtual eval_sing_dlnmnu]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t_m_ts

time $t - t_s$

 

k

mode $k$

 

sing

singularity index

 

Returns

the potential $\mathrm{d}(m\nu)/\mathrm{d}t$.


ncm_hoaa_eval_sing_V ()

gdouble
ncm_hoaa_eval_sing_V (NcmHOAA *hoaa,
                      NcmModel *model,
                      const gdouble t_m_ts,
                      const gdouble k,
                      const guint sing);

Evaluates the potential term at $t$ and $k$.

[virtual eval_sing_V]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t_m_ts

time $t - t_s$

 

k

mode $k$

 

sing

singularity index

 

Returns

the potential $V$.


ncm_hoaa_eval_sing_system ()

void
ncm_hoaa_eval_sing_system (NcmHOAA *hoaa,
                           NcmModel *model,
                           const gdouble t_m_ts,
                           const gdouble k,
                           const guint sing,
                           gdouble *nu,
                           gdouble *dlnmnu,
                           gdouble *Vnu);

Evaluates the system functions at $t$ and $k$.

[virtual eval_sing_system]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

t_m_ts

time $t - t_s$

 

k

mode $k$

 

sing

singularity index

 

nu

the frequency $\nu$.

[out]

dlnmnu

the derivative $\mathrm{d}(m\nu)/\mathrm{d}t$.

[out]

Vnu

the potential over frequency term $V/\nu$.

[out]

ncm_hoaa_eval_powspec_factor ()

gdouble
ncm_hoaa_eval_powspec_factor (NcmHOAA *hoaa,
                              NcmModel *model);

Evaluates the power spectrum constant factor. Default is: $1/(2\pi^2)$.

[virtual eval_powspec_factor]

Parameters

hoaa

a NcmHOAA

 

model

a NcmModel.

[allow-none]

Types and Values

NCM_TYPE_HOAA

#define NCM_TYPE_HOAA (ncm_hoaa_get_type ())

enum NcmHOAAOpt

When solving the system of equations, the user can choose to solve the system with all variables non-zero, only V non-zero or only dlnmnu non-zero.

Members

NCM_HOAA_OPT_FULL

System with all variables non-zero

 

NCM_HOAA_OPT_V_ONLY

System with only V non-zero

 

NCM_HOAA_OPT_DLNMNU_ONLY

System with only dlnmnu non-zero

 

NCM_HOAA_OPT_INVALID

Invalid option

 

enum NcmHOAASingType

The singularity type.

Members

NCM_HOAA_SING_TYPE_ZERO

mass pass through zero

 

NCM_HOAA_SING_TYPE_INF

mass pass through infinity

 

NCM_HOAA_SING_TYPE_INVALID

Invalid option

 

struct NcmHOAAClass

struct NcmHOAAClass {
};

enum NcmHOAAVar

The variables in the system.

Members

NCM_HOAA_VAR_QBAR

Field variable

 

NCM_HOAA_VAR_PBAR

Momentum variable

 

NCM_HOAA_VAR_UPSILON

adiabatic parameter

 

NCM_HOAA_VAR_GAMMA

adiabatic parameter

 

NCM_HOAA_VAR_SYS_SIZE

Number of variables in the system

 

NCM_HOAA_TIME_FRAC

#define NCM_HOAA_TIME_FRAC (1.0e-13)

NCM_HOAA_DEBUG_EVOL

#define NCM_HOAA_DEBUG_EVOL (FALSE)

NCM_HOAA_DEBUG_SING

#define NCM_HOAA_DEBUG_SING (FALSE)

NCM_HOAA_DEBUG_EVOL_SING

#define NCM_HOAA_DEBUG_EVOL_SING (FALSE)

NCM_HOAA_PARABOLIC_MIN_POINTS

#define NCM_HOAA_PARABOLIC_MIN_POINTS (4)

NCM_HOAA_PARABOLIC_TRIG_ONE

#define NCM_HOAA_PARABOLIC_TRIG_ONE (0.999)

NcmHOAA

typedef struct _NcmHOAA NcmHOAA;

Property Details

The “abstol” property

  “abstol”                   double

Absolute tolerance tolerance.

Owner: NcmHOAA

Flags: Read / Write / Construct

Allowed values: >= 0

Default value: 0


The “k” property

  “k”                        double

The mode k.

Owner: NcmHOAA

Flags: Read / Write / Construct

Allowed values: >= 0

Default value: 1


The “opt” property

  “opt”                      NcmHOAAOpt

Evolution options.

Owner: NcmHOAA

Flags: Read / Write / Construct Only

Default value: NCM_HOAA_OPT_INVALID


The “reltol” property

  “reltol”                   double

Relative tolerance.

Owner: NcmHOAA

Flags: Read / Write / Construct

Allowed values: [0,1]

Default value: 1e-07


The “save-evol” property

  “save-evol”                gboolean

Save the system evolution.

Owner: NcmHOAA

Flags: Read / Write / Construct

Default value: TRUE


The “tf” property

  “tf”                       double

The final time t_f.

Owner: NcmHOAA

Flags: Read / Write / Construct

Default value: 1


The “ti” property

  “ti”                       double

The initial time t_i.

Owner: NcmHOAA

Flags: Read / Write / Construct

Default value: 0