# Time stepping in comsol multiphysics

I would like to know which is the algorithm Comsol uses in order to correct the time step it uses. For example, when you try to solve an equation you've written in the PDE coefficient interface, and you set free time-step, Comsol automatically choose the time step in order to obtain the specified absolute error. Anyway, how does Comsol choose the correct time step?

• In Navier Stokes equations the parameter to look to, is the CFL number, that has to be smaller than one.
• For generic transport problem the parameter is the Peclét number.

But what about all the other problems? There is a general way to find a toughtful maximum time step?

• Your question is not well posed: before asking for the time step you should ask for the time integration method used to solve your equations. (Sorry I have no idea of which integration schemes are implemented in comsol, and I doubt that there is a one-size-fits-all one used by default.) This said, it seems that there is a fundamental misconception in your question between the concept of variable step size methods and the stability condition for explicit time integration in ODE's. – Stefano M Jun 22 '13 at 20:26
• Hi, thank you for your comment. Yes, I could have some misunderstanding. Comsol uses backward differences scheme for time derivatives, which should be always stable. Nevertheless, even setting a very low absolute tolerance (let's say 1e-12) the solution isn't always realistic. Only specifying a lower maximum time step I can achieve a realistic solution. I Know Comsol uses an error estimation to respect the absolute tolerance, but I can't find how comsol obtain such an estimation. Do you think there is a way for predict a thoughtful time step? Thank you – Lorenzo Nespoli Jun 24 '13 at 7:50
• Adaptive time stepping is a subject of active research, but it's not new. It is based on a number of constraints. The most basic ones are related to the mesh resolution (i.e. mesh size $\Delta x$): so to solve a generic advection-diffusion problem, you should respect at least 2 conditions. The first is diffusion related: $\Delta t < \frac{(\Delta x)^2}{D}$ where $D$ is the diffusivity, and the second is advection-related: $\Delta t < \frac{\Delta x}{v}$ where $v$ is the velocity, coupled with CFL condition to become: $\Delta t < \text{CFL} \cdot\frac{\Delta x}{v}$. – SAAD Aug 21 '14 at 10:12
• For more advanced cases (e.g. adaptive meshing), additional constraints can be added from the interpolation error depending on the interpolation scheme and order ... Having said all this, I am not really aware of what Comsol uses, but it is good to read the user guide. – SAAD Aug 21 '14 at 10:13

Given a PDE choosing the correct numerical solving strategy requires some knowledge/expertise. (Computational Science is indeed a "Science" and one has to learn it.)

In application specific software (e.g commercial FEM solvers for engineering problems like crash problems or metal forming) this knowledge is somehow "crystalized" and embedded, so that most application engineers should be able to numerically solve physical problems without too much trouble. Analysts can concentrate on the physics of the problem, and not too much on the numerics. This is an optimistic view: really tough problems require multidisciplinary expertise (num. analysis, computer science, engineering, physics) even when application specific commercial software is used; but at least, in a day by day use, big errors do not occur.

On the contrary your question is very general and broad, asking for guidelines applicable to a generic PDE and solving strategy, in a non-application specific environment.

I think that without any little hint to the type of problem you are trying to solve it is impossible to give you a sensible answer, as it is impossible to condense a sizable chunk of Computational Science in a few paragraphs.

Nevertheless I think that some useful advice could be given.

1. Physical quantities have dimensions: saying that $10^{-12}$ is a very small absolute error is meaningless. Check your equation for dimensional consistency; if possible try to write them in a non-dimensional well-scaled form.

2. For PDE's the "correct" time step may depend not only on how the equations are scaled (choice of physical units of measure) but also on the spatial discretization (finer mesh, smaller time step.) If you do not have theoretical results at hand, compare results varying both time-step and mesh-size.

3. Always try to compute a global quantity (e.g. kinetic energy) and plot its evolution over time at variable time steps: you will gain insight on what's going on.

4. There is nothing wrong in a trial-an-error procedure, provided you are able to asses if a given solution is physically meaningful.

Not much help, I know, but I hope this will be a good starting point.

It's not possible to answer your question in general, since comsol likely uses different methods depending on the problem.

The general answer is that a partial differential equation is discretized in both space and time. Just like you have to set up a volume grid, you have to break time into chunks. The solution accuracy is a function of the time-step "grid".

What variable time-step algorithms do is try to dynamically pick the time-step, to make it smaller when the solution is changing rapidly. This can involve testing a bunch of different time-steps, and picking one that gives acceptable error with respect to the finest grid it's checked.

The maximum time-step then controls how quickly the solution can be found when the solution looks linear in time. It should be on order of the relevant time-scale of your system, since if your estimate is way off, the integrator won't be able to draw a smooth line between its attempted time-steps. This may happen, in particular, if the thing oscillates - in which case you'd need less than the oscillation period.