https://mooseframework.inl.gov
MFEMVectorL2Error.C
Go to the documentation of this file.
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 
16 
19 {
21  params.addClassDescription(
22  "Computes L2 error $\\left\\Vert \\vec u_{ex} - \\vec u_{h}\\right\\Vert_{\\rm L2}$ for "
23  "vector gridfunctions.");
24  params.addParam<MFEMVectorCoefficientName>("function",
25  "The analytic solution to compare against.");
26  params.addParam<VariableName>(
27  "variable", "Name of the vector variable of which to find the norm of the error.");
28  return params;
29 }
30 
32  : MFEMPostprocessor(parameters),
33  _var_name(getParam<VariableName>("variable")),
34  _coeff_name(getParam<MFEMVectorCoefficientName>("function")),
35  _vec_coeff(getVectorCoefficient(_coeff_name)),
36  _var(getMFEMProblem().getProblemData().gridfunctions.GetRef(_var_name))
37 {
38 }
39 
40 void
42 {
43 }
44 
45 void
47 {
48 }
49 
52 {
53  return _var.ComputeL2Error(_vec_coeff);
54 }
55 
56 #endif
mfem::GridFunction & _var
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
MFEMVectorL2Error(const InputParameters &parameters)
mfem::VectorCoefficient & _vec_coeff
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual PostprocessorValue getValue() const override final
Get the L2 Error.
Real PostprocessorValue
various MOOSE typedefs
Definition: MooseTypes.h:202
registerMooseObject("MooseApp", MFEMVectorL2Error)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
virtual void execute() override
Execute method.
static InputParameters validParams()