https://mooseframework.inl.gov
MFEMSumAux.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 "MFEMSumAux.h"
13 #include "MFEMProblem.h"
14 
15 registerMooseObject("MooseApp", MFEMSumAux);
16 
19 {
21  params.addClassDescription(
22  "Calculates the sum of two variables sharing an FE space, each optionally scaled by a real "
23  "constant, and stores the result in a third.");
24  params.addRequiredParam<VariableName>("first_source_variable", "First variable to sum.");
25  params.addRequiredParam<VariableName>("second_source_variable", "Second variable to sum.");
26  params.addParam<mfem::real_t>(
27  "first_scale_factor", 1.0, "Factor to scale the first variable by prior to sum.");
28  params.addParam<mfem::real_t>(
29  "second_scale_factor", 1.0, "Factor to scale the second variable by prior to sum.");
30  return params;
31 }
32 
34  : MFEMAuxKernel(parameters),
35  _v1_var_name(getParam<VariableName>("first_source_variable")),
36  _v2_var_name(getParam<VariableName>("second_source_variable")),
37  _v1_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_v1_var_name)),
38  _v2_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_v2_var_name)),
39  _lambda1(getParam<mfem::real_t>("first_scale_factor")),
40  _lambda2(getParam<mfem::real_t>("second_scale_factor"))
41 {
42 }
43 
44 void
46 {
47  // result = lambda1 * v1 + lambda2 * v2
49 }
50 
51 #endif
const mfem::real_t _lambda2
Definition: MFEMSumAux.h:42
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...
registerMooseObject("MooseApp", MFEMSumAux)
MFEMSumAux(const InputParameters &parameters)
Definition: MFEMSumAux.C:33
virtual void execute() override
Execute method.
Definition: MFEMSumAux.C:45
mfem::ParGridFunction & _result_var
Reference to result gridfunction.
Definition: MFEMAuxKernel.h:36
Class to construct an auxiliary solver used to update an auxvariable.
Definition: MFEMAuxKernel.h:20
const mfem::real_t _lambda1
Definition: MFEMSumAux.h:41
static InputParameters validParams()
Definition: MFEMAuxKernel.C:16
const mfem::ParGridFunction & _v1_var
Definition: MFEMSumAux.h:38
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...
static InputParameters validParams()
Definition: MFEMSumAux.C:18
const mfem::ParGridFunction & _v2_var
Definition: MFEMSumAux.h:39