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

adding support for higher-order elements #154

Merged

Conversation

zasexton
Copy link
Contributor

@zasexton zasexton commented Dec 7, 2023

In response to face area errors for higher-order elements this branch and draft pull request are being made. This addresses specific issues raised by @ktbolt in #114

Current situation

See #114

Release Notes

Added support for the following higher order elements:

  • VTK_QUADRATIC_TRIANGLE
  • VTK_QUADRATIC_QUAD
  • VTK_BIQUADRATIC_QUAD
  • VTK_QUADRATIC_TETRA
  • VTK_QUADRATIC_HEXAHEDRON

Documentation

Relevant documentation extends on previous ordering attributes for linear elements.

Testing

Additional tests will need to be carried over from svFSI-Tests which were created for quadratic elements. This draft pull request was not for migrating these test cases. Perhaps the minimum necessary tests can be selected for this draft pull request before proceeding to an official pull request.

Code of Conduct & Contributing Guidelines

@ktbolt ktbolt marked this pull request as ready for review December 8, 2023 00:14
@ktbolt ktbolt self-requested a review December 8, 2023 00:14
@ktbolt
Copy link
Collaborator

ktbolt commented Dec 8, 2023

@zasexton Have you tested for all higher-order elements?

@mrp089
Copy link
Member

mrp089 commented Dec 8, 2023

You can switch on this test, which should give you 6-noded triangles: main...mrp089:svFSIplus:test_P2_145

For 10-noded tetrahedrons, you can add this additional mesh to the existing struct/block_compression test case: https://github.com/SimVascular/svFSI-Tests/tree/master/05-struct/01-block-compression/mesh/P2

@zasexton
Copy link
Contributor Author

zasexton commented Dec 8, 2023

This is the list of svFSI-Tests that I have completed (with check marks) I am still planning to add support for the VTK_BIQUADRATIC_HEXAHEDRON which I didn't realize we supported until I went through the test meshes of svFSI-Tests

  • 05-struct/01-block-compression/P2 This tests for VTK_QUADRATIC_TETRA
  • 02-lelas/01-beam_Euler-Bernoulli/02-hex8 This tests for VTK_HEXAHEDRON
  • 02-lelas/01-beam_Euler-Bernoulli/02-tet10 This tests for VTK_QUADRATIC_TETRA
  • 02-lelas/01-beam_Euler-Bernoulli/02-hex20 This tests for VTK_QUADRATIC_HEXAHEDRON
  • 02-lelas/01-beam_Euler-Bernoulli/02-hex27 This tests for VTK_BIQUADRATIC_HEXAHEDRON

I will add this support for the 27-node element and run the test case on my local machine today. I'll include a comparison of the results for the mentioned element types above in this discussion to verify the code.

@mrp089
Copy link
Member

mrp089 commented Dec 8, 2023

Awesome, @zasexton! Since you're running those already, can you add them to the CI framework in this PR? That would bring us MUCH closer to finishing #95! @MatteoSalvador, what do you think?

@zasexton
Copy link
Contributor Author

zasexton commented Dec 8, 2023

@mrp089 I can as long as I don't mess up the git lfs stuff. I'm not as familiar with adding large files so I might need some help on how I should go about this.

@mrp089
Copy link
Member

mrp089 commented Dec 8, 2023

No worries, you can't mess it up more than I have done!

Ensure you have git lfs installed on your local machine. In addition, you need to run git lfs install once in your local repository to tell it to use it here. From then on, everything is automatic. You can add, commit and push as usual, git lfs will take care of the rest.

We will have a look over the PR before we merge it!

@zasexton
Copy link
Contributor Author

zasexton commented Dec 8, 2023

git lfs automatically designates files for segregated storage? or is this more specifically because these files would be added to the test folder?

@mrp089
Copy link
Member

mrp089 commented Dec 8, 2023

It will automatically track all the file extensions specified here (basically everything in here that is not code). These are then handled directly via GitHub and not added to the repository itself, which will only contain a hash.

@mrp089
Copy link
Member

mrp089 commented Dec 8, 2023

For the tests themselves, please have a look at the existing ones. Add them to a new folder tests/cases/lelas and create a test script test_lelas.py. You can check if it's working by running

pytest -v -k lelas

from the tests folder, which should execute all your new tests. Happy to help more!

@zasexton
Copy link
Contributor Author

zasexton commented Dec 8, 2023

Okay! You're right this seems very straightforward. I'll let you know if I run into any problems.

One last question for both @mrp089 and @ktbolt : svFSI-Tests for many of the lelas cases are run for 100 time steps. This seems like quite a lot for a test case. Should I decrease this number? If so we would have to regenerate the comparison data, but as we add many more tests this might create problems if we keep the time step number high...

@mrp089
Copy link
Member

mrp089 commented Dec 8, 2023

Good point! We default to one time step; some tests run five time steps. We usually do the following:

  • Run as many time steps as necessary to ensure that the solution makes sense (to see what you want to see in the results)
  • Reduce the number of time steps to a minimal amount
  • Store solution as a reference solution

@MatteoSalvador
Copy link
Collaborator

Thanks @zasexton for the great work you did!
Please let me know if you have any issues setting up git lfs and the final tests, I am also in the lab today :)

@zasexton
Copy link
Contributor Author

zasexton commented Dec 8, 2023

Comparison between svFSI and svFSIplus on higher-order element test cases:

05-struct/01-block-compression/P2 This tests for VTK_QUADRATIC_TETRA

