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 "MFEMVectorFEInnerProductIntegralPostprocessor.h" 13 : #include "MFEMProblem.h" 14 : 15 : registerMooseObject("MooseApp", MFEMVectorFEInnerProductIntegralPostprocessor); 16 : 17 : InputParameters 18 2222 : MFEMVectorFEInnerProductIntegralPostprocessor::validParams() 19 : { 20 2222 : InputParameters params = MFEMPostprocessor::validParams(); 21 2222 : params += MFEMBlockRestrictable::validParams(); 22 4444 : params.addClassDescription( 23 : "Calculates the integral of the inner product of two vector variables within a subdomain."); 24 8888 : params.addParam<MFEMScalarCoefficientName>( 25 : "coefficient", "1.", "Name of optional scalar coefficient to scale integrand by."); 26 8888 : MFEMExecutedObject::addRequiredDependencyParam<VariableName>( 27 : params, "primal_variable", "Name of the first vector variable in the inner product."); 28 6666 : MFEMExecutedObject::addRequiredDependencyParam<VariableName>( 29 : params, "dual_variable", "Name of the second vector variable in the inner product."); 30 2222 : return params; 31 0 : } 32 : 33 62 : MFEMVectorFEInnerProductIntegralPostprocessor::MFEMVectorFEInnerProductIntegralPostprocessor( 34 62 : const InputParameters & parameters) 35 : : MFEMPostprocessor(parameters), 36 : MFEMBlockRestrictable( 37 : parameters, 38 186 : getMFEMProblem().getMFEMVariableMesh(getParam<VariableName>("primal_variable"))), 39 124 : _primal_var(*getMFEMProblem().getGridFunction(getParam<VariableName>("primal_variable"))), 40 186 : _scaled_dual_var_coef(getScalarCoefficient("coefficient"), 41 186 : getVectorCoefficientByName(getParam<VariableName>("dual_variable"))), 42 248 : _subdomain_integrator(_primal_var.ParFESpace()) 43 : { 44 62 : if (isSubdomainRestricted()) 45 124 : _subdomain_integrator.AddDomainIntegrator( 46 62 : new mfem::VectorFEDomainLFIntegrator(_scaled_dual_var_coef), getSubdomainMarkers()); 47 : else 48 0 : _subdomain_integrator.AddDomainIntegrator( 49 0 : new mfem::VectorFEDomainLFIntegrator(_scaled_dual_var_coef)); 50 62 : } 51 : 52 : void 53 116 : MFEMVectorFEInnerProductIntegralPostprocessor::execute() 54 : { 55 116 : _subdomain_integrator.Assemble(); 56 116 : _integral = _subdomain_integrator(_primal_var); 57 116 : } 58 : 59 : PostprocessorValue 60 116 : MFEMVectorFEInnerProductIntegralPostprocessor::getValue() const 61 : { 62 116 : return _integral; 63 : } 64 : 65 : #endif