Line data Source code
1 : /********************************************************************/ 2 : /* SOFTWARE COPYRIGHT NOTIFICATION */ 3 : /* Cardinal */ 4 : /* */ 5 : /* (c) 2021 UChicago Argonne, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /* */ 8 : /* Prepared by UChicago Argonne, LLC */ 9 : /* Under Contract No. DE-AC02-06CH11357 */ 10 : /* With the U. S. Department of Energy */ 11 : /* */ 12 : /* Prepared by Battelle Energy Alliance, LLC */ 13 : /* Under Contract No. DE-AC07-05ID14517 */ 14 : /* With the U. S. Department of Energy */ 15 : /* */ 16 : /* See LICENSE for full restrictions */ 17 : /********************************************************************/ 18 : 19 : #pragma once 20 : 21 : #include "OpenMCAuxKernel.h" 22 : 23 : /** 24 : * A class which approximates gradients of constant monomial tallies using forward finite 25 : * differences. The gradient computation is based on: 26 : * K. N. Stolte and P. V. Tsvetkov (2023), Annals of Nuclear Energy, 182, 109617. 27 : * https://doi.org/10.1016/j.anucene.2022.109617 28 : */ 29 : class FDTallyGradAux : public OpenMCVectorAuxKernel 30 : { 31 : public: 32 : static InputParameters validParams(); 33 : 34 : FDTallyGradAux(const InputParameters & parameters); 35 : 36 : /// We handle computing and storing the variable value manually. 37 : virtual void compute() override; 38 : 39 : protected: 40 : /// Need to override computeValue() to avoid creating a pure-virtual class. 41 0 : virtual RealVectorValue computeValue() override { return RealVectorValue(0.0, 0.0, 0.0); } 42 : 43 : /// The external filter bin index for the score. 44 : const unsigned int _bin_index; 45 : 46 : /// The element's tally value. 47 : const VariableValue * _tally_val; 48 : 49 : /// The neighboring element's tally value. 50 : const VariableValue * _tally_neighbor_val; 51 : 52 : /** 53 : * The sum of outer products of y' with itself, where y' = x_j - x_i. 54 : * x_j is the centroid of the neighboring element j of element i. 55 : * x_i is the centroid of element i. 56 : */ 57 : RealEigenMatrix _sum_y_y_t; 58 : 59 : /** 60 : * The sum of the finite difference approximation of u multiplied by y'. 61 : */ 62 : RealEigenVector _sum_y_du_dy; 63 : };