Radiation data output problem with a suggestion

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
ZHUOJUN
Posts: 15
Joined: Fri Oct 16, 2020 12:16 pm

Radiation data output problem with a suggestion

Post by ZHUOJUN »

Hello,

Recently I am working on a simple thermal radiation problem using the DOM and the FSCK supported by Code Saturne. In general I found that, the FSCK and MODAK model are only available in specific physical models, e.g. combustion and etc. But my project is only concerned on the radiation of a gas mixture with CO2 and H2O.
So, I tried to modify the source functions acquired from GitHub, namely the "cs_rad_transfer_absorption.c", "cs_rad_transfer_solve.c", and "cs_rad_transfer_options.c”. What I have done is to modify the conditional statements which judge the existence of physical model then decide to use FSCK or not.
For example, I modified source code from

Code: Select all

if (pm_flag[CS_COMBUSTION_FUEL] >= 0) 
  {
      ......
      ......
      if (rt_params->imfsck == 1)
        cs_rad_transfer_fsck(w1, w2, tempk, kgas, agas, agasb);
    }
  }
to

Code: Select all

if (1) 
  {
      ......
      ......
      if (rt_params->imfsck == 1)
        cs_rad_transfer_fsck(w1, w2, tempk, kgas, agas, agasb);
    }
  }
The new modified .c files in src indeed makes sense with correct absorption and emission. Then a problem occurred in the post-process stage. The error description is below

Code: Select all

/home/jun/Downloads/code_saturne-master/src/fvm/fvm_to_cgns.c:4165: Fatal error.

Data of dimension 7 not handled


Call stack:
   1: 0x7f55490caec9 <fvm_to_cgns_export_field+0x129> (libsaturne-7.1.so)
   2: 0x7f55490bf60f <fvm_writer_export_field+0xbf>   (libsaturne-7.1.so)
   3: 0x7f5549190e1c <cs_post_write_var+0x39c>        (libsaturne-7.1.so)
   4: 0x7f5549196a41 <cs_post_time_step_output+0x1761> (libsaturne-7.1.so)
   5: 0x7f5549197401 <cs_post_write_vars+0x11>        (libsaturne-7.1.so)
   6: 0x7f55490d68b9 <caltri_+0x200e>                 (libsaturne-7.1.so)
   7: 0x7f554a1a585a <main+0x6fa>                     (libcs_solver-7.1.so)
   8: 0x7f55485c4bf7 <__libc_start_main+0xe7>         (libc.so.6)
   9: 0x555d7ffc766a <_start+0x2a>                    (cs_solver)
End of stack
In my opinion, this is probably due to the output data type. But when I did not modified the source code and just use the constant absorption coefficient, this problem would not occur. So I am very glad to get your idea. Files concerned have been attached below.
Finally, I have a suggestion about the source code in cs_rad_transfer_fsck.c concerned the Gauss-Legendre n-point quadrature.(from line 1048 to 1159) When I chose the 7-point, those code can hardly get the correct quadrature weights for each point, which means wq[3] = 1 and others equal to -nan. Maybe a correction is needed.
Thanks for your patience.
Attachments
error.txt
(797 Bytes) Downloaded 117 times
setup.xml
(12.21 KiB) Downloaded 107 times
run_solver.log
(62.88 KiB) Downloaded 120 times
Yvan Fournier
Posts: 4069
Joined: Mon Feb 20, 2012 3:25 pm

Re: Radiation data output problem with a suggestion

Post by Yvan Fournier »

Hello,

The problem is due to the fact that we use fields of arbitrary dimensions (here 7) to store `nwsgg` components, while the visualization export assumes fields should have 1 component (scalars), 3 components (vectors), 6 components (symmetric tensors), or 9 components (non-symmetric tensors).

The simplest solution here is to deactivate the postprocessing output for fields with 7 components (see setup.log for list of those). This can be done in cs_user_parameters.c, using cs_field_set_key_int(cs_field_by_name("name"), keyvis, 0), where you can substitute the correct name. It might be feasible in the GUI for some fields.

A cleaner solution would be to extract this as separate 1D fields.

I will try to deactivate default output of these values in the upcoming release also, to avoid such issues.

For the 7-point quadrature, I'll need to file a bug, at least so we don't forget to check (the developers who integrated this some while ago are now working on other projects, though one of them might be available for this).

Best regards,

Yvan
ZHUOJUN
Posts: 15
Joined: Fri Oct 16, 2020 12:16 pm

Re: Radiation data output problem with a suggestion

Post by ZHUOJUN »

Hello

Thanks for your detailed solutions. It really help a lot!
Post Reply