39 double action_tol_,
double fields_tol_)
40 : action_relative_tol(action_tol_)
41 , field_vals_relative_tol(fields_tol_)
54 bool converged =
false;
57 const Eigen::VectorXd current_field_vals = profiles.
evaluate_at(domain_start);
73 + std::to_string(domain_start) +
") < " 83 return static_cast<int>(-std::log10(min_tol) * 10);
87 double x,
double y)
const 89 const double ax =
Abs(x);
90 const double ay =
Abs(y);
91 const double largest = std::max(ax, ay);
93 const double underflow = std::numeric_limits<double>::min();
95 if (largest < underflow) {
99 return Abs(x - y) / largest;
107 + std::to_string(action_diff));
111 std::stringstream log_str;
112 log_str <<
"Action converged = " << (action_converged ?
"true" :
"false");
115 return action_converged;
119 double domain_start,
const Eigen::VectorXd& field_vals)
const 121 const int n_fields = field_vals.size();
125 "Relative_convergence_tester::check_fields_converged: " 126 "number of field values does not match previous number");
129 std::vector<double> field_diffs(n_fields);
130 for (
int i = 0; i <
n_fields; ++i) {
133 +
"(r = " + std::to_string(domain_start) +
") = " 134 + std::to_string(field_vals(i)));
136 const double max_diff = *std::max_element(field_diffs.cbegin(), field_diffs.cend());
139 + std::to_string(max_diff));
142 std::stringstream log_str;
143 log_str <<
"Fields converged = " << + (fields_converged ?
"true" :
"false");
147 return fields_converged;
contains the definition of the Field_profiles clas
contains helper functions for calculating the Euclidean action
logging::Basic_logger logger
bool check_action_converged(double) const
virtual bool is_converged(const Potential &potential, const Field_profiles &profiles) override
Check whether the candidate bubble solution has converged.
double field_vals_relative_tol
bool check_fields_converged(double, const Eigen::VectorXd &) const
double get_domain_start() const
virtual void restart() override
Restart the convergence tester to the start of the iteration.
int calculate_max_iterations() const
void log_message(Log_level level, const std::string &msg) const
double action_relative_tol
Relative_convergence_tester()=default
Construct relative convergence tester with default tolerances.
Eigen::VectorXd evaluate_at(double rho) const
Get all field values at a given radius.
double relative_difference(double, double) const
Exception indicating general setup error.
Abstract base class for a generic potential.
Eigen::VectorXd old_field_vals
double calculate_action(const Potential &potential, const Field_profiles &profiles, std::size_t max_intervals=1000, double rel_tol=1.e-4, double abs_tol=1.e-4, Integration_rule rule=Integration_rule::GK31, bool use_kinetic=true)
Calculates the action using either the kinetic or potential terms.
Discretized set of field profiles.