https://mooseframework.inl.gov
MFEMCurlAux.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 "MFEMCurlAux.h"
13 #include "MFEMProblem.h"
14 
15 registerMooseObject("MooseApp", MFEMCurlAux);
16 
19 {
21  params.addClassDescription(
22  "Calculates the curl of an H(curl) conforming ND source variable and stores the result"
23  " on an H(div) conforming RT result auxvariable");
24  MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
25  params, "source", "Vector H(curl) MFEMVariable to take the curl of.");
26  params.addParam<mfem::real_t>("scale_factor", 1.0, "Factor to scale result auxvariable by.");
27  return params;
28 }
29 
31  : MFEMAuxKernel(parameters),
32  _source_var_name(getParam<VariableName>("source")),
33  _source_var(*getMFEMProblem().getGridFunction(_source_var_name)),
34  _scale_factor(getParam<mfem::real_t>("scale_factor")),
35  _curl(_source_var.ParFESpace(), _result_var.ParFESpace())
36 {
37  _sequence = _source_var.GetSequence() + _result_var.GetSequence();
38  _curl.Assemble();
39  _curl.Finalize();
40 }
41 
42 // Computes the auxvariable.
43 void
45 {
46  update();
48 }
49 
50 void
52 {
53  if (long sequence = _source_var.GetSequence() + _result_var.GetSequence() > _sequence)
54  {
55  _sequence = sequence;
56  _curl.Update();
57  _curl.Assemble();
58  _curl.Finalize();
59  }
60 }
61 
62 #endif
const mfem::real_t _scale_factor
Scalar factor to multiply the result by.
Definition: MFEMCurlAux.h:43
MFEMCurlAux(const InputParameters &parameters)
Definition: MFEMCurlAux.C:30
Class to set an H(div) auxvariable to be the curl of an H(curl) vector variable.
Definition: MFEMCurlAux.h:22
virtual void execute() override
Computes the auxvariable.
Definition: MFEMCurlAux.C:44
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseObject("MooseApp", MFEMCurlAux)
long _sequence
Counter to keep track of FE space updates.
Definition: MFEMAuxKernel.h:41
const mfem::ParGridFunction & _source_var
Reference to source gridfunction.
Definition: MFEMCurlAux.h:41
mfem::ParGridFunction & _result_var
Reference to result gridfunction.
Definition: MFEMAuxKernel.h:38
Class to construct an auxiliary solver used to update a real auxvariable.
Definition: MFEMAuxKernel.h:20
static InputParameters validParams()
Definition: MFEMAuxKernel.C:16
static InputParameters validParams()
Definition: MFEMCurlAux.C:18
mfem::common::ParDiscreteCurlOperator _curl
Curl operator.
Definition: MFEMCurlAux.h:45
virtual void update() override
Method called to update any owned objects upon an FE space update.
Definition: MFEMCurlAux.C:51
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...