Underestimation of velocity, compressible model

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Christopher
Posts: 36
Joined: Wed Feb 17, 2021 2:22 pm

Re: Underestimation of velocity, compressible model

Post by Christopher »

Hi Yvan,

thanks for your reply. Could you give me some help where to add "--enable-debug"? I can only start these topics:

help
studymanager
smgr
bdiff
bdump
compile
config
cplgui
create
gui
parametric
studymanagergui
smgrgui
trackcvg
update
up
info
run
submit
symbol2line

when I launch code_saturne.

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

Re: Underestimation of velocity, compressible model

Post by Yvan Fournier »

Hello,

The --enable-debug option must actually be used much earlier, when installing the code. It is an option for the "configure" command.

Best regards,

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

Re: Underestimation of velocity, compressible model

Post by Christopher »

Hello Yvan,

I finally installed a new build of CS from Git in the debug mode (with debugging symbols) and re-ran the calculation. However the output looks similar to the previous without debugging. Which data should I provide to find the bug?

The error message is different as well. The main calculation won't start.

ALMAX = 0.41379E-01 (Characteristic length )
ALMAX is the cubic root of the domain volume.

ALMAX is the length used to initialize the turbulence.
SIGFPE signal (floating point exception) intercepted!

Call stack:
1: 0x7fc1697a7210 <+0x46210> (libc.so.6)
2: 0x7fc16a4ec4b3 <cs_cf_thermo_default_init+0x1a9> (libsaturne-7.1.so)
3: 0x7fc169c7f8df <iniva0_+0x10b0> (libsaturne-7.1.so)
4: 0x7fc169a317fc <caltri_+0x10ed> (libsaturne-7.1.so)
5: 0x7fc16b2afae5 <+0x5ae5> (libcs_solver-7.1.so)
6: 0x7fc16b2afddc <main+0x142> (libcs_solver-7.1.so)
7: 0x7fc1697880b3 <__libc_start_main+0xf3> (libc.so.6)
8: 0x5624c368d0ce <_start+0x2e> (cs_solver)
End of stack

Without the user_parameters everything works fine.

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

Re: Underestimation of velocity, compressible model

Post by Yvan Fournier »

Hello,

The crash occuring earlier is interesting. Probably a division by zero (which might or might not be the cause of the crash you have on the regular build).

Now that you have a debug version, you can try to run it with a debugger: if gdb is installed on your machine, go to the advanced setup for the code_saturne run options, and add "gdb" in the "tool options" box. Then once the code starts in a terminal with a gdb prompt, type "continue" to go to the crash site. Then "up" and/or "down" to navigate the stack, until you find the "interesting" line. (don't hesitate to post again at ths stage).

Best regards,

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

Re: Underestimation of velocity, compressible model

Post by Christopher »

Hi,

here is the output from gdb. So is the "interesting line" number 155? I have never used gdb before. The German message is "File or directory not found" and refers to the cs_cf_thermo.c. The interesting thing is that the folder "GitHub_Master" was my source folder, which I already deleted. However, the main calculation runs fine without the stiffened gas model (see gdb2).

Kind regards,
Christopher
Attachments
gdb2.png
gdb.png
Christopher
Posts: 36
Joined: Wed Feb 17, 2021 2:22 pm

Re: Underestimation of velocity, compressible model

Post by Christopher »

Hello Yvan,

I found out something interesting. At least for me. I applied the same model I originally created for CS to OpenFoam v8.

In CS I use a velocity inlet with a mass flow and a pressure outlet. I initialised the thermodynamics at the inlets with pressure and temperature. The result is that the pressure and temperature fields match the experimental data, but the velocity is too low.

In OF I have done pretty much the same thing. I use a velocity inlet with a mass flow and a pressure outlet. However, the temperature is initialised by a specific T-file. The difference with CS is that the pressure at the inlets has a "zero gradient" BC.

As a result, the velocities in OF agree much better with the experimental results, but the pressure is much too high. I have searched the literature for an explanation. So far without success. Perhaps I am making a fundamental error in my model. But since velocity and pressure depend on each other, there are clear physical rules to describe this mathematically. Why then does the calculated data not agree with the experiment?

So either the pressure is too high or the velocities are too low!???

I really hope that the stiffened gas model will bring clarity.

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

Re: Underestimation of velocity, compressible model

Post by Yvan Fournier »

Hello,

I'm not very familiar with the compressible module, so I may need to check with another developer, but looking at your debug/gdb screenshot, it seems you have a crash line 155 of cs_cf_thermo.c.

You could reach that line typing "up" multiple times in the gdb prompt, but in any case, looking at the matching code, there is a division by cv0 and t0, so I suspect one of the two has not been defined and is set to 0. Could you check those (both in the GUI, user functions if you have them, and setup.log for confirmation/cross checking) ?

Best regards,

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

Re: Underestimation of velocity, compressible model

Post by Christopher »

Hi,

I have checked the setup.log file. The physical properties are defined as follows:

gravity vector: [0, 0, 0]
icorio: 0 (ignore Coriolis source terms)

Continuous phase:
ro0: 1.17862e+00 (Reference density)
viscl0: 1.83000e-05 (Ref. molecular dyn. visc.)
cp0: 1.00500e+03 (Ref. specific heat)
icp: -1 (> 0: Variable Cp (cs_user_physical_properties))
p0: 1.01325e+05 (Ref. total pressure)
pred0: 0.00000e+00 (Ref. reduced pressure)
t0: 2.93150e+02 (Ref. temperature)

Initial reference point for pressure
xyzp0: 0.00000e+00 0.00000e+00 0.00000e+00

irovar: 1 (variable density)
ivivar: 0 (constant molecular viscosity)

So, t0 and cp0 are defined correctly. I initialize these variables in the gui. However, you mentioned that it should be cv0. In the gui, however, I can only set the specific heat by constant pressure, not by constant volume.

After downloading and checking the code, I saw that within the perfect gas model there is a conversion from cp to cv, but for the stiffened gas not. cv0 should be set by the user.

/* perfect gas */
if (ieos == CS_EOS_IDEAL_GAS || ieos == CS_EOS_GAS_MIX) {
cs_real_t xmasml = cs_glob_fluid_properties->xmasmr;
*cv0 = cp0 - r_pg/xmasml;
*ro0 = p0 * xmasml/(r_pg*t0);
e0 = *cv0 * t0;
}
/* stiffened gas: cv0 is set by the user */
else if (ieos == CS_EOS_STIFFENED_GAS) {
cs_real_t gamma = cs_glob_cf_model->gammasg;
*ro0 = (p0 + psginf) / ((gamma-1.)*(*cv0)*t0);
e0 = *cv0*t0 + psginf / *ro0;
}

I will try to initialize cv in the user parameters by "int cv0 = " and see if it runs.

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

Re: Underestimation of velocity, compressible model

Post by Christopher »

Hi Yvan,

I struggle where to set cv0. In the user parameters won't work. Could give a hint?

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

Re: Underestimation of velocity, compressible model

Post by Yvan Fournier »

Hello,

I would have thought doing that in cs_user_parameters would work. If this is not the case, I'll need to navigate/grep through the code or run a compressible case under a debugger to see why your setting does not work.

I'll take a look and keep you informed.

Best regards,

Yvan
Post Reply