Skip to contents

Calculates daily nitrogen and phosphorus fluxes (ingestion, retention, excretion) for a fish using prey and predator elemental concentrations.

Usage

calculate_nutrient_balance(consumption, weight_gain, processed_nutrient_params)

Arguments

consumption

Vector of consumption by prey type (g/day)

weight_gain

Predator weight gain (g/day)

processed_nutrient_params

List with processed nutrient parameters

Value

A named list with three elements:

nitrogen

Named list with six numeric scalars describing daily nitrogen fluxes (g N/day): consumed, assimilated, growth, excretion, egestion, and assimilation_efficiency (dimensionless fraction, 0–1).

phosphorus

Same structure as nitrogen but for phosphorus (g P/day).

weight_gain

Numeric scalar. Predator weight gain (g/day), as supplied.

Experimental

Nutrient regeneration modelling is an **experimental feature** under active development. This function can be called directly to compute daily N and P fluxes for a single time step, but it is **not yet integrated** into the main `run_fb4()` simulation loop. Full integration (automatic daily nutrient tracking, inclusion in `fb4_result` objects, and TMB backend support) is planned for a future release. The API may change.

Examples

params <- list(
  prey_n_concentrations     = c(0.025, 0.030),
  prey_p_concentrations     = c(0.004, 0.005),
  predator_n_concentration  = 0.030,
  predator_p_concentration  = 0.004,
  n_assimilation_efficiency = c(0.80, 0.80),
  p_assimilation_efficiency = c(0.60, 0.60)
)
calculate_nutrient_balance(consumption = c(2.0, 1.0),
                           weight_gain = 0.5,
                           processed_nutrient_params = params)
#> $nitrogen
#> $nitrogen$consumed
#> [1] 0.08
#> 
#> $nitrogen$growth
#> [1] 0.015
#> 
#> $nitrogen$excretion
#> [1] 0.049
#> 
#> $nitrogen$egestion
#> [1] 0.016
#> 
#> $nitrogen$assimilated
#> [1] 0.064
#> 
#> $nitrogen$assimilation_efficiency
#> [1] 0.8
#> 
#> 
#> $phosphorus
#> $phosphorus$consumed
#> [1] 0.013
#> 
#> $phosphorus$growth
#> [1] 0.002
#> 
#> $phosphorus$excretion
#> [1] 0.0058
#> 
#> $phosphorus$egestion
#> [1] 0.0052
#> 
#> $phosphorus$assimilated
#> [1] 0.0078
#> 
#> $phosphorus$assimilation_efficiency
#> [1] 0.6
#> 
#> 
#> $weight_gain
#> [1] 0.5
#>