Skip to content
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

[WIP] GradVal FIX for Massflow SWP #2272

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

NAnand-TUD
Copy link

@NAnand-TUD NAnand-TUD commented Apr 24, 2024

Proposed Changes

As mentioned in the last few dev meetings, there was some error with GradVal for the streamwise solver with Massflow. This was because the tape was not cleared during SetRecoding. In the current version, the register of extra solutions is moved to Register Variables and gradients look consistent.

Related Work

SWP-Isothermal with mass flow also shows good gradient validation after implementing this fix. In theory, this should not break any other part of the code.

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • [ x ] I am submitting my contribution to the develop branch.
  • [ x ] My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • [ x ] My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.
    CAD_GRAD_AFTER
    CAD Sensitivites after making changes, gradients are symmetric for the upper and lower variables.
    CAD_GRAD_BEFORE
    CAD Sensitivities before making changes, gradients are not-symmetric for the upper and lower variables.
    Case_Image_RTemp
    Test Case!
    FFD_GRAD_AFTER
    FFD Sensitives also co-relate well

@NAnand-TUD NAnand-TUD changed the title fix grad_val GradVal FIX for Massflow SWP Apr 24, 2024
@@ -261,6 +259,8 @@ void CDiscAdjSolver::RegisterVariables(CGeometry *geometry, CConfig *config, boo
config->SetIncPressureOut_BC(BPressure);
config->SetIncTemperature_BC(Temperature);

direct_solver->RegisterSolutionExtra(reset, config);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the boolean passed to this function means "reset". But I'll assign @TobiKattmann to this one.

Copy link
Author

Choose a reason for hiding this comment

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

unsigned long CIncEulerSolver::RegisterSolutionExtra(bool input, const CConfig* config) { if (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) { if (input) AD::RegisterInput(SPvals.Streamwise_Periodic_PressureDrop); else AD::RegisterOutput(SPvalsUpdated.Streamwise_Periodic_PressureDrop); return 1; } return 0; }

Yes, you are right, so we are doing the opposite then. I will investigate a bit more.

@pcarruscag pcarruscag changed the title GradVal FIX for Massflow SWP [WIP] GradVal FIX for Massflow SWP Sep 14, 2024
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