wolfhece.lagrangian.particle_system

Author: HECE - University of Liege, Pierre Archambeau Date: 2024

Copyright (c) 2024 University of Liege. All rights reserved.

This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.

Module Contents

wolfhece.lagrangian.particle_system._load_particles_files(x: tuple[float, int, dict, pathlib.Path]) tuple[float, int, wolfhece.lagrangian.particles.Particles][source]

Parallel/Multiprocessor function to load the particles from file.

class wolfhece.lagrangian.particle_system.Particle_system(domain: numpy.ndarray = None, emitters: list[wolfhece.lagrangian.emitter.Emitter] = None, uv: list[wolfhece.lagrangian.velocity_field.Velocity_Field] = None, times: list[float] = None)[source]
property domain: numpy.ndarray[source]

Return the domain.

property u: numpy.ndarray[source]

Return the u component of the velocity field at time 0.

property v: numpy.ndarray[source]

Return the v component of the velocity field at time 0.

property blend: bool[source]

Return the blend property.

property times_vf[source]

Return the times of the velocity fields.

property times: numpy.ndarray[source]

Return the times.

property sorted_times_vf[source]

Return the times of the velocity fields sorted.

property colors: list[tuple[float]][source]

Return the colors of the particles.

property nb_steps: int[source]

Return the number of steps.

property keys: list[float][source]

Return the keys of the particles.

property number_of_vf: int[source]

Return the number of velocity fields.

property number_of_emitters: int[source]

Return the number of emitters.

property current_step: float[source]

Return the current step.

property current_step_idx: int[source]

Return the current step index.

property previous_step: float[source]

Return the previous step.

property dir: str[source]

Return the directory.

property bounds: tuple[float][source]

Return the bounds of the object.

property path_emit: pathlib.Path[source]

Return the path of the emitters.

property path_vf: pathlib.Path[source]

Return the path of the velocity field.

property path_particles: pathlib.Path[source]

Return the path of the particles.

property path_domain: pathlib.Path[source]

Return the path of the domain.

reset() None[source]

Reset the particles.

check() tuple[bool, str][source]

Check if the particle system is valid.

append_velocity_field(uv: wolfhece.lagrangian.velocity_field.Velocity_Field, time: float) None[source]

Append a velocity field to the list.

load_domain_uv_from_npz(filename: str)[source]

Init the particle system from a npz file.

the file must contain:
  • u: x velocity component - np.ndarray - float64

  • v: y velocity component - np.ndarray - float64

  • domain: array containing the domain - np.ndarray - int8

  • (optionl) header: tuple containing the header of the file (origx, origy, dx, dy, nbx, nby) - tuple[float]

If haeder is not found, the header is set to (0., 0., 1., 1., u.shape[0], u.shape[1]).

All arrays must have the same shape.

After that, you have to define the emitters before baking the particles.

find_uv1_uv2_t1_t2(curtime: float, first_idx: int = 0) tuple[wolfhece.lagrangian.velocity_field.Velocity_Field, wolfhece.lagrangian.velocity_field.Velocity_Field, float, float, int][source]

Find the two closest velocity fields.

sort_vf()[source]

Sort the velocity fields and update times.

n_previous_step(n: int = 1) list[float][source]

Return n previous steps.

serialize() dict[source]

Serialize the object.

deserialize(data: dict) None[source]

Deserialize the object.

save(f: str = '', save_particles: bool = True) None[source]

Save the particles to file.

load(f: str) None[source]

Load the particles from file.

get_header() tuple[float][source]

Return the header of the file.

bake(total_time: float, dt: float, scheme: str = None, callback=None) None[source]

Bake the particles.

plot(time: float = -1.0, alpha: float = 1.0) None[source]

Plot the particles.

plot_mpl(time: float = -1.0) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]

Plot the particles using Matplotlib.