https://mooseframework.inl.gov
Loading...
Searching...
No Matches
VectorPostprocessorVisualizationAux.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{
18
19 params.addClassDescription("Read values from a VectorPostprocessor that is producing vectors "
20 "that are 'number of processors' * in length. Puts the value for "
21 "each processor into an elemental auxiliary field.");
22
23 params.addRequiredParam<VectorPostprocessorName>(
24 "vpp", "The name of the VectorPostprocessor to pull the data from.");
25 params.addRequiredParam<std::string>(
26 "vector_name", "The name of the vector to use from the VectorPostprocessor");
27
28 params.addParam<bool>("use_broadcast",
29 false,
30 "Causes this AuxKernel to use a broadcasted version of the vector instead "
31 "of a scattered version of the vector (the default). This is slower - but "
32 "is useful for debugging and testing");
33
34 return params;
35}
36
38 const InputParameters & parameters)
39 : AuxKernel(parameters),
40 _use_broadcast(getParam<bool>("use_broadcast")),
41 _vpp_scatter(getScatterVectorPostprocessorValue("vpp", getParam<std::string>("vector_name"))),
42 _vpp_vector(
43 getVectorPostprocessorValue("vpp", getParam<std::string>("vector_name"), _use_broadcast)),
44 _my_pid(processor_id())
45{
46}
47
48void
50{
51 if (_my_pid == 0 && _vpp_vector.size() != n_processors())
52 mooseError("Error in AuxKernel ",
53 name(),
54 ". Vector ",
55 getParam<std::string>("vector_name"),
56 " in VectorPostprocessor ",
57 getParam<VectorPostprocessorName>("vpp"),
58 " does not contain num_procs number of entries. num_procs: ",
60 " num_entries: ",
61 _vpp_vector.size());
62}
63
64Real
66{
68 {
69 mooseAssert(_vpp_vector.size() > _my_pid,
70 "Vector does not contain enough entries in VectorPostprocessorVisualization named "
71 << name());
72 return _vpp_vector[_my_pid];
73 }
74 return _vpp_scatter;
75}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObject("MooseApp", VectorPostprocessorVisualizationAux)
static InputParameters validParams()
Definition AuxKernel.C:27
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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...
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.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
Read values from a VectorPostprocessor that is producing vectors that are "number of processors" in l...
const ScatterVectorPostprocessorValue & _vpp_scatter
Holds the values we want to display.
virtual Real computeValue() override
Get the value from the vector and assign it to the element.
bool _use_broadcast
Whether or not we're using a broadcast (replicated) vector.
VectorPostprocessorVisualizationAux(const InputParameters &parameters)
const VectorPostprocessorValue & _vpp_vector
Holds the values we want to display.
virtual void timestepSetup() override
Note: this used for error checking.
processor_id_type n_processors() const