LCOV - code coverage report
Current view: top level - src/kernels - DistributedForce.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 0 22 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 "DistributedForce.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", DistributedForce);
      13             : 
      14             : InputParameters
      15           0 : DistributedForce::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           0 :   params.addRequiredParam<unsigned int>("component", "acceleration vector components");
      25             : 
      26             :   // The body force acts on the mass of the volume
      27           0 :   params.addRequiredCoupledVar("rho", "density"); // Density integrated over a volume yields mass
      28           0 :   params.addClassDescription("Implements a force term in the Navier Stokes momentum equation.");
      29             : 
      30           0 :   return params;
      31           0 : }
      32             : 
      33           0 : DistributedForce::DistributedForce(const InputParameters & parameters)
      34             :   : Kernel(parameters),
      35           0 :     _component(getParam<unsigned int>("component")),
      36           0 :     _acceleration(getParam<RealVectorValue>("acceleration")(_component)),
      37           0 :     _rho_var_number(coupled("rho")),
      38           0 :     _rho(coupledValue("rho"))
      39             : {
      40           0 : }
      41             : 
      42             : Real
      43           0 : DistributedForce::computeQpResidual()
      44             : {
      45             :   // -rho * g * phi
      46           0 :   return -_rho[_qp] * _acceleration * _test[_i][_qp];
      47             : }
      48             : 
      49             : Real
      50           0 : DistributedForce::computeQpJacobian()
      51             : {
      52           0 :   return 0.;
      53             : }
      54             : 
      55             : Real
      56           0 : DistributedForce::computeQpOffDiagJacobian(unsigned int jvar)
      57             : {
      58           0 :   if (jvar == _rho_var_number)
      59           0 :     return -_phi[_j][_qp] * _acceleration * _test[_i][_qp];
      60             : 
      61             :   return 0;
      62             : }

Generated by: LCOV version 1.14