- blockThe list of subdomains (names or ids) that this object will be restricted to. Leave empty to apply to all subdomains.
C++ Type:std::vector<SubdomainName>
Controllable:No
Description:The list of subdomains (names or ids) that this object will be restricted to. Leave empty to apply to all subdomains.
- coefficient1.Name of property for the mass coefficient k. A functor is any of the following: a variable, an MFEM material property, a function, a postprocessor or a number.
Default:1.
C++ Type:MFEMScalarCoefficientName
Controllable:No
Description:Name of property for the mass coefficient k. A functor is any of the following: a variable, an MFEM material property, a function, a postprocessor or a number.
- variableVariable labelling the weak form this kernel is added to
C++ Type:VariableName
Unit:(no unit assumed)
Controllable:No
Description:Variable labelling the weak form this kernel is added to
MFEMMassKernel
Overview
Adds the domain integrator for integrating the bilinear form
where and is a scalar mass coefficient.
This term arises from the weak form of the mass operator
Input Parameters
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
- enableTrueSet the enabled status of the MooseObject.
Default:True
C++ Type:bool
Controllable:No
Description:Set the enabled status of the MooseObject.
Advanced Parameters
Input Files
- (test/tests/mfem/periodic/periodic.i)
- (test/tests/mfem/complex/complex.i)
- (test/tests/mfem/functions/cylindrical_coefficients.i)
- (test/tests/mfem/periodic/periodic_complex.i)
- (test/tests/mfem/auxkernels/axisymmetric_magnetostatic.i)
- (test/tests/mfem/submeshes/boundary_submesh.i)
- (test/tests/mfem/periodic/periodic_eigenproblem.i)
Child Objects
(test/tests/mfem/periodic/periodic.i)
# Screened Poisson problem -div(grad u) + u = f on a periodic square with no boundary elements,
# with exact solution u = sin(pi x) sin(pi y).
[Mesh]
type = MFEMFileMesh
file = ../mesh/periodic-square.mesh
serial_refine = 2
[]
[Problem]
type = MFEMProblem
[]
[FESpaces]
[H1FESpace]
type = MFEMScalarFESpace
fec_type = H1
fec_order = SECOND
[]
[]
[Variables]
[u]
type = MFEMVariable
fespace = H1FESpace
[]
[]
[Functions]
[source]
type = ParsedFunction
expression = '(1 + 2 * pi^2) * sin(pi * x) * sin(pi * y)'
[]
[exact]
type = ParsedFunction
expression = 'sin(pi * x) * sin(pi * y)'
[]
[]
[Kernels]
[diffusion]
type = MFEMDiffusionKernel
variable = u
[]
[mass]
type = MFEMMassKernel
variable = u
[]
[source]
type = MFEMDomainLFKernel
variable = u
coefficient = source
[]
[]
[Solvers]
[boomeramg]
type = MFEMHypreBoomerAMG
print_level = 0
[]
[cg]
type = MFEMHyprePCG
preconditioner = boomeramg
l_tol = 1e-12
print_level = 0
[]
[]
[Executioner]
type = MFEMSteady
device = cpu
[]
[Postprocessors]
[l2_error]
type = MFEML2Error
variable = u
function = exact
[]
[]
[Outputs]
[CSV]
type = CSV
file_base = OutputData/Periodic
[]
[]
(test/tests/mfem/complex/complex.i)
mu = 1.0
epsilon = 1.0
sigma = 20.0
omega = 10.0
kappa_i = '${fparse -sqrt(mu*omega*sqrt(epsilon^2*omega^2+sigma^2)-epsilon*mu*omega^2)/sqrt(2)}'
kappa_r = '${fparse -mu*omega*sigma/kappa_i/2}'
[Mesh]
type = MFEMFileMesh
file = ../mesh/inline-quad.mesh
[]
[Problem]
type = MFEMProblem
numeric_type = complex
[]
[FESpaces]
[H1FESpace]
type = MFEMScalarFESpace
fec_type = H1
fec_order = FIRST
[]
[]
[Variables]
[u]
type = MFEMComplexVariable
fespace = H1FESpace
[]
[]
[Functions]
[u0_r]
type = ParsedFunction
expression = exp(y*${kappa_i})*cos(y*${kappa_r})
[]
[u0_i]
type = ParsedFunction
expression = -exp(y*${kappa_i})*sin(y*${kappa_r})
[]
[stiffnessCoef]
type = ParsedFunction
expression = 1.0/${mu}
[]
[massCoef]
type = ParsedFunction
expression = -${omega}*${omega}*${epsilon}
[]
[lossCoef]
type = ParsedFunction
expression = ${omega}*${sigma}
[]
[]
[BCs]
[dbc]
type = MFEMComplexScalarDirichletBC
variable = u
coefficient_real = u0_r
coefficient_imag = u0_i
[]
[]
[Kernels]
[diffusion_complex]
type = MFEMComplexKernel
variable = u
[RealComponent]
type = MFEMDiffusionKernel
coefficient = stiffnessCoef
[]
[ImagComponent]
type = MFEMDiffusionKernel
coefficient = 0.0
[]
[]
[mass_complex]
type = MFEMComplexKernel
variable = u
[RealComponent]
type = MFEMMassKernel
coefficient = massCoef
[]
[ImagComponent]
type = MFEMMassKernel
coefficient = lossCoef
[]
[]
[]
[Solvers]
[main]
type = MFEMSuperLU
[]
[]
[Executioner]
type = MFEMSteady
assembly_level = legacy
[]
[VectorPostprocessors]
[line_sample]
type = MFEMComplexVariableLineValueSampler
variables = 'u'
start_point = '0 0 0'
end_point = '1 1 0'
num_points = 101
[]
[]
[Outputs]
[CSV]
type = CSV
file_base = OutputData/complex_2d_quad
[]
[]
(test/tests/mfem/functions/cylindrical_coefficients.i)
[Mesh]
type = MFEMFileMesh
file = ../mesh/star.mesh
[]
[Problem]
type = MFEMProblem
[]
[FESpaces]
[H1FESpace]
type = MFEMScalarFESpace
fec_type = H1
fec_order = FIRST
[]
[]
[Variables]
[u]
type = MFEMVariable
fespace = H1FESpace
[]
[]
[Functions]
[cylindrical]
type = MFEMCoordinateTransformations
coord_type = RZ
inv_r_eps = 0
[]
[]
[FunctorMaterials]
[material]
type = MFEMGenericFunctorMaterial
prop_names = 'diffCoef massCoef'
prop_values = 'cylindrical_r cylindrical_inv_r'
[]
[]
[BCs]
[Dirichlet]
type = MFEMScalarDirichletBC
variable = u
coefficient = 10
[]
[]
[Kernels]
[diffusion]
type = MFEMDiffusionKernel
variable = u
coefficient = diffCoef
[]
[mass]
type = MFEMMassKernel
variable = u
coefficient = massCoef
[]
[]
[Solvers]
[main]
type = MFEMMUMPS
[]
[]
[Executioner]
type = MFEMSteady
device = cpu
[]
[VectorPostprocessors]
[LineSampler]
type = MFEMVariableLineValueSampler
variables = 'u'
start_point = '-1 0 0'
end_point = '1 0 0'
num_points = 10
[]
[]
[Outputs]
csv = true
file_base = OutputData/CylindricalCoefficients
[]
(test/tests/mfem/periodic/periodic_complex.i)
# Complex screened Poisson problem -div(grad u) + (1 + i) u = f on a periodic square with no
# boundary elements, with exact solution u = sin(pi x) sin(pi y).
[Mesh]
type = MFEMFileMesh
file = ../mesh/periodic-square.mesh
serial_refine = 2
[]
[Problem]
type = MFEMProblem
numeric_type = complex
[]
[FESpaces]
[H1FESpace]
type = MFEMScalarFESpace
fec_type = H1
fec_order = SECOND
[]
[]
[Variables]
[u]
type = MFEMComplexVariable
fespace = H1FESpace
[]
[]
[Functions]
[source_real]
type = ParsedFunction
expression = '(1 + 2 * pi^2) * sin(pi * x) * sin(pi * y)'
[]
[source_imag]
type = ParsedFunction
expression = 'sin(pi * x) * sin(pi * y)'
[]
[exact]
type = ParsedFunction
expression = 'sin(pi * x) * sin(pi * y)'
[]
[]
[Kernels]
[diffusion]
type = MFEMComplexKernel
variable = u
[RealComponent]
type = MFEMDiffusionKernel
[]
[]
[mass]
type = MFEMComplexKernel
variable = u
[RealComponent]
type = MFEMMassKernel
[]
[ImagComponent]
type = MFEMMassKernel
[]
[]
[source]
type = MFEMComplexKernel
variable = u
[RealComponent]
type = MFEMDomainLFKernel
coefficient = source_real
[]
[ImagComponent]
type = MFEMDomainLFKernel
coefficient = source_imag
[]
[]
[]
[Solvers]
[main]
type = MFEMSuperLU
[]
[]
[Executioner]
type = MFEMSteady
device = cpu
[]
[Postprocessors]
[l2_error]
type = MFEMComplexL2Error
variable = u
function_real = exact
function_imag = 0
[]
[]
[Outputs]
[CSV]
type = CSV
file_base = OutputData/PeriodicComplex
[]
[]
(test/tests/mfem/auxkernels/axisymmetric_magnetostatic.i)
[Mesh]
type = MFEMFileMesh
file = ../mesh/hinomaru_offset.e
[]
[Problem]
type = MFEMProblem
[]
[FESpaces]
[H1FESpace]
type = MFEMScalarFESpace
fec_type = H1
fec_order = FIRST
[]
[RTFESpace]
type = MFEMVectorFESpace
fec_type = RT
fec_order = CONSTANT
[]
[L2FESpace]
type = MFEMScalarFESpace
fec_type = L2
fec_order = CONSTANT
basis = GaussLegendre
[]
[]
[Variables]
[Atheta]
type = MFEMVariable
fespace = H1FESpace
[]
[]
[Functions]
# Meridional radius r = x
[r]
type = MFEMParsedFunction
expression = 'x'
[]
[inv_r]
type = MFEMParsedFunction
expression = '1.0/x'
[]
# Weighted source coefficient r * J_theta = x * 8
[Jtheta_r_wire]
type = MFEMParsedFunction
expression = '8.0*x'
[]
[]
[FunctorMaterials]
[cyl_coeffs]
type = MFEMGenericFunctorMaterial
prop_names = 'diffCoef massCoef'
prop_values = 'r inv_r'
[]
[J_wire]
type = MFEMGenericFunctorMaterial
prop_names = 'Jtheta sourceCoef'
prop_values = '8.0 Jtheta_r_wire'
block = wire
[]
[]
[AuxVariables]
[B]
type = MFEMVariable
fespace = RTFESpace
[]
[J]
type = MFEMVariable
fespace = L2FESpace
[]
[]
[Kernels]
[diffusion]
type = MFEMDiffusionKernel
variable = Atheta
coefficient = diffCoef
[]
[mass]
type = MFEMMassKernel
variable = Atheta
coefficient = massCoef
[]
[source_wire]
type = MFEMDomainLFKernel
variable = Atheta
coefficient = sourceCoef
[]
[]
[AuxKernels]
[B_from_Atheta]
type = MFEMMeridionalCurlAux
variable = B
source = Atheta
[]
[J]
type = MFEMScalarProjectionAux
variable = J
coefficient = Jtheta
[]
[]
[BCs]
[essential]
type = MFEMScalarDirichletBC
variable = Atheta
boundary = skin
[]
[]
[Solvers]
[BoomerAMG]
type = MFEMHypreBoomerAMG
[]
[PCG]
type = MFEMHyprePCG
l_tol = 1e-8
preconditioner = BoomerAMG
[]
[]
[Postprocessors]
[norm] # should be sqrt(8*pi)
type = MFEMVectorL2Error
variable = B
function = '0. 0.'
[]
[]
[Executioner]
type = MFEMSteady
[]
[Outputs]
[ReportedPostprocessors]
type = CSV
file_base = AxisymmetricMagnetostatic
[]
[]
(test/tests/mfem/submeshes/boundary_submesh.i)
[Mesh]
type = MFEMFileMesh
file = ../mesh/cylinder-hex-q2.gen
uniform_refine = 1
[]
[Problem]
type = MFEMProblem
[]
[SubMeshes]
[exterior]
type = MFEMBoundarySubMesh
boundary = curved_surface
[]
[]
[FESpaces]
[SubMeshH1FESpace]
type = MFEMGenericFESpace
fec_name = H1_2D_P1
submesh = exterior
[]
[]
[Variables]
[submesh_potential]
type = MFEMVariable
fespace = SubMeshH1FESpace
[]
[]
[Kernels]
[mass]
type = MFEMMassKernel
variable = submesh_potential
[]
[source]
type = MFEMDomainLFKernel
variable = submesh_potential
coefficient = 3.0
[]
[]
[Solvers]
[boomeramg]
type = MFEMHypreBoomerAMG
[]
[main]
type = MFEMHypreGMRES
preconditioner = boomeramg
l_tol = 1e-8
l_max_its = 1000
[]
[]
[Executioner]
type = MFEMSteady
device = cpu
[]
[Outputs]
[ParaViewDataCollection]
type = MFEMParaViewDataCollection
file_base = OutputData/BoundaryPotential
vtk_format = ASCII
submesh = exterior
[]
[]
(test/tests/mfem/periodic/periodic_eigenproblem.i)
# Eigenproblem -div(grad u) + u = lambda u on a periodic square with no boundary elements, whose
# exact eigenvalues are 1 + pi^2 (k^2 + l^2) for integers k and l.
[Mesh]
type = MFEMFileMesh
file = ../mesh/periodic-square.mesh
serial_refine = 2
parallel_refine = 1
[]
[Problem]
type = MFEMEigenproblem
num_modes = 5
[]
[FESpaces]
[H1FESpace]
type = MFEMScalarFESpace
fec_type = H1
fec_order = FIRST
[]
[]
[Variables]
[u]
type = MFEMVariable
fespace = H1FESpace
[]
[]
[Kernels]
[diffusion]
type = MFEMDiffusionKernel
variable = u
[]
[mass]
type = MFEMMassKernel
variable = u
[]
[]
[Solvers]
[boomeramg]
type = MFEMHypreBoomerAMG
print_level = 0
[]
[LOBPCG]
type = MFEMHypreLOBPCG
preconditioner = boomeramg
print_level = 0
l_tol = 1e-8
l_max_its = 200
random_seed = 75
[]
[]
[Executioner]
type = MFEMSteady
device = cpu
[]
[VectorPostprocessors]
[eigenvalues]
type = MFEMEigenvaluesPostprocessor
[]
[]
[Outputs]
[CSV]
type = CSV
file_base = OutputData/PeriodicEigenproblem
[]
[]
(framework/include/mfem/kernels/MFEMTimeDerivativeMassKernel.h)
// This file is part of the MOOSE framework
// https://mooseframework.inl.gov
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
#ifdef MOOSE_MFEM_ENABLED
#pragma once
#include "MFEMMassKernel.h"
/**
* \f[
* (k du/dt, v)
* \f]
*/
class MFEMTimeDerivativeMassKernel : public MFEMMassKernel
{
public:
static InputParameters validParams();
MFEMTimeDerivativeMassKernel(const InputParameters & parameters);
/// Get name of the trial variable (gridfunction) the kernel acts on.
/// Defaults to the name of the test variable labelling the weak form.
virtual const VariableName & getTrialVariableName() const override { return _var_dot_name; }
protected:
/// Name of variable (gridfunction) representing time derivative of variable.
const VariableName _var_dot_name;
};
#endif