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 : #include "ElementHDivSemiError.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", ElementHDivSemiError); 14 : 15 : InputParameters 16 28830 : ElementHDivSemiError::validParams() 17 : { 18 28830 : InputParameters params = ElementVectorL2Error::validParams(); 19 28830 : params.addClassDescription("Returns the H(div)-seminorm of the difference between a pair of " 20 : "computed and analytical vector-valued solutions."); 21 28830 : params.addRequiredParam<FunctionName>("function", 22 : "The vector analytical solution to compare against"); 23 28830 : params.addRequiredCoupledVar("variable", "The vector FE solution"); 24 28830 : params.suppressParameter<FunctionName>("function_x"); 25 28830 : params.suppressParameter<FunctionName>("function_y"); 26 28830 : params.suppressParameter<FunctionName>("function_z"); 27 28830 : params.suppressParameter<std::vector<VariableName>>("var_x"); 28 28830 : params.suppressParameter<std::vector<VariableName>>("var_y"); 29 28830 : params.suppressParameter<std::vector<VariableName>>("var_z"); 30 28830 : return params; 31 0 : } 32 : 33 156 : ElementHDivSemiError::ElementHDivSemiError(const InputParameters & parameters) 34 156 : : ElementVectorL2Error(parameters), _u_var(*getVectorVar("variable", 0)), _div_u(_u_var.divSln()) 35 : { 36 156 : } 37 : 38 : Real 39 456192 : ElementHDivSemiError::computeQpIntegral() 40 : { 41 456192 : Real diff = _div_u[_qp] - _func.div(_t, _q_point[_qp]); 42 456192 : return diff * diff; 43 : }