writing derived parameters

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Mohammed Irshad
Posts: 11
Joined: March 28 2012
Affiliation: Institute for Theoretical Physics, University of Zurich

writing derived parameters

Post by Mohammed Irshad » March 28 2012

How to write derived parameters to the output chain files?

Jason Dossett
Posts: 97
Joined: March 19 2010
Affiliation: The University of Texas at Dallas
Contact:

writing derived parameters

Post by Jason Dossett » April 18 2012

Hi,
In params_cmb.f90 there is a function called CalcDerivedParams increase the number of derived params to however many new derived params you are adding, and add an entry for your new derived params. See example below.

Code: Select all

  function CalcDerivedParams(P, derived) result (num_derived)
     use settings
     use cmbtypes
     use ParamDef
     use Lists
     implicit none
     Type(real_pointer) :: derived
     Type(ParamSet) P
     Type(CMBParams) CMB
     real r10   
     integer num_derived 
     
     num_derived = 8 !Cosmomc has 7 derived params standard
   
     allocate(Derived%P(num_derived))
   
      call ParamsToCMBParams(P%P,CMB)

      if (lmax_tensor /= 0 .and. compute_tensors) then
          r10 = P%Info%Theory%cl_tensor(10,1)/P%Info%Theory%cl(10,1)
      else
        r10 = 0
      end if

      derived%P(1) = CMB%omv
      derived%P(2) = P%Info%Theory%Age
      derived%P(3) = CMB%omdm+CMB%omb
      derived%P(4) = P%Info%Theory%Sigma_8      
      derived%P(5) = CMB%zre
      derived%P(6) = r10
      derived%P(7) = CMB%H0
      !New derived parameter
      derived%P(8) = New_derived_parameter or calculation
  end function CalcDerivedParams

Mohammed Irshad
Posts: 11
Joined: March 28 2012
Affiliation: Institute for Theoretical Physics, University of Zurich

writing derived parameters

Post by Mohammed Irshad » April 19 2012

Thank you very much for this information

Post Reply