BubbleProfiler  0.3.0
by Peter Athron, Csaba Balazs, Michael Bardsley, Andrew Fowlie, Dylan Harries & Graham White
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BubbleProfiler::Relative_convergence_tester Class Reference

#include <relative_convergence_tester.hpp>

Inheritance diagram for BubbleProfiler::Relative_convergence_tester:
Inheritance graph
[legend]
Collaboration diagram for BubbleProfiler::Relative_convergence_tester:
Collaboration graph
[legend]

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_testeroperator= (const Relative_convergence_tester &)=default
 
Relative_convergence_testeroperator= (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...
 
- Public Member Functions inherited from BubbleProfiler::Profile_convergence_tester
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 {}
 

Detailed Description

This class implements a convergence criterion based on two factors:

  1. Relative change in Euclidean action
  2. Relative change in field values at the origin

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.

Constructor & Destructor Documentation

BubbleProfiler::Relative_convergence_tester::Relative_convergence_tester ( )
default

Construct relative convergence tester with default tolerances.

BubbleProfiler::Relative_convergence_tester::Relative_convergence_tester ( double  tol)
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 .

Parameters
tolrelative 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 .

Parameters
action_tolrelative change tolerance for the action
fields_tolrelative change tolerance for field values at origin

Definition at line 38 of file relative_convergence_tester.cpp.

References calculate_max_iterations(), and max_iterations.

BubbleProfiler::Relative_convergence_tester::Relative_convergence_tester ( const Relative_convergence_tester )
default
BubbleProfiler::Relative_convergence_tester::Relative_convergence_tester ( Relative_convergence_tester &&  )
default
virtual BubbleProfiler::Relative_convergence_tester::~Relative_convergence_tester ( )
virtualdefault

Member Function Documentation

int BubbleProfiler::Relative_convergence_tester::calculate_max_iterations ( ) const
private
bool BubbleProfiler::Relative_convergence_tester::check_action_converged ( double  action) const
private
bool BubbleProfiler::Relative_convergence_tester::check_fields_converged ( double  domain_start,
const Eigen::VectorXd &  field_vals 
) const
private
virtual int BubbleProfiler::Relative_convergence_tester::get_max_iterations ( ) const
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.

Returns
maximum number of iterations allowed

Implements BubbleProfiler::Profile_convergence_tester.

Definition at line 103 of file relative_convergence_tester.hpp.

References max_iterations, and restart().

bool BubbleProfiler::Relative_convergence_tester::is_converged ( const Potential potential,
const Field_profiles profiles 
)
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.

Parameters
potentialthe potential for which the bubble profile is being calculated
profilesthe current estimate for the bubble field profiles
Returns
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.

Relative_convergence_tester& BubbleProfiler::Relative_convergence_tester::operator= ( const Relative_convergence_tester )
default
Relative_convergence_tester& BubbleProfiler::Relative_convergence_tester::operator= ( Relative_convergence_tester &&  )
default
double BubbleProfiler::Relative_convergence_tester::relative_difference ( double  x,
double  y 
) const
private
void BubbleProfiler::Relative_convergence_tester::restart ( )
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().

void BubbleProfiler::Relative_convergence_tester::set_max_iterations ( int  it)
inline

Set the maximum number of iterations allowed.

Parameters
itthe maximum allowed number of iterations

Definition at line 114 of file relative_convergence_tester.hpp.

References max_iterations.

Member Data Documentation

double BubbleProfiler::Relative_convergence_tester::action_relative_tol {1.e-4}
private
double BubbleProfiler::Relative_convergence_tester::field_vals_relative_tol {1.e-4}
private
int BubbleProfiler::Relative_convergence_tester::iteration_count {0}
private

Definition at line 117 of file relative_convergence_tester.hpp.

Referenced by is_converged(), and restart().

logging::Basic_logger BubbleProfiler::Relative_convergence_tester::logger {}
private
int BubbleProfiler::Relative_convergence_tester::max_iterations {10}
private
double BubbleProfiler::Relative_convergence_tester::old_action {0.}
private

Definition at line 121 of file relative_convergence_tester.hpp.

Referenced by check_action_converged(), is_converged(), and restart().

Eigen::VectorXd BubbleProfiler::Relative_convergence_tester::old_field_vals {}
private

Definition at line 122 of file relative_convergence_tester.hpp.

Referenced by check_fields_converged(), is_converged(), and restart().


The documentation for this class was generated from the following files: