LCOV - code coverage report
Current view: top level - src/criticality - RotationSearch.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: ddd5f2 Lines: 23 24 95.8 %
Date: 2026-06-07 19:35:24 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #ifdef ENABLE_OPENMC_COUPLING
       2             : 
       3             : #include "RotationSearch.h"
       4             : #include "openmc/capi.h"
       5             : 
       6             : registerMooseObject("CardinalApp", RotationSearch);
       7             : 
       8             : InputParameters
       9         102 : RotationSearch::validParams()
      10             : {
      11         102 :   auto params = CriticalitySearchBase::validParams();
      12         102 :   params += OpenMCCellTransformBase::validParams();
      13         204 :   params.addRequiredParam<MooseEnum>(
      14         306 :       "rotation_axis", MooseEnum("x=0 y=1 z=2"), "Axis about which to rotate the cell's fill.");
      15         102 :   params.addClassDescription("Searches for criticality by modifying cell rotation(s) in degrees");
      16             : 
      17         102 :   return params;
      18           0 : }
      19             : 
      20          54 : RotationSearch::RotationSearch(const InputParameters & parameters)
      21             :   : CriticalitySearchBase(parameters),
      22             :     OpenMCCellTransformBase(static_cast<MooseObject &>(*this)),
      23         106 :     _rotation_axis_idx(int(getParam<MooseEnum>("rotation_axis")))
      24             : {
      25             :   // apply additional checks on the minimum and maximum to ensure one period of rotation in search
      26          52 :   if (_minimum < 0)
      27           4 :     paramError("minimum",
      28           2 :                "The 'minimum' specified rotation (" + std::to_string(_minimum) +
      29             :                    ") must be positive!");
      30          50 :   if (_maximum >= 360)
      31           4 :     paramError("The 'maximum' specified rotation (" + std::to_string(_maximum) +
      32             :                ") must be less than 360 degrees");
      33          48 : }
      34             : 
      35             : void
      36         624 : RotationSearch::updateOpenMCModel(const Real & angle)
      37             : {
      38        1248 :   _console << "OpenMC will run with next guess for rotation = " << angle << " " << units()
      39         624 :            << std::endl;
      40             : 
      41             :   // make a vectorized version of the rotation angle with 0 (default Point value) for the
      42             :   // non-rotating axes
      43             :   Point angles;
      44             :   // the enum default indices correspond to which vector component is non zero
      45         624 :   angles(_rotation_axis_idx) = angle;
      46             : 
      47             :   // rotation transformation
      48         624 :   auto transform_type_enum = OpenMCCellTransformBase::transform_type;
      49         624 :   transform_type_enum = "rotation";
      50             : 
      51             :   // do the transform
      52         624 :   transform(transform_type_enum, angles);
      53         624 : }
      54             : 
      55             : #endif

Generated by: LCOV version 1.14