LCOV - code coverage report
Current view: top level - src/materials - CoupledGradientMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 18 19 94.7 %
Date: 2025-07-17 01:28:37 Functions: 6 6 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 "CoupledGradientMaterial.h"
      11             : 
      12             : registerMooseObject("MooseApp", CoupledGradientMaterial);
      13             : registerMooseObject("MooseApp", ADCoupledGradientMaterial);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17       28734 : CoupledGradientMaterialTempl<is_ad>::validParams()
      18             : {
      19       28734 :   InputParameters params = Material::validParams();
      20       28734 :   params.addClassDescription("Creates a gradient material equal to the gradient of the coupled "
      21             :                              "variable times a scalar material property.");
      22       28734 :   params.addRequiredParam<MaterialPropertyName>(
      23             :       "grad_mat_prop",
      24             :       "Name of gradient material property equal to the gradient of the coupled variable gradient "
      25             :       "times the scalar.");
      26       28734 :   params.deprecateParam("grad_mat_prop", "gradient_material_name", "12/12/25");
      27       86202 :   params.addParam<MaterialPropertyName>(
      28             :       "scalar_property_factor",
      29       57468 :       1.0,
      30             :       "Scalar material property acting as a factor in the output gradient material property.");
      31       28734 :   params.addRequiredCoupledVar("u", "The coupled variable to take the gradient of");
      32       28734 :   params.deprecateCoupledVar("u", "coupled_variable", "12/12/25");
      33       28734 :   return params;
      34           0 : }
      35             : 
      36             : template <bool is_ad>
      37         156 : CoupledGradientMaterialTempl<is_ad>::CoupledGradientMaterialTempl(
      38             :     const InputParameters & parameters)
      39             :   : Material(parameters),
      40         156 :     _grad_mat_prop(declareGenericProperty<RealVectorValue, is_ad>("grad_mat_prop")),
      41         156 :     _scalar_property_factor(getGenericMaterialProperty<Real, is_ad>("scalar_property_factor")),
      42         312 :     _grad_u(coupledGenericGradient<is_ad>("u"))
      43             : {
      44         156 : }
      45             : 
      46             : template <bool is_ad>
      47             : void
      48       17344 : CoupledGradientMaterialTempl<is_ad>::computeQpProperties()
      49             : {
      50       17344 :   _grad_mat_prop[_qp] = _grad_u[_qp] * _scalar_property_factor[_qp];
      51       17344 : }

Generated by: LCOV version 1.14