moose icon indicating copy to clipboard operation
moose copied to clipboard

Add strongly-imposed H(div) Dirichlet BCs

Open nmnobre opened this issue 1 year ago • 8 comments

Hi Alex,

The idea here is to try to strongly impose Dirichlet boundary conditions on problems in H(div) because nobody likes penalties that much.

It's our understanding the only support for strong boundary conditions is via the nodal boundary conditions infrastructure which cycles through boundary nodes, and therefore never has any concept of elements, or their sides, and thus no means for integration. So, here, we instead tried to use the integrated boundary conditions infrastructure to recover the ability to integrate but, of course, this poses some difficulties when the time comes to override the required Jacobian and residual entries.

The approach we took applies a boolean mask on the current element's Jacobian and residual, thereby erasing any entries we wish to override while preserving the entries we wish to keep corresponding to dofs in the bulk of the domain. This all assumes the assembly will go through ThreadedElementLoopBase<RangeType>::operator() and thus that any boundary contributions are computed after the bulk element contributions.

Number of (linear) iterations for the tests prescribed by coupled_electrostatics.i:

Element type Weak (penalty) BCs Strong BCs
HEX27 83 20
TET14 1509 1177
TRI6/7 328 328
QUAD8/9 22 9

Missing:

  • documentation
  • an implementation for H(curl)/Nédélec one

Possible improvements:

  • element-wise multiplication for libMesh's DenseMatrix and DenseVector to hide it from MOOSE's code
  • ~can I omit some postprocessors/variables from a CSVDiff (or a .csv output) to avoid unnecessary redundancy in the gold files?~ Done, thanks @GiudGiud!

Cheers, -Nuno

nmnobre avatar Jan 19 '24 13:01 nmnobre

Job Documentation on 64ec1e0 wanted to post the following:

View the site here

This comment will be updated on new commits.

moosebuild avatar Jan 19 '24 15:01 moosebuild

Job Coverage on 64ec1e0 wanted to post the following:

Framework coverage

c36c4a #26595 64ec1e
Total Total +/- New
Rate 85.06% 85.06% +0.00% 90.91%
Hits 104220 104280 +60 60
Misses 18308 18314 +6 6

Diff coverage report

Full coverage report

Modules coverage

Coverage did not change

Full coverage reports

Reports

This comment will be updated on new commits.

moosebuild avatar Jan 19 '24 16:01 moosebuild

What you have here is an elegant idea. However, there are APIs in the tagging interface that allow bypassing the local residual and Jacobian data structures so that a residual object can pass its residuals/Jacobians directly to Assembly;

Yeah, we noticed those. We had a solution intercepting cached entries, but it was so ugly we gave up.

A more bullet-proof solution would be to think about how we can generalize what we do for "nodal" boundary conditions for non-nodal boundary dofs.

Funny you mention it!, because we actually tried that too: https://github.com/idaholab/moose/compare/next...farscape-project:moose:dirichlet_nodal. Please ignore the print statements. The important bit is that by skipping all the is-this-a-nodal-variable checks on the example RT0 problem, MOOSE actually overrides the Jacobian and residual entries that you expect (those on boundary faces -- after all, all DoFs lie on a node). The problem is once you're there, you have no way of integrating. As far as I know, there's no way of getting an edge/face from a node, is there?

nmnobre avatar Jan 23 '24 00:01 nmnobre

You don't necessarily need JxW right? That will only influence scaling of the constraint. But you definitely need the _normals. So yes we wouldn't be able to use the nodal loop to apply these constraints

lindsayad avatar Jan 23 '24 18:01 lindsayad

This pull request has been automatically marked as stale because it has not had recent activity in the last 100 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 03 '24 05:05 github-actions[bot]

should we keep this open @nmnobre?

lindsayad avatar May 06 '24 14:05 lindsayad

I think I'd very much like to come back to this yes. I'm guessing the bot will shut up if I force push?

nmnobre avatar May 06 '24 14:05 nmnobre

you just need to comment to fend the bot away

GiudGiud avatar May 06 '24 14:05 GiudGiud