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 "NekVolumeIntegral.h" 22 : 23 : registerMooseObject("CardinalApp", NekVolumeIntegral); 24 : 25 : InputParameters 26 1853 : NekVolumeIntegral::validParams() 27 : { 28 1853 : InputParameters params = NekFieldPostprocessor::validParams(); 29 1853 : params.addClassDescription("Integral of a field over the NekRS volume mesh"); 30 1853 : return params; 31 0 : } 32 : 33 615 : NekVolumeIntegral::NekVolumeIntegral(const InputParameters & parameters) 34 615 : : NekFieldPostprocessor(parameters) 35 : { 36 615 : } 37 : 38 : Real 39 6754 : NekVolumeIntegral::volume() const 40 : { 41 6754 : switch (_pp_mesh) 42 : { 43 52 : case nek_mesh::fluid: 44 52 : return nekrs::volume(nek_mesh::fluid); 45 6690 : case nek_mesh::all: 46 6690 : return nekrs::volume(nek_mesh::all); 47 12 : case nek_mesh::solid: 48 12 : return nekrs::volume(nek_mesh::all) - nekrs::volume(nek_mesh::fluid); 49 0 : default: 50 0 : mooseError("Unhandled NekMeshEnum in volume()!"); 51 : } 52 : } 53 : 54 : Real 55 10474 : NekVolumeIntegral::getValue() const 56 : { 57 10474 : switch (_pp_mesh) 58 : { 59 104 : case nek_mesh::fluid: 60 104 : return getIntegralOnMesh(nek_mesh::fluid); 61 10346 : case nek_mesh::all: 62 10346 : return getIntegralOnMesh(nek_mesh::all); 63 24 : case nek_mesh::solid: 64 24 : return getIntegralOnMesh(nek_mesh::all) - getIntegralOnMesh(nek_mesh::fluid); 65 0 : default: 66 0 : mooseError("Unhandled NekMeshEnum in getValue()!"); 67 : } 68 : } 69 : 70 : Real 71 10498 : NekVolumeIntegral::getIntegralOnMesh(const nek_mesh::NekMeshEnum & mesh) const 72 : { 73 10498 : Real vol = nekrs::volume(mesh); 74 : 75 10498 : if (_field == field::velocity_component) 76 : { 77 16 : Real vx = nekrs::volumeIntegral(field::velocity_x, vol, mesh); 78 16 : Real vy = nekrs::volumeIntegral(field::velocity_y, vol, mesh); 79 16 : Real vz = nekrs::volumeIntegral(field::velocity_z, vol, mesh); 80 : Point velocity(vx, vy, vz); 81 : return _velocity_direction * velocity; 82 : } 83 : 84 10482 : return nekrs::volumeIntegral(_field, vol, mesh); 85 : } 86 : 87 : #endif