LCOV - code coverage report
Current view: top level - src/materials - DynamicViscosityMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 36 37 97.3 %
Date: 2026-05-29 20:41:18 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 "DynamicViscosityMaterial.h"
      11             : #include "SinglePhaseFluidProperties.h"
      12             : 
      13             : registerMooseObject("ThermalHydraulicsApp", DynamicViscosityMaterial);
      14             : 
      15             : InputParameters
      16          88 : DynamicViscosityMaterial::validParams()
      17             : {
      18          88 :   InputParameters params = Material::validParams();
      19             : 
      20         176 :   params.addCoupledVar("beta", "Remapped volume fraction of liquid");
      21         176 :   params.addRequiredCoupledVar("arhoA", "alpha*rho*A");
      22         176 :   params.addRequiredCoupledVar("arhouA", "alpha*rho*vel*A");
      23         176 :   params.addRequiredCoupledVar("arhoEA", "alpha*rho*E*A");
      24             : 
      25         176 :   params.addRequiredParam<MaterialPropertyName>("mu", "Dynamic viscosity property");
      26         176 :   params.addRequiredParam<MaterialPropertyName>("v", "Specific volume property");
      27         176 :   params.addRequiredParam<MaterialPropertyName>("e", "Specific internal energy property");
      28             : 
      29         176 :   params.addRequiredParam<UserObjectName>("fp_1phase", "Single-phase fluid properties");
      30             : 
      31          88 :   params.addClassDescription("Computes the dynamic viscosity as a material property");
      32             : 
      33          88 :   return params;
      34           0 : }
      35             : 
      36          66 : DynamicViscosityMaterial::DynamicViscosityMaterial(const InputParameters & parameters)
      37             :   : DerivativeMaterialInterfaceTHM<Material>(parameters),
      38             : 
      39          66 :     _mu_name(getParam<MaterialPropertyName>("mu")),
      40          66 :     _mu(declareProperty<Real>(_mu_name)),
      41         138 :     _dmu_dbeta(isParamValid("beta") ? &declarePropertyDerivativeTHM<Real>(_mu_name, "beta")
      42             :                                     : nullptr),
      43          66 :     _dmu_darhoA(declarePropertyDerivativeTHM<Real>(_mu_name, "arhoA")),
      44          66 :     _dmu_darhouA(declarePropertyDerivativeTHM<Real>(_mu_name, "arhouA")),
      45          66 :     _dmu_darhoEA(declarePropertyDerivativeTHM<Real>(_mu_name, "arhoEA")),
      46             : 
      47         132 :     _v(getMaterialProperty<Real>("v")),
      48         144 :     _dv_dbeta(isParamValid("beta") ? &getMaterialPropertyDerivativeTHM<Real>("v", "beta")
      49             :                                    : nullptr),
      50          66 :     _dv_darhoA(getMaterialPropertyDerivativeTHM<Real>("v", "arhoA")),
      51             : 
      52         132 :     _e(getMaterialProperty<Real>("e")),
      53          66 :     _de_darhoA(getMaterialPropertyDerivativeTHM<Real>("e", "arhoA")),
      54          66 :     _de_darhouA(getMaterialPropertyDerivativeTHM<Real>("e", "arhouA")),
      55          66 :     _de_darhoEA(getMaterialPropertyDerivativeTHM<Real>("e", "arhoEA")),
      56             : 
      57         132 :     _fp_1phase(getUserObject<SinglePhaseFluidProperties>("fp_1phase"))
      58             : {
      59          66 : }
      60             : 
      61             : void
      62         448 : DynamicViscosityMaterial::computeQpProperties()
      63             : {
      64             :   Real dmu_dv, dmu_de;
      65         448 :   _fp_1phase.mu_from_v_e(_v[_qp], _e[_qp], _mu[_qp], dmu_dv, dmu_de);
      66             : 
      67         896 :   if (isParamValid("beta"))
      68          52 :     (*_dmu_dbeta)[_qp] = dmu_dv * (*_dv_dbeta)[_qp];
      69         448 :   _dmu_darhoA[_qp] = dmu_dv * _dv_darhoA[_qp] + dmu_de * _de_darhoA[_qp];
      70         448 :   _dmu_darhouA[_qp] = dmu_de * _de_darhouA[_qp];
      71         448 :   _dmu_darhoEA[_qp] = dmu_de * _de_darhoEA[_qp];
      72         448 : }

Generated by: LCOV version 1.14