cs_wall_functions.h

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

cs_wall_functions.h

Post by Ionut G »

Hello,

What cells are used in the calculation process by the "cs_wall_functions.h" function?
I am assuming that it is applied on the cells adjacent to a wall boundary.

I am trying to implement a wall function that considers, in predicting the velocity distribution, the pressure gradient.
I calculated the pressure gradient in "cs_user_boundary_conditions.f90" subroutine for the cells adjacent to the wall boundary, and then I transfer the pressure gradient variable to the "cs_wall_functions.h" function.
To be sure that I pass correctly the data from the FORTRAN subroutine to "cs_wall_functions.h" function, I write the pressure gradient variable in 2 text files, from FORTRAN subroutine and from "cs_wall_functions.h" function.

When I compare the text files, I see that I have a smaller number of entries in the FORTRAN subroutine than the "cs_wall_functions.h" function.

Shouldn't I have the same number of entries in both text files?

For calculating the pressure gradient on the cell adjacent to the wall, I used the "getfbr" subroutine and then "ifabor" function.


Best regards,
Ionut
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: cs_wall_functions.h

Post by Yvan Fournier »

Hello,

Sorry, without at least some parts of the code, I can't really guess.

Regards,

Yvan
Ionut G
Posts: 43
Joined: Fri Apr 20, 2018 2:43 pm

Re: cs_wall_functions.h

Post by Ionut G »

Hello,

I attached the files that I use in Code_Saturne, as an archive.

In "cs_user_boundary_conditions.f90", I calculate the pressure gradient.

In the file "cs_wall_functions.h", I modified the "cs_wall_functions_1scale_log", starting at line number 198.
Here I will use the variable for pressure gradient for further calculations.

I do not understand what I am missing that I do not have the same number of entries in the text files, saved from FORTRAN and C (result_fortran90.txt and result.txt).

Thank you for your help.


Best Regards,

Ionut
Attachments
Pres.Gradient test.rar
(16.5 KiB) Downloaded 120 times
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: cs_wall_functions.h

Post by Yvan Fournier »

Hello,

Are you running in parallel or serial ? If running in parallel, opening the same files and buffering issues could explain this.

Regards,

Yvan
Ionut G
Posts: 43
Joined: Fri Apr 20, 2018 2:43 pm

Re: cs_wall_functions.h

Post by Ionut G »

Hello,

I am running in parallel, 28 processes.

Is there a solution to overcome this issue?


Best Regards,

Ionut
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: cs_wall_functions.h

Post by Yvan Fournier »

Hello,

Yes, avoid opening and writing to the same file from multiple processors, or use MPI-IO.

Files are really not the simplest way to pass data, and are inefficient here. Why don't you use allocated arrays ? Possibly in a user module.

Regards,

Yvan
Ionut G
Posts: 43
Joined: Fri Apr 20, 2018 2:43 pm

Re: cs_wall_functions.h

Post by Ionut G »

Hello,

Thank you Yvan, your recommendations helped me to solve the issue.

I have written to files for testing purposes, to be sure that the variable I pass from FORTRAN to C is correct.

I have a variable allocated to pass the data from FORTRAN to C.

Best Regards,
Ionut
Ionut G
Posts: 43
Joined: Fri Apr 20, 2018 2:43 pm

Re: cs_wall_functions.h

Post by Ionut G »

Hello,


I think I have another issue transferring the data from "cs_user_boundary_conditions.f90" to "cs_wall_functions.h".
In "cs_user_boundary_conditions.f90" I compute the pressure gradient for all the cells adjacent to the wall boundary, then I used these values to calculate the friction velocity in the "cs_wall_functions.h".

The issue appears when I look at the data transferred from "cs_user_boundary_conditions.f90" to "cs_wall_functions.h".
The values are not the same.
I verified the values of the pressure gradient in both "cs_user_boundary_conditions.f90" and "cs_wall_functions.h", by writing text files from both "cs_user_boundary_conditions.f90"and "cs_wall_functions.h".

I attached the files here.
I run the simulation for 10 iterations.
At line 68485 the third iteration starts, and in both text files the values of the pressure gradient are written for 34242 cells.
In both text files at line 68485 the values are the same, but from line 68486 to 102726 the values from "cs_user_boundary_conditions.f90" are different than in "cs_wall_functions.h".

Why I do not have the same values in both files, written from "cs_user_boundary_conditions.f90" and "cs_wall_functions.h"?
Did I miss something?
The functions that I use in Code_Saturne are the the ones from the previous messages.


Best Regards,

Ionut
Attachments
result_cs_wall_functions.txt
(5.68 MiB) Downloaded 129 times
result_cs_user_boundary_conditions.txt
(9.14 MiB) Downloaded 125 times
Post Reply