Changeset 3800 in Sophya


Ignore:
Timestamp:
Jul 19, 2010, 5:05:40 PM (15 years ago)
Author:
cmv
Message:

reorganisation tres legere du code Vlos, cmv 19/07/2010

Location:
trunk/Cosmo/SimLSS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/SimLSS/cmvginit3d.cc

    r3782 r3800  
    572572      cout<<"\n--- Apply Growth factor"<<endl;
    573573      cout<<"...D(z=0)="<<growth(0.)<<"  D(z="<<zref<<")="<<growth(zref)<<endl;
    574       fluct3d.ApplyDerGrowthFactor(use_growth_factor);
     574      fluct3d.ApplyVelLosGrowthFactor(use_growth_factor);
    575575      fluct3d.MinMax(rmin,rmax);
    576576      cout<<"rgen.Min = "<<rmin<<" , Max="<<rmax<<endl;
  • trunk/Cosmo/SimLSS/cmvrvloscor.cc

    r3799 r3800  
    107107 long nmax = max(Nx,max(Ny,Nz));
    108108 cout<<"dmin="<<dmin<<" nmax="<<nmax<<endl;
    109  Histo hmpc(-dmin*nmax,dmin*nmax,4*nmax);
     109 Histo hmpc(-dmin*nmax/10.,dmin*nmax/10.,nmax);
    110110
    111111 POutPersist pos(fnppf.c_str());
     
    167167 for(int i=0;i<Nx;i++) {
    168168   if(i%(Nx/10)==0) cout<<"   i="<<i<<endl;
    169    TMatrix<r_4> M2d, M2dc;
     169   TMatrix<r_4> M2d, M2dv, M2dc;
    170170   if(do2d && (i==0 || i==Nx/2 || i==Nx-1)) {
    171171     M2d.ReSize(Ny,Nz); M2d = 0.;
     172     M2dv.ReSize(Ny,Nz); M2dv = 0.;
    172173     M2dc.ReSize(Ny,Nz); M2dc = 0.;
    173174   }
     
    199200   // On remplit eventuellement les matrices 2D
    200201   if(do2d && M2d.Size()>0)
    201      for(int l=0;l<Nz;l++) {M2d(j,l) = R(l); M2dc(j,l) = Rdis(l);}
     202     for(int l=0;l<Nz;l++) {M2d(j,l) = R(l); M2dv(j,l) = V(l); M2dc(j,l) = Rdis(l);}
    202203   // On remplit le cube avec le champ R redshift distordu
    203204   if(fluct3d) for(int l=0;l<Nz;l++) (*rgen)(l,j,i) += Rdis(l);
     
    240241     sprintf(str,"mx_%d",i);
    241242     pos.PutObject(M2d,str);
     243     sprintf(str,"mxv_%d",i);
     244     pos.PutObject(M2dv,str);
    242245     sprintf(str,"mxc_%d",i);
    243246     pos.PutObject(M2dc,str);
  • trunk/Cosmo/SimLSS/genefluct3d.cc

    r3799 r3800  
    904904
    905905//-------------------------------------------------------------------
     906void GeneFluct3D::ToRedshiftSpace(void)
     907// Apply redshift distortion corrections
     908// ---- ATTENTION: Le spectre Pk doit etre (dRho/Rho)(k)
     909{
     910 double zpk = compute_pk_redsh_ref_;
     911 double beta = -(1.+zpk) * growth_->DsDz(zpk,good_dzinc_) / (*growth_)(zpk);
     912 if(lp_>0) cout<<"--- ToRedshiftSpace --- at z="<<zpk<<", Beta="<<beta
     913               <<" (km/s)/Mpc (comp. for dz="<<good_dzinc_<<")"<<endl;
     914 check_array_alloc();
     915
     916 for(long i=0;i<Nx_;i++) {
     917   double kx = Kx(i);
     918   for(long j=0;j<Ny_;j++) {
     919     double ky = Ky(j);
     920     double kt2 = kx*kx + ky*ky;
     921     for(long l=0;l<NCz_;l++) {
     922       double kz = Kz(l);
     923       if(l==0)  continue;
     924       T_(l,j,i) *= (1. + beta*kz*kz/(kt2 + kz*kz));
     925     }
     926   }
     927 }
     928}
     929
     930//-------------------------------------------------------------------
    906931void GeneFluct3D::ToVelLoS(void)
    907 // Le spectre Pk doit etre (dRho/Rho)(k)
     932/*
     933---- Vitesse particuliere
     934Un atome au redshift "z" emet a la longueur d'onde "Le" si il est au repos
     935Il a une vitesse (particuliere) "V" dans le referentiel comobile au redshift "z"
     936Dans le referentiel comobile au redshift "z", il emet a la longueur d'onde "Le*(1+V/C)"
     937L'observateur voit donc une longueur d'onde "Le*(1+V/C)*(1+z) = Le*[1+z+V/C*(1+z)]"
     938  et croit que l'atome est au redshift "z' = z + V/C*(1+z)"
     939L'observateur observe donc une vitesse particuliere (1+z)*V/c
     940  --> vitesse particuliere dans le repere comobile en z: V/C
     941      vitesse particuliere dans le repere comobile de l'observateur: (1+z)*V/C
     942---- ATTENTION: Le spectre Pk doit etre (dRho/Rho)(k)
     943---- On genere la vitesse particuliere (dans le referentiel comobile au redshift "z")
     944     Vlos(k) = i*Beta(z)*k(los)/k^2*(dRho/Rho)(k)
     945        .avec Beta(z) = dln(D)/da = -(1+z)/D*dD/dz
     946        .on convertit en vitesse en faisant Vlos(k)/H(z)
     947*/
    908948{
    909949 double zpk = compute_pk_redsh_ref_;
     
    931971//-------------------------------------------------------------------
    932972void GeneFluct3D::ApplyGrowthFactor(int type_evol)
    933 // Apply Growth to real space
     973// Apply Growth to real space d(Rho)/Rho cube
    934974// Using the correspondance between redshift and los comoving distance
    935975// describe in vector "zred_" "loscom_"
     
    9711011
    9721012//-------------------------------------------------------------------
    973 void GeneFluct3D::ApplyDerGrowthFactor(int type_evol)
    974 // Apply Conformal derivative of Growth to real space for transverse velocity cube
    975 {
    976  if(lp_>0) cout<<"--- ApplyDerGrowthFactor: evol="<<type_evol<<endl;
     1013void GeneFluct3D::ApplyRedshiftSpaceGrowthFactor(void)
     1014// Apply Growth(z) to redshift-distorted real space cube
     1015{
     1016 const char *bla = "GeneFluct3D::ApplyRedshiftSpaceGrowthFactor_Error: redshift evolution impossible because factor depen on k";
     1017 cout<<bla<<endl; throw ParmError(bla);
     1018}
     1019
     1020//-------------------------------------------------------------------
     1021void GeneFluct3D::ApplyVelLosGrowthFactor(int type_evol)
     1022// Apply Growth(z) to transverse velocity real space cube
     1023{
     1024 if(lp_>0) cout<<"--- ApplyVelLosGrowthFactor: evol="<<type_evol<<endl;
    9771025 check_array_alloc();
    9781026
    9791027 if(growth_ == NULL) {
    980    const char *bla = "GeneFluct3D::ApplyGrowthFactor_Error: set GrowthFactor first";
     1028   const char *bla = "GeneFluct3D::ApplyVelLosGrowthFactor_Error: set GrowthFactor first";
    9811029   cout<<bla<<endl; throw ParmError(bla);
    9821030 }
    9831031 if(type_evol<1 || type_evol>2) {
    984    const char *bla = "GeneFluct3D::ApplyGrowthFactor_Error: bad type_evol value";
     1032   const char *bla = "GeneFluct3D::ApplyVelLosGrowthFactor_Error: bad type_evol value";
    9851033   cout<<bla<<endl; throw ParmError(bla);
    9861034 }
  • trunk/Cosmo/SimLSS/genefluct3d.h

    r3781 r3800  
    118118  void ComputeFourier(PkSpectrumZ& pk_at_z);
    119119  void FilterByPixel(void);
     120  void ToRedshiftSpace(void);
    120121  void ToVelLoS(void);
    121122
    122123  void ComputeReal(void);
    123124  void ApplyGrowthFactor(int type_evol=1);
    124   void ApplyDerGrowthFactor(int type_evol=1);
     125  void ApplyRedshiftSpaceGrowthFactor(void);
     126  void ApplyVelLosGrowthFactor(int type_evol=1);
    125127
    126128  void ReComputeFourier(void);
Note: See TracChangeset for help on using the changeset viewer.