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 "ElementOptimizationDiffusionCoefFunctionInnerProduct.h" 11 : 12 : registerMooseObject("OptimizationApp", ElementOptimizationDiffusionCoefFunctionInnerProduct); 13 : 14 : InputParameters 15 242 : ElementOptimizationDiffusionCoefFunctionInnerProduct::validParams() 16 : { 17 242 : InputParameters params = ElementOptimizationFunctionInnerProduct::validParams(); 18 242 : params.addClassDescription( 19 : "Compute the gradient for material inversion by taking the inner product of gradients of the " 20 : "forward and adjoint variables with material gradient"); 21 : 22 484 : params.addRequiredCoupledVar("forward_variable", "Variable from the forward solution"); 23 242 : return params; 24 0 : } 25 : 26 122 : ElementOptimizationDiffusionCoefFunctionInnerProduct:: 27 122 : ElementOptimizationDiffusionCoefFunctionInnerProduct(const InputParameters & parameters) 28 : : ElementOptimizationFunctionInnerProduct(parameters), 29 122 : _grad_adjoint(coupledGradient("variable")), 30 244 : _grad_forward(coupledGradient("forward_variable")) 31 : { 32 122 : } 33 : 34 : Real 35 1522816 : ElementOptimizationDiffusionCoefFunctionInnerProduct::computeQpInnerProduct() 36 : { 37 1522816 : return -_grad_adjoint[_qp] * _grad_forward[_qp]; 38 : }