Skip to content

Delete dead-code for "nearfield" and "interface" boundaries#1351

Merged
pcarruscag merged 6 commits intodevelopfrom
delete_dead_nearfield_code
Aug 16, 2021
Merged

Delete dead-code for "nearfield" and "interface" boundaries#1351
pcarruscag merged 6 commits intodevelopfrom
delete_dead_nearfield_code

Conversation

@pcarruscag
Copy link
Member

I think nearfield was a kind of internal interface between two boundaries with the same points, so not a "do nothing" group of points but more like an actuator disk without any jump.
Anyway, it was all incomplete or broken and there was no documentation in the code, for a change...
To anyone in the future the commit to revert is 265bfe8814ed345e9ab6288265e80858b00ae59e

Comment on lines -1328 to -1329
if (IndexNF_inv[AngleInt+1] > 0) { iColumn = IndexNF_inv[AngleInt+1]; goto end; }
if (IndexNF_inv[AngleInt-1] > 0) { iColumn = IndexNF_inv[AngleInt-1]; goto end; }
Copy link
Member Author

Choose a reason for hiding this comment

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

I was almost surprised 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

lol, that code looks like someone really hated else if

@lgtm-com
Copy link

lgtm-com bot commented Aug 15, 2021

This pull request fixes 6 alerts when merging 02c1e4d into 8e7bd69 - view on LGTM.com

fixed alerts:

  • 4 for Comparison result is always the same
  • 2 for Comparison of narrow type with wide type in loop condition

@pcarruscag
Copy link
Member Author

@snow54 I think the solution file for your testcase will have to be updated, can you have a look please to make sure the discrete adjoint still works?
This should also fix the problems you had with the Venkatakrishnan limiter.

Copy link
Contributor

@TobiKattmann TobiKattmann left a comment

Choose a reason for hiding this comment

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

Well, you had me at +23 −1,962 ... 💐 I do not have much to say other than thanks for this cleanup (^~^)/

Once yuki confirms that everything works this is good to go from my side

... And 'now' you complain about complex code! Get your things together CodeFactor. (*proceeds to hang off employee of the month Feb2020 picture)

@snow54
Copy link
Contributor

snow54 commented Aug 16, 2021

@pcarruscag Thanks for the cleanup. I have made a pull request to update solution file for the test case.

You have deleted codes that create WeightNF.dat so I have deleted it from python codes as well. (I tried to push as a suggestion but it didn't work as I expected).

I think nearfield was a kind of internal interface between two boundaries with the same points, so not a "do nothing" group of points but more like an actuator disk without any jump.

I thought so when I was trying to make it work in ver.6 but, when I tried with mesh with two boundaries with the same points, it didn't work.

@lgtm-com
Copy link

lgtm-com bot commented Aug 16, 2021

This pull request fixes 6 alerts when merging d1bae40 into 8e7bd69 - view on LGTM.com

fixed alerts:

  • 4 for Comparison result is always the same
  • 2 for Comparison of narrow type with wide type in loop condition

Co-authored-by: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com>
@lgtm-com
Copy link

lgtm-com bot commented Aug 16, 2021

This pull request fixes 6 alerts when merging c17195f into 8e7bd69 - view on LGTM.com

fixed alerts:

  • 4 for Comparison result is always the same
  • 2 for Comparison of narrow type with wide type in loop condition

@pcarruscag
Copy link
Member Author

Thank you for updating the solution file @snow54 , there's quite a big difference in the adjoint residuals, do the final derivatives still make sense? Is the flow field noticeably different (for the better, e.g. smoother? or equivalent to not having the boundary at all?) now that nearfield is treated as an internal boundary?
If so let's update the residuals and merge.

I'm sorry that you had to spend time fixing that MPI code... But at least we found out we could clean all this obsolete code.

@snow54
Copy link
Contributor

snow54 commented Aug 16, 2021

Thank you for updating the solution file @snow54 , there's quite a big difference in the adjoint residuals, do the final derivatives still make sense? Is the flow field noticeably different (for the better, e.g. smoother? or equivalent to not having the boundary at all?) now that nearfield is treated as an internal boundary?
If so let's update the residuals and merge.

I think we can update the residuals.

Gradients between adjoint and finite difference match quite well as shown below. I haven't finished calculating for all design variables, but I think it is enough.

Comparison_gradient

In terms of flow field, the capture below is from the current develop branch. The boundary between structured grid and unstructured gird is a nearfield boundary. An object is above this capture and pressure wave propagates from there. Since this grid is inclined by Mach angle, pressure distribution on the nearfield should be fairly similar to the region above but this capture shows some strange pressure disturbance.

Limiter: VAN_ALBADA_EDGE
NF_before

Limiter: VENKATAKRISHNAN_WANG
NF_before_VEN

The capture below is from the branch with this PR. The issue I mentioned above does not exist.

Limiter: VAN_ALBADA_EDGE
NF_after

I think the residuals for direct solver will be different like the adjoint if you run it for some hundreds more iterations (currently, the test case has only 20 iterations). However, since the nearfield boundary is a bit far from an object, it takes some iterations for pressure waves to reach the nearfield boundary.

This PR also solves an issue with VENKATAKRISHNAN_WANG limiter. It seems to be much easier for convergence than VAN_ALBADA_EDGE, so it is fairly useful. I still have a gradient un-match issue with my bigger mesh but I believe it is coming from something else.

I'm sorry that you had to spend time fixing that MPI code... But at least we found out we could clean all this obsolete code.

Yeah, I noticed it had been deleted. It's OK. It was still a good opportunity for me to learn how MPI works.

@pcarruscag pcarruscag merged commit ed327e4 into develop Aug 16, 2021
@pcarruscag pcarruscag deleted the delete_dead_nearfield_code branch August 16, 2021 14:25
@lgtm-com
Copy link

lgtm-com bot commented Aug 16, 2021

This pull request fixes 6 alerts when merging 1243d16 into 1a84301 - view on LGTM.com

fixed alerts:

  • 4 for Comparison result is always the same
  • 2 for Comparison of narrow type with wide type in loop condition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants