LCOV - code coverage report
Current view: top level - src/base - CardinalApp.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: 93e9c4 Lines: 76 85 89.4 %
Date: 2026-07-16 12:06:10 Functions: 5 8 62.5 %
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             : #include "CardinalApp.h"
      20             : #include "Moose.h"
      21             : #include "AppFactory.h"
      22             : #include "ModulesApp.h"
      23             : #include "MooseSyntax.h"
      24             : #include "CardinalAppTypes.h"
      25             : #include "CardinalRevision.h"
      26             : 
      27             : #ifdef ENABLE_OPENMC_COUPLING
      28             : #include "OpenMCSyntax.h"
      29             : #endif
      30             : 
      31             : #ifdef ENABLE_NEK_COUPLING
      32             : #include "NekSyntax.h"
      33             : #endif
      34             : 
      35             : #ifdef ENABLE_GRIFFIN_COUPLING
      36             : #include "GriffinApp.h"
      37             : #include "RadiationTransportApp.h"
      38             : #endif
      39             : 
      40             : #ifdef ENABLE_BISON_COUPLING
      41             : #include "BisonApp.h"
      42             : #endif
      43             : 
      44             : #ifdef ENABLE_SAM_COUPLING
      45             : #include "SamApp.h"
      46             : #endif
      47             : 
      48             : #ifdef ENABLE_SOCKEYE_COUPLING
      49             : #include "SockeyeApp.h"
      50             : #endif
      51             : 
      52             : #ifdef ENABLE_SODIUM
      53             : #include "SodiumApp.h"
      54             : #endif
      55             : 
      56             : #ifdef ENABLE_POTASSIUM
      57             : #include "PotassiumApp.h"
      58             : #endif
      59             : 
      60             : #ifdef ENABLE_IAPWS95
      61             : #include "IAPWS95App.h"
      62             : #endif
      63             : 
      64             : registerKnownLabel("CardinalApp");
      65             : 
      66             : InputParameters
      67        4647 : CardinalApp::validParams()
      68             : {
      69        4647 :   InputParameters params = MooseApp::validParams();
      70             : 
      71             :   // only used for Nek wrappings - if used with another application (OpenMC wrapping
      72             :   // or just plain MOOSE-type apps), these are unused
      73        9294 :   params.addCommandLineParam<int>(
      74             :       "nekrs_buildonly", "--nekrs-buildonly [#procs]", "#procs to build NekRS if pre-compiling");
      75        9294 :   params.addCommandLineParam<int>("nekrs_cimode",
      76             :                                   "--nekrs-cimode [id]",
      77             :                                   "Test ID for NekRS CI settings for execution within Cardinal");
      78        9294 :   params.addCommandLineParam<std::string>(
      79             :       "nekrs_backend",
      80             :       "--nekrs-backend",
      81             :       "Backend to use for NekRS parallelism; example options: CPU, CUDA, DPCPP, HIP, OPENCL, "
      82             :       "OPENMP; if there is an option not listed, this parameter gets parsed as a string do you can "
      83             :       "use other options");
      84        9294 :   params.addCommandLineParam<std::string>(
      85             :       "nekrs_device_id", "--nekrs-device-id", "NekRS device ID");
      86             : 
      87        4647 :   params.set<bool>("use_legacy_material_output") = false;
      88        4647 :   params.set<bool>("use_legacy_initial_residual_evaluation_behavior") = false;
      89        4647 :   params.set<bool>("error_unused") = false;
      90        4647 :   params.set<bool>("allow_unused") = true;
      91        4647 :   return params;
      92           0 : }
      93             : 
      94          49 : CardinalApp::CardinalApp(const InputParameters & parameters) : MooseApp(parameters)
      95             : {
      96          49 :   CardinalApp::registerAll(_factory, _action_factory, _syntax);
      97          49 : }
      98             : 
      99             : void
     100        4647 : CardinalApp::registerAll(Factory & f, ActionFactory & af, Syntax & s)
     101             : {
     102        4647 :   Registry::registerObjectsTo(f, {"CardinalApp"});
     103        4647 :   Registry::registerActionsTo(af, {"CardinalApp"});
     104             : 
     105        4647 :   ModulesApp::registerAllObjects<CardinalApp>(f, af, s);
     106             : 
     107             : #ifdef ENABLE_GRIFFIN_COUPLING
     108             :   GriffinApp::registerAll(f, af, s);
     109             :   RadiationTransportApp::registerAll(f, af, s);
     110             : #endif
     111             : 
     112             : #ifdef ENABLE_BISON_COUPLING
     113             :   BisonApp::registerAll(f, af, s);
     114             : #endif
     115             : 
     116             : #ifdef ENABLE_SAM_COUPLING
     117             :   SamApp::registerAll(f, af, s);
     118             : #endif
     119             : 
     120             : #ifdef ENABLE_SOCKEYE_COUPLING
     121             :   SockeyeApp::registerAll(f, af, s);
     122             : #endif
     123             : 
     124             : #ifdef ENABLE_SODIUM
     125             :   SodiumApp::registerAll(f, af, s);
     126             : #endif
     127             : 
     128             : #ifdef ENABLE_POTASSIUM
     129             :   PotassiumApp::registerAll(f, af, s);
     130             : #endif
     131             : 
     132             : #ifdef ENABLE_IAPWS95
     133             :   IAPWS95App::registerAll(f, af, s);
     134             : #endif
     135             : 
     136             :   /* register custom execute flags, action syntax, etc. here */
     137             : #ifdef ENABLE_NEK_COUPLING
     138        1501 :   Nek::associateSyntax(s, af);
     139             : #endif
     140             : 
     141             : #ifdef ENABLE_OPENMC_COUPLING
     142        3161 :   OpenMC::associateSyntax(s, af);
     143             : #endif
     144             : 
     145        4647 :   associateSyntaxInner(s, af);
     146        4647 : }
     147             : 
     148             : void
     149        4121 : CardinalApp::registerApps()
     150             : {
     151        4121 :   registerApp(CardinalApp);
     152             : 
     153        4121 :   ModulesApp::registerApps();
     154             : 
     155             : #ifdef ENABLE_GRIFFIN_COUPLING
     156             :   GriffinApp::registerApps();
     157             :   RadiationTransportApp::registerApps();
     158             : #endif
     159             : 
     160             : #ifdef ENABLE_BISON_COUPLING
     161             :   BisonApp::registerApps();
     162             : #endif
     163             : 
     164             : #ifdef ENABLE_SAM_COUPLING
     165             :   SamApp::registerApps();
     166             : #endif
     167             : 
     168             : #ifdef ENABLE_SOCKEYE_COUPLING
     169             :   SockeyeApp::registerApps();
     170             : #endif
     171             : 
     172             : #ifdef ENABLE_SODIUM
     173             :   SodiumApp::registerApps();
     174             : #endif
     175             : 
     176             : #ifdef ENABLE_POTASSIUM
     177             :   PotassiumApp::registerApps();
     178             : #endif
     179             : 
     180             : #ifdef ENABLE_IAPWS95
     181             :   IAPWS95App::registerApps();
     182             : #endif
     183             : 
     184             :   {
     185        4121 :     const std::string doc = "NekRS computational fluid dynamics coupling ";
     186             : #ifdef ENABLE_NEK_COUPLING
     187        1115 :     addBoolCapability("nekrs", true, doc + "is available.");
     188             : #else
     189        3006 :     addBoolCapability("nekrs", false, doc + "is not available.");
     190             : #endif
     191             :   }
     192             : 
     193             :   {
     194        4121 :     const std::string doc = "OpenMC Monte Carlo particle transport coupling ";
     195             : #ifdef ENABLE_OPENMC_COUPLING
     196        3012 :     addBoolCapability("openmc", true, doc + "is available.");
     197             : #else
     198        1109 :     addBoolCapability("openmc", false, doc + "is not available.");
     199             : #endif
     200             :   }
     201             : 
     202             :   {
     203        4121 :     const std::string doc = "DAGMC CAD geometry ";
     204             : #ifdef ENABLE_DAGMC
     205        1552 :     addBoolCapability("dagmc", true, doc + "is available.");
     206             : #else
     207        2569 :     addBoolCapability("dagmc", false, doc + "is not available.");
     208             : #endif
     209             :   }
     210        4121 : }
     211             : 
     212             : void
     213        4647 : CardinalApp::associateSyntaxInner(Syntax & syntax, ActionFactory & /* action_factory */)
     214             : {
     215        9294 :   registerSyntax("VolumetricHeatSourceICAction", "Cardinal/ICs/VolumetricHeatSource");
     216        9294 :   registerSyntax("BulkEnergyConservationICAction", "Cardinal/ICs/BulkEnergyConservation");
     217             : 
     218             : #ifdef ENABLE_OPENMC_COUPLING
     219             :   // Add the [Problem/Filters] block
     220        6322 :   registerSyntaxTask("AddFilterAction", "Problem/Filters/*", "add_filters");
     221        6322 :   registerMooseObjectTask("add_filters", Filter, false);
     222        6322 :   addTaskDependency("add_filters", "init_displaced_problem");
     223             : 
     224             :   // Add the [Problem/Tallies] block
     225        6322 :   registerSyntaxTask("AddTallyAction", "Problem/Tallies/*", "add_tallies");
     226        6322 :   registerMooseObjectTask("add_tallies", Tally, false);
     227             :   // Make sure filters are constructed before tallies.
     228        6322 :   addTaskDependency("add_tallies", "add_filters");
     229             :   // Can only add external auxvars after the tallies have been added.
     230        6322 :   addTaskDependency("add_external_aux_variables", "add_tallies");
     231             : 
     232             :   // Add the [Problem/CriticalitySearch] block
     233        6322 :   registerSyntax("AddCriticalitySearchAction", "Problem/CriticalitySearch");
     234        6322 :   registerMooseObjectTask("add_criticality_search", CriticalitySearch, false);
     235        3161 :   registerTask("add_criticality_search", false /* is required */);
     236        6322 :   addTaskDependency("add_criticality_search", "init_problem");
     237             : 
     238             :   // Add the [Problem/ModelModifiers] block
     239        6322 :   registerSyntaxTask("AddModelModifiersAction", "Problem/ModelModifiers/*", "add_model_modifiers");
     240        6322 :   registerMooseObjectTask("add_model_modifiers", ModelModifiers, false);
     241        6322 :   addTaskDependency("add_model_modifiers", "init_problem");
     242             : 
     243             :   // Register a modify outputs task to enable variable hiding in the MGXS action.
     244        3161 :   registerTask("modify_outputs", true /* is required */);
     245        6322 :   addTaskDependency("modify_outputs", "common_output");
     246        6322 :   addTaskDependency("modify_outputs", "add_tallies");
     247        6322 :   addTaskDependency("add_output", "modify_outputs");
     248             : 
     249             :   // Add the MGXS block.
     250        6322 :   registerSyntax("SetupMGXSAction", "Problem/MGXS");
     251             : #endif
     252             : 
     253             : #ifdef ENABLE_NEK_COUPLING
     254             :   // Add the [Problem/Dimensionalize] block
     255        3002 :   registerSyntax("DimensionalizeAction", "Problem/Dimensionalize");
     256        1501 :   registerTask("add_dimensionalization", false /* is required */);
     257        3002 :   addTaskDependency("add_dimensionalization", "init_mesh");
     258             : 
     259             :   // Add the [Problem/FieldTransfers] block
     260        3002 :   registerSyntaxTask("AddFieldTransferAction", "Problem/FieldTransfers/*", "add_field_transfers");
     261        3002 :   registerMooseObjectTask("add_field_transfers", FieldTransfer, false);
     262        3002 :   addTaskDependency("add_field_transfers", "init_mesh");
     263        3002 :   addTaskDependency("add_external_aux_variables", "add_field_transfers");
     264             : 
     265             :   // Add the [Problem/ScalarTransfers] block, which will be executed after the field transfers
     266        3002 :   registerSyntaxTask(
     267             :       "AddScalarTransferAction", "Problem/ScalarTransfers/*", "add_scalar_transfers");
     268        3002 :   registerMooseObjectTask("add_scalar_transfers", ScalarTransfer, false);
     269        3002 :   addTaskDependency("add_scalar_transfers", "add_field_transfers");
     270             : #endif
     271             : 
     272        4647 :   registerTask("add_heat_source_ic", false /* is required */);
     273        9294 :   addTaskDependency("add_heat_source_ic", "add_ic");
     274             : 
     275        4647 :   registerTask("add_heat_source_postprocessor", false /* is required */);
     276        9294 :   addTaskDependency("add_heat_source_postprocessor", "add_postprocessor");
     277             : 
     278        4647 :   registerTask("add_bulk_fluid_temperature_ic", false /* is required */);
     279        9294 :   addTaskDependency("add_bulk_fluid_temperature_ic", "add_bulk_fluid_temperature_user_object");
     280             : 
     281        4647 :   registerTask("add_bulk_fluid_temperature_user_object", false /* is required */);
     282        9294 :   addTaskDependency("add_bulk_fluid_temperature_user_object", "add_heat_source_ic");
     283        4647 : }
     284             : 
     285             : std::string
     286           0 : CardinalApp::getInstallableInputs() const
     287             : {
     288           0 :   return CARDINAL_INSTALLABLE_DIRS;
     289             : }
     290             : 
     291             : /***************************************************************************************************
     292             :  *********************** Dynamic Library Entry Points - DO NOT MODIFY ******************************
     293             :  **************************************************************************************************/
     294             : extern "C" void
     295           0 : CardinalApp__registerAll(Factory & f, ActionFactory & af, Syntax & s)
     296             : {
     297           0 :   CardinalApp::registerAll(f, af, s);
     298           0 : }
     299             : 
     300             : extern "C" void
     301           0 : CardinalApp__registerApps()
     302             : {
     303           0 :   CardinalApp::registerApps();
     304           0 : }

Generated by: LCOV version 1.14