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 MFEM_ENABLED 11 : 12 : #include "MFEMVectorL2Error.h" 13 : #include "MFEMProblem.h" 14 : 15 : registerMooseObject("MooseApp", MFEMVectorL2Error); 16 : 17 : InputParameters 18 8644 : MFEMVectorL2Error::validParams() 19 : { 20 8644 : InputParameters params = MFEMPostprocessor::validParams(); 21 8644 : params.addClassDescription( 22 : "Computes L2 error $\\left\\Vert \\vec u_{ex} - \\vec u_{h}\\right\\Vert_{\\rm L2}$ for " 23 : "vector gridfunctions."); 24 8644 : params.addParam<MFEMVectorCoefficientName>("function", 25 : "The analytic solution to compare against."); 26 8644 : params.addParam<VariableName>( 27 : "variable", "Name of the vector variable of which to find the norm of the error."); 28 8644 : return params; 29 0 : } 30 : 31 7 : MFEMVectorL2Error::MFEMVectorL2Error(const InputParameters & parameters) 32 : : MFEMPostprocessor(parameters), 33 7 : _var_name(getParam<VariableName>("variable")), 34 7 : _coeff_name(getParam<MFEMVectorCoefficientName>("function")), 35 7 : _vec_coeff(getVectorCoefficient(_coeff_name)), 36 14 : _var(getMFEMProblem().getProblemData().gridfunctions.GetRef(_var_name)) 37 : { 38 7 : } 39 : 40 : void 41 6 : MFEMVectorL2Error::initialize() 42 : { 43 6 : } 44 : 45 : void 46 6 : MFEMVectorL2Error::execute() 47 : { 48 6 : } 49 : 50 : PostprocessorValue 51 8 : MFEMVectorL2Error::getValue() const 52 : { 53 8 : return _var.ComputeL2Error(_vec_coeff); 54 : } 55 : 56 : #endif