Line data Source code
1 : #ifdef ENABLE_NEK_COUPLING 2 : 3 : #include "NekFieldInterface.h" 4 : #include "NekInterface.h" 5 : #include "UserErrorChecking.h" 6 : #include "GeometryUtils.h" 7 : 8 : InputParameters 9 10336 : NekFieldInterface::validParams() 10 : { 11 10336 : InputParameters params = emptyInputParameters(); 12 20672 : params.addRequiredParam<MooseEnum>("field", getNekFieldEnum(), "Field to apply this object to"); 13 20672 : params.addParam<Point>("velocity_direction", 14 : "Unit vector to dot with velocity, for 'field = velocity_component'. For " 15 : "example, velocity_direction = '1 1 0' will get the velocity dotted with " 16 : "(1/sqrt(2), 1/sqrt(2), 0)."); 17 20672 : params.addParam<MooseEnum>( 18 : "velocity_component", 19 20672 : getBinnedVelocityComponentEnum(), 20 : "Direction in which to evaluate velocity when 'field = velocity_component.' " 21 : "Options: user (you then need to specify a direction with 'velocity_direction'); normal"); 22 10336 : return params; 23 0 : } 24 : 25 3448 : NekFieldInterface::NekFieldInterface(const MooseObject * moose_object, 26 : const InputParameters & parameters, 27 3448 : const bool allow_normal_velocity) 28 6896 : : _field(moose_object->getParam<MooseEnum>("field").getEnum<field::NekFieldEnum>()), 29 6896 : _velocity_component(moose_object->getParam<MooseEnum>("velocity_component") 30 : .getEnum<component::BinnedVelocityComponentEnum>()) 31 : { 32 : // check that this field can be used given the problem parameters 33 3448 : nekrs::checkFieldValidity(_field); 34 : 35 3441 : if (_field == field::velocity_component) 36 : { 37 116 : switch (_velocity_component) 38 : { 39 : case component::user: 40 198 : checkRequiredParam(parameters, "velocity_direction", "using 'velocity_component = user'"); 41 : 42 297 : _velocity_direction = geom_utils::unitVector( 43 : moose_object->getParam<Point>("velocity_direction"), "velocity_direction"); 44 : 45 99 : break; 46 17 : case component::normal: 47 17 : if (!allow_normal_velocity) 48 0 : mooseError("This object does not support 'velocity_component = normal'! Please contact " 49 : "the Cardinal development team if this is hindering your use case."); 50 : 51 34 : checkUnusedParam(parameters, "velocity_direction", "using 'velocity_component = normal'"); 52 17 : break; 53 0 : default: 54 0 : mooseError("Unhandled BinnedVelocityComponentEnum!"); 55 : } 56 : } 57 : else 58 : { 59 6650 : checkUnusedParam(parameters, "velocity_direction", "not using 'field = velocity_component'"); 60 6650 : checkUnusedParam(parameters, "velocity_component", "not using 'field = velocity_component'"); 61 : } 62 3441 : } 63 : #endif