How to generate a 2D diamond lattice network? #2840
kunal0kumar0sinha
announced in
FAQ
Replies: 2 comments 1 reply
-
I'm sure I had a better way to do this at some point, but this is what I came up with just now: import openpnm as op
pn = op.network.BodyCenteredCubic([10, 10, 2])
op.topotools.trim(pn, pores=pn.pores('zmax'))
op.topotools.trim(pn, throats=pn.throats('body_to_body'))
op.topotools.trim(pn, throats=pn.throats('corner_to_corner'))
pn['pore.coords'] *= [1, 1, 0]
del pn.params['dimensionality']
h = op.visualization.plot_connections(pn)
op.visualization.plot_coordinates(pn, ax=h) |
Beta Was this translation helpful? Give feedback.
1 reply
-
I think this is the other way that I've done this in that past: from skimage.morphology import diamond
im = diamond(20)
pn = op.network.CubicTemplate(im)
pn = op.topotools.rotate_coords(pn, a=0, b=0, c=45) Perhaps this is a bit more logical. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have been trying to generate a diamond grid (attached figure). Can you please suggest how to do this?
Beta Was this translation helpful? Give feedback.
All reactions