-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some MFEM development in support of traditional MOOSE use
- Allow specifying initial conditions for MFEM based simulations - Add support for properties restricted to block names
- Loading branch information
Showing
9 changed files
with
117 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifdef MFEM_ENABLED | ||
|
||
#pragma once | ||
|
||
#include "MFEMGeneralUserObject.h" | ||
|
||
class MFEMScalarIC : public MFEMGeneralUserObject | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
MFEMScalarIC(const InputParameters & params); | ||
virtual void execute() override; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifdef MFEM_ENABLED | ||
|
||
#include "MFEMScalarIC.h" | ||
#include "MFEMProblem.h" | ||
#include <libmesh/libmesh_common.h> | ||
#include <mfem.hpp> | ||
|
||
registerMooseObject("MooseApp", MFEMScalarIC); | ||
|
||
InputParameters | ||
MFEMScalarIC::validParams() | ||
{ | ||
auto params = MFEMGeneralUserObject::validParams(); | ||
params.addRequiredParam<std::string>("variable", | ||
"The variable to apply the initial condition for"); | ||
params.addRequiredParam<FunctionName>("coefficient", "The scalar coefficient"); | ||
params.registerBase("InitialCondition"); | ||
// We cannot generally execute this at construction time since the coefficient may be based on a | ||
// MOOSE function which is not itself setup until its initialSetup is called. UserObject initial | ||
// execution occurs after function initialSetup | ||
params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL}; | ||
params.suppressParameter<ExecFlagEnum>("execute_on"); | ||
return params; | ||
} | ||
|
||
MFEMScalarIC::MFEMScalarIC(const InputParameters & params) : MFEMGeneralUserObject(params) {} | ||
|
||
void | ||
MFEMScalarIC::execute() | ||
{ | ||
auto coeff = getMFEMProblem().getScalarFunctionCoefficient(getParam<FunctionName>("coefficient")); | ||
auto grid_function = getMFEMProblem().getGridFunction(getParam<std::string>("variable")); | ||
grid_function->ProjectCoefficient(*coeff); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.