Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential bug in MappedCart (in currently unused code) #36

Open
manauref opened this issue Oct 14, 2020 · 1 comment
Open

Potential bug in MappedCart (in currently unused code) #36

manauref opened this issue Oct 14, 2020 · 1 comment
Assignees

Comments

@manauref
Copy link
Collaborator

manauref commented Oct 14, 2020

I think there's an erroneous memory access in line 71 of Grid/MappedCart.lua.

It is assigning a value to d1[3] and d2[3], but these vectors have size 2, not 3. I suspect that the correct code that should replace lines 69-71 is:

   d1[1], d2[1], d3[1] = diff.derivt(self._mapc2p, 1)(xc)
   d1[2], d2[2], d3[2] = diff.derivt(self._mapc2p, 2)(xc)

Otherwise the current code takes the derivative with respect to a third variable that doesn't exist. If this is correct, I wonder why test_2() in Unit/test_MappedCart.lua works. Maybe I'm wrong and this issue should be resolved/closed.

@manauref manauref self-assigned this Oct 14, 2020
@ammarhakim
Copy link
Owner

Yes this looks wrong. First thing to do is add a regression/Unit test for this mapping. The current test is not actually checking the metric tensor or Jacobian and just checks that the object was created. I will extend the test and we can then fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants