Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #ifdef MOOSE_MFEM_ENABLED 11 : 12 : #pragma once 13 : 14 : #include "MFEMAuxKernel.h" 15 : 16 : /** 17 : * AuxKernel to compute a running time average of a scalar coefficient 18 : * using a linear blend. 19 : * 20 : * avg_new(x) = (1 - w) * avg_old(x) + w * src(x), w = dt / (t - s), t > s 21 : */ 22 : class MFEMScalarTimeAverageAux : public MFEMAuxKernel 23 : { 24 : public: 25 : static InputParameters validParams(); 26 : 27 : MFEMScalarTimeAverageAux(const InputParameters & parameters); 28 : 29 6 : virtual ~MFEMScalarTimeAverageAux() override = default; 30 : 31 : /// Computes the auxvariable. 32 : virtual void execute() override; 33 : 34 : protected: 35 : /// Reference to source coefficient. 36 : mfem::Coefficient & _source_coefficient; 37 : /// Reference to result gridfunction coefficient. 38 : mfem::Coefficient & _result_coefficient; 39 : /// Placeholder gridfunction to avoid read/write aliasing during projection. 40 : mfem::ParGridFunction _average_var; 41 : /// Time before the averaging starts. 42 : const Real & _skip; 43 : /// The current time. 44 : const Real & _time; 45 : /// Time step size. 46 : const Real & _dt; 47 : }; 48 : 49 : #endif