Skip to content

Commit

Permalink
Update extinction_callback()
Browse files Browse the repository at this point in the history
  • Loading branch information
ismael-lajaaiti committed Mar 8, 2024
1 parent bbce1b6 commit f8e5603
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions use_cases/tritrophic-biomass-vs-temperature.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import ColorSchemes: tol_light
using CairoMakie
using DataFrames
using EcologicalNetworksDynamics
import EcologicalNetworksDynamics: ExtinctionCallback

# Temperature gradient from 0 to 40°C, converted to Kelvin, with increments of 1°.
T0 = 273.15 # 0°C in Kelvin.
Expand All @@ -14,15 +13,14 @@ df = DataFrame(; T = Float64[], trophic_level = Int64[], Beq = Float64[])
tmax = 315_360_000_000 # From Binzer et al., 2012.
verbose = false # Do not show '@info' messages during simulation run.
trophic_lvl = [1, 2, 3]
callback_function(m) = ExtinctionCallback(1e-12, m._value, verbose)

# Run simulations for each temperature across gradient.
@info "Start simulations..."
for T in T_values
m = default_model(Foodweb([3 => 2, 2 => 1]), Temperature(T))
m.h = 1 # Set hill exponent to 1.
B0 = m.K[1] / 8 # Inital biomass.
callback = callback_function(m)
callback = extinction_callback(m, 1e-12)
solution = simulate(m, B0; tmax, callback)
Beq_vec = solution[end]
for (Beq, tlvl) in zip(Beq_vec, trophic_lvl)
Expand Down

0 comments on commit f8e5603

Please sign in to comment.