20 "Compute updated densities based on sensitivities using an optimality criteria method to " 21 "keep the volume constraint satisified.");
24 "Name of the density_sensitivity variable.");
26 params.
addParam<
Real>(
"bisection_lower_bound", 0,
"Lower bound for the bisection algorithm.");
27 params.
addParam<
Real>(
"bisection_upper_bound", 1e16,
"Upper bound for the bisection algorithm.");
33 _mesh(_subproblem.
mesh()),
34 _density_sensitivity_name(getParam<VariableName>(
"density_sensitivity")),
35 _design_density(&writableVariable(
"design_density")),
36 _density_sensitivity(&_subproblem.getStandardVariable(_tid, _density_sensitivity_name)),
37 _volume_fraction(getParam<
Real>(
"volume_fraction")),
38 _lower_bound(getParam<
Real>(
"bisection_lower_bound")),
39 _upper_bound(getParam<
Real>(
"bisection_upper_bound"))
42 paramError(
"design_density",
"Design density must be a finite element variable");
66 mooseError(
"Element data not found for the current element id.");
76 for (
const auto & sub_id :
blockIDs())
77 for (
const auto & elem :
_mesh.
getMesh().active_local_subdomain_elements_ptr_range(sub_id))
83 ->getElementalValue(elem),
100 bool perform_loop =
true;
105 Real lmid = 0.5 * (l2 + l1);
108 Real curr_total_volume = 0;
115 elem_data.new_density = new_density;
117 curr_total_volume += new_density * elem_data.volume;
131 perform_loop = (l2 - l1) / (l1 + l2) > 1e-3;
143 Real updated_density = std::max(
146 std::min(current_density + move,
147 std::max(current_density - move,
148 std::max(1e-5, current_density) * std::sqrt(-dc / lmid)))));
150 return updated_density;
const Real _upper_bound
Upper bound for bisection algorithm.
Real computeUpdatedDensity(Real current_density, Real dc, Real lmid)
Real _total_allowable_volume
Total volume allowed for volume contraint.
const Real _volume_fraction
The volume fraction to be enforced.
static InputParameters validParams()
Element user object that performs SIMP optimization using a bisection algorithm using a volume constr...
const Real _lower_bound
Lower bound for bisection algorithm.
void gatherElementData()
Gathers element date necessary to perform the bisection algorithm for optimization.
MooseWritableVariable * _design_density
The pseudo-density variable.
virtual void execute() override
const MooseWritableVariable * _density_sensitivity
The filtered density sensitivity variable.
const Parallel::Communicator & _communicator
virtual const std::set< SubdomainID > & blockIDs() const
registerMooseObject("OptimizationApp", DensityUpdate)
static InputParameters validParams()
void paramError(const std::string ¶m, Args... args) const
virtual void timestepSetup() override
void performOptimCritLoop()
Performs the optimality criterion loop (bisection)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Elem *const & _current_elem
DensityUpdate(const InputParameters ¶meters)
void mooseError(Args &&... args) const
std::map< dof_id_type, ElementData > _elem_data_map
Data structure to hold old density, sensitivity, volume, current density.
const MooseMesh & _mesh
The system mesh.