How to change initial conditions - cmyoo/cosmos GitHub Wiki

Tutorial 1: changing initial data

Let us consider the peak of the curvature perturbation located at the origin slightly stretched in the $x$-direction.

$$ \zeta=-2\ln \Psi=-\mu\left[\exp\left(-\frac{1}{6}k^2 \left(q^2 X^2+Y^2+Z^2\right)\right)\right]W(R), $$

where $R^2=X^2+Y^2+Z^2$, and $q$ is the parameter characterizing the elongation. The function $W(R)$ is given by [3]

$$ W(R;R_{\rm W},L)=\left\{ \begin{array}{ll} 1&{\rm for}~0\leq R \leq R_{\rm W} \ 1-\frac{\left(\left(R_{\rm W}-L\right)^6-\left(L-R\right)^6\right)^6}{\left(R_{\rm W}-L\right)^{36}}&{\rm for}~R_{\rm W} \leq R \leq L \ 0&{\rm for}~L \leq R \end{array}\right. $$

with $R_{\rm W}=0.8L$. We note that this configuration is compatible with the default settings of the boundary conditions.

How to introduce the initial condition is explained below. For simplicity, we begin with the files for the time evolution sample of the adiabatic spherical initial condition.

How to edit files

Creating a working directory

  • Copy the directory /sample/adiabatic_spherical to /sample/adiabatic_spheroid

Editting /adiabatic_spheroid/cosmos.cpp

  • Introduce the initial data setting function fmv->initial_spheroid(mu,kk,xi2), where we reuse the parameter xi2 as the parameter $q$. The function is newly defined in cosmos_initial.cpp and listed in cosmos.h.

Editting /source/cosmos.h $\rightarrow$ /sample/adiabatic_spheroid/cosmos.h

  • Add the declaration of the function void initial_spheroid(double mu,double k,double xi2) and void set_Psi_spheroid(double mu,double k,double xi2).

Editting /source/cosmos_initial.cpp $\rightarrow$ /sample/adiabatic_spheroid/cosmos_initial.cpp

  • Add the definition of void Fmv::initial_spheroid(double mu,double k,double xi2).

  • Add the definition of void Fmv::set_Psi_spheroid(double mu,double kk,double xi2).

Editting /adiabatic_spheroid/par_ini.d

  • Set the parameter value for continue to "0".
  • Change the value of the parameter xi2 to, e.g., "0.8".
    \
  • Change the maximum step of the main loop if necessary.

How to run

  • You may create /adiabatic_spheroid directory at the top of the COSMOS directory by doing the command as
    ./makecosmos.sh adiabatic_spheroid.
    If the /adiabatic_spheroid directory is created successfully at the top of the COSMOS directory, you are ready to compile and run.

  • The last step is to move to the /adiabatic_spheroid directory as cd adiabatic_spheroid, do make there, and run the executable output as ./cosmos.