CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Time-steps via Perl in CCL

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 23, 2004, 08:14
Default Time-steps via Perl in CCL
  #1
Rui
Guest
 
Posts: n/a
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
  Reply With Quote

Old   March 24, 2004, 17:47
Default Re: Time-steps via Perl in CCL
  #2
Glenn Horrocks
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
  Reply With Quote

Old   March 25, 2004, 16:05
Default Re: Time-steps via Perl in CCL
  #3
Rui
Guest
 
Posts: n/a
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
  Reply With Quote

Old   March 25, 2004, 17:37
Default Re: Time-steps via Perl in CCL
  #4
Glenn Horrocks
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://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
  Reply With Quote

Old   March 26, 2004, 07:54
Default Re: Time-steps via Perl in CCL
  #5
Rui
Guest
 
Posts: n/a
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

  Reply With Quote

Old   March 29, 2004, 01:47
Default Re: Time-steps via Perl in CCL
  #6
Glenn Horrocks
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 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
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A variable expressing time steps in UDF? lcw FLUENT 6 March 28, 2020 04:07
Multiple floating objects CKH OpenFOAM Running, Solving & CFD 14 February 20, 2019 10:08
calculation diverge after continue to run zhajingjing OpenFOAM 0 April 28, 2010 05:35
Time steps - Large Eddy - LES Gernot FLUENT 0 September 14, 2005 12:54
unsteady calcs in FLUENT Sanjay Padhiar Main CFD Forum 1 March 31, 1999 13:32


All times are GMT -4. The time now is 21:30.