adamantine-sim / adamantine

Software to simulate heat transfer for additive manufacturing
https://adamantine-sim.github.io/adamantine/
Other
36 stars 10 forks source link

Out-of-bounds access in MaterialsProperties when AMR decreases the DOF #143

Open stvdwtt opened 2 years ago

stvdwtt commented 2 years ago

If AMR is set such that the DOF decreases during the simulation (e.g. with "coarsen_after_beam" set to true), an out-of-bounds access can occur in MaterialsProperties::set_state when accessing the liquid and powder ratios. I believe this is because the MaterialsProperties is using an outdated mesh. I'm not sure if it is the internal DofHandler that is out of sync or something else. Simply calling MaterialProperties::reinit_dofs before MaterialsProperties::set_state isn't sufficient.

In other cases with AMR, it is unclear if the behavior is correct or not (but it doesn't trip the out-of-bounds exception).

stvdwtt commented 2 years ago

I believe this was fixed in #142, but I don't think I added a test case with coarsen_after_beam set to true. I'll double-check that.