ConservationLawsParticles.jl

Documentation for ConservationLawsParticles.jl.

Particle method for 1D conservation laws.

This package implements the deterministic particle schemes described in the article

E. Radici, F. Stra: Entropy solutions of mildly singular non-local scalar conservation laws with congestion via deterministic particle method. SIAM Journal on Mathematical Analysis 55.3 (2023), pp. 2001-2041. DOI: https://doi.org/10.1137/21M1462994. arXiv: https://arxiv.org/abs/2107.10760.

You can cite the article as

@article{doi:10.1137/21M1462994,
    author = {Radici, Emanuela and Stra, Federico},
    title = {Entropy solutions of mildly singular non-local scalar conservation
             laws with congestion via deterministic particle method},
    journal = {SIAM Journal on Mathematical Analysis},
    volume = {55},
    number = {3},
    pages = {2001-2041},
    year = {2023},
    doi = {10.1137/21M1462994},
    URL = {https://doi.org/10.1137/21M1462994},
    eprint = {2107.10760},
    eprinttype = {arxiv},
    eprintclass = {math.AP},
}

The convergence rate of the scheme is studied in the follow-up article (among other results)

@online{arxiv/2211.02450,
    author = {Marconi, Elio and Radici, Emanuela, and Stra, Federico},
    title = {Stability of quasi-entropy solutions of non-local scalar conservation laws},
    year = {2022},
    eprint = {2211.02450},
    eprinttype = {arxiv},
    eprintclass = {math.AP},
    url = {https://arxiv.org/abs/2211.02450},
}

Library

Public

ConservationLawsParticles.DiffusiveIntegratedModelType
DiffusiveIntegratedModel((V₁, ...), ((W₁₁, ...), ...), (mob₁, ...), (D₁, ...))

Represents a particles system with:

  • external velocities Vᵢ,
  • integrated interactions Wᵢⱼ (this is the effect of the species j on the species i),
  • mobilities mobᵢ,
  • diffusions Dᵢ.

See also DiffusiveSampledModel.

Examples

julia> using ConservationLawsParticles.Examples, RecursiveArrayTools

julia> model = DiffusiveIntegratedModel(
           (V, V),
           ((W_attr, W_rep),
            (W_rep, W_attr)),
           (mobρ, mobσ),
           (Diffusion(1), nothing));

julia> x = ArrayPartition(gaussian_particles(2, 4), collect(range(-3, 4, length=5)))
([-2.000000000000003, -0.30305473018369145, 0.30305473018369145, 2.000000000000003], [-3.0, -1.25, 0.5, 2.25, 4.0])

julia> velocities_diff(x, model, 0.)
([6.032353228461558, -0.7551163082821832, 0.6338610075015758, -6.3250083138486275], [23.261098611816987, 0.9023583690557855, 0.7055593913708742, -8.774526834146023, -55.23308442021724])
source
ConservationLawsParticles.DiffusiveSampledModelType
DiffusiveSampledModel((V₁, ...), ((W′₁₁, ...), ...), (mob₁, ...), (D₁, ...))

Represents a particles system with:

  • external velocities Vᵢ,
  • sampled interactions W′ᵢⱼ (this is the effect of the species j on the species i),
  • mobilities mobᵢ,
  • diffusions Dᵢ.

See also DiffusiveIntegratedModel.

Examples

julia> using ConservationLawsParticles.Examples, RecursiveArrayTools

julia> model = DiffusiveSampledModel(
           (V, V),
           ((Wprime_attr, Wprime_rep),
            (Wprime_rep, Wprime_attr)),
           (mobρ, mobσ),
           (Diffusion(1), nothing));

julia> x = ArrayPartition(gaussian_particles(2, 4), collect(range(-3, 4, length=5)))
([-2.000000000000003, -0.30305473018369145, 0.30305473018369145, 2.000000000000003], [-3.0, -1.25, 0.5, 2.25, 4.0])

julia> velocities_diff(x, model, 0.)
([5.701842050142524, -0.8139064918316994, 0.3386810988127882, -6.637012508114956], [22.405129478914613, 1.1249366684885518, 1.5188519354999799, -7.87111869358889, -54.536397957423915])
source
ConservationLawsParticles.HyperbolicModelType
HyperbolicModel((V₁, ...), ((I₁₁, ...), ...), (mob₁, ...))

Represents a particles system with:

  • external velocities Vᵢ,
  • integrated interactions Iᵢⱼ (this is the effect of the species j on the species i),
  • mobilities mobᵢ.

See also ParabolicModel.

Examples

julia> using ConservationLawsParticles.Examples, RecursiveArrayTools

julia> model = HyperbolicModel(
           (V, V),
           ((SampledInteraction(Wprime_attr), IntegratedInteraction(W_rep)),
            (IntegratedInteraction(W_rep), SampledInteraction(Wprime_attr))),
           (mobρ, mobσ));

julia> x = ArrayPartition(gaussian_particles(2, 4), collect(range(-3, 4, length=5)))
([-2.000000000000003, -0.30305473018369145, 0.30305473018369145, 2.000000000000003], [-3.0, -1.25, 0.5, 2.25, 4.0])

julia> abstract_velocities(x, model, 0.)
([6.267901451064502, 0.2629261335925302, -0.3841814343731375, -6.560556536451573], [22.921033907881895, 0.8199108735979148, 0.7055593913708742, -8.681409489341364, -54.89301971628215])
source
ConservationLawsParticles.IntegratedModelType
IntegratedModel((V₁, ...), ((W₁₁, ...), ...), (mob₁, ...))

Represents a particles system with:

  • external velocities Vᵢ,
  • integrated interactions Wᵢⱼ (this is the effect of the species j on the species i),
  • mobilities mobᵢ.

See also SampledModel.

Examples

julia> using ConservationLawsParticles.Examples, RecursiveArrayTools

julia> model = IntegratedModel(
           (V, V),
           ((W_attr, W_rep),
            (W_rep, W_attr)),
           (mobρ, mobσ));

julia> x = ArrayPartition(gaussian_particles(2, 4), collect(range(-3, 4, length=5)))
([-2.000000000000003, -0.30305473018369145, 0.30305473018369145, 2.000000000000003], [-3.0, -1.25, 0.5, 2.25, 4.0])

julia> velocities(x, model, 0.)
([6.621647425385332, 0.30545649966452776, -0.42671180044513507, -6.914302510772401], [23.261098611816987, 0.9023583690557855, 0.7055593913708742, -8.774526834146023, -55.23308442021724])
source
ConservationLawsParticles.ParabolicModelType
ParabolicModel((V₁, ...), ((I₁₁, ...), ...), (mob₁, ...), (D₁, ...))

Represents a particles system with:

  • external velocities Vᵢ,
  • interactions Iᵢⱼ (this is the effect of the species j on the species i),
  • mobilities mobᵢ,
  • diffusions Dᵢ.

See also HyperbolicModel.

Examples

julia> using ConservationLawsParticles.Examples, RecursiveArrayTools

julia> model = ParabolicModel(
           (V, V),
           ((SampledInteraction(Wprime_attr), IntegratedInteraction(W_rep)),
            (IntegratedInteraction(W_rep), SampledInteraction(Wprime_attr))),
           (mobρ, mobσ),
           (Diffusion(1), nothing));

julia> x = ArrayPartition(gaussian_particles(2, 4), collect(range(-3, 4, length=5)))
([-2.000000000000003, -0.30305473018369145, 0.30305473018369145, 2.000000000000003], [-3.0, -1.25, 0.5, 2.25, 4.0])

julia> abstract_velocities(x, model, 0.)
([5.678607254140728, -0.7976466743541808, 0.6763913735735734, -5.971262339527799], [22.921033907881895, 0.8199108735979148, 0.7055593913708742, -8.681409489341364, -54.89301971628215])
source
ConservationLawsParticles.SampledModelType
SampledModel((V₁, ...), ((W′₁₁, ...), ...), (mob₁, ...))

Represents a particles system with:

  • external velocities Vᵢ,
  • sampled interactions W′ᵢⱼ (this is the effect of the species j on the species i),
  • mobilities mobᵢ.

See also IntegratedModel.

Examples

julia> using ConservationLawsParticles.Examples, RecursiveArrayTools

julia> model = SampledModel(
           (V, V),
           ((Wprime_attr, Wprime_rep),
            (Wprime_rep, Wprime_attr)),
           (mobρ, mobσ));

julia> x = ArrayPartition(gaussian_particles(2, 4), collect(range(-3, 4, length=5)))
([-2.000000000000003, -0.30305473018369145, 0.30305473018369145, 2.000000000000003], [-3.0, -1.25, 0.5, 2.25, 4.0])

julia> velocities(x, model, 0.)
([6.291136247066298, 0.2466663161150116, -0.7218917091339228, -7.22630670503873], [22.405129478914613, 1.1249366684885518, 1.5188519354999799, -7.87111869358889, -54.536397957423915])
source
ConservationLawsParticles.integrated_interactionFunction
integrated_interaction([t,] x, W, ys[, dens_diff])

Computes $-(W' * \rho)(t, x) = -(W * \rho')(t,x)$, where $\rho$ is the piecewise-constant density associated to the particles ys.

It t is omitted, then W(x) is assumed independent of time.

Note

To ensure the correctness of the computation, dens_diff must coincide with diff(pwc_density(ys)). It can be pre-computed and passed explicitly to allow reuse (as an optimization).

See also sampled_interaction, compute_interaction.

source
ConservationLawsParticles.pwc_densitiesFunction
pwc_densities(xs::AbstractVector{<:Real}...)
pwc_densities(xs::Tuple{Vararg{AbstractVector{<:Real}}})

Given a list of n families of particles of lengths l₁, …, lₙ, returns an n-tuple whose s-th entry is an n×2×lₛ array densₛ.

This array contains the information about the densities of all the species around the particles of the s-th species. This array is indexed as [o,side,i], where o∈{1, …, n} is the index of the other species whose density we want to know, side is either 1 if we want to know the left density or 2 for the right density, and i∈{1, …, lₛ} is the index of the particle.

In other words, densₛ[o,side,i] is the density of the o-th species on the left (side=1) or right (side=2) of the i-th particle of the s-th species.

See also pwc_densities! for an inplace version.

Examples

julia> pwc_densities([0,1,2], [0,2,3])
([0.0 0.5; 0.0 0.25;;; 0.5 0.5; 0.25 0.25;;; 0.5 0.0; 0.25 0.5], [0.0 0.5; 0.0 0.25;;; 0.5 0.0; 0.25 0.5;;; 0.0 0.0; 0.5 0.0])
source
ConservationLawsParticles.pwc_densityMethod
pwc_density(x::AbstractVector)

Returns the piecewise constant probability density from the quantile particle positions.

Let the quantile particles be at positions x₀, x₁, …, xₙ (remember that in Julia they are actually x[1], x[2], ..., x[n], x[n+1]). The returned array R is such that R[1] = R[n+2] = 0 and R[i] = 1 / (N * (x[i] - x[i-1])) for the intermediate indices (this formula holds also for the first and last entry if we assume x[0] = -∞ and x[n+2] = ∞).

Examples

julia> pwc_density([0, 1, 3])
4-element Vector{Float64}:
 0.0
 0.5
 0.25
 0.0
source
ConservationLawsParticles.@time_independentMacro

Automatically define a method which takes time as first argument and discards it.

Examples

The definition

@time_independent V(x) = -x^3

is equivalent to

V(x) = -x^3
V(t, x) = V(x)

This also works with more than one argument, for instance

@time_independent V(x₁, x₂) = x₁ * x₂

is equivalent to

V(x₁, x₂) = x₁ * x₂
V(t, x₁, x₂) = V(x₁, x₂)
source

Private

ConservationLawsParticles.make_velocitiesMethod
make_velocities((V₁, ...), ((W′₁₁, ...), ...), (mob₁, ...))

Creates a function velocities(dx, x, p, t) that computes the velocity of the particles under the influence of the external velocities Vᵢ, mutual interactions W′ᵢⱼ and congestions given by mobᵢ.

See also make_velocity.

source
ConservationLawsParticles.make_velocityMethod
make_velocity(V::Function, Wprime::Function, mobility::Function)

Creates a function velocity(dx, x, p, t) that computes the velocity of the particles under the influence of an external velocity V, a mutual interaction Wprime and the congestion given by mobility.

See also make_velocities.

source