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 59571 : TimeDerivative::validParams() 22 : { 23 59571 : InputParameters params = TimeKernel::validParams(); 24 59571 : params.addClassDescription("The time derivative operator with the weak form of $(\\psi_i, " 25 : "\\frac{\\partial u_h}{\\partial t})$."); 26 59571 : params.addParam<bool>("lumping", false, "True for mass matrix lumping, false otherwise"); 27 : 28 59571 : return params; 29 0 : } 30 : 31 16029 : TimeDerivative::TimeDerivative(const InputParameters & parameters) 32 16029 : : TimeKernel(parameters), _lumping(getParam<bool>("lumping")) 33 : { 34 16009 : } 35 : 36 : Real 37 4537727380 : TimeDerivative::computeQpResidual() 38 : { 39 4537727380 : return _test[_i][_qp] * _u_dot[_qp]; 40 : } 41 : 42 : Real 43 3737441022 : TimeDerivative::computeQpJacobian() 44 : { 45 3737441022 : return _test[_i][_qp] * _phi[_j][_qp] * _du_dot_du[_qp]; 46 : } 47 : 48 : void 49 39215803 : TimeDerivative::computeJacobian() 50 : { 51 39215803 : if (_lumping) 52 : { 53 44924 : prepareMatrixTag(_assembly, _var.number(), _var.number()); 54 : 55 44924 : precalculateJacobian(); 56 148220 : for (_i = 0; _i < _test.size(); _i++) 57 363680 : for (_j = 0; _j < _phi.size(); _j++) 58 996320 : for (_qp = 0; _qp < _qrule->n_points(); _qp++) 59 735936 : _local_ke(_i, _i) += _JxW[_qp] * _coord[_qp] * computeQpJacobian(); 60 : 61 44924 : accumulateTaggedLocalMatrix(); 62 : } 63 : else 64 39170879 : TimeKernel::computeJacobian(); 65 39215803 : }