wolfhece.lagrangian.particle_system =================================== .. py:module:: wolfhece.lagrangian.particle_system .. autoapi-nested-parse:: 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 --------------- .. py:function:: _load_particles_files(x: tuple[float, int, dict, pathlib.Path]) -> tuple[float, int, wolfhece.lagrangian.particles.Particles] Parallel/Multiprocessor function to load the particles from file. .. py:class:: 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) .. py:attribute:: _filename :value: None .. py:attribute:: _time :value: 0.0 .. py:attribute:: _particles :type: dict[float, dict[int, wolfhece.lagrangian.particles.Particles]] .. py:attribute:: totaltime :value: 0.0 .. py:attribute:: dt :value: 0.0 .. py:attribute:: scheme :value: 'RK22' .. py:attribute:: _current :value: None .. py:attribute:: _previous :value: None .. py:attribute:: _current_step :value: 0.0 .. py:attribute:: _current_step_idx :value: 0 .. py:attribute:: _dir :value: None .. py:attribute:: _emitters :value: None .. py:attribute:: _inside_array .. py:attribute:: _velocity_fields :type: dict[float:Velocity_Field] .. py:method:: reset() -> None Reset the particles. .. py:method:: check() -> tuple[bool, str] Check if the particle system is valid. .. py:method:: append_velocity_field(uv: wolfhece.lagrangian.velocity_field.Velocity_Field, time: float) -> None Append a velocity field to the list. .. py:method:: load_domain_uv_from_npz(filename: str) 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. .. py:property:: domain :type: numpy.ndarray Return the domain. .. py:property:: u :type: numpy.ndarray Return the u component of the velocity field at time 0. .. py:property:: v :type: numpy.ndarray Return the v component of the velocity field at time 0. .. py:property:: blend :type: bool Return the blend property. .. py:property:: times_vf Return the times of the velocity fields. .. py:property:: times :type: numpy.ndarray Return the times. .. py:property:: sorted_times_vf Return the times of the velocity fields sorted. .. py:method:: 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] Find the two closest velocity fields. .. py:method:: sort_vf() Sort the velocity fields and update times. .. py:property:: colors :type: list[tuple[float]] Return the colors of the particles. .. py:property:: nb_steps :type: int Return the number of steps. .. py:property:: keys :type: list[float] Return the keys of the particles. .. py:property:: number_of_vf :type: int Return the number of velocity fields. .. py:property:: number_of_emitters :type: int Return the number of emitters. .. py:property:: current_step :type: float Return the current step. .. py:property:: current_step_idx :type: int Return the current step index. .. py:property:: previous_step :type: float Return the previous step. .. py:method:: n_previous_step(n: int = 1) -> list[float] Return n previous steps. .. py:property:: dir :type: str Return the directory. .. py:property:: bounds :type: tuple[float] Return the bounds of the object. .. py:property:: path_emit :type: pathlib.Path Return the path of the emitters. .. py:property:: path_vf :type: pathlib.Path Return the path of the velocity field. .. py:property:: path_particles :type: pathlib.Path Return the path of the particles. .. py:property:: path_domain :type: pathlib.Path Return the path of the domain. .. py:method:: serialize() -> dict Serialize the object. .. py:method:: deserialize(data: dict) -> None Deserialize the object. .. py:method:: save(f: str = '', save_particles: bool = True) -> None Save the particles to file. .. py:method:: load(f: str) -> None Load the particles from file. .. py:method:: get_header() -> tuple[float] Return the header of the file. .. py:method:: bake(total_time: float, dt: float, scheme: str = None, callback=None) -> None Bake the particles. .. py:method:: plot(time: float = -1.0, alpha: float = 1.0) -> None Plot the particles. .. py:method:: plot_mpl(time: float = -1.0) -> tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] Plot the particles using Matplotlib.