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 "TimeDerivative.h" 11 : 12 : // MOOSE includes 13 : #include "Assembly.h" 14 : #include "MooseVariableFE.h" 15 : 16 : #include "libmesh/quadrature.h" 17 : 18 : registerMooseObject("MooseApp", TimeDerivative); 19 : 20 : InputParameters 21 57369 : TimeDerivative::validParams() 22 : { 23 57369 : InputParameters params = TimeKernel::validParams(); 24 57369 : params.addClassDescription("The time derivative operator with the weak form of $(\\psi_i, " 25 : "\\frac{\\partial u_h}{\\partial t})$."); 26 57369 : params.addParam<bool>("lumping", false, "True for mass matrix lumping, false otherwise"); 27 : 28 57369 : return params; 29 0 : } 30 : 31 14919 : TimeDerivative::TimeDerivative(const InputParameters & parameters) 32 14919 : : TimeKernel(parameters), _lumping(getParam<bool>("lumping")) 33 : { 34 14899 : } 35 : 36 : Real 37 4013877260 : TimeDerivative::computeQpResidual() 38 : { 39 4013877260 : return _test[_i][_qp] * _u_dot[_qp]; 40 : } 41 : 42 : Real 43 3294780772 : TimeDerivative::computeQpJacobian() 44 : { 45 3294780772 : return _test[_i][_qp] * _phi[_j][_qp] * _du_dot_du[_qp]; 46 : } 47 : 48 : void 49 35161715 : TimeDerivative::computeJacobian() 50 : { 51 35161715 : if (_lumping) 52 : { 53 39788 : prepareMatrixTag(_assembly, _var.number(), _var.number()); 54 : 55 39788 : precalculateJacobian(); 56 131340 : for (_i = 0; _i < _test.size(); _i++) 57 322560 : for (_j = 0; _j < _phi.size(); _j++) 58 884640 : for (_qp = 0; _qp < _qrule->n_points(); _qp++) 59 653632 : _local_ke(_i, _i) += _JxW[_qp] * _coord[_qp] * computeQpJacobian(); 60 : 61 39788 : accumulateTaggedLocalMatrix(); 62 : } 63 : else 64 35121927 : TimeKernel::computeJacobian(); 65 35161715 : }