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 "ElementIntegralVariableUserObject.h" 11 : 12 : registerMooseObject("MooseApp", ElementIntegralVariableUserObject); 13 : 14 : InputParameters 15 136573 : ElementIntegralVariableUserObject::validParams() 16 : { 17 136573 : InputParameters params = ElementIntegralUserObject::validParams(); 18 136573 : params.addClassDescription("computes a volume integral of a variable."); 19 136573 : params.addRequiredCoupledVar("variable", "The name of the variable that this object operates on"); 20 136573 : return params; 21 0 : } 22 : 23 4150 : ElementIntegralVariableUserObject::ElementIntegralVariableUserObject( 24 4150 : const InputParameters & parameters) 25 : : ElementIntegralUserObject(parameters), 26 : MooseVariableInterface<Real>(this, 27 : false, 28 : "variable", 29 : Moose::VarKindType::VAR_ANY, 30 : Moose::VarFieldType::VAR_FIELD_STANDARD), 31 4150 : _u(coupledValue("variable")), 32 8300 : _grad_u(coupledGradient("variable")) 33 : { 34 4150 : addMooseVariableDependency(&mooseVariableField()); 35 4150 : } 36 : 37 : Real 38 3227564 : ElementIntegralVariableUserObject::computeQpIntegral() 39 : { 40 3227564 : return _u[_qp]; 41 : }