Turbulent Channel Flow with Periodic Boundary Conditions

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
LHL123
Posts: 1
Joined: Sun Apr 28, 2024 4:17 pm

Turbulent Channel Flow with Periodic Boundary Conditions

Post by LHL123 »

Dear Code_Saturne developers,

I am a novice user of Code_Saturne and currently undertaking LES of turbulent channel flow using the WALE model. In my simulation setup, I have configured periodic boundary conditions at the inlet/outlet and two sidewalls, with volume forces driving the fluid flow.

However, I have encountered two specific challenges that I hope to address with your expertise:

1. Custom Velocity Initialization: I aim to introduce random perturbations to the velocity initialization. To achieve this, I modified the velocity initialization code generated by the GUI, as shown in the attached file "cs_meg_initialization.c". However, upon inspecting the simulation results, I discovered that the velocity initialization was still determined by the values specified in the GUI rather than by my custom code. I seek guidance on how to ensure that user-defined code dictates the velocity initialization process.

2. Volume Forces and Flow Stability: I have implemented volume forces using the code provided in the attached file "cs_user_source_terms.c". Despite my efforts to configure the volume forces, I have been unable to maintain a constant mean flow velocity, thus hindering the attainment of statistically steady turbulent flow fields. I believe that setting a constant pressure gradient could potentially address this issue. I would greatly appreciate any insights or recommendations on how to achieve this.
I am grateful for any assistance or advice you can provide to help me overcome these challenges and improve the accuracy and stability of my LES simulations.

Thank you sincerely for your support and guidance!

Best regards,
Liu Honglei
Attachments
cs_meg_initialization.c
(2.28 KiB) Downloaded 392 times
cs_user_source_terms.c
(6.34 KiB) Downloaded 400 times
Yvan Fournier
Posts: 4135
Joined: Mon Feb 20, 2012 3:25 pm

Re: Turbulent Channel Flow with Periodic Boundary Conditions

Post by Yvan Fournier »

Hello,

Regarding 1), cs_meg* functions are not user-defined functions. They are generated by the code based on the definitions in the GUI, so your changes will be overwritten. Use cs_user_initialization instead.

Regarding 2), how much fluctuations do you have ? I am not sure you can get something completely steady using a source term, but fluctuations should be very small. I would need to check in some of our examples, but you may also find some examples on this forum. We do need to put a better example in the documentation as this question comes up quite frequently...

Best regards,

Yvan
zeph67
Posts: 53
Joined: Tue Oct 23, 2012 5:54 pm

Re: Turbulent Channel Flow with Periodic Boundary Conditions

Post by zeph67 »

Hi everyone,

I encountered a similar issue, using version 6.0.8, on this very case of periodic turbulent channel flow, however in RANS mode.

In cs_user_source_terms.f90, I implemented the source (pressure gradient) supposed to balance the viscous stresses. At the same time, I initialized the velocity field to be Ux = 20 (corresponding to the expected Umax_x at convergence). But the calculation behaved as if the initial velocity was 0 everywhere (while listing shows an initialization with Ux = 20 everywhere). Finally, convergence was reached, however after some really long time.

Afterwards, I encountered the same problem when initializing another calculation with the output of the aforementioned one: right source term but Umax_x very low at the first time step, and long time to converge back towards the right velocity values.

Any idea? I put the listing file and ythe cs_user_source_terms.f90 of the RANS calculation (first one above) in attachment.

Thanks in advance,
Christophe
Attachments
cs_user_source_terms_RANS.f90
(29.94 KiB) Downloaded 355 times
listingRANS.txt
(484.71 KiB) Downloaded 355 times
Post Reply