https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MassFluxWeightedFlowRate.C
Go to the documentation of this file.
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
11#include "MathFVUtils.h"
13#include "NSFVUtils.h"
14#include "NS.h"
16
17#include <math.h>
18
20
23{
25 params.addRequiredParam<MooseFunctorName>("density",
26 "Provide a functor that returns the density.");
27 params.addClassDescription("Computes the mass flux weighted average of the quantity "
28 "provided by advected_quantity over a boundary.");
29 return params;
30}
31
33 : VolumetricFlowRate(parameters), _density(getFunctor<ADReal>("density")), _mdot(0)
34{
36 mooseError("This object only works only with finite volume.");
37
38 checkFunctorSupportsSideIntegration<ADReal>("density", _qp_integration);
39}
40
41void
47
48Real
50{
51 mooseAssert(fi, "We should have a face info in " + name());
52 mooseAssert(_adv_quant, "We should have an advected quantity in " + name());
53 const auto state = determineState();
54
55 // Get face value for velocity
57 _velocity_interp_method, *fi, state, _tid, /*subtract_mesh_velocity=*/true));
58 const bool correct_skewness =
59 _advected_interp_method == Moose::FV::InterpMethod::SkewCorrectedAverage;
60
61 mooseAssert(_adv_quant->hasFaceSide(*fi, true) || _adv_quant->hasFaceSide(*fi, true),
62 "Advected quantity must be defined on one of the sides of the face!");
63 mooseAssert((_adv_quant->hasFaceSide(*fi, true) == _density.hasFaceSide(*fi, true)) ||
64 (_adv_quant->hasFaceSide(*fi, false) == _density.hasFaceSide(*fi, false)),
65 "Density must be defined at least on one of the sides where the advected quantity is "
66 "defined!");
67
68 const auto face_arg =
71 face_flux > 0,
72 correct_skewness,
73 _adv_quant->hasFaceSide(*fi, true) ? fi->elemPtr() : fi->neighborPtr(),
74 nullptr});
75 auto dens = _density(face_arg, state);
76 const auto adv_quant_face = MetaPhysicL::raw_value(dens * (*_adv_quant)(face_arg, state));
77 _mdot += fi->faceArea() * fi->faceCoord() * MetaPhysicL::raw_value(dens) * face_flux;
78 return face_flux * adv_quant_face;
79}
80
81void
83{
85 const auto & pps = static_cast<const MassFluxWeightedFlowRate &>(y);
86 _mdot += pps._mdot;
87}
88
89Real
94
95void
DualNumber< Real, DNDerivativeType, true > ADReal
const std::vector< double > y
registerMooseObject("NavierStokesApp", MassFluxWeightedFlowRate)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
This postprocessor computes the mass-flux weighted average of a flow quantity over a boundary,...
virtual void finalize() override
virtual void threadJoin(const UserObject &y) override
static InputParameters validParams()
const Moose::Functor< ADReal > & _density
density provided as functor
Real _mdot
the mass flow rate over the face computed by this object
virtual Real computeFaceInfoIntegral(const FaceInfo *fi) override
virtual void initialize() override
virtual Real getValue() const override
MassFluxWeightedFlowRate(const InputParameters &parameters)
const std::string & name() const
void mooseError(Args &&... args) const
virtual Real getVolumetricFaceFlux(const Moose::FV::InterpMethod m, const FaceInfo &fi, const Moose::StateArg &time, const THREAD_ID tid, bool subtract_mesh_velocity) const =0
Retrieve the volumetric face flux, will not include derivatives.
virtual void threadJoin(const UserObject &y) override
virtual void initialize() override
virtual void finalize() override
Moose::StateArg determineState() const
void gatherSum(T &value)
This postprocessor computes the volumetric flow rate through a boundary, internal or external to the ...
static InputParameters validParams()
Moose::FV::InterpMethod _velocity_interp_method
The interpolation method to use for the velocity.
Moose::FV::InterpMethod _advected_interp_method
The interpolation method to use for the advected quantity.
const RhieChowFaceFluxProvider *const _rc_uo
The Rhie-Chow interpolation user object.
const Moose::Functor< ADReal > *const _adv_quant
The functor representing the advected quantity for finite volume.
auto raw_value(const Eigen::Map< T > &in)
LimiterType limiterType(InterpMethod interp_method)