trotsiuk / r3PG

An R package for forest growth simulation using the 3-PG process-based model
https://trotsiuk.github.io/r3PG/
GNU General Public License v3.0
27 stars 16 forks source link

Premature end of simulation - No mortality, but are all trees dead? #75

Closed Rasilgon closed 2 years ago

Rasilgon commented 2 years ago

When testing r3PG with different initial conditions, I sometimes obtained an output like the one below. In this specific case, the simulation should have ended in 2090, but it did in 2031. In all similar situations, I assume that the simulations ends because all trees died, However, none of the mortalities show that trees died.

I would like to know if it is correct to assume that the simulation ended because all trees died. If so, it looks like a sudden death of all trees, which is very impressive. Besides, I feel that is confusing there is no mortality happening, which would indicate that all trees are dying or died. Is this the expected behaviour of the model?

If the simulation end is not related to mortality, I would appreciate if you have any other ideas about what can be causing such model behaviour. The data is here, but as I said before, it happened already with other input data.

image

Code


load(file = "test_1103_555.RData")
out_3PG <- run_3PG(site       = t_site,
                   climate    = t_climate, 
                   species    = t_species, 
                   thinning   = t_thinning, 
                   parameters = t_par, 
                   size_dist  = t_sizeDist, 
                   settings   = t_settings
)
i_var <- c('height',   "dbh", 'volume_cum', "stems_n", "biom_stem", "biom_root",
           "biom_foliage", "mort_thinn", "mort_stress", "layer_id" )
i_lab <- i_var
out_3PG %>%
  filter(variable %in% i_var) %>%
  mutate(variable = factor(variable, levels = i_var)) %>%
  ggplot( aes(date, value))+
  geom_line( aes(color = species), size = 0.5)+
  facet_wrap( ~ variable, scales = 'free_y', ncol = 3, 
              labeller = labeller(variable = setNames(i_lab, i_var) )) +
  scale_color_brewer('', palette = 'Dark2') +
  theme_classic()+
  theme(legend.position="bottom")+
  xlab("Calendar date") + ylab('Value') 
twest820 commented 2 years ago

It's not entirely clear, but I believe "premature end of simulation" is referring to 1) Picea abies traces stopping at 2023 and 2) Fagus sylvatica stopping at 2034. The obvious event at the start of 2024 is Picea abies turns 42 and gets thinned. If I pass NULL for t_thinning both species continue to 2090 as configured in t_site.

This suggests to me this issue might be, so far as r3PG is concerned, another flavor of #73 as the age 42 thin specifies a stem mortality ratio of 113. So thinning spruce from 744.6 to 713 TPH is going to remove the stem biomass for up to 3571 average trees per hectare. It seems unlikely the stand structure is such that it's possible to thin from above this aggressively without removing all trees.

The Fagus sylvatica root, stem, and foliage management multipliers are also elevated so I suspect the reason for output stopping in 2034 is that, with Picea abies removed, a similar removal gets triggered in beech.

Assuming I'm in the right direction here, it may be helpful to log mort_manag into the output to make this more diagnosable. I also suspect this bit of run_3PG.R is suppressing the Picea abies traces once it goes to stems_n = 0.

  # Remove the values for dead cohort or not recruited cohort
  remove_sim_arr <- array(r3PG_out[,,2,2] <= 0 | r3PG_out[,,2,1] < 0, dim=dim(r3PG_out))
trotsiuk commented 2 years ago

@twest820 thank you for the quick identification of the issue! Indeed, I think the issue is coming from the t_thinning and suggestion for #73 is very valuable in this aspect.

@Rasilgon the stem, root, foliage shall indicate the ration at which those stem parts need to be thinned (usually around 1), but not the actual values of biomass (as currently present in the t_thinning). page 10 of the original 3PG manual

Residual stocking (trees ha-1) after thinning at the nominated age, and biomass pools of each tree removed by the thinning, expressed as a fraction of the foliage, root and stem biomass of an average single tree in the stand at thinning. Fractions greater than 1 simulate thinning from above.

P.S. Sorry for low responsiveness due to personal issues, shall be more available soon

Rasilgon commented 2 years ago

Hi @trotsiuk and @twest820 ! Thanks, yes, you are totally right. There was a bug in the code that created the thinning plan. Sorry, I should have checked better the input data. Anyway, thanks for taking the time :)

florianhartig commented 2 years ago

Hi all, comment from me: regardless, I would prefer keeping the simulation running and output 0, instead of stopping. This will avoid errors down the line (e.g. when using the model in a larger pipeline).

trotsiuk commented 2 years ago

Hi Florian and all, this is related to the pull request from @JohannesOberpriller https://github.com/trotsiuk/r3PG/pull/60 . The simulation is running but output is NA instead of 0. Please see the discussion there and potentially extend it.