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_NEK_COUPLING 20 : 21 : #include "AddScalarTransferAction.h" 22 : #include "NekRSProblem.h" 23 : #include "ScalarTransferBase.h" 24 : 25 : registerMooseAction("CardinalApp", AddScalarTransferAction, "add_scalar_transfers"); 26 : 27 : InputParameters 28 55 : AddScalarTransferAction::validParams() 29 : { 30 55 : auto params = MooseObjectAction::validParams(); 31 55 : params.addClassDescription( 32 : "Adds a scalar transfer (a single number) for coupling NeKRS to MOOSE"); 33 55 : return params; 34 0 : } 35 : 36 55 : AddScalarTransferAction::AddScalarTransferAction(const InputParameters & parameters) 37 55 : : MooseObjectAction(parameters) 38 : { 39 55 : } 40 : 41 : void 42 52 : AddScalarTransferAction::act() 43 : { 44 52 : if (_current_task == "add_scalar_transfers") 45 : { 46 52 : auto nek_problem = dynamic_cast<NekRSProblem *>(_problem.get()); 47 : 48 52 : if (!nek_problem) 49 1 : mooseError("The [ScalarTransfers] block can only be used with wrapped Nek cases! " 50 : "You need to change the [Problem] block to 'NekRSProblem'."); 51 : 52 59 : if (_type == "NekScalarValue" || _type == "NekPostprocessorValue") 53 : { 54 51 : _moose_object_pars.set<NekRSProblem *>("_nek_problem") = nek_problem; 55 : auto transfer = 56 149 : nek_problem->addObject<ScalarTransferBase>(_type, _name, _moose_object_pars, false)[0]; 57 : } 58 : } 59 49 : } 60 : #endif