-
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
unsigned long CDriver::GetNumberInnerIter() const { return config_container[selected_zone]->GetnInner_Iter(); } | ||
unsigned long CDriver::GetNumberOuterIter() const { return config_container[selected_zone]->GetnOuter_Iter(); } | ||
|
||
unsigned long CDriver::GetDensity_FreeStreamND() const { return config_container[selected_zone]->GetDensity_FreeStreamND(); } |
Check warning
Code scanning / CodeQL
Lossy function result cast Warning
unsigned long CDriver::GetNumberOuterIter() const { return config_container[selected_zone]->GetnOuter_Iter(); } | ||
|
||
unsigned long CDriver::GetDensity_FreeStreamND() const { return config_container[selected_zone]->GetDensity_FreeStreamND(); } | ||
unsigned long CDriver::GetForce_Ref() const { return config_container[selected_zone]->GetForce_Ref(); } |
Check warning
Code scanning / CodeQL
Lossy function result cast Warning
@@ -66,6 +72,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 solver->GetNodes()->GetSolution(iPoint,iVar); |
Check warning
Code scanning / CodeQL
Lossy function result cast Warning
… 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
# ################################################################## # | ||
def initC(coord): | ||
x = coord[0] | ||
y = coord[1] |
Check notice
Code scanning / CodeQL
Unused local variable Note
y = coord[1] | ||
#z = coord[2] | ||
#print("x,y = ",x," ",y) | ||
C = 0.0 |
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
redefined
This assignment to 'C' is unnecessary as it is
redefined
R = 8.314 | ||
# kg/kmol | ||
M = 28.5 | ||
RHO = P0/(R*T/M) |
Check notice
Code scanning / CodeQL
Unused local variable Note
RHO = P0/(R*T/M) | ||
iFLOWSOLVER = SU2Driver.GetSolverIndices()['INC.FLOW'] | ||
solvar = list(SU2Driver.GetSolutionVector(iFLOWSOLVER, iPoint)) | ||
primvar = list(SU2Driver.GetPrimitiveVector(iFLOWSOLVER, iPoint)) |
Check notice
Code scanning / CodeQL
Unused local variable Note
#print("primvar = ",primvar) | ||
#print("solvar=",solvar) | ||
iTEMP = solindex.get("TEMPERATURE") | ||
iDENSITY = primindex.get("DENSITY") |
Check notice
Code scanning / CodeQL
Unused local variable Note
nu=mu/rho | ||
tke, dissipation = SU2Driver.GetSolutionVector(iSSTSOLVER,iPoint) | ||
gradc = SU2Driver.GetGradient(iSPECIESSOLVER,iPoint,0) | ||
norm_gradc = np.sqrt(gradc[0]*gradc[0] + gradc[1]*gradc[1]) |
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
redefined
print("\n------------------------------ Begin Solver -----------------------------") | ||
sys.stdout.flush() | ||
|
||
nDim = driver.GetNumberDimensions() |
Check notice
Code scanning / CodeQL
Unused local variable Note
unsigned short nVar = GetNumberSolverVars(iSolver); | ||
if (nVar != solutionVector.size() ) | ||
SU2_MPI::Error("Solution Vector size is not equal to Solver size.", CURRENT_FUNCTION); | ||
//cout << "setting solution vector " << nodes->GetSolution(iPoint,0) << " " << solutionVector[0] << ", "<< nVar<< endl; |
Check notice
Code scanning / CodeQL
Commented-out code Note
auto* nodes = solver->GetNodes(); | ||
auto nPrimvar = GetNumberPrimitiveVars(iSolver); | ||
vector<passivedouble> solutionvector(nPrimvar, 0.0); | ||
//cout << "setting primitive vector " << nodes->GetPrimitive(iPoint,0) << " " << primitiveVector[0] << ", "<< nPrimvar<< endl; |
Check notice
Code scanning / CodeQL
Commented-out code Note
vector<passivedouble> val_source) final { | ||
/*--- Since this call can be accessed indirectly using python, do some error | ||
* checking to prevent segmentation faults ---*/ | ||
//cout << "flow" << endl; |
Check notice
Code scanning / CodeQL
Commented-out code Note
vector<passivedouble> val_source) final { | ||
/*--- Since this call can be accessed indirectly using python, do some error | ||
* checking to prevent segmentation faults ---*/ | ||
//cout << "***** set custom point source species *****" << endl; |
Check notice
Code scanning / CodeQL
Commented-out code Note
|
||
/*--- Compute the residual for this control volume and subtract. ---*/ | ||
for (iVar = 0; iVar < nVar; iVar++) { | ||
//cout << iPoint << " " << iVar << ",S="<< PointSource[iPoint][iVar]<< endl; |
Check notice
Code scanning / CodeQL
Commented-out code Note
Proposed Changes
Introduce custom source terms for all solvers through the python wrapper.
current status:
First proof of concept, reproduces the laminar buoyancy driven cavity testcase
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.