LCOV - code coverage report
Current view: top level - src/kernels - DistributedPower.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 0 31 0.0 %
Date: 2025-08-14 10:14:56 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://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 "DistributedPower.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", DistributedPower);
      13             : 
      14             : InputParameters
      15           0 : DistributedPower::validParams()
      16             : {
      17           0 :   InputParameters params = Kernel::validParams();
      18             : 
      19             :   // The acceleration vector.
      20           0 :   params.addParam<RealVectorValue>(
      21             :       "acceleration",
      22           0 :       RealVectorValue(0, 0, 0),
      23             :       "The acceleration components for an applied distributed force in an element.");
      24             : 
      25             :   // Momentum components.
      26           0 :   params.addRequiredCoupledVar("rho_u", "x-component of the momentum vector");
      27           0 :   params.addCoupledVar("rho_v", "y-component of the momentum vector");
      28           0 :   params.addCoupledVar("rho_w", "z-component of the momentum vector");
      29             : 
      30           0 :   params.addClassDescription(
      31             :       "Implements the power term of a specified force in the Navier Stokes energy equation.");
      32             : 
      33           0 :   return params;
      34           0 : }
      35             : 
      36           0 : DistributedPower::DistributedPower(const InputParameters & parameters)
      37             :   : Kernel(parameters),
      38             :     // acceleration vector
      39           0 :     _acceleration(getParam<RealVectorValue>("acceleration")),
      40             : 
      41             :     // momentum components
      42           0 :     _rhou_var_number(coupled("rho_u")),
      43           0 :     _rhov_var_number(isCoupled("rho_v") ? coupled("rho_v") : libMesh::invalid_uint),
      44           0 :     _rhow_var_number(isCoupled("rho_w") ? coupled("rho_w") : libMesh::invalid_uint),
      45           0 :     _rho_u(coupledValue("rho_u")),
      46           0 :     _rho_v(isCoupled("rho_v") ? coupledValue("rho_v") : _zero),
      47           0 :     _rho_w(isCoupled("rho_w") ? coupledValue("rho_w") : _zero)
      48             : {
      49           0 : }
      50             : 
      51             : Real
      52           0 : DistributedPower::computeQpResidual()
      53             : {
      54           0 :   RealVectorValue rhou_vec(_rho_u[_qp], _rho_v[_qp], _rho_w[_qp]);
      55             :   // -rhou dot acceleration
      56           0 :   return -rhou_vec * _acceleration * _test[_i][_qp];
      57             : }
      58             : 
      59             : Real
      60           0 : DistributedPower::computeQpJacobian()
      61             : {
      62           0 :   return 0.;
      63             : }
      64             : 
      65             : Real
      66           0 : DistributedPower::computeQpOffDiagJacobian(unsigned int jvar)
      67             : {
      68           0 :   if (jvar == _rhou_var_number)
      69           0 :     return -_phi[_j][_qp] * _acceleration(0) * _test[_i][_qp];
      70           0 :   if (jvar == _rhov_var_number)
      71           0 :     return -_phi[_j][_qp] * _acceleration(1) * _test[_i][_qp];
      72           0 :   if (jvar == _rhow_var_number)
      73           0 :     return -_phi[_j][_qp] * _acceleration(2) * _test[_i][_qp];
      74             : 
      75             :   return 0;
      76             : }

Generated by: LCOV version 1.14