Skip to content

Commit

Permalink
remove warning, add error in lua for safety
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbayer committed Jan 8, 2024
1 parent a3273eb commit c90d61a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion libfastpm/cosmology.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ static ode_soln growth_ode_solve(double a, FastPMCosmology * c)
if (a >= aini) {
fastpm_raise(-1, "Growth ODE unsuccesful at a=%g.", a);
} else {
fastpm_info("WARNING: Growth ODE unsuccesful at a=%g. Returning growth of 0.", a);
soln.y0 = 0;
soln.y1 = 0;
soln.y2 = 0;
Expand Down
7 changes: 7 additions & 0 deletions src/lua-runtime-fastpm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ schema.growth_mode.choices = {
ODE = 'FASTPM_GROWTH_MODE_ODE',
}

-- enforce a<0.00625 (hard coded) when using ODE growth mode
function schema.time_step.action (time_step)
if time_step[1] < 0.00625 then
error("Cannot start the simulation at a<0.00625 when growth_mode=='ODE'.")
end
end

-- enforce Omega_m
function schema.omega_m.action (value)
if value ~= nil then
Expand Down

0 comments on commit c90d61a

Please sign in to comment.