From 4f4809f4777513d8db5240bf383a138c2df38612 Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Fri, 13 Sep 2024 00:11:13 -0700 Subject: [PATCH] try using a shorter termination for bisection solver --- src/EnergyPlus/ExtendedHI.cc | 2 +- src/EnergyPlus/General.cc | 8 ++++++++ src/EnergyPlus/HVACSystemRootFindingAlgorithm.hh | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/ExtendedHI.cc b/src/EnergyPlus/ExtendedHI.cc index 1e71b9ad173..e9b9f7a7a91 100644 --- a/src/EnergyPlus/ExtendedHI.cc +++ b/src/EnergyPlus/ExtendedHI.cc @@ -485,7 +485,7 @@ namespace ExtendedHI { // The function computes the extended heat index, in Kelvinn auto const HVACSystemRootSolverBackup = state.dataRootFinder->HVACSystemRootFinding.HVACSystemRootSolver; - state.dataRootFinder->HVACSystemRootFinding.HVACSystemRootSolver = HVACSystemRootSolverAlgorithm::BisectionThenRegulaFalsi; + state.dataRootFinder->HVACSystemRootFinding.HVACSystemRootSolver = HVACSystemRootSolverAlgorithm::ShortBisectionThenRegulaFalsi; int eqvar_name = 0; Real64 eqvar_value = find_eqvar_name_and_value(state, Ta, RH, eqvar_name); diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index 65a1dd95fed..a9d287a0df0 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -241,6 +241,14 @@ void SolveRoot(const EnergyPlusData &state, } break; } + case HVACSystemRootSolverAlgorithm::ShortBisectionThenRegulaFalsi: { + if (NIte < 3) { + XTemp = (X1 + X0) / 2.0; + } else { + XTemp = (Y0 * X1 - Y1 * X0) / DY; + } + break; + } default: { XTemp = (Y0 * X1 - Y1 * X0) / DY; } diff --git a/src/EnergyPlus/HVACSystemRootFindingAlgorithm.hh b/src/EnergyPlus/HVACSystemRootFindingAlgorithm.hh index 6138bacc004..3487423d534 100644 --- a/src/EnergyPlus/HVACSystemRootFindingAlgorithm.hh +++ b/src/EnergyPlus/HVACSystemRootFindingAlgorithm.hh @@ -59,6 +59,7 @@ enum class HVACSystemRootSolverAlgorithm : int RegulaFalsiThenBisection, BisectionThenRegulaFalsi, Alternation, + ShortBisectionThenRegulaFalsi, Num }; struct HVACSystemRootFindingAlgorithm