idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.75k stars 1.05k forks source link

Scaling for Dirichlet bcs #1898

Closed jasondhales closed 9 years ago

jasondhales commented 10 years ago

The way MOOSE handles Dirichlet bcs is to zero the row in the matrix associated with the appropriate degree of freedom, place a one on the diagonal entry, and replace the RHS at that row with the prescribed value. This has the drawback of the magnitude of the stiffness for that row being predetermined regardless of the magnitude of the row before the change or of the magnitude of the stiffness generally. This adversely affects the conditioning of the problem, and in some cases the solver does not recover.

It would be helpful if scaling options were available for Dirichlet bcs. For example, instead of using one on the diagonal, MOOSE could use the sum of the absolute values of the entries on the row and scale the RHS accordingly. Another idea would be to allow the user to set the diagonal value.

andrsd commented 10 years ago

Should not the scaling factor applied here be the same as the one specified for the variable?

jasondhales commented 10 years ago

Let's imagine that we have a model with diagonal entries on the order of 10^-20^. Let's also say that the system would solve just fine if we eliminated the DOFs associated with homogeneous BCs. If this were the case, the condition number would therefore be acceptable. If we handle Dirichlet BCs by replacing diagonal entries with 1, we will then have a very large condition number. We could scale the equation by 10^20^ to solve this. However, if for some reason the magnitude of the diagonal entries changes dramatically (drops 20 orders of magnitude), we are again left with a large condition number.

If instead of 1 we used the value of the diagonal entry, we would not harm the conditioning of the system.

andrsd commented 10 years ago

I am attaching a patch that removes the put 1. on diagonal thing and does the sum of abs values. It should do what you requested. Could you try on your problems which exhibited the convergence issues and let me know if it helped?

jwpeterson commented 9 years ago

BCs which derive from NodalBC can now override computeQpJacobian() and computeQpOffDiagJacobian(). I think you can probably use this to implement any kind of problem-dependent scaling you might require for DirichletBCs. Also, since there hasn't been any response on this issue since David's first attempt to fix it, I'm closing...