-
Notifications
You must be signed in to change notification settings - Fork 509
Minor numerical improvements #2975
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
Conversation
Previously it could have called SeaSt_End multiple times, written non-fatal errors multiple times, or not called MD_End at all, depending on where an error occurred in the code.
ParseVarWDefault routines were using an optional argument as if it were not optional
we got rid of LogMap earlier, but apparently missed on use case
- avoid potential infinite loop in `AddOrSub2Pi` when comparing two large angles - ensure radius > 0 to avoid division by zero in `kernelSmoothing` - modify `RunTimes` so it makes sense for AeroMap cases - call`SimStatus_FirstTime` in AeroMap cases - use `R8Ki` instead of `DbKi` in some routines - change `CubicSplineInterpM` to a function to avoid extra allocations every time it's called
replaces "+ -" with "-".
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.
Pull Request Overview
This PR implements several minor numerical improvements across multiple modules to enhance code robustness and consistency. The changes focus on preventing edge cases and potential errors in numerical computations.
Key changes include:
- Enhanced angle normalization logic in
AddOrSub2Pito prevent infinite loops with very large angles - Improved division-by-zero protection in kernel smoothing functions
- Streamlined cubic spline interpolation by converting from function to subroutine to avoid repeated array allocations
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/seastate/src/SeaState_Output.f90 | Updates file unit check condition for consistency |
| modules/openfast-library/src/FAST_Subs.f90 | Adds useCases parameter to RunTimes call for AeroMap support |
| modules/openfast-library/src/FAST_SS_Subs.f90 | Adds SimStatus_FirstTime call with useCases parameter for AeroMap support |
| modules/nwtc-library/src/VTK.f90 | Fixes error status parameter assignment order |
| modules/nwtc-library/src/NWTC_Num.f90 | Major improvements to angle normalization, kernel smoothing, and cubic spline functions |
| modules/nwtc-library/src/NWTC_IO.f90 | Adds proper optional parameter handling in ParseVar routines |
| modules/nwtc-library/src/ModMesh.f90 | Replaces DCM_logMap with EulerExtract for consistency |
| modules/moordyn/src/MoorDyn_Misc.f90 | Cleans up unused variables and improves code organization |
| modules/moordyn/src/MoorDyn_Driver.f90 | Restructures cleanup logic and ensures proper end routine calls |
| modules/hydrodyn/src/Morison.f90 | Simplifies double operator expression |
| modules/aerodyn/src/AirfoilInfo.f90 | Updates to use subroutine version of cubic spline interpolation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Feature or improvement description
This PR makes a few minor improvements to the code:
_Endroutines only one time, regardless of error status.A + -Bis replaced withA - B).LogMapin a ModMesh packing routine is replaced withEulerExtractfor consistency.UnEcvalue inParseVarroutines is now checked if it's present before being used.AddOrSub2Pihas been modified to avoid a potential infinite loop when comparing two very large angles.kernelSmoothinghas new logic to avoid potential division by zeroRunTimes&SimStatushave been modified to be used in AeroMap casesCubicSplineInterpMis now a function instead of a subroutine to avoid extra array allocations every time it's calledRelated issue, if one exists
None
Impacted areas of the software
HydroDyn, MoorDyn, SeaState, NWTC Library, AirfoilInfo
Additional supporting information
Test results, if applicable
This doesn't change any test results. It primarily affects rare modeling situations.