Using Matlab to read the Code Saturne result file

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Jundi He
Posts: 106
Joined: Fri Jan 13, 2017 3:23 pm

Using Matlab to read the Code Saturne result file

Post by Jundi He »

Hi Code Saturne team:

I have a steady state simulation done by Code Saturne, and I am going to read the result file. As I know, different variables are stored in different files, for example, temperature field is stored in file "results.tempc.00001" which is binary. And now I am going to read the temperature field into an array in Matlab, so that I can do other data processing or calculation using the result data, anyone know how to do that? If there is a Matlab file, it's perfect. If there is not, could someone tell me the structure of the output file "results.tempc.00001", how many numbers are in this file and what's the type of these numbers, because in Matlab, I need to specify the type of numbers ("float 64" or "int32"...) and the number of the total numbers stored in the file. I suppose for example I have 12000 cells in my fluid domain, there will be 12000 temperature values stored in this file, so that I can use the global cell index to find out the temperature of this cell. Thanks for the time.

Regards!
Jundi
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Using Matlab to read the Code Saturne result file

Post by Yvan Fournier »

Hello,

The different post-processing output formats are detailed in the user manual (pdf).

What type of post-processing do you need to do ? If you need spatial information, the fields in the post-processing mesh will not be enough. You will also need mesh-related info.

I recommend checking what formats Matlab can read, and comparing that to those Code_Saturne can output. ParaView may also hep converting between formats.

Regards,

Yvan
Jundi He
Posts: 106
Joined: Fri Jan 13, 2017 3:23 pm

Re: Using Matlab to read the Code Saturne result file

Post by Jundi He »

Hi Yvan:

OK, thanks, I am reading the user manual to know the structure of the output file.

Regards!
Jundi
C.FLAG.
Posts: 32
Joined: Fri Apr 08, 2016 2:19 pm

Re: Using Matlab to read the Code Saturne result file

Post by C.FLAG. »

Hello,

You might want to check this matlab library https://www.mathworks.com/matlabcentral ... ile-format

The file format is actually not so complicated, and I was able to write some fortran program to read simple Ensight files, see this link for instance: https://repo.ijs.si/CFLAG/CS-fluid-soli ... eo.f90#L66

Regards,
Cédric
Post Reply