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_OPENMC_COUPLING 20 : 21 : #include "CellTemperatureAux.h" 22 : #include "openmc/cell.h" 23 : #include "openmc/error.h" 24 : 25 : registerMooseObject("CardinalApp", CellTemperatureAux); 26 : 27 : InputParameters 28 627 : CellTemperatureAux::validParams() 29 : { 30 627 : InputParameters params = OpenMCAuxKernel::validParams(); 31 627 : params.addClassDescription("OpenMC cell temperature (K), mapped to each MOOSE element"); 32 627 : return params; 33 0 : } 34 : 35 307 : CellTemperatureAux::CellTemperatureAux(const InputParameters & parameters) 36 307 : : OpenMCAuxKernel(parameters) 37 : { 38 307 : } 39 : 40 : Real 41 8418368 : CellTemperatureAux::computeValue() 42 : { 43 : // if the element doesn't map to an OpenMC cell, return a temperature of -1; this is required 44 : // because otherwise OpenMC would throw an error for an invalid instance, index pair passed to the 45 : // C-API 46 8418368 : if (!mappedElement()) 47 : return OpenMCCellAverageProblem::UNMAPPED; 48 : 49 : OpenMCCellAverageProblem::cellInfo cell_info = 50 8075872 : _openmc_problem->elemToCellInfo(_current_elem->id()); 51 : 52 8075872 : if (!_openmc_problem->hasTemperatureFeedback(cell_info)) 53 : return OpenMCCellAverageProblem::UNMAPPED; 54 : 55 8073216 : return _openmc_problem->cellTemperature(cell_info); 56 : } 57 : 58 : #endif