-
Notifications
You must be signed in to change notification settings - Fork 849
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 dissipation in transition model and update inlet profile (initial profile from config) #1268
Conversation
@@ -139,7 +139,8 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig | |||
const su2double chi_1 = 0.002; | |||
const su2double chi_2 = 50.0; | |||
|
|||
su2double tu = config->GetTurbulenceIntensity_FreeStream(); | |||
/*--- turbulence intensity is u'/U so we multiply by 100 to get percentage ---*/ | |||
su2double tu = 100.0 * config->GetTurbulenceIntensity_FreeStream(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 every now and then CFD-online helps us find some bugs :)
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
SU2_CFD/src/solvers/CSolver.cpp
Outdated
INLET_TYPE Kind_Inlet = config->GetKind_Inlet(); | ||
switch (Kind_Inlet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INLET_TYPE Kind_Inlet = config->GetKind_Inlet(); | |
switch (Kind_Inlet) { | |
switch (config->GetKind_Inlet()) { |
columnName << "# COORD-X " << setw(24) << "COORD-Y " << setw(24); | ||
if(nDim==3) columnName << "COORD-Z " << setw(24); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to sound like neat picking in this particular context but bear with me (you never know the next piece of code you will work on).
From an efficiency standpoint you should always move as little data as possible (talking about the spaces in setw and passing numbers as strings).
This is particularly relevant for strings because of something called "small string optimization", where up to a certain number of characters, strings do not allocate memory on the heap.
In this example, this also means that you are forcing the file format from the outside, this should be the responsibility of the class (profile reader in this case) consider for example that we may want to use it for CSV formats.
SU2_CFD/src/solvers/CSolver.cpp
Outdated
columnName << "# COORD-X " << setw(24) << "COORD-Y " << setw(24); | ||
if(nDim==3) columnName << "COORD-Z " << setw(24); | ||
|
||
if (compressible){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ok for now, but if more solvers start using inlet profiles this is not a scalable solution.
The suggestion was to have this block of code as a method of different solvers, so that you do not have to figure out the type of solver based on configuration options (and consequently the type of inlet, etc. etc.).
solver->GetInletVariableNames()
something like that.
The motivation for polymorphism and abstract classes is to allow centralizing this type of knowledge, i.e. "what type of object is this?", on a single place, the instantiation of the object.
Enough philosophy...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I prefer having something like this at the level of the solver container so we can construct this information. After all, very soon we will have passive scalar, combustion variables, nemo combustion variables,...
By the way please give the PR a more descriptive title that reflects the transition fix and the column names feature. |
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit late, but thanks for the transition-model bugfix and the inlet-marker-stuff 💐
filename = val_filename; | ||
markerType = val_kind_marker; | ||
numberOfVars = val_number_vars; | ||
columnNames = val_columnNames; | ||
columnValues = val_columnValues; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this could be done with an initializer list for the ctor .. but I am unsure if one is to be preferred over the other. The core guidelines dont seem to have a strong opinion either. CE Playground
} | ||
} else { | ||
SU2_MPI::Error("While opening profile file, no \"NMARK=\" specification was found", CURRENT_FUNCTION); | ||
//cout << "inlet profile reader is ignoring line: " << text_line << endl; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case I would remove the whole else
statement ... unless there are further plans
SetVolumeOutputValue("RES_VELOCITY-Z", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); | ||
SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 4)); | ||
if (config->GetEnergy_Equation()) | ||
SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 4)); | ||
} else { | ||
SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); | ||
if (config->GetEnergy_Equation()) | ||
SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess one could move this config->GetEnergy_Equation()
out of the if nDim
and make the acces solver[FLOW_SOL]->LinSysRes(iPoint, nDim+1)
Proposed Changes
Related Work
Related to #1263 and #1265
PR Checklist