LCOV - code coverage report
Current view: top level - src/userobjects - NekPlaneSpatialBinUserObject.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 22 29 75.9 %
Date: 2025-07-15 20:50:38 Functions: 3 5 60.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /********************************************************************/
       2             : /*                  SOFTWARE COPYRIGHT NOTIFICATION                 */
       3             : /*                             Cardinal                             */
       4             : /*                                                                  */
       5             : /*                  (c) 2021 UChicago Argonne, LLC                  */
       6             : /*                        ALL RIGHTS RESERVED                       */
       7             : /*                                                                  */
       8             : /*                 Prepared by UChicago Argonne, LLC                */
       9             : /*               Under Contract No. DE-AC02-06CH11357               */
      10             : /*                With the U. S. Department of Energy               */
      11             : /*                                                                  */
      12             : /*             Prepared by Battelle Energy Alliance, LLC            */
      13             : /*               Under Contract No. DE-AC07-05ID14517               */
      14             : /*                With the U. S. Department of Energy               */
      15             : /*                                                                  */
      16             : /*                 See LICENSE for full restrictions                */
      17             : /********************************************************************/
      18             : 
      19             : #ifdef ENABLE_NEK_COUPLING
      20             : 
      21             : #include "NekPlaneSpatialBinUserObject.h"
      22             : 
      23             : InputParameters
      24          99 : NekPlaneSpatialBinUserObject::validParams()
      25             : {
      26          99 :   InputParameters params = NekSpatialBinUserObject::validParams();
      27         198 :   params.addRequiredRangeCheckedParam<Real>(
      28             :       "gap_thickness",
      29             :       "gap_thickness > 0.0",
      30             :       "thickness of gap region for which to accept contributions to the side integral over "
      31             :       "the gap, expressed in the same units as the mesh.");
      32          99 :   return params;
      33           0 : }
      34             : 
      35          50 : NekPlaneSpatialBinUserObject::NekPlaneSpatialBinUserObject(const InputParameters & parameters)
      36         100 :   : NekSpatialBinUserObject(parameters), _gap_thickness(getParam<Real>("gap_thickness"))
      37             : {
      38             :   // we need to enforce that there is only one side distribution, because side
      39             :   // distributions defined in orthogonal directions don't ever overlap with one another
      40             :   unsigned int num_side_distributions = 0;
      41             : 
      42         141 :   for (unsigned int i = 0; i < _bins.size(); ++i)
      43             :   {
      44             :     auto & uo = _bins[i];
      45          91 :     const PlaneSpatialBinUserObject * side = dynamic_cast<const PlaneSpatialBinUserObject *>(uo);
      46          91 :     if (side)
      47             :     {
      48          49 :       ++num_side_distributions;
      49          49 :       _side_bin = side;
      50          49 :       _side_index = i;
      51             :     }
      52             :   }
      53             : 
      54          50 :   if (num_side_distributions != 1)
      55           2 :     mooseError("This user object requires exactly one bin distribution "
      56           1 :                "to be a side distribution; you have specified: " +
      57           0 :                Moose::stringify(num_side_distributions) + "\noptions: HexagonalSubchannelGapBin");
      58             : 
      59          49 :   if (_field == field::velocity_component && _velocity_component == component::normal)
      60             :   {
      61          16 :     if (!_fixed_mesh)
      62           0 :       mooseError(
      63             :           "The gap unit normals assume the NekRS domain is not moving; with a moving "
      64             :           "mesh, the 'velocity_component = normal' setting is unavailable unless internal methods "
      65             :           "are updated to recompute normals following a change in geometry.");
      66             : 
      67          16 :     _velocity_bin_directions = _side_bin->gapUnitNormals();
      68             :   }
      69          49 : }
      70             : 
      71             : Real
      72           0 : NekPlaneSpatialBinUserObject::distanceFromGap(const Point & point,
      73             :                                               const unsigned int & gap_index) const
      74             : {
      75           0 :   return _side_bin->distanceFromGap(point, gap_index);
      76             : }
      77             : 
      78             : unsigned int
      79           0 : NekPlaneSpatialBinUserObject::gapIndex(const Point & point) const
      80             : {
      81           0 :   return _side_bin->gapIndex(point);
      82             : }
      83             : 
      84             : void
      85   121044384 : NekPlaneSpatialBinUserObject::gapIndexAndDistance(const Point & point,
      86             :                                                   unsigned int & index,
      87             :                                                   Real & distance) const
      88             : {
      89   121044384 :   _side_bin->gapIndexAndDistance(point, index, distance);
      90   121044384 : }
      91             : 
      92             : #endif

Generated by: LCOV version 1.14