Fix HICKS_HENNE_CAMBER deformation under MPI - #2897
Open
pragyaangaur wants to merge 2 commits into
Open
pragyaangaur wants to merge 2 commits into
pragyaangaur wants to merge 2 commits into
Conversation
SetHicksHenneCamber found the trailing edge, the leading edge and the angle of attack from the vertices of the current rank only, so each rank could deform its part of the airfoil in a different frame. The trailing-edge and leading-edge candidates are now gathered over all ranks and reduced in the same order on every rank. The trailing-edge search now uses the normal of each vertex and keeps the vertex with the largest x on each surface, and only owned vertices are candidates. The reference value of the naca0012_def_camber parallel test is updated. That test runs on 2 ranks, and the old value came from this defect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
This PR fixes
HICKS_HENNE_CAMBERproducing wrong deformations whenSU2_DEFruns on more than one MPI rank. The fix is inCSurfaceMovement::SetHicksHenneCamberinCommon/src/grid_movement/CSurfaceMovement.cpp.Before it places the camber bumps, the function finds the trailing edge and the leading edge of the airfoil and computes the angle of attack from them. It searched only the vertices of the current rank and had no MPI communication. A rank whose partition did not contain the true trailing edge or leading edge computed its own wrong frame, so different parts of the airfoil were deformed in different frames.
SetHicksHennein the same file already gathers both points over all ranks withAllgather, and this PR follows the same approach.The trailing-edge search also had two defects that made the result depend on the vertex order, and the vertex order changes with the partitioning:
TPCoord[0], which was still zero at that point, so it kept the last matching vertex. It now keeps the vertex with the largest x on each surface.The changes are:
vertex[iMarker][0]. It sends a sentinel that never wins the reduction.Related Work
Closes #2875.
Verification
I ran
SU2_DEFonTestCases/deformation/naca0012/def_NACA0012_camber.cfg(mesh from su2code/TestCases) with develop and with this branch. The last design variable is a camber bump of 0.005 near the trailing edge, so a correct result moves the upper and lower surfaces by the same amount and keeps the thickness. The columns below are the largest vertical displacement of each surface, the largest change in thickness, and the largest difference of any mesh node to the serial run.Develop:
With 4 ranks the lower surface does not move at all, which is the behaviour described in the issue.
This branch:
The serial output mesh of this branch is byte-identical to the serial output mesh of develop.
The reference value of the
naca0012_def_camberparallel regression test changes from0.00854844to0.0201692. This test runs withmpirun -n 2, so the old value came from the defect. The new value is the deformation residual of the 2-rank run, and it equals the serial value. I computed it on macOS arm64, where the 2-rank run of develop gives0.00855292against the stored0.00854844. The CI machine may therefore differ in the last digits, and I will update the value from the CI log if the test reports a small difference.pre-commitpasses on the changed files. CompilingCSurfaceMovement.cppwith-Wall -Wextragives no warnings in the changed function, both in the normal build and with-DCODI_REVERSE_TYPE.PR Checklist
pre-commit run --allto format old commits.naca0012_def_camberparallel test covers this, and its reference value is updated.)