https://mooseframework.inl.gov
DensityUpdateTwoConstraints.h
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 #pragma once
11 
12 #include "ElementUserObject.h"
13 #include "MooseTypes.h"
14 
20 {
21 public:
23 
25 
26  virtual void initialize() override{};
27  virtual void timestepSetup() override;
28  virtual void execute() override;
29  virtual void finalize() override{};
30  virtual void threadJoin(const UserObject &) override{};
31 
32 protected:
34  const MooseMesh & _mesh;
36  const VariableName _design_density_name;
38  const VariableName _density_sensitivity_name;
39  const VariableName _cost_density_sensitivity_name;
40  const VariableName _cost_name;
42 
54  // Relative tolerance used to stop the two-variable bisection method.
56  // Weights to solve a dual physics problem, e.g. a thermomechanical one.
57  std::vector<Real> _weight_values;
58 
59 private:
60  struct ElementData
61  {
69 
70  ElementData() = default;
72  Real dens, Real sens, Real cost_sens, Real thermal_sens, Real cst, Real vol, Real filt_dens)
73  : old_density(dens),
74  sensitivity(sens),
75  cost_sensitivity(cost_sens),
76  thermal_sensitivity(thermal_sens),
77  cost(cst),
78  volume(vol),
79  new_density(filt_dens)
80  {
81  }
82  };
83 
87  void gatherElementData();
91  void performOptimCritLoop();
92 
93  Real computeUpdatedDensity(Real current_density,
94  Real dc,
95  Real cost_sensitivity,
96  Real thermal_sensitivity,
97  Real cost,
98  Real lmid,
99  Real cmid);
100 
103 
106 
108  std::map<dof_id_type, ElementData> _elem_data_map;
109 
117  const bool _adaptive_move;
122 };
Real computeUpdatedDensity(Real current_density, Real dc, Real cost_sensitivity, Real thermal_sensitivity, Real cost, Real lmid, Real cmid)
std::map< dof_id_type, ElementData > _elem_data_map
Data structure to hold old density, sensitivity, volume, current density.
const MooseWritableVariable * _cost_density_sensitivity
The filtered density sensitivity variable (cost)
Element user object that performs SIMP optimization using a bisection algorithm applying a volume con...
const VariableName _cost_density_sensitivity_name
const MooseWritableVariable * _density_sensitivity
The filtered density sensitivity variable (elasticity)
const Real _cost_fraction
The cost fraction to be enforced.
Real _total_allowable_volume
Total volume allowed for volume contraint.
static InputParameters validParams()
const VariableName _design_density_name
The name of the pseudo-density variable.
const VariableName _density_sensitivity_name
The elasticity compliance sensitivity name.
const Real _bisection_move
Bisection algorithm move.
VariableName _thermal_sensitivity_name
Thermal compliance sensitivity name.
void performOptimCritLoop()
Performs the optimality criterion loop (bisection)
const Real _upper_bound
Upper bound for bisection algorithm.
const Real _lower_bound
Lower bound for bisection algorithm.
Real _total_allowable_cost
Total volume allowed for cost contraint.
MooseVariable * _thermal_sensitivity
Thermal compliance variable.
const MooseVariable & _cost
The cost variable.
MooseWritableVariable * _design_density
The pseudo-density variable.
const MooseMesh & _mesh
The system mesh.
DensityUpdateTwoConstraints(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const bool _adaptive_move
Whether bisection moves are adaptive.
const InputParameters & parameters() const
virtual void threadJoin(const UserObject &) override
ElementData(Real dens, Real sens, Real cost_sens, Real thermal_sens, Real cst, Real vol, Real filt_dens)
const Real _volume_fraction
The volume fraction to be enforced.
void gatherElementData()
Gathers element date necessary to perform the bisection algorithm for optimization.