forked from 1b-agent/fieldcraft-upstream
Report factor value bytes and preserve overflow-safe reduction limits
This commit is contained in:
1 parent
c7d0a82079
commit
a530a0d914
7 files changed
+80
-12
No files matched your search
@@ -368,16 +368,17 @@ fn coupling_errors_name_the_problem() {
|
||||
/// budget stops while counting, before allocating.
|
||||
#[test]
|
||||
fn oversized_reductions_are_refused_before_allocating() {
|
||||
let mut g = grid([83, 83, 1], ElementKind::Hex8, |q| [83.0 * q[0], 83.0 * q[1], q[2]]);
|
||||
let mut g = grid([110, 110, 1], ElementKind::Hex8, |q| [110.0 * q[0], 110.0 * q[1], q[2]]);
|
||||
g.define(iso(1000.0, 0.3), None, full(), Procedure::Static {});
|
||||
g.couple("Base", [41.5, 41.5, 0.0], CouplingKind::Distributing, &ALL, |q| near(q[2], 0.0));
|
||||
g.couple("Base", [55.0, 55.0, 0.0], CouplingKind::Distributing, &ALL, |q| near(q[2], 0.0));
|
||||
g.bc("hold", BoundaryCondition::Fixed { target: rp("Base") });
|
||||
g.face_set("top", |q| near(q[2], 1.0));
|
||||
g.load("p", Load::Pressure { set: "top".into(), magnitude: 1.0 });
|
||||
let start = std::time::Instant::now();
|
||||
let e = solve_static(&g.model, Some("Step"), &Limits::default()).unwrap_err().to_string();
|
||||
let raised = Limits { max_factor_entries: 2_000_000_000, ..Limits::default() };
|
||||
let e = solve_static(&g.model, Some("Step"), &raised).unwrap_err().to_string();
|
||||
eprintln!("refused in {:?}: {e}", start.elapsed());
|
||||
assert!(e.contains("couples 7056 nodes") && e.contains("GB") && e.contains("kinematic coupling"), "{e}");
|
||||
assert!(e.contains("couples 12321 nodes") && e.contains("GB") && e.contains("kinematic coupling"), "{e}");
|
||||
|
||||
let mut g = grid([2, 1, 1], ElementKind::Hex8, |q| [2.0 * q[0], q[1], q[2]]);
|
||||
g.define(iso(1000.0, 0.3), None, full(), Procedure::Static {});
|
||||
|
||||
@@ -438,3 +438,17 @@ fn trusses_take_thermal_strain_along_their_axis() {
|
||||
assert!(r.elements.iter().flat_map(|el| &el.points).all(|p| p.stress[0].abs() < 1e-9));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn heat_factor_cap_reports_value_bytes_before_allocation() {
|
||||
let mut g = grid([2, 1, 1], ElementKind::Hex8, |p| [2.0 * p[0], p[1], p[2]]);
|
||||
g.define(iso(1000.0, 0.3), None, full(), Procedure::HeatTransfer { transient: None });
|
||||
thermal(&mut g, iso(1000.0, 0.3), None, conductor(K));
|
||||
hold(&mut g, "cold", 0.0, |p| near(p[0], 0.0));
|
||||
let before = g.model.clone();
|
||||
let tight = Limits { max_factor_entries: 1, ..Limits::default() };
|
||||
let e = solve_heat(&g.model, None, &tight).unwrap_err().to_string();
|
||||
assert!(e.contains("bytes of factor values alone") && e.contains("limit is 1 entries"), "{e}");
|
||||
assert_eq!(g.model, before);
|
||||
assert!(solve_heat(&g.model, None, &Limits::default()).is_ok());
|
||||
}
|
||||
@@ -362,7 +362,8 @@ fn errors_name_the_problem() {
|
||||
let tight = Limits { max_dofs: 10, ..Limits::default() };
|
||||
assert!(solve_static(&g.model, Some("Step"), &tight).unwrap_err().to_string().contains("limit"));
|
||||
let tight = Limits { max_factor_entries: 5, ..Limits::default() };
|
||||
assert!(solve_static(&g.model, Some("Step"), &tight).unwrap_err().to_string().contains("limit"));
|
||||
let e = solve_static(&g.model, Some("Step"), &tight).unwrap_err().to_string();
|
||||
assert!(e.contains("bytes of factor values alone") && e.contains("limit is 5 entries"), "{e}");
|
||||
assert!(solve_static(&g.model, Some("Nope"), &Limits::default()).is_err());
|
||||
assert!(solve_frequency(&g.model, Some("Step"), &FrequencyOptions::default(), &Limits::default()).is_err(), "a static step");
|
||||
assert!(solve_static(&g.model, Some("Step"), &Limits::default()).is_ok());
|
||||
|
||||
Reference in new issue
Block a user