su2code / SU2

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

Bug about the wrong pitching_omega of incompressible flow. #193

Closed hoop247 closed 8 years ago

hoop247 commented 9 years ago

Hi, SU2 developers,

I recently working on the flapping wing using SU2. Since the Mach number is much smaller than 0.3, I use the incompressible solver with pitching mesh deformation to simulate the flapping.

In the testcases folder, you guys provide the plunging of NACA0012 in compressible NS flow. I modified it into pitching of NACA0012 in incompressible NS flow by adding and changing keywords:

REGIME_TYPE = INCOMPRESSIBLE
% ----------------------- DYNAMIC MESH DEFINITION -----------------------------%
%
% Mesh motion for unsteady simulations (NO, YES)
GRID_MOVEMENT= YES
%
% Type of mesh motion (NONE, FLUTTER, RIGID_ROTATION, RIGID_PITCHING)
GRID_MOVEMENT_KIND= DEFORMING
%
MARKER_MOVING = ( airfoil)
%
% Coordinates of the motion origin
MOTION_ORIGIN_X= 0.25
MOTION_ORIGIN_Y= 0.0
MOTION_ORIGIN_Z= 0.0
%
% Pitching angular freq. (rad/s) about the motion origin
PITCHING_OMEGA_X= 0.0 
PITCHING_OMEGA_Y= 0.0
PITCHING_OMEGA_Z= 106.69842
%
% Pitching amplitude (degrees) about the motion origin
PITCHING_AMPL_X= 0.0
PITCHING_AMPL_Y= 0.0
PITCHING_AMPL_Z= 30
%
% Pitching phase offset (degrees) about the motion origin
PITCHING_PHASE_X= 0.0
PITCHING_PHASE_Y= 0.0
PITCHING_PHASE_Z= 0.0

When running this cfg file, the terminal prints

------------------------------ Begin Solver -----------------------------

 Updating surface positions.
 Storing translating displacement for marker: airfoil.
 Translational velocity: (0, 0, 0) m/s.
 Deforming the volume grid.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 1/2. Linear iter.: 0. Min. area: 5.37582e-07. Error: 0.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 2/2. Linear iter.: 0. Min. area: 5.37582e-07. Error: 0.
 Storing plunging displacement for marker: airfoil.
 Plunging frequency: (0, 0, 0) rad/s.
 Plunging amplitude: (0, 0, 0) degrees.
 Deforming the volume grid.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 1/2. Linear iter.: 0. Min. area: 5.37582e-07. Error: 0.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 2/2. Linear iter.: 0. Min. area: 5.37582e-07. Error: 0.
 Storing pitching displacement for marker: airfoil.
 Pitching frequency: (0, 0, 8.19188e+48) rad/s about origin: (0.25, 0, 0).
 Pitching amplitude about origin: (0, 0, 30) degrees.
 Pitching phase lag about origin: (0, 0, 0) degrees.
 Deforming the volume grid.
Non-linear iter.: 1/2. Linear iter.: 92. Min. area: 5.37582e-07. Error: 1.20232e-27.
Non-linear iter.: 2/2. Linear iter.: 92. Min. area: 5.37582e-07. Error: 1.20232e-27.
 Storing rotating displacement for marker: airfoil.
 Angular velocity: (0, 0, 0) rad/s about origin: (0.25, 0, 0).
 Deforming the volume grid.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 1/2. Linear iter.: 0. Min. area: 5.37582e-07. Error: 0.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 2/2. Linear iter.: 0. Min. area: 5.37582e-07. Error: 0.
 Computing grid velocities by finite differencing.

The value of Pitching frequency is totally wrong. So I do some debugging, found that there is no initialization of Omega_Ref in slover_direct_mean.cpp for incompressible flow.

  /*--- Incompressible non dimensionalization ---*/

  else {

    /*--- Reference length = 1 (by default)
     Reference density = liquid density or freestream
     Reference viscosity = liquid viscosity or freestream
     Reference velocity = liquid velocity or freestream
     Reference pressure = Reference density * Reference velocity * Reference velocity
     Reynolds number based on the liquid or reference viscosity ---*/

    Pressure_FreeStream = 0.0; config->SetPressure_FreeStream(Pressure_FreeStream);
    Density_FreeStream  = config->GetDensity_FreeStream();
    ModVel_FreeStream = 0.0;
    for (iDim = 0; iDim < nDim; iDim++) ModVel_FreeStream += config->GetVelocity_FreeStream()[iDim]*config->GetVelocity_FreeStream()[iDim];
    ModVel_FreeStream = sqrt(ModVel_FreeStream); config->SetModVel_FreeStream(ModVel_FreeStream);

    /*--- Additional reference values defined by Pref, Tref, Rho_ref. By definition,
     Lref is one because we have converted the grid to meters.---*/

    Length_Ref = config->GetLength_Reynolds();                config->SetLength_Ref(Length_Ref);
    Density_Ref = Density_FreeStream;                         config->SetDensity_Ref(Density_Ref);
    Velocity_Ref = ModVel_FreeStream;                         config->SetVelocity_Ref(Velocity_Ref);
    Pressure_Ref = Density_Ref*(Velocity_Ref*Velocity_Ref);   config->SetPressure_Ref(Pressure_Ref);
    ///#NOTE JC
    Omega_Ref = Velocity_Ref/Length_Ref;                      config->SetOmega_Ref(Omega_Ref);

Then I copied the corresponding codes to places for incompressible flow. Run it again, however, terminal prints the right pitching frequency, it still meet errors. The screen outputs are:

------------------------------ Begin Solver -----------------------------

 Updating surface positions.
 Storing translating displacement for marker: airfoil.
 Translational velocity: (0, 0, 0) m/s.
 Deforming the volume grid.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 1/2. Linear iter.: 0. Min. area: 8.10228e-10. Error: 0.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 2/2. Linear iter.: 0. Min. area: 8.10228e-10. Error: 0.
 Storing plunging displacement for marker: airfoil.
 Plunging frequency: (0, 0, 0) rad/s.
 Plunging amplitude: (0, 0, 0) degrees.
 Deforming the volume grid.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 1/2. Linear iter.: 0. Min. area: 8.10228e-10. Error: 0.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 2/2. Linear iter.: 0. Min. area: 8.10228e-10. Error: 0.
 Storing pitching displacement for marker: airfoil.
 Pitching frequency: (0, 0, 106.698) rad/s about origin: (0.25, 0, 0).
 Pitching amplitude about origin: (0, 0, 30) degrees.
 Pitching phase lag about origin: (0, 0, 0) degrees.
 Deforming the volume grid.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 1/2. Linear iter.: 0. Min. area: 8.10228e-10. Error: 0.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 2/2. Linear iter.: 0. Min. area: 8.10228e-10. Error: 0.
 Storing rotating displacement for marker: airfoil.
 Angular velocity: (0, 0, 0) rad/s about origin: (0.25, 0, 0).
 Deforming the volume grid.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 1/2. Linear iter.: 0. Min. area: 8.10228e-10. Error: 0.
CSysSolve::FGMRES(): system solved by initial guess.
Non-linear iter.: 2/2. Linear iter.: 0. Min. area: 8.10228e-10. Error: 0.
 Computing grid velocities by finite differencing.
Segmentation fault

Could you fix this bug?

Best regards.

talbring commented 9 years ago

Hi hoop247,

the problem here is that the incompressible formulation used in SU2 is only valid for steady problems and thus cannot be used for this kind of application. However, you could try to use the compressible formulation in combination with the low-mach number preconditioner.

I agree that there should be a more precise error message when trying to run unsteady+incompressible...

hoop247 commented 9 years ago

Dear talbring,

Thanks a lot! Finally, I understand why the unsteady+imcompressible in SU2 sometimes works, sometimes fails. And thanks for your advise using compressible formulation with low-mach number preconditioner.

: )

hlkline commented 8 years ago

It looks like this was resolved, I am closing the issue.