Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "MfrPostprocessor.h" 11 : #include "MooseMesh.h" 12 : #include "libmesh/elem.h" 13 : 14 : registerMooseObject("NavierStokesApp", MfrPostprocessor); 15 : 16 : InputParameters 17 0 : MfrPostprocessor::validParams() 18 : { 19 0 : InputParameters params = SideIntegralPostprocessor::validParams(); 20 0 : params.addClassDescription("Object for outputting boundary mass fluxes in conjunction with " 21 : "FVFluxBC derived objects that support it"); 22 0 : return params; 23 0 : } 24 : 25 0 : MfrPostprocessor::MfrPostprocessor(const InputParameters & parameters) 26 0 : : SideIntegralPostprocessor(parameters) 27 : { 28 0 : } 29 : 30 : Real 31 0 : MfrPostprocessor::computeQpIntegral() 32 : { 33 0 : mooseError("We should never call this"); 34 : } 35 : 36 : void 37 0 : MfrPostprocessor::setMfr(const FaceInfo * const fi, const Real mfr, const bool includes_area) 38 : { 39 0 : _fi_to_mfr[fi] = mfr * (includes_area ? Real(1) : (fi->faceArea() * fi->faceCoord())); 40 0 : } 41 : 42 : Real 43 0 : MfrPostprocessor::computeIntegral() 44 : { 45 0 : const FaceInfo * fi = _mesh.faceInfo(_current_elem, _current_side); 46 0 : if (!fi) 47 : { 48 0 : const Elem * const neighbor = _current_elem->neighbor_ptr(_current_side); 49 : mooseAssert(neighbor, 50 : "If current elem doesn't own a FaceInfo then there must be a neighbor who does."); 51 0 : const auto neigh_side = neighbor->which_neighbor_am_i(_current_elem); 52 0 : fi = _mesh.faceInfo(neighbor, neigh_side); 53 : mooseAssert(fi, "We must have found a FaceInfo by now"); 54 : } 55 : auto it = _fi_to_mfr.find(fi); 56 : mooseAssert(it != _fi_to_mfr.end(), "We should have found the FaceInfo"); 57 0 : return it->second; 58 : }