[yt-users] Flux Across Surfaces

Michael Zingale michael.zingale at stonybrook.edu
Thu Jul 31 16:18:30 PDT 2014


Hi Melinda, this sounds like it would be a good operation to list in the yt
cookbook -- do you have a simple script that illustrates it (and a
small-medium sized dataset, if necessary?).  I can help you add it to the
cookbook if you like.

Mike


On Thu, Jul 31, 2014 at 3:59 PM, Melinda Soares-Furtado <
msoares.physics at gmail.com> wrote:

> I figured out the problem, Matt. It was due to the fact that I was setting
> the sphere radius equal to the surface radius -- the trilinear
> interpolation was impacted by this. When I simply increased the sphere
> radius to a value larger than the surface radius, the flux calculation
> worked perfectly.
>
> I noticed this when I used the code below to plot the generated surface
> and saw that there were large regions that were empty. The flux was not
> being computed in these regions and, as a result, the total flux was lower
> than what I had expected.
>
> ****code to generate a plot of the generated
> surface************************************
> colors = apply_colormap(np.log10(surf["Temperature"]), cmap_name="hot")
> #cmap_name="jet", "algae", "hot", "gist_stern", "RdBu","kamae"
>
> fig = plt.figure(figsize=(10, 10), dpi=150)
> ax = fig.gca(projection='3d')
> p3dc = Poly3DCollection(surf.triangles, linewidth=0.0)
> p3dc.set_facecolors(colors[0,:,:]/255.)
> ax.add_collection(p3dc)
> ax.auto_scale_xyz(surf.vertices[0,:], surf.vertices[1,:],
> surf.vertices[2,:])
> ax.set_aspect(1.0)
> plt.savefig("%s_Surface.png" % pf)
>
>
> Also, I realized what you meant by the surface area of a sphere! ;)
>
> Regards,
> Melinda Soares-Furtado
>
>
>
> On Wed, Jul 30, 2014 at 2:59 PM, Matthew Turk <matthewturk at gmail.com>
> wrote:
>
>> Hi Melinda,
>>
>> (As a quick note, we have test coverage for a few cases like this, but
>> non-spherical.  The rest of my email assumes that the flux calculation
>> is working as desired, but I can also attempt to set up a simple
>> problem to demonstrate this from first principles, which I will put on
>> my todo list.)
>>
>> I can think of a few things that might be going on.  The first is that
>> the flux is typically computed using tri-linear interpolation, as well
>> as a dot product.  This will interpolate to the barycenter of the
>> triangles found through the marching cubes algorithm the velocity and
>> density.  Increasing the refinement will increase this value, but
>> we're still both approximating the sphere surface as a set of
>> triangles, as well as taking the interpolated velocities and
>> multiplying them by the area.  So the weak points:
>>
>>  * Interpolation
>>  * Dot product of interpolated values
>>  * Approximating surface
>>
>> One possible thing to try would be to examine the flux of "ones"
>> across the surface, where the fluxing field is defined radially
>> outward.  This would then give the total surface area.  So, we'd
>> create three new derived fields:
>>
>> @derived_field(name="rad_x_vec")
>> def rad_x_vec(field, data):
>>     center = data.get_field_parameter("center")
>>     return data["x"] - center[0]
>>
>> @derived_field(name="rad_y_vec")
>> def rad_y_vec(field, data):
>>     center = data.get_field_parameter("center")
>>     return data["y"] - center[1]
>>
>> @derived_field(name="rad_z_vec")
>> def rad_z_vec(field, data):
>>     center = data.get_field_parameter("center")
>>     return data["z"] - center[2]
>>
>> Then you can use "rad_x_vec", "rad_y_vec", "rad_z_vec" as the vector
>> fields, which should point radially outward, and the "ones" field as
>> the fluxing field.  This should return to you the total surface area,
>> which you can then compare against 4/3 pi r**3, and see the total
>> difference between the two.  That will at least indicate how different
>> they are, and provide a semblance of a normalization?
>>
>> -Matt
>>
>> On Mon, Jul 28, 2014 at 5:13 PM, Melinda Soares-Furtado
>> <msoares.physics at gmail.com> wrote:
>> > I have used yt to determine the flux calculation for a region
>> surrounding a
>> > single star with a given mass loss rate. This region is right outside
>> the
>> > stellar radius (see attached). Comparing the flux calculation to the
>> known
>> > mass loss rate, I see that not all of the mass is accounted for and,
>> what's
>> > more, improved refinement of the simulation enhances this percentage,
>> > however it is still below 70%. I need to calculate the flux for a region
>> > surrounding a large group of stars, so simply increasing the refinement
>> is
>> > really not an option. Any suggestions as to how I can use yt for my flux
>> > diagnostics in a manner that is more accurate?
>> >
>> > Best,
>> > Melinda
>> >
>> > _______________________________________________
>> > yt-users mailing list
>> > yt-users at lists.spacepope.org
>> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>> >
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>


-- 
Michael Zingale
Associate Professor

Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY
11794-3800
*phone*:  631-632-8225
*e-mail*: Michael.Zingale at stonybrook.edu
*web*: http://www.astro.sunysb.edu/mzingale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140731/b0118bd9/attachment.html>


More information about the yt-users mailing list