Differences in result computed from .msh and .geo file

Dear Community

I wrote a code for calculating the drag experienced by a sphere in Stokes flow. When I performed the calculations on a .msh file [titled “annular.msh”] that was created in GMSH, and imported into FEniCS using the procedure described here, I get the theoretically correct answer of 6\pi.

However when I use gmsh -2 annular.geo to create annular.msh, and perform the necessary calculations I notice that the computed drag is \sim 20.6, which is erroneous.

May I please know there is a difference in the output? Also, I would like to know how the mesh resolution is specified in the geo file, so that I may work with the script directly, instead of having to generate the geometry in the GUI each time.

The contents of “annular.geo” are given below:

// Gmsh project created on Thu Oct 21 14:19:22 2021
//+
Circle(1) = {0, 0, 0, 1, 0, Pi};
//+
Circle(2) = {0, 0, 0, 5, 0, Pi};
//+
Line(3) = {1, 3};
//+
Line(4) = {2, 4};
//+
Curve Loop(1) = {2, -4, -1, 3};
//+
Plane Surface(1) = {1};
//+
Physical Curve(1) = {1};
//+
Physical Curve(2) = {2};
//+
Physical Surface(3) = {1};


Thank You
Warm Regards

I do not understand what your issue is, as I do not understand the difference between the first “annular.msh” file you obtained, and the second one where you used “gmsh -2 annular.geo”.

Please note that there are plenty of ways to use gmsh with python, including the gmsh python api, for instance described here: Using the GMSH Python API to generate complex meshes | Jørgen S. Dokken where the output is an msh file you can read in as described in