Line data Source code
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 "SideOptimizationFunctionInnerProduct.h" 11 : 12 : InputParameters 13 90 : SideOptimizationFunctionInnerProduct::validParams() 14 : { 15 90 : InputParameters params = SideVectorPostprocessor::validParams(); 16 90 : params += OptimizationFunctionInnerProductHelper::validParams(); 17 180 : params.addRequiredCoupledVar( 18 : "variable", "Variable used for inner product calculation, usually the adjoint variable."); 19 90 : return params; 20 0 : } 21 : 22 45 : SideOptimizationFunctionInnerProduct::SideOptimizationFunctionInnerProduct( 23 45 : const InputParameters & parameters) 24 : : SideVectorPostprocessor(parameters), 25 : OptimizationFunctionInnerProductHelper(parameters), 26 45 : _var(coupledValue("variable")), 27 90 : _vec(declareVector("inner_product")) 28 : { 29 45 : } 30 : 31 : void 32 972 : SideOptimizationFunctionInnerProduct::initialize() 33 : { 34 972 : setCurrentTime(_t, _dt); 35 972 : } 36 : 37 : void 38 12960 : SideOptimizationFunctionInnerProduct::execute() 39 : { 40 38880 : for (_qp = 0; _qp < _qrule->n_points(); ++_qp) 41 : { 42 25920 : const Real q_inner_product = _JxW[_qp] * _coord[_qp] * computeQpInnerProduct(); 43 25920 : update(_q_point[_qp], q_inner_product); 44 : } 45 12960 : } 46 : 47 : void 48 0 : SideOptimizationFunctionInnerProduct::threadJoin(const UserObject & y) 49 : { 50 : const auto & vpp = static_cast<const SideOptimizationFunctionInnerProduct &>(y); 51 0 : add(vpp); 52 0 : } 53 : 54 : void 55 972 : SideOptimizationFunctionInnerProduct::finalize() 56 : { 57 972 : getVector(_vec); 58 972 : }