libMesh / libmesh

libMesh github repository
http://libmesh.github.io
GNU Lesser General Public License v2.1
657 stars 286 forks source link

Does LAGRANGE_VEC support boundary conditions on subspaces? #2615

Open potaman opened 4 years ago

potaman commented 4 years ago

I am coming back to libmesh after a while and was playing around with the LAGRANGE_VEC examples. I was a little unclear about whether DirichletBoundary allow the application of boundary conditions on individual components?

jwpeterson commented 4 years ago

Hmm... @roystgnr will have to correct me if I'm wrong, but based on my reading of apply_dirichlet_impl() it looks like either all components of a LAGRANGE_VEC variable are constrained, or none are:

https://github.com/libMesh/libmesh/blob/ff170d531f6b26a69c36de90b0afd8677a3ce157/src/base/dof_map_constraints.C#L910-L921

I'm not sure what the best way to generalize this would be. Perhaps the DirichletBoundary objects could store, in addition to the list of variables which are constrained, lists of components for each of those variables which are constrained?

roystgnr commented 4 years ago

At one point I added the capability to selectively constrain part of a Dirichlet boundary, on the fly, by returning NaN as the component value in unconstrained locations, which would then cause the constraints code to omit generating a constraint for DoFs with support at those locations. Thus you could constrain a convected variable at only the inflow parts of an inflow/outflow boundary, or constrain a displacement at only areas of contact, for examples. In theory you might be able to do what you want with vector variables by returning NaN for those fields which should be left unconstrained.

I've never tested this with vector variables, though, so if you try it then please set up some decent tests and let it know whether it works or not! If it does work then turning your tests into libMesh unit tests would be a good idea, to make sure we don't break the feature later after you're depending on it. Our Dirichlet constraint code has undergone a lot of revision lately and will likely see more in the not too distant future.