CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   SU2 (https://www.cfd-online.com/Forums/su2/)
-   -   Time varying far field boundary conditions (https://www.cfd-online.com/Forums/su2/246144-time-varying-far-field-boundary-conditions.html)

ander November 15, 2022 09:18

Time varying far field boundary conditions
 
Dear SU2 devs,

I'm trying to modify the source code to account for time varying far field boundary conditions for the Euler Equations. (In the future I would also like to extend them to vary spatially, but this is a first step).

I have modified the function CEulerSolver::BC_Far_Field, and the edited piece of the code looks like this:

Code:

      bool UsingTraject = config->UsingTrajectory();
      Vel2_Infty = 0.0; Vn_Infty = 0.0;
      for (iDim = 0; iDim < nDim; iDim++) {
          Vel_Infty[iDim] = UsingTraject ? config->GetVelocityFS_Traject(iDim) :
          GetVelocity_Inf(iDim);
          Vel2_Infty    += Vel_Infty[iDim]*Vel_Infty[iDim];
          Vn_Infty      += Vel_Infty[iDim]*UnitNormal[iDim];
      }
      Density_Infty = UsingTraject ? config->GetDensityFS_Traject() : GetDensity_Inf();
      Pressure_Infty  = UsingTraject ? config->GetPressureFS_Traject() :
          GetPressure_Inf();
      SoundSpeed_Infty = sqrt(Gamma*Pressure_Infty/Density_Infty);
      Entropy_Infty    = pow(Density_Infty, Gamma)/Pressure_Infty;

Here I have added some additionals values and functions to CConfig. The bool UsingTraject specifies if the time varying conditions are used. The functions Get_XXX_FS_Traject() reads in time varying free stream values from the config file, and these free stream values are updated once each timestep.

However my implementation doesn't seem to work. I have ran a supersonic case on a wedge-like object where I gradually changed the direction of the freestream velocity, but the incoming field doesn't seem to change direction.

I would like some guidance on possible reasons for why my implementation is failing. Is there is something wrong in my assumption that I can modify the BC_Far_Field function in this way?

Thanks in advance!

bigfootedrockmidget November 16, 2022 17:55

Did you check that the farfield changes if you change the farfield velocity from the config file? And what if you just hardcode some value for the farfield conditions in the farfield function?

Did you check that you are actually entering the farfield routine every timestep?

ander November 17, 2022 14:02

You are correct, they didn't change! The reason was that I updated the config file only on the MASTER rank, and therefore all the different copies of the config file didn't change.

I tested it now, and if I make the velocity field accelerate linearly and apply the same acceleration as a body force, the velocity field seems to get a uniform acceleration, which was what I hoped (at least in the supersonic case).

I need to do more testing to see if I am able to implement far field BC's for a rotating reference frame

bigfootedrockmidget November 17, 2022 15:57

Great to hear!
By the way, there is also the option to use the python wrapper to implement this, you can have a look in Testcases/py_wrapper for some examples.


All times are GMT -4. The time now is 14:36.