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 320 : ElementOptimizationDiffusionCoefFunctionInnerProduct::validParams() 16 : { 17 320 : InputParameters params = ElementOptimizationFunctionInnerProduct::validParams(); 18 320 : 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 640 : params.addRequiredCoupledVar("forward_variable", "Variable from the forward solution"); 23 320 : return params; 24 0 : } 25 : 26 160 : ElementOptimizationDiffusionCoefFunctionInnerProduct:: 27 160 : ElementOptimizationDiffusionCoefFunctionInnerProduct(const InputParameters & parameters) 28 : : ElementOptimizationFunctionInnerProduct(parameters), 29 160 : _grad_adjoint(coupledGradient("variable")), 30 320 : _grad_forward(coupledGradient("forward_variable")) 31 : { 32 160 : } 33 : 34 : Real 35 2276544 : ElementOptimizationDiffusionCoefFunctionInnerProduct::computeQpInnerProduct() 36 : { 37 2276544 : return -_grad_adjoint[_qp] * _grad_forward[_qp]; 38 : }