LCOV - code coverage report
Current view: top level - src/bcs - DashpotBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 0 31 0.0 %
Date: 2024-02-27 11:53:14 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "DashpotBC.h"
      11             : 
      12             : registerMooseObject("TensorMechanicsApp", DashpotBC);
      13             : 
      14             : InputParameters
      15           0 : DashpotBC::validParams()
      16             : {
      17           0 :   InputParameters params = IntegratedBC::validParams();
      18           0 :   params.addRequiredParam<unsigned int>(
      19             :       "component", "The displacement component corresponding the variable this BC acts on.");
      20           0 :   params.addRequiredCoupledVar("disp_x", "Displacement in the x direction");
      21           0 :   params.addCoupledVar("disp_y", "Displacement in the y direction");
      22           0 :   params.addCoupledVar("disp_z", "Displacement in the z direction");
      23             : 
      24           0 :   params.addParam<Real>("coefficient", 1.0, "The viscosity coefficient");
      25             : 
      26           0 :   return params;
      27           0 : }
      28             : 
      29           0 : DashpotBC::DashpotBC(const InputParameters & parameters)
      30             :   : IntegratedBC(parameters),
      31           0 :     _component(getParam<unsigned int>("component")),
      32           0 :     _coefficient(getParam<Real>("coefficient")),
      33           0 :     _disp_x_var(coupled("disp_x")),
      34           0 :     _disp_y_var(isCoupled("disp_y") ? coupled("disp_y") : 0),
      35           0 :     _disp_z_var(isCoupled("disp_z") ? coupled("disp_z") : 0),
      36             : 
      37           0 :     _disp_x_dot(coupledDot("disp_x")),
      38           0 :     _disp_y_dot(isCoupled("disp_y") ? coupledDot("disp_y") : _zero),
      39           0 :     _disp_z_dot(isCoupled("disp_z") ? coupledDot("disp_z") : _zero)
      40             : {
      41           0 : }
      42             : 
      43             : Real
      44           0 : DashpotBC::computeQpResidual()
      45             : {
      46           0 :   RealVectorValue velocity(_disp_x_dot[_qp], _disp_y_dot[_qp], _disp_z_dot[_qp]);
      47             : 
      48           0 :   return _test[_i][_qp] * _coefficient * _normals[_qp] * velocity;
      49             : }
      50             : 
      51             : Real
      52           0 : DashpotBC::computeQpJacobian()
      53             : {
      54             :   RealVectorValue velocity;
      55           0 :   velocity(_component) = _phi[_j][_qp] / _dt;
      56             : 
      57           0 :   return _test[_i][_qp] * _coefficient * _normals[_qp] * velocity;
      58             : }
      59             : 
      60             : Real
      61           0 : DashpotBC::computeQpOffDiagJacobian(unsigned int jvar)
      62             : {
      63             :   RealVectorValue velocity;
      64             :   unsigned int component = 0;
      65             : 
      66           0 :   if (jvar == _disp_x_var)
      67             :     component = 0;
      68           0 :   else if (jvar == _disp_y_var)
      69             :     component = 1;
      70           0 :   else if (jvar == _disp_z_var)
      71             :     component = 2;
      72             : 
      73           0 :   velocity(component) = _phi[_j][_qp] / _dt;
      74             : 
      75           0 :   return -_test[_i][_qp] * _normals[_qp] * velocity;
      76             : }

Generated by: LCOV version 1.14