forked from 1b-agent/fieldcraft-upstream
solver: heat flow through each heat load, and the imbalance (#362)
solve.heat's reply and the results report give heat_flows: each convection, flux and source load's heat into the body, the prescribed temperatures' total and their sum; the results panel lists them for a heat step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
0e0d8bd114
commit
464a4d50c1
4 files changed
+127
-18
No files matched your search
@@ -497,6 +497,7 @@ impl Session {
|
||||
out["frames"] = f.frames.iter().map(|f| f.time).collect();
|
||||
}
|
||||
Kind::Heat(h) => {
|
||||
out["heat_flows"] = heat_flows(h);
|
||||
out["frames"] = json!(h.times);
|
||||
if let Ok((t, _)) = heat_frame(h, v.pick()) {
|
||||
out["time"] = json!(t);
|
||||
@@ -519,6 +520,16 @@ impl Session {
|
||||
}
|
||||
}
|
||||
|
||||
/// The heat balance of a heat transfer result: each heat load's flow into the body (`loads`:
|
||||
/// `{name, type, heat}`, negative out of it), the prescribed temperatures' total (`reactions`),
|
||||
/// and `imbalance`, their sum: about 0 in a steady state, the heat stored per time in a
|
||||
/// transient one.
|
||||
pub fn heat_flows(h: &HeatResult) -> Value {
|
||||
let loads: Vec<Value> = h.loads.iter().map(|l| json!({"name": l.name, "type": l.kind, "heat": l.heat})).collect();
|
||||
let applied: f64 = h.loads.iter().map(|l| l.heat).sum();
|
||||
json!({"loads": loads, "reactions": h.reaction_total, "imbalance": applied + h.reaction_total})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in new issue
Block a user