CosmoCoffee Forum Index CosmoCoffee

 
 FAQFAQ   SearchSearch  MemberlistSmartFeed   MemberlistMemberlist    RegisterRegister 
   ProfileProfile   Log inLog in 
Arxiv New Filter | Bookmarks & clubs | Arxiv ref/author:

CAMB_source: Weak lensing convergence power spectra
Goto page 1, 2  Next  
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software
View previous topic :: View next topic  
Author Message
gongbo zhao



Joined: 04 Jan 2005
Posts: 69
Affiliation: ICG, Portsmouth

PostPosted: March 08 2008  Reply with quote

Dear all,
I was trying to generate the weak lensing convergence power spectra C_l^{\kappa\kappa} given some window functions. I got a 8-column output Cl file by choosing 1 redshift bin and setting

get_scalar_cls = T
get_transfer = F
get_vector_cls = F
get_tensor_cls = F
want_CMB = T

To my understanding, the 8 output columns should be
l,Cl^{TT,TE,EE},Cl^{\phi\phi}, Cl^{T\phi},  C_l^{\kappa\kappa}, Cl^{T\kappa}
there's no ClBB. Am I right?
BTW, there's a returned 'bus error' when setting nonlinear=2 (I compiled with g95).

Thanks,
Gongbo
Back to top
View user's profile [ Hidden ] Visit poster's website
Antony Lewis



Joined: 23 Sep 2004
Posts: 1309
Affiliation: University of Sussex

PostPosted: March 08 2008  Reply with quote

Yes, no BB for scalars.

Let me know if you find a fix for the bus error.
Back to top
View user's profile [ Hidden ] Visit poster's website
gongbo zhao



Joined: 04 Jan 2005
Posts: 69
Affiliation: ICG, Portsmouth

PostPosted: March 08 2008  Reply with quote

Thanks, Antony! I will let you know once I fix the problem.
BTW, the lensing source implemented in output is −2*phi*W%win_lens(j), can you provide the main reference for this issue? or some maple files.



Cheers
Gongbo
Back to top
View user's profile [ Hidden ] Visit poster's website
Antony Lewis



Joined: 23 Sep 2004
Posts: 1309
Affiliation: University of Sussex

PostPosted: March 09 2008  Reply with quote

−2φ is the standard source for the lensing potential. win_lens should be calculated consistently from your supplied source window function (Gaussian by default). Sorry I don't have any documentation.
Back to top
View user's profile [ Hidden ] Visit poster's website
gongbo zhao



Joined: 04 Jan 2005
Posts: 69
Affiliation: ICG, Portsmouth

PostPosted: March 24 2008  Reply with quote

Dear all,

Has anyone succeeded in reproducing some convergence power results in the literature (such as fig 2 in astro-ph/0106399) using CAMB sources? I tried but failed.



Thanks,
Gong-Bo
Back to top
View user's profile [ Hidden ] Visit poster's website
Antony Lewis



Joined: 23 Sep 2004
Posts: 1309
Affiliation: University of Sussex

PostPosted: March 24 2008  Reply with quote

I've checked things look consistent, though not a detailed comparison as no alternative codes to hand.

Note can set evolve_delta_xe = F to speed things up, and check stability to increasing k_eta_max_scalar. Obviously need to include non-linear corrections on small scales.

Also note limber_windows = T currently doesn't work, set limber_windows = F (any fixed welcome!)
Back to top
View user's profile [ Hidden ] Visit poster's website
gongbo zhao



Joined: 04 Jan 2005
Posts: 69
Affiliation: ICG, Portsmouth

PostPosted: March 30 2008  Reply with quote

Thanks Antony!
But if my window function peaks at low redshift, 0.1 for example, I have to set a huge max_eta_k, which greatly slows down the computation and might give rise to memory leaks if I have multi-bins. (I tested and found max_eta_k should be larger than 1500000 for the window peaking at z~0.1 to avoid the numerical instability).

So is it a simple solution to this problem? For example, increasing the stepsize for k integration at small scales?


Thanks,
Gong-Bo
Back to top
View user's profile [ Hidden ] Visit poster's website
Antony Lewis



Joined: 23 Sep 2004
Posts: 1309
Affiliation: University of Sussex

PostPosted: March 30 2008  Reply with quote

Probably need to use Limber approximation. If you get it to work please let me know.
Back to top
View user's profile [ Hidden ] Visit poster's website
gongbo zhao



Joined: 04 Jan 2005
Posts: 69
Affiliation: ICG, Portsmouth

PostPosted: March 30 2008  Reply with quote

But I need the cross-correlations. I tried modifying the k intervals for integration at small scales (using log-spacing rather than linear), something like that
Code:

            dk2 = 0.005*dlnk1  !very small scales
            dk3 = 10*dk2  !very small scales
          if (qmax_int > max_k_dk) then
           !This allows inclusion of high k modes for computing BB lensed spectrum accurately
           !without taking ages to compute.

            call Ranges_Add_delta(ThisCT%q, max_k_dk, qmax_int/2, dk2, IsLog = .true.)
            call Ranges_Add_delta(ThisCT%q, qmax_int/2, qmax_int, dk3, IsLog = .true.)

 

