https://mooseframework.inl.gov
Loading...
Searching...
No Matches
DomainUserObject.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
12// MOOSE includes
13#include "UserObject.h"
14#include "BlockRestrictable.h"
17#include "TransientInterface.h"
18#include "RandomInterface.h"
19#include "ElementIDInterface.h"
20#include "MooseError.h"
21
23
24namespace libMesh
25{
26class Elem;
27class QBase;
28}
29
43 public BlockRestrictable,
46 public TransientInterface,
47 public RandomInterface,
49{
50public:
52
54
55 void execute() override final;
56
60 virtual void executeOnElement() {}
61
65 virtual void executeOnBoundary() {}
66
70 virtual void executeOnInternalSide() {}
71
75 virtual void executeOnExternalSide(const Elem * /*elem*/, unsigned int /*side*/) {}
76
80 virtual void executeOnInterface() {}
81
86
91
96
101
105 bool shouldExecuteOnInterface() const;
106
107 void checkVariable(const MooseVariableFieldBase & variable) const override;
108
109protected:
110 const MooseArray<Point> & qPoints() const { return *_current_q_point; }
111 const QBase & qRule() const { return *_current_q_rule; }
112 const MooseArray<Real> & JxW() const { return *_current_JxW; }
113 const MooseArray<Real> & coord() const { return _coord; }
114 const MooseArray<Point> & normals() const { return _normals; }
115
128 getInterfaceFieldVar(const std::string & var_name,
129 unsigned int comp,
130 const std::set<BoundaryID> * interfaces = nullptr);
131
134
136 const Elem * const & _current_elem;
137
140
143 const unsigned int & _current_side;
144
147 const Elem * const & _current_side_elem;
148
152
154 const Elem * const & _neighbor_elem;
155
159
162
166
168 std::set<BoundaryID> _interface_bnd_ids;
169
171 std::map<BoundaryID, std::set<SubdomainID>> _interface_connected_blocks;
172
173private:
174 void setVolumeData();
175
176 void setFaceData();
177
181 const QBase * _current_q_rule;
184
188 const QBase * const & _qrule;
191
195 const QBase * const & _qrule_face;
198
202
204 std::map<VariableName, std::set<BoundaryID>> _var_interfaces;
205};
206
207inline void
209{
210 mooseError("Users of DomainUserObjects should call "
211 "executeOnElement/executeOnBoundary/executeOnInternalSide");
212}
213
214inline void
219
220inline void
225
226inline void
231
232inline void
237
238inline void
245
246inline void
253
254inline bool
boundary_id_type BoundaryID
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
An interface that restricts an object to subdomains via the 'blocks' input parameter.
This user object allows related evaluations on elements, boundaries, internal sides,...
std::set< BoundaryID > _interface_bnd_ids
The set of boundary IDs on which this object should perform executeOnInterface.
const MooseArray< Point > & _q_point_face
The quadrature points in physical space used on the element side/face.
const Elem *const & _current_side_elem
Current side of the current element (available during executeOnInternalSide() and executeOnBoundary()...
std::map< VariableName, std::set< BoundaryID > > _var_interfaces
A map storing the set of boundaries where variables we wish to evaluate.
bool shouldExecuteOnInterface() const
Return whether this object should run executeOnInterface.
const MooseArray< Point > & qPoints() const
virtual void executeOnBoundary()
execute method that is called during ComputeUserObjects::onBoundary
const MooseArray< Real > & _JxW
The elemental Jacobian times quadrature weights in the element interior.
const Real & _current_elem_volume
The current element volume (available during all execute functions)
virtual void executeOnExternalSide(const Elem *, unsigned int)
execute method that is called during ComputeUserObjects::onExternalSide
virtual void executeOnElement()
execute method that is called during ComputeUserObjects::onElement
const QBase * _current_q_rule
A pointer to the current volume/face quadrature rule.
const QBase *const & _qrule_face
The quadrature rule used on the element side/face.
const MooseArray< Real > & _JxW_face
The side element Jacobian times quadrature weights on the element side/face.
const BoundaryID & _current_boundary_id
The boundary ID (available during executeOnBoundary() and executeOnInterface())
const MooseArray< Real > & coord() const
std::map< BoundaryID, std::set< SubdomainID > > _interface_connected_blocks
The set of blocks connected to our blocks through boundaries of the _interface_bnd_ids data member.
void checkVariable(const MooseVariableFieldBase &variable) const override
Helper for checking that the ids for this object are in agreement with the variables on the supplied ...
const MooseArray< Point > * _current_q_point
A pointer to the current volume/face quadrature points.
void preExecuteOnElement()
method that is called right before executeOnElement; sets the data to volumetric
const QBase *const & _qrule
The quadrature rule used in the element interior.
const MooseArray< Real > * _current_JxW
A pointer to the current JxW.
const Real & _current_neighbor_volume
the neighboring element's volume (available during executeOnInternalSide() and executeOnInterface())
const Elem *const & _current_elem
The current element pointer (available during all execute functions)
const Real & _current_side_volume
Current side volume (available during executeOnInternalSide() and executeOnBoundary() and executeOnIn...
const MooseArray< Real > & _coord
An array representing coordinate system volume modifications.
void preExecuteOnInternalSide()
method that is called right before executeOnInternalSide; sets the data to face
MooseMesh & _mesh
the Moose mesh
const Elem *const & _neighbor_elem
The neighboring element (available during executeOnInternalSide() and executeOnInterface())
void preExecuteOnBoundary()
method that is called right before executeOnBoundary; sets the data to face
static InputParameters validParams()
const MooseArray< Point > & normals() const
virtual void executeOnInterface()
execute method that is called during ComputeUserObjects::onInterface
const MooseArray< Point > & _normals
The unit norm at quadrature points on the element side/face from the current element perpendicular to...
void execute() override final
Execute method.
const MooseArray< Point > & _q_point
The quadrature points in physical space used in the element interior.
const MooseVariableFieldBase * getInterfaceFieldVar(const std::string &var_name, unsigned int comp, const std::set< BoundaryID > *interfaces=nullptr)
Routes through to Coupleable::getFieldVar, but also inserts the return variable into a set of field v...
void preExecuteOnInterface()
method that is called right before executeOnInterface; sets the data to face
virtual void executeOnInternalSide()
execute method that is called during ComputeUserObjects::onInternalSide
const unsigned int & _current_side
Current side of the current element (available during executeOnInternalSide() and executeOnBoundary()...
const MooseArray< Real > & JxW() const
const QBase & qRule() const
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
forward declarations
Definition MooseArray.h:18
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
This class provides an interface for common operations on field variables of both FE and FV types wit...
Intermediate base class that ties together all the interfaces for getting MooseVariables with the Moo...
Interface for objects that need parallel consistent random numbers without patterns over the course o...
This interface is designed currently for DomainUserObject where material properties on element,...
Interface for objects that needs transient capabilities.
Base class for user-specific data.
Definition UserObject.h:20
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...