% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simulate.R
\name{deb_simulate}
\alias{deb_simulate}
\title{Simulate DEB Growth Trajectory}
\usage{
deb_simulate(t_max, p_Am, p_M, kappa, v, E_G, E0, L0, f = 1, dt = 0.5)
}
\arguments{
\item{t_max}{End time (days).}

\item{p_Am}{Surface-area-specific assimilation rate \eqn{\{p_{Am}\}}
(J d\eqn{^{-1}} cm\eqn{^{-2}}).}

\item{p_M}{Volume-specific somatic maintenance \eqn{[p_M]}
(J d\eqn{^{-1}} cm\eqn{^{-3}}).}

\item{kappa}{Allocation fraction to soma.}

\item{v}{Energy conductance (cm d\eqn{^{-1}}).}

\item{E_G}{Specific cost of structure (J cm\eqn{^{-3}}).}

\item{E0}{Initial reserve density (J cm\eqn{^{-3}}).}

\item{L0}{Initial structural length (cm).}

\item{f}{Scaled functional response \eqn{f \in [0,1]}.  Default 1.}

\item{dt}{Integration step size (days).  Default 0.5.}
}
\value{
Data frame with columns \code{time}, \code{E} (reserve), \code{V} (volume),
\code{L} (structural length).
}
\description{
Forward-integrates the standard 2-state DEB ODE (reserve \eqn{E},
structure \eqn{V}) using Euler's method.  This is a standalone
simulator independent of Stan — useful for exploring parameter
space, generating synthetic data, teaching, and prior predictive
checks.
}
\section{Numerical note}{

This uses the LSODA solver from \pkg{deSolve}, which
automatically switches between stiff (BDF) and non-stiff (Adams)
methods.  This matches the BDF solver used in the Stan models,
ensuring numerical consistency between R-side simulation and
Stan-side inference.  The \code{dt} parameter controls output
resolution, not integration accuracy (governed by \code{rtol}/\code{atol}
= 1e-6).
}

\examples{
# Simulate E. fetida growth for 84 days
traj <- deb_simulate(t_max = 84, p_Am = 5, p_M = 0.5,
  kappa = 0.75, v = 0.2, E_G = 400, E0 = 1, L0 = 0.1)
plot(traj$time, traj$L, type = "l", xlab = "Days", ylab = "L (cm)")
}
