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 for axisymmetric terms in NEMO + general NEMO updates #1326

Merged
merged 16 commits into from
Jul 21, 2021

Conversation

WallyMaier
Copy link
Contributor

@WallyMaier WallyMaier commented Jul 12, 2021

Proposed Changes

-This work is focused on fixing some of the axisymmetric loop structures within NEMO, which prevented residual evolution. This also changes a viscous planar wedge regression to an axisymmetric case.

-Code updates to make NEMO more-in-line with SU2 code style. i.e. variable declarations, SU2 MPI errors, etc.

-Fixes bug in vibrational-electronic functionality for CSU2TCLib

-Updating ionization/nheavy loops so CSU2TCLib and CMutationTCLib are consistent.

Related Work

This addresses/builds on #1106 #1205

PR Checklist

  • I am submitting my contribution to the develop branch.
  • 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.

@pr-triage pr-triage bot added the PR: draft label Jul 12, 2021
@@ -3582,14 +3582,6 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
SU2_MPI::Error("AUSMPW+ is extremely unstable. Feel free to fix me!", CURRENT_FUNCTION);
}

if (GetGasModel() == "ARGON" && GetKind_FluidModel() == SU2_NONEQ){
SU2_MPI::Error("ARGON is not working with SU2_NONEQ fluid model!", CURRENT_FUNCTION);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are now working.

@@ -5023,7 +5015,8 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
/*--- Specifying a deforming surface requires a mesh deformation solver. ---*/
if (GetSurface_Movement(DEFORMING)) Deform_Mesh = true;

if (GetGasModel() == "ARGON") monoatomic = true;
if (GetGasModel() == "ARGON") {monoatomic = true;}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prevents some issues with unintialized jumps

SU2_CFD/src/fluid/CSU2TCLib.cpp Outdated Show resolved Hide resolved
-TWO3*(AuxVar_Grad_i[1][1]+AuxVar_Grad_i[2][0]));
+v*TWO3*(2*PrimVar_Grad_i[1][1]-PrimVar_Grad_i[1][0]
-v*yinv+U_i[0]*turb_ke_i))
+total_conductivity_i*PrimVar_Grad_i[0][1])
Copy link
Contributor Author

@WallyMaier WallyMaier Jul 12, 2021

Choose a reason for hiding this comment

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

@FlorianDm should this value be "-total_conductivity_i*PrimVar"?

The term appears as "-qy" in the literature. Where "qy" is defined as "-k dt/du"

Copy link
Member

@FlorianDm FlorianDm Jul 17, 2021

Choose a reason for hiding this comment

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

Indeed I believe it should actually be +k dT/dy then. Thanks for spotting this. The test case i made breaks so I will rerun it with this branch

Copy link
Member

Choose a reason for hiding this comment

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

Ok so I reran the test case with this branch. I guess I should wait until this PR is to be merged to push the changes in the regression files to the TestCases repo so any other open PRs don't get failed regressions

Copy link
Member

Choose a reason for hiding this comment

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

or is the rest ready to go? If it may take a while maybe I better do the fix now in another PR in concert with the TestCases changes so it can be merged straight away as a simple fix and then you just merge the latest develop in here.. let me know what you think is best

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@FlorianDm Glad you could confirm! This PR should be done on Monday/Tuesday (hopefully) and Ill update the regression tests. However, if you want to go ahead to address it case before then, thats fine as well!

@@ -324,10 +324,6 @@ void CNEMOCompOutput::SetVolumeOutputFields(CConfig *config){
break;
}

//Auxiliary variables for post-processment
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removing repeated line

SU2_CFD/src/solvers/CNEMOEulerSolver.cpp Show resolved Hide resolved
@@ -1670,23 +1665,23 @@ void CNEMOEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contai

/*--- Species diffusion coefficients ---*/
visc_numerics->SetDiffusionCoeff(nodes->GetDiffusionCoeff(iPoint),
node_infty->GetDiffusionCoeff(0) );
nodes->GetDiffusionCoeff(iPoint));
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 more consistent with the baseline SU2.

Comment on lines 841 to 861
for (iPoint = 0; iPoint < nPoint; iPoint++) {
su2double yCoord = geometry->nodes->GetCoord(iPoint, 1);
su2double yVelocity = nodes->GetVelocity(iPoint,1);
su2double xVelocity = nodes->GetVelocity(iPoint,0);
su2double Total_Viscosity = nodes->GetLaminarViscosity(iPoint) + nodes->GetEddyViscosity(iPoint);

if (yCoord > EPS){
su2double nu_v_on_y = Total_Viscosity*yVelocity/yCoord;
nodes->SetAuxVar(iPoint, 0, nu_v_on_y);
nodes->SetAuxVar(iPoint, 1, nu_v_on_y*yVelocity);
nodes->SetAuxVar(iPoint, 2, nu_v_on_y*xVelocity);
}
}

