https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEML2Error.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 MOOSE_MFEM_ENABLED
11
12#include "MFEML2Error.h"
13#include "MFEMProblem.h"
14
16
19{
22 "Computes L2 error $\\left\\Vert u_{ex} - u_{h}\\right\\Vert_{\\rm L2}$ for "
23 "gridfunctions using H1 or L2 elements.");
24 params.addParam<MFEMScalarCoefficientName>("function",
25 "The analytic solution to compare against.");
26 MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
27 params, "variable", "Name of the variable of which to find the norm of the error.");
28 return params;
29}
30
32 : MFEMPostprocessor(parameters),
33 _coeff(getScalarCoefficient("function")),
34 _var(*getMFEMProblem().getGridFunction(getParam<VariableName>("variable")))
35{
36}
37
38void
42
43void
47
50{
51 return _var.ComputeL2Error(_coeff);
52}
53
54#endif
registerMooseObject("MooseApp", MFEML2Error)
Real PostprocessorValue
various MOOSE typedefs
Definition MooseTypes.h:230
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
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.
Compute the L2 error for a variable.
Definition MFEML2Error.h:20
mfem::GridFunction & _var
Definition MFEML2Error.h:36
MFEML2Error(const InputParameters &parameters)
Definition MFEML2Error.C:31
virtual void execute() override
Perform the main work for this object.
Definition MFEML2Error.C:44
static InputParameters validParams()
Definition MFEML2Error.C:18
virtual PostprocessorValue getValue() const override final
Get the L2 Error.
Definition MFEML2Error.C:49
mfem::Coefficient & _coeff
Definition MFEML2Error.h:35
virtual void initialize() override
Perform any pre-execution setup for this object.
Definition MFEML2Error.C:39
Postprocessor for MFEM results.
static InputParameters validParams()