Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* Swift, a Fourier spectral solver for MOOSE */ 4 : /* */ 5 : /* Copyright 2024 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #include "TensorIntegralPostprocessor.h" 10 : #include "DomainAction.h" 11 : #include "TensorProblem.h" 12 : 13 : registerMooseObject("SwiftApp", TensorIntegralPostprocessor); 14 : 15 : InputParameters 16 228 : TensorIntegralPostprocessor::validParams() 17 : { 18 228 : InputParameters params = TensorPostprocessor::validParams(); 19 228 : params.addClassDescription("Compute the integral over a buffer"); 20 228 : return params; 21 0 : } 22 : 23 114 : TensorIntegralPostprocessor::TensorIntegralPostprocessor(const InputParameters & parameters) 24 114 : : TensorPostprocessor(parameters) 25 : { 26 114 : } 27 : 28 : void 29 1764 : TensorIntegralPostprocessor::execute() 30 : { 31 1764 : _integral = _u.sum().cpu().item<double>(); 32 : 33 1764 : const auto s = _domain.getDomainMax() - _domain.getDomainMin(); 34 5292 : for (const auto dim : make_range(_domain.getDim())) 35 3528 : _integral *= s(dim); 36 : 37 1764 : _integral /= _u.numel(); 38 1764 : } 39 : 40 : PostprocessorValue 41 1764 : TensorIntegralPostprocessor::getValue() const 42 : { 43 1764 : return _integral; 44 : }