LCOV - code coverage report
Current view: top level - src/auxkernels - CoupledDirectionalMeshHeightInterpolation.C (source / functions) Hit Total Coverage
Test: idaholab/moose misc: #31405 (292dce) with base fef103 Lines: 20 20 100.0 %
Date: 2025-09-04 07:54:05 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 "CoupledDirectionalMeshHeightInterpolation.h"
      11             : #include "MooseMesh.h"
      12             : 
      13             : #include "libmesh/mesh_tools.h"
      14             : 
      15             : registerMooseObject("MiscApp", CoupledDirectionalMeshHeightInterpolation);
      16             : 
      17             : InputParameters
      18          38 : CoupledDirectionalMeshHeightInterpolation::validParams()
      19             : {
      20          38 :   InputParameters params = AuxKernel::validParams();
      21          76 :   params.addRequiredCoupledVar(
      22             :       "coupled_var",
      23             :       "The variable whose values are scaled based on position relative to the model bounds.");
      24             : 
      25          76 :   MooseEnum directions("x y z");
      26          76 :   params.addRequiredParam<MooseEnum>("direction", directions, "The direction to interpolate in.");
      27          38 :   params.addClassDescription(
      28             :       "Scales a variable based on position relative to the model bounds in a specified direction");
      29             : 
      30          38 :   return params;
      31          38 : }
      32             : 
      33          20 : CoupledDirectionalMeshHeightInterpolation::CoupledDirectionalMeshHeightInterpolation(
      34          20 :     const InputParameters & parameters)
      35             :   : AuxKernel(parameters),
      36          20 :     _coupled_val(coupledValue("coupled_var")),
      37          60 :     _direction(getParam<MooseEnum>("direction"))
      38             : {
      39          20 :   BoundingBox bounding_box = MeshTools::create_bounding_box(_subproblem.mesh());
      40             : 
      41          20 :   _direction_min = bounding_box.min()(_direction);
      42          20 :   _direction_max = bounding_box.max()(_direction);
      43          20 : }
      44             : 
      45             : Real
      46        4961 : CoupledDirectionalMeshHeightInterpolation::computeValue()
      47             : {
      48        4961 :   const Node & current_pos = *_current_node;
      49             : 
      50             :   const Real fraction_along_direction =
      51        4961 :       (current_pos(_direction) - _direction_min) / (_direction_max - _direction_min);
      52             : 
      53        4961 :   return fraction_along_direction * _coupled_val[_qp];
      54             : }

Generated by: LCOV version 1.14