[yt-users] sphere object without periodicity?

Matthew Turk matthewturk at gmail.com
Mon Dec 26 05:08:30 PST 2011


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 at 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 at skory.us
> http://stephenskory.com/
> 510.621.3687 (google voice)
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org



More information about the yt-users mailing list