Page 1 of 3

### streamwise periodicity

Posted: Sun Oct 15, 2023 8:23 am
Dear Code_Saturne developers,

I am currently working on simulating a rectangular duct with streamwise periodicity using LES in Code_Saturne. The simulation process involves two steps: initially using the Batten method to introduce turbulent flow at the inlet to induce flow transition, and then switching the inlet boundary to a constant velocity boundary and running the simulation for a sufficiently long time to achieve a fully developed turbulent state.

In the simulation, I am attempting to utilize the "mapped inlet" feature in the Code_Saturne GUI to achieve streamwise periodicity. However, after running the simulation for an adequate duration, I observed that the velocity profiles at the inlet and outlet are inconsistent.

Upon referring to the available resources, it seems that I may need to introduce a momentum source term in the momentum equation to counteract the influence of shear forces in the duct on the velocity. I have attempted to incorporate this source term in the momentum equation, but the velocity profiles at the inlet and outlet still do not align.

I am currently perplexed and unsure of how to proceed. I would greatly appreciate your guidance and suggestions to help resolve this issue with setting up the streamwise periodic boundary conditions.

Thank you very much for your time and assistance.

Best regards,

JIAWEI

### Re: streamwise periodicity

Posted: Sun Oct 15, 2023 8:24 am
velocity profile plots

### Re: streamwise periodicity

Posted: Mon Oct 16, 2023 7:10 pm
Hello,

For LES, the "mapped inlet" option may not be the best, as it adds some interpolations.

It is strange though that velocity profiles at the inlet and outlet are inconsistent. How much do they differ ?

For this sort of case, using a velocity source term which balances out with friction is usually the best approach. The attached example shows how this can be done with a user-defined function.

I am not sure the Batten method at the inlet is useful, as in the periodic case, there are no actual inlet or outlet faces (they become interior faces). Using synthetic turbulence for the volume initialization is good though.

Best regards,

Yvan

### Re: streamwise periodicity

Posted: Tue Oct 17, 2023 8:48 am
Dear Yvan Fournier,
Thank you very much for your prompt response!
There are ductline ,outlet,inlet velocity profile after implementing the mapped inlet boundary conditions. Additionally, I would Not using the mapped inlet implies the need to set the inlet and outlet as periodic boundaries in the GUI, and subsequently use source terms to counterbalance shear forces?
Furthermore, Could you please provide guidance on how to accurately calculate turbulence kinetic energy and turbulent dissipation rate in the synthetic eddy generation program?
I eagerly await your response and greatly appreciate your time and expertise.
Best regards,
JIAWEI

### Re: streamwise periodicity

Posted: Thu Oct 19, 2023 12:41 am
Hello,

Yes, using "true" periodic conditions means using source terms (as per the example I posted) to counterbalance the shear forces.

As regards synthetic turbulence generation, you can check the user examples, but I have only basic knowledge about that part of the code, so I'll suggest to others to complete this answer...

Best regards,

Yvan

### Re: streamwise periodicity

Posted: Thu Oct 19, 2023 8:23 am
Dear Yvan,

I truly appreciate your patience in helping me

Despite your previous advice, I have not been able to resolve the issue at hand. I have explored two different approaches.

Firstly, I attempted to use the "mapped inlet" method to specify the inlet velocity without employing any source terms. I ran the simulation using the RANS method for a significant duration, but the velocity profiles did not align as expected.

In my second attempt, I set the inlet and outlet boundaries as periodic and introduced momentum source terms to drive the flow. Once again, I conducted the simulation using the RANS method for an extended period, but the inlet and outlet velocity profiles still did not converge as anticipated.

I find myself perplexed by these outcomes and am unsure where the issue might lie. Here are the setup files for the periodic boundary and screenshots for the mapped inlet.

Thank you once again for your ongoing support and patience.

JIAWEI

### Re: streamwise periodicity

Posted: Fri Oct 20, 2023 7:04 pm
Hello,

When using periodic conditions and a source term, you need to continually balance that source term with friction. That is done in the example I posted, but am not sure whether it would work using a constant source term as you seem to be doing with the GUI.

Also, how misaligned are the velocity profiles and how do you extract them ? Interpolation issues might be at play here.

Best regards,

Yvan

### Re: streamwise periodicity

Posted: Mon Jan 22, 2024 4:08 am
Hi Yvan,

Thanks for your suggestions on streamwise periodicity. I've implemented the "cs_user_source_terms.c" file you shared to maintain a continuous balance between the source term and friction. My question is that how can we determine the appropriate value for the momentum in the statement 'cs_real_t momentum = 1;'?

I've experimented with different values, including those from the example provided in the Code_Saturne GUI:
#example:
tau = 10.; # relaxation time (s)
vel_x_imp = 1.5; #target velocity (m/s)
Su = rho * (vel_x_imp - u) / tau;
dSudu = - rho / tau; # Jacobian of the source term
These values result in the spatial mean velocity in the 'run_solver.log' file consistently increasing or decreasing with each time step.

I've attached my setup.xml file and a model picture for your reference. I would greatly appreciate any insights you might have on this matter.

Best regards,
Ximeng

### Re: streamwise periodicity

Posted: Mon Jan 22, 2024 9:41 pm
Hello,

I think the velocity should converge to that balancing the source term and the friction after a number of iterations.

To choose the target velocity, I'll try to find another example. I think we had one at some time, but am not sure whether I am looking at the wrong example or if the setup was simplified. I think the source term is equivalent to imposing a pressure gradient, but need to check the details.

So I'll get back to you soon.

Best regards,

Yvan

### Re: streamwise periodicity

Posted: Tue Jan 23, 2024 6:00 pm
Hi Yvan,

Thanks! I will wait for your feedback.

Best regards,
Ximeng