Point-wise Data Comparison:
Displacement difference
Absolute minimum 0.0, Absolute maximum 0.6956977440261483, Mean Absolute 0.10206439457668011
Velocity difference
Absolute minimum 0.0, Absolute maximum 7.215320729130406e-11, Mean Absolute 1.2396040892631794e-11
Jacobian difference
Absolute minimum 3.970861417457172e-09, Absolute maximum 0.2490969770896423, Mean Absolute 0.0032774890659426088

Cell-wise Data Comparison
E_Jacobian difference
Absolute minimum 0.9288569542309549, Absolute maximum 1.0279858279283158, Mean Absolute 0.9984236904573359

02-lelas/01-beam_Euler-Bernoulli/02-hex8/N008 This tests for VTK_HEXAHEDRON

Point-wise Data Comparison:
Displacement difference
Absolute minimum 0.0, Absolute maximum 3.2153340989715673e-07, Mean Absolute 4.548847737427873e-08
VonMises_stress difference
Absolute minimum 9.381217002868652, Absolute maximum 1588.5585794448853, Mean Absolute 471.39514387045637
Jacobian difference
Absolute minimum 7.489453501818844e-11, Absolute maximum 4.5283808702833994e-08, Mean Absolute 2.5688052840035408e-08

Cell-wise Data Comparison
E_VonMises difference
Absolute minimum 172505719.70841414, Absolute maximum 3567861151.2347636, Mean Absolute 1261049399.9539156
E_Jacobian difference
Absolute minimum 0.9851409668352776, Absolute maximum 1.0649893011737244, Mean Absolute 1.0340321533409274

02-lelas/01-beam_Euler-Bernoulli/02-tet10 This tests for VTK_QUADRATIC_TETRA

Point-wise Data Comparison:
Displacement difference
Absolute minimum 0.0, Absolute maximum 2.212599939432902e-05, Mean Absolute 2.9679076280059963e-06
VonMises_stress difference
Absolute minimum 420.42477837204933, Absolute maximum 113673.42852401733, Mean Absolute 32134.726864736927
Stress difference
Absolute minimum 0.0, Absolute maximum 362793.9807678917, Mean Absolute 35617.79715781511
Strain difference
Absolute minimum 0.0, Absolute maximum 0.02054817192935376, Mean Absolute 0.000712990549751116
Jacobian difference
Absolute minimum 9.380840548800506e-11, Absolute maximum 3.729124733675704e-06, Mean Absolute 1.9514923445663436e-06

Cell-wise Data Comparison
E_VonMises difference
Absolute minimum 31163023.0557853, Absolute maximum 5729142118.490126, Mean Absolute 1406633450.748689
E_Jacobian difference
Absolute minimum 0.9705426752301588, Absolute maximum 1.0921224212415461, Mean Absolute 1.0429530632282058

02-lelas/01-beam_Euler-Bernoulli/02-hex20 This tests for VTK_QUADRATIC_HEXAHEDRON

Point-wise Data Comparison:
Displacement difference
Absolute minimum 0.0, Absolute maximum 5.86666446e-05, Mean Absolute 8.25680022e-06
VonMises_stress difference
Absolute minimum 7570.87593699, Absolute maximum 1.52905573e+09, Mean Absolute 1.57168166e+08
Jacobian difference
Absolute minimum 3.13949899e-07, Absolute maximum 0.00828905, Mean Absolute 0.00164415

Cell-wise Data Comparison
E_VonMises difference
Absolute minimum 76518088.15819924, Absolute maximum 4.33284265e+09, Mean Absolute 1.38062769e+09
E_Jacobian difference
Absolute minimum 0.9852893, Absolute maximum 1.08812184, Mean Absolute 1.04749235

  • 02-lelas/01-beam_Euler-Bernoulli/02-hex27 This tests for VTK_BIQUADRATIC_HEXAHEDRON

@ktbolt
Copy link
Collaborator

ktbolt commented Dec 8, 2023

@zasexton There is definitely a bug in computing VonMises_stress and some other secondary quantities, I will open an Issue for this.

Be careful comparing results from the current svFSI code, the svFSIplus code was converted from svFSI commit e258b9f.

@zasexton
Copy link
Contributor Author

zasexton commented Dec 8, 2023

For the VTK_QUADRATIC_TETRA in the test case 02-lelas/01-beam_Euler-Bernoulli/02-tet10 we may want to double-check that Stress values obtained from cpp simulation.

Similarly for VTK_QUADRATIC_TETRA in the test case 05-struct/01-block-compression/P2 there seems to be a rather large difference between svFSI and svFSIplus for Displacement values obtained

I'll double check all of the simulation parameters to see if I have any differences in the simulation setup/assumptions.

Overall, values which are computed from the simulation (e.g. E_VonMises, E_Jacobian, VonMises_stress ...) display poor agreement between svFSI and svFSIplus

@zasexton
Copy link
Contributor Author

zasexton commented Dec 8, 2023

@ktbolt I've been comparing the svFSIplus results to the files stored in svFSI-Tests and have not been producing new results from svFSI to compare against svFSIplus. Hopefully this is fine

@zasexton
Copy link
Contributor Author

zasexton commented Dec 8, 2023

Added final support for VTK_TRIQUADRATIC_HEXAHEDRON. I'll push these commits now

Copy link
Collaborator

@ktbolt ktbolt left a comment

Choose a reason for hiding this comment

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

Looks good.

@ktbolt ktbolt merged commit 59216b6 into SimVascular:main Dec 11, 2023
5 checks passed
@zasexton zasexton deleted the add-support-high-order-elements-#114 branch December 27, 2023 20:05
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.

None yet

4 participants