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

Generated by: LCOV version 1.14