#155 Merged at 496dc93
Deleted repository
week-of-code (9c87847b8177)
  1. Elizabeth Tasker

(This is a new pull request but is an update from the one here: https://bitbucket.org/enzo/enzo-dev/pull-request/49/addition-to-refine-region-mechanics/diff#comment-251984)

This code defines a new refine region mechanism (so done to prevent backwards comparability issues with the current RefineRegion which is used extensively in cosmology), MultiRefineRegion.

It allows multiple regions of different geometries to be specified, each given their own minimum and maximum levels of refinement. Currently implemented are rectangle, cylinder and ring.

Areas of the simulation box not in any specified region can either have the global min and max refinement levels applied (default option) or have levels specified.

Within the refined region, the refinement levels can either be higher or lower (i.e. a level of de-refinement) than the global parameters.

In theory, this should make John's code "Grid_FlagCellsToAvoidRefinementRegion.C" redundant, but I'd prefer him to make that call in case I've missed an application.

This code can be tested on really any test problem, but I've included a rotating disk set-up, since it's the natural way to test the ring and cylinder geometric shapes.

I've not done the docs, but if it looks good to everyone, I'll add the new parameters to them.

Comments (10)

  1. Elizabeth Tasker author

    Slices of the grid structure for various refine region options can be seen here: http://imgur.com/a/VT1oS

    Top image: no refined region specified, Enzo refines on mass 2: A cylindrical region is held at a higher maximum refinement than the rest of the volume 3: Multiple regions at higher max refinement 4: A rectangle section is held at a lower maximum refinement 5: A ring is held at a lower maximum refinement 6: A ring is held at a higher maximum refinement (AMR is staggered in and out to stop edges with big refinement jumps)

  2. chummels

    Elizabeth, this looks awesome. I'm going to test this out on a cosmology problem and I'll get back to you, but I think this is a great addition to the code base. Great work.

    1. Elizabeth Tasker author

      Thanks! Let me know how it works on a cosmo problem and if you need any explanation for setting it up prior to me writing the docs (though the code is actually very simple).

      Since everything is in code units, I don't see why there'd be any problem with a comoving box, but expansion is something I try and avoid in my life so there may yet be a bug.

  3. Nathan Goldbaum

    Hi Elizabeth,

    I think this is a great addition to the code. I've wanted to do something like this in the past and it will be very nice to be able to use it in the future. I have two concerns but I think they should be easy to work out.

    First, the RotatingDisk initializer seems to be very similar to the GalaxySimulation initializer. Do we need both? Can we consolidate a bit to avoid code duplication?

    Second, it would also be great to get some documentation for the new parameters.

    Thanks again for your work on this :)

  4. Elizabeth Tasker author

    Yes, to be honest we don't really need the RotatingDisk initialiser. I only added it in because Brain suggested that there ought to be a test problem to try out the functionality, so I made the simplest set-up I could think of to do this. If we're happy using GalaxySimulation for this, we can just remove RotatingDisk.

    The only argument I can think for keeping it is --because it is a cut-down GalaxySim-- it might make a better 'test problem' if we needed it in that suit. But there isn't really an easy 'test' (i.e. with a yes/no golden standard answer) for the refined regions, so maybe not necessary.

    I'll do the docs.

  5. John Wise

    Hi Elizabeth, this is great work, and it supersedes my Grid_FlagCellsToAvoidRefinementRegion routine. It looks good to me.

  6. John Wise

    Hi again, I just tried to compile your additions with precision-32 and particles-64, and there are some problems with FLOAT / float definitions in the routines. Could you fix these? Thanks.

  7. Elizabeth Tasker author

    Hi John -- when I try that combination I hit problems, but not with my routines. It fails in Grid_FlagCellsToBeRefinedByResistiveLength.C. I'm not sure what the problem is there, since the routine uses FLOAT, not float. Do you see a different error?

    1. John Wise

      I should have looked whether the error was coming from your mods! I think it was introduced in a recent PR. I'll fix it in another PR. Thanks for looking into this!

      I've used multiple rectangular regions with success, so I'm approving.