www.mooseframework.org
GhostingAux.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 "GhostingAux.h"
11 #include "GhostingUserObject.h"
12 
13 registerMooseObject("MooseApp", GhostingAux);
14 
16 
19 {
21 
22  params.addRequiredParam<processor_id_type>("pid", "The PID to see the ghosting for");
23 
24  MooseEnum functor_type("geometric algebraic", "geometric");
25  params.addParam<MooseEnum>("functor_type", functor_type, "The type of ghosting functor to use");
26 
27  params.addParam<bool>("include_local_elements",
28  false,
29  "Whether or not to include local elements as part of the ghosting set");
30 
31  params.addRequiredParam<UserObjectName>(
32  "ghost_uo", "The GhostUserObject from which to obtain ghosting information from.");
33 
34  params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
35 
36  params.addClassDescription("Colors the elements ghosted to the chosen PID.");
37  return params;
38 }
39 
41  : AuxKernel(parameters),
42  _pid(getParam<processor_id_type>("pid")),
43  _rm_type(getParam<MooseEnum>("functor_type") == "geometric"
44  ? Moose::RelationshipManagerType::GEOMETRIC
45  : Moose::RelationshipManagerType::ALGEBRAIC),
46  _include_local(getParam<bool>("include_local_elements")),
47  _value(0.),
48  _ghost_uo(getUserObject<GhostingUserObject>("ghost_uo"))
49 {
50  if (isNodal())
51  mooseError("GhostingAux only works on elemental fields.");
52 }
53 
54 void
56 {
57  if (_current_elem->processor_id() == _pid && _include_local)
58  _value = 1;
59  else if (_current_elem->processor_id() != _pid)
61  else
62  _value = 0.;
63 }
64 
65 Real
67 {
68  return _value;
69 }
Moose
Definition: Moose.h:116
MooseObject::mooseError
void mooseError(Args &&... args) const
Definition: MooseObject.h:141
GhostingAux::_ghost_uo
const GhostingUserObject & _ghost_uo
The reference to the ghosting user object.
Definition: GhostingAux.h:46
MooseEnum
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
InputParameters::addParam
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object.
Definition: InputParameters.h:1198
GhostingAux::precalculateValue
virtual void precalculateValue() override
This callback is used for AuxKernelTempls that need to perform a per-element calculation.
Definition: GhostingAux.C:55
AuxKernelTempl
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:35
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
InputParameters::set
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Definition: InputParameters.h:987
GhostingUserObject::getElementalValue
Real getElementalValue(const Elem *elem, Moose::RelationshipManagerType rm_type, processor_id_type pid) const
Definition: GhostingUserObject.C:96
GhostingAux::_rm_type
Moose::RelationshipManagerType _rm_type
The type of ghosting functor to get.
Definition: GhostingAux.h:37
GhostingUserObject
This object loops over all of the underlying ghosting functors added by libMesh or MOOSE through Rela...
Definition: GhostingUserObject.h:31
Moose::RelationshipManagerType
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:852
AuxKernelTempl::_current_elem
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition: AuxKernel.h:208
InputParameters::addClassDescription
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.
Definition: InputParameters.C:70
GhostingAux::_pid
processor_id_type _pid
The PID to show the ghosting for.
Definition: GhostingAux.h:34
EXEC_TIMESTEP_END
const ExecFlagType EXEC_TIMESTEP_END
GhostingAux.h
GhostingUserObject.h
AuxKernelTempl::validParams
static InputParameters validParams()
Definition: AuxKernel.C:28
AuxKernelTempl::isNodal
bool isNodal() const
Nodal or elemental kernel?
Definition: AuxKernel.h:89
GhostingAux::GhostingAux
GhostingAux(const InputParameters &parameters)
Definition: GhostingAux.C:40
GhostingAux
Definition: GhostingAux.h:22
registerMooseObject
registerMooseObject("MooseApp", GhostingAux)
EXEC_INITIAL
const ExecFlagType EXEC_INITIAL
GhostingAux::validParams
static InputParameters validParams()
Definition: GhostingAux.C:18
GhostingAux::_include_local
bool _include_local
Whether or not to include local elements in the display field.
Definition: GhostingAux.h:40
GhostingAux::computeValue
virtual Real computeValue() override
Compute and return the value of the aux variable.
Definition: GhostingAux.C:66
defineLegacyParams
defineLegacyParams(GhostingAux)
ExecFlagEnum
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:24
GhostingAux::_value
Real _value
precalculated element value
Definition: GhostingAux.h:43
InputParameters::addRequiredParam
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
Definition: InputParameters.h:1176