<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi David,<br>
<br>
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.<br>
<br>
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. <br>
<br>
My only problem is that I have created my own particles type and I need
to specify it. In macros_and_parameters.h:<br>
<br>
#define PARTICLE_TYPE_POINT_MASS   5<br>
<br>
Where/how do I specify the particle type ? I can't find those
parameters in the output data...<br>
<br>
Thanks a lot,<br>
<br>
<br>
Jean-Claude<br>
<br>
<br>
David Collins a écrit :
<blockquote
 cite="mid:AANLkTilWk7Fp6NGth3SgMTRgN_i9iBcgUASa6u5M6zFX@mail.gmail.com"
 type="cite">
  <blockquote type="cite">
    <pre wrap="">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 !
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Great, I'm glad that worked.  Entire fields of science have been
created because of that very issue.  It's subtle, but a killer.

  </pre>
  <blockquote type="cite">
    <pre wrap="">    - 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 ?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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.)

  </pre>
  <blockquote type="cite">
    <pre wrap="">    - keep all BaryonFields the same except the velocity that I need to set
up to 0. Is there an easy way to do that ?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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.
  </pre>
</blockquote>
</body>
</html>