solution to tutorial case 4

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
leguichet
Posts: 34
Joined: Wed Sep 03, 2014 1:00 pm

solution to tutorial case 4

Post by leguichet »

Dear users,

I am new to code_saturne and starting some tutorials packed with the version 3.0.5.
In the case 4, where a cs_user_extra_operations.f90 function need be specified. In the folder Code_Saturne/3.0/src/code_saturne-3.0.5/examples/2-full_domain/case4, this file cannot be found. So I cannot compare mine to the given 'correct' solution.

I searched in other later version 3.3. The same! No solution cs_user_extra_operations.f90 is given in the cs_user_extra_operations.f90

So could some put this file here? And update the file in the coming version of code_saturne. Thank you very much!

Best regards

Zhenlan
leguichet
Posts: 34
Joined: Wed Sep 03, 2014 1:00 pm

Re: solution to tutorial case 4

Post by leguichet »

Here I put my script to this case. It already doesn't work before using cs_user_extra_operations.f90. I followed the steps described in the tutorial, I do not know why this produces such errors.

Could someone give me a help? Thank you very much!

Debit entrant retenu en 13 faces de sortie sur 15
Signal SIGFPE (exception en virgule flottante) intercepté !

Pile d'appels :
1: 0x7f066c4ecea1 <fvm_convert_array+0x4e91> (libsaturne.so.0)
2: 0x7f066c34e153 <fvm_writer_field_helper_step_e+0xb63> (libsaturne.so.0)
3: 0x7f066c34612c <fvm_to_ensight_export_field+0x174c> (libsaturne.so.0)
4: 0x7f066c34b52a <fvm_writer_export_field+0xba> (libsaturne.so.0)
5: 0x7f066c3c9ba3 <cs_post_write_var+0x313> (libsaturne.so.0)
6: 0x7f066c3cf6ea <cs_post_write_vars+0x105a> (libsaturne.so.0)
7: 0x7f066c373c02 <caltri_+0x37c2> (libsaturne.so.0)
8: 0x7f066c33fe65 <cs_run+0xa65> (libsaturne.so.0)
9: 0x7f066c33ffc5 <main+0x155> (libsaturne.so.0)
10: 0x7f0668e54c8d <__libc_start_main+0xfd> (libc.so.6)
11: 0x400d69 <> (cs_solver)
Fin de la pile
Attachments
cs_user_extra_operations.f90
(6.11 KiB) Downloaded 187 times
case2.xml
(13.03 KiB) Downloaded 179 times
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: solution to tutorial case 4

Post by Yvan Fournier »

Hello,

In your cs_user_operations.f90, you need to allocate lstelt

allocate(lstelt(ncelet))

before calling getcel, and call

deallocate(lstcel)

before the end.

This will avoid the crash I obtain with your case. I'll have to check for a reference cs_user_extra_operations.f90 for this example, but re-reading the tutorial, and comparing with older versions, it seems the use of that file is left as an exercice, with no "reference" version available.
We'll have to improve this for 4.0.

In any case, your xml file shows your setup is different from the reference ones. So I assume you experimented with parameters. This is good to familiarize yourself with the code behavior, but I can't tell if the crash you have is due to increasing the time step, the head losses, or something else. I recommend experimenting one parameter at a time. In any case, the CFL (CourantNB in the listing) starts quite high, then increases suddenly at time step 6, so reducing the time step is probably a start.

Regards,

Yvan
leguichet
Posts: 34
Joined: Wed Sep 03, 2014 1:00 pm

Re: solution to tutorial case 4

Post by leguichet »

Thank you Yvan,

I just need to mention a point with respect to your reply: the reference case2.xml given in the EXAMPLES/2-full_domain/CASE2 is already different from the one that I built up by following exactly the tutorial pdf instructions, namely some parts of boundary conditions. Any way, the difference does not blow up the calculation to the end of case 3.

When I added the "head loss" instructions in case 4 (defining the zone 2 and give loss coefficents), the calculation stop with errors shown above. So I think there is something incompatible for calculating head loss.

If you are preparing a the new tutorail pdf file, please check it all out, that would be helpful for the starters.
Yvan Fournier wrote:Hello,

In your cs_user_operations.f90, you need to allocate lstelt

allocate(lstelt(ncelet))

before calling getcel, and call

deallocate(lstcel)

before the end.

This will avoid the crash I obtain with your case. I'll have to check for a reference cs_user_extra_operations.f90 for this example, but re-reading the tutorial, and comparing with older versions, it seems the use of that file is left as an exercice, with no "reference" version available.
We'll have to improve this for 4.0.

In any case, your xml file shows your setup is different from the reference ones. So I assume you experimented with parameters. This is good to familiarize yourself with the code behavior, but I can't tell if the crash you have is due to increasing the time step, the head losses, or something else. I recommend experimenting one parameter at a time. In any case, the CFL (CourantNB in the listing) starts quite high, then increases suddenly at time step 6, so reducing the time step is probably a start.

Regards,

Yvan
Post Reply