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

Weights of QGaussLogR #16283

Closed
simonsticko opened this issue Nov 21, 2023 · 3 comments
Closed

Weights of QGaussLogR #16283

simonsticko opened this issue Nov 21, 2023 · 3 comments

Comments

@simonsticko
Copy link
Contributor

If I use QGaussLogR with the factor_out_singular_weights=true flag, the quadrature weights does not sum to one. From the documentation, it looks like they should.

Is this a bug? Or should the sum of the weights only converge to 1 when we increase the order? Do you know @luca-heltai ?

#include <deal.II/base/quadrature_lib.h>

using namespace dealii;

int
main()
{
  const int dim = 1;

  const Point<dim> ref_space_singularity;
  const double     singularity_scaling        = 1;
  const bool       factor_out_singular_weight = true;

  const unsigned int max_order = 12;
  for (unsigned int order = 1; order <= max_order; order++)
    {
      QGaussLogR<dim> quadrature(order,
                                 ref_space_singularity,
                                 singularity_scaling,
                                 factor_out_singular_weight);

      double sum_of_weights = 0;
      for (unsigned int i = 0; i < quadrature.size(); ++i)
        sum_of_weights += quadrature.weight(i);
     
      std::cout <<"order = "<<order <<", sum_of_weights = " << sum_of_weights << std::endl;
    }
}
order = 1, sum_of_weights = 0.910239
order = 2, sum_of_weights = 0.883331
order = 3, sum_of_weights = 0.936294
order = 4, sum_of_weights = 0.95993
order = 5, sum_of_weights = 0.972484
order = 6, sum_of_weights = 0.979941
order = 7, sum_of_weights = 0.984729
order = 8, sum_of_weights = 0.987986
order = 9, sum_of_weights = 0.990301
order = 10, sum_of_weights = 0.992005
order = 11, sum_of_weights = 0.993296
order = 12, sum_of_weights = 0.994298
@simonsticko
Copy link
Contributor Author

Okey, never mind. I have convinced myself that there is no reason that they should sum to 1.

@masterleinad
Copy link
Member

For factor_out_singular_weight=false, the weights should sum up to -1 and they do.

@luca-heltai
Copy link
Member

Sorry, I'm late to the party. Summing the weights with factor_out_singular_weight=true does not make any sense, since you are not supposed to integrate smooth functions with it (and the constant is such a function). The documentation states

Notice that this quadrature rule is worthless if you try to use it for regular functions once you factored out the singularity.

I hope this is clear enough, but you are welcome to suggest any changes you think are appropriate in the documentation. I must admit it does not read well (I think I wrote this some 10 to 15 years ago, and I would have probably written it differently today).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants