Forest dieback with replicator dynamics of mitigators
The forest dieback model coupled with the replicator dynamics of mitigators.
- Class:
SocialForestDiebackSystem - Import:
from skcomplex.systems.physics.climate import SocialForestDiebackSystem - Field:
physics/climate - Topics:
tipping points,vegetation,social dynamics,replicator,delay,dde - References:
- Liu and Bauch 2023
- Bury, Bauch, and Anand 2019
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.physics.climate import SocialForestDiebackSystem
trajectory = SocialForestDiebackSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
v |
0.8 |
x |
0.5 |
Tv |
30.0 |
Tc |
1.0 |
alpha |
1.0 |
delta |
1.0 |
fmax |
5.0 |
w |
3.0 |
tp |
10.0 |
tf |
15.0 |
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 SocialForestDiebackSystem(BaseSystem):
"""The forest dieback model coupled with the replicator dynamics of mitigators.
The mitigators perceive the warming of the forest.
The forest grows as in `ForestDiebackSystem`, with its growth rate scaled by `0.2 + 0.4 x`, so that mitigation by
the share `x` of the population helps it. The share follows the replicator equation `x' = x (1 - x) (-alpha + f(Tf)
+ delta (2 x - 1))`, where the cost of warming `f = fmax / (1 + exp(-w (Tf - Tc)))` reads the warming `Tf = tf / tp
(T(t) - T(t - tp))` projected from the last `tp` years, a delay differential equation. Before the start the cover
keeps its initial value. With no warming the shares 0 and 1 are stable and the share `x* = 1 - (fmax / 2) / (1 +
exp(w Tc))` between them is unstable, for the defaults of `alpha`, `delta`, and `w`. The population converges to all
or no mitigators, and the forest to a positive cover or to bare soil, the green, brown, and barren outcomes, with
long swings for some temperatures. The system has the vegetation cover `forest.v` and the share of mitigators
`people.x`.
Args:
v:
The initial vegetation cover, and its value before the start.
x:
The initial share of mitigators.
Tv:
The ambient temperature under full forest cover, in degrees Celsius.
Tc:
The critical warming.
alpha:
The cost of mitigation.
delta:
The strength of the social norm.
fmax:
The largest cost of warming.
w:
The steepness of the cost of warming.
tp:
The years of past warming that the projection reads.
tf:
The years ahead of the projection.
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.physics.climate import SocialForestDiebackSystem
>>> SocialForestDiebackSystem(Tc=2.5).prepare().system_.interactions[1].Tc
2.5
"""
field = 'physics/climate'
topics = ('tipping points', 'vegetation', 'social dynamics', 'replicator', 'delay', 'dde')
references = ('Liu and Bauch 2023', 'Bury, Bauch, and Anand 2019')
until = 200.0
dt = 0.5
def __init__(
self,
v: float = 0.8,
x: float = 0.5,
*,
Tv: float = 30.0,
Tc: float = 1.0,
alpha: float = 1.0,
delta: float = 1.0,
fmax: float = 5.0,
w: float = 3.0,
tp: float = 10.0,
tf: float = 15.0,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.v = v
self.x = x
self.Tv = Tv
self.Tc = Tc
self.alpha = alpha
self.delta = delta
self.fmax = fmax
self.w = w
self.tp = tp
self.tf = tf
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of the forest, the population, and their coupling.
Args:
context:
The observables to compile with the problem, or `None` for none.
"""
super()._prepare(context)
mitigation = MitigationInteraction(
'mitigation',
target='people',
forest='forest',
alpha=self.alpha,
delta=self.delta,
fmax=self.fmax,
w=self.w,
Tc=self.Tc,
tp=self.tp,
tf=self.tf,
)
self.system_ = System(
self.label,
elements=[ForestCoverElement('forest', v=self.v, Tv=self.Tv), MitigatorsElement('people', x=self.x)],
interactions=[MitigatedForestGrowthInteraction('growth', target='forest', mitigators='people'), mitigation],
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
Interactions:
MitigatedForestGrowthInteraction, fromInteractionMitigationInteraction, fromInteraction
class ForestCoverElement(Element):
"""Vegetation cover of a tropical forest and the temperature of its soil.
The cover `v` runs from 0 for bare soil to 1 for full forest. Bare soil is warmer than forest by `a`, so the local
temperature is `T = Tv + a (1 - v)`. `ForestGrowthInteraction` gives the growth of the cover.
Args:
label:
The label of the forest.
v:
The initial vegetation cover.
Tv:
The ambient temperature, the temperature under full forest cover, in degrees Celsius.
a:
The warming of bare soil over forest.
Examples:
>>> from skcomplex.systems.physics.climate import ForestCoverElement
>>> ForestCoverElement('forest').Tv
30.0
"""
def __init__(
self,
label: str,
*,
v: Annotated[float, RealSet.closed(0, 1)] = 0.8,
Tv: float = 30.0,
a: float = 5.0,
) -> None:
super().__init__(label)
self.v = v
self.Tv = Tv
self.a = a
class MitigatorsElement(Element):
"""Share of mitigators in a population.
The share `x` runs from 0 to 1, and `MitigationInteraction` gives its replicator dynamics.
Args:
label:
The label of the population.
x:
The initial share of mitigators.
Examples:
>>> from skcomplex.systems.physics.climate import MitigatorsElement
>>> MitigatorsElement('people', x=0.3).x
0.3
"""
def __init__(self, label: str, *, x: Annotated[float, RealSet.closed(0, 1)] = 0.5) -> None:
super().__init__(label)
self.x = x
class MitigatedForestGrowthInteraction(ForestGrowthInteraction):
"""Growth of the cover of a forest helped by the share of mitigators of a population.
The growth rate of `ForestGrowthInteraction` is scaled by `0.2 + 0.4 x`, where `x` is the share of mitigators.
Args:
label:
The label of the interaction.
target:
The path of the forest.
mitigators:
The path of the population whose share of mitigators helps the forest.
g0:
The largest growth rate.
beta:
The half width of the growth rate against the temperature.
Topt:
The optimal temperature of growth.
gamma:
The disturbance rate.
Examples:
>>> from skcomplex.systems.physics.climate import MitigatedForestGrowthInteraction
>>> MitigatedForestGrowthInteraction('growth', target='forest', mitigators='people').mitigators
'people'
"""
def __init__(
self,
label: str,
*,
target: Role,
mitigators: Role,
g0: Annotated[float, RealSet.closed_open(0, oo)] = 2.0,
beta: Annotated[float, RealSet.open(0, oo)] = 10.0,
Topt: float = 28.0,
gamma: Annotated[float, RealSet.closed_open(0, oo)] = 0.2,
) -> None:
super().__init__(label, target=target, g0=g0, beta=beta, Topt=Topt, gamma=gamma)
self.mitigators = mitigators
def _get_efficiency(self, context: SimpleNamespace) -> Expression | float:
"""Return the factor `0.2 + 0.4 x` of the growth rate."""
efficiency: Expression = 0.2 + 0.4 * context.mitigators.x
return efficiency
class MitigationInteraction(Interaction):
"""Replicator dynamics of the share of mitigators, who perceive the warming of a forest.
The share `x` of the target follows `x' = x (1 - x) (-alpha + f + delta (2 x - 1))`, with the cost of mitigation
`alpha`, the strength `delta` of the social norm, and the cost of warming `f = fmax / (1 + exp(-w (Tf - Tc)))`. The
perceived warming `Tf = tf / tp (T(t) - T(t - tp))` projects the warming of the forest over the last `tp` years
over `tf` years.
Args:
label:
The label of the interaction.
target:
The path of the population.
forest:
The path of the forest whose warming the population perceives.
alpha:
The cost of mitigation.
delta:
The strength of the social norm.
fmax:
The largest cost of warming.
w:
The steepness of the cost of warming.
Tc:
The critical warming.
tp:
The years of past warming that the projection reads.
tf:
The years ahead of the projection.
Examples:
>>> from skcomplex.systems.physics.climate import MitigationInteraction
>>> MitigationInteraction('mitigation', target='people', forest='forest').tp
10.0
"""
law_classes = (RateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
forest: Role,
alpha: float = 1.0,
delta: float = 1.0,
fmax: Annotated[float, RealSet.closed_open(0, oo)] = 5.0,
w: Annotated[float, RealSet.closed_open(0, oo)] = 3.0,
Tc: float = 1.0,
tp: Annotated[float, RealSet.open(0, oo)] = 10.0,
tf: Annotated[float, RealSet.closed_open(0, oo)] = 15.0,
) -> None:
super().__init__(label)
self.target = target
self.forest = forest
self.alpha = alpha
self.delta = delta
self.fmax = fmax
self.w = w
self.Tc = Tc
self.tp = tp
self.tf = tf
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the replicator rate of the share of mitigators.
Args:
context:
The namespace of the population and the forest, the time `t`, and the parameters.
"""
super()._prepare(context)
people, forest, t = context.target, context.forest, context.t
past = forest.v(t=t - context.tp)
perceived = (
context.tf
/ context.tp
* (
ForestGrowthInteraction._get_temperature(forest, forest.v)
- ForestGrowthInteraction._get_temperature(forest, past)
)
)
cost = context.fmax / (1 + exp(-context.w * (perceived - context.Tc)))
rate = people.x * (1 - people.x) * (-context.alpha + cost + context.delta * (2 * people.x - 1))
self.laws_ = [RateLaw(people.x.diff(t), rate)]
Equations
The equations are those that symbolic returns for the system with its default parameters.
forest.v: diff(v_forest(t), t) == g0_growth*((a_forest*(v_forest(t) - 1) + Topt_growth - Tv_forest)^2/beta_growth^2 - 1)*(v_forest(t) - 1)*(0.4*x_people(t) + 0.2)*v_forest(t) - gamma_growth*v_forest(t)
people.x: diff(x_people(t), t) == -(delta_mitigation*(2*x_people(t) - 1) - alpha_mitigation + fmax_mitigation/(e^((Tc_mitigation - (a_forest*(v_forest(t - tp_mitigation) - 1) - a_forest*(v_forest(t) - 1))*tf_mitigation/tp_mitigation)*w_mitigation) + 1))*(x_people(t) - 1)*x_people(t)