-
Notifications
You must be signed in to change notification settings - Fork 848
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] pywrapper - custom source terms for all solvers #2388
base: develop
Are you sure you want to change the base?
Conversation
… type in loop condition Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…into feature_custom_source
unsigned long CDriver::GetNumberOuterIter() const { return config_container[selected_zone]->GetnOuter_Iter(); } | ||
|
||
unsigned long CDriver::GetDensity_FreeStreamND() const { | ||
return SU2_TYPE::GetValue(config_container[selected_zone]->GetDensity_FreeStreamND()); |
Check warning
Code scanning / CodeQL
Lossy function result cast Warning
return SU2_TYPE::GetValue(config_container[selected_zone]->GetDensity_FreeStreamND()); | ||
} | ||
unsigned long CDriver::GetForce_Ref() const { | ||
return SU2_TYPE::GetValue(config_container[selected_zone]->GetForce_Ref()); |
Check warning
Code scanning / CodeQL
Lossy function result cast Warning
@@ -66,6 +76,11 @@ | |||
|
|||
string CDriver::GetSurfaceFileName() const { return config_container[selected_zone]->GetSurfCoeff_FileName(); } | |||
|
|||
unsigned long CDriver::GetSolution(unsigned short iSOLVER, unsigned long iPoint, unsigned short iVar) { | |||
auto solver = solver_container[iZone][INST_0][MESH_0][iSOLVER]; | |||
return SU2_TYPE::GetValue(solver->GetNodes()->GetSolution(iPoint,iVar)); |
Check warning
Code scanning / CodeQL
Lossy function result cast Warning
#print("indices of primitives=",primindex) | ||
#print("number of primitives:",len(primindex)) | ||
|
||
nElem = driver.GetNumberElements() |
Check notice
Code scanning / CodeQL
Unused local variable Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 days ago
The best way to fix the problem is to remove the assignment of the nElem
variable since it is not used anywhere in the code. This will clean up the code and eliminate the unnecessary variable. The change should be made in the main
function of the TestCases/py_wrapper/custom_source/run.py
file.
-
Copy modified line R61
@@ -60,4 +60,3 @@ | ||
|
||
nElem = driver.GetNumberElements() | ||
#print("number of elements:",nElem) | ||
#print("number of elements:",driver.GetNumberElements()) | ||
|
iDENSITY = primindex.get("DENSITY") | ||
#print("index of density = ",iDENSITY) | ||
|
||
index_Vel = varindex.get("VELOCITY_X") |
Check notice
Code scanning / CodeQL
Unused local variable Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 days ago
The best way to fix the problem is to remove the assignment of the unused variable index_Vel
. This will clean up the code and remove any potential confusion about the purpose of the variable. Since the right-hand side of the assignment does not have any side effects, it is safe to remove the entire line.
-
Copy modified line R78
@@ -77,3 +77,3 @@ | ||
|
||
index_Vel = varindex.get("VELOCITY_X") | ||
#index_Vel = varindex.get("VELOCITY_X") | ||
#print("index of velocity = ",index_Vel) |
solvar = list(SU2Driver.GetSolutionVector(iFLOWSOLVER, iPoint)) | ||
# the list with names | ||
solindex = getsolvar(SU2Driver) | ||
primindex = SU2Driver.GetPrimitiveIndices() |
Check notice
Code scanning / CodeQL
Unused local variable Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 days ago
The best way to fix the problem is to remove the assignment of the unused variable primindex
. This will clean up the code and remove any potential confusion about the purpose of the variable. Since the right-hand side of the assignment does not have any side effects, it is safe to remove the entire line.
@@ -104,3 +104,2 @@ | ||
solindex = getsolvar(SU2Driver) | ||
primindex = SU2Driver.GetPrimitiveIndices() | ||
iTEMP = solindex.get("TEMPERATURE") |
# | ||
|
||
#print("solver variable names:",varindex) | ||
iDENSITY = primindex.get("DENSITY") |
Check notice
Code scanning / CodeQL
Unused local variable Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 days ago
The best way to fix the problem is to remove the unused variable iDENSITY
. Since the assignment of iDENSITY
does not have any side effects, we can safely delete the entire line where iDENSITY
is assigned. This will clean up the code and remove any potential confusion about the purpose of the variable.
-
Copy modified line R226
@@ -225,4 +225,3 @@ | ||
#print("solver variable names:",varindex) | ||
iDENSITY = primindex.get("DENSITY") | ||
#print("index of density = ",iDENSITY) | ||
#print("index of density = ",primindex.get("DENSITY")) | ||
|
iDENSITY = primindex.get("DENSITY") | ||
#print("index of density = ",iDENSITY) | ||
|
||
index_Vel = varindex.get("VELOCITY_X") |
Check notice
Code scanning / CodeQL
Unused local variable Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 days ago
The best way to fix the problem is to remove the assignment of the index_Vel
variable since it is not used anywhere in the code. This will clean up the code and remove any potential confusion about the purpose of the variable.
To implement this fix, we need to delete the line where index_Vel
is assigned a value. This change should be made in the file TestCases/py_wrapper/turbulent_premixed_psi/run.py
on line 229.
-
Copy modified line R229
@@ -228,4 +228,3 @@ | ||
|
||
index_Vel = varindex.get("VELOCITY_X") | ||
#print("index of velocity = ",index_Vel) | ||
|
||
|
index_Vel = varindex.get("VELOCITY_X") | ||
#print("index of velocity = ",index_Vel) | ||
|
||
custom_source_vector = [0.0 for i in range(nVars)] |
Check notice
Code scanning / CodeQL
Unused local variable Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 days ago
To fix the problem, we need to remove the assignment of the custom_source_vector
variable since it is not used anywhere in the code. This will clean up the code and eliminate the unnecessary variable. The change should be made in the file TestCases/py_wrapper/turbulent_premixed_psi/run.py
on line 232.
@@ -231,3 +231,2 @@ | ||
|
||
custom_source_vector = [0.0 for i in range(nVars)] | ||
#print("custom source vector = ", custom_source_vector) |
Proposed Changes
Introduce custom source terms for all solvers through the python wrapper.
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.
pre-commit run --all
to format old commits.