Skip to content

fix(thermoelastic)!: enforce volume fraction as a constraint, not an objective - #280

Open
mkeeler43 wants to merge 1 commit into
mainfrom
fix/thermoelastic-volfrac-constraint
Open

mkeeler43 wants to merge 1 commit into
mainfrom
fix/thermoelastic-volfrac-constraint

Conversation

@mkeeler43

Copy link
Copy Markdown
Contributor

Implements the follow-up agreed in the 22.07 discussion on #256.

Why

The thermoelastic problems reported the volume-fraction error as a third objective. It is not something to minimize. It is a feasibility check. Beams2D and HeatConduction already handle it through the constraint API, and this PR brings Thermoelastic2D and Thermoelastic3D in line.

The two problems also disagreed with each other. Thermoelastic2D called the target volume_fraction_target, while every other volume-constrained problem calls it volfrac. Thermoelastic3D stored the actual volume fraction in its dataset column but returned the error from simulate() under the same name.

What changes

  • Objectives. Both problems now have two objectives: structural and thermal compliance. The volume error is gone from objectives, from the simulate() output and from each OptiStep.
  • Constraint. Thermoelastic2D, Thermoelastic3D and Beams3D gain volume_fraction_bound, copied from Beams2D. It raises a warning when the design's mean density misses the target by more than 0.01.
  • Naming. The Thermoelastic2D condition is renamed to volfrac.
  • Datasets. The problems point at thermoelastic_2d_v2 and thermoelastic_3d_v1. These are clerical copies of the current datasets. Nothing is recomputed. Thermoelastic2D renames one column and drops volume_fraction_error. Thermoelastic3D drops volume_fraction.
  • Cleanup. The Beams3D solver no longer computes an unused volume error.

Versioning

The meeting decided not to bump versions. I changed that after checking how datasets load. Renaming a condition column in place would break every released EngiBench, because datasets load at their latest revision. So this PR uses new dataset repos and keeps the problem version at 0. This follows the Thermoelastic2D precedent, where problem v0 already points at dataset v1.

Breaking

  • simulate() returns two values instead of three for both thermoelastic problems.
  • OptiStep.obj_values has two entries instead of three.
  • Thermoelastic2D code that passes volume_fraction_target must pass volfrac.

Checks

Every stored design in both thermoelastic datasets meets its target. The worst miss is 8e-5, so the new warning does not fire on dataset designs. The Beams3D test and validation splits were checked the same way, with a worst miss of 5e-5.

The two simulate reference files keep their first two values unchanged. The code that computes them did not change.

Pre-commit passes. The constraint, problem, Beams3D and Thermoelastic3D unit tests pass: 29 passed, 12 deselected. The deselected tests run the solver or load datasets.

Blocked on

The two new dataset repos do not exist yet. The dataset tests and the full test_python_problem_impl run will fail until they are pushed. The relabel job is written and verifies every kept column against the pinned source before uploading.

🤖 Generated with Claude Code

…objective

Thermoelastic2D and Thermoelastic3D reported the volume-fraction error as a
third objective. It is a feasibility check, so it now lives in the constraint
API, as it does in Beams2D and HeatConduction.

- Drop the volume error from objectives, simulate() and every OptiStep.
- Add volume_fraction_bound (warning, tolerance 0.01) to Thermoelastic2D,
  Thermoelastic3D and Beams3D, copied from Beams2D.
- Rename the Thermoelastic2D condition volume_fraction_target to volfrac, the
  name the other volume-constrained problems use.
- Point at thermoelastic_2d_v2 and thermoelastic_3d_v1. These are clerical
  copies of the current datasets with the volume columns renamed or dropped.
- Remove the unused volume error from the Beams3D solver.

BREAKING CHANGE: simulate() returns two values for the thermoelastic problems,
and the Thermoelastic2D condition is now volfrac.

Refs #256

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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