Mangrove succession
The regrowth of a mangrove forest of the Sundarbans after a clear cut.
- Class:
MangroveSuccessionSystem - Import:
from skcomplex.systems.biology.ecology import MangroveSuccessionSystem - Field:
biology/ecology - Topics:
succession,forest,ode,system dynamics,competition - References:
- Bala et al. 2017
- Tietjen and Huth 2006
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.biology.ecology import MangroveSuccessionSystem
trajectory = MangroveSuccessionSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
keora |
0.0 |
gewa |
0.0 |
sundari |
0.0 |
g_gewa |
0.05 |
g_sundari |
0.03 |
seedlings |
0.01 |
solver |
'auto' |
backend |
'auto' |
Tags
The system with its default parameters has these capability tags, which solvers and analyses check.
| Tag | Values |
|---|---|
| Time | continuous |
| Space | none |
| Laws | rate |
| Randomness | deterministic |
| Domains | real |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class MangroveSuccessionSystem(BaseSystem):
"""The regrowth of a mangrove forest of the Sundarbans after a clear cut.
It goes from pioneers to climax trees.
Keora, the pioneer, regrows fastest, Gewa, the intermediate group, follows, and Sundari, the climax group, grows
slowest but comes to dominate the mature forest and suppresses the others. Volumes, mature volumes, and competition
weights follow Bala et al. (2017), and the growth rates of Gewa and Sundari are illustrative. The system has the
stands `keora`, `gewa`, and `sundari`.
Args:
keora:
The initial stem volume of Keora, the pioneer.
gewa:
The initial stem volume of Gewa, the intermediate group.
sundari:
The initial stem volume of Sundari, the climax group.
g_gewa:
The specific growth rate of Gewa.
g_sundari:
The specific growth rate of Sundari.
seedlings:
The constant input of Gewa and Sundari seedlings.
label:
The label of the system, which names it when it is nested in another one.
solver:
The solver of the problem, or `'auto'` for the one the system chooses.
backend:
The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.
Examples:
>>> from skcomplex.systems.biology.ecology import MangroveSuccessionSystem
>>> [element.mature for element in MangroveSuccessionSystem().prepare().system_.elements]
[196.11, 80.0, 320.0]
"""
field = 'biology/ecology'
topics = ('succession', 'forest', 'ode', 'system dynamics', 'competition')
references = ('Bala et al. 2017', 'Tietjen and Huth 2006')
until = 300.0
dt = 1.0
def __init__(
self,
keora: float = 0.0,
gewa: float = 0.0,
sundari: float = 0.0,
*,
g_gewa: float = 0.05,
g_sundari: float = 0.03,
seedlings: float = 0.01,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.keora = keora
self.gewa = gewa
self.sundari = sundari
self.g_gewa = g_gewa
self.g_sundari = g_sundari
self.seedlings = seedlings
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of the regrowth of a mangrove forest after a clear cut.
The forest is of the Sundarbans.
Args:
context:
The observables to compile with the problem, or `None` for none.
"""
super()._prepare(context)
self.system_ = System(
self.label,
elements=[
StandElement('keora', volume=self.keora, mature=196.11),
StandElement('gewa', volume=self.gewa, mature=80.0),
StandElement('sundari', volume=self.sundari, mature=320.0),
],
interactions=[
PioneerGrowthInteraction('keora_growth', target='keora', intermediate='gewa', climax='sundari'),
SuccessionalGrowthInteraction(
'gewa_growth',
target='gewa',
first='gewa',
second='sundari',
g=self.g_gewa,
w_first=0.32,
w_second=0.68,
seedlings=self.seedlings,
),
SuccessionalGrowthInteraction(
'sundari_growth',
target='sundari',
first='gewa',
second='sundari',
g=self.g_sundari,
w_first=0.01,
w_second=0.99,
seedlings=self.seedlings,
),
],
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
StandElement, fromElement
Interactions:
PioneerGrowthInteraction, fromInteractionSuccessionalGrowthInteraction, fromInteraction
class StandElement(Element):
"""Stand of trees of one successional group, measured by its stem volume.
Args:
label:
The label of the stand.
volume:
The initial stem volume.
mature:
The stem volume of the group in a mature forest.
Examples:
>>> from skcomplex.systems.biology.ecology import StandElement
>>> StandElement('keora', mature=196.11).mature
196.11
"""
def __init__(
self,
label: str,
*,
volume: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
mature: Annotated[float, RealSet.open(0, oo)] = 100.0,
) -> None:
super().__init__(label)
self.volume = volume
self.mature = mature
class PioneerGrowthInteraction(Interaction):
"""Michaelis-Menten regrowth of pioneer trees.
The other groups suppress their input from seeds.
Alone, the volume follows `V(t) = V_mat t / (K_M + t)` after a clear cut, which is
`dV/dt = V (V / V_mat - 2) / K_M + C V_mat / K_M` with `C = 1`. The other groups reduce the factor
`C = 1 - w_I V_I / V_mat,I - w_C V_C / V_mat,C`, with weights normalized to sum to one, and no lower than 0.
Args:
label:
The label of the interaction.
target:
The path of the pioneer stand.
intermediate:
The path of the intermediate stand.
climax:
The path of the climax stand.
half_time:
The time `K_M` the pioneers take to reach half their mature volume.
w_intermediate:
The weight of the intermediate group in the competition.
w_climax:
The weight of the climax group in the competition.
Examples:
>>> from skcomplex.systems.biology.ecology import PioneerGrowthInteraction
>>> PioneerGrowthInteraction('growth', target='keora', intermediate='gewa', climax='sundari').half_time
3.65
"""
law_classes = (RateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
intermediate: Role,
climax: Role,
half_time: Annotated[float, RealSet.open(0, oo)] = 3.65,
w_intermediate: Annotated[float, RealSet.closed_open(0, oo)] = 0.32,
w_climax: Annotated[float, RealSet.closed_open(0, oo)] = 0.68,
) -> None:
super().__init__(label)
self.target = target
self.intermediate = intermediate
self.climax = climax
self.half_time = half_time
self.w_intermediate = w_intermediate
self.w_climax = w_climax
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rate of the `volume` of the target.
Args:
context:
The namespace of the bound elements, the time `t`, and the parameters.
"""
super()._prepare(context)
self.laws_ = [RateLaw(context.target.volume, self._get_rate(context))]
def _get_rate(self, namespace: SimpleNamespace) -> Expression:
"""Return the regrowth with the suppressed input from seeds.
Args:
namespace:
The namespace of the symbols the rate can use, with the stands.
Returns:
rate:
The rate of the volume of the pioneers.
"""
s = namespace
volume, mature = s.target.volume, s.target.mature
suppression = clip(
1 - PioneerGrowthInteraction._get_crowding(s.intermediate, s.climax, s.w_intermediate, s.w_climax),
low=0,
)
rate: Expression = (volume * (volume / mature - 2) + suppression * mature) / s.half_time
return rate
@staticmethod
def _get_crowding(
first: SimpleNamespace,
second: SimpleNamespace,
weight_first: Expression,
weight_second: Expression,
) -> Expression:
"""Return the weighted share of the mature volumes that two stands fill."""
total = weight_first + weight_second
return (
weight_first / total * first.volume / first.mature + weight_second / total * second.volume / second.mature
)
class SuccessionalGrowthInteraction(Interaction):
"""Logistic growth of intermediate or climax trees with seedling input.
They are crowded by their own group and another.
The rate is `dV/dt = a + g V (1 - w_1 V_1 / V_mat,1 - w_2 V_2 / V_mat,2)`, with weights normalized to sum to one.
One of the two crowding stands is usually the target itself.
Args:
label:
The label of the interaction.
target:
The path of the growing stand.
first:
The path of the first crowding stand.
second:
The path of the second crowding stand.
g:
The specific growth rate.
w_first:
The weight of the first crowding stand.
w_second:
The weight of the second crowding stand.
seedlings:
The constant input `a` of seedlings that averts extinction.
Examples:
>>> from skcomplex.systems.biology.ecology import SuccessionalGrowthInteraction
>>> SuccessionalGrowthInteraction('growth', target='gewa', first='gewa', second='sundari', g=0.1).g
0.1
"""
law_classes = (RateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
first: Role,
second: Role,
g: Annotated[float, RealSet.closed_open(0, oo)] = 0.05,
w_first: Annotated[float, RealSet.closed_open(0, oo)] = 0.5,
w_second: Annotated[float, RealSet.closed_open(0, oo)] = 0.5,
seedlings: Annotated[float, RealSet.closed_open(0, oo)] = 0.01,
) -> None:
super().__init__(label)
self.target = target
self.first = first
self.second = second
self.g = g
self.w_first = w_first
self.w_second = w_second
self.seedlings = seedlings
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rate of the `volume` of the target.
Args:
context:
The namespace of the bound elements, the time `t`, and the parameters.
"""
super()._prepare(context)
self.laws_ = [RateLaw(context.target.volume, self._get_rate(context))]
def _get_rate(self, namespace: SimpleNamespace) -> Expression:
"""Return the crowded logistic growth with the seedling input.
Args:
namespace:
The namespace of the symbols the rate can use, with the stands.
Returns:
rate:
The rate of the volume of the target.
"""
s = namespace
crowding = PioneerGrowthInteraction._get_crowding(s.first, s.second, s.w_first, s.w_second)
rate: Expression = s.seedlings + s.g * s.target.volume * (1 - crowding)
return rate
Equations
The equations are those that symbolic returns for the system with its default parameters.
keora.volume: diff(volume_keora(t), t) == ((volume_keora(t)/mature_keora - 2)*volume_keora(t) + mature_keora*where(-w_intermediate_keora_growth*volume_gewa(t)/(mature_gewa*(w_climax_keora_growth + w_intermediate_keora_growth)) - w_climax_keora_growth*volume_sundari(t)/(mature_sundari*(w_climax_keora_growth + w_intermediate_keora_growth)) + 1 < 0, 0, -w_intermediate_keora_growth*volume_gewa(t)/(mature_gewa*(w_climax_keora_growth + w_intermediate_keora_growth)) - w_climax_keora_growth*volume_sundari(t)/(mature_sundari*(w_climax_keora_growth + w_intermediate_keora_growth)) + 1))/half_time_keora_growth
gewa.volume: diff(volume_gewa(t), t) == -g_gewa_growth*(w_first_gewa_growth*volume_gewa(t)/(mature_gewa*(w_first_gewa_growth + w_second_gewa_growth)) + w_second_gewa_growth*volume_sundari(t)/(mature_sundari*(w_first_gewa_growth + w_second_gewa_growth)) - 1)*volume_gewa(t) + seedlings_gewa_growth
sundari.volume: diff(volume_sundari(t), t) == -g_sundari_growth*(w_first_sundari_growth*volume_gewa(t)/(mature_gewa*(w_first_sundari_growth + w_second_sundari_growth)) + w_second_sundari_growth*volume_sundari(t)/(mature_sundari*(w_first_sundari_growth + w_second_sundari_growth)) - 1)*volume_sundari(t) + seedlings_sundari_growth