[WIP] Pressure Based Solver#2812
Conversation
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
There was a problem hiding this comment.
Please think about ways of reusing the numerics used by the scalar solvers, not duplicating code is part of the criteria for merging PRs.
| Diff_U = new su2double [nVar]; | ||
| Velocity_i = new su2double [nDim]; | ||
| Velocity_j = new su2double [nDim]; | ||
| Velocity_upw = new su2double [nDim]; | ||
| MeanVelocity = new su2double [nDim]; | ||
| Flux = new su2double [nDim]; | ||
| ProjFlux_i = new su2double [nVar]; | ||
| ProjFlux_j = new su2double [nVar]; | ||
| Jacobian_i = new su2double* [nVar]; | ||
| Jacobian_j = new su2double* [nVar]; | ||
| Jacobian_upw = new su2double* [nVar]; | ||
|
|
||
| for (iVar = 0; iVar < nVar; iVar++) { | ||
| Jacobian_i[iVar] = new su2double [nVar]; | ||
| Jacobian_j[iVar] = new su2double [nVar]; | ||
| Jacobian_upw[iVar] = new su2double [nVar]; |
There was a problem hiding this comment.
Please look at more recent examples of introducing new numerics classes or cleaning old ones, this is not the way for new code.
| Face_Flux = 0.0; | ||
| for (iDim = 0; iDim < nDim; iDim++) { | ||
| Velocity_i[iDim] = V_i[iDim+1]; | ||
| Velocity_j[iDim] = V_j[iDim+1]; | ||
| MeanVelocity[iDim] = 0.5*(Velocity_i[iDim] + Velocity_j[iDim]); | ||
| Face_Flux += MeanDensity*MeanVelocity[iDim]*Normal[iDim]; | ||
| } |
There was a problem hiding this comment.
This is not a correct implementation of Rhie-Chow momentum interpolation.
Please consider attending a developer meeting to explain your plans with this PR, the way I see it going, it's not going to make the cut to merge into develop.
There was a problem hiding this comment.
Thanks for your feedback. I will let you know when it is ready for review.
There was a problem hiding this comment.
Ok. Keep in mind that we prefer many small PRs over one big one. This way, lessons learned from one review carry over to the next small PR.
Very large PRs tend to take a long time to review because the authors tend to run out of time rather than finish the work.
https://su2code.github.io/docs_v7/Code-Review/
There was a problem hiding this comment.
@thijsaalbers please discuss with @vdweide if there can be a 'minimum example' PR of the implementation, one that can be delivered half-way in this GSOC project. Then add 'nice to have' features later.
For announcements on developer meetings and also for quick questions, please check slack.
Implements the full class structure required for the pressure-based solver in a minimal form. The code compiles and runs but does not yet contain any numerical/physical implementation. Future work will focus on implementing solver logic. Note: In the previous attempts (see related work) there is noticeable code duplication between CIncEuler and CPBIncEuler. The final architecture may be revised depending on how the implementation of CPBIncEuler evolves.
| /*--- Store the number of vertices on each marker for deallocation later ---*/ | ||
|
|
||
| nVertex.resize(nMarker); | ||
| for (iMarker = 0; iMarker < nMarker; iMarker++) |
| // numerics[iMGlevel][POISSON_SOL][visc_term] = new CAvgGrad_Poisson(nDim, nVar_Poisson, config); | ||
|
|
||
| /*--- Assign the convective boundary term as well to account for flow BCs as well --*/ | ||
| for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { |
| //GetFluidModel()->SetTDState_T(Temperature_Inf, scalar_init); | ||
| //Enthalpy_Inf = GetFluidModel()->GetEnthalpy(); |
| /*--- Perform the non-dimensionalization for the flow equations using the | ||
| specified reference values. ---*/ | ||
|
|
||
| // SetNondimensionalization(config, iMesh); |
| // numerics[iMGlevel][POISSON_SOL][source_first_term] = new CSource_PoissonFVM(nDim, nVar_Poisson, config); | ||
| // numerics[iMGlevel][POISSON_SOL][source_second_term] = new CSourceNothing(nDim, nVar_Poisson, config); |
| switch (config->GetKind_Centered_Flow()) { | ||
| case CENTERED::CDS : /* numerics[MESH_0][FLOW_SOL][conv_term] = new CCentPB_Flow(nDim, nVar_Flow, config); */ break; | ||
| default: | ||
| SU2_MPI::Error("Invalid centered scheme or not implemented.\n Currently, only CDS is available for pressure based incompressible flows.", CURRENT_FUNCTION); | ||
|
|
||
| } |
| * \brief Get the temperature of the point. | ||
| * \return Value of the temperature of the point. | ||
| */ | ||
| // inline su2double GetTemperature(unsigned long iPoint) const final { return Solution(iPoint, 0); } |
| /* | ||
| * \brief Destructor of the class. | ||
| */ | ||
| // ~CPoissonSolver(void); |
| /*! | ||
| * \brief Constructor of the class. | ||
| */ | ||
| // CPoissonSolver(void); |
| /*! | ||
| * \brief Constructor of the class. | ||
| */ | ||
| //CPBIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) {}; |

Proposed Changes
The current work aims at getting a working version of the pressure based incompressible flow solver into the development branch.
Investigation
Implementation (in order of priority)
Validation and Maintenance
Current Issues
Related Work
This work is based on earlier attempts by Nitish Anand (2024) and Akshay Koodly (2021), see feature branches feature_PBFlow_V8 and feature_Pressure_based respectively. Also see PR #2210
PR Checklist
pre-commit run --allto format old commits.