Merge lp:~asc/fluidity/mesh_spherical_shells into lp:fluidity

Proposed by Adam Candy
Status: Merged
Merged at revision: 4065
Proposed branch: lp:~asc/fluidity/mesh_spherical_shells
Merge into: lp:fluidity
Diff against target: 32 lines (+7/-1)
1 file modified
tools/gmsh2triangle.py (+7/-1)
To merge this branch: bzr merge lp:~asc/fluidity/mesh_spherical_shells
Reviewer Review Type Date Requested Status
Alexandros Avdis Approve
Review via email: mp+125552@code.launchpad.net

Description of the change

New option in gmsh2triangle to interpret a 3d input mesh as a 2d mesh on a spherical shell.
This avoids having to apply sed to the node file.

An improvement would be to have Fluidity detect this independent of the dimension in the node file.

To post a comment you must log in.
Revision history for this message
Alexandros Avdis (alexandros-avdis) wrote :

Looks good

review: Approve
Revision history for this message
Simon Mouradian (mouradian) wrote :

There should be an accompanying update to the manual. I will add this shortly.

Revision history for this message
Adam Candy (asc) wrote :

Thanks Simon

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/gmsh2triangle.py'
2--- tools/gmsh2triangle.py 2012-03-14 11:01:33 +0000
3+++ tools/gmsh2triangle.py 2012-09-20 17:28:19 +0000
4@@ -16,6 +16,9 @@
5 help="discard 3rd coordinate of node positions",
6 action="store_const", const=2, dest="dim", default=3)
7
8+optparser.add_option("--shell", "-s",
9+ help="interpret a 3d input mesh as a 2d mesh on a spherical shell",
10+ action="store_const", const=True, dest="spherical_shell", default=False)
11
12 optparser.add_option("--internal-boundary", "-i",
13 help="mesh contains internal faces - this option is required if you have assigned " +
14@@ -57,6 +60,9 @@
15 sys.exit(1)
16
17 dim=options.dim
18+nodefile_dim = dim
19+if options.spherical_shell:
20+ nodefile_dim -= 1
21
22 nodefile_linelist = []
23 for i in range(nodecount):
24@@ -154,7 +160,7 @@
25 sys.exit(1)
26
27 nodefile=file(basename+".node", 'w')
28-nodefile.write(`nodecount`+" "+`options.dim`+" 0 0\n")
29+nodefile.write(`nodecount`+" "+`nodefile_dim`+" 0 0\n")
30 j=0
31 for i in range(nodecount):
32 j=j+1