Hello.
I found that partial SOLU scheme (with
blencv=0.7...0.8), deactivating flux reconstruction or tweaking some other numerics is not so strong as pressure/velocity limiting and relaxation. I mentioned it in other posts but I think it's relevant here too, it's important for many users. Here are means to archive more stability:
1. Use
Least Squares gradient reconstruction +
Non-ortho faces threshold option. If you need more stability switch to
Full (all vertex adjacent) option but it's
very slow.
2. In static cases use
Local time step + target
CFL=0.5...5. Check that real CFL is not too large (in solver log tables) due to divergence or too big
Minimal time step factor. For most cases reference time step is 0.0001...0.001 s, minimal factor range is numerically the same.
3. Start with
Upwind for all variables, then switch to
SOLU for velocity with blending 1.0 (
blencv=1.0), reduce
blencv to
0.6...0.8 if you can't stabilize (it will also reduce precision but better than nothing). Other variables... Turbulence model is usually rough itself, so
Upwind should be OK. Temperature and user scalars / species may be more sensitive so you may compare results with
Upwind and
SOLU for them if solution doesn't diverge with
SOLU (or reduce
blencv to
0.6...0.8). With Upwind/SOLU you always balance between precision and stability. Simplest cases are insensitive to this, complex cases like highly swirled flow may be much more sensible.
4.
Use variable limiting.
It's mandatory for velocity, pressure and species / user scalars. Also good for temperature. Not needed for turbulence (from my experience). How to do it. Some variables are accessible in Equation parameters =>
Clipping in GUI. For other variables create
cs_user_extra_operations function (copy from examples to
SRC dir) or open if you have it in your case. Then introduce something like this, example is for pressure, process other variables this way:
Code: Select all
cs_real_t prsMinRq=-5000; /* Minimum allowable pressure [Pa] */
cs_real_t prsMaxRq=5000; /* Maximum allowable pressure [Pa] */
cs_field_t *prsField=cs_field_by_name_try("pressure"); /* Pointer to pressure field */
if (prsField!=NULL) /* Pressure field present */
{
for (cs_lnum_t iCell=0;iCell<nCell;iCell++) /* Cell loop */
{
prsField->val[iCell]=fmin(fmax(prsField->val[iCell],prsMinRq),prsMaxRq);
};
};
Sorry, didn't check so needs debug.
5.
Use variable relaxation. Relaxation factor is
0.05...0.3 for velocity and pressure,
0.5...0.8 for temperature / enthalpy and turbulence,
0.3 for species / user scalars. How to do it. Open your
cs_user_parameters function or create from examples. Here is an example for
epsilon, extrapolate on other variables:
Code: Select all
cs_field_t* field;
cs_equation_param_t* eqnPar;
field=CS_F_(eps); /* Field structure */
if (field!=NULL) /* Field present */
{
eqnPar=cs_field_get_equation_param(field); /* Field options structure */
eqnPar->relaxv=0.8; /* Relaxation factor */
eqnPar->ircflu=0; /* Flux reconstruction flag */
};
For different options with RSM you will also need
rij, r11, r22, r33, r12, r23, r13 fields (if there is no such field code will just skip it so don't test on turbulence model selected). For temperature scalar field is not TempC but
h. For user scalars you need
cs_field_by_name_try("ScalarName") instead of
CS_F_(...). You can check that it works in setup.log, search for relaxv lines for each field (these lines look like
relaxv 0.05).
Disabling flux reconstruction for
RANS turbulence (k+epsilon) was found somewhere in examples. I think it's usually not practical to disable it for other variables and I'm not sure it will not reduce precision with RSM. If you implement all things described, the solution should be stable even with RSM and rapid density changes like in combustion simulations.
Also, I want to say that what I see on the pictures looks like checkerboard effect but not divergence. There was a discussion about such problem, the result, as I remember, was: with small timesteps we have checkerboarding, with large timesteps - divergence. I think that increasing timesteps (I described how to archive stability) or tetra mesh may help.