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 "MFEMInnerProductAux.h" 13 : #include "MFEMProblem.h" 14 : 15 : registerMooseObject("MooseApp", MFEMInnerProductAux); 16 : 17 : InputParameters 18 2110 : MFEMInnerProductAux::validParams() 19 : { 20 2110 : InputParameters params = MFEMAuxKernel::validParams(); 21 4220 : params.addClassDescription("Projects $s \\vec u \\cdot \\vec v$ onto a scalar MFEM auxvariable"); 22 8440 : params.addRequiredParam<MFEMVectorCoefficientName>("first_source_vec", "Vector coefficient"); 23 8440 : params.addRequiredParam<MFEMVectorCoefficientName>("second_source_vec", "Vector coefficient"); 24 6330 : params.addParam<MFEMScalarCoefficientName>( 25 : "coefficient", "1.", "Name of scalar coefficient s to scale the inner product by"); 26 2110 : return params; 27 0 : } 28 : 29 6 : MFEMInnerProductAux::MFEMInnerProductAux(const InputParameters & parameters) 30 : : MFEMAuxKernel(parameters), 31 18 : _inner(getVectorCoefficient("first_source_vec"), getVectorCoefficient("second_source_vec")), 32 18 : _scaled_inner(getScalarCoefficient("coefficient"), _inner) 33 : { 34 : // The target variable's finite element space 35 6 : mfem::ParFiniteElementSpace * fes = _result_var.ParFESpace(); 36 : 37 : // Must be scalar L2 38 6 : if (!dynamic_cast<const mfem::L2_FECollection *>(fes->FEColl()) || fes->GetVDim() != 1) 39 0 : mooseError("MFEMInnerProductAux requires the target variable to be scalar L2."); 40 : 41 : // Must have no shared/constrained DOFs (pure interior DOFs) 42 6 : if (fes->GetTrueVSize() != fes->GetVSize()) 43 0 : mooseError("MFEMInnerProductAux currently supports only L2 spaces with interior DOFs " 44 : "(no shared/constrained DOFs)."); 45 6 : } 46 : 47 : void 48 6 : MFEMInnerProductAux::execute() 49 : { 50 6 : _result_var.ProjectCoefficient(_scaled_inner); 51 6 : } 52 : 53 : #endif // MOOSE_MFEM_ENABLED