access fluid properties, cs_wall_function.h

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Ionut G
Posts: 43
Joined: Fri Apr 20, 2018 2:43 pm

Re: access fluid properties, cs_wall_function.h

Post by Ionut G »

Thank you very much Yvan, the code is working well now.

I want to save the "spg" variable, that I calculate in the cs_user_initialization.f90, in the results file to use it for post processing.

How can I do that?

Right now the "spg" variable it is present in the results file but it only contains zero values, even though I set values of 5 for it in the cs_user_initialization.f90 file.
I have attached below the files that I used for calculate the "spg" variable and transferring it to the solver.

Regards,
Ionut
Attachments
cs_user_parameters.c
(4.96 KiB) Downloaded 293 times
cs_user_initialization.f90
(7.2 KiB) Downloaded 302 times
cs_user_initialization.c
(3.77 KiB) Downloaded 296 times
Yvan Fournier
Posts: 4209
Joined: Mon Feb 20, 2012 3:25 pm

Re: access fluid properties, cs_wall_function.h

Post by Yvan Fournier »

Hello,

You are not using spg consistently:

- in cs_user_intialization.f90, you are allocating "spg" instead of accessing it using field_get_val_s_by_name("spg", spg) so you need to fix that.

- also, you defined spg as a field on all cells, but are defining values as if it were a subset of boundary faces, so you need to fix this.

- In case the field is not already in the preprocessing output, in cs_user_initialization.c, or cs_user_parameters (in cs_user_parameters.c, just after cs_user_model) add:

Code: Select all

cs_field_t *f = cs_field_by_name("spg");
cs_field_set_key_int(f, cs_field_key_id("post_vis"), 1);
Regards,

Yvan
Post Reply