Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OptApp] Simp with the filtering factory #12149

Conversation

sunethwarna
Copy link
Member

📝 Description
This PR introduces a SIMP control which uses the Filter::Factory for topologiy optimization.

🆕 Changelog

  • Added SIMP control
  • Added tests

@sunethwarna sunethwarna self-assigned this Mar 5, 2024
@sunethwarna sunethwarna changed the base branch from master to optapp/filtering/create_filtering_factory March 5, 2024 17:22
Copy link
Member

@Igarizza Igarizza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

…g_factory' into optapp/simp_with_filtering_factory
self.beta = min(self.beta * self.beta_increase_frac, self.beta_max)
Kratos.Logger.PrintInfo(f"::{self.GetName()}::", f"Increased beta to {self.beta}.")

def __ApplyDensityAndYoungsModulus(self) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are updating the density and you modulus i recommend to name the function UpdateDensityAndYoungModulus

if not IsSameContainerExpression(control_field, self.GetEmptyField()):
raise RuntimeError(f"Updates for the required element container not found for control \"{self.GetName()}\". [ required model part name: {self.model_part.FullName()}, given model part name: {control_field.GetModelPart().FullName()} ]")

if Kratos.Expression.Utils.NormL2(self.phi - control_field) > 1e-15:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is mistaken. Since phi is control field we are checking if it is updated or not and then we have to reset phi wi th the new control field and then filter phi/new control field and then project. but currently phi is reset with the filtered phi which is a mistake

raise RuntimeError(f"Updates for the required element container not found for control \"{self.GetName()}\". [ required model part name: {self.model_part.FullName()}, given model part name: {control_field.GetModelPart().FullName()} ]")

if Kratos.Expression.Utils.NormL2(self.phi - control_field) > 1e-15:
self.phi = self.filter.FilterField(control_field)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.phi = self.filter.FilterField(control_field)
self.phi = control_field
filtered_phi = self.filter.FilterField(self.phi)

@sunethwarna
Copy link
Member Author

Closing because this is moved to #12328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants