https://mooseframework.inl.gov
SideOptimizationFunctionInnerProduct.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 
14 {
17  params.addRequiredCoupledVar(
18  "variable", "Variable used for inner product calculation, usually the adjoint variable.");
19  return params;
20 }
21 
23  const InputParameters & parameters)
24  : SideVectorPostprocessor(parameters),
26  _var(coupledValue("variable")),
27  _vec(declareVector("inner_product"))
28 {
29 }
30 
31 void
33 {
35 }
36 
37 void
39 {
40  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
41  {
42  const Real q_inner_product = _JxW[_qp] * _coord[_qp] * computeQpInnerProduct();
43  update(_q_point[_qp], q_inner_product);
44  }
45 }
46 
47 void
49 {
50  const auto & vpp = static_cast<const SideOptimizationFunctionInnerProduct &>(y);
51  add(vpp);
52 }
53 
54 void
56 {
57  getVector(_vec);
58 }
void update(const Point &q_point, Real q_inner_product)
Accumulates integration for inner product by multiplying the given value by the function&#39;s parameterG...
void setCurrentTime(Real time, Real dt)
This function sets up member variables for the inner product accumulation at certain time...
void add(const OptimizationFunctionInnerProductHelper &other)
Accumulates inner product integration in _curr_time_ip vector from another object.
VectorPostprocessorValue & _vec
Vector holding inner product.
const MooseArray< Point > & _q_point
const std::vector< double > y
const MooseArray< Real > & _JxW
virtual Real computeQpInnerProduct()=0
Used to compute the inner product at a certain quadrature point.
static InputParameters validParams()
const MooseArray< Real > & _coord
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void getVector(std::vector< Real > &result)
Gathers _curr_time_ip from other processors and performs time integration.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const QBase *const & _qrule
SideOptimizationFunctionInnerProduct(const InputParameters &parameters)
virtual void threadJoin(const UserObject &uo) override final