Kinetics
Define the kinetic encounters that the systems of several fields share.
Distributions over the values of a trait meet in pairs and change class.
EncounterInteraction(label, *, candidate, field=None, rate=None, kernel=None, outcome='conservative', state='x', cross_section=None, factor=None)
Bases: Interaction
An interaction where members of two distributions meet and change class.
A distribution is a group of NonnegativeElement with one member per class of a trait. A candidate at class h
meets the field at class k at the rate rate[h, k], and the outcome says what follows:
'conservative': the candidate moves to classiwith the probabilitykernel[h, k, i].'destructive': the candidate is removed.'proliferative': the candidate creates a new candidate at classiwith the probabilitykernel[h, k, i], or at its own class without a kernel.
The rate and the kernel are functions of the namespace, which holds namespace.candidate, namespace.field, and
the parameters. On a PhaseSpace encounters pair classes at the same position. Without a field the encounter is a
linear redistribution between classes. With a cross_section the rate is the binary collision integral of kinetic
theory, evaluated by a fast spectral method, which keeps the density exactly and the momentum and energy to spectral
accuracy.
Unlike the bilinear form of the core, which its rate laws hold, it names the outcomes of an encounter and builds
the rates and kernels from them. Choose it when the change of a population comes from binary meetings of its
members.
It appears in many fields. Traders exchange wealth when they meet, people shift their opinion after a conversation, immune cells destroy tumour cells they meet, and gas molecules change velocity when they collide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
candidate
|
Role
|
The path of the group of the candidate density. |
required |
field
|
Role | None
|
The path of the group of the field density, or |
None
|
rate
|
Callable[[SimpleNamespace], object] | None
|
The function |
None
|
kernel
|
Callable[[SimpleNamespace], object] | None
|
The function |
None
|
outcome
|
str
|
|
'conservative'
|
state
|
str
|
The name of the state of the densities. |
'x'
|
cross_section
|
Callable[..., object] | None
|
The function |
None
|
factor
|
Callable[[SimpleNamespace], object] | None
|
A function of the namespace that returns a factor of the collision frequency, such as a function of the
density moment, or |
None
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The outcome is unknown, the state is no name, a function is not callable, a conservative encounter has no kernel, an encounter without a field is not conservative, an encounter has neither a rate nor a cross-section, or a cross-section comes with a rate, a kernel, a field, or an outcome. |
Examples:
>>> import numpy as np
>>> from skcomplex.systems.general.kinetics import EncounterInteraction
>>> kernel = np.full((3, 3, 3), 1 / 3)
>>> mixing = EncounterInteraction(
... 'mixing', candidate='population', field='population', rate=lambda s: 1.0, kernel=lambda s: kernel
... )
>>> mixing.outcome
'conservative'
>>> collide = EncounterInteraction('collide', candidate='gas', cross_section=lambda speed, cosine: 1.0)
>>> collide.rate is None
True
Source code in src/skcomplex/systems/general/kinetics/_encounter.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |