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
Expose RemotePointEvaluation parameters in non-nested multigrid #15899
Expose RemotePointEvaluation parameters in non-nested multigrid #15899
Conversation
In addition to the arguments needed by the constructor of RemotePointEvaluation, I've added an additional boolean, To give more context, this PR is motivated by the fact that some boundary points may not be picked up due to floating point arithmetic in certain situations (for instance when one has neumann boundary conditions), leading to dramatic effects on the number of required iterations. This issue can be solved by simply tweaking the tolerance parameter, and this is what the present PR allows. |
18d2575
to
dda8f18
Compare
* AdditionalData structure with the arguments needed by | ||
* RemotePointEvaluation. Default values are the same as the ones described in | ||
* the documentation of RemotePointEvaluation. The last boolean parameter, @p enf_all_points_found is true by defaults and | ||
* checks if RemotePointEvaluation::all_points_found() evaluates to true, i.e. | ||
* all submitted points have been found inside the domain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write the text more general, since we plan to add more parameters.
/** | ||
* AdditionalData structure with the arguments needed by | ||
* RemotePointEvaluation. Default values are the same as the ones described in | ||
* the documentation of RemotePointEvaluation. The last boolean parameter, @p enf_all_points_found is true by defaults and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* the documentation of RemotePointEvaluation. The last boolean parameter, @p enf_all_points_found is true by defaults and | |
* the documentation of RemotePointEvaluation. The last Boolean parameter, | |
* @p enf_all_points_found is true by defaults and |
struct AdditionalData | ||
{ | ||
AdditionalData(const double tol = 1e-6, | ||
const bool enf_unique_mapping = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed.
AdditionalData(const double tol = 1e-6, | ||
const bool enf_unique_mapping = false, | ||
const unsigned int rtree_l = 0, | ||
const std::function<std::vector<bool>()> &marked_verts = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed.
const bool enf_unique_mapping = false, | ||
const unsigned int rtree_l = 0, | ||
const std::function<std::vector<bool>()> &marked_verts = {}, | ||
const bool enf_all_points_found = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const bool enf_all_points_found = true) | |
const bool enforce_all_points_found = true) |
Utilities::MPI::RemotePointEvaluation<dim> rpe; | ||
std::shared_ptr<Utilities::MPI::RemotePointEvaluation<dim>> rpe; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change to shared_ptr is not needed!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it was a leftover from debugging. Fixed, thanks
|
||
if (additional_data.enforce_all_points_found) | ||
AssertThrow( | ||
rpe->all_points_found(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rpe->all_points_found(), | |
!additional_data.enforce_all_points_found || rpe->all_points_found(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just some minor documentation changes.
* @p tolerance and @p rtree_level related to the search procedure (used | ||
* internally by RemotePointEvaluation) or, in the future, transfer operators | ||
* needed by the non-nested multigrid algorithm. Default values are the same | ||
* as the ones described in the documentation of RemotePointEvaluation. | ||
* The last Boolean parameter, @p enforce_all_points_found is true by default | ||
* and checks if RemotePointEvaluation::all_points_found() evaluates to true, | ||
* i.e. all submitted points have been found inside the domain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally, we described these parameters closer to the parameters. See
dealii/include/deal.II/lac/solver_gmres.h
Lines 197 to 261 in dfb4350
/** | |
* Standardized data struct to pipe additional data to the solver. | |
*/ | |
struct AdditionalData | |
{ | |
/** | |
* Constructor. By default, set the number of temporary vectors to 30, | |
* i.e. do a restart every 28 iterations. Also set preconditioning from | |
* left, the residual of the stopping criterion to the default residual, | |
* and re-orthogonalization only if necessary. Also, the batched mode with | |
* reduced functionality to track information is disabled by default. | |
*/ | |
explicit AdditionalData( | |
const unsigned int max_n_tmp_vectors = 30, | |
const bool right_preconditioning = false, | |
const bool use_default_residual = true, | |
const bool force_re_orthogonalization = false, | |
const bool batched_mode = false, | |
const LinearAlgebra::OrthogonalizationStrategy | |
orthogonalization_strategy = | |
LinearAlgebra::OrthogonalizationStrategy::modified_gram_schmidt); | |
/** | |
* Maximum number of temporary vectors. This parameter controls the size | |
* of the Arnoldi basis, which for historical reasons is | |
* #max_n_tmp_vectors-2. SolverGMRES assumes that there are at least three | |
* temporary vectors, so this value must be greater than or equal to three. | |
*/ | |
unsigned int max_n_tmp_vectors; | |
/** | |
* Flag for right preconditioning. | |
* | |
* @note Change between left and right preconditioning will also change | |
* the way residuals are evaluated. See the corresponding section in the | |
* SolverGMRES. | |
*/ | |
bool right_preconditioning; | |
/** | |
* Flag for the default residual that is used to measure convergence. | |
*/ | |
bool use_default_residual; | |
/** | |
* Flag to force re-orthogonalization of orthonormal basis in every step. | |
* If set to false, the solver automatically checks for loss of | |
* orthogonality every 5 iterations and enables re-orthogonalization only | |
* if necessary. | |
*/ | |
bool force_re_orthogonalization; | |
/** | |
* Flag to control whether a reduced mode of the solver should be | |
* run. This is necessary when running (several) SolverGMRES instances | |
* involving very small and cheap linear systems where the feedback from | |
* all signals, eigenvalue computations, and log stream are disabled. | |
*/ | |
bool batched_mode; | |
/** | |
* Strategy to orthogonalize vectors. | |
*/ | |
LinearAlgebra::OrthogonalizationStrategy orthogonalization_strategy; | |
}; |
AssertThrow( | ||
!additional_data.enforce_all_points_found || rpe.all_points_found(), | ||
ExcMessage( | ||
"You requested that all points should be found, but this didn't happen. You can change this option through the AdditionaData struct in the constructor.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you break the line?
e39c619
to
f11181e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
...through an AdditionalData struct.