The results 'seem' fine without ages of computing time. The number of dk2 and dk3 is a guesswork, it can be further optimized. I wonder if there's some better way to do this without limber?


Cheers
Gongbo
Back to top
View user's profile [ Hidden ] Visit poster's website
gongbo zhao



Joined: 04 Jan 2005
Posts: 69
Affiliation: ICG, Portsmouth

PostPosted: April 20 2008  Reply with quote

After some tests, I found a fix of the Limber approximation part for lensing. The problem is the missing of a factor of l(l+1)/2 in the limber source. To get it work, do the following,
in the innermost loop in subroutine GetLimberTransfers in cmbmain.f90,
add

Code:

if(W%kind == window_lensing) &
              ThisCT%Limber_windows(s_ix,ell)%Source(n-n1+1)=&
ThisCT%Limber_windows(s_ix,ell)%Source(n-n1+1)/2*ThisCT%ls%l(ell)*(ThisCT%ls%l(ell)+1)



Cheers
Gong-Bo
Back to top
View user's profile [ Hidden ] Visit poster's website
gongbo zhao



Joined: 04 Jan 2005
Posts: 69
Affiliation: ICG, Portsmouth

PostPosted: April 20 2008  Reply with quote

Update: The above modification only works for single lensing bin. For multi-bins, replace subroutine CalcLimberScalCls in cmbmain.f90 with the following,

Code:


     subroutine CalcLimberScalCls(CTrans)
       Type(ClTransferData) :: CTrans
       integer ell, i, s_ix, ik, pix
        real(dl) CL, reall,fac
        Type(TRedWin), pointer :: W


      if (.not. limber_windows) return
      do pix=1,CP%InitPower%nn

       do i =1, num_redshiftwindows
          W => Redshift_w(i)
          s_ix = 3+i
        if (CTrans%limber_l_min(s_ix) /=0) then

        do ell = CTrans%limber_l_min(s_ix), Ctrans%ls%l0
          Cl = 0
          reall = real(CTrans%ls%l(ell),dl)
          fac = (2*pi**2)/fourpi/reall**3
          do ik = 1, CTrans%Limber_windows(s_ix,ell)%num_k
           if(W%kind == window_lensing) CTrans%Limber_windows(s_ix,ell)%Source(ik)=&
            CTrans%Limber_windows(s_ix,ell)%Source(ik)*reall*(reall+1)/2


           Cl=Cl+  CTrans%Limber_windows(s_ix,ell)%Source(ik)**2 * &
                fac*ScalarPower(CTrans%Limber_windows(s_ix,ell)%k(ik) ,pix)
                !  * reall**2/(2*pi)

          end do
          iCl_scalar(ell,C_PhiTemp + i,pix)  =Cl

        end do
        end if
       end do
      end do

     end subroutine CalcLimberScalCls



Gongbo
Back to top
View user's profile [ Hidden ] Visit poster's website
Steven Pediani



Joined: 06 Oct 2008
Posts: 16
Affiliation: University of Manchester

PostPosted: October 06 2008  Reply with quote

I'm guessing that the code has been updated since, as those subroutines don't exist in my copy of CAMB. I'm trying to generate the convergence power spectrum (like the one shown in the link posted by Gongbo Zhao), where the user is able to choose their window function, and one can work out other quantities like aperture mass and shear variance. I have done this for cmbfast, and decided it'd be useful to do the same to CAMB. I was under the impression that there was a simple relation between the convergence and the lensing potential power spectra, Cl (κ κ) = \frac{1}{4} l4 Cl(φ φ), and so the output in the scalar file, l4 Cl(φ φ), is the convergence? I ask as I can't get it to agree with any of my other work, and so am wondering if this is not the case, or is there a subtitle change needed in one of the starting parameters.

[EDIT] Never mind, got it working now.
Back to top
View user's profile  
Lukas Hollenstein



Joined: 31 Mar 2009
Posts: 16
Affiliation: IPhT CEA-Saclay

PostPosted: March 31 2009  Reply with quote

Hi,

Im also interested in the convergence power spectrum. Thanks to Gongbo Zhao for pointing out how to get the Limber approximation right. Now I think I get the right answer in the linear case.

As Gongbo already pointed out, there is a problem with the non-linear lensing. When I switch to do_nonlinear=2, I get a bus error, no matter if compiled with gfortran, g95 or ifort.

Did anybody find the problem here? Thanks!
Back to top
View user's profile   Visit poster's website
Antony Lewis



Joined: 23 Sep 2004
Posts: 1309
Affiliation: University of Sussex

PostPosted: March 31 2009  Reply with quote

There seem to be several bugs that stop this working.

In cmbmain.f90 try changing CalcScalarSources to have some traps for j < TimeSteps%npoints:

Code:

!     Calculation of transfer functions.
101          if (CP%WantTransfer.and.itf <= CP%Transfer%num_redshifts) then
                 if (j < TimeSteps%npoints) then
                  if (j < TimeSteps%npoints.and.tauend < tautf(itf) .and.TimeSteps%points(j+1) > tautf(itf)) then
                         
                     call GaugeInterface_EvolveScal(EV,tau,y,tautf(itf),tol1,ind,c,w)

                  endif
                 end if
!     output transfer functions for this k-value.
                     
                  if (abs(tau-tautf(itf)) < 1.e-5_dl) then
                           call outtransf(EV,y, MT%TransferData(:,EV%q_ix,itf))
                         
                           itf=itf+1
                           if (j < TimeSteps%npoints) then
                            if (j < TimeSteps%npoints.and.itf <= CP%Transfer%num_redshifts.and. &
                                TimeSteps%points(j+1) > tautf(itf)) goto 101
                           end if     
                  endif

                  end if
             end if


and in modules.f90

Code:
        if (CP%WantTransfer) then
            deallocate(MT%optical_depths, stat = RW_i)           
            allocate(MT%optical_depths(CP%Transfer%num_redshifts))
            do RW_i = 1, CP%Transfer%num_redshifts
                MT%optical_depths(RW_i) =  -sdotmu(transfer_ix(RW_i))+sdotmu(nthermo)
            end do
        end if


should be something like

Code:
        if (CP%WantTransfer) then
            deallocate(MT%optical_depths, stat = RW_i)           
            allocate(MT%optical_depths(CP%Transfer%num_redshifts))
            do RW_i = 1, CP%Transfer%num_redshifts
               if (CP%Transfer%Redshifts(RW_i) < 1e-3) then
                MT%optical_depths(RW_i) = 0 !zero may not be set correctly in transfer_ix
               else
                MT%optical_depths(RW_i) =  -sdotmu(transfer_ix(RW_i))+sdotmu(nthermo)
               end if
            end do
        end if


(or fix how it sets up the indices, or just comment out since not needed for lensing anyway)

I do have an updated version of CAMB_sources, but there is a big disagreement with 0902.1759 I would like to undestand first (also in with current version, which includes the effect too).
Back to top
View user's profile [ Hidden ] Visit poster's website
Lukas Hollenstein



Joined: 31 Mar 2009
Posts: 16
Affiliation: IPhT CEA-Saclay

PostPosted: April 01 2009  Reply with quote

Thanks Antony,

however these fixes don't help with the bus error. After digging a bit I found out that there is a problem with deallocating Pk_data in MatterPowerdata_Free (modules.f90). Commenting a few lines seems to help:

Code:

      subroutine MatterPowerdata_Free(PK_data)
          Type(MatterPowerData) :: PK_data
          integer i

          deallocate(PK_data%log_kh,stat=i)
          deallocate(PK_data%matpower,stat=i)
          deallocate(PK_data%ddmat,stat=i)
          deallocate(PK_data%nonlin_ratio,stat=i)
          deallocate(PK_data%redshifts,stat=i)

       !! temporary fix to bus error if do_nonlinear=2
       !   deallocate(PK_data%log_k,stat=i)
       !   deallocate(PK_data%nonlin_ratio_vv,stat=i)
       !   deallocate(PK_data%nonlin_ratio_vd,stat=i)
       !   deallocate(PK_data%vvpower,stat=i)
       !   deallocate(PK_data%ddvvpower,stat=i)
       !   deallocate(PK_data%vdpower,stat=i)
       !   deallocate(PK_data%ddvdpower,stat=i)

          call MatterPowerdata_Nullify(PK_data)

      end subroutine MatterPowerdata_Free


But obviously then the memory isn't freed. As far as I can see, these arrays are not in all cases allocated and cannot be deallocated consequently. Unfortunately, one cannot check if they're allocated because they're pointers rather than allocatable arrays. I'm not really an expert in Fortran. Any idea?

BTW, there seem to be more problems with pointers and their deallocation as indicated by a list of remaining memory after running CAMB (at least when compiled with g95 and the flag -ftrace=full).

E.g., ThiThisCT%Limber_windows(s_ix,ell)%k, ThisCT%Limber_windows(s_ix,ell)%Source and CTrans%Limber_windows are actually not deallocated.

I don't know if that is worrying?

Does this
Quote:
I do have an updated version of CAMB_sources, but there is a big disagreement with 0902.1759 I would like to undestand first (also in with current version, which includes the effect too).

mean that you don't trust the lensing results yet? Or does it only affect the redshift distortions?

Thanks a lot, cheers,
Lukas
Back to top
View user's profile   Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software All times are GMT + 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group. Sponsored by WordWeb online dictionary and dictionary software.