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