**Versions:**All versions

## Problem Description

I am solving a transient model and changed the stepsize in the **Times:** field in the Study Settings, but the solver is still taking exactly the same timesteps. It seems the timesteps that the solver is taking are not related to the times that I have specified. Why is this?

How do I verify the results of my transient simulation?

I increased the total timespan that I am simulating, and now the solver timesteps and results are quite different. Why?

How do I get the solver to take different timesteps?

## Solution

By default, the stepsize entry in the **Times:** field shown in the screenshot below only controls at what times the data is written out, it does not directly control the timesteps the solver takes, although it can have an effect upon the initial timsetep. Increasing the number of output timesteps between the start and end time does not usually change the timesteps that the solver actually takes. In most cases, the software internally uses either an adaptive or fixed timestepping that is independent of these output times. Thus, the data stored in output may be interpolated between the timesteps taken by the solver. The software will automatically determine a set of solver settings that are reasonable for the combinations of physics in the model, but these can be modified.

*Default settings of the time dependent solver.*

#### Adaptive Timestepping

Most time-dependent problems in COMSOL Multiphysics are by default solved with an adaptive timestepping scheme. This means that the software will automatically adjust the timestep size to maintain the desired **Relative Tolerance**. The default setting for this is **Physics Controlled** as shown in the screenshot above. It can also be changed to **User Controlled** and then you can manually enter a different relative tolerance, as shown in the screenshot below. Lowering the relative tolerance to smaller numbers will result in smaller timesteps, which increases solution accuracy, and solving time.

*A user-controlled relative tolerance.*

Re-solving the model with a tighter relative tolerance, as well as re-solving with a finer mesh, is how you get the solver to reduce the timestep and verify your model. To gain trust in the results of a transient model, you must compare your model against other models run with finer meshes and finer timesteps. It is important that you do so to verify your model results.

If your model includes loads that are abruptly changing in time, you should also include the **Events** interface within your model. This will tell the solver how to accurately capture abrupt changes in the solution. For guidance in using **Events**, see: Knowledge Base 1245: Solving Models with Pulsed Loads in Time

When the solver starts, it estimates an initial timestep size to take based upon the total simulation time. Thus, if you solve the same model twice, for different total times, the initial timestep can be different. This can lead to different results if there is something significant happening immediately after the start time. To specify the initial time step size, go to the **Time-Dependent Solver** settings, **Time Stepping** section, enable the **Initial step:** option and enter a fixed initial step size, as shown in the screenshot below. Note that the software is still free to choose a timestep smaller than this value, but will not make it larger. Also consider if **Events** can be used instead.

*Specifying the initial timestep size that the solver tries to take.*

During the solution, the solver will automatically make the timestep smaller as needed to resolve any fast variations in the solution, as needed. It will also make the timestep larger during periods when the solution is only varying gradually. You can control the maximum timestep taken by going to the **Time-Dependent Solver** settings, **Time Stepping** section, and change the **Maximum step constraint:** from its default value of **Automatic** to either **Constant** or **Expression**, as shown in the screenshot below. The **Constant** option specifies a maximum possible timestep, and the **Expression** option can make the maximum timestep constraint vary based upon any global expression in the model.

*Specifying the maximum possible timestep size that the solver will take.*

It is not possible to explicitly control the smallest timestep that the adaptive timestepper takes. When you observe the solver taking very small timesteps this is an indication that your model is approaching a singularity, that the solution is shooting off to infinity, or that the solution is changing faster than is resolvable given the current relative tolerance and mesh size. See also: Knowledge Base 1261: Performing a Mesh Refinement Study, Knowledge Base 1127: Improving convergence in nonlinear time dependent models , and Knowledge Base 1240: Manually Setting the Scaling of Variables.

#### Manual Timestepping

It is also possible that your model uses a constant timestepping scheme. Some classes of problems, such as transient pressure acoustics models, are solved with a fixed timestep by default. Many wave-type problems (where the solution fields oscillate in time and space) are better solved with a fixed timestep.
To find out if a fixed timestep is being used, go to the Time-Dependent Solver settings, Time Stepping section. There, you will see the method used to compute the solution. This will be either **BDF**, **Generalized alpha**, or **Runge-Kutta**. For a description of these methods, see Knowledge Base 1062: BDF, Generalized Alpha, and Runge-Kutta Methods Below that, you will see a pull-down for the **Steps taken by solver**, this will be either **Free**, **Intermediate**, **Strict**, or **Manual**. The **Free** option lets the solver freely choose the timestep as described above. The **Manual** timestep option fixes the timestep.

*Switching between the options for the steps taken by the solver.*

When using **Manual** timestepping, you can explicitly set the timestep taken, and the relative tolerance entry no longer affects the solver behavior. For guidance in how to choose the timestep for wave-type problems, see: Knowledge Base 1118: BDF, Resolving time-dependent waves and Knowledge Base 1244: Solving Wave-Type Problems with Step Changes in the Loads

#### Other Solver Options

There are two other timestepping options: **Intermediate** and **Strict**. These modify the behavior of the free timestepping algorithm by forcing the solver to take additional timesteps.

With the **Intermediate** option, the solver will take one additional timestep within each interval between the requested output times, but the solver is still free to choose when this intermediate step occurs.

The **Strict** option forces the solver to take a timestep at exactly the requested output times. The solver is still free to introduce additional timesteps in between to maintain the specified tolerance, or due to Events. By introducing a timestep at exactly the requested output times, there is no interpolation of the data.

If you want to output the results at the exact timesteps taken by the solver, go to the **Time-Dependent Solver** settings, **Output** section, and set the **Times to store:** to **Steps taken by solver**, as shown below. Be aware that this option may generate a lot of output data. When the **Specified values** option is used (the default) the software will write out data at the requested time-points by interpolating between the actual solver timesteps.

*Saving the data at the timesteps taken by the solver.*

In version 5.6, this option has changed, as shown in the screenshot below. There are also additional options to save data only every few timesteps, or only at the solver timestep closest to the requested timestep.

*Saving the data at the timesteps taken by the solver in version 5.6.*

If you want to reduce the amount of data that is stored in your model, also see: Knowledge Base 1255: Reducing the amount of data stored in a model

COMSOL makes every reasonable effort to verify the information you view on this page. Resources and documents are provided for your information only, and COMSOL makes no explicit or implied claims to their validity. COMSOL does not assume any legal liability for the accuracy of the data disclosed. Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark details.