su2code / SU2

SU2: An Open-Source Suite for Multiphysics Simulation and Design
https://su2code.github.io
Other
1.34k stars 844 forks source link

Incompressbile Navier-Stokes case with grid movment #247

Closed morgan-bc closed 7 years ago

morgan-bc commented 8 years ago

Hi, SU2 developers,

When I worked on a 2D vicsid laminar problem with a gird movement, SU2 goes wrong at the time when it computes the BC_HeatFlux_Wall. The condition of the moving wall is setted to be MARKER_HEATFLUX=(wall, 0.0). So I checked the code and found problems in the function CNSSolver::BC_HeatFlux_Wall. The problematic codes are here.

void CNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {

...
 /*--- Implicit Jacobian contributions due to moving walls ---*/

        if (implicit) {

          /*--- Jacobian contribution related to the pressure term ---*/

          GridVel2 = 0.0;
          for (iDim = 0; iDim < nDim; iDim++)
            GridVel2 += GridVel[iDim]*GridVel[iDim];
          for (iVar = 0; iVar < nVar; iVar++)
            for (jVar = 0; jVar < nVar; jVar++)
              Jacobian_i[iVar][jVar] = 0.0;
          Jacobian_i[nDim+1][0] = 0.5*(Gamma-1.0)*GridVel2*ProjGridVel;
          for (jDim = 0; jDim < nDim; jDim++)
            Jacobian_i[nDim+1][jDim+1] = -(Gamma-1.0)*GridVel[jDim]*ProjGridVel;
          Jacobian_i[nDim+1][nDim+1] = (Gamma-1.0)*ProjGridVel;

          /*--- Add the block to the Global Jacobian structure ---*/
...

In 2D incompressible cases, the number of conservative variables is 3, so nVar = 3 and the size of Jacobian should be 3x3. The codes Jacobian_i[nDim+1][0] has memory acess error. Obviously, the codes are for compressible problems. Can you fix the bug ? What's the right method to compute BC_HeatFlux for incompressoble cases with grid movment ?

Another small bug. In function COutput::SetSurfaceCSV_Flow

 Pressure = FlowSolver->node[iPoint]->GetPressure();
        PressCoeff = FlowSolver->GetCPressure(iMarker, iVertex);

Pressure is wrong for incompressible problems

economon commented 8 years ago

Thanks for filing this. Unfortunately, we have not completely implemented the ALE formulation for the incompressible solver to handle dynamic meshes. If this is something you would be interested in helping develop further, please let us know.

That being said, we should have proper guards (or error messages) that avoid this kind of memory access error in the incompressible case. We'll look into this right away.

talbring commented 7 years ago

We will soon open a feature request for that. So I am gonna close this for now.