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

Fix NEMO Supersonic Inlet BC & BC Cleanup #1862

Merged
merged 63 commits into from
Jan 12, 2023
Merged

Conversation

jtneedels
Copy link
Contributor

@jtneedels jtneedels commented Dec 30, 2022

Signed-off-by: jtneedels jneedels@stanford.edu

Proposed Changes

Fixes supersonic inlet BC in CNEMOEulerSolver so that it becomes operational.
Clean up NEMO supersonic outlet BC.
Clean up NEMO farfield BC.

Related Work

See associated PR to update documentation: su2code/su2code.github.io#112

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.

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • 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.

Signed-off-by: jtneedels <jneedels@stanford.edu>
@pr-triage pr-triage bot added the PR: draft label Dec 30, 2022
@jtneedels
Copy link
Contributor Author

Here's what I see:

  • Viscous components of BC_INLET and BC_OUTLET commented out, can these be ucnommented?
  • BC_INLET is non-operational.
  • BC_SUPERSONIC_INLET is commented out and non-functional. Is this redundant in function to BC_FARFIELD, can it be removed, or should it be fixed?

@jtneedels
Copy link
Contributor Author

Here's my proposed changes:

  • BC_supersonic_outlet seems to be covered by the automatic check for Ma > 1 in BC_outlet, so BC_supersonic_outlet can be removed instead of fixed. Is that true or should be keep supersonic_outlet?
  • BC_supersonic_inlet seems useful to have, but I'm not sure on the difference between it and BC_farfield for a supersonic case.
  • BC_inlet: is there a strong case for keeping it? Or could it be removed? Is there a case where we want a subsonic inlet?

@pcarruscag
Copy link
Member

What NEMO has for farfield is a supersonic inlet, it's not handling the outflow case correctly.

@WallyMaier
Copy link
Contributor

WallyMaier commented Dec 31, 2022

I believe the viscous components of a lot of bcs are commented out and can probably be removed at this point. I'm not even sure if they are formulated properly for NEMO problems.

I think BC_Inlet can be removed. Or all the commented code can be removed with just an error message.

Regarding the outlet boundaries, supersonic outlet does seem to be redundant. However, many validation cases use a supersonic outlet, regardless of boundary layers (ASWBLI), so it may be fine to keep.

@jtneedels
Copy link
Contributor Author

What NEMO has for farfield is a supersonic inlet, it's not handling the outflow case correctly.

Because it’s not considering incoming characteristics for subsonic flow?

@jtneedels
Copy link
Contributor Author

Good point on scramjets, I’ll start by working on fixing supersonic inlet, then we can make a call on what to do with the normal inlet.

@pcarruscag
Copy link
Member

Supersonic outflow only has outgoing characteristics, so forcing the farfield state may not be ideal. If the flow is going out it should work as an outflow boundary.

Signed-off-by: jtneedels <jneedels@stanford.edu>
@jtneedels
Copy link
Contributor Author

jtneedels commented Jan 3, 2023

@pcarruscag @WallyMaier Working on the supersonic inlet. I brought things mostly up to date with fluid model. There is a comment saying a root-finding method needs to be implemented to find rhoCvve. But we already have the full conservative state, could we just call cons2primvar?

Any other suggestions?

Signed-off-by: jtneedels <jneedels@stanford.edu>
@WallyMaier
Copy link
Contributor

The root finding method was to find Tve. I can think of 2/3 solutions:
1.) If we already have the conservative state, then using cons2primvar seems like the best bet in my mind.
2.) Try to just use ComputeTemperatures
3.) Follow the method of initializing node_infty. (This may actually be 1+2)

Signed-off-by: jtneedels <jneedels@stanford.edu>
@jtneedels
Copy link
Contributor Author

jtneedels commented Jan 3, 2023

Yeah, so there was a comment left here from someone saying a root-finding method was needed to compute rhocvve in this case. Closer look, it isn't since you assume you already have vib temp and can compute Eve. I used the setTDStatePTTv which seems to give all values needed to initialize. There are likely some bugs there but I can work through that.

A few follow on Qs:

  • Why at line 2238 there is a call to conv_numerics to set values based on node_infty. Should that not be based on node_inlet? I think we should be passing dPdU, etc., for the inlet state we just computed. What's the best way to do that if so?
  • What is the best way here to reference fluid model? Is what I have right, or am I missing something?
  • Since mass fraction is a necessary input for the supersonic_inlet, will we need a different config option for nemo vs the standard air solver?

Signed-off-by: jtneedels <jneedels@stanford.edu>
Signed-off-by: jtneedels <jneedels@stanford.edu>
Signed-off-by: jtneedels <jneedels@stanford.edu>
Signed-off-by: jtneedels <jneedels@stanford.edu>
@jtneedels jtneedels requested a review from patelha57 January 5, 2023 00:39
Signed-off-by: jtneedels <jneedels@stanford.edu>
@jtneedels jtneedels requested a review from WallyMaier January 5, 2023 19:56
Signed-off-by: jtneedels <jneedels@stanford.edu>
Signed-off-by: jtneedels <jneedels@stanford.edu>
Signed-off-by: jtneedels <jneedels@stanford.edu>
Signed-off-by: jtneedels <jneedels@stanford.edu>
@WallyMaier
Copy link
Contributor

This looks good to me. Thanks for the work.
Two last questions:
1.) Would it better to include a viscous case versus an euler?
2.) How to you fix code factor issues?

SU2_CFD/src/solvers/CNEMOEulerSolver.cpp Outdated Show resolved Hide resolved
SU2_CFD/src/solvers/CNEMOEulerSolver.cpp Outdated Show resolved Hide resolved
Signed-off-by: jtneedels <jneedels@stanford.edu>
Signed-off-by: jtneedels <jneedels@stanford.edu>
Signed-off-by: jtneedels <jneedels@stanford.edu>
@jtneedels jtneedels requested a review from WallyMaier January 12, 2023 17:41
@jtneedels jtneedels changed the title Fix NEMO Supersonic Inlet BC Fix NEMO Supersonic Inlet BC & BC Cleanup Jan 12, 2023
Signed-off-by: jtneedels <jneedels@stanford.edu>
Signed-off-by: jtneedels <jneedels@stanford.edu>
Copy link
Member

@pcarruscag pcarruscag left a comment

Choose a reason for hiding this comment

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

Nice cleanup 👍

nodes->GetThermalConductivity_ve(iPoint));

/*--- Compute and update residual ---*/
auto residual = visc_numerics->ComputeResidual(config);

Check notice

Code scanning / CodeQL

Declaration hides variable

Variable residual hides another variable of the same name (on [line 2224](1)).
Signed-off-by: jtneedels <jneedels@stanford.edu>
@jtneedels jtneedels merged commit dfcb26a into develop Jan 12, 2023
@jtneedels jtneedels deleted the feature_nemo_bc_cleanup branch January 12, 2023 22:22
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