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

Fix indexing bug. #139

Merged
merged 4 commits into from
Nov 16, 2023

Conversation

ktbolt
Copy link
Collaborator

@ktbolt ktbolt commented Nov 14, 2023

Current situation

This is the fix for #88.

Code of Conduct & Contributing Guidelines

@MatteoSalvador
Copy link
Collaborator

@ktbolt I tried to run the tests locally and all the CFD-related ones fail just after initialization with a double free or corruption (!prev) error. It's kind of interesting that macOS runs smoothly.

@ktbolt
Copy link
Collaborator Author

ktbolt commented Nov 14, 2023

@MatteoSalvador You run the tests locally on what platform?

I ran pipe3D_RCR on Ubuntu 20 no problem.

@MatteoSalvador
Copy link
Collaborator

I ran pipe3D_RCR on Ubuntu 20.04 and I got the error stated before

@ktbolt
Copy link
Collaborator Author

ktbolt commented Nov 14, 2023

@MatteoSalvador I was not careful and screwed up the indexing of another array. This is why unit tests are so useful.

I found the error by turning on Array index checking. I wonder if we should run the tests with Array indexing checking turned on, even if it slowed down simulations. I could add a flag to the CMake file to enable this.

@MatteoSalvador
Copy link
Collaborator

Thanks @ktbolt! I personally agree with turning on array indexing checking in this MR. @mrp089 what do you think?

@mrp089
Copy link
Member

mrp089 commented Nov 15, 2023

I think it makes sense to check indexing in our tests.

This is why unit tests are so useful.

@ktbolt, do you want to add the first one?

@ktbolt
Copy link
Collaborator Author

ktbolt commented Nov 15, 2023

@mrp089 Implementing unit testing is a lot of work, not sure if we want to expend the resources for this code. Next Stage for sure where we can implement the code for testing (test-driven development).

@MatteoSalvador
Copy link
Collaborator

@ktbolt I think that even if all tests are running now, there are still some issues with CFD-related ones.
The solver seems to diverge and the reference solutions are not matched.

@ktbolt
Copy link
Collaborator Author

ktbolt commented Nov 15, 2023

@MatteoSalvador I saw the divergence, looks like the fix uncovered another bug, looking into that now.

@ktbolt
Copy link
Collaborator Author

ktbolt commented Nov 16, 2023

@MatteoSalvador The all_fun::integ() functions used to integrate quantities over a face (e.g. all_fun::integ(com_mod, cm_mod, fa, com_mod.Yo, 1, nsd) use a magic number (e.g. 1) as an argument which I misunderstood how it was being used. I modified all those functions to use them the same (awful) way.

Copy link
Collaborator

@MatteoSalvador MatteoSalvador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ktbolt! Do you think that this MR will fix the problem @elenasmartinez found with resistance BCs in CFD simulations?

@ktbolt
Copy link
Collaborator Author

ktbolt commented Nov 16, 2023

@MatteoSalvador This does fix the problem @elenasmartinez found with resistance BCs in CFD.

@MatteoSalvador MatteoSalvador merged commit c26b7c6 into SimVascular:main Nov 16, 2023
5 checks passed
@ktbolt ktbolt deleted the CFD-rcr-bc-poor-comparison_88 branch November 16, 2023 17:49
mrp089 referenced this pull request in mrp089/svFSIplus_old Nov 30, 2023
* Fix indexing bug.

* Fix indexing problem (again).

* Modify the calls to all_fun::integ() functions to pass in an array's 0-based index range.

---------

Co-authored-by: Matteo Salvador <[email protected]>
mrp089 referenced this pull request in mrp089/svFSIplus_old Nov 30, 2023
* Fix indexing bug.

* Fix indexing problem (again).

* Modify the calls to all_fun::integ() functions to pass in an array's 0-based index range.

---------

Co-authored-by: Matteo Salvador <[email protected]>
mrp089 referenced this pull request in mrp089/svFSIplus_old Nov 30, 2023
* Fix indexing bug.

* Fix indexing problem (again).

* Modify the calls to all_fun::integ() functions to pass in an array's 0-based index range.

---------

Co-authored-by: Matteo Salvador <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants