Replace Python numerical kernels with native C execution
This commit is contained in:
1 parent
48da6be21c
commit
3b38f73fe0
227 files changed
+16801
-75499
No files matched your search
+15
-7
@@ -461,16 +461,16 @@ type SimulationResult = {
|
||||
final: Record<string, number>;
|
||||
series: Record<string, number[]>;
|
||||
diagnostics: {
|
||||
pressureFlow: {
|
||||
pressureFlow?: {
|
||||
solveCount: number;
|
||||
maxScaledResidual: number;
|
||||
maxEvaluationsPerSolve: number;
|
||||
};
|
||||
stream: {
|
||||
stream?: {
|
||||
maxIterationsPerSolve: number;
|
||||
};
|
||||
stateCount: number;
|
||||
sampleCount: number;
|
||||
sampleCount?: number;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1259,7 +1259,7 @@ export function observeSimulationActivityWatchdog(
|
||||
},
|
||||
};
|
||||
}
|
||||
const SUPPORTED_SOLVER_METHODS = ["BDF", "Radau", "LSODA", "RK45", "RK23", "DOP853"];
|
||||
const SUPPORTED_SOLVER_METHODS = ["BDF", "RK45"];
|
||||
const simulationConfigLabels: Record<SimulationNumericKey, string> = {
|
||||
t_start: "起始时间",
|
||||
t_stop: "结束时间",
|
||||
@@ -7374,7 +7374,7 @@ function FlowWorkbench() {
|
||||
) => {
|
||||
const resultStatus = result.status ?? (result.success ? "completed" : "failed");
|
||||
const sampleCount = Math.min(
|
||||
result.diagnostics.sampleCount,
|
||||
result.diagnostics.sampleCount ?? result.series.time?.length ?? 0,
|
||||
result.series.time?.length ?? 0,
|
||||
);
|
||||
const hasUsableSamples = sampleCount >= 2;
|
||||
@@ -7403,6 +7403,11 @@ function FlowWorkbench() {
|
||||
failed: `仿真异常终止,已保留计算至 ${simulatedUntil} s 的 ${sampleCount} 个采样点`,
|
||||
} as const;
|
||||
const statusMessage = statusMessages[resultStatus];
|
||||
const maxScaledResidual = result.diagnostics.pressureFlow?.maxScaledResidual;
|
||||
const residualMessage =
|
||||
typeof maxScaledResidual === "number" && Number.isFinite(maxScaledResidual)
|
||||
? `;最大方程残差 ${formatNumber(maxScaledResidual)}`
|
||||
: "";
|
||||
|
||||
if (resultStatus === "completed") {
|
||||
setSimulationProgress({
|
||||
@@ -7415,7 +7420,7 @@ function FlowWorkbench() {
|
||||
});
|
||||
appendConsoleEntry(
|
||||
"success",
|
||||
`${statusMessage},可在“结果”页签查看;最大方程残差 ${formatNumber(result.diagnostics.pressureFlow.maxScaledResidual)}`,
|
||||
`${statusMessage},可在“结果”页签查看${residualMessage}`,
|
||||
);
|
||||
} else {
|
||||
setSimulationProgress((current) => ({
|
||||
@@ -7444,7 +7449,10 @@ function FlowWorkbench() {
|
||||
id: `simulation-${Date.now()}`,
|
||||
createdAt: new Date().toISOString(),
|
||||
project: cloneValue(project),
|
||||
result: cloneValue(result),
|
||||
result: cloneValue({
|
||||
...result,
|
||||
diagnostics: { ...result.diagnostics, sampleCount },
|
||||
}),
|
||||
};
|
||||
setResultSnapshot(nextSnapshot);
|
||||
storeResultSnapshot(nextSnapshot);
|
||||
|
||||
@@ -146,12 +146,12 @@ type ResultPayload = {
|
||||
stateTransitionTimes?: number[];
|
||||
}>;
|
||||
};
|
||||
pressureFlow: {
|
||||
pressureFlow?: {
|
||||
solveCount: number;
|
||||
maxScaledResidual: number;
|
||||
maxEvaluationsPerSolve: number;
|
||||
};
|
||||
stream: {
|
||||
stream?: {
|
||||
maxIterationsPerSolve: number;
|
||||
};
|
||||
stateCount: number;
|
||||
|
||||
Reference in new issue
Block a user