Skip to content

feat: implement Robin boundary conditions (convection) for thermal optimization#228

Open
rainerrodrigues wants to merge 2 commits into
JuliaTopOpt:masterfrom
rainerrodrigues:feature/thermal-quad4-element
Open

feat: implement Robin boundary conditions (convection) for thermal optimization#228
rainerrodrigues wants to merge 2 commits into
JuliaTopOpt:masterfrom
rainerrodrigues:feature/thermal-quad4-element

Conversation

@rainerrodrigues

Copy link
Copy Markdown

…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)

@rainerrodrigues rainerrodrigues marked this pull request as ready for review June 1, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant