Topological Optimizazion in Code Saturne
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
Topological Optimizazion in Code Saturne
Hi all,
as stated in the topic i'm interested in find a way to use code_saturne as a cfd topological optimizer. If you search something on youtube there are some solutions made by commercial software. It could be interesting for applications such designing pipes and collectors. Similar on what is possible to do in FEM software for TO in SIMP algorithms, where the density is function of the material stresses, i would try to set a user density function of the local velocity module. Is it possible to do something similar in CS ? Or do you have any other idea capable to perform TO in CFD with CS ?
Thanks in advance.
as stated in the topic i'm interested in find a way to use code_saturne as a cfd topological optimizer. If you search something on youtube there are some solutions made by commercial software. It could be interesting for applications such designing pipes and collectors. Similar on what is possible to do in FEM software for TO in SIMP algorithms, where the density is function of the material stresses, i would try to set a user density function of the local velocity module. Is it possible to do something similar in CS ? Or do you have any other idea capable to perform TO in CFD with CS ?
Thanks in advance.
-
- Posts: 4208
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Topological Optimizazion in Code Saturne
Hello,
I am not too familiar with they way you compute a density function, but you should be able do to just about anything in the cs_user_extra_operations function, which is called at the end of every time step.
As to how you drive the optimization process itself, I assume you need to drive a succession of computations. The built-in autovnv framework might be sufficient for this. Otherwise, SALOME has some features for parametric studies, or you can roll your own scripts, depending on what fits best.
Regards,
Yvan
I am not too familiar with they way you compute a density function, but you should be able do to just about anything in the cs_user_extra_operations function, which is called at the end of every time step.
As to how you drive the optimization process itself, I assume you need to drive a succession of computations. The built-in autovnv framework might be sufficient for this. Otherwise, SALOME has some features for parametric studies, or you can roll your own scripts, depending on what fits best.
Regards,
Yvan
Re: Topological Optimizazion in Code Saturne
Hi Yvan,
after some studying about the principles of topological optimization, now i'm a little bit more conscious of what I should do. My goal is to maximize the heat transfer at the wall in a water cooling circuit defining the best flux shape. According to theory, in first instance, i should increase the overall turbulence inside my channel to increase the thermal exchange between fluid layers. This means that i should maximise "k" of my k-omega model inside my domain. In order to do that i should "penalise", after a computation, the cells where lower is the k value. Penalise means that i should sediment such small k fluid domain, considering such regions as solid.
I'm thinking of raising the viscosity to quasi-solid values and to have a thermal conductivity similar to the wall material. Next to this another computation should be made where only the remaining fluid domain (water viscosity) will be solved; then again the penalisation step and so on until i'll find a good and homogenenus heat exchange at my wall. computation -> penalisation -> computation -> penalisation ..... and the ratio fluid domain/overall volume will be (in example) 1 --> 0,96 --> 0,92 --> ...... --> 0,5
For what i know about Code_saturne i suppose this is quite feasible, however i'm low skilled in coding. I.e. i should:
- at the end of every computation: load the entire k-distribution among the cells (i suppose as an array), find the max, min and average k values;
- set the viscosity and conductvity value of the x% lower k distribution values to solid behaviour
- restart the computation with such values
re-do the loop
Any advice/ documents / related example on how to do tihis ?
Thanks in advance,
Andrea
after some studying about the principles of topological optimization, now i'm a little bit more conscious of what I should do. My goal is to maximize the heat transfer at the wall in a water cooling circuit defining the best flux shape. According to theory, in first instance, i should increase the overall turbulence inside my channel to increase the thermal exchange between fluid layers. This means that i should maximise "k" of my k-omega model inside my domain. In order to do that i should "penalise", after a computation, the cells where lower is the k value. Penalise means that i should sediment such small k fluid domain, considering such regions as solid.
I'm thinking of raising the viscosity to quasi-solid values and to have a thermal conductivity similar to the wall material. Next to this another computation should be made where only the remaining fluid domain (water viscosity) will be solved; then again the penalisation step and so on until i'll find a good and homogenenus heat exchange at my wall. computation -> penalisation -> computation -> penalisation ..... and the ratio fluid domain/overall volume will be (in example) 1 --> 0,96 --> 0,92 --> ...... --> 0,5
For what i know about Code_saturne i suppose this is quite feasible, however i'm low skilled in coding. I.e. i should:
- at the end of every computation: load the entire k-distribution among the cells (i suppose as an array), find the max, min and average k values;
- set the viscosity and conductvity value of the x% lower k distribution values to solid behaviour
- restart the computation with such values
re-do the loop
Any advice/ documents / related example on how to do tihis ?
Thanks in advance,
Andrea
-
- Posts: 4208
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Topological Optimizazion in Code Saturne
Hello,
This seems possible. In parallel, you need to make sure the minimum and maximum values are the global ones (so synchronize those). Most arrays such as temperature, turbulence variables, etc are accessed as "fields". The Doxygen user documentation has quite a few examples with this.
Also, setting a "solid-like" viscosity might have some numerical effects in case of strong jumps, so you may want to increase the value progressively. You could also use head losses for a similar purpose. In any case, wall laws are only handled at walls, not at boundaries between marked cells and others, so this may limit the precision of the approach.
Best regards,
Yvan
This seems possible. In parallel, you need to make sure the minimum and maximum values are the global ones (so synchronize those). Most arrays such as temperature, turbulence variables, etc are accessed as "fields". The Doxygen user documentation has quite a few examples with this.
Also, setting a "solid-like" viscosity might have some numerical effects in case of strong jumps, so you may want to increase the value progressively. You could also use head losses for a similar purpose. In any case, wall laws are only handled at walls, not at boundaries between marked cells and others, so this may limit the precision of the approach.
Best regards,
Yvan
Re: Topological Optimizazion in Code Saturne
Hi,
following your advice i'm trying an optimization following the SIMP algorithm (esponential behaviour from max to min viscosity) instead of a BESO algorithm (0-1 viscosity).
I'm running some slow single core simulations just to test the algorithm. However i want to scale to fully parallel. As you pointed before i have to find the real maximum in the entire domain and not N local min and max.
my actual code is :
do iel = 1, ncel
if (cvar_k(iel).gt.vkmax) then
vkmax = cvar_k(iel)
endif
if (cvar_k(iel).lt.vkmin) then
vkmin = cvar_k(iel)
endif
varkmed = varkmed+cvar_k(iel)
enddo
varkmed = varkmed/ncel
Is there any tutorial on how to perform such action for the entire domain ?
Thank you in advance. I hope to show you some results in the next days.
following your advice i'm trying an optimization following the SIMP algorithm (esponential behaviour from max to min viscosity) instead of a BESO algorithm (0-1 viscosity).
I'm running some slow single core simulations just to test the algorithm. However i want to scale to fully parallel. As you pointed before i have to find the real maximum in the entire domain and not N local min and max.
my actual code is :
do iel = 1, ncel
if (cvar_k(iel).gt.vkmax) then
vkmax = cvar_k(iel)
endif
if (cvar_k(iel).lt.vkmin) then
vkmin = cvar_k(iel)
endif
varkmed = varkmed+cvar_k(iel)
enddo
varkmed = varkmed/ncel
Is there any tutorial on how to perform such action for the entire domain ?
Thank you in advance. I hope to show you some results in the next days.
-
- Posts: 4208
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Topological Optimizazion in Code Saturne
Hello,
Yes, you have some examples here: http://code-saturne.org/doxygen/src/cs_ ... ons_p.html.
Regards,
Yvan
Yes, you have some examples here: http://code-saturne.org/doxygen/src/cs_ ... ons_p.html.
Regards,
Yvan
Re: Topological Optimizazion in Code Saturne
Hi Yvan, i'm trying to further investigate what you told me about the autovnv framework to set a succession of computations. Is there any documentation to read or any example / tutorial ??Yvan Fournier wrote: As to how you drive the optimization process itself, I assume you need to drive a succession of computations. The built-in autovnv framework might be sufficient for this. Otherwise, SALOME has some features for parametric studies, or you can roll your own scripts, depending on what fits best.
Thank you in advance
Andrea
-
- Posts: 4208
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Topological Optimizazion in Code Saturne
Hello Andrea,
Thre is a pdf documentation for Autovnv included in the code distribution since version 3.0. You can access it using "code_saturne info -g autovnv".
I don't think there is a tutorial, though I can post a simple example tomorrow.
Version 5.0 will also have simple GUI for this (you can test it if you download trunk).
Regards,
Yvan
Thre is a pdf documentation for Autovnv included in the code distribution since version 3.0. You can access it using "code_saturne info -g autovnv".
I don't think there is a tutorial, though I can post a simple example tomorrow.
Version 5.0 will also have simple GUI for this (you can test it if you download trunk).
Regards,
Yvan
Re: Topological Optimizazion in Code Saturne
Hi all,
as you said before, the strong jumps that i impose have a very strong influence on simulation convergence and stability. Is there any theoric advice you can give me to increase code stability ? i'm already using upwind schemes with SIMPLEC.
Thanks
as you said before, the strong jumps that i impose have a very strong influence on simulation convergence and stability. Is there any theoric advice you can give me to increase code stability ? i'm already using upwind schemes with SIMPLEC.
Thanks
-
- Posts: 284
- Joined: Fri Dec 04, 2015 1:42 pm
Re: Topological Optimizazion in Code Saturne
Hello Andrea,
Are you following th advice of Yvan ("...you may want to increase the value progressively")? This will allow that the fluid flow adapt to the new viscosity distribution, avoiding strong jumps in the velocity.
Is your penalization function continuos in terms of "k"? This will give you smooth transitions.
Also you can try with the relaxation coecient
Regards,
Luciano
Are you following th advice of Yvan ("...you may want to increase the value progressively")? This will allow that the fluid flow adapt to the new viscosity distribution, avoiding strong jumps in the velocity.
Is your penalization function continuos in terms of "k"? This will give you smooth transitions.
Also you can try with the relaxation coecient
Regards,
Luciano