out_det <-
crossing(
# 1. p00 2. pG0 3. pL0 4. pGG 5. pSS 6. p0G 7. p0S 8. pLS 9. pGS 10. pLG
nvec = "n0 = [0.1, 0.1, 0.1, 0.6, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0];",
# nvec = "n0 = [0.1, 0.1, 0, 0, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0];",
# nvec = "n0 = [0.2, 0, 0, 0.4, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0];",
rs = list(c(rG = 1, rS = 1.55)),
ms = list(c(mG = 0.1, mS = 0.1)),
ds = list(c(dG = 0.25, dS = 0.25)),
cs = list(c(cG = 0.2, cS = 0.2)),
mGG = crossing(mSS = seq(0.5,1.5, 0.01), mGG = seq(0.5,1.5, 0.01)) |> pull(mGG),
mSS = crossing(mSS = seq(0.5,1.5, 0.01), mGG = seq(0.5,1.5, 0.01)) |> pull(mSS),
time = 2000,
fint = 50000,
intensity = 0.2) |>
rowwise() |>
mutate(mijs = list(c(mGG = mGG, mSG = 1, mGS = 1, mSS = mSS)),
pvec = list(c(rs,ms,ds,cs, mijs)),
pvec = paste0("p = (", vec_to_tup(pvec), ");")) |>
mutate(julia_out = list(run_model_ffp(n = nvec, p = pvec, time = time,
fireint = fint, intensity = intensity, ffp = 0,
which_model = "fire_shrubstructured")))
plot_det <-
out_det |>
mutate(julia_out = list(julia_out[julia_out[,"timestamp"] > 1950,] )) |>
mutate(pGrass = mean(rowSums(julia_out[,c("pG0(t)", "pGG(t)", "pGS(t)")])),
pShrub = mean(rowSums(julia_out[,c("pL0(t)", "pLS(t)", "pLG(t)", "pSS(t)")])),
pEmpty = mean(rowSums(julia_out[,c("p00(t)", "p0G(t)", "p0S(t)")]))) |>
group_by(fint, intensity) |>
group_by(mGG, mSS) |>
summarize(mean_pGrass = mean(pGrass)) |>
ggplot() +
geom_tile(aes(x = mGG, y = mSS, fill = mean_pGrass), color = NA) +
geom_hline(yintercept = 1, color = "white", linewidth = 1.5) +
geom_vline(xintercept = 1, color = "white", linewidth = 1.5) +
scale_fill_viridis_c(name = "Equilibrium grass frequency")+
scale_x_continuous(expand = c(0,0))+
scale_y_continuous(expand = c(0,0))+
labs(x = latex2exp::TeX("$m_{gg}$"),
y=latex2exp::TeX("$m_{ss}$"), tag = "A. ")