/*--- Compute the auxiliary variable gradient with GG or WLS. ---*/
if (config->GetKind_Gradient_Method() == GREEN_GAUSS) {
SetAuxVar_Gradient_GG(geometry, config);
}
if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) {
SetAuxVar_Gradient_LS(geometry, config);
}
Copy link
Member

Choose a reason for hiding this comment

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

Move this to CFVMFlowSolverBase.inl and share it between CEulerSolver and CNEMOEulerSolver please (the bug is in CEuler solver, not here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you explain why this would go in .inl and not .hpp? Just for future reference? Is it because the function is identical and not a template? And if thats the case, should I make it a template and include the incompressible portion of the code?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the logic is more or less: if the method does not have to be a template then it is declared in the .hpp and implemented in .inl of CFVMSolverBase.
If it has to be a template, or you want it to be "inlineable", then it has to go in the .hpp.
But both files are headers, the only thing that changes is the "visibility", e.g. CEulerSolver includes the hpp but not the inl.
At the moment the inl is included by the NS solvers, at the top of the associated .cpp's you'll see

/*--- Explicit instantiation of the parent class of CIncEulerSolver,
 *    to spread the compilation over two cpp files. ---*/
template class CFVMFlowSolverBase<CIncEulerVariable, ENUM_REGIME::INCOMPRESSIBLE>;

That also means that if you change something in the .inl only the NS solvers recompile, but not the Euler solvers (which sounded like a good idea because e.g. CEulerSolver is a reasonably large file).

The incompressible version looks different enough to be either its own method or left as is.
My rule of thumb for such master versions is not to have physics-based conditionals in there (e.g. "if compressible"), if necessary, that type of detail should be provided from the outside, and not already present in the body of the "master" version.
In other words, we want those versions to be generic in the sense they allow externally provided specialization, not in the sense they already try to cover all possible options.
I hope this makes some sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@WallyMaier
Copy link
Contributor Author

Everything is up-to-date. I just need to update the TestCase folder....not sure what that order is...

@WallyMaier WallyMaier changed the title [WIP] Fix for axisymmetric terms in NEMO + general NEMO updates Fix for axisymmetric terms in NEMO + general NEMO updates Jul 20, 2021
@@ -227,7 +227,7 @@ def main():
axi_rans_air_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle"
axi_rans_air_nozzle.cfg_file = "air_nozzle.cfg"
axi_rans_air_nozzle.test_iter = 10
axi_rans_air_nozzle.test_vals = [-12.094937, -6.622043, -8.814412, -2.393288]
axi_rans_air_nozzle.test_vals = [-6.348077, -0.827162, -2.241982, 2.313210]
Copy link
Member

Choose a reason for hiding this comment

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

Just to clarify, the way I had done the regressions was with RESTART=YES in the config file where the restart file in TestCases solution_flow.dat was already converged to rho<1e-12 so it would just do 10 iterations and then those values I took. I see you did it differently since the values are only at 1e-6. I guess it does not matter but just wanted to clarify

Copy link
Contributor Author

@WallyMaier WallyMaier Jul 20, 2021

Choose a reason for hiding this comment

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

@FlorianDm, thanks for the clarification. I only updated the values in the regression test, so it still should be a restart. I could make an update to the current solution, or change the cfg to RESTART=NO. Though I was dumb and already pushed the changes in the TestCases...I dont this to sit broken, so I may just put in another small PR

SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp Outdated Show resolved Hide resolved
SU2_CFD/include/solvers/CFVMFlowSolverBase.inl Outdated Show resolved Hide resolved
SU2_CFD/src/solvers/CEulerSolver.cpp Outdated Show resolved Hide resolved
SU2_CFD/src/solvers/CNEMOEulerSolver.cpp Outdated Show resolved Hide resolved
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.

The order is to merge into testcases first just before merging this branch (then you can manually trigger the tests to re-run).

@pcarruscag pcarruscag marked this pull request as ready for review July 20, 2021 14:21
@WallyMaier WallyMaier merged commit cf4677b into develop Jul 21, 2021
@WallyMaier WallyMaier deleted the nemo_update branch July 21, 2021 06:09
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