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 : #include "MFEMGradAux.h" 13 : #include "MFEMProblem.h" 14 : 15 : registerMooseObject("MooseApp", MFEMGradAux); 16 : 17 : InputParameters 18 8710 : MFEMGradAux::validParams() 19 : { 20 8710 : InputParameters params = MFEMAuxKernel::validParams(); 21 8710 : params.addClassDescription( 22 : "Calculates the gradient of an H1 conforming source variable and stores the result" 23 : " on an H(curl) conforming ND result auxvariable"); 24 8710 : params.addRequiredParam<VariableName>("source", 25 : "Scalar H1 MFEMVariable to take the gradient of."); 26 8710 : params.addParam<mfem::real_t>("scale_factor", 1.0, "Factor to scale result auxvariable by."); 27 8710 : return params; 28 0 : } 29 : 30 40 : MFEMGradAux::MFEMGradAux(const InputParameters & parameters) 31 : : MFEMAuxKernel(parameters), 32 40 : _source_var_name(getParam<VariableName>("source")), 33 40 : _source_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_source_var_name)), 34 40 : _scale_factor(getParam<mfem::real_t>("scale_factor")), 35 80 : _grad(_source_var.ParFESpace(), _result_var.ParFESpace()) 36 : { 37 40 : _grad.Assemble(); 38 40 : _grad.Finalize(); 39 40 : } 40 : 41 : // Computes the auxvariable. 42 : void 43 40 : MFEMGradAux::execute() 44 : { 45 40 : _result_var = 0.0; 46 40 : _grad.AddMult(_source_var, _result_var, _scale_factor); 47 40 : } 48 : 49 : #endif