streamwise periodicity

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
surina
Posts: 5
Joined: Sun Oct 08, 2023 9:10 am

streamwise periodicity

Post by surina »

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
Attachments
cs_user_source_terms-momentum.c
(4.55 KiB) Downloaded 208 times
cs_user_les_inflow-base.c
(3.8 KiB) Downloaded 188 times
surina
Posts: 5
Joined: Sun Oct 08, 2023 9:10 am

Re: streamwise periodicity

Post by surina »

velocity profile plots
Attachments
outlet.png
inlet.png
ductline center .png
Yvan Fournier
Posts: 4073
Joined: Mon Feb 20, 2012 3:25 pm

Re: streamwise periodicity

Post by Yvan Fournier »

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
Attachments
cs_user_source_terms.c
(6.99 KiB) Downloaded 208 times
surina
Posts: 5
Joined: Sun Oct 08, 2023 9:10 am

Re: streamwise periodicity

Post by surina »

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
Attachments
ductline center .png
outlet.png
inlet.png
Yvan Fournier
Posts: 4073
Joined: Mon Feb 20, 2012 3:25 pm

Re: streamwise periodicity

Post by Yvan Fournier »

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
surina
Posts: 5
Joined: Sun Oct 08, 2023 9:10 am

Re: streamwise periodicity

Post by surina »

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
Attachments
PERIODIC setup.xml
(10.73 KiB) Downloaded 203 times
MAPPED INLET setup.xml
(10.29 KiB) Downloaded 174 times
Yvan Fournier
Posts: 4073
Joined: Mon Feb 20, 2012 3:25 pm

Re: streamwise periodicity

Post by Yvan Fournier »

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
ximeng
Posts: 23
Joined: Sun Jan 22, 2023 3:28 pm

Re: streamwise periodicity

Post by ximeng »

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
Attachments
model.JPG
setup_icemmesh.xml
(8.93 KiB) Downloaded 49 times
Yvan Fournier
Posts: 4073
Joined: Mon Feb 20, 2012 3:25 pm

Re: streamwise periodicity

Post by Yvan Fournier »

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
ximeng
Posts: 23
Joined: Sun Jan 22, 2023 3:28 pm

Re: streamwise periodicity

Post by ximeng »

Hi Yvan,

Thanks! I will wait for your feedback.

Best regards,
Ximeng
Post Reply