Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Auxiliary class for extracting nodal positions/interpolation points from MFEM FESpaces, and for setting DoFs on MFEM GridFunctions
via projection given a vector of values evaluated at these nodes.

End users should not need to interact with `MFEMNodalProjector` directly. `MFEMNodalProjector` is
used by MFEM transfers that set values of an MFEMGridFunction, such as
End users should not need to interact with `MFEMNodalProjector` directly. `MFEMNodalProjector` is
used by MFEM transfers that set values of an MFEMGridFunction, such as
[MultiAppMFEMShapeEvaluationTransfer](MultiAppMFEMShapeEvaluationTransfer.md).

!if-end!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Allows transfers of [MFEM variables](MFEMVariable.md) between MFEM-based applications via local
evaluation of shape functions at target nodal projection points. The variables may be defined on
different meshes and FESpaces of different orders, but must be real, share the same dimensionality,
different meshes and FESpaces of different orders, but must share the same dimensionality,
and both belong to an `MFEMProblem` in their respective applications.

## General Description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For transfers in the opposite direction, from libMesh-based applications to MFEM
All MFEM to libMesh transfers executed from this class should be able to support:

- transfers to lowest order scalar LAGRANGE and MONOMIAL variables
- transfers to second order scalar LAGRANGE variables
- transfers to second order scalar LAGRANGE variables
- transfers between variables belonging to dissimilar meshes
- arbitrary number of parallel processes for both the source and target application
- transfers between parent and child applications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

!if! function=hasCapability('mfem')

Allows transfers of libMesh-based [MooseVariables](MooseVariable.md) to
Allows transfers of libMesh-based [MooseVariables](MooseVariable.md) to
[MFEM variables](MFEMVariable.md),
via local evaluation of shape functions at target nodal projection points. This class supports
transfers between different meshes, from first and second order LAGRANGE and constant MONOMIAL libMesh
Expand All @@ -28,7 +28,7 @@ For transfers in the opposite direction, from MFEM-based applications to libMesh
All libMesh to MFEM transfers executed from this class should be able to support:

