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

Add in Sutherland's law for NEMO problems #1702

Merged
merged 7 commits into from
Jul 15, 2022
Merged

Conversation

WallyMaier
Copy link
Contributor

Proposed Changes

Here I am adding Sutherland's law for viscosity and thermal conductivity for NEMO problems using the native library. Experiments for these types of problems often are run using very low temperatures (~65K). Our current models aren't suited well for these temperature ranges.

There is also some general clean up work in the still-not-working Gupta-Yos model and viscous numerics.

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.
  • [X ] My contribution generates no new compiler warnings (try with the '-Wall -Wextra -Wno-unused-parameter -Wno-empty-body' compiler flags, or simply --warnlevel=2 when using meson).
  • My contribution is commented and consistent with SU2 style.
  • 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.

@@ -1598,6 +1633,8 @@ vector<su2double>& CSU2TCLib::GetDiffusionCoeff(){
DiffusionCoeffWBE();
if(Kind_TransCoeffModel == TRANSCOEFFMODEL::GUPTAYOS)
DiffusionCoeffGY();
if(Kind_TransCoeffModel == TRANSCOEFFMODEL::SUTHERLAND)
DiffusionCoeffWBE();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The diffusion coefficient used in the Sutherland model is still computed using the WBE routine

@@ -1971,18 +2013,50 @@ void CSU2TCLib::ThermalConductivitiesGY(){
}

/*--- Translational contribution to thermal conductivity ---*/
ThermalCond_tr += (15.0/4.0)*kb*gam_i/denom_t;
if (denom_t != 0) ThermalCond_tr += (15.0/4.0)*kb*gam_i/denom_t;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is general cleanup. The code doesn't behave just yet.....though this is a problem for another day.

Copy link
Member

Choose a reason for hiding this comment

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

This is a bit ugly. Is denom always positive? If so the standard way of protecting against division by zero is using fmax(x, EPS)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes denom should always be positive. I think the issue is if demon= 0 then ThermalCond_tr += 0 .
But I agree this is ugly.

Copy link
Member

Choose a reason for hiding this comment

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

Still, equality comparisons of floating point numbers with 0 are generally a bad idea, because things will also blow up with 1e-100, checking for > EPS should be safer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha. Is there a cleaner/efficient way to make sure that if denom_t = 0, then there is no contribution to thermal conductivity? fmax(x, EPS)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed these around to maybe be less ugly.

SU2_CFD/include/fluid/CSU2TCLib.hpp Outdated Show resolved Hide resolved
Common/src/CConfig.cpp Outdated Show resolved Hide resolved
SU2_CFD/include/fluid/CSU2TCLib.hpp Outdated Show resolved Hide resolved
@@ -1971,18 +2013,50 @@ void CSU2TCLib::ThermalConductivitiesGY(){
}

/*--- Translational contribution to thermal conductivity ---*/
ThermalCond_tr += (15.0/4.0)*kb*gam_i/denom_t;
if (denom_t != 0) ThermalCond_tr += (15.0/4.0)*kb*gam_i/denom_t;
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit ugly. Is denom always positive? If so the standard way of protecting against division by zero is using fmax(x, EPS)

SU2_CFD/src/fluid/CSU2TCLib.cpp Outdated Show resolved Hide resolved
Comment on lines +255 to +256
const su2double rho = val_primvar[RHO_INDEX];
const su2double T = val_primvar[T_INDEX];
Copy link
Member

Choose a reason for hiding this comment

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

👍 nice

@@ -110,6 +110,13 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou
ElDegeneracy(0,5) = 5;
ElDegeneracy(0,6) = 15;

if (viscous) {
mu_ref[0] = 2.125E-5;
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth adding a comment with a reference for these values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I can add a quick reference.

if (Kind_FluidModel == SU2_NONEQ && Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE ) {
SU2_MPI::Error("Only WILKE transport model is stable for the NEMO solver using SU2TClib. Use Mutation++ instead.", CURRENT_FUNCTION);
if (Kind_FluidModel == SU2_NONEQ && (Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE && Kind_TransCoeffModel != TRANSCOEFFMODEL::SUTHERLAND) ) {
SU2_MPI::Error("Only WILKE and SUTHERLAND transport models are stable for the NEMO solver using SU2TClib. Use Mutation++ instead.", CURRENT_FUNCTION);
Copy link
Contributor

Choose a reason for hiding this comment

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

How hard would it be to add this routine so it is supported by MPP?

Also, just to confirm, Sutherland is just used for viscosity then WBE is used for diffusion coeffs and thermal conductivity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great question. I don't know if MPP has sutherland's law, but if it does....it should be fairly simple to implement.
I guess with that thought, the Sutherlands law would be the identical implementation, but it would need additional errors if someone tried to used not AR, N2, or Air5/7.

Yes, Sutherland is used for viscosity and thermal conductivity. Blottner part of WBE is still used for diffusion coefficients.

@@ -1346,7 +1346,7 @@ CFL_REDUCTION_ADJTURB= 0.01

% -------------------- NEMO NUMERICAL METHOD DEFINITION -----------------------%
%
% Mixture transport properties (WILKE,GUPTA-YOS,CHAPMANN-ENSKOG)
% Mixture transport properties (WILKE,GUPTA-YOS,CHAPMANN-ENSKOG, SUTHERLAND)
Copy link
Contributor

Choose a reason for hiding this comment

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

Overall looks good! I think this will be a good addition for running the lower temperature experimental verification cases with NEMO, where the T_{\inf} is low but he Ma_{\inf} is high.

@WallyMaier WallyMaier merged commit f2add99 into develop Jul 15, 2022
@WallyMaier WallyMaier deleted the feature_NEMO_suth branch July 15, 2022 16:46
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