https://mooseframework.inl.gov
MFEMVectorIC.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 "MFEMVectorIC.h"
13 #include "MFEMProblem.h"
14 
16 
19 {
20  auto params = MFEMInitialCondition::validParams();
21  params.addClassDescription("Sets the initial values of an MFEM vector variable from a "
22  "user-specified vector coefficient.");
23  params.addRequiredParam<MFEMVectorCoefficientName>("vector_coefficient",
24  "The vector coefficient");
25  return params;
26 }
27 
29 
30 void
32 {
33  auto & coeff = getVectorCoefficient("vector_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.h:332
MFEMProblem & getMFEMProblem()
Return the owning MFEM problem.
Definition: MFEMObject.h:45
mfem::VectorCoefficient & getVectorCoefficient(const std::string &name)
Retrieve a vector MFEM coefficient using the value of an input parameter.
Definition: MFEMObject.C:64
Base class used to set the initial value(s) on an MFEMVariable.
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 vector valued MFEMVariable.
Definition: MFEMVectorIC.h:19
virtual void execute() override
Perform the main work for this object.
Definition: MFEMVectorIC.C:31
registerMooseObject("MooseApp", MFEMVectorIC)
static InputParameters validParams()
Definition: MFEMVectorIC.C:18
MFEMVectorIC(const InputParameters &params)
Definition: MFEMVectorIC.C:28
static InputParameters validParams()