Different Results each time run Multi-threaded
Hi, Each time I run the following script multi-threaded I get a different element count, varying by as much as 1-3%. This doesn't seem to happen when I run single-threaded. Why?
Merge StrCat("./",Sprintf("%g", RL), "/DemagnetizingFieldTest.pos");
NewModel;
SetFactory("OpenCASCADE");
Sphere(1) = {0, 0, 0, 50, -Pi/2, Pi/2, 2*Pi};
Cylinder(2) = {0, 0, -10, 0, 0, 20, 1.1, 2*Pi};
Cylinder(3) = {0, 0, -10, 0, 0, 20, 1, 2*Pi};
BooleanDifference{ Volume{2}; Delete; }{ Volume{3}; Delete; }
Sphere(4) = {0, 0, 0, .075, -Pi/2, Pi/2, 2*Pi};
Coherence;
Physical Volume(1) = {5}; //Air
Physical Volume(2) = {2}; //Coil
Physical Volume(3) = {4}; //Sphere
Physical Surface(1) = {10}; //Air outer surface
For i In {0:(RL-1)}
Plugin(ModifyComponents).View = 0;
If (i==0)
Plugin(ModifyComponents).Expression0 = StrCat(Sprintf("%g", Mesh.MeshSizeMax), " * v0");
Else
Plugin(ModifyComponents).OtherView = i;
Plugin(ModifyComponents).Expression0 = "v0 * w0";
EndIf
Plugin(ModifyComponents).Run;
EndFor
Coils[ ] = {2};
Coils_surf[ ] = Unique(Abs(Boundary { Volume { Coils[ ]}; } ) );
Coils_lines[ ] = Unique(Abs(Boundary { Surface { Coils_surf[ ]}; } ) );
IronSphere[ ] = {4};
IronSphere_surf[ ] = Unique(Abs(Boundary { Volume { IronSphere[ ]}; } ) );
IronSphere_lines[ ] = Unique(Abs(Boundary { Surface { IronSphere_surf[ ]}; } ) );
//coil mesh
Field[1] = MathEval;
Field[1].F = Sprintf("%g",0.1);
Field[2] = Restrict;
Field[2].IField = 1;
Field[2].EdgesList = {Coils_lines[ ]};
Field[2].FacesList = {Coils_surf[ ]};
Field[2].VolumesList = {Coils[ ]};
//IronSphere mesh
Field[3] = MathEval;
Field[3].F = Sprintf("%g",0.015);
Field[4] = Restrict;
Field[4].IField = 3;
Field[4].EdgesList = {IronSphere_lines[ ]};
Field[4].FacesList = {IronSphere_surf[ ]};
Field[4].VolumesList = {IronSphere[ ]};
If (RL==0)
Field[5] = Min;
Field[5].FieldsList = {2, 4};
Background Field = 5;
Else
Field[5] = PostView;
Field[5].ViewIndex = 0;
Field[6] = Min;
Field[6].FieldsList = {2, 4, 5};
Background Field = 6;
EndIf
I run Gmsh 4.9.0-git-701db57a using the following command
./gmsh -format msh2 -nt 4 -optimize_threshold 0.3 -setnumber RL 0 -save -o ./DemagnetizingFieldTest.msh -clmax 14.7 -algo auto -3 ./DemagnetizingFieldTest.geo