BubbleProfiler
0.3.0
by Peter Athron, Csaba Balazs, Michael Bardsley, Andrew Fowlie, Dylan Harries & Graham White
|
#include <relative_convergence_tester.hpp>
Public Member Functions | |
Relative_convergence_tester ()=default | |
Construct relative convergence tester with default tolerances. More... | |
Relative_convergence_tester (double tol) | |
Construct relative convergence tester with the same tolerance value for change in action and change in field values at origin. More... | |
Relative_convergence_tester (double action_tol, double fields_tol) | |
Construct relative convergence tester with different tolerance values for change in action and change in field values at origin. More... | |
Relative_convergence_tester (const Relative_convergence_tester &)=default | |
Relative_convergence_tester (Relative_convergence_tester &&)=default | |
virtual | ~Relative_convergence_tester ()=default |
Relative_convergence_tester & | operator= (const Relative_convergence_tester &)=default |
Relative_convergence_tester & | operator= (Relative_convergence_tester &&)=default |
virtual bool | is_converged (const Potential &potential, const Field_profiles &profiles) override |
Check whether the candidate bubble solution has converged. More... | |
virtual int | get_max_iterations () const override |
Return the maximum number of iterations allowed. More... | |
virtual void | restart () override |
Restart the convergence tester to the start of the iteration. More... | |
void | set_max_iterations (int it) |
Set the maximum number of iterations allowed. More... | |
![]() | |
virtual | ~Profile_convergence_tester ()=default |
Private Member Functions | |
int | calculate_max_iterations () const |
double | relative_difference (double, double) const |
bool | check_action_converged (double) const |
bool | check_fields_converged (double, const Eigen::VectorXd &) const |
Private Attributes | |
int | iteration_count {0} |
int | max_iterations {10} |
double | action_relative_tol {1.e-4} |
double | field_vals_relative_tol {1.e-4} |
double | old_action {0.} |
Eigen::VectorXd | old_field_vals {} |
logging::Basic_logger | logger {} |
This class implements a convergence criterion based on two factors:
The user supplies relative tolerances for both factors. Note that in general there is more than one scalar field; in which case the field with the greatest relative change between iterations is used to test convergence.
Definition at line 40 of file relative_convergence_tester.hpp.
|
default |
Construct relative convergence tester with default tolerances.
|
explicit |
Construct relative convergence tester with the same tolerance value for change in action and change in field values at origin.
The maximum number of iterations is set to
\[ -10 \log_{10}(\epsilon), \]
with \(\epsilon\) equal to the supplied value of tol
.
tol | relative change tolerance |
Definition at line 46 of file relative_convergence_tester.cpp.
BubbleProfiler::Relative_convergence_tester::Relative_convergence_tester | ( | double | action_tol, |
double | fields_tol | ||
) |
Construct relative convergence tester with different tolerance values for change in action and change in field values at origin.
The maximum number of iterations is set to
\[ \max(-10 \log_{10}(\epsilon)), \]
where \(\epsilon\) is the smaller of action_tol
and fields_tol
.
action_tol | relative change tolerance for the action |
fields_tol | relative change tolerance for field values at origin |
Definition at line 38 of file relative_convergence_tester.cpp.
References calculate_max_iterations(), and max_iterations.
|
default |
|
default |
|
virtualdefault |
|
private |
Definition at line 80 of file relative_convergence_tester.cpp.
References action_relative_tol, and field_vals_relative_tol.
Referenced by Relative_convergence_tester().
|
private |
Definition at line 102 of file relative_convergence_tester.cpp.
References action_relative_tol, BubbleProfiler::logging::Basic_logger::log_message(), logger, old_action, relative_difference(), and BubbleProfiler::logging::Trace.
Referenced by is_converged().
|
private |
Definition at line 118 of file relative_convergence_tester.cpp.
References field_vals_relative_tol, BubbleProfiler::logging::Basic_logger::log_message(), logger, gaussian_alpha_tests::n_fields, old_field_vals, relative_difference(), and BubbleProfiler::logging::Trace.
Referenced by is_converged().
|
inlineoverridevirtual |
Return the maximum number of iterations allowed.
If this count is exceeded, before convergence is reached (as indicated by is_converged
returning true
), the client may want to issue a warning or implement some other error handling strategy.
Implements BubbleProfiler::Profile_convergence_tester.
Definition at line 103 of file relative_convergence_tester.hpp.
References max_iterations, and restart().
|
overridevirtual |
Check whether the candidate bubble solution has converged.
This method will return true
when the change in both metrics (i.e. the action and field values at the origin) fall below the specified thresholds.
potential | the potential for which the bubble profile is being calculated |
profiles | the current estimate for the bubble field profiles |
true
if both the action and field profiles have converged Implements BubbleProfiler::Profile_convergence_tester.
Definition at line 51 of file relative_convergence_tester.cpp.
References action_relative_tol, BubbleProfiler::calculate_action(), check_action_converged(), check_fields_converged(), BubbleProfiler::Field_profiles::evaluate_at(), field_vals_relative_tol, BubbleProfiler::Field_profiles::get_domain_start(), iteration_count, BubbleProfiler::logging::Basic_logger::log_message(), logger, old_action, old_field_vals, and BubbleProfiler::logging::Trace.
|
default |
|
default |
|
private |
Definition at line 86 of file relative_convergence_tester.cpp.
References BubbleProfiler::Abs().
Referenced by check_action_converged(), and check_fields_converged().
|
overridevirtual |
Restart the convergence tester to the start of the iteration.
Implements BubbleProfiler::Profile_convergence_tester.
Definition at line 150 of file relative_convergence_tester.cpp.
References iteration_count, old_action, and old_field_vals.
Referenced by get_max_iterations().
|
inline |
Set the maximum number of iterations allowed.
it | the maximum allowed number of iterations |
Definition at line 114 of file relative_convergence_tester.hpp.
References max_iterations.
|
private |
Definition at line 119 of file relative_convergence_tester.hpp.
Referenced by calculate_max_iterations(), check_action_converged(), and is_converged().
|
private |
Definition at line 120 of file relative_convergence_tester.hpp.
Referenced by calculate_max_iterations(), check_fields_converged(), and is_converged().
|
private |
Definition at line 117 of file relative_convergence_tester.hpp.
Referenced by is_converged(), and restart().
|
private |
Definition at line 123 of file relative_convergence_tester.hpp.
Referenced by check_action_converged(), check_fields_converged(), and is_converged().
|
private |
Definition at line 118 of file relative_convergence_tester.hpp.
Referenced by get_max_iterations(), Relative_convergence_tester(), and set_max_iterations().
|
private |
Definition at line 121 of file relative_convergence_tester.hpp.
Referenced by check_action_converged(), is_converged(), and restart().
|
private |
Definition at line 122 of file relative_convergence_tester.hpp.
Referenced by check_fields_converged(), is_converged(), and restart().