top of page

How to Automate a Mesh Study in COMSOL: 3 Levels of Control

Sep 28
4 min read

A mesh study checks if your mesh is fine enough. You solve the same model on several mesh densities and compare the results. If the answer stops changing, you found a mesh you can trust.

You do not need to build this by hand every time. COMSOL lets you start simple and add control step by step. This article shows three levels: the default physics-controlled mesh, an edited physics-induced sequence with a size parameter, and a single scale parameter that drives the whole study automatically within one Study.


Level 1: Physics-Controlled Mesh


This is where every model starts. In the Mesh node settings, Sequence type is set to Physics-controlled mesh by default. COMSOL builds the mesh for you, based on your physics and geometry.

The Element size list has nine levels, from Extremely coarse to Extremely fine, with Normal in the middle. Pick a level, click Compute, and check your result.

This level is fast and needs no setup. But it only gives you a fixed level, not an exact size, so it is a starting point, not yet an automatic mesh study.


Element size settings in the Physics-controlled mesh.
Element size settings in the Physics-controlled mesh.

Level 2: Edit the Physics-Induced Sequence With a Size Parameter


To go further, right-click the Mesh node and choose Edit Physics-Induced Sequence (or click Edit on the Mesh toolbar). COMSOL turns the automatic mesh into a visible, editable sequence of nodes, including one or more Size nodes, while keeping the settings the physics interfaces already tuned for you.

Open a Size node in that sequence and switch its Element Size setting from Predefined to Custom. This opens Element Size Parameters, with fields like Maximum element size and Minimum element size. These fields accept a parameter name, not only a number.

Go to Global Definitions > Parameters and add a parameter, for example hmax. Type hmax into Maximum element size.

Now right-click your Study node and add Parametric Sweep. It sits as a sub-node inside that same study. Add hmax to the Parameter names list, with values like 5, 2, and 1 mm. Click Compute once, and COMSOL rebuilds the mesh and re-solves for every value automatically, while the rest of the mesh still follows the physics-based settings.

If you ever want to go back to the automatic version, right-click the Mesh node and choose Reset to the Physics-Induced Sequence.


Size node in the User-controlled mesh.
Size node in the User-controlled mesh.

Level 3: One Scale Node for the Whole Mesh


Level 2 already automates the study, but a real model often has more than one Size node in the sequence, for example, one for the general domain and one for a boundary layer. Editing every one of them by hand is easy to get wrong.


COMSOL has a node built for exactly this: Scale. Right-click the Mesh node and choose Scale. This adds a Scale node to the sequence, open the Scale node's settings. There is one field: Element size scale. A value under 1 makes the mesh finer. A Value over 1 makes it coarser. By default, Geometric entity level is set to Entire geometry, so the Scale node touches every element size already set before it in the sequence, no matter how many Size nodes you have.

Like other numeric settings fields, Element size scale can take a parameter instead of a plain number. Add a parameter in Global Definitions > Parameters, for example scale, and type it into the field.


Now sweep only scale in the Parametric Sweep, with values like 2, 1, 0.5, and 0.25. A scale of 1 keeps the mesh you already tuned. A scale of 0.25 makes every size a quarter of that, across the whole sequence, with one field to control instead of many.


Watching Convergence in Real Time with a Probe


You don't have to wait for the whole sweep to finish to see whether your mesh is converging. Right-click Definitions and open the Probes submenu. Pick the probe type that matches what you want to track. A Domain Point Probe watches a value at one point. A Global Variable Probe watches any global expression, like maxop1(T) for a maximum temperature.

Type your expression into the probe's settings before you run the Parametric Sweep.

Once you click Compute, COMSOL opens a Probe Plot and a Probe Table on their own, and updates them live while it solves. In a Parametric Sweep, each mesh size adds a new point to the plot as soon as that run finishes. You watch the value settle in real time, right in front of you, instead of waiting for the full sweep to end.

When the line on the Probe Plot goes flat, you've found your converged mesh.


Need Help Automating a Mesh Study in COMSOL?

Setting up a mesh study by hand takes time, and doing it wrong can quietly ruin good results. If you want help automating a mesh convergence study, editing a physics-induced sequence, or trusting the numbers your model gives you, reach out to Simulation Guys. We help you build COMSOL models you can actually rely on.



bottom of page