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 : #pragma once 20 : 21 : #include "GeneralPostprocessor.h" 22 : 23 : #include "OpenMCBase.h" 24 : 25 : /** 26 : * OpenMCWallTime is a post-processsor that returns the OpenMC wall time. This is one of 27 : * several options at present: 28 : * 1. Total time spent during initialization; 29 : * 2. Total time spent running a simulation; 30 : * 3. Total time running transport; 31 : * 4. Total time running inactive batches; 32 : * 5. Total time running active batches; 33 : * 6. Total time synchronizing the fission bank; 34 : * 7. Total time accumulating tallies; 35 : * 8. Total time spent in finalization; 36 : * 9. Total time elapsed. 37 : * The accumulated time (over all time steps / adaptivity steps / Picard iterations) is returned by 38 : * default to facilitate the computation of figures of merit. This behaviour can be adjusted 39 : * to return the wall time for a single simulation, if desired. 40 : */ 41 : class OpenMCWallTime : public GeneralPostprocessor, public OpenMCBase 42 : { 43 : public: 44 : static InputParameters validParams(); 45 : 46 : OpenMCWallTime(const InputParameters & parameters); 47 : 48 288 : virtual void initialize() override {} 49 : virtual void execute() override; 50 : 51 : virtual Real getValue() const override; 52 : 53 : /// Declare the OpenMCTime enum. These will correspond 1 to 1 to the 54 : /// enums used in the input file. 55 5616 : CreateMooseEnumClass(OpenMCTime, 56 : initialization_time = 0, 57 : total_simulation_time = 1, 58 : transport_time = 2, 59 : inactive_batch_time = 3, 60 : active_batch_time = 4, 61 : fission_bank_time = 5, 62 : tally_accumulation_time = 6, 63 : finalization_time = 7, 64 : total_elapsed_time = 8); 65 : 66 : protected: 67 : /// Whether the simulation time should be accumulated or not. 68 : const bool & _accumulate_time; 69 : 70 : /// The type of time to report from OpenMC. 71 : const OpenMCTime _openmc_time; 72 : 73 : /// The accumulate or step walltime. 74 : Real _walltime; 75 : };