Compute Time & Memory

Why your simulation takes too long or runs out of memory, and how to fix both.


If you only have 2 minutes

Compute time and memory are driven first and foremost by your accuracy target. You set, directly or indirectly, an accepted relative error, and Dr.Q keeps refining the mesh until it reaches that target. The smaller the error you demand, the more elements, compute time, and memory it takes, and that relationship grows disproportionately: the last few percentage points of accuracy are by far the most expensive. So choose the accepted error deliberately, as accurate as necessary rather than as accurate as possible.

How compute time and memory scale

A smaller accuracy target requires a finer mesh. Element count scales with the cube of refinement: halve the element size and you get roughly 8× as many elements. Compute time grows faster still, because Dr.Q solves the system directly (LU factorization), whose cost grows disproportionately with the number of degrees of freedom; memory also grows disproportionately, though more mildly. Going from 10% to 5% relative error costs a multiple of going from 25% to 20%.

Run a coarse mesh first to check the setup is right. Only refine once the boundary conditions, loads, and material are confirmed.

How accurate is accurate enough?

As a user you tend to want the simulation "as accurate as possible." It's wiser to match the accepted error to the uncertainty in your inputs. The discretization error Dr.Q reports is only one of several error sources; there are also uncertainties in loads, material properties, and geometry. These sources combine, and the total is dominated by the largest one.

So ask yourself: how well do I actually know the assumptions going into this simulation? If you can only estimate the loads to about 15%, demanding a 1% simulation result is questionable.

What helps

The following levers reduce compute time and memory:

  • Loosen the target error. The most important lever, and the one directly in your hands. You don't touch the mesh, Dr.Q handles the refinement; you only set the accepted error (see "How accurate is accurate enough?").
  • Simplify the geometry. Mesh fineness follows not only the target but also the geometry: small design details like engravings, tiny fillets, or holes force a fine mesh just to represent them, regardless of the target. Often such details don't affect the result at all. Remove them before solving.
  • Exploit symmetry. Shrinks the model with no loss of information: for symmetric geometry and loading, half or a quarter is enough. See the article on Symmetry.

When you run out of memory

If there isn't enough memory, the solver aborts while factorizing the stiffness matrix (Errors 189, 282, 338, 340). The model is too large for the available memory. The same levers as above help: loosen the target error, simplify the geometry, or use symmetry.

When the study can't reach your target

If the convergence study exhausts its refinement budget before reaching the accepted error, Dr.Q stops and reports it (Warning 8, or Error 11 "maximum iterations reached") and returns the last, not-yet-converged result. Two ways forward: loosen the target error so the accuracy already reached is enough (see "How accurate is accurate enough?"), or accept the last result if its reported error is tolerable for your purpose. If the quantity refuses to converge no matter how fine the mesh, that is a singularity, not a budget problem, see Singularities.

Nonlinear analyses

For nonlinear analyses (contact, plasticity, large deformation), additional factors affect compute time:

  • Use as few load steps as still converge.
  • Avoid unnecessary nonlinear features, e.g. frictional contact when bonded contact is physically adequate.

Pitfalls

Close to the limit in threshold questions: If you define the goal not as a fixed relative error but as a threshold question (e.g. "does the peak stress stay below 800 MPa?"), Dr.Q derives the required accuracy from how far the current result is from the threshold. If the result sits close to the limit, that question demands very high accuracy, and mesh and compute time explode. Example: a limit of 800 MPa and a first result of 801 MPa gives a target error of just 0.125%.

Singularities: at a stress singularity the estimated error still decreases, but very slowly, and the peak stress at the point never converges anyway. So a tighter target gets disproportionately expensive there. If the study reports a singularity, model a fillet there or evaluate the result away from the point. More on this under Singularities.