Line data Source code
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 : 16 : registerMooseObject("MooseApp", MFEMScalarBoundaryIC); 17 : 18 : InputParameters 19 8676 : MFEMScalarBoundaryIC::validParams() 20 : { 21 8676 : auto params = MFEMInitialCondition::validParams(); 22 8676 : params += MFEMBoundaryRestrictable::validParams(); 23 17352 : params.addClassDescription("Sets the initial values of an MFEM scalar variable from a " 24 : "user-specified scalar coefficient."); 25 26028 : params.addRequiredParam<MFEMScalarCoefficientName>("coefficient", "The scalar coefficient"); 26 8676 : return params; 27 0 : } 28 : 29 23 : MFEMScalarBoundaryIC::MFEMScalarBoundaryIC(const InputParameters & params) 30 : : MFEMInitialCondition(params), 31 : MFEMBoundaryRestrictable(params, 32 23 : *getMFEMProblem() 33 23 : .getProblemData() 34 69 : .gridfunctions.GetRef(getParam<VariableName>("variable")) 35 : .ParFESpace() 36 46 : ->GetParMesh()) 37 : { 38 23 : } 39 : 40 : void 41 23 : MFEMScalarBoundaryIC::execute() 42 : { 43 46 : auto & coeff = getScalarCoefficient("coefficient"); 44 46 : auto grid_function = getMFEMProblem().getGridFunction(getParam<VariableName>("variable")); 45 23 : grid_function->ProjectBdrCoefficient(coeff, getBoundaryMarkers()); 46 23 : } 47 : 48 : #endif