Skip to content

Commit

Permalink
steadySingleSpecies() now checks that species grow at least to matu…
Browse files Browse the repository at this point in the history
…rity.
  • Loading branch information
gustavdelius committed Aug 6, 2024
1 parent 537727c commit a99df23
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/steadySingleSpecies.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ steadySingleSpecies <- function(params, species = NULL,
w_max_idx <- sum(params@w <= params@species_params[sp, "w_max"])
idx <- w_min_idx:(w_max_idx - 1)

# Check that species can grow to maturity at least
w_mat_idx <- sum(params@w <= params@species_params[sp, "w_mat"])
if (any(growth[w_min_idx:w_mat_idx] == 0)) {
stop(sp, " cannot grow to maturity")
}

# Keep egg density constant
n0 <- params@initial_n[sp, w_min_idx]
# Steady state solution of the upwind-difference scheme used in project
Expand Down

0 comments on commit a99df23

Please sign in to comment.