https://mooseframework.inl.gov
MFEMScalarBoundaryIC.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 "MFEMScalarBoundaryIC.h"
13 #include "MFEMProblem.h"
14 #include <mfem.hpp>
15 
17 
20 {
21  auto params = MFEMInitialCondition::validParams();
23  params.addClassDescription("Sets the initial values of an MFEM scalar variable from a "
24  "user-specified scalar coefficient.");
25  params.addRequiredParam<MFEMScalarCoefficientName>("coefficient", "The scalar coefficient");
26  return params;
27 }
28 
30  : MFEMInitialCondition(params),
32  *getMFEMProblem()
33  .getProblemData()
34  .gridfunctions.GetRef(getParam<VariableName>("variable"))
35  .ParFESpace()
36  ->GetParMesh())
37 {
38 }
39 
40 void
42 {
43  auto & coeff = getScalarCoefficient("coefficient");
44  auto grid_function = getMFEMProblem().getGridFunction(getParam<VariableName>("variable"));
45  grid_function->ProjectBdrCoefficient(coeff, getBoundaryMarkers());
46 }
47 
48 #endif
Class used to set the initial value(s) on a scalar valued MFEMVariable.
std::shared_ptr< mfem::ParGridFunction > getGridFunction(const std::string &name)
Definition: MFEMProblem.C:502
static InputParameters validParams()
mfem::Coefficient & getScalarCoefficient(const std::string &name)
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...
MFEMScalarBoundaryIC(const InputParameters &params)
static InputParameters validParams()
mfem::Array< int > & getBoundaryMarkers()
registerMooseObject("MooseApp", MFEMScalarBoundaryIC)
Base class for construction of an object that is restricted to a subset of boundaries of the problem ...
virtual void execute() override
Execute method.
MFEMProblem & getMFEMProblem()
Returns a reference to the MFEMProblem instance.
static InputParameters validParams()