## Underestimation of velocity, compressible model

Questions and remarks about code_saturne usage
Forum rules
Christopher
Posts: 36
Joined: Wed Feb 17, 2021 2:22 pm

### Underestimation of velocity, compressible model

Hello,

I have ended my last topic with a comparison of an experiment with simulation data.

viewtopic.php?f=2&t=2788

The results were good. However, after doing some measurements at higher air temperatures and a more sophisticated setup, I now see a big difference in velocities. I have attached a file showing the results for illustrative purposes. It is the same meltblown nozzle as in the last post.

As you can see, there is an underestimation of the velocities along the x-axis below the nozzle exit, while the temperature shows good agreement with the experiment.

To better fit the solution to the experiment, I multiplied each cell-velocity on L by a factor of 1.5. Therefore, as you can see, we got a underestimation of 1.5*c. Then I artificially increased the pressure (by 1e5 Pa) and then the mass flow (twice) at the inlets. The agreement with the experimental data was better, but the curves are now too close together because of the lower pressure difference. Doubling the mass flow showed no change in velocity.

So my questions are:
1. is there a trick in CS to get around these problems, e.g. by using special boundary conditions?
2. or is the solver unable to solve the compressible NS equation at such high velocities and temperatures?

I use CS 7.1.

Kind regards,
Christopher
Attachments
Data.pdf
Yvan Fournier
Posts: 3647
Joined: Mon Feb 20, 2012 3:25 pm

### Re: Underestimation of velocity, compressible model

Hello,

I will need to check with colleagues who worked on the compressible model and know it well.

I suspect the limitation is more due to boundary conditions or equations of state than numerical aspects, but I do not know that part of the code well enough.
We already use specific boundary conditions for the compressible model, but we might need more.

Are you using a perfect gas or stiffened gas.model (or can I check this in your previous setup) ?

Best regards,

Yvan
Christopher
Posts: 36
Joined: Wed Feb 17, 2021 2:22 pm

### Re: Underestimation of velocity, compressible model

Hello,

I am using perfect gas as I did in my previous setup. Would you recommend a stiffened gas.model? Do I need to set it up without the GUI? Because I can only select perfect gas inside the compressible module on GUI.

Kind regards,
Christopher
Yvan Fournier
Posts: 3647
Joined: Mon Feb 20, 2012 3:25 pm

### Re: Underestimation of velocity, compressible model

Hello,

Yes, you will need to select the stiffened gas model with a user-defined function, either in cs_user_parameters.c or cs_user_parameters.f90 (posting from my phone, so it is not practical for me to check the details of which examples are available right now).

Best regards,

Yvan
Christopher
Posts: 36
Joined: Wed Feb 17, 2021 2:22 pm

### Re: Underestimation of velocity, compressible model

Hello Yvan,

I searched for a stiffened gas model and I found this:

https://www.code-saturne.org/cms/sites/ ... 69f6b6ec54

With the variable "ieos" I should give an indicator for the equation of state. In my case "CS_EOS_STIFFENED_GAS: stiffened gas". So I searched for some Examples in the "share" folder to add a user-defined function in my SRC folder. But I found non. Do you have an advice how to implement a stiffened gas model. Is there an example anywhere else or do I have to implement it 100% by my own, such as https://en.wikipedia.org/wiki/Equation_of_state in 11.1?

Kind regards,
Christopher
Yvan Fournier
Posts: 3647
Joined: Mon Feb 20, 2012 3:25 pm

### Re: Underestimation of velocity, compressible model

Hello,

I have never used this, but looking at the code, it seems you can simply try adding (in cs_user_parameters):

Code: Select all

``````cs_cf_model_t *cf_mdl = cs_get_glob_cf_model();
cf_mdl->ieos = CS_EOS_STIFFENED_GAS;
``````
Best regards,

Yvan
Christopher
Posts: 36
Joined: Wed Feb 17, 2021 2:22 pm

### Re: Underestimation of velocity, compressible model

Hi Yvan,

sorry for the late reply. Was busy with other things. I've tried to use the stiffened gas model and added

void
cs_user_model(void)
{
cs_cf_model_t *cf_mdl = cs_get_glob_cf_model();
cf_mdl->ieos = CS_EOS_STIFFENED_GAS;
}

in the cs_user_parameters.c file. Then dropped it into the SRC folder. However, I get the error:

@
@ @@ WARNING: Wall distance calculation
@ =========
@ The laplacian solution does not respect the maximum
@ principle in 10 cells. We recompute the laplacien
@ without reconstructions.

** WALL DISTANCE
-------------

Min distance = 0.56443E-05 Max distance = 0.25227E+00

Flexible Conjugate Gradient [Pressure]: divergence after 1 iterations:
initial residual: nan; current residual: nan

fallback from Multigrid to Jacobi (diagonal) preconditioning
for re-try and subsequent solves.

Flexible Conjugate Gradient [Pressure]: divergence after 1 iterations:
initial residual: nan; current residual: nan

/home/code_saturne/code_saturne-v7.1/code_saturne-master/src/alge/cs_sles_it.c:4962: Fatal error.

Flexible Conjugate Gradient: error (divergence) solving for Pressure

I also tried different solvers, left preconditioners to automatic and increased the solver precision. My guess is, that the error is related to the solver. The initial time step is 1e-07 and CFL = 0.4. Why is the calculated residual "nan"?

Attached you will find the latest setup.xml.

Kind regards,
Christopher
Attachments
cs_user_parameters.c
setup.xml
Yvan Fournier
Posts: 3647
Joined: Mon Feb 20, 2012 3:25 pm

### Re: Underestimation of velocity, compressible model

Hello,

Did you run with this same mesh using another model before, or is this the first test with this mesh?

This looks like a mesh quality issue. If this is not the case, then you might have a memory access (overwite) error with your modification, but this seems less probable.

Best regards,

Yvan
Christopher
Posts: 36
Joined: Wed Feb 17, 2021 2:22 pm

### Re: Underestimation of velocity, compressible model

Hi Yvan,

mesh quality is an important thing, I agree. Unfortunately, the mesh file is too large for upload (48 mb). However, when I check the 5 quality criterion's it looks not that bad (total number of cells = 770000):

Criterion 1: Orthogonality:
Number of bad cells detected: 0 --> 0 %

Criterion 2: Offset:
Number of bad cells detected: 60 --> 0 %

Number of bad cells detected: 12 --> 0 %

Criterion 4: Cells Volume Ratio:
Number of bad cells detected: 0 --> 0 %

Criterion 5: Guilt by Association:
Number of bad cells detected: 0 --> 0 %

Warning:
--------
Mesh quality issue has been detected

The mesh should be re-considered using the listed criteria.

The calculation will run but the solution quality may be degraded...

In my previous calculations I never got a mesh that was perfect regarding the 5 criterion's. I always thought, that the overall result quality is not seriously effected by these few bad cells. However, the solution is just not as good as in the other regions.

The whole model is basically the same as in the past. I just added the stiffened gas model in the user_parameters.c.

Kind regards,
Christopher
Yvan Fournier
Posts: 3647
Joined: Mon Feb 20, 2012 3:25 pm

### Re: Underestimation of velocity, compressible model

Hello,

The quality criteria seem OK. And in any case, if you used the same mesh successfully with other models, I do not see why this should have an effect on the wall distance computation (unless that distance is needed by that model and not by the previous ones).

So I would suspect a bug, but to find it, the first step would be to try to run using a debug build. (code_saturne configured using --enable-debug), to see if any issue is detected earlier. We can then work from that.

Best regards,

Yvan