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] Unify filtering mechanisms using FilterFactory #12201

Merged
merged 92 commits into from
Apr 2, 2024

Conversation

sunethwarna
Copy link
Member

@sunethwarna sunethwarna commented Mar 18, 2024

📝 Description
This PR unifies the filters used in OptApp to one factory, and updates the controls to use the filtering. Following major changes were made:

Explicit Filtering

  1. There is no need to have seperate DampingFunction anymore because, I unified all the filter functions including sigmoidal function. Now all of them can be used either as filter or damping. Following figure shows the filter functions: (May be in future, we can have seperate settings for these functions, so we can tweak some of the coeffs used in these filter functions).
    image

  2. Now damping diagonal matrix is specified externally as an Expression. So this allows creating damping matrices with different mechanisms. Hence, the signature to the ComputeWeightForAllNeighbors changed. This does not have additional performance impact. Because, earlier also we used two KDTrees, one for fitlering, one for damping. This is still the same.

VertexMorphinShapeControl

Now uses the Filter::FilterFactory to get the filter. It allows following combinations:

  • Explicit filtering without mesh motion (in case of shell surface optimization)
  • Explicit filtering with mesh motion (in case of design surface optimization with volume elements)
  • Implicit filtering without mesh motion (in case of shell surface optimization)
  • Implicit filtering with mesh motion (in case of design surface optimization with volume elements)
  • Implicit filtering without mesh motion for design surface optimization with volume elements

ShellThicknessControl

  1. physical_phi_field is kept and updated to support filtering based on the deltas.
  2. control_phi_field is computed from the Unfilter method as in the vm_shape_control.
  3. Uses the fitler factory to create filters
  4. Shell thickness is also now filters only the $\underline{\Delta p}_i$ instead of the absolute control space values and correctly does the update in the physical space using $\underline{s}_0$ .
  5. The updating is correctly done using the $\underline{s}_0$
  6. Damping is applied as zero values in implcit becuase, now filtering is only done on $\underline{\Delta p}_i$, then damped model part regions should have $\underline{\Delta s}_i = 0$ which is the Dirichlet BC for system of equations. Advantage of this uniform damping in implicit case is, then user can have any arbitray function applied for the physical space variable in the damped region.

Followings are the test cases which I ran (can be found in https://github.com/KratosMultiphysics/Examples/tree/master/optimization_application/use_cases):
comparison_shape_only
comparison_shape_thickness
shape_only_comparison

Damping comparison:
damping_comparison

all_damping_comp

🆕 Changelog

  • Removed damping function
  • Renamed explicit_filter to explicit_filter_utils
  • Unified the filter function behaviour to be used with filters and damping
  • Added ContainerExpressionUtils::ExtractData to extract data from an expression with a given model part where the model part from expression and the given model part differ.
  • Added OptimizationUtils::GetComponentWiseModelParts to extract model parts from parameters on which the boundary conditions are applied
  • Updated VertexMorphingShapeControl to use the new Filter::Factory
  • Updated ShellThicknessControl to use the new Filter::Factory
  • Implemented Filter::GetBoundaryConditions to get the boundary conditions used in the filter
  • Implemented ExplicitFilter
  • Implemented ImplicitFilter
  • Added tests

… into optapp/filters/unify_filters_with_factory
… into optapp/filters/unify_filters_with_factory
… into optapp/filters/unify_filters_with_factory
… into optapp/filters/unify_filters_with_factory
… into optapp/filters/unify_filters_with_factory
@sunethwarna sunethwarna requested a review from Igarizza March 21, 2024 11:02
@sunethwarna
Copy link
Member Author

Hi @RezaNajian , @Igarizza , could you have a look at this?

@RezaNajian
Copy link
Contributor

@sunethwarna thanks, very good !

@sunethwarna sunethwarna merged commit 544e268 into master Apr 2, 2024
11 checks passed
@sunethwarna sunethwarna deleted the optapp/filters/unify_filters_with_factory branch April 2, 2024 07:19
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