Fix: Update no flux bcs for mesh deformation#6829
Fix: Update no flux bcs for mesh deformation#6829bobmyhill wants to merge 1 commit intogeodynamics:mainfrom
Conversation
f779ae5 to
93a3a21
Compare
We will need to take a look at those changes. |
|
@tjhei A few questions:
Test names and errors for deal.II-9.7 and deal.II-master:
|
|
It might be worth looking at your and Rene's changes separately. The deal.II 9.6 tester is the only one that compares test results. The others only execute tests and report crashes. This is because output is slightly different with different deal.II versions. |
a9f34ed to
bccb74e
Compare
|
I think this is not quite right: If we use mesh deformation we use a flat manifold and we should not use the manifold nornals (as we found out). But without mesh deformation, for example for spherical geometries, we use a different manifold that does provide better normals. So, I would make this bool argument conditional on that. |
|
Hi @tjhei, yes, sorry, I was just trying a few things out to see which change caused the 100-odd tests to fail. Now that I've pinned down the source of most of the errors, my next step is to use the
I think this is what you're suggesting? Any thoughts about what we should do about the failed tests that won't be affected by this change (mesh_deformation_gmg_2d_spherical_shell and four others that use GMG and mesh deformation)? |
|
The other changes are likely due to Rene's change. If they are small and look sensible, we can update the blessed output. |
|
@tjhei I deleted Rene's change from this PR. The shared commit ("Add test") is just a new test. The five tests that fail all have significant differences (all involve mesh deformation and the GMG solver):
|
... but it might be solving the correct problem now. :-)
There are likely other fixes necessary to make GMG work correctly, like you describe in #6818 (comment) I think this PR is reasonable to merge. |
Sorry @tjhei, we'll need to take another look at this - when I removed Rene's first commit and reran the new tests, I forgot to refresh paraview.
I suspect this means I'll have to look through more failing tests, which I'll do tomorrow.
|
Hi @bobmyhill @tjhei, Thank you very much for this PR! I noticed an interesting behavior during testing and would like to ask for your thoughts. In the test model My preliminary thought is: Should we check more precisely whether each boundary is actually deformed? For example, only set What are your opinions on this? Is boundary-specific logic worth considering, or is global consistency more important? Thanks! |
Interesting. I didn't think of this situation. Is this an important case worth handling? We can either determine for each boundary what to do or, maybe the better way, figure out while using the manifold normal doesn't work correctly. |
|
@tiannh7 Thanks for doing some testing! There are two separate points relating to your questions:
@tjhei: Did you suggest the current logic in this PR because the manifold normals are more accurate / more efficient to calculate? |
|
Hi @tjhei and @bobmyhill, Thank you both for the replies! Regarding the concern about regression: I am currently working with several spherical shell models involving free surfaces and traction boundaries. Could I take a little time to run my existing benchmarks against this branch? I want to verify whether the deviation introduced on the static boundaries is negligible or significant. This should help us decide if the current global switch is sufficient or if we typically need finer-grained control per boundary. When my schedule permits, I’ll report back with my test results as soon as possible! As a preliminary note: for the |
Manifold normals are correct for spherical objects (pointing exactly in radial direction) whereas using the geometry gives slightly different answers, especially on coarse meshes. I think @tiannh7 is right and we need to keep using them for the bottom boundary even if the top is a deforming surface. And yes, I am suggesting we call compute_no_normal_flux separately for deforming and non-deforming surfaces. |
|
Thanks both. I had a go at making the required change (see most recent commit), but get the error I'm out of time today (I've been doing this in spare 10 minute slots), but any help would be appreciated. |
|
Hi Bob, I believe the following section should be deleted: VectorTools::compute_no_normal_flux_constraints(dof_handler_v,
/* first_vector_component= */
0,
this->get_boundary_velocity_manager().get_tangential_boundary_velocity_indicators(),
constraints_v,
this->get_mapping(),
/*use_manifold_for_normal=*/
!this->get_parameters().mesh_deformation_enabled);Because it conflicts with |
|
Hi @tiannh7 |
|
@bobmyhill Glad I could help. Looking forward to the next steps. |
|
@tjhei, I think this is ready for another look now. I reviewed the new tests (which both look fine), and also three of the tests whose output changed in interesting ways: hill_diffusion_field_boundary_conditions.prm (layer 1)The Layer 1 composition of the top boundary is determined by the function Timestep 0 (both new and old)
End time (new)
boundary_traction_function_cartesian_free_surface.prm (stress xy)Both solutions have a weird artifact in the middle of the domain. New not obviously worse than old. old
gmg_mesh_deform_topo.prm (velocity and streamlines)New looks better (streamlines now close). But I did want to note that this test throws up another problem; the shape of the deformed surface at time t is dependent on the size of the maximum time step (converging with a small timestep size). See the two sets of images below. new (end time, maximum timestep not set)
old (end time, maximum timestep not set)
new (end time, maximum timestep set to 0.00005, global refinement = 5)
old (end time, maximum timestep set to 0.00005, global refinement = 5)
ConclusionExamples 1 and 3 are clearly improved by this PR, and Example 2 looks much the same (differences are hard to spot over the large unrelated anomalies - Issue #6835 ). The no normal flux constraints now look to be correct for both AMG and GMG, although differences remain in the solutions (which needs further testing, probably outside this PR - Issue #6833). The undershoot problem in Example 1 is also unrelated to this PR (Issue #6834) |
doc/modules/changes/20260112_myhill
Outdated
| using the local mesh. This fix focuses on simulations using the | ||
| AMG solver. |
There was a problem hiding this comment.
| using the local mesh. This fix focuses on simulations using the | |
| AMG solver. | |
| using the mesh. |
9b55f2e to
7234472
Compare
|
Would you mind squashing your commits? |
2860a42 to
b9974b6
Compare
Of course! Now squashed, and I added @gassmoeller as co-author on the first commit as he did much of the initial work. |
|
Thanks, I will take a closer look tomorrow. My only concern so far is what Timo pointed out here. These lines are almost what we do in the call to |
The code breaks with a "cycle detected in constraints" deal.II error (or it did when I tried it). I also don't know whether this broke something subtle. |
|
@gassmoeller I restored the file in the new commit above to test it. |
gassmoeller
left a comment
There was a problem hiding this comment.
I agree with the general direction and discussion of this PR, but I have questions on the lines I marked up.
Overall I think:
- you got the fix right
- we need to take care to only disable the manifold on boundaries that are actually deforming (for all solvers!), otherwise we loose a lot of accuracy as @tiannh7 pointed out
- I think there is at least one change in the mesh deformation system that I dont think is necessary see my comment there
- I think there is something unclear happening in the lines I commented on yesterday and that Bob reverted in the latest commit.
constraints_vshould only contain constraints for the velocity degrees of freedom as numbered by the DoFHandlerdof_handler_v, yet we hand overconstraints_vto the functionscompute_initial_velocity_boundary_constraintsandcompute_current_velocity_boundary_constraintswhich use our general DoFHandler to put some constraints in. It doesnt seem to matter as tests pass either way, but it feels wrong to me. @tjhei do you agree, or am I missing something? I would suggest to leave out the changes you reverted Bob (so just stick to the version we have now without removing the weird lines) and we figure it out separately from this PR. It doesnt seem to matter for the tests either way.
source/mesh_deformation/interface.cc
Outdated
| level, | ||
| /*use_manifold_for_normal=*/ | ||
| !this->get_parameters().mesh_deformation_enabled); |
There was a problem hiding this comment.
I am not sure about this change. These no normal flux constraints are for the multigrid level constraints of mesh deformation of boundaries that allow only tangential mesh movements. Shouldnt we be able to use the manifold for those boundaries as well?
| // Update the no-normal-flux constraints on the boundaries where | ||
| // tangential velocity is prescribed. | ||
| // If mesh deformation is enabled, we cannot use the manifold | ||
| // information to compute the normal vector, since the | ||
| // manifold may not represent the actual deformed shape | ||
| // of the boundary. | ||
| VectorTools::compute_no_normal_flux_constraints(dof_handler, | ||
| 0 /* first_vector_component */, | ||
| this->get_boundary_velocity_manager().get_tangential_boundary_velocity_indicators(), | ||
| constraint, | ||
| mapping, | ||
| /*use_manifold_for_normal=*/ | ||
| !this->get_parameters().mesh_deformation_enabled); |
There was a problem hiding this comment.
doesnt this also need a special treatment for boundaries with/without mesh deformation? using the manifold for boundaries without mesh deformation and not using the manifold for boundaries with mesh deformation?
| this->get_mapping(), | ||
| /*use_manifold_for_normal=*/ | ||
| !this->get_parameters().mesh_deformation_enabled); |
There was a problem hiding this comment.
same question as for the global coarsening gmg, shouldnt this be split into one call for the tangential velocity boundaries with mesh deformation, and one for the ones without?
| level, | ||
| /*use_manifold_for_normal=*/ | ||
| !this->get_parameters().mesh_deformation_enabled); |
There was a problem hiding this comment.
and here the same, this is the same operation as in line 1625, just for the level dofs instead of the global dofs. Therefore it should also be split into the boundaries with/without deformation.
| Postprocessing: | ||
| Writing graphical output: output-mesh_deformation_gmg_2d_spherical_shell/solution/solution-00000 | ||
| RMS, max velocity: 3.45 m/year, 13.7 m/year | ||
| RMS, max velocity: 0.0689 m/year, 0.263 m/year |
There was a problem hiding this comment.
this seems like a large change, and one I would like to understand better. But probably only worth looking into when my other comments have been addressed (as this is a gmg test).
|
Hi @gassmoeller , thanks for the review. Do you want to take this one over? I'm going to be extremely busy for the next two-four weeks, and probably won't have time to pay attention to this before w/c 23rd February. |
|
Hi, sure. I implemented most of my comments and pushed them to this branch. I need to take another look tomorrow if I got everything (GMG level constraints and diffusion are not checked yet). @alarshi I just remembered I wanted to ask you about this PR. What the PR does is to always align the tangential velocity boundary conditions with the surface, even if it is deformed. I feel like we discussed for your models at some point that that is actually not what we want (we wanted material to be able to move sideways even at a mountain tip in topography, so it would move into/out of the model domain). Is this still something you need? Because then we should talk how to make that compatible with this PR. |
|
Amazing, thank you @gassmoeller ! |
a47eb03 to
ebf5db7
Compare
1c56dc7 to
12fcda7
Compare
|
By GitHub rules I can't approve what is nominally my PR, but FWIW, I approve of this PR when the testers pass! Thank you, Rene :) |
|
I updated the changelog entry in the second commit, since it wasnt just the manifold issues that was fixed, it was also that we did not update the constraints during the model run. Yes this should be ready if someone with the right permissions comes along and pushes the button 😄 |
|
"This branch has conflicts that must be resolved" |
951432c to
9494f53
Compare
|
Yes that happened in the meantime. I rebased and fixed the conflict but still need to update the tests. Will leave a comment when this is ready. |
…ndaries Co-authored-by: Rene Gassmoeller <rene.gassmoeller@mailbox.org>
9494f53 to
18e4ec7
Compare










This PR is an extension of #6819, and represents a first step towards resolving #6818.
Changes in this PR:
As described in #6818 this does not yet fix the related GMG issues.