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 "NekViscousSurfaceForce.h" 22 : 23 : registerMooseObject("CardinalApp", NekViscousSurfaceForce); 24 : 25 : InputParameters 26 181 : NekViscousSurfaceForce::validParams() 27 : { 28 181 : InputParameters params = NekSidePostprocessor::validParams(); 29 362 : MooseEnum comp("x y z total", "total"); 30 362 : params.addParam<MooseEnum>( 31 : "component", 32 : comp, 33 : "Component of viscous force to compute. 'total' takes the magnitude of the viscous force, " 34 : "while 'x', 'y', or 'z' return individual components."); 35 181 : params.addClassDescription("Viscous force that the fluid exerts on a surface"); 36 181 : return params; 37 181 : } 38 : 39 54 : NekViscousSurfaceForce::NekViscousSurfaceForce(const InputParameters & parameters) 40 108 : : NekSidePostprocessor(parameters), _component(getParam<MooseEnum>("component")) 41 : { 42 54 : if (_pp_mesh != nek_mesh::fluid) 43 1 : mooseError("The 'NekViscousSurfaceForce' postprocessor can only be applied to the fluid mesh " 44 : "boundaries!\n" 45 : "Please change 'mesh' to 'fluid'."); 46 : 47 53 : if (_nek_problem->nondimensional()) 48 0 : mooseError("The NekViscousSurfaceForce object is missing the implementation to convert the " 49 : "non-dimensional viscous drag to dimensional form. Please contact the developers if " 50 : "this is impacting your analysis."); 51 53 : } 52 : 53 : Real 54 848 : NekViscousSurfaceForce::getValue() const 55 : { 56 848 : auto drag = nekrs::viscousDrag(_boundary); 57 : 58 848 : if (_component == "total") 59 812 : return std::sqrt(drag[0] * drag[0] + drag[1] * drag[1] + drag[2] * drag[2]); 60 36 : else if (_component == "x") 61 12 : return drag[0]; 62 24 : else if (_component == "y") 63 12 : return drag[1]; 64 12 : else if (_component == "z") 65 12 : return drag[2]; 66 : else 67 0 : mooseError("Unknown 'component' in NekViscousSurfaceForce!"); 68 848 : } 69 : 70 : #endif