CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   How to calculate simulation time? (http://www.cfd-online.com/Forums/main/91885-how-calculate-simulation-time.html)

Yur August 25, 2011 09:18

How to calculate simulation time?
 
Hello guys,

I would like to know, if there is a proper way to calculate the simulation time and the number of timesteps.

Thanks.

cfdnewbie August 25, 2011 10:21

What do you mean by simulation time?
The physical time you are trying to cover in your simulation? That's something you fix/decide upon....
The wall clock time your code needs to perform a certain # of iterations? That's something you can deduce from benchmarks done with your code....

not clear what you mean exactly....

cheers...

Yur August 25, 2011 10:51

Sorry for the confusion. With the simulation time, I mean actually the physical size of one timestep. I've read somewhere, that it could be calculated with the CFL number, but I don't really know where to start with this.

cfdnewbie August 25, 2011 12:03

There are two things that govern your timestep:
a) physics. Find out which is the timestep that governs your physics, i.e. what is the smallest time phenomena in your solution. Let's say if something occurs at a frequency of 1000 Hz, then certainly that would give you an estimate for your upper bound on the time step
b) numerical stability. (talking about explicit schemes): CFL condition is an expression of the fact that you have a wave speed in your system, which governs the transport of information. Your time stepping scheme should be compatible with physics in a sense that your timestep should allow the information to travel only to an adjacent control volume in a single time step, i.e. you have to respect the natural way of information transport in the fluid.

You might google the CFL condition or check standard text books on it, the gist is the following:
Compute your fastest wave speed in the system (largest EV of the flux jacobi matrix) and divide grid cell length by it. that gives you the characteristic time information needs to cross one grid cell.
Take a fraction of this time (= safety margin = CFL number) as this timestep for your computation.

This might be an oversimplification for hyperbolic 1d probs only, but it should give you an idea about what to do.

cheers!

Yur August 25, 2011 13:39

My finest grid cell size is 0.5mm and characteristic speed is 55m/s.

So if I understand this correctly , I have to do the following, to get the value of one time step :

0.0005 * 55 = 0.0275

0.0275 / 340 (speed of sound ) = 0.00008 sec

This would be one time step right?

And just another noob question. One timestep is the time needed to calculate equations over one cell or the time one particle takes to calculate one flowpass in a simulation volume?

cfdnewbie August 25, 2011 13:53

Quote:

Originally Posted by Yur (Post 321614)
My finest grid cell size is 0.5mm and characteristic speed is 55m/s.

So if I understand this correctly , I have to do the following, to get the value of one time step :

0.5 * 55 = 27,5

ehh...no :) first, you mixed your units... mm * m/s...
then, to the get characteristic time, you would have to divide the length by the velocity, NOT multiply it...
Quote:

27,5 / 340 (speed of sound ) = 0.08 sec
the speed of sound in your calculation will most likely NOT be fixed, since it is calculated from c= sqrt(gamma * R * T), so it will depend on your local T(p,rho)...


Quote:

This would be one time step right?
no, unfortunately not. the characteristic wave speeds (eigenvalues) of the Euler part are (2d), u, u, u-c, u+c,...
so what you have to do is to calculate these speeds locally (c, abs(u) everywhere), THEN determine the max velocity and take that.... I suggest you do some reading on this...

Quote:

And just another noob question. One timestep is the time needed to calculate equations over one cell or the time one particle takes to calculate one flowpass in a simulation volume?
the timestep you calculate is the maximum allowable time step you can advance your solution in time without the simulation becoming unstable due to numerical errors. Let's say you want to simulate the flow from 0s to 10s... and you find out that your max timestep is 1s...then you would have to perform 10 timesteps, each integrating the solution over 1 s.....

hope this helps!

cheers!

Yur August 25, 2011 16:47

Thank you very much for the explanation. I definitively gonna do some reading on this.

cfdnewbie August 25, 2011 16:53

No problem. Come back if you have any more questions!


All times are GMT -4. The time now is 05:51.