@@ -548,8 +548,8 @@ computeBhpAtThpLimitInjImpl(const std::function<std::vector<Scalar>(const Scalar
548548 const Scalar low = 10.0 * unit::barsa;
549549 const Scalar high = 800.0 * unit::barsa;
550550 const Scalar flo_tolerance = flo_rel_tol * std::fabs (flo_samples.back ());
551- int iteration = 0 ;
552551 try {
552+ int iteration = 0 ;
553553 const Scalar solved_bhp = RegulaFalsiBisection<ErrorPolicy>::
554554 solve (eq, low, high, max_iteration, flo_tolerance, iteration);
555555 bhp_samples.push_back (solved_bhp);
@@ -610,7 +610,6 @@ computeBhpAtThpLimitInjImpl(const std::function<std::vector<Scalar>(const Scalar
610610 const Scalar low = bhp_samples[sign_change_index + 1 ];
611611 const Scalar high = bhp_samples[sign_change_index];
612612 const Scalar bhp_tolerance = 0.01 * unit::barsa;
613- int iteration = 0 ;
614613 if (low == high) {
615614 // We are in the high flow regime where the bhp_samples
616615 // are all equal to the bhp_limit.
@@ -620,6 +619,7 @@ computeBhpAtThpLimitInjImpl(const std::function<std::vector<Scalar>(const Scalar
620619 return std::nullopt ;
621620 }
622621 try {
622+ int iteration = 0 ;
623623 const Scalar solved_bhp = RegulaFalsiBisection<ErrorPolicy>::
624624 solve (eq, low, high, max_iteration, bhp_tolerance, iteration);
625625 if constexpr (extraBhpAtThpLimitOutput) {
@@ -773,8 +773,8 @@ computeBhpAtThpLimit(const std::function<std::vector<Scalar>(const Scalar)>& fra
773773 // Solve for the proper solution in the given interval.
774774 const int max_iteration = 100 ;
775775 const Scalar bhp_tolerance = 0.01 * unit::barsa;
776- int iteration = 0 ;
777776 try {
777+ int iteration = 0 ;
778778 const Scalar solved_bhp = RegulaFalsiBisection<ThrowOnError>::
779779 solve (eq, low, high, max_iteration, bhp_tolerance, iteration);
780780 return solved_bhp;
@@ -1053,10 +1053,9 @@ bruteForceBracketCommonTHP(const std::function<Scalar(const Scalar)>& eq,
10531053 constexpr int sample_number = 1000 ;
10541054 constexpr Scalar interval = 1E5 ;
10551055 Scalar eq_low = eq (min_thp);
1056- Scalar eq_high = 0.0 ;
10571056 for (int i = 0 ; i < sample_number + 1 ; ++i) {
10581057 max_thp = min_thp + interval * i;
1059- eq_high = eq (max_thp);
1058+ const Scalar eq_high = eq (max_thp);
10601059 if (eq_high * eq_low <= 0 .) {
10611060 bracket_found = true ;
10621061 min_thp = max_thp - interval;
0 commit comments