Semidiscretization

TrixiParticles.SemidiscretizationType
Semidiscretization(systems...; neighborhood_search=GridNeighborhoodSearch{NDIMS}())

The semidiscretization couples the passed systems to one simulation.

Arguments

  • systems: Systems to be coupled in this semidiscretization

Keywords

  • neighborhood_search: The neighborhood search to be used in the simulation. By default, the GridNeighborhoodSearch is used. Use nothing to loop over all particles (no neighborhood search). To use other neighborhood search implementations, pass a template of a neighborhood search. See copy_neighborhood_search and the examples below for more details. To use a periodic domain, pass a PeriodicBox to the neighborhood search.
  • threaded_nhs_update=true: Can be used to deactivate thread parallelization in the neighborhood search update. This can be one of the largest sources of variations between simulations with different thread numbers due to particle ordering changes.

Examples

semi = Semidiscretization(fluid_system, boundary_system)

semi = Semidiscretization(fluid_system, boundary_system,
                          neighborhood_search=GridNeighborhoodSearch{2}(update_strategy=SerialUpdate()))

periodic_box = PeriodicBox(min_corner = [0.0, 0.0], max_corner = [1.0, 1.0])
semi = Semidiscretization(fluid_system, boundary_system,
                          neighborhood_search=GridNeighborhoodSearch{2}(; periodic_box))

semi = Semidiscretization(fluid_system, boundary_system,
                          neighborhood_search=PrecomputedNeighborhoodSearch{2}())

semi = Semidiscretization(fluid_system, boundary_system,
                          neighborhood_search=nothing)
source
TrixiParticles.SourceTermDampingType
SourceTermDamping(; damping_coefficient)

A source term to be used when a damping step is required before running a full simulation. The term $-c \cdot v_a$ is added to the acceleration $\frac{\mathrm{d}v_a}{\mathrm{d}t}$ of particle $a$, where $c$ is the damping coefficient and $v_a$ is the velocity of particle $a$.

Keywords

  • damping_coefficient: The coefficient $d$ above. A higher coefficient means more damping. A coefficient of 1e-4 is a good starting point for damping a fluid at rest.

Examples

source_terms = SourceTermDamping(; damping_coefficient=1e-4)
source
TrixiParticles.restart_with!Method
restart_with!(semi, sol)

Set the initial coordinates and velocities of all systems in semi to the final values in the solution sol. semidiscretize has to be called again afterwards, or another Semidiscretization can be created with the updated systems.

Arguments

  • semi: The semidiscretization
  • sol: The ODESolution returned by solve of OrdinaryDiffEq
source
TrixiParticles.semidiscretizeMethod
semidiscretize(semi, tspan; reset_threads=true)

Create an ODEProblem from the semidiscretization with the specified tspan.

Arguments

  • semi: A Semidiscretization holding the systems involved in the simulation.
  • tspan: The time span over which the simulation will be run.

Keywords

  • reset_threads: A boolean flag to reset Polyester.jl threads before the simulation (default: true). After an error within a threaded loop, threading might be disabled. Resetting the threads before the simulation ensures that threading is enabled again for the simulation. See also trixi-framework/Trixi.jl#1583.

Returns

A DynamicalODEProblem (see the OrdinaryDiffEq.jl docs) to be integrated with OrdinaryDiffEq.jl. Note that this is not a true DynamicalODEProblem where the acceleration does not depend on the velocity. Therefore, not all integrators designed for DynamicalODEProblems will work properly. However, all integrators designed for ODEProblems can be used.

Examples

semi = Semidiscretization(fluid_system, boundary_system)
tspan = (0.0, 1.0)
ode_problem = semidiscretize(semi, tspan)
source