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. |
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... |
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.
|
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! |
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? |
Quote:
then, to the get characteristic time, you would have to divide the length by the velocity, NOT multiply it... Quote:
Quote:
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:
hope this helps! cheers! |
Thank you very much for the explanation. I definitively gonna do some reading on this.
|
No problem. Come back if you have any more questions!
|
All times are GMT -4. The time now is 02:05. |