lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
218 stars 291 forks source link

Error: input parameters for a modified equation of state. #538

Closed Hayyim-H closed 10 months ago

Hayyim-H commented 10 months ago

I'm trying to work with the code and create a new potential parameterization for the equation of state, something similar to the CLP parameterization. I've modified the files background.c, background.h, and input.c to introduce this new parameterization, and the Python 3 code I've written is as follows:

import numpy as np
import matplotlib.pyplot as plt
from classy import Class

params = {'h':0.7,
     'omega_b':0.046,
     'omega_cdm':0.254,
     'Omega_Lambda':0.7,
         'Omega_fld' : 0.5,
         'Omega_scf': -0.1,
         'gauge' : 'new',
     'A_s':2.1e-9,
     'n_s':0.96,
     'YHe':0.24,
         'fluid_equation_of_state' : 'EFF1',
     'output': 'mPk'}

cosmo = Class()
cosmo.set(params)
cosmo.compute()

z = 0
k = np.logspace(-4,0,500)
pk = [cosmo.pk(ki, 0.0) for ki in k]

plt.loglog(k,pkl)
plt.xlabel('k (h/Mpc)')
plt.ylabel('P(k) [(Mpc/h)^3]')
plt.legend()
plt.show()

The issue is that I'm getting the following error messages:

Error in Class: input_read_from_file(L:417) :error in input_shooting(pfc,ppr,pba,pth,ppt,ptr,ppm,phr,pfo,ple,psd,pop, input_verbose, &has_shooting, errmsg); =>input_shooting(L:724) :error in input_read_parameters(&(fzw.fc),ppr,pba,pth,ppt,ptr,ppm,phr,pfo,ple,psd,pop, errmsg); =>input_read_parameters(L:1629) :error in input_read_parameters_species(pfc,ppr,pba,pth,ppt, input_verbose, errmsg); =>input_read_parameters_species(L:3309) :condition (pba->scf_tuning_index >= pba->scf_parameters_size) is true; Tuning index 'scf_tuning_index' (0) is larger than the number of entries (0) in 'scf_parameters'.

I'm not sure what the problem might be, but I hope you can assist me. I would greatly appreciate it.