[ET Trac] #2639: CarpetLib internal error with PreSync and analysis thorns

Samuel Cupp trac-noreply at einsteintoolkit.org
Tue Sep 27 16:34:47 CDT 2022


#2639: CarpetLib internal error with PreSync and analysis thorns

 Reporter: Samuel Cupp
   Status: new
Milestone: 
  Version: development version
     Type: bug
 Priority: major
Component: Carpet

Comment (by Samuel Cupp):

To expand on this, the code in regrid\(\) is

```
void th::regrid() {
  CCTK_REAL const basetime = 0.0;
  CCTK_REAL const basedelta = 1.0;

  const int old_mglevels = times.size();
  times.resize(h.mglevels());
  deltas.resize(h.mglevels());
  for (int ml = 0; ml < h.mglevels(); ++ml) {
    const int old_reflevels = times.AT(ml).size();
    times.AT(ml).resize(h.reflevels());
    deltas.AT(ml).resize(h.reflevels());
    for (int rl = 0; rl < h.reflevels(); ++rl) {
      if (ml == 0) {
        deltas.AT(ml).AT(rl) = basedelta / reffacts.AT(rl);
      } else {
        deltas.AT(ml).AT(rl) = deltas.AT(ml - 1).AT(rl) * h.mgfact;
      }
```

As seen here, in line 14 deltas is always 1.0/reffacts, which is just 1 for the coarser grids. For PreSync, some synchronization/BCs are applied during the short period in which this is 1, and that doesn’t occur without PreSync. I believe this is where the incorrect time slips in. Since it quickly resets the deltas, most of the times afterward are correct. It’s only until later with the next call to CycleTimeLevels that this inconsistency finally breaks the code.

I believe that basedelta should be set to the dt of the coarsest timelevel. At the very least, doing this explicitly for my case fixes the error. I haven’t verified that the codes produce the same results, but it seems like a reasonable choice instead of a random default of 1.

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2639/carpetlib-internal-error-with-presync-and
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/trac/attachments/20220927/e1baad15/attachment-0001.html 


More information about the Trac mailing list