su2code/SU2

Adding Custom, time-dependent MACH_NUMBER

thunderqd opened this issue · 0 comments

Hi all,

I'm new to CFD and SU2. I'm trying to modify the c++ code to add a time-dependent mach in the compressible Euler equations (SU2 Solver: EULER) for a rocket head cone design. At about line 786 of the CEulerSolver.cpp, I want to have a slight numerical change in its mach, for example, a sine function.

After I saw the example of the Adding Custom Source Terms to Euler Equations I modified the code like this:

  const auto dt           = config->GetDelta_UnstTimeND();
  su2double time          = config->GetTime_Step() * dt;
  su2double Alpha         = config->GetAoA()*PI_NUMBER/180.0;
  su2double Beta          = config->GetAoS()*PI_NUMBER/180.0;
  const su2double MachValue     = config->GetMach();
  su2double Mach          = 2 * MachValue + 0.01 * sin(2 * PI_NUMBER * time);

But during postprocessing I noticed that Mach becomes 2 * MachValue + 0 as the "time" could not be updated to the series of 0, 1, 2, 3, 4... So I'm wondering how I can build a mach that could change over time. I'm not sure what kind of syntax I should be using or how exactly to implement this mach term.

I am using SU2 7.3.1. Thank you so much!