LCOV - code coverage report
Current view: top level - src/auxkernels - TagVectorAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 99787a Lines: 25 27 92.6 %
Date: 2025-10-14 20:01:24 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 "TagVectorAux.h"
      11             : 
      12             : registerMooseObject("MooseApp", TagVectorAux);
      13             : 
      14             : InputParameters
      15       15895 : TagVectorAux::validParams()
      16             : {
      17       15895 :   InputParameters params = TagAuxBase<AuxKernel>::validParams();
      18       31790 :   params.addClassDescription("Extract DOF values from a tagged vector into an AuxVariable");
      19       63580 :   params.addRequiredParam<TagName>("vector_tag", "Name of the vector tag to extract values from");
      20       31790 :   params.addParam<bool>(
      21             :       "remove_variable_scaling",
      22       31790 :       false,
      23             :       "Whether to remove variable scaling from DOF value. If false, values are directly extracted "
      24             :       "from the tag vector, and potentially with scaling applied. If true, any scaling of "
      25             :       "variables is undone in the reported values.");
      26       15895 :   return params;
      27           0 : }
      28             : 
      29         594 : TagVectorAux::TagVectorAux(const InputParameters & parameters)
      30             :   : TagAuxBase<AuxKernel>(parameters),
      31         594 :     _remove_variable_scaling(isParamSetByUser("scaled")
      32        1244 :                                  ? !getParam<bool>("scaled")
      33        1726 :                                  : getParam<bool>("remove_variable_scaling")),
      34        2376 :     _v(coupledVectorTagValue("v", "vector_tag")),
      35        1782 :     _v_var(*getFieldVar("v", 0))
      36             : {
      37         594 :   checkCoupledVariable(&_v_var, &_var);
      38             : 
      39        1770 :   if (isParamSetByUser("scaled"))
      40             :   {
      41          28 :     mooseDeprecated("The 'scaled' parameter has been deprecated. Please use the "
      42             :                     "'remove_variable_scaling' parameter instead.");
      43          84 :     if (isParamSetByUser("remove_variable_scaling"))
      44           0 :       paramError("You cannot set both the 'scaled' and 'remove_variable_scaling' parameters. "
      45             :                  "Please use only the 'remove_variable_scaling' parameter.");
      46             :   }
      47             : 
      48         590 :   if (_remove_variable_scaling)
      49             :   {
      50          64 :     const auto vector_tag_id = _subproblem.getVectorTagID(getParam<TagName>("vector_tag"));
      51          32 :     const auto vector_tag_type = _subproblem.vectorTagType(vector_tag_id);
      52          32 :     if (vector_tag_type != Moose::VECTOR_TAG_RESIDUAL)
      53           8 :       paramError("vector_tag",
      54             :                  "The provided vector tag does not correspond to a tagged residual vector, which "
      55             :                  "is the only kind of vector tag type for which scaling is applicable, yet "
      56             :                  "variable scaling is requested to be removed.");
      57             :   }
      58         586 : }
      59             : 
      60             : Real
      61       85320 : TagVectorAux::computeValue()
      62             : {
      63       85320 :   return _remove_variable_scaling ? _v[_qp] / _v_var.scalingFactor() : _v[_qp];
      64             : }

Generated by: LCOV version 1.14