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 "AdjointStrainSymmetricStressGradInnerProduct.h" 11 : 12 : registerMooseObject("OptimizationApp", AdjointStrainSymmetricStressGradInnerProduct); 13 : 14 : InputParameters 15 0 : AdjointStrainSymmetricStressGradInnerProduct::validParams() 16 : { 17 0 : InputParameters params = ElementOptimizationFunctionInnerProduct::validParams(); 18 0 : params.addClassDescription( 19 : "This component is designed to compute the gradient of the objective function concerning " 20 : "specific properties. It achieves this by computing the inner product of the property " 21 : "derivative obtained a material property and the strain resulting from the forward " 22 : "simulation."); 23 0 : params.addRequiredParam<MaterialPropertyName>( 24 : "stress_derivative_name", "The name of the stress derivative material property"); 25 0 : params.addRequiredParam<MaterialPropertyName>( 26 : "adjoint_strain_name", "Name of the strain property in the adjoint problem"); 27 0 : return params; 28 0 : } 29 : 30 0 : AdjointStrainSymmetricStressGradInnerProduct::AdjointStrainSymmetricStressGradInnerProduct( 31 0 : const InputParameters & parameters) 32 : : ElementOptimizationFunctionInnerProduct(parameters), 33 0 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""), 34 0 : _stress_derivative(getMaterialPropertyByName<SymmetricRankTwoTensor>( 35 : getParam<MaterialPropertyName>("stress_derivative_name"))), 36 0 : _adjoint_strain(getMaterialPropertyByName<RankTwoTensor>( 37 0 : getParam<MaterialPropertyName>("adjoint_strain_name"))) 38 : { 39 0 : } 40 : 41 : Real 42 0 : AdjointStrainSymmetricStressGradInnerProduct::computeQpInnerProduct() 43 : { 44 0 : auto derivative = RankTwoTensor(_stress_derivative[_qp]); 45 0 : return -_adjoint_strain[_qp].doubleContraction(derivative); 46 : }