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 "AddFieldTransferAction.h" 22 : #include "NekRSProblem.h" 23 : #include "FieldTransferBase.h" 24 : 25 : registerMooseAction("CardinalApp", AddFieldTransferAction, "add_field_transfers"); 26 : 27 : InputParameters 28 1174 : AddFieldTransferAction::validParams() 29 : { 30 1174 : auto params = MooseObjectAction::validParams(); 31 1174 : params.addClassDescription("Adds a field transfer (mesh-based data) for coupling to NekRS"); 32 1174 : return params; 33 0 : } 34 : 35 1174 : AddFieldTransferAction::AddFieldTransferAction(const InputParameters & parameters) 36 1174 : : MooseObjectAction(parameters) 37 : { 38 1174 : } 39 : 40 : void 41 1168 : AddFieldTransferAction::act() 42 : { 43 1168 : if (_current_task == "add_field_transfers") 44 : { 45 1168 : auto nek_problem = dynamic_cast<NekRSProblem *>(_problem.get()); 46 : 47 1168 : if (!nek_problem) 48 1 : mooseError("The [FieldTransfers] block can only be used with wrapped Nek cases! " 49 : "You need to change the [Problem] block to 'NekRSProblem'."); 50 : 51 1855 : if (_type == "NekFieldVariable" || _type == "NekVolumetricSource" || 52 1212 : _type == "NekBoundaryFlux" || _type == "NekMeshDeformation") 53 : { 54 1167 : _moose_object_pars.set<NekRSProblem *>("_nek_problem") = nek_problem; 55 : auto transfer = 56 3459 : nek_problem->addObject<FieldTransferBase>(_type, _name, _moose_object_pars, false)[0]; 57 : } 58 : } 59 1146 : } 60 : #endif