Luca, Thank you very much for the reply. That is all very very helpful.
I see what you are saying about the hanging node constraints. I am using a mesh from gmsh directly (without any sort of refinement), which I am pretty sure is conforming. My code does include a call to make_hanging_node_constraints just to be safe, but commenting that out does not seem to cause any difference in behavior. It is very helpful that you mention time-dependent constraints, which I will certainly need to implement sooner rather than later (but the BCs in the current problem are actually constant). I actually believe the scheme I listed above does not totally work in that case. If we have x_i = a(t), then RHS_bc(i) must change from having the contribution -m(j,i)a(t) -> -m(j,i)a(t + dt). Unfortunately, I do not see a way to do that other than to rebuild that static part of the matrix in order to call distribute_local_to_global(...,false) again. Something like multiplying each entry by a factor does not work since some entries in RHS_bc could contain information from more than one constrained node. Perhaps then I should look into using distribute_local_to_global(...,true) and let the time_dependent assembly handle the boundary conditions. I assume that the call to distribute_local_to_global(...,true) instead does: 1) Sets M(i,i) = L and RHS(i) = L*a. 2) Zeros out row i except for the diagonal entry. The extra trick here is that since x_i is not being set to zero prior to the solve step, if you are reusing the preconditioner across time steps, you need to control L so it is always the exact same, but that is not too difficult in this easy situation. It is difficult if one is using periodic or other constraints which constrain one DoF to others (rather than to a constant) there does not seem to be an easy way to get access to which DoFs those are for a given constrained DoF. This would inhibit efficient manual setting of the scaling of the rows. The current code does not have time-dependent or periodic BCs, so these considerations are perhaps for a later date for me to consider. I found a major issue in an unrelated part of my code, so it is mostly working now, but I still have a feeling there is still at least a minor issue with how I am handling the BCs. Regards, Kyle On Fri, Jul 21, 2023 at 8:54 PM Wolfgang Bangerth <bange...@colostate.edu> wrote: > On 7/21/23 04:48, Luca Heltai wrote: > > Boundary conditions and hanging nodes have a very delicate interplay. > > As just another data point, step-26 re-builds the matrix in every time > step > just so that we can apply boundary conditions and hanging node constraints > from scratch. > > Best > W. > > -- > ------------------------------------------------------------------------ > Wolfgang Bangerth email: bange...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > > -- > The deal.II project is located at http://www.dealii.org/ > For mailing list/forum options, see > https://groups.google.com/d/forum/dealii?hl=en > --- > You received this message because you are subscribed to a topic in the > Google Groups "deal.II User Group" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/dealii/B5IJB1O-BSw/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > dealii+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dealii/03b57226-f66e-011a-3adb-58cdf995d661%40colostate.edu > . > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CAEt%3DwjN%2BvJjPm%3Du-N7Lz16v3vh5bDYJLBSG-Y5z-q6Tq6PFrjw%40mail.gmail.com.