
Calculate contaminant accumulation (Mid-level - Main function)
Source:R/06-contaminant-accumulation.R
calculate_contaminant_accumulation.RdCalculates daily contaminant dynamics (uptake, elimination, body burden) for a fish using one of three bioaccumulation models (CONTEQ 1-3).
Usage
calculate_contaminant_accumulation(
respiration_o2,
consumption,
weight,
temperature,
current_concentration,
processed_contaminant_params
)Value
A named list with at least six elements (all numeric scalars unless noted):
- clearance
Daily elimination of contaminant (ug/day).
- uptake
Total daily uptake from food (ug/day); for CONTEQ 3 this is the sum of water and food uptake.
- new_burden
Body burden at end of day (ug); floored at 0.
- new_concentration
Whole-body concentration (ug/g wet weight); floored at 0.
- weight
Fish weight (g), as supplied.
- model_used
Integer. CONTEQ equation used (1, 2, or 3).
CONTEQ 3 (Arnot & Gobas 2004) appends two additional elements:
uptake_water (ug/day from water) and uptake_food
(ug/day from food).
Experimental
Contaminant modelling is an **experimental feature** under active development. This function can be called directly to compute daily bioaccumulation for a single time step, but it is **not yet integrated** into the main `run_fb4()` simulation loop. Full integration (automatic contaminant tracking across all simulation days, inclusion in `fb4_result` objects, and TMB backend support) is planned for a future release. The API may change.
Examples
# CONTEQ 1: food uptake only, no elimination
params <- list(
CONTEQ = 1,
prey_concentrations = c(0.05, 0.08),
transfer_efficiency = c(0.8, 0.8)
)
calculate_contaminant_accumulation(
respiration_o2 = 0.02, consumption = c(2.0, 1.0),
weight = 100, temperature = 15,
current_concentration = 0.1,
processed_contaminant_params = params
)
#> $clearance
#> [1] 0
#>
#> $uptake
#> [1] 0.144
#>
#> $new_burden
#> [1] 10.144
#>
#> $new_concentration
#> [1] 0.10144
#>
#> $weight
#> [1] 100
#>
#> $model_used
#> [1] 1
#>