Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
SideValueSampler.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 
10 #include "SideValueSampler.h"
11 
12 // MOOSE includes
13 #include "MooseVariableFE.h"
14 
15 #include "libmesh/quadrature.h"
16 
18 
21 {
23  params += SamplerBase::validParams();
24  params.addClassDescription("Sample variable(s) along a sideset, internal or external.");
25  params.addRequiredCoupledVar(
26  "variable", "The names of the variables that this VectorPostprocessor operates on");
27 
28  return params;
29 }
30 
32  : SideVectorPostprocessor(parameters), SamplerBase(parameters, this, _communicator)
33 {
34  std::vector<std::string> var_names(_coupled_moose_vars.size());
35  _values.resize(_coupled_moose_vars.size());
36 
37  for (unsigned int i = 0; i < _coupled_moose_vars.size(); i++)
38  {
39  var_names[i] = _coupled_moose_vars[i]->name();
41  }
42 
43  // Initialize the data structures in SamplerBase
44  SamplerBase::setupVariables(var_names);
45 }
46 
47 void
49 {
51 }
52 
53 void
55 {
56  for (unsigned int _qp = 0; _qp < _qrule->n_points(); _qp++)
57  {
58  for (unsigned int i = 0; i < _coupled_moose_vars.size(); i++)
59  _values[i] = (dynamic_cast<MooseVariable *>(_coupled_moose_vars[i]))->sln()[_qp];
60 
62  }
63 }
64 
65 void
67 {
69 }
70 
71 void
73 {
74  const auto & vpp = static_cast<const SideValueSampler &>(y);
75 
77 }
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
Definition: SamplerBase.h:36
virtual void initialize()
Initialize the datastructures.
Definition: SamplerBase.C:77
SideValueSampler(const InputParameters &parameters)
std::vector< Real > _values
So we don&#39;t have to create and destroy this vector over and over again.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
const MooseArray< Point > & _q_point
virtual void finalize() override
Finalize the values.
void setupVariables(const std::vector< std::string > &variable_names)
You MUST call this in the constructor of the child class and pass down the name of the variables...
Definition: SamplerBase.C:53
unsigned int _qp
virtual void threadJoin(const SamplerBase &y)
Join the values.
Definition: SamplerBase.C:174
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
static InputParameters validParams()
Definition: SamplerBase.C:24
registerMooseObject("MooseApp", SideValueSampler)
std::vector< MooseVariableFieldBase * > _coupled_moose_vars
Vector of all coupled variables.
Definition: Coupleable.h:1412
virtual void finalize()
Finalize the values.
Definition: SamplerBase.C:120
virtual void addSample(const Point &p, const Real &id, const std::vector< Real > &values)
Call this with the value of every variable at each point you want to sample at.
Definition: SamplerBase.C:63
const QBase *const & _qrule
virtual void threadJoin(const UserObject &y) override
Must override.
virtual void execute() override
Execute method.
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 Elem *const & _current_elem
void checkForStandardFieldVariableType(const MooseVariableFieldBase *const var_ptr, const std::string &var_param_name="variable") const
Checks whether the passed variable pointer corresponds to a regular single-valued field variable...
Definition: SamplerBase.C:93
virtual void initialize() override
Initialize the datastructures.
Base class for user-specific data.
Definition: UserObject.h:39