forked from 1b-agent/fieldcraft-upstream
solver: nonlinear static analysis by Newton–Raphson with automatic increments
solve.nonlinear follows a nonlinear static step in load increments: dead loads and prescribed displacements ramp with the load factor, a pressure follows the deformed faces (its load stiffness symmetrised so the supernodal Cholesky stays), the consistent tangent is refactored every iteration with an optional line search, and an increment converges on force, displacement and energy together. Increments start from the extrapolated last one, grow after fast convergence and are cut back on inversion, a non-finite or growing residual, an indefinite tangent or too many iterations; the step stops cleanly at the minimum increment, the increment cap or the Newton iteration limit. Elements are assembled in parallel in label order (same bits on any thread count). Results carry Cauchy stress, logarithmic strain, the increment history and a displacement frame per increment, which results.frame and the results panel show. Trusses, shells, beams, plane stress, incompatible modes, temperature and centrifugal loads are refused by name; couplings warn that they stay linear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm
This commit is contained in:
1 parent
2321d75cc6
commit
2183fdbe81
14 files changed
+1579
-43
No files matched your search
@@ -650,6 +650,50 @@ impl Reduction {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// T_fᵀ r: a vector over every degree of freedom (a residual) restricted to the free
|
||||
/// equations.
|
||||
pub fn restrict(&self, r: &[f64]) -> Vec<f64> {
|
||||
let mut out = vec![0.0; self.neq()];
|
||||
for (dof, v) in r.iter().enumerate() {
|
||||
for (e, c) in self.free.row(dof) {
|
||||
if let Some(x) = out.get_mut(e) {
|
||||
*x += c * v;
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Every degree of freedom from the free equations' values `q` with the prescribed values
|
||||
/// scaled by `scale` (a load factor): T_f q + scale T_p u_p.
|
||||
pub fn expand_scaled(&self, q: &[f64], scale: f64) -> Vec<f64> {
|
||||
(0..self.prescribed_motion.len())
|
||||
.map(|d| {
|
||||
let free: f64 = self.free.row(d).map(|(e, c)| c * q.get(e).copied().unwrap_or(0.0)).sum();
|
||||
free + scale * self.prescribed_motion.get(d).copied().unwrap_or(0.0)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The largest prescribed motion, |T_p u_p|∞.
|
||||
pub fn largest_prescribed(&self) -> f64 {
|
||||
self.prescribed_motion.iter().fold(0.0, |m, v| m.max(v.abs()))
|
||||
}
|
||||
|
||||
/// T_pᵀ g for a vector g over every degree of freedom (the reactions of the out-of-balance
|
||||
/// forces g = f_int − f_ext), zero where nothing is prescribed.
|
||||
pub fn reactions_of(&self, g: &[f64]) -> Vec<f64> {
|
||||
let mut out = vec![0.0; self.prescribed_motion.len()];
|
||||
for (dof, v) in g.iter().enumerate() {
|
||||
for (p, c) in self.fixed.row(dof) {
|
||||
if let Some(x) = out.get_mut(p) {
|
||||
*x += c * v;
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// The reactions at the prescribed degrees of freedom, T_pᵀ (K u − f), over every degree of
|
||||
/// freedom (zero where nothing is prescribed).
|
||||
pub fn reactions(&self, k: &Csr, u: &[f64], f: &[f64]) -> Vec<f64> {
|
||||
|
||||
Reference in new issue
Block a user