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

Generated by: LCOV version 1.14