- **CFX**
(*http://www.cfd-online.com/Forums/cfx/*)

- - **Time-steps via Perl in CCL
**
(*http://www.cfd-online.com/Forums/cfx/20268-time-steps-via-perl-ccl.html*)

Time-steps via Perl in CCL
Hi everyone, I´ve been doing transient simulations and calculating the time-steps, via CEL, as function of the maximum velocity in the domain at each instant. Now I´d like to calculate those time-step values using a Perl script in CCL. But it seems that unlike CEL, the Perl script is only evaluated at the beginning of the Run. Is there any way that the script is called by the Solver at each transient iteration? Or do I need Fortran to do it? Thanks
Rui |

Re: Time-steps via Perl in CCL
Hi Rui,
If CEL cannot do it you will need fortran. I think fortran can set the timestep (but I am not sure, never done it). If you are doing a Courant number or CFL number calculation you should be able to do that entirely in CEL. What do you need perl/fortran for? Glenn |

Re: Time-steps via Perl in CCL
Hi, thanks for your answer Glenn.
I'm doing mold filling simulations, and have been calculating, with CEL, the time-step for each iteration as function of the maximum velocity, such that the maximum Courant number is constant. However, this doesn't work as well as I want to. If I change the inlet conditions, reducing the inlet velocity, the time-steps increase as I keep the same Courant number criteria, causing larger residuals! Another problem, which may be critical, is when the flow front gets close to the outlet, the residuals get much larger. So I thought of calculating the time-step value as function of the residuals and the previous time-step, such that if the residuals are larger than a chosen value, the new time-step will be set smaller than the previous one, if the residuals are smaller, the time-step may be increased. For this, I need the variables TSnew (new time-step) and TSold (old time-step). I tried to do it with a Perl script like this: !$TSold=$TSnew; !$Tsnew=function($TSold,$Residuals); Timesteps = $TSnew But it seems that the Perl script, unlike CEL, is only evaluated at the beginning of the Run, causing the time-steps to be constant. Is there anyway that the Perl script is called by the solver every transient iteration? Or is User Fortran necessary for doing this job? I suppose that having, at each instant, time-steps as short as the necessary to obtain accuracy and as long as possible to decrease the computing time, is an important issue for everyone who deals with transient simulations. So I'd like to know how other people deal with this question. And how can you achieve an optimization between the used time-step and the number of iterarations inside each time-step? Thanks Rui |

Re: Time-steps via Perl in CCL
hi Rui,
The normal way for judging when you have reached convergence for a timestep is when the residuals go below a tolerance. When you change the timestep and it gets harder and easier to acheive this tolerance, all that means is that the solver should take more iterations per timestep for the larger timesteps. There is a useful tip on the CFX community site about judging convergence: http://www-waterloo.ansys.com/cfxcom...onvergence.htm It is most applicable to steady state flows, but the concepts are transferable to transient flows. In general it is common practice in transient flows to makes such that the solver reaches the convergence tolerance in 3-5 iterations per timestep. With CFX5 this is more efficient than using a larger timestep and a greater number of iterations. I can see no reason to adjust the timestep based on how the last timestep converged. If it converges to the tolerance then you are fine. Regards, Glenn |

Re: Time-steps via Perl in CCL
Hi, thanks again Glenn
So do you think the best option is to choose a constant time-step, set a target for the residuals and let the solver do the necessary number of iterations to achieve that target? And how do you choose that time-step value? Such that the solver reaches the residuals target in 3-5 iterations? I just want to find an optimization between time-steps and number of iterations, for a chosen residual target criteria, such that the computing time may decrease. Rui |

Re: Time-steps via Perl in CCL
Hi Rui,
For many single phase transient problems, optimum simulation speed with good accuracy occurs when the solver can converge to the specified tolerance in 3-5 iterations. Generally you would then adjust the timestep size such that this occurs. The residual tolerance you choose is then dependant on the criteria discussed in the technical tip, from a fast, approximate solution to a precision solution. Often multi-phase simulations like a few more iterations per timestep, the number I seem to remember as a guide is about 10. Glenn |

All times are GMT -4. The time now is 01:42. |