ow

CosmoLattice output

lphi4.h model: V(ϕ,X) = (λ/4)(ϕ^4) + (1/2) (g^2) (ϕ^2) (X^2)

(* Created by Francisco Torrenti - June 2022 *)

(*This notebook reads the output data generated by CosmoLattice (in text format) and creates a series of useful figures. It is adapted to the default lphi4.h model implemented in CosmoLattice, but can be easily generalized to other scalar models. *)

Clear["Global`*"] 
(*Clears all variables*)

SetDirectory[NotebookDirectory[]]; 
(*Sets working directory to current directory*)

Parameters for spectra outputs

(* Parameters from the simulation *)

  Npoints=32;   (* N: number of lattice points per side *)
  tOutputInfreq=5;  (* time interval between spectra *)
  NumBins=IntegerPart[Sqrt[3]* Npoints/2]; (* number of bins in the spectra *)

(* Parameters for spectra output *)
  s3=1 ; (* frequency of spectra output. Spectra printed are s3*n+1 for n=1, 2,... *)
FinalTime=1000; (*End time of the simulation*)

NumSpectra=FinalTime/(tOutputInfreq*s3);(*Number of spectra to be printed*)
colors=Table[ColorData["Rainbow", t],{t,0.,1,1/NumSpectra}]; (*creates a rainbow of colours for spectra figures*)
specTimes=Table[tOutputInfreq*s3*(i-1),{i,1,NumSpectra*s3}]; (*approximate spectra times*)

Spectra Fields

(*Column structure of file "spectra_scalar_X.txt":*)

Inflaton

NumColumns=3;
specS0=ReadList["spectra_gws.txt",Table[Number,{NumColumns}]];

Table[
spectraS0[i]=Table[{specS0[[j]][[1]],specS0[[j]][[2]]},{j,NumBins*s3*(i-1) + 1,NumBins*s3*(i-1)+NumBins}],{i,1,NumSpectra}];
Table[partnumb0[i]=Table[{specS0[[j]][[1]],specS0[[j]][[3]]},{j,NumBins*s3*(i-1) + 1,NumBins*s3*(i-1)+NumBins}],{i,1,NumSpectra}];

(*Spectrum of GW amplitude*)

ListLogLogPlot[Table[spectraS0[i],{i,1,NumSpectra}],PlotStyle->colors,Joined->True,PlotRange->{{0.2,50},{(10^(-10)),(10^(-3.5))}},ImageSize->440,Frame -> True,FrameLabel->{Style["(OverTilde[k])",FontSize->14,Black],Style["(Subscript[(OverTilde[Δ]), (OverTilde[ϕ])])((OverTilde[k]))",FontSize->14,Black]},FrameTicksStyle->Directive[Black,14]]