LCOV - code coverage report
Current view: top level - src/auxkernels - NewmarkVelAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 16 18 88.9 %
Date: 2025-07-25 05:00:39 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          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 "NewmarkVelAux.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", NewmarkVelAux);
      13             : 
      14             : InputParameters
      15        1928 : NewmarkVelAux::validParams()
      16             : {
      17        1928 :   InputParameters params = AuxKernel::validParams();
      18        1928 :   params.addClassDescription("Calculates the current velocity using Newmark method.");
      19        3856 :   params.addRequiredCoupledVar("acceleration", "acceleration variable");
      20        3856 :   params.addRequiredParam<Real>("gamma", "gamma parameter for Newmark method");
      21        1928 :   return params;
      22           0 : }
      23             : 
      24        1014 : NewmarkVelAux::NewmarkVelAux(const InputParameters & parameters)
      25             :   : AuxKernel(parameters),
      26        1014 :     _accel_old(coupledValueOld("acceleration")),
      27        1014 :     _accel(coupledValue("acceleration")),
      28        1014 :     _u_old(uOld()),
      29        3042 :     _gamma(getParam<Real>("gamma"))
      30             : {
      31        1014 : }
      32             : 
      33             : Real
      34      627992 : NewmarkVelAux::computeValue()
      35             : {
      36      627992 :   Real vel_old = _u_old[_qp];
      37      627992 :   if (!isNodal())
      38           0 :     mooseError("must run on a nodal variable");
      39             :   // Calculates Velocity using Newmark time integration scheme
      40      627992 :   return vel_old + (_dt * (1 - _gamma)) * _accel_old[_qp] + _gamma * _dt * _accel[_qp];
      41             : }

Generated by: LCOV version 1.14