https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowPointFluxQuantity.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
13
16{
19 "Records the flux at each Dirac point of a PorousFlow line sink (such as "
20 "PorousFlowPeacemanBorehole or PorousFlowPolyLineSink). Use a "
21 "PorousFlowPlotPointFluxQuantity VectorPostprocessor to output the recorded values.");
22 return params;
23}
24
29
30void
31PorousFlowPointFluxQuantity::zero(const std::vector<Real> & xs,
32 const std::vector<Real> & ys,
33 const std::vector<Real> & zs)
34{
35 _fluxes.assign(xs.size(), 0.0);
36 _xs = xs;
37 _ys = ys;
38 _zs = zs;
39}
40
41void
42PorousFlowPointFluxQuantity::add(std::size_t i, Real contrib)
43{
44 _fluxes[i] += contrib;
45}
46
47void
51
52void
56
57void
59{
60 // Each Dirac point is evaluated by exactly one processor (DiracKernelBase::addPoint ignores
61 // points in elements owned by other processors), so every point's flux is nonzero on at most
62 // one processor and a simple element-wise sum gathers the whole line sink. However, the point
63 // count itself is only guaranteed to agree across processors for point_file/reporter-defined
64 // geometries; a line_base geometry on a distributed mesh can, in principle, produce a
65 // different point count per processor, so guard against that before summing.
66 std::size_t num_pts = _fluxes.size();
67 gatherMax(num_pts);
68 if (num_pts != _fluxes.size())
69 mooseError("PorousFlowPointFluxQuantity: the number of line-sink points differs between "
70 "processors (this processor has ",
71 _fluxes.size(),
72 ", another has ",
73 num_pts,
74 "). This can happen when a line sink is defined using line_base on a distributed "
75 "mesh: try mesh_mode = replicated.");
76
78}
registerMooseObject("PorousFlowApp", PorousFlowPointFluxQuantity)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const
Records the instantaneous flux at each Dirac point of a PorousFlow line sink (such as PorousFlowPeace...
std::vector< Real > _fluxes
The flux at each point of the line sink, indexed by Dirac point ID.
void zero(const std::vector< Real > &xs, const std::vector< Real > &ys, const std::vector< Real > &zs)
Resets the flux recorded at every point to zero, and records the current point coordinates.
PorousFlowPointFluxQuantity(const InputParameters &parameters)
void add(std::size_t i, Real contrib)
Adds contrib to the flux recorded at point i.
virtual void finalize() override
Sums the per-point fluxes over all processors.
std::vector< Real > _xs
Coordinates of each point of the line sink, indexed by Dirac point ID.
virtual void initialize() override
Does nothing.
virtual void execute() override
Does nothing.
void gatherSum(T &value)
void gatherMax(T &value)