CompartmentalSystems.start_distributions¶
Module for computing age distributions or moments thereof to be used as start distributions in subsequent simulations.
The age distribution at the start \(t_0\) is NOT defined by the reservoir model and the initial values. In fact EVERY age distribution can be chosen. The implemented algorithms will correctly project it to any time \(t\). This module provides several ways to generate such a distribution.
The functions containing the word ‘distributions’ usually return a vector valued function of age representing pool wise age distributions that are NOT normalized (Integrating of a vector component over all ages yields the mass of the corresponding pool.) , and in some cases a start vector that should be used in the subsequent simulation for which the start age distribution is computed.
The functions containing the word ‘moments’ usually return an array: moments x pools, containing the moments of the pool ages . representing the initial values needed for the moment systems e.g. the mean of a start distribution to be used as initial value for the mean age system. The length of the list is determined by the maximum order of the moment system to be solved. In some cases a consistent start vector is also provided.
Zero start age distributions¶
The distributions eaisiest to imagine are those that start with zero age:
The one with all pools empty provided by: :py:meth:`start_age_distributions_from_zero_initial_content and the respective moments by: :py:meth:`start_age_moments_from_zero_initial_content
The one where all initial mass has age zero, provided by: :py:meth:`start_age_distributions_from_zero_age_initial_content
Established distributions¶
However for many applications one is interested in the CHANGE of an age distribution that has been established over a (possibly infinitely) long period of time.
Spinup
If we start the computation with all pools empty at time \(0\) and run it till time \(t = a_{max}\), the resulting distribution will be non zero only in the interval \([0,a_{max}]\). Such a distribution is provided by:
start_age_distributions_from_empty_spinup()
and the moments by: :py:meth:`start_age_moments_from_empty_spinupNote that the finiteness of the spin up time has to be considered in the choice of questions that can be asked. For instance do not mistake the fact that the percentage of material older than \(a_{max}\) will increase over time for a property of the system, where it is actually a property of the start distribution resulting from the finiteness of the spin up time.
Distributions induced by steady states of the autonomous system, if those exist.
If the term ‘established’ is taken to the limit of infinity one can look for a related system that has persisted unchanged for all times \(t<t_0\) and start with the age distribution created by such a system. Such a distribution can only occur if the system has been in a steady state. For a general non-autonomous system this is very unlikely that such a steady state exist at all. However we can consider a related autonomous system resulting from ‘freezing’ the general non-autonomous system at a time \(t_0\). Even for such an autonomous system it is uncertain if and where equilibria exist. This has to be checked before an equilibrium age distribution can be computed. Actually the following steps have to be performed:
Transform the general nonlinear non-autonomous system into a nonlinear autonomous system by freezing it at time \(t=t_0\):
Compute \(u_0(x)=u(t_0,x_0)\) and \(B_0(x)=B(t_0,x_0)\)
Look for an equilibrium \(x_{fix}\) of the frozen system such that \(0=B_0(x_{fix})+u_0(x_{fix})\). If the frozen system is linear the we can compute the fixed point explicitly : \(x_{fix}=B_0^{-1}u_0\). In general the frozen system will be nonlinear and we will have to look for the fixed point numerically.
Compute the age distribution of the system at equilibrium \(x_{fix}\). This can be done using the formulas for linear autonomous pool models. (At the fixed point the nonlinear system is identical to a linear one. This is a special case of the general idea of linearizing a nonlinear model with respect to a trajectory, which in case of a fixed point is constant.)
All these steps are performed by
start_age_distributions_from_steady_state()
andstart_age_moments_from_steady_state()
.Note that \(x_{fix}\) is the compatible start vector that has to be used along with this start distributions for the following computation.
Functions
|
|
|
If a fixedpoint of the frozen system can be found, create a linear autonomous model as an equivalent for the frozen (generally nonlinear) system there. |
Finite age spin up from empty pools |
|
Compute the age distribution of the system at equilibrium \(x_{fix}\) , by means of a linear autonomous pool model with identical age distributions. |
|
|
Returns the age distribution (function) for a system into which all initial mass is injected instantaneous at \(t=0\). |
Returns the age distribution (function) for an empty system. |
|
|
Compute the age moments of the system at equilibrium \(x_{fix}\) , by means of a linear autonomous pool model with identical age distributions. |
The function returns an array of shape (max_order, srm.nr_pools) |