https://mooseframework.inl.gov
MFEMDivAux.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 "MFEMDivAux.h"
13 #include "MFEMProblem.h"
14 
15 registerMooseObject("MooseApp", MFEMDivAux);
16 
17 /*
18 Class to set an L2 auxvariable to be the divergence of a H(div) vector variable.
19 */
22 {
24  params.addClassDescription(
25  "Calculates the divergence of an H(div) conforming RT source variable and stores the result"
26  " on an L2 conforming result auxvariable");
27  params.addRequiredParam<VariableName>("source",
28  "Vector H(div) MFEMVariable to take the divergence of.");
29  params.addParam<mfem::real_t>("scale_factor", 1.0, "Factor to scale result auxvariable by.");
30  return params;
31 }
32 
34  : MFEMAuxKernel(parameters),
35  _source_var_name(getParam<VariableName>("source")),
36  _source_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_source_var_name)),
37  _scale_factor(getParam<mfem::real_t>("scale_factor")),
38  _div(_source_var.ParFESpace(), _result_var.ParFESpace())
39 {
40  _div.Assemble();
41  _div.Finalize();
42 }
43 
44 // Computes the auxvariable.
45 void
47 {
48  _result_var = 0.0;
50 }
51 
52 #endif
static InputParameters validParams()
Definition: MFEMDivAux.C:21
mfem::common::ParDiscreteDivOperator _div
Definition: MFEMDivAux.h:41
MFEMDivAux(const InputParameters &parameters)
Definition: MFEMDivAux.C:33
virtual void execute() override
Execute method.
Definition: MFEMDivAux.C:46
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
mfem::ParGridFunction & _result_var
Reference to result gridfunction.
Definition: MFEMAuxKernel.h:36
const mfem::real_t _scale_factor
Definition: MFEMDivAux.h:39
registerMooseObject("MooseApp", MFEMDivAux)
static InputParameters validParams()
Definition: MFEMAuxKernel.C:16
const mfem::ParGridFunction & _source_var
Definition: MFEMDivAux.h:37
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...