Skip to main content

Crate phyz_coupling

Crate phyz_coupling 

Source
Expand description

Multi-scale coupling for different physics solvers.

Couples different solvers (QM→MM, EM→rigid, particle→rigid) via:

  • Handshake regions: overlapping spatial domains for force exchange
  • Subcycling: run fast solvers at higher frequency
  • Force transfer: direct coupling, flux transfer, or potential barriers

§Example

use phyz_coupling::{Coupling, ForceTransfer, BoundingBox, SolverType};
use phyz_math::Vec3;

// Define overlap region between electromagnetic and rigid body solvers
let coupling = Coupling {
    solver_a: SolverType::Electromagnetic,
    solver_b: SolverType::RigidBody,
    overlap_region: BoundingBox {
        min: Vec3::new(-1.0, -1.0, -1.0),
        max: Vec3::new(1.0, 1.0, 1.0),
    },
    force_transfer: ForceTransfer::Direct { damping: 0.1 },
};

// Compute Lorentz force on charged body
let force = phyz_coupling::lorentz_force(
    1e-6,  // charge (C)
    Vec3::new(0.0, 0.0, 0.0),
    Vec3::new(1.0, 0.0, 0.0),  // velocity
    &Vec3::new(0.0, 0.0, 1e3), // E field
    &Vec3::new(0.0, 1.0, 0.0), // B field
);

Re-exports§

pub use boundary::BoundingBox;
pub use coupling::Coupling;
pub use coupling::ForceTransfer;
pub use coupling::SolverType;
pub use lorentz::lorentz_force;
pub use lorentz::magnetic_torque;
pub use subcycling::SubcyclingSchedule;
pub use subcycling::TimeScale;

Modules§

boundary
Spatial bounding regions for coupling.
coupling
Coupling definitions between different solver types.
lorentz
Lorentz force and electromagnetic coupling to rigid bodies.
subcycling
Subcycling and multi-timescale integration.