[yt-users] fields in ghost zones

Matthew Turk matthewturk at gmail.com
Tue Jun 15 07:16:37 PDT 2010


Hi Jean-Claude, David,

I think this is better suited to enzo-users-l.

Best,

Matt

On Tue, Jun 15, 2010 at 7:11 AM, Jean-Claude Passy <jcpassy at gmail.com> wrote:
> Hi David,
>
> I was able modify the outputs as I wanted. Again, you were right: it took me
> a little bit of time but it was totally worth it.
>
> Now, let me ask you another quick question. I want to add a particle to the
> data. Typically, I consider the relaxed data of my primary model, set up the
> velocity fields to zero, add a particle describing the companion and start
> my "real" simulation. Therefore, I need to modify the fields 'particle...'
> accordingly and it should be pretty easy now that I know how to use h5py.
>
> My only problem is that I have created my own particles type and I need to
> specify it. In macros_and_parameters.h:
>
> #define PARTICLE_TYPE_POINT_MASS   5
>
> Where/how do I specify the particle type ? I can't find those parameters in
> the output data...
>
> Thanks a lot,
>
>
> Jean-Claude
>
>
> David Collins a écrit :
>
> your guess was totally right. I was computing with 64 bits and writing with
> 32 bits only. I fixed it and restarting Enzo worked well. Great !
>
>
> Great, I'm glad that worked.  Entire fields of science have been
> created because of that very issue.  It's subtle, but a killer.
>
>
>
>     - change some global parameters like StopCycle, CycleDataDump,
> GlobalDir,... Would it work if I only edit the files
> DDnnnn/CommonEnvelopennnn ? Wouldn't it create a conflict somewhere ?
>
>
> Changing cycle based outputs won't change the answer.  Changing
> timestep based outputs (like DtDataDump, Redshift)  might introduce a
> little diffusion, because there will usually be a short timestep to
> make the output time right.
>
> As long as you replace GlobalDir everywhere, you're fine.
>
> ls -1 |grep -v grid | sed -i 's/GlobalDir.*/GlobalDir = $A'
>
> should do it, but double check. (that's ls -One, not ls -Ell)(On some
> platforms, like the native sed on OSX and AIX, sed doesn't have a -i
> option, so you have to do this through some temp file.)
>
>
>
>     - keep all BaryonFields the same except the velocity that I need to set
> up to 0. Is there an easy way to do that ?
>
>
> This is pretty easy with Python and h5py.  Basically,  loop over all
> the grid files, open them, and re-write the file into a new
> directory,but make V = 0 as you go.  Then copy all the files that
> aren't *.grid* files to your new directory.  (I don't think there's a
> way to kill a dataset directly, so you need to copy everything.  )
>
> Something like:
>
> for grid in glob.glob("*.grid"):
>   file1 = h5py.File(grid,'r')
>   file2 = h5py.File(other_dir + grid, 'w')
>   for group in file1.listitems():
>    open the group.
>    for field in group:
>      if field is not velocity:
>           file2.create_datasete(field, shape, data=file1[group][field)
>     else:
>          file2.create_dataset( field, shape, data=numpy.zeros(
> file1[group][field].shape) )
>
>
> with the appropriate syntax improvements.
>
>
> d.
>
>
> _______________________________________________
> 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