LCOV - code coverage report
Current view: top level - src/auxkernels - NekSpatialBinComponentAux.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 17 20 85.0 %
Date: 2025-07-15 20:50:38 Functions: 3 3 100.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 "NekSpatialBinComponentAux.h"
      22             : #include "CardinalEnums.h"
      23             : 
      24             : registerMooseObject("CardinalApp", NekSpatialBinComponentAux);
      25             : 
      26             : InputParameters
      27         146 : NekSpatialBinComponentAux::validParams()
      28             : {
      29         146 :   InputParameters params = SpatialUserObjectAux::validParams();
      30         292 :   params.addRequiredRangeCheckedParam<unsigned int>(
      31             :       "component", "component < 3", "Component of user object");
      32         146 :   params.addClassDescription(
      33             :       "Component-wise (x, y, z) spatial value returned from a Nek user object");
      34         146 :   return params;
      35           0 : }
      36             : 
      37          74 : NekSpatialBinComponentAux::NekSpatialBinComponentAux(const InputParameters & parameters)
      38         148 :   : SpatialUserObjectAux(parameters), _component(getParam<unsigned int>("component"))
      39             : {
      40             :   // by requiring this userobject, we automatically ensure correct NekRSProblem-type problems
      41             :   // because the NekUserObject checks for compatibility
      42          74 :   _bin_uo = dynamic_cast<const NekSpatialBinUserObject *>(&_user_object);
      43             : 
      44          74 :   if (!_bin_uo)
      45           2 :     mooseError("This auxkernel can only be combined with NekSpatialBinUserObject-derived classes!\n"
      46           1 :                "You have specified the '" +
      47           0 :                _user_object.type() + "' user object instead.");
      48             : 
      49          73 :   if (_bin_uo->field() != field::velocity_component)
      50           1 :     mooseError("This auxkernel can only be used with a binning user object that sets "
      51             :                "'field = velocity_component'!");
      52          72 : }
      53             : 
      54             : Real
      55      104760 : NekSpatialBinComponentAux::computeValue()
      56             : {
      57      104760 :   if (isNodal())
      58           0 :     return _bin_uo->spatialValue(*_current_node, _component);
      59             :   else
      60      104760 :     return _bin_uo->spatialValue(_current_elem->vertex_average(), _component);
      61             : }
      62             : 
      63             : #endif

Generated by: LCOV version 1.14