R8-a harness: RTX_E3FSI_LOAD_PLANES (the load route on the n mid planes; cost knob, whole span by default)
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9867a8b831
commit
0f386df871
@@ -144,8 +144,10 @@ pub struct E3Fluid {
|
||||
pub grid: Grid,
|
||||
pub h: f64,
|
||||
pub dt: f64,
|
||||
/// The z extent the loads are divided by (per unit span).
|
||||
/// The duct's z extent.
|
||||
pub width: f64,
|
||||
/// The z extent the last `loads` integrated over (per unit span).
|
||||
pub load_width: f64,
|
||||
pub lines: Arc<RwLock<Lines>>,
|
||||
sink: Arc<Mutex<Vec<Contribution>>>,
|
||||
}
|
||||
@@ -284,6 +286,7 @@ impl E3Fluid {
|
||||
h,
|
||||
dt,
|
||||
width,
|
||||
load_width: width,
|
||||
lines,
|
||||
sink: Arc::new(Mutex::new(Vec::new())),
|
||||
}
|
||||
@@ -324,14 +327,25 @@ impl E3Fluid {
|
||||
assert!(previous.is_none(), "a load sink was already installed");
|
||||
let mask = self.device.solver.mask().expect("mask");
|
||||
let body = self.device.solver.body().expect("body");
|
||||
let f = mask
|
||||
.cut_wall_force(body, &self.field, RHO * NU, t)
|
||||
.expect("cut wall force");
|
||||
// `RTX_E3FSI_LOAD_PLANES=n`: the route on the n mid planes only (per
|
||||
// unit span of those planes) — a cost knob for a spanwise-uniform
|
||||
// flow; the whole span by default.
|
||||
let nz = self.grid.nz;
|
||||
let n = (super::env_f("RTX_E3FSI_LOAD_PLANES", 0.0) as usize).min(nz);
|
||||
let f = if n > 0 && n < nz {
|
||||
let k0 = (nz - n) / 2;
|
||||
self.load_width = n as f64 * self.h;
|
||||
mask.cut_wall_force_per_span(body, &self.field, RHO * NU, t, (k0, k0 + n))
|
||||
.expect("cut wall force per span")
|
||||
} else {
|
||||
self.load_width = self.width;
|
||||
let f = mask
|
||||
.cut_wall_force(body, &self.field, RHO * NU, t)
|
||||
.expect("cut wall force");
|
||||
[f[0] / self.width, f[1] / self.width, f[2] / self.width]
|
||||
};
|
||||
set_load_sink(None);
|
||||
let contributions = std::mem::take(&mut *self.sink.lock().expect("sink"));
|
||||
(
|
||||
[f[0] / self.width, f[1] / self.width, f[2] / self.width],
|
||||
contributions,
|
||||
)
|
||||
(f, contributions)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user