phyz_coupling/lib.rs
1//! Multi-scale coupling for different physics solvers.
2//!
3//! Couples different solvers (QM→MM, EM→rigid, particle→rigid) via:
4//! - Handshake regions: overlapping spatial domains for force exchange
5//! - Subcycling: run fast solvers at higher frequency
6//! - Force transfer: direct coupling, flux transfer, or potential barriers
7//!
8//! # Example
9//!
10//! ```
11//! use phyz_coupling::{Coupling, ForceTransfer, BoundingBox, SolverType};
12//! use phyz_math::Vec3;
13//!
14//! // Define overlap region between electromagnetic and rigid body solvers
15//! let coupling = Coupling {
16//! solver_a: SolverType::Electromagnetic,
17//! solver_b: SolverType::RigidBody,
18//! overlap_region: BoundingBox {
19//! min: Vec3::new(-1.0, -1.0, -1.0),
20//! max: Vec3::new(1.0, 1.0, 1.0),
21//! },
22//! force_transfer: ForceTransfer::Direct { damping: 0.1 },
23//! };
24//!
25//! // Compute Lorentz force on charged body
26//! let force = phyz_coupling::lorentz_force(
27//! 1e-6, // charge (C)
28//! Vec3::new(0.0, 0.0, 0.0),
29//! Vec3::new(1.0, 0.0, 0.0), // velocity
30//! &Vec3::new(0.0, 0.0, 1e3), // E field
31//! &Vec3::new(0.0, 1.0, 0.0), // B field
32//! );
33//! ```
34
35pub mod boundary;
36pub mod coupling;
37pub mod lorentz;
38pub mod subcycling;
39
40pub use boundary::BoundingBox;
41pub use coupling::{Coupling, ForceTransfer, SolverType};
42pub use lorentz::{lorentz_force, magnetic_torque};
43pub use subcycling::{SubcyclingSchedule, TimeScale};