#193 closed defect (wontfix)
Mesh generation (and consequently, timestepping) differs between Linux and Windows.
Reported by: | ole | Owned by: | Nick |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Functionality and features | Version: | |
Severity: | normal | Keywords: | |
Cc: |
Description (last modified by ole)
The same script and same ANUGA version generates slightly different meshes on different platforms. The example anuga_work/development/demos/island.py shows this. I have checked in the generated meshes using the names island_linux.msh and island_windows.msh. On either platform the timestepping is dramatically different depending on which mesh is being used. Here's some output:
Using the Linux mesh
Mesh statistics: Number of triangles = 7208 Extent [m]: x in [0.000000, 100.000000] y in [0.000000, 100.000000] Areas [m^2]: A in [0.644829, 9.596606] number of distinct areas: 7208 Histogram: [0.644829, 1.540006[: 5421 [1.540006, 2.435184[: 1610 [2.435184, 3.330362[: 37 [3.330362, 4.225539[: 35 [4.225539, 5.120717[: 37 [5.120717, 6.015895[: 21 [6.015895, 6.911073[: 18 [6.911073, 7.806250[: 11 [7.806250, 8.701428[: 8 [8.701428, 9.596606]: 10 Percentiles (10%): 720 triangles in [0.644829, 0.931708] 720 triangles in [0.931708, 1.017388] 720 triangles in [1.017388, 1.096717] 720 triangles in [1.096717, 1.173627] 720 triangles in [1.173627, 1.265768] 720 triangles in [1.265768, 1.367499] 720 triangles in [1.367499, 1.473311] 720 triangles in [1.473311, 1.605096] 720 triangles in [1.605096, 1.788979] 720 triangles in [1.788979, 9.002288] 8 triangles in [9.002288, 9.596606] Boundary: Number of boundary segments == 230 Boundary tags == ['top', 'right', 'bottom', 'left'] ------------------------------------------------ Time = 0.0000, steps=0 (0) Time = 1.0000, delta t in [0.00490999, 0.02104604], steps=120 (0) Time = 2.0000, delta t in [0.00488622, 0.00548481], steps=194 (0)
Using the Windows mesh
Mesh statistics: Number of triangles = 7210 Extent [m]: x in [0.000000, 100.000000] y in [0.000000, 100.000000] Areas [m^2]: A in [0.629728, 9.479879] number of distinct areas: 7210 Histogram: [0.629728, 1.514743[: 5259 [1.514743, 2.399758[: 1773 [2.399758, 3.284773[: 40 [3.284773, 4.169788[: 38 [4.169788, 5.054803[: 37 [5.054803, 5.939819[: 16 [5.939819, 6.824834[: 21 [6.824834, 7.709849[: 9 [7.709849, 8.594864[: 10 [8.594864, 9.479879]: 7 Percentiles (10%): 721 triangles in [0.629728, 0.938614] 721 triangles in [0.938614, 1.023260] 721 triangles in [1.023260, 1.099714] 721 triangles in [1.099714, 1.180817] 721 triangles in [1.180817, 1.270424] 721 triangles in [1.270424, 1.373040] 721 triangles in [1.373040, 1.479134] 721 triangles in [1.479134, 1.602771] 721 triangles in [1.602771, 1.780142] 721 triangles in [1.780142, 9.479879] Boundary: Number of boundary segments == 232 Boundary tags == ['top', 'right', 'bottom', 'left'] ------------------------------------------------ Time = 0.0000, steps=0 (0) Time = 1.0000, delta t in [0.00046156, 0.02104604], steps=947 (0) Time = 2.0000, delta t in [0.00040646, 0.00047853], steps=2306 (0)
Can you investigate
1: Why this is? 2: If there is a way of avoiding the mesh condition that creates the degenerate timestepping (194 steps/s to 2306 steps/s)?
This problem was produced in changeset:4725
Ta Ole
Change History (6)
comment:1 Changed 16 years ago by ole
- Description modified (diff)
comment:2 Changed 16 years ago by duncan
- Resolution set to worksforme
- Status changed from new to closed
comment:3 Changed 16 years ago by duncan
- Resolution worksforme deleted
- Status changed from closed to reopened
comment:4 Changed 16 years ago by duncan
- Owner changed from duncan to Nick
- Status changed from reopened to new
Hi Nick, Could you run this on your Windows box and linux box and see what results you get.
comment:5 Changed 16 years ago by duncan
- Resolution set to wontfix
- Status changed from new to closed
I fixed the code, so running island.py ran the mesh generator and got the different meshes for different os's.
Why is this? 'triangle' is the mesh gen code, as as ticket #34 noted, the results from different os's is not the same.
I changed the maximum_triangle_area from 2 to 2.1 and got these results in windows;
X:\anuga_work\development\demos>python island.py Generating mesh to file "island.tsh" Constructing Delaunay triangulation by divide-and-conquer method. Recovering segments in Delaunay triangulation. Removing unwanted triangles. Spreading regional attributes and area constraints. Adding Steiner points to enforce quality. Writing vertices. Writing triangles. Writing segments. Writing neighbors. Statistics: Input vertices: 8 Input segments: 8 Input holes: 0 Mesh vertices: 3515 Mesh triangles: 6804 Mesh edges: 10318 Mesh exterior boundary edges: 224 Mesh interior boundary edges: 71 Mesh subsegments (constrained edges): 295 ------------------------------------------------ Mesh statistics: Number of triangles = 6804 Extent [m]: x in [0.000000, 100.000000] y in [0.000000, 100.000000] Areas [m^2]: A in [0.706040, 9.961472] number of distinct areas: 6804 Histogram: [0.706040, 1.631583[: 5106 [1.631583, 2.557126[: 1521 [2.557126, 3.482670[: 45 [3.482670, 4.408213[: 37 [4.408213, 5.333756[: 24 [5.333756, 6.259299[: 34 [6.259299, 7.184842[: 12 [7.184842, 8.110385[: 7 [8.110385, 9.035928[: 8 [9.035928, 9.961472]: 10 Percentiles (10%): 680 triangles in [0.706040, 0.987090] 680 triangles in [0.987090, 1.081477] 680 triangles in [1.081477, 1.170691] 680 triangles in [1.170691, 1.255268] 680 triangles in [1.255268, 1.354013] 680 triangles in [1.354013, 1.451399] 680 triangles in [1.451399, 1.568303] 680 triangles in [1.568303, 1.697416] 680 triangles in [1.697416, 1.873541] 680 triangles in [1.873541, 9.503874] 4 triangles in [9.503874, 9.961472] Boundary: Number of boundary segments == 224 Boundary tags == ['top', 'left', 'right', 'bottom'] ------------------------------------------------ Time = 0.0000, steps=0 (0) Time = 1.0000, delta t in [0.00635619, 0.02178911], steps=99 (0) Time = 2.0000, delta t in [0.00631652, 0.00699387], steps=150 (0)
I changed the maximum_triangle_area to 1.01 and got these results on windows;
X:\anuga_work\development\demos>python island.py Generating mesh to file "island.tsh" self.mode pzq28.0aanAa Constructing Delaunay triangulation by divide-and-conquer method. Recovering segments in Delaunay triangulation. Removing unwanted triangles. Spreading regional attributes and area constraints. Adding Steiner points to enforce quality. Writing vertices. Writing triangles. Writing segments. Writing neighbors. Statistics: Input vertices: 8 Input segments: 8 Input holes: 0 Mesh vertices: 7233 Mesh triangles: 14208 Mesh edges: 21440 Mesh exterior boundary edges: 256 Mesh interior boundary edges: 105 Mesh subsegments (constrained edges): 361 ------------------------------------------------ Mesh statistics: Number of triangles = 14208 Extent [m]: x in [0.000000, 100.000000] y in [0.000000, 100.000000] Areas [m^2]: A in [0.266045, 9.848374] number of distinct areas: 14208 Histogram: [0.266045, 1.224278[: 13958 [1.224278, 2.182511[: 97 [2.182511, 3.140744[: 39 [3.140744, 4.098977[: 24 [4.098977, 5.057209[: 37 [5.057209, 6.015442[: 15 [6.015442, 6.973675[: 18 [6.973675, 7.931908[: 4 [7.931908, 8.890141[: 9 [8.890141, 9.848374]: 7 Percentiles (10%): 1420 triangles in [0.266045, 0.472471] 1420 triangles in [0.472471, 0.512533] 1420 triangles in [0.512533, 0.551147] 1420 triangles in [0.551147, 0.589756] 1420 triangles in [0.589756, 0.633956] 1420 triangles in [0.633956, 0.684702] 1420 triangles in [0.684702, 0.739388] 1420 triangles in [0.739388, 0.807238] 1420 triangles in [0.807238, 0.890087] 1420 triangles in [0.890087, 8.756090] 8 triangles in [8.756090, 9.848374] Boundary: Number of boundary segments == 256 Boundary tags == ['top', 'right', 'bottom', 'left'] ------------------------------------------------ Time = 0.0000, steps=0 (0) Time = 1.0000, delta t in [0.00307226, 0.01453896], steps=220 (0) Time = 2.0000, delta t in [0.00416887, 0.00767447], steps=178 (0)
and these results in Linux;
Generating mesh to file "island.tsh" self.mode pzq28.0aanAa Constructing Delaunay triangulation by divide-and-conquer method. Recovering segments in Delaunay triangulation. Removing unwanted triangles. Spreading regional attributes and area constraints. Adding Steiner points to enforce quality. Writing vertices. Writing triangles. Writing segments. Writing neighbors. Statistics: Input vertices: 8 Input segments: 8 Input holes: 0 Mesh vertices: 7235 Mesh triangles: 14211 Mesh edges: 21445 Mesh exterior boundary edges: 257 Mesh interior boundary edges: 108 Mesh subsegments (constrained edges): 365 ------------------------------------------------ Mesh statistics: Number of triangles = 14211 Extent [m]: x in [0.000000, 100.000000] y in [0.000000, 100.000000] Areas [m^2]: A in [0.266045, 9.851605] number of distinct areas: 14211 Histogram: [0.266045, 1.224601[: 13966 [1.224601, 2.183157[: 89 [2.183157, 3.141713[: 37 [3.141713, 4.100269[: 25 [4.100269, 5.058825[: 34 [5.058825, 6.017381[: 19 [6.017381, 6.975937[: 21 [6.975937, 7.934493[: 10 [7.934493, 8.893049[: 5 [8.893049, 9.851605]: 5 Percentiles (10%): 1421 triangles in [0.266045, 0.472536] 1421 triangles in [0.472536, 0.511012] 1421 triangles in [0.511012, 0.550546] 1421 triangles in [0.550546, 0.590495] 1421 triangles in [0.590495, 0.633956] 1421 triangles in [0.633956, 0.681650] 1421 triangles in [0.681650, 0.735879] 1421 triangles in [0.735879, 0.804128] 1421 triangles in [0.804128, 0.892741] 1421 triangles in [0.892741, 9.851605] 1 triangles in [9.851605, 9.851605] Boundary: Number of boundary segments == 257 Boundary tags == ['top', 'bottom', 'right', 'left'] ------------------------------------------------ Time = 0.0000, steps=0 (0) Time = 1.0000, delta t in [0.00168977, 0.01405944], steps=454 (0) Time = 2.0000, delta t in [0.00153936, 0.00182543], steps=612 (0)
For these parameters Linux takes longer.
So it seems that the small differences in the meshes produced by generating the mesh in different operating systems results in significantly different time steps for the island simulation. Note that the island simulation was put together to investigate unrealistic behaviour.
I have sent an email to the creater of triangle to see if he knows why different OS's result in different meshes.
comment:6 Changed 15 years ago by duncan
email from Jonathan, the creater of triangle
I’ve noticed that it produces different meshes if it runs on linux or Windows.
Do you know why this is, and if this will be fixed/changed in the
future?
Duncan,
I'm guessing that this is because of the difference in the ways the two compilers handle floating point operations. For instance, one compiler might use a fused mutliply-add instruction where another doesn't. This can perturb the positions of the newly inserted vertices, thereby changing the final mesh.
If my diagnosis is correct, I doubt that this can be "fixed" efficiently. I think you'd have to use a floating-point emulator to make sure the floating-point arithmetic always comes out exactly the same regardless of the compiler or operating system. That would be very very slow.
Jonathan
Ticket #34 notes that there is a difference between the output from triangle for different OS's. I cannot find the tests it mentions though.
I ran this on my windows xp box, changeset:4725 and got the following result;
I got the same result using my Linux box.