https://mooseframework.inl.gov
MFEMScalarIC.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 "MFEMScalarIC.h"
13 #include "MFEMProblem.h"
14 #include <mfem.hpp>
15 
17 
20 {
21  auto params = MFEMInitialCondition::validParams();
22  params.addClassDescription("Sets the initial values of an MFEM scalar variable from a "
23  "user-specified scalar coefficient.");
24  params.addRequiredParam<MFEMScalarCoefficientName>("coefficient", "The scalar coefficient");
25  return params;
26 }
27 
29 
30 void
32 {
33  auto & coeff = getScalarCoefficient(getParam<MFEMScalarCoefficientName>("coefficient"));
34  auto grid_function = getMFEMProblem().getGridFunction(getParam<VariableName>("variable"));
35  grid_function->ProjectCoefficient(coeff);
36 }
37 
38 #endif
std::shared_ptr< mfem::ParGridFunction > getGridFunction(const std::string &name)
Definition: MFEMProblem.C:517
mfem::Coefficient & getScalarCoefficient(const std::string &name)
Returns references to coefficients stored in the MFEMProblem PropertiesManager.
Base class used to set the initial value(s) on an MFEMVariable.
registerMooseObject("MooseApp", MFEMScalarIC)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Class used to set the initial value(s) on a scalar valued MFEMVariable.
Definition: MFEMScalarIC.h:18
MFEMScalarIC(const InputParameters &params)
Definition: MFEMScalarIC.C:28
static InputParameters validParams()
Definition: MFEMScalarIC.C:19
MFEMProblem & getMFEMProblem()
Returns a reference to the MFEMProblem instance.
virtual void execute() override
Execute method.
Definition: MFEMScalarIC.C:31
static InputParameters validParams()