- transfers from lowest order scalar LAGRANGE and MONOMIAL variables
- transfers from second order scalar LAGRANGE variables
- transfers from second order scalar LAGRANGE variables
- transfers between variables belonging to dissimilar meshes
- arbitrary number of parallel processes for both the source and target application
- transfers between parent and child applications
Expand Down
7 changes: 3 additions & 4 deletions framework/include/base/TheWarehouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,9 @@ class TheWarehouse
{
mooseAssert(obj, "Null object");
auto cast_obj = dynamic_cast<T *>(obj);
if (obj)
mooseAssert(cast_obj,
"Queried object " + obj->typeAndName() + " has incompatible c++ type with " +
MooseUtils::prettyCppType<T>());
mooseAssert(cast_obj,
"Queried object " + obj->typeAndName() + " has incompatible c++ type with " +
MooseUtils::prettyCppType<T>());
mooseAssert(std::find(results.begin(), results.end(), cast_obj) == results.end(),
"Duplicate object");
if (show_all || obj->enabled())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class MFEMFunctorMaterial : public MFEMObject,
{
public:
static InputParameters validParams();
static libMesh::Point libMeshPointFromMFEMVector(const mfem::Vector & vec);

MFEMFunctorMaterial(const InputParameters & parameters);
virtual ~MFEMFunctorMaterial();
Expand Down
6 changes: 0 additions & 6 deletions framework/src/mfem/functormaterials/MFEMFunctorMaterial.C
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ MFEMFunctorMaterial::validParams()
return params;
}

libMesh::Point
MFEMFunctorMaterial::libMeshPointFromMFEMVector(const mfem::Vector & vec)
{
return libMesh::Point(vec.Elem(0), vec.Elem(1), vec.Elem(2));
}

MFEMFunctorMaterial::MFEMFunctorMaterial(const InputParameters & parameters)
: MFEMObject(parameters),
MFEMBlockRestrictable(parameters, getMFEMProblem().mesh().getMFEMParMesh()),
Expand Down
26 changes: 6 additions & 20 deletions framework/src/mfem/indicators/MFEML2ZienkiewiczZhuIndicator.C
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,13 @@ MFEML2ZienkiewiczZhuIndicator::validParams()
MFEML2ZienkiewiczZhuIndicator::MFEML2ZienkiewiczZhuIndicator(const InputParameters & params)
: MFEMIndicator(params)
{
if (isParamSetByUser("flux_fespace"))
{
// fetch the flux_fespace from the object system
auto object_ptr =
getMFEMProblem()
.getMFEMObject<MFEMFESpace>("MFEMFESpace", getParam<MFEMFESpaceName>("flux_fespace"))
.getSharedPtr();
auto fespace_ptr = std::dynamic_pointer_cast<const MFEMFESpace>(object_ptr);
_flux_fes = fespace_ptr->getFESpace();
}
// fetch the flux_fespace from the object system
if (auto * sn = queryParam<MFEMFESpaceName>("flux_fespace"))
_flux_fes = getMFEMProblem().getMFEMObject<MFEMFESpace>("MFEMFESpace", *sn).getFESpace();

if (isParamSetByUser("smooth_flux_fespace"))
{
// fetch the smooth_flux_fespace from the object system
auto object_ptr = getMFEMProblem()
.getMFEMObject<MFEMFESpace>(
"MFEMFESpace", getParam<MFEMFESpaceName>("smooth_flux_fespace"))
.getSharedPtr();
auto fespace_ptr = std::dynamic_pointer_cast<const MFEMFESpace>(object_ptr);
_smooth_flux_fes = fespace_ptr->getFESpace();
}
// fetch the smooth_flux_fespace from the object system
if (auto * sn = queryParam<MFEMFESpaceName>("smooth_flux_fespace"))
_smooth_flux_fes = getMFEMProblem().getMFEMObject<MFEMFESpace>("MFEMFESpace", *sn).getFESpace();
}

void
Expand Down
1 change: 0 additions & 1 deletion framework/src/mfem/postprocessors/MFEMPostprocessor.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ MFEMPostprocessor::validParams()
{
InputParameters params = MFEMExecutedObject::validParams();
params += Postprocessor::validParams();
params.registerSystemAttributeName("MFEMExecutedObject");
return params;
}

Expand Down
44 changes: 13 additions & 31 deletions framework/src/mfem/problem/MFEMProblem.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@
#ifdef MOOSE_MFEM_ENABLED

#include "MFEMProblem.h"
#include "MFEMInitialCondition.h"
#include "MFEMVariable.h"
#include "MFEMIndicator.h"
#include "MFEMSubMesh.h"
#include "MFEMFunctorMaterial.h"
#include "MFEMSubMeshTransfer.h"
#include "MFEMExecutedObject.h"
#include "Postprocessor.h"
#include "VectorPostprocessor.h"
#include "MFEMVectorUtils.h"
#include "libmesh/string_to_enum.h"

Expand Down Expand Up @@ -56,7 +52,7 @@ MFEMProblem::MFEMProblem(const InputParameters & params)
void
MFEMProblem::initialSetup()
{
FEProblemBase::initialSetup();
ExternalProblem::initialSetup();

// MFEM indicators create their estimators during addIndicator(); markers still need an explicit
// setup pass because they are no longer initialized through the libMesh/MOOSE user-object path.
Expand All @@ -72,7 +68,7 @@ MFEMProblem::execute(const ExecFlagType & exec_type)
setCurrentExecuteOnFlag(exec_type);
executeMFEMObjects(exec_type);

FEProblemBase::execute(exec_type);
ExternalProblem::execute(exec_type);
}

void
Expand Down Expand Up @@ -260,7 +256,7 @@ MFEMProblem::addGridFunction(const std::string & var_type,
else
{
// Add MOOSE variable.
FEProblemBase::addVariable(var_type, var_name, parameters);
ExternalProblem::addVariable(var_type, var_name, parameters);

// Add MFEM variable indirectly ("gridfunction").
InputParameters mfem_variable_params = addMFEMFESpaceFromMOOSEVariable(parameters);
Expand Down Expand Up @@ -407,29 +403,15 @@ MFEMProblem::addImagComponentToBC(const std::string & kernel_name,
int
vectorFunctionDim(const std::string & type, const InputParameters & parameters)
{
if (type == "LevelSetOlssonVortex")
{
return 2;
}
else if (type == "ParsedVectorFunction")
{
if (parameters.isParamSetByUser("expression_z") || parameters.isParamSetByUser("value_z"))
{
return 3;
}
else if (parameters.isParamSetByUser("expression_y") || parameters.isParamSetByUser("value_y"))
{
return 2;
}
else
{
return 1;
}
}
else
{
if (parameters.isParamSetByUser("expression_z") || parameters.isParamSetByUser("value_z"))
return 3;
}
if (parameters.isParamSetByUser("expression_y") || parameters.isParamSetByUser("value_y") ||
type == "LevelSetOlssonVortex")
return 2;
if (parameters.isParamSetByUser("expression_x") || parameters.isParamSetByUser("value_x"))
return 1;

return 3;
}

const std::vector<std::string> SCALAR_FUNCS = {"Axisymmetric2D3DSolutionFunction",
Expand Down Expand Up @@ -539,7 +521,7 @@ MFEMProblem::addVectorPostprocessor(const std::string & type,
addObject<MFEMExecutedObject>(type, name, parameters);
}
else
FEProblemBase::addVectorPostprocessor(type, name, parameters);
ExternalProblem::addVectorPostprocessor(type, name, parameters);
}

InputParameters
Expand Down Expand Up @@ -688,7 +670,7 @@ MFEMProblem::addTransfer(const std::string & transfer_name,
if (parameters.getBase() == "MFEMSubMeshTransfer")
addObject<MFEMExecutedObject>(transfer_name, name, parameters);
else
FEProblemBase::addTransfer(transfer_name, name, parameters);
ExternalProblem::addTransfer(transfer_name, name, parameters);
}

void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ MFEMVectorPostprocessor::validParams()
{
InputParameters params = MFEMExecutedObject::validParams();
params += VectorPostprocessor::validParams();
params.registerSystemAttributeName("MFEMExecutedObject");
return params;
}

Expand Down
Binary file removed test/tests/mfem/mesh/cube.e
Binary file not shown.
1 change: 1 addition & 0 deletions test/tests/mfem/mesh/cube.e
Binary file added test/tests/mfem/mesh/cube_hex27.e
Binary file not shown.
Binary file removed test/tests/mfem/mesh/square.e
Binary file not shown.
1 change: 1 addition & 0 deletions test/tests/mfem/mesh/square.e
Binary file added test/tests/mfem/mesh/square_quad4.e
Binary file not shown.
24 changes: 12 additions & 12 deletions test/tests/mfem/transfers/h1_libmesh_parent_mfem_sub/tests
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
capabilities = 'mfem'
recover = false
compute_devices = 'cpu cuda'
cli_args = 'Mesh/file=../../mesh/square_tri.e '
'mfem_app0:Mesh/file=../../mesh/square_tri.e '
cli_args = 'Mesh/file=../../mesh/square_tri6.e '
'mfem_app0:Mesh/file=../../mesh/square_tri6.e '
'Outputs/file_base=libmesh_parent_scalar_mfem_sub_tris '
[]
[H1TriSecondOrder]
Expand All @@ -49,11 +49,11 @@
capabilities = 'mfem'
recover = false
compute_devices = 'cpu cuda'
cli_args = 'Mesh/file=../../mesh/square_tri.e '
cli_args = 'Mesh/file=../../mesh/square_tri6.e '
'Outputs/file_base=libmesh_parent_scalar_mfem_sub_tris_order_2 '
'Variables/libmesh_scalar_var/order=SECOND '
'AuxVariables/mfem_scalar_var/order=SECOND '
'mfem_app0:Mesh/file=../../mesh/square_tri.e '
'mfem_app0:Mesh/file=../../mesh/square_tri6.e '
'mfem_app0:FESpaces/H1FESpace/fec_order=SECOND '
[]
[H1TriToQuad]
Expand All @@ -66,7 +66,7 @@
recover = false
compute_devices = 'cpu cuda'
cli_args = 'Mesh/file=../../mesh/square_quad9.e '
'mfem_app0:Mesh/file=../../mesh/square_tri.e '
'mfem_app0:Mesh/file=../../mesh/square_tri6.e '
'Outputs/file_base=libmesh_parent_scalar_mfem_sub_tri_to_quad '
[]
[H1TriToQuadSecondOrder]
Expand All @@ -82,7 +82,7 @@
'Outputs/file_base=libmesh_parent_scalar_mfem_sub_tri_to_quad_order_2 '
'Variables/libmesh_scalar_var/order=SECOND '
'AuxVariables/mfem_scalar_var/order=SECOND '
'mfem_app0:Mesh/file=../../mesh/square_tri.e '
'mfem_app0:Mesh/file=../../mesh/square_tri6.e '
'mfem_app0:FESpaces/H1FESpace/fec_order=SECOND '
[]
[H1Hex]
Expand Down Expand Up @@ -125,10 +125,10 @@
capabilities = 'mfem'
recover = false
compute_devices = 'cpu cuda'
cli_args = 'Mesh/file=../../mesh/cube_tetmesh.e '
cli_args = 'Mesh/file=../../mesh/cube_tet10.e '
'BCs/sides/boundary=Sides '
'Outputs/file_base=libmesh_parent_scalar_mfem_sub_tets '
'mfem_app0:Mesh/file=../../mesh/cube_tetmesh.e '
'mfem_app0:Mesh/file=../../mesh/cube_tet10.e '
[]
[H1TetSecondOrder]
type = CSVDiff
Expand All @@ -139,12 +139,12 @@
capabilities = 'mfem'
recover = false
compute_devices = 'cpu cuda'
cli_args = 'Mesh/file=../../mesh/cube_tetmesh.e '
cli_args = 'Mesh/file=../../mesh/cube_tet10.e '
'BCs/sides/boundary=Sides '
'Variables/libmesh_scalar_var/order=SECOND '
'AuxVariables/mfem_scalar_var/order=SECOND '
'Outputs/file_base=libmesh_parent_scalar_mfem_sub_tets_order_2 '
'mfem_app0:Mesh/file=../../mesh/cube_tetmesh.e '
'mfem_app0:Mesh/file=../../mesh/cube_tet10.e '
'mfem_app0:FESpaces/H1FESpace/fec_order=SECOND '
[]
[H1TetToHex]
Expand All @@ -159,7 +159,7 @@
cli_args = 'Mesh/file=../../mesh/cube.e '
'BCs/sides/boundary=Sides '
'Outputs/file_base=libmesh_parent_scalar_mfem_sub_tet_to_hex '
'mfem_app0:Mesh/file=../../mesh/cube_tetmesh.e '
'mfem_app0:Mesh/file=../../mesh/cube_tet10.e '
[]
[H1TetToHexSecondOrder]
type = CSVDiff
Expand All @@ -175,7 +175,7 @@
'Variables/libmesh_scalar_var/order=SECOND '
'AuxVariables/mfem_scalar_var/order=SECOND '
'Outputs/file_base=libmesh_parent_scalar_mfem_sub_tet_to_hex_order_2 '
'mfem_app0:Mesh/file=../../mesh/cube_tetmesh.e '
'mfem_app0:Mesh/file=../../mesh/cube_tet10.e '
'mfem_app0:FESpaces/H1FESpace/fec_order=SECOND '
[]
[]
Expand Down
Loading