Skip to content

Commit

Permalink
allow DE fluid w(a) table models with w<-1 as long as do not cross
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbant committed Nov 17, 2023
1 parent 898ec3a commit adfca4d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion camb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
__author__ = "Antony Lewis"
__contact__ = "antony at cosmologist dot info"
__url__ = "https://camb.readthedocs.io"
__version__ = "1.5.2"
__version__ = "1.5.3"

from . import baseconfig

Expand Down
Binary file modified camb/cambdll.dll
Binary file not shown.
6 changes: 6 additions & 0 deletions camb/dark_energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ def validate_params(self):
if self.wa and (self.w < -1 - 1e-6 or 1 + self.w + self.wa < - 1e-6):
raise CAMBError('fluid dark energy model does not support w crossing -1')

def set_w_a_table(self, a, w):
# check w array has elements that are all the same sign or zero
if np.sign(1 + np.max(w)) - np.sign(1 + np.min(w)) == 2:
raise ValueError('fluid dark energy model does not support w crossing -1')
super().set_w_a_table(a, w)


@fortran_class
class DarkEnergyPPF(DarkEnergyEqnOfState):
Expand Down
6 changes: 3 additions & 3 deletions docs/CAMBdemo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Using CAMB 1.5.1 installed at c:\\work\\dist\\git\\camb\\camb\n"
"Using CAMB 1.5.2 installed at c:\\work\\dist\\git\\camb\\camb\n"
]
}
],
Expand Down Expand Up @@ -1292,7 +1292,7 @@
"for z in zplot:\n",
" plt.loglog(k, PK.P(z,k))\n",
"plt.xlim([1e-4,kmax])\n",
"plt.xlabel('k Mpc')\n",
"plt.xlabel(r'k Mpc')\n",
"plt.ylabel('$P_\\Psi\\, Mpc^{-3}$')\n",
"plt.legend(['z=%s'%z for z in zplot]);\n"
]
Expand Down Expand Up @@ -2857,7 +2857,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\Antony\\AppData\\Local\\Temp\\ipykernel_29556\\455262666.py:12: UserWarning: Data has no positive values, and therefore cannot be log-scaled.\n",
"C:\\Users\\Antony\\AppData\\Local\\Temp\\ipykernel_30204\\455262666.py:12: UserWarning: Data has no positive values, and therefore cannot be log-scaled.\n",
" ax.set_xlim(k[0], k[-1])\n"
]
},
Expand Down
2 changes: 1 addition & 1 deletion fortran/DarkEnergyFluid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ subroutine TDarkEnergyFluid_Init(this, State)
this%num_perturb_equations = 0
else
if (this%use_tabulated_w) then
if (any(this%equation_of_state%F<-1)) &
if (any(this%equation_of_state%F<-1) .and. any(this%equation_of_state%F>-1)) &
error stop 'Fluid dark energy model does not allow w crossing -1'
elseif (this%wa/=0 .and. &
((1+this%w_lam < -1.e-6_dl) .or. 1+this%w_lam + this%wa < -1.e-6_dl)) then
Expand Down
2 changes: 1 addition & 1 deletion fortran/config.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module config
use constants, only: const_twopi
implicit none

character(LEN=*), parameter :: version = '1.5.2'
character(LEN=*), parameter :: version = '1.5.3'

integer :: FeedbackLevel = 0 !if >0 print out useful information about the model

Expand Down

0 comments on commit adfca4d

Please sign in to comment.