Fix BPHX mass flux per-side channels so pressure drop is visible.
Some checks failed
CI / check (push) Has been cancelled

Mass flux used all plate gaps instead of half the pack per fluid, underestimating G and making ΔP look like zero in the UI (0.000 bar). Also show ΔP in kPa/Pa and sync the web example.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-19 17:06:44 +02:00
parent 81abd5a591
commit 2f1f7ecb80
5 changed files with 55 additions and 48 deletions

View File

@@ -903,10 +903,24 @@ function ModelicaResultsView({
<div className="grid grid-cols-2 gap-1.5">
{inspector.delta_p_bar != null && (
<MiniMetric label="ΔP" value={`${inspector.delta_p_bar.toFixed(3)} bar`} />
<MiniMetric
label="ΔP"
value={
Math.abs(inspector.delta_p_bar) * 100 >= 0.05
? `${(inspector.delta_p_bar * 100).toFixed(2)} kPa`
: `${(inspector.delta_p_bar * 1e5).toFixed(1)} Pa`
}
/>
)}
{inspector.delta_p_sec_bar != null && (
<MiniMetric label="ΔP sec" value={`${inspector.delta_p_sec_bar.toFixed(3)} bar`} />
<MiniMetric
label="ΔP sec"
value={
Math.abs(inspector.delta_p_sec_bar) * 100 >= 0.05
? `${(inspector.delta_p_sec_bar * 100).toFixed(2)} kPa`
: `${(inspector.delta_p_sec_bar * 1e5).toFixed(1)} Pa`
}
/>
)}
{inspector.q_primary_kw != null && (
<MiniMetric label="Q̇" value={`${Math.abs(inspector.q_primary_kw).toFixed(2)} kW`} />
@@ -977,43 +991,6 @@ function ModelicaResultsView({
);
}
function SolvedVariablesBlock({
items,
title,
}: {
items: SolvedVariable[];
title: string;
}) {
if (items.length === 0) return null;
return (
<div className="overflow-hidden rounded-md border border-[var(--line)]">
<div className="border-b border-[var(--line)] bg-[var(--chrome-2)] px-2 py-1 text-[9px] font-semibold uppercase tracking-wide text-[var(--ink-faint)]">
{title}
</div>
<table className="w-full text-[10px]">
<thead>
<tr className="text-left text-[9px] text-[var(--ink-faint)]">
<th className="px-1.5 py-1 font-medium">Var</th>
<th className="px-1 py-1 font-medium">Value</th>
<th className="px-1 py-1 font-medium">Min</th>
<th className="px-1 py-1 font-medium">Max</th>
</tr>
</thead>
<tbody>
{items.map((sv) => (
<tr key={sv.id} className="border-t border-[var(--line)]">
<td className="mono px-1.5 py-1 text-[var(--ink)]">{sv.variable}</td>
<td className="mono px-1 py-1 text-[var(--ink)]">{fmtOpt(sv.value, 4)}</td>
<td className="mono px-1 py-1 text-[var(--ink-dim)]">{fmtOpt(sv.min, 3)}</td>
<td className="mono px-1 py-1 text-[var(--ink-dim)]">{fmtOpt(sv.max, 3)}</td>
</tr>
))}
</tbody>
</table>
</div>
);
}
function MiniMetric({ label, value }: { label: string; value: string }) {
return (
<div className="rounded border border-[var(--line)] bg-[var(--chrome-2)] px-1.5 py-1">

View File

@@ -182,8 +182,22 @@ export function buildComponentInspector(
}
const summaryLines: string[] = [];
if (delta_p_bar != null) summaryLines.push(`ΔP = ${fmt(delta_p_bar, 3)} bar`);
if (delta_p_sec_bar != null) summaryLines.push(`ΔP sec = ${fmt(delta_p_sec_bar, 3)} bar`);
if (delta_p_bar != null) {
const dp_kpa = delta_p_bar * 100.0;
summaryLines.push(
Math.abs(dp_kpa) >= 0.05
? `ΔP = ${fmt(dp_kpa, 2)} kPa`
: `ΔP = ${fmt(delta_p_bar * 1e5, 1)} Pa`,
);
}
if (delta_p_sec_bar != null) {
const dp_kpa = delta_p_sec_bar * 100.0;
summaryLines.push(
Math.abs(dp_kpa) >= 0.05
? `ΔP sec = ${fmt(dp_kpa, 2)} kPa`
: `ΔP sec = ${fmt(delta_p_sec_bar * 1e5, 1)} Pa`,
);
}
if (q_primary_kw != null) summaryLines.push(`Q̇ = ${fmt(Math.abs(q_primary_kw), 2)} kW`);
if (q_secondary_kw != null) summaryLines.push(`Q̇ sec = ${fmt(Math.abs(q_secondary_kw), 2)} kW`);
if (work_kw != null) summaryLines.push(`Ẇ = ${fmt(work_kw, 2)} kW`);