www.mooseframework.org
LayeredIntegral.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "LayeredIntegral.h"
11 
12 #include "libmesh/mesh_tools.h"
13 
15 
18 {
20  params += LayeredBase::validParams();
21  params.addClassDescription("Compute variable integrals over layers.");
22 
23  return params;
24 }
25 
27  : ElementIntegralVariableUserObject(parameters), LayeredBase(parameters)
28 {
29 }
30 
31 void
33 {
36 }
37 
38 void
40 {
41  Real integral_value = computeIntegral();
42 
43  unsigned int layer = getLayer(_current_elem->vertex_average());
44 
45  setLayerValue(layer, getLayerValue(layer) + integral_value);
46 }
47 
48 void
50 {
52 }
53 
54 void
56 {
59 }
60 
61 const std::vector<Point>
63 {
64  std::vector<Point> points;
65 
66  for (const auto & l : _layer_centers)
67  {
68  Point pt(0.0, 0.0, 0.0);
69  pt(_direction) = l;
70  points.push_back(pt);
71  }
72 
73  return points;
74 }
This UserObject computes volume integrals of a variable storing partial sums for the specified number...
registerMooseObject("MooseApp", LayeredIntegral)
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
virtual const std::vector< Point > spatialPoints() const override
Optional interface function for providing the points at which a UserObject attains spatial values...
static InputParameters validParams()
Definition: LayeredBase.C:22
std::vector< Real > _layer_centers
center coordinates of each layer
Definition: LayeredBase.h:133
virtual void threadJoin(const UserObject &y)
Definition: LayeredBase.C:339
unsigned int _direction
The component direction the layers are going in. We cache this for speed (so we&#39;re not always going t...
Definition: LayeredBase.h:112
virtual void execute() override
Execute method.
virtual void initialize() override
virtual Real getLayerValue(unsigned int layer) const
Get the value for a given layer.
Definition: LayeredBase.C:293
void setLayerValue(unsigned int layer, Real value)
Set the value for a particular layer.
Definition: LayeredBase.C:407
virtual void initialize()
Definition: LayeredBase.C:301
virtual void finalize()
Definition: LayeredBase.C:314
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Elem *const & _current_elem
The current element pointer (available during execute())
virtual unsigned int getLayer(Point p) const
Helper function to return the layer the point lies in.
Definition: LayeredBase.C:348
This base class computes volume integrals of a variable storing partial sums for the specified number...
Definition: LayeredBase.h:36
virtual void threadJoin(const UserObject &y) override
This postprocessor computes a volume integral of the specified variable.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
LayeredIntegral(const InputParameters &parameters)
Base class for user-specific data.
Definition: UserObject.h:39
virtual void threadJoin(const UserObject &y) override
Must override.
virtual void finalize() override