LCOV - code coverage report
Current view: top level - src/kernels - PINSFEFluidVelocityTimeDerivative.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 32 33 97.0 %
Date: 2025-08-14 10:14:56 Functions: 4 4 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 "PINSFEFluidVelocityTimeDerivative.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", PINSFEFluidVelocityTimeDerivative);
      13             : registerMooseObjectRenamed("NavierStokesApp",
      14             :                            PMFluidVelocityTimeDerivative,
      15             :                            "02/01/2024 00:00",
      16             :                            PINSFEFluidVelocityTimeDerivative);
      17             : 
      18             : InputParameters
      19         492 : PINSFEFluidVelocityTimeDerivative::validParams()
      20             : {
      21         492 :   InputParameters params = TimeDerivative::validParams();
      22         984 :   params.addParam<bool>("conservative_form", false, "if conservative form is used");
      23         984 :   params.addRequiredCoupledVar("pressure", "coupled pressure");
      24         984 :   params.addRequiredCoupledVar("temperature", "coupled temperature");
      25         984 :   params.addRequiredParam<UserObjectName>("eos", "The name of equation of state object to use.");
      26         492 :   params.addClassDescription("Add the transient term for one component of the porous media "
      27             :                              "momentum conservation equation");
      28             : 
      29         492 :   return params;
      30           0 : }
      31             : 
      32         264 : PINSFEFluidVelocityTimeDerivative::PINSFEFluidVelocityTimeDerivative(
      33         264 :     const InputParameters & parameters)
      34             :   : TimeDerivative(parameters),
      35         264 :     _conservative_form(getParam<bool>("conservative_form")),
      36         264 :     _pressure(coupledValue("pressure")),
      37         264 :     _temperature(coupledValue("temperature")),
      38         264 :     _temperature_dot(coupledDot("temperature")),
      39         264 :     _pressure_dot(coupledDot("pressure")),
      40         528 :     _rho(getMaterialProperty<Real>("rho_fluid")),
      41         528 :     _eos(getUserObject<SinglePhaseFluidProperties>("eos"))
      42             : {
      43         264 : }
      44             : 
      45             : Real
      46   118333440 : PINSFEFluidVelocityTimeDerivative::computeQpResidual()
      47             : {
      48   118333440 :   Real res = _rho[_qp] * TimeDerivative::computeQpResidual();
      49   118333440 :   if (_conservative_form)
      50             :   {
      51             :     Real rho, drho_dp, drho_dT;
      52    46144000 :     _eos.rho_from_p_T(_pressure[_qp], _temperature[_qp], rho, drho_dp, drho_dT);
      53    46144000 :     Real drho_dt = drho_dT * _temperature_dot[_qp] + drho_dp * _pressure_dot[_qp];
      54    46144000 :     res += _u[_qp] * drho_dt * _test[_i][_qp];
      55             :   }
      56             : 
      57   118333440 :   return res;
      58             : }
      59             : 
      60             : Real
      61    12846080 : PINSFEFluidVelocityTimeDerivative::computeQpJacobian()
      62             : {
      63    12846080 :   Real jac = _rho[_qp] * TimeDerivative::computeQpJacobian();
      64    12846080 :   if (_conservative_form)
      65             :   {
      66             :     Real rho, drho_dp, drho_dT;
      67      972800 :     _eos.rho_from_p_T(_pressure[_qp], _temperature[_qp], rho, drho_dp, drho_dT);
      68      972800 :     Real drho_dt = drho_dT * _temperature_dot[_qp] + drho_dp * _pressure_dot[_qp];
      69      972800 :     jac += _phi[_j][_qp] * drho_dt * _test[_i][_qp];
      70             :   }
      71             : 
      72    12846080 :   return jac;
      73             : }

Generated by: LCOV version 1.14