robertsj / libdetran

deterministic transport utilities
MIT License
2 stars 2 forks source link

RandomQuadrature #58

Open robertsj opened 1 year ago

robertsj commented 1 year ago

For a variety of reasons, the ability to produce a randomly-generated, angular quadrature for discrete-ordinates calculations is of interest.

Currently, the quadrature classes in Detran follow two hierarchies. The first is BaseQuadrature<-DerivedQuadrature, where Derived is Uniform, GC, or GL. These are 1D quadratures for the range 0 to 1 that follow specific rules (e.g., GL having the zeros of Legendre polynomials with special weights that give let an N-point quadrature integrate polynomials of degree 2N-1 exactly; GC does so for weighted integrands of the form f(x)/sqrt(1-x^2) (or something like that).

The second is Quadrature<-AnotherDerivedQuadrature, where AnotherDerivedQuadrature is one of several, special quadratures (e.g., LevelSymmetric, AbuShumaysDoubleRange) or ProductQuadratureAP<A, P>, where A and P are one of the DerivedQuadrature types noted above.

So, two new derived classes:

  BaseQuadrature<-RandomQuadrature
    chooses x_i ~ Unif(0, 1)   i = 1...N
    sorts x_i
    sets w_i = 1/N

  RandomAngleQuadrature
    chooses mu_i ~ Unif(0, 1) i = 1...N
    chooses eta_i ~ Unif(0, 1)
    sets xi_i = sqrt(mu_i^2, eta_i^2)
    sets w_i = 1/N

and one new template

  ProductQuadratureAP<RandomQuadrature, RandomQuadrature>

Of course, the "randomization" can be fixed at construction.

Alternatively, methods could be added to BaseQuadrature and Quadrature to be reimplemented by their children.

robertsj commented 1 year ago

Hypothesis I: M runs of one (randomized) N-angle problem will not produce results as good as one M*N-angle problem but will be better than a single N-angle problem.

Hypothesis II: One run of a fully-converged, N-angle problem whose quadrature is randomized for each of M iterations will generally yield worse results than one, non-randomized, fully-converged, NM-angle problem. Moreover, M may be significantly larger than the number of iterations required to converge one, non-randomized, N-angle problem. However, the accuracy of the randomized N-angle problem might be substantially closer to the non-randomized, fully-converged, NM-angle problem results than would be the non-randomized variant.

Hypothesis III: Randomization of the quadrature at each iteration mitigates ray effects. This is already shown to a degree in the literature. It helps justify why, as stated in Hypothesis II, that the randomized, N-angle problem may be more accurate than the non-randomized, N-angle problem.