sphere object without periodicity?

Hi All, I want to define a sphere with a center that sits on one face of my domain, [0., 0.5, 0.5] in unitary coordinates. However, the boundary conditions in this case are not periodic, and so I don't want periodicity. I did some preliminary testing, and it appears that periodicity is being enforced--if I make a sphere of radius 0.25 and set it at [0., 0.5,0.5] it returns the same number of cells as when it is at [0.5, 0.5, 0.5]--which is completely enclosed within the domain. I would expect the sphere to have half as many cells in the former case if periodicity is not being enforced, as only one hemisphere is in the domain then. I should point out that this is a non-AMR simulation. I perused the source, but I didn't see anything that obviously turned off (or on!) periodicity. Any suggestions would be most appreciated. thanks, JS

Jeff,
I want to define a sphere with a center that sits on one face of my domain, [0., 0.5, 0.5] in unitary coordinates. However, the boundary conditions in this case are not periodic, and so I don't want periodicity.
I agree that it should be possible to turn off periodicity for a sphere. Before it's fixed, I think you can use a boolean container (test this below, I haven't!): base_sp = pf.h.sphere([0, 0.5, 0.5], 0.25) box = pf.h.region([0.5]*3, [0.75, 0.25, 0.25], [1, 0.75, 0.75]) sp = pf.h.boolean([base_sp, "NOT", box]) Let me know if you run into trouble. -- Stephen Skory s@skory.us http://stephenskory.com/ 510.621.3687 (google voice)

Hi Jeff and Stephen, There are only a few places where periodicity is used, and it looks like sphere's are one of them. It might be worthwhile to take this opportunity to factor out the domain shifting, set a 'periodicity' boolean on StaticOutput, and then add a "shift_domain" function for selection. Then rather than something like: for off_i in [-1, 0, 1]: for off_j in [-1, 0, 1]: for off_k in [-1, 0, 1]: left = left + off_i * domain_width ... one could do: for off_i, off_j, off_k in offset_domain(pf): ... This way when it's not periodic, you just get back 0's, and when it is, you get back 1's. Anwyay, for spheres I'd specificalyl look in the calculation of Radius and in the geometry_finding_mixing.py module to see where the shifting occurs. It should be in both the get_list_of_grids function for AMRSphere and in the Radius function in universal_fields.py. -MAtt On Sat, Dec 24, 2011 at 9:04 AM, Stephen Skory <s@skory.us> wrote:
Jeff,
I want to define a sphere with a center that sits on one face of my domain, [0., 0.5, 0.5] in unitary coordinates. However, the boundary conditions in this case are not periodic, and so I don't want periodicity.
I agree that it should be possible to turn off periodicity for a sphere. Before it's fixed, I think you can use a boolean container (test this below, I haven't!):
base_sp = pf.h.sphere([0, 0.5, 0.5], 0.25) box = pf.h.region([0.5]*3, [0.75, 0.25, 0.25], [1, 0.75, 0.75]) sp = pf.h.boolean([base_sp, "NOT", box])
Let me know if you run into trouble.
-- Stephen Skory s@skory.us http://stephenskory.com/ 510.621.3687 (google voice) _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (3)
-
j s oishi
-
Matthew Turk
-
Stephen Skory