
[Sponsors] 
March 23, 2004, 08:14 
Timesteps via Perl in CCL

#1 
Guest
Posts: n/a

Hi everyone, I´ve been doing transient simulations and calculating the timesteps, via CEL, as function of the maximum velocity in the domain at each instant. Now I´d like to calculate those timestep 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 

March 24, 2004, 17:47 
Re: Timesteps via Perl in CCL

#2 
Guest
Posts: n/a

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 

March 25, 2004, 16:05 
Re: Timesteps via Perl in CCL

#3 
Guest
Posts: n/a

Hi, thanks for your answer Glenn.
I'm doing mold filling simulations, and have been calculating, with CEL, the timestep 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 timesteps 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 timestep value as function of the residuals and the previous timestep, such that if the residuals are larger than a chosen value, the new timestep will be set smaller than the previous one, if the residuals are smaller, the timestep may be increased. For this, I need the variables TSnew (new timestep) and TSold (old timestep). 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 timesteps 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, timesteps 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 timestep and the number of iterarations inside each timestep? Thanks Rui 

March 25, 2004, 17:37 
Re: Timesteps via Perl in CCL

#4 
Guest
Posts: n/a

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://wwwwaterloo.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 35 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 

March 26, 2004, 07:54 
Re: Timesteps via Perl in CCL

#5 
Guest
Posts: n/a

Hi, thanks again Glenn
So do you think the best option is to choose a constant timestep, 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 timestep value? Such that the solver reaches the residuals target in 35 iterations? I just want to find an optimization between timesteps and number of iterations, for a chosen residual target criteria, such that the computing time may decrease. Rui 

March 29, 2004, 00:47 
Re: Timesteps via Perl in CCL

#6 
Guest
Posts: n/a

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 35 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 multiphase simulations like a few more iterations per timestep, the number I seem to remember as a guide is about 10. Glenn 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Multiple floating objects  CKH  OpenFOAM Running, Solving & CFD  12  March 21, 2016 14:05 
calculation diverge after continue to run  zhajingjing  OpenFOAM  0  April 28, 2010 04:35 
A variable expressing time steps in UDF?  lcw  FLUENT  4  January 16, 2006 13:19 
Time steps  Large Eddy  LES  Gernot  FLUENT  0  September 14, 2005 11:54 
unsteady calcs in FLUENT  Sanjay Padhiar  Main CFD Forum  1  March 31, 1999 12:32 