pub struct TopOptSolver {
pub simp: SiMP,
pub filter: FilteringMethods,
pub move_limit: f64,
pub damping: f64,
pub tolerance: f64,
pub max_iter: usize,
pub compliance_history: Vec<f64>,
}Expand description
Topology optimization solver using the Optimality Criteria (OC) method.
The OC update rule adjusts densities to satisfy KKT conditions for compliance minimization subject to a volume constraint.
Fields§
§simp: SiMPSIMP model.
filter: FilteringMethodsFilter.
move_limit: f64Move limit for density update.
damping: f64Damping exponent for OC update.
tolerance: f64Convergence tolerance.
max_iter: usizeMaximum iterations.
compliance_history: Vec<f64>Current compliance history.
Implementations§
Source§impl TopOptSolver
impl TopOptSolver
Sourcepub fn new(simp: SiMP, filter: FilteringMethods) -> Self
pub fn new(simp: SiMP, filter: FilteringMethods) -> Self
Creates a new TopOptSolver.
Sourcepub fn with_move_limit(self, m: f64) -> Self
pub fn with_move_limit(self, m: f64) -> Self
Sets the move limit.
Sourcepub fn with_damping(self, d: f64) -> Self
pub fn with_damping(self, d: f64) -> Self
Sets the damping parameter.
Sourcepub fn with_tolerance(self, t: f64) -> Self
pub fn with_tolerance(self, t: f64) -> Self
Sets convergence tolerance.
Sourcepub fn with_max_iter(self, n: usize) -> Self
pub fn with_max_iter(self, n: usize) -> Self
Sets maximum iterations.
Sourcepub fn oc_update(
&self,
density: &[f64],
sensitivity: &[f64],
volume_target: f64,
) -> (Vec<f64>, f64)
pub fn oc_update( &self, density: &[f64], sensitivity: &[f64], volume_target: f64, ) -> (Vec<f64>, f64)
Performs one OC density update step.
Returns the new density vector and the Lagrange multiplier used.
Sourcepub fn compute_compliance(&self, strain_energy: &[f64]) -> f64
pub fn compute_compliance(&self, strain_energy: &[f64]) -> f64
Computes compliance given stiffness field and element strain energies.
Compliance = Σ E(ρ_e) * se_e (sum of strain energy contributions).
Sourcepub fn run_mock(&mut self, load: f64) -> Vec<f64>
pub fn run_mock(&mut self, load: f64) -> Vec<f64>
Runs the topology optimization loop with a mock FEA (diagonal stiffness).
For testing purposes the strain energy of element e is approximated
as E(ρ_e) * load^2 / n where load is a uniform load parameter.
Sourcepub fn volume_constraint_satisfied(&self, density: &[f64], tol: f64) -> bool
pub fn volume_constraint_satisfied(&self, density: &[f64], tol: f64) -> bool
Checks whether the volume constraint is satisfied within tolerance.
Trait Implementations§
Source§impl Clone for TopOptSolver
impl Clone for TopOptSolver
Source§fn clone(&self) -> TopOptSolver
fn clone(&self) -> TopOptSolver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TopOptSolver
impl RefUnwindSafe for TopOptSolver
impl Send for TopOptSolver
impl Sync for TopOptSolver
impl Unpin for TopOptSolver
impl UnsafeUnpin for TopOptSolver
impl UnwindSafe for TopOptSolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.