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 26 : NekViscousSurfaceForce::validParams() 27 : { 28 26 : InputParameters params = NekSidePostprocessor::validParams(); 29 52 : MooseEnum comp("x y z total", "total"); 30 52 : 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 26 : params.addClassDescription("Viscous force that the fluid exerts on a surface"); 36 26 : return params; 37 26 : } 38 : 39 9 : NekViscousSurfaceForce::NekViscousSurfaceForce(const InputParameters & parameters) 40 18 : : NekSidePostprocessor(parameters), _component(getParam<MooseEnum>("component")) 41 : { 42 9 : 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 8 : 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 8 : } 52 : 53 : Real 54 804 : NekViscousSurfaceForce::getValue() const 55 : { 56 804 : if (_component == "total") 57 : { 58 804 : nrs_t * nrs = (nrs_t *)nekrs::nrsPtr(); 59 804 : auto o_Sij = platform->o_memPool.reserve<dfloat>(2 * nrs->NVfields * nrs->fieldOffset); 60 804 : postProcessing::strainRate(nrs, true, nrs->o_U, o_Sij); 61 : 62 804 : occa::memory o_b = platform->device.malloc<int>(_boundary.size(), _boundary.data()); 63 804 : const auto drag = postProcessing::viscousDrag(nrs, _boundary.size(), o_b, o_Sij); 64 804 : o_Sij.free(); 65 804 : return drag; 66 804 : } 67 : else 68 0 : mooseError("x, y, and z components of viscous drag not currently supported. Please contact " 69 : "developers if this is affecting your analysis needs."); 70 : } 71 : 72 : #endif