https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMComplexL2Error.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 "MFEMComplexL2Error.h"
13#include "MFEMProblem.h"
14
16
19{
22 "Computes L2 error $\\left\\Vert u_{ex} - u_{h}\\right\\Vert_{\\rm L2}$ for "
23 "complex gridfunctions using H1 or L2 elements.");
24 params.addParam<MFEMScalarCoefficientName>(
25 "function_real", "The real part of the analytic solution to compare against.");
26 params.addParam<MFEMScalarCoefficientName>(
27 "function_imag", "The imaginary part of the analytic solution to compare against.");
28 MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
29 params, "variable", "Name of the variable of which to find the norm of the error.");
30 return params;
31}
32
34 : MFEMPostprocessor(parameters),
35 _coeff_real(getScalarCoefficient("function_real")),
36 _coeff_imag(getScalarCoefficient("function_imag")),
37 _var(*getMFEMProblem().getComplexGridFunction(getParam<VariableName>("variable")))
38{
39}
40
43{
44 return _var.ComputeL2Error(_coeff_real, _coeff_imag);
45}
46
47#endif
registerMooseObject("MooseApp", MFEMComplexL2Error)
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 complex variable.
virtual PostprocessorValue getValue() const override final
Get the L2 Error.
static InputParameters validParams()
mfem::Coefficient & _coeff_imag
mfem::Coefficient & _coeff_real
MFEMComplexL2Error(const InputParameters &parameters)
mfem::ParComplexGridFunction & _var
Postprocessor for MFEM results.
static InputParameters validParams()