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 : #pragma once 12 : 13 : #include "MFEMAuxKernel.h" 14 : #include "mfem.hpp" 15 : 16 : /** 17 : * Project s(x) * (U . V) onto a scalar MFEM auxvariable. 18 : * 19 : * Notes: 20 : * - Currently supports only interior DOFs (no shared/constrained DOFs). 21 : * - The target variable's FE Space must be L2. 22 : */ 23 : class MFEMDotProductAux : public MFEMAuxKernel 24 : { 25 : public: 26 : static InputParameters validParams(); 27 : 28 : MFEMDotProductAux(const InputParameters & parameters); 29 7 : ~MFEMDotProductAux() override = default; 30 : 31 : void execute() override; 32 : 33 : protected: 34 : /// Names of vector sources 35 : const VariableName _u_var_name; 36 : const VariableName _v_var_name; 37 : 38 : /// References to the vector ParGridFunctions 39 : const mfem::ParGridFunction & _u_var; 40 : const mfem::ParGridFunction & _v_var; 41 : const mfem::real_t _scale_factor; 42 : 43 : /// Coefficient wrappers 44 : mfem::VectorGridFunctionCoefficient _u_coef; 45 : mfem::VectorGridFunctionCoefficient _v_coef; 46 : mfem::InnerProductCoefficient _dot_uv; 47 : mfem::ConstantCoefficient _scale_c; 48 : 49 : ///Final coefficient that applies the scale factor to the inner product 50 : mfem::ProductCoefficient _final_coef; 51 : }; 52 : 53 : #endif // MOOSE_MFEM_ENABLED