feat: implement Robin boundary conditions (convection) for thermal optimization#228
Open
rainerrodrigues wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…timization
Summary
This PR introduces convective boundary conditions (Newton's Law of Cooling) to HeatConductionProblem, enabling more realistic thermal topology optimization (e.g., modeling heat sinks cooled by ambient air).
Highlights:
Surface Integral Assembly: Implemented assemble_convection_matrix using Ferrite's FaceScalarValues and QuadratureRule{dim-1} to evaluate the boundary integral for convection.
Zero-Cost Solver Injection: Updated the GenericFEASolver call operator to inject the constant convection matrix into the global stiffness matrix. This is done via in-place mutation (K_data[row, col] += val) to perfectly preserve Ferrite.jl's matrix pre-allocations and safely maintain the Symmetric type wrapper. Due to dispatch on Physics === HeatTransfer, this adds zero runtime overhead to structural problems.
Type-Stable Struct Expansion: Added a parameterized convectiondict field to HeatConductionProblem to map boundary names to their heat transfer coefficient and ambient temperature (h, T_inf). The constructor defaults to an empty dictionary, ensuring complete backwards compatibility with existing scripts.
Minor changes:
Added getconvectiondict fallback and specific getter methods.
Updated module exports in TopOptProblems.jl and imports in FEA.jl to properly expose the new assembly logic.
What type of change is this?
[ ] Bug fix in a backwards-compatible manner.
[x] New feature in a backwards-compatible manner.
[ ] Breaking change: bug fix or new feature that involve incompatible API changes.
[ ] Other (e.g. doc update, configuration, etc)
Checklist
[x] I ran all tests on my computer and it's all green (i.e. ] test).
[ ] I have added tests that prove my fix is effective or that my feature works.
[ ] I have added necessary documentation (if appropriate)