Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic on CalcTempAtFalseVacFraction() #149

Merged
merged 6 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cmake_minimum_required(VERSION 3.23)
project(
BSMPT
VERSION 3.0.4
VERSION 3.0.5
LANGUAGES C CXX
DESCRIPTION
"BSMPT - Beyond the Standard Model Phase Transitions : A C++ package for the computation of the EWPT in BSM models"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas M
SPDX-License-Identifier: GPL-3.0-or-later
-->

Program: BSMPT version 3.0.4
Program: BSMPT version 3.0.5

Released by: Philipp Basler, Lisa Biermann, Margarete Mühlleitner, Jonas Müller, Rui Santos and João Viana

Expand Down
21 changes: 20 additions & 1 deletion include/BSMPT/bounce_solution/bounce_solution.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,25 @@ class BounceSolution
*/
const double RelErr = 1e-6;

/**
* @brief Maximum relative difference in temperature on the fraction of false
* vacuum to be accepted.
*
*/
const double RelativeTemperatureInCalcTempAtFalseVacFraction = 1e-8;

/**
* @brief Maximum relative error on the fraction of vacuum tunneled to be
* accepted.
*/
const double RelativeErrorInCalcTempAtFalseVacFraction = 1e-3;

/**
* @brief Additional margin of error in the while loop without admitting
* failure.
*/
const double MarginOfCalcTempAtFalseVacFractionBeforeFailure = 1e-4;

/**
* @brief pair of coexisiting phases
*/
Expand Down Expand Up @@ -547,4 +566,4 @@ struct resultErrorPair Nintegrate_Outer(BounceSolution &obj);
*/
struct resultErrorPair Nderive_BounceRatio(BounceSolution &obj);

} // namespace BSMPT
} // namespace BSMPT
28 changes: 17 additions & 11 deletions src/bounce_solution/bounce_solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,14 @@
this->SetStoredTemp(T_middle); // update temp storage for inner integral
double IatT = prefac * Nintegrate_Outer(*this).result;

bool numerically_unstable = false;

while (std::abs(T_up / T_down - 1) > 1e-8)
while ((std::abs(T_up / T_down - 1) >
RelativeTemperatureInCalcTempAtFalseVacFraction *
MarginOfCalcTempAtFalseVacFractionBeforeFailure) or
(not almost_the_same(
int_at_false_vac_frac,
IatT,
RelativeErrorInCalcTempAtFalseVacFraction *

Check warning on line 763 in src/bounce_solution/bounce_solution.cpp

View check run for this annotation

Codecov / codecov/patch

src/bounce_solution/bounce_solution.cpp#L763

Added line #L763 was not covered by tests
MarginOfCalcTempAtFalseVacFractionBeforeFailure)))
{
T_middle = (T_up + T_down) / 2.;
this->SetStoredTemp(T_middle); // update temp storage for inner integral
Expand All @@ -775,18 +780,19 @@
T_down = T_middle;
}

if (std::abs(T_up / T_down - 1) < 1e-8 and
not almost_the_same(int_at_false_vac_frac, IatT))
// Condition for success
if (std::abs(T_up / T_down - 1) <
RelativeTemperatureInCalcTempAtFalseVacFraction and
almost_the_same(int_at_false_vac_frac,
IatT,
RelativeErrorInCalcTempAtFalseVacFraction))
{
numerically_unstable = true;
res_Temp = T_middle;
break;
}
}
if (not numerically_unstable)
{
res_Temp = T_middle;
}
}
// Not numerically stable
return res_Temp;
}

Expand Down Expand Up @@ -1092,4 +1098,4 @@
return this->betaH;
}

} // namespace BSMPT
} // namespace BSMPT