xbraid icon indicating copy to clipboard operation
xbraid copied to clipboard

CoarsenRefStatus possibly reporting wrong time index

Open jcc242 opened this issue 6 years ago • 5 comments

I set up a simple time domain with 5 points on the coarse time grid and uniformly tag the entire coarse time domain for refinement by some factor. I am doing spatial refinement as well.

During my spatial refinement function, the time index I get from braid_CoarsenRefStatusGetTIndex() appears to be giving me values that are wrong or invalid. It appears I am getting the following correspondence between time points and indices:

(Point, Index): (T0,3) (T1,0) (T2,1) (T3,2) (T4,3)

That is, the time index 3 is associated with the first time point of my coarse time domain, then counting up starts at T1.

Is this because the time index is not set by _braid_CoarsenRefStatusInit like it is in _braid_StepStatusInit, and so just using (or reusing) whatever value was set last into the struct? This theory corresponds to the order of calling refinement, T1, T2, T3, T4 then lastly T0.

Note that I am deducing what time point I am at by looking at the value returned from time, and the values of my state vector match the time so I feel comfortable with assuming the time is correct.

jcc242 avatar Dec 20 '18 18:12 jcc242

These changes seem to fix the issue:

https://github.com/XBraid/xbraid/pull/19/commits/a2b2eaeb3971bdd534f487e49740cf17a25628b8

I'm not sure what the consequences are of calling

_braid_StatusElt(status, idx) = c_index;

in _braid_CoarsenRefStatusInit. Does _braid_FRefine or another function expect the idx to be at a certain value later on in the routine, and now I've changed it?

jcc242 avatar Dec 20 '18 19:12 jcc242

I would not use 'idx' for the coarse point. It looks as though it would make sense to provide both the fine and corresponding coarse indexes in CoarsenRefStatus. So, I would add a 'c_idx' variable to the core in the CoarsenRefStatus section and add a braid_StatusGetCTIndex routine. Does that make sense?

rfalgout avatar Dec 20 '18 19:12 rfalgout

Hi All,

Thanks for finding this bug Josh!

Rob's suggestions make sense to me, that we use 'idx' for the fine index, and a new core variable 'c_idx' for the coarse index. Then, there can be two routines say, braid_StatusGetCTindex and braid_StatusGetFTindex, that are supported in the coarsen and refine routines.

Cheers,

Jacob

On Thu, Dec 20, 2018 at 12:55 PM Rob Falgout [email protected] wrote:

I would not use 'idx' for the coarse point. It looks as though it would make sense to provide both the fine and corresponding coarse indexes in CoarsenRefStatus. So, I would add a 'c_idx' variable to the core in the CoarsenRefStatus section and add a braid_StatusGetCTIndex routine. Does that make sense?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/XBraid/xbraid/issues/18#issuecomment-449117378, or mute the thread https://github.com/notifications/unsubscribe-auth/AEjD40W3ekCKHt9QmQvFz2csUR0pDAEqks5u6-sogaJpZM4Zct2p .

jbschroder avatar Dec 20 '18 20:12 jbschroder

That makes sense, I'll look into it.

jcc242 avatar Dec 20 '18 20:12 jcc242

@jcc242 Hi Joshua, did we fix this bug? I think so, but I wanted to check before I close this ticket.

Thanks!

Jacob

jbschroder avatar Jun 09 '21 15:06 jbschroder