Calling the temperature distribution in user function

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

Calling the temperature distribution in user function

Post by ZHUOJUN »

Hello,

I am working on a radiative heat transfer problem, and it is necessary to define the absorption coefficient around the field. I have noticed that the "cs_user_radiative_transfer.c" file in the example folder, and I am quite confused that the formal parameters of the "cs_user_rad_transfer_absorption" function does not include the temperature.

So I am very eager to find out how to call the temperature of each cell (which I defined in the GUI, thermal option).
In the .C file, it is easy to call the ID and coordinate of each cell by the struct "cs_glob_mesh_quantities" and "cs_glob_mesh", should I consider the similar method to achieve my goal?
And last, the .C file have a step of reading from file, declaring arrays with 78 dimensions, this makes me confused too.

Thanks for your generous help.
Attachments
eaxmple.c
(2.52 KiB) Downloaded 131 times
Yvan Fournier
Posts: 4075
Joined: Mon Feb 20, 2012 3:25 pm

Re: Calling the temperature distribution in user function

Post by Yvan Fournier »

Hello,

You can always access the temperature using the field API, for example:

Code: Select all

const cs_real_t *cvar_t = cs_fluid_by_name("temperature")->val;
In which case you then have access to current temperature values in the cvar_t array.

I am not sure which arrays with 78 dimensions you are referring to.

Regards,

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

Re: Calling the temperature distribution in user function

Post by ZHUOJUN »

Greeting,

First, I really appreciate it.
And the arrays I mentioned which have 78 elements are these below

Code: Select all

int n_v_segs = 77;
            cs_real_t zray2[78], k_up[78], k_down[78];
They initially appeared in the example code named "cs_user_radiative_transfer.c" in the folder, "user_examples", or in the attachment file.

Thank you so much!
Yvan Fournier
Posts: 4075
Joined: Mon Feb 20, 2012 3:25 pm

Re: Calling the temperature distribution in user function

Post by Yvan Fournier »

Hello,

These arrays are related to a data file for a specific (atmospheric radiation) case, so you can ignore them.

Regards,

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

Re: Calling the temperature distribution in user function

Post by ZHUOJUN »

Hello,

Thank you for your patience. It really helps a lot.
Post Reply