https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LayeredIntegralBase.h
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
10#pragma once
11
13#include "LayeredBase.h"
14#include "InputParameters.h"
15
19template <typename UserObjectType>
20class LayeredIntegralBase : public SpatialUserObjectFunctor<UserObjectType>, public LayeredBase
21{
22public:
24
26
32 virtual Real spatialValue(const Point & p) const override { return integralValue(p); }
33
34 virtual const std::vector<Point> spatialPoints() const override;
35
36 virtual void initialize() override;
37 virtual void execute() override;
38 virtual void finalize() override;
39 virtual void threadJoin(const UserObject & y) override;
40
41protected:
42 using UserObjectType::_current_elem;
43 using UserObjectType::computeIntegral;
44};
45
46template <typename UserObjectType>
54
55template <typename UserObjectType>
57 : SpatialUserObjectFunctor<UserObjectType>(parameters), LayeredBase(parameters)
58{
59 if (parameters.isParamValid("block") && parameters.isParamValid("boundary"))
60 mooseError("Both block and boundary cannot be specified for a layered integral user object. If "
61 "you want to define the geometric bounds of the layers from a specified block set "
62 "layer_bounding_block instead.");
63}
64
65template <typename UserObjectType>
66void
68{
69 UserObjectType::initialize();
71}
72
73template <typename UserObjectType>
74void
76{
77 const auto integral_value = computeIntegral();
78
79 const auto layer = getLayer(_current_elem->vertex_average());
80
81 setLayerValue(layer, getLayerValue(layer) + integral_value);
82}
83
84template <typename UserObjectType>
85void
90
91template <typename UserObjectType>
92void
94{
95 UserObjectType::threadJoin(y);
97}
98
99template <typename UserObjectType>
100const std::vector<Point>
102{
103 std::vector<Point> points;
104
105 for (const auto & l : _layer_centers)
106 {
107 Point pt(0.0, 0.0, 0.0);
108 pt(_direction) = l;
109 points.push_back(pt);
110 }
111
112 return points;
113}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another,...
This base class computes volume integrals of a variable storing partial sums for the specified number...
Definition LayeredBase.h:37
virtual void threadJoin(const UserObject &y)
virtual Real integralValue(const Point &p) const
Given a Point return the integral value associated with the layer that point falls in.
static InputParameters validParams()
Definition LayeredBase.C:22
virtual void finalize()
virtual void initialize()
Base class for computing layered side integrals.
virtual Real spatialValue(const Point &p) const override
Given a Point return the integral value associated with the layer that point falls in.
virtual void initialize() override
virtual void threadJoin(const UserObject &y) override
virtual const std::vector< Point > spatialPoints() const override
LayeredIntegralBase(const InputParameters &parameters)
static InputParameters validParams()
virtual void finalize() override
virtual void execute() override
Base class for creating a user object with the SpatialUserObject and Moose::Functor APIs.
static InputParameters validParams()
Base class for user-specific data.
Definition UserObject.h:20