https://mooseframework.inl.gov
CostSensitivity.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 
10 #include "CostSensitivity.h"
11 
12 registerMooseObject("OptimizationApp", CostSensitivity);
13 
16 {
18  params.addClassDescription("Computes cost sensitivity needed for multimaterial SIMP method.");
19  params.addRequiredCoupledVar("design_density", "Design density variable name.");
20  params.addRequiredParam<MaterialPropertyName>("cost",
21  "DerivativeParsedMaterial for cost of materials.");
22  return params;
23 }
24 
27  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
28  _sensitivity(declareProperty<Real>(_base_name + "cost_sensitivity")),
29  _design_density(coupledValue("design_density")),
30  _design_density_name(coupledName("design_density", 0)),
31  _dcostdrho(getMaterialPropertyDerivativeByName<Real>(getParam<MaterialPropertyName>("cost"),
32  _design_density_name)),
33  _cost(getMaterialPropertyByName<Real>(getParam<MaterialPropertyName>("cost")))
34 {
35 }
36 
37 void
39 {
40  _sensitivity[_qp] = _current_elem->volume() * _cost[_qp] +
42 }
const MaterialProperty< Real > & _dcostdrho
Derivative of the cost with respect to the pseudo-density variable.
static InputParameters validParams()
virtual void computeQpProperties() override
void addRequiredParam(const std::string &name, const std::string &doc_string)
const MaterialProperty< Real > & _cost
Cost material property.
static InputParameters validParams()
MaterialProperty< Real > & _sensitivity
The cost sensitivity material generated by this object.
const VariableValue & _design_density
Pseudo-density variable.
Computes the cost sensitivity for SIMP optimization algorithms that consider a cost constraint...
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
CostSensitivity(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
registerMooseObject("OptimizationApp", CostSensitivity)