-
Notifications
You must be signed in to change notification settings - Fork 637
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
Filters for periodic design patterns #2465
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2465 +/- ##
==========================================
+ Coverage 73.25% 73.82% +0.57%
==========================================
Files 17 17
Lines 5212 5269 +57
==========================================
+ Hits 3818 3890 +72
+ Misses 1394 1379 -15
|
After restoring Python 3.7:
Python 3.10:
|
Just split the off-by-one changes to a separate PR. |
ddedd0c
to
dcab372
Compare
dcab372
to
d8d3a66
Compare
This PR also makes lengthscale constraint functions applicable to 2d periodic design patterns. The new test in |
eta_d = 1 - eta_e | ||
beta, eta = 10, 0.5 | ||
radius, c = 0.3, 400 | ||
places = 18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems way too low (smaller than machine precision). Are you sure this test is actually doing anything with the tolerance set so low?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By making the tolerance so low it's basically checking that the value is invariant to machine precision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I agree that the places
should probably be smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mawc2019 says that the absolute magnitude of the constraint functions is about 1e-4
, so this is asking it to match to 14 digits. So this is okay, but I would reduce it to places=16
just to be safe.
This PR makes the 2d filters in
filters.py
applicable to periodic 2d designs, where the design pattern is periodic in x, y, or both x and y directions. Incylindrical_filter
,conic_filter
, andgaussian_filter
, and the periodicity is specified by a new argumentperiodic_axes
, whose value can be0
,1
,(0,1)
, orNone
.In most cases where the filter diameter is not larger than the size of the input design pattern, extra padding along the periodic axis is simply not added before convolution. If the filter diameter is larger than the size of the input design pattern along a periodic axis, before convolution, the design pattern is duplicated along that axis so that the resultant design pattern along that axis is not smaller than the filter diameter.
The change in those filter functions also makes
constraint_solid
andconstraint_void
applicable to periodic 2d designs.By the way, the missing
+1
in calculating the array size for the material grid is restored in this PR.