Skip to content

Comments

Objective.compute_scalar independent of grid resolution#484

Merged
f0uriest merged 39 commits intomasterfrom
dd/obj_res
Sep 12, 2023
Merged

Objective.compute_scalar independent of grid resolution#484
f0uriest merged 39 commits intomasterfrom
dd/obj_res

Conversation

@ddudt
Copy link
Collaborator

@ddudt ddudt commented Apr 10, 2023

This PR attempts to resolve most of the problems raised in Issue #482. Most importantly, it makes sure that all objectives with "local" errors now have their compute_scalar values roughly independent of the grid resolution, both when normalized and not.

These changes also have Objective.normalization now only used to make the values dimensionless; it removes the need to reference Objective.dim_f in the compute logic.

Also updates Objective.print_value to print the min/max/mean of the error instead of just the total, and uses abs error when target is 0, and only prints total error for linear objectives (assumed they're used as exactly satisfied constraints so we don't need lots of details). A

Printing should also be more intuitive, printing the actual value of the aspect ratio, volume etc rather than the error.

Resolves #482
Resolves #589

@f0uriest
Copy link
Member

Another thing to possibly consider here:
for the constrained optimization it seems to work best if force is used as an inequality rather than equality constraint, but its not necessarily obvious what the bounds should be in physical units. I would be nice if everything worked out such that we could easily give the bounds in normalized units, ie, I want normalized force < 1e-3 everywhere. That might require some extra logic with different numbers of nodes etc.

@dpanici dpanici mentioned this pull request Aug 15, 2023
@f0uriest
Copy link
Member

f0uriest commented Aug 18, 2023

Can we make a separate PR for all the alphabetization stuff? Doing it here messes up the diff and makes it hard to see what actually changed.

@ddudt
Copy link
Collaborator Author

ddudt commented Aug 18, 2023

Can we make a separate PR for all the alphabetization stuff? Doing it here messes up the diff and makes it hard to see what actually changed.

Yes, but you specifically said at the last dev meeting to just start alphabetizing as we edit files for other reasons...

@f0uriest
Copy link
Member

Can we make a separate PR for all the alphabetization stuff? Doing it here messes up the diff and makes it hard to see what actually changed.

Yes, but you specifically said at the last dev meeting to just start alphabetizing as we edit files for other reasons...

yeah that was my bad, I forgot that git sometimes doesn't recognize what changed in the most intuitive way.

@f0uriest f0uriest marked this pull request as ready for review September 10, 2023 00:51
@codecov
Copy link

codecov bot commented Sep 10, 2023

Codecov Report

Merging #484 (44211ac) into master (6b478c7) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #484      +/-   ##
==========================================
+ Coverage   94.43%   94.52%   +0.08%     
==========================================
  Files          79       79              
  Lines       18497    18417      -80     
==========================================
- Hits        17467    17408      -59     
+ Misses       1030     1009      -21     
Files Changed Coverage Δ
desc/objectives/_bootstrap.py 97.50% <100.00%> (-0.42%) ⬇️
desc/objectives/_equilibrium.py 96.92% <100.00%> (+2.01%) ⬆️
desc/objectives/_generic.py 97.72% <100.00%> (+1.02%) ⬆️
desc/objectives/_geometry.py 97.84% <100.00%> (+4.29%) ⬆️
desc/objectives/_profiles.py 96.61% <100.00%> (-1.51%) ⬇️
desc/objectives/_qs.py 97.35% <100.00%> (+0.92%) ⬆️
desc/objectives/_stability.py 98.71% <100.00%> (+4.32%) ⬆️
desc/objectives/objective_funs.py 96.77% <100.00%> (+0.23%) ⬆️

... and 4 files with indirect coverage changes

f0uriest
f0uriest previously approved these changes Sep 11, 2023
Copy link
Collaborator

@dpanici dpanici left a comment

Choose a reason for hiding this comment

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

do we want a changelog entry for this?

dpanici
dpanici previously approved these changes Sep 12, 2023
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.

printing objective sum of squares error Objective weights/normalizations

4 participants