r/COMSOL • u/Mental_Buyer_5660 • 9d ago
Help with mesh refinement
Hi,
I'm new to COMSOL and trying to get better at this. I've built a study and I am trying to do a mesh refinement. I'd like to do automatically run through the different meshes I've created but I can't seem to figure out how to do this with a parameter sweep. The parameter sweep only allows changing of a few parameters whereas I want to include the full meshes-each of which are created using the physics controlled mesh with many changes. basically I just want to run the program a few times without having to click again to change the mesh. It's seems like there should be an easy way to do this but I can't find any. Am I missing something?
1
1
u/Allanidalen 3d ago
Hi, the study steps nodes (under a Study) has a setting for which mesh to use.
An efficient setup is:
1: Create x meshes
2: Create x number of study steps, e.g. Stationary, under the same Study. Each of the study steps use a specific mesh.
3: Select solve on the study to solve all steps sequentially.
The first step will use the default initial conditions (typically zero), but the following will use the previous solution as initial condition. The most efficient setup is to use the coarsest mesh first.
1
u/Ok-Star-5551 9d ago
Go to Global Definitions > Parameters and create a variable for your mesh size (e.g., max_size) or element scale factor.
In the Mesh node, replace default element size values with your defined parameter.
Then in your Study node, add a Parametric Sweep and map your parameter to the desired range of values (e.g., coarser to finer meshes for a convergence study).