Skip to content

Custom GrowthRatios and more Schedule variables #94

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

Merged
merged 59 commits into from
Jan 8, 2025

Conversation

DavidAnderegg
Copy link
Contributor

@DavidAnderegg DavidAnderegg commented Sep 4, 2024

Purpose

This PR adds the ability to set custom growth ratios on each layer. Additionally, more 'schedule' variables are introduced.

This PR adjusts how some options work. Apart from prescribing a single value, it is now possible to define a list with per-layer values. Additionally, it is possible to instruct pyHyp to interpolate the value linearly throughout the extrusion.

This PR removes the volSmoothSchedule variable as the same functionality is now possible with volSmoothIter.

Lastly, a new variable growthRatios is introduced to explicitly set the growth ratio. If it is set, the marchDist option is ignored. This variable works like the other changes introduce here.

Expected time until merged

1 week

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature) - volSmoothSchedule is now obsolete and was removed
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

I adjusted the naca0012_rans and corner test to include an 'interpolation' and a 'per-layer' case. I also added a test for nConstantStart and nConstantEnd options. And finally, i added a test for simpleOCart with xBounds and no nearfield mesh.

Here are the new ref-files for the new tests: schedule_ref_files.zip

Here are the new ref-files for the new tests: refFiles.zip

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@DavidAnderegg DavidAnderegg requested a review from a team as a code owner September 4, 2024 13:41
@eirikurj
Copy link
Contributor

eirikurj commented Sep 4, 2024

@DavidAnderegg thanks for the PR. Will try to take a look as soon as I can. In the meantime, can you address the failing tests.

@DavidAnderegg
Copy link
Contributor Author

@eirikurj The tests fail because new the ref files have not been added. I attached a .zip in the description of this PR.

@eirikurj
Copy link
Contributor

eirikurj commented Sep 4, 2024

My bad, I only read the description in a rush and saw the test are failing. I can update the reference files. I skimmed the PR content, and it looks good, but will do a more thorough pass later.
I think it would be good if we can combine or refactor the RANS scripts to avoid code duplication. They are essentially all the same except for a few options. I suggest one of the two,

  1. refactor the geometry generation out into its own file that can be imported or run.
  2. use argparse with argument mode (or similar) to run each case and just update the relevant options based on the mode. This will have a smaller footprint.

@eirikurj
Copy link
Contributor

eirikurj commented Sep 4, 2024

I have updated the files. However, in line with my previous comment on refactoring the scripts I updated the names and inserted rans in the files i.e.,

naca0012_growth_ratios.cgns -> naca0012_rans_growth_ratios.cgns
naca0012_schedule.cgns      -> naca0012_rans_schedule.cgns

To avoid nightly builds failing, I named the archive with the updated files is pyhyp_ref_files_2024-09-04.tar.gz. You can update the script to pull this archive instead for testing. Once ready I will update the main.

@anilyil
Copy link
Contributor

anilyil commented Nov 25, 2024

@DavidAnderegg, does the new files break old tests or did you only add new files for the new tests? if we are not breaking any of the existing tests, I can upload the ref files now. If they break existing tests, we can attempt to do it within the same day we plan on merging the PR

@DavidAnderegg
Copy link
Contributor Author

@anilyil The new ref files do break the old tests. This is because I extended the 'corner' case. So I suggest you wait with updating until the day this PR gets merged.

@anilyil anilyil requested a review from eirikurj December 6, 2024 17:20
Copy link
Contributor

@eirikurj eirikurj left a comment

Choose a reason for hiding this comment

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

All the changes look good, see my comments for just a few clarifications.
The new reference archive attached was missing the naca0012_rans_schedule.cgns file. In order to get this merged as soon as possible, I just created this file and updated and uploaded the reference archive pyhyp_ref_files_20241210.tar.gz to our servers. I have pulled this archive locally and the tests pass.
However, this process is annoying and to avoid this issue of failing tests on GH due to reference files not up-to-date, we can just change get-ref-files.sh to point to the dated reference file. This is a better long term strategy as this allows current and new reference files and we dont need to change anything once merged.

@DavidAnderegg
Copy link
Contributor Author

@eirikurj I am sorry for the missing ref-file, I did not realize it... I addressed the comments that were clear. I also changed get-ref-files.sh to point towards pyhyp_ref_files_20241210.tar.gz.

Please let me know what you think regarding the not resolved points.

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 7 lines in your changes missing coverage. Please review.

Project coverage is 83.64%. Comparing base (a161009) to head (9d0dc94).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pyhyp/pyHyp.py 96.02% 6 Missing ⚠️
pyhyp/utils.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #94      +/-   ##
==========================================
+ Coverage   79.24%   83.64%   +4.39%     
==========================================
  Files           4        4              
  Lines         424      538     +114     
==========================================
+ Hits          336      450     +114     
  Misses         88       88              
Flag Coverage Δ
?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DavidAnderegg
Copy link
Contributor Author

DavidAnderegg commented Dec 12, 2024

Regarding the failed tests. This is very strange to me. Everything passes except for test_all_examples.py:TestExamples.testCorner . To further add to the confusion, this test also passes on u22-gcc-ompi-latest but fails on the other 3 images. I can reproduce this error locally, but I am a bit lost on how to debug it. Any suggestions are welcome...

Edit:
When i run the underlying file runCorner.py manually, the output is the same. But when this exact file is called from the test, the result is slightly different. I cant reproduce this, back to square 1...

@anilyil anilyil requested review from anilyil and eirikurj December 18, 2024 09:23
anilyil
anilyil previously approved these changes Dec 18, 2024
significant figures rounding could for large numbers.
@anilyil anilyil self-requested a review December 20, 2024 09:48
anilyil
anilyil previously approved these changes Dec 20, 2024
@anilyil anilyil requested a review from eirikurj January 8, 2025 07:26
@eirikurj eirikurj merged commit 8c7d0ce into mdolab:main Jan 8, 2025
12 checks passed
@eirikurj
Copy link
Contributor

eirikurj commented Jan 8, 2025

Looks good, thanks for all your efforts on this!

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.

6 participants