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 4450 : CardinalApp::validParams()
64 : {
65 4450 : 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 8900 : params.addCommandLineParam<int>(
70 : "nekrs_buildonly", "--nekrs-buildonly [#procs]", "#procs to build NekRS if pre-compiling");
71 8900 : params.addCommandLineParam<int>("nekrs_cimode",
72 : "--nekrs-cimode [id]",
73 : "Test ID for NekRS CI settings for execution within Cardinal");
74 8900 : params.addCommandLineParam<std::string>(
75 : "nekrs_backend",
76 : "--nekrs-backend",
77 : "Backend to use for NekRS parallelism; example options: CPU, CUDA, DPCPP, HIP, OPENCL, "
78 : "OPENMP; if there is an option not listed, this parameter gets parsed as a string do you can "
79 : "use other options");
80 8900 : params.addCommandLineParam<std::string>(
81 : "nekrs_device_id", "--nekrs-device-id", "NekRS device ID");
82 :
83 4450 : params.set<bool>("use_legacy_material_output") = false;
84 4450 : params.set<bool>("use_legacy_initial_residual_evaluation_behavior") = false;
85 4450 : params.set<bool>("error_unused") = false;
86 4450 : params.set<bool>("allow_unused") = true;
87 4450 : return params;
88 0 : }
89 :
90 25 : CardinalApp::CardinalApp(const InputParameters & parameters) : MooseApp(parameters)
91 : {
92 25 : CardinalApp::registerAll(_factory, _action_factory, _syntax);
93 25 : }
94 :
95 : void
96 4450 : CardinalApp::registerAll(Factory & f, ActionFactory & af, Syntax & s)
97 : {
98 4450 : Registry::registerObjectsTo(f, {"CardinalApp"});
99 4450 : Registry::registerActionsTo(af, {"CardinalApp"});
100 :
101 4450 : ModulesApp::registerAllObjects<CardinalApp>(f, af, s);
102 :
103 : #ifdef ENABLE_GRIFFIN_COUPLING
104 : GriffinApp::registerAll(f, af, s);
105 : RadiationTransportApp::registerAll(f, af, s);
106 : #endif
107 :
108 : #ifdef ENABLE_BISON_COUPLING
109 : BisonApp::registerAll(f, af, s);
110 : #endif
111 :
112 : #ifdef ENABLE_SAM_COUPLING
113 : SamApp::registerAll(f, af, s);
114 : #endif
115 :
116 : #ifdef ENABLE_SOCKEYE_COUPLING
117 : SockeyeApp::registerAll(f, af, s);
118 : #endif
119 :
120 : #ifdef ENABLE_SODIUM
121 : SodiumApp::registerAll(f, af, s);
122 : #endif
123 :
124 : #ifdef ENABLE_POTASSIUM
125 : PotassiumApp::registerAll(f, af, s);
126 : #endif
127 :
128 : #ifdef ENABLE_IAPWS95
129 : IAPWS95App::registerAll(f, af, s);
130 : #endif
131 :
132 : /* register custom execute flags, action syntax, etc. here */
133 : #ifdef ENABLE_NEK_COUPLING
134 1501 : Nek::associateSyntax(s, af);
135 : #endif
136 :
137 4450 : associateSyntaxInner(s, af);
138 4450 : }
139 :
140 : void
141 3949 : CardinalApp::registerApps()
142 : {
143 3949 : registerApp(CardinalApp);
144 :
145 3949 : ModulesApp::registerApps();
146 :
147 : #ifdef ENABLE_GRIFFIN_COUPLING
148 : GriffinApp::registerApps();
149 : RadiationTransportApp::registerApps();
150 : #endif
151 :
152 : #ifdef ENABLE_BISON_COUPLING
153 : BisonApp::registerApps();
154 : #endif
155 :
156 : #ifdef ENABLE_SAM_COUPLING
157 : SamApp::registerApps();
158 : #endif
159 :
160 : #ifdef ENABLE_SOCKEYE_COUPLING
161 : SockeyeApp::registerApps();
162 : #endif
163 :
164 : #ifdef ENABLE_SODIUM
165 : SodiumApp::registerApps();
166 : #endif
167 :
168 : #ifdef ENABLE_POTASSIUM
169 : PotassiumApp::registerApps();
170 : #endif
171 :
172 : #ifdef ENABLE_IAPWS95
173 : IAPWS95App::registerApps();
174 : #endif
175 :
176 : {
177 3949 : const std::string doc = "NekRS computational fluid dynamics coupling ";
178 : #ifdef ENABLE_NEK_COUPLING
179 1115 : addBoolCapability("nekrs", true, doc + "is available.");
180 : #else
181 2834 : addBoolCapability("nekrs", false, doc + "is not available.");
182 : #endif
183 : }
184 :
185 : {
186 3949 : const std::string doc = "OpenMC Monte Carlo particle transport coupling ";
187 : #ifdef ENABLE_OPENMC_COUPLING
188 2840 : addBoolCapability("openmc", true, doc + "is available.");
189 : #else
190 1109 : addBoolCapability("openmc", false, doc + "is not available.");
191 : #endif
192 : }
193 :
194 : {
195 3949 : const std::string doc = "DAGMC CAD geometry ";
196 : #ifdef ENABLE_DAGMC
197 1463 : addBoolCapability("dagmc", true, doc + "is available.");
198 : #else
199 2486 : addBoolCapability("dagmc", false, doc + "is not available.");
200 : #endif
201 : }
202 3949 : }
203 :
204 : void
205 4450 : CardinalApp::associateSyntaxInner(Syntax & syntax, ActionFactory & /* action_factory */)
206 : {
207 8900 : registerSyntax("VolumetricHeatSourceICAction", "Cardinal/ICs/VolumetricHeatSource");
208 8900 : registerSyntax("BulkEnergyConservationICAction", "Cardinal/ICs/BulkEnergyConservation");
209 :
210 : #ifdef ENABLE_OPENMC_COUPLING
211 : // Add the [Problem/Filters] block
212 5928 : registerSyntaxTask("AddFilterAction", "Problem/Filters/*", "add_filters");
213 5928 : registerMooseObjectTask("add_filters", Filter, false);
214 5928 : addTaskDependency("add_filters", "init_displaced_problem");
215 :
216 : // Add the [Problem/Tallies] block
217 5928 : registerSyntaxTask("AddTallyAction", "Problem/Tallies/*", "add_tallies");
218 5928 : registerMooseObjectTask("add_tallies", Tally, false);
219 : // Make sure filters are constructed before tallies.
220 5928 : addTaskDependency("add_tallies", "add_filters");
221 : // Can only add external auxvars after the tallies have been added.
222 5928 : addTaskDependency("add_external_aux_variables", "add_tallies");
223 :
224 : // Add the [Problem/CriticalitySearch] block
225 5928 : registerSyntax("AddCriticalitySearchAction", "Problem/CriticalitySearch");
226 5928 : registerMooseObjectTask("add_criticality_search", CriticalitySearch, false);
227 2964 : registerTask("add_criticality_search", false /* is required */);
228 5928 : addTaskDependency("add_criticality_search", "init_problem");
229 :
230 : // Register a modify outputs task to enable variable hiding in the MGXS action.
231 2964 : registerTask("modify_outputs", true /* is required */);
232 5928 : addTaskDependency("modify_outputs", "common_output");
233 5928 : addTaskDependency("modify_outputs", "add_tallies");
234 5928 : addTaskDependency("add_output", "modify_outputs");
235 :
236 : // Add the MGXS block.
237 5928 : registerSyntax("SetupMGXSAction", "Problem/MGXS");
238 : #endif
239 :
240 : #ifdef ENABLE_NEK_COUPLING
241 : // Add the [Problem/Dimensionalize] block
242 3002 : registerSyntax("DimensionalizeAction", "Problem/Dimensionalize");
243 1501 : registerTask("add_dimensionalization", false /* is required */);
244 3002 : addTaskDependency("add_dimensionalization", "init_mesh");
245 :
246 : // Add the [Problem/FieldTransfers] block
247 3002 : registerSyntaxTask("AddFieldTransferAction", "Problem/FieldTransfers/*", "add_field_transfers");
248 3002 : registerMooseObjectTask("add_field_transfers", FieldTransfer, false);
249 3002 : addTaskDependency("add_field_transfers", "init_mesh");
250 3002 : addTaskDependency("add_external_aux_variables", "add_field_transfers");
251 :
252 : // Add the [Problem/ScalarTransfers] block, which will be executed after the field transfers
253 3002 : registerSyntaxTask(
254 : "AddScalarTransferAction", "Problem/ScalarTransfers/*", "add_scalar_transfers");
255 3002 : registerMooseObjectTask("add_scalar_transfers", ScalarTransfer, false);
256 3002 : addTaskDependency("add_scalar_transfers", "add_field_transfers");
257 : #endif
258 :
259 4450 : registerTask("add_heat_source_ic", false /* is required */);
260 8900 : addTaskDependency("add_heat_source_ic", "add_ic");
261 :
262 4450 : registerTask("add_heat_source_postprocessor", false /* is required */);
263 8900 : addTaskDependency("add_heat_source_postprocessor", "add_postprocessor");
264 :
265 4450 : registerTask("add_bulk_fluid_temperature_ic", false /* is required */);
266 8900 : addTaskDependency("add_bulk_fluid_temperature_ic", "add_bulk_fluid_temperature_user_object");
267 :
268 4450 : registerTask("add_bulk_fluid_temperature_user_object", false /* is required */);
269 8900 : addTaskDependency("add_bulk_fluid_temperature_user_object", "add_heat_source_ic");
270 4450 : }
271 :
272 : std::string
273 0 : CardinalApp::getInstallableInputs() const
274 : {
275 0 : return CARDINAL_INSTALLABLE_DIRS;
276 : }
277 :
278 : /***************************************************************************************************
279 : *********************** Dynamic Library Entry Points - DO NOT MODIFY ******************************
280 : **************************************************************************************************/
281 : extern "C" void
282 0 : CardinalApp__registerAll(Factory & f, ActionFactory & af, Syntax & s)
283 : {
284 0 : CardinalApp::registerAll(f, af, s);
285 0 : }
286 :
287 : extern "C" void
288 0 : CardinalApp__registerApps()
289 : {
290 0 : CardinalApp::registerApps();
291 0 : }
|