Skip to main content

AcousticSolver2D

Struct AcousticSolver2D 

Source
pub struct AcousticSolver2D {
    pub p: Grid2D,
    pub vx: Grid2D,
    pub vy: Grid2D,
    /* private fields */
}
Expand description

Solveur acoustique 2D (FDTD, schéma saute-mouton sur grille décalée).

Disposition : p[x,y] au centre des cellules, vx[x,y] entre p[x,y] et p[x+1,y], vy[x,y] entre p[x,y] et p[x,y+1]. Les frontières sont des murs rigides (vitesse normale nulle), sauf si set_absorbing_boundary est utilisé.

Fields§

§p: Grid2D§vx: Grid2D§vy: Grid2D

Implementations§

Source§

impl AcousticSolver2D

Source

pub fn new( nx: usize, ny: usize, dx: f32, dy: f32, default_rho: f32, default_c: f32, ) -> Self

Source

pub fn rho(&self) -> &Grid2D

Densité (lecture seule). Utiliser set_medium pour modifier.

Source

pub fn set_pml_boundary(&mut self, width: usize, max_sigma: f32)

Configure des couches absorbantes PML sur les bords. width : épaisseur en nombre de cellules (ex: 20 à 30). max_sigma : intensité maximale de l’amortissement.

Source

pub fn bulk_modulus(&self) -> &Grid2D

Module de compressibilité K = ρc² (lecture seule).

Source

pub fn set_medium(&mut self, x: usize, y: usize, rho: f32, c: f32)

Définit le milieu d’une cellule : densité rho et vitesse du son c.

Source

pub fn set_medium_rect( &mut self, x0: usize, y0: usize, x1: usize, y1: usize, rho: f32, c: f32, )

Définit le milieu d’un rectangle [x0, x1) × [y0, y1).

Source

pub fn c_max(&self) -> f32

Vitesse du son maximale dans le domaine.

Source

pub fn max_stable_dt(&self) -> f32

Pas de temps maximal stable (condition CFL 2D) pour le milieu actuel.

Source

pub fn stable_dt(&self, safety: f32) -> f32

safety × max_stable_dt(), avec 0 < safety <= 1 (0.9 est un bon choix).

Source

pub fn set_absorbing_boundary(&mut self, width: usize, max_damping: f32)

Couche éponge de width cellules sur les 4 bords.

max_damping (entre 0 et 1) est la fraction d’amplitude retirée à chaque pas sur le bord extérieur ; le profil décroît de façon quadratique vers l’intérieur. Valeurs typiques : width 15–30, max_damping 0.05–0.2. width = 0 désactive l’amortissement (murs rigides).

Source

pub fn add_source( &mut self, x: usize, y: usize, waveform: Waveform, amplitude: f32, )

Ajoute une source ponctuelle pilotée par une forme d’onde.

Source

pub fn inject_source(&mut self, x: usize, y: usize, value: f32)

Injecte instantanément une impulsion de pression.

Source

pub fn add_receiver(&mut self, x: usize, y: usize) -> usize

Ajoute un récepteur ; retourne son identifiant.

Source

pub fn receiver(&self, id: usize) -> &[f32]

Signal de pression enregistré (un échantillon par pas de temps).

Source

pub fn time(&self) -> f64

Temps simulé écoulé (secondes).

Source

pub fn step(&mut self, dt: f32)

Effectue un pas de simulation temporel dt.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.