# [petsc-users] Dirichlet boundary condition for a nonlinear system

Barry Smith bsmith at mcs.anl.gov
Tue Feb 18 19:56:00 CST 2014

```On Feb 18, 2014, at 5:39 PM, Fande Kong <fd.kong at siat.ac.cn> wrote:

> Hi all,
>
> I am just trying to solve a nonlinear system resulted from discretizating a hyperelasticity problem by finite element method. When I solve a linear PDE, I never put boundary solution either in a solution vector or a matrix, but instead, I put boundary condition to the right hand size (load).

You adjust the right hand side to have zero as the boundary conditions. This can be written as

(A_II   A_IB ) ( X_I )       (F_I)
(A_BI  A_BB)(X_B)   =   (F_B)

Which is equivalent to

(A_I  A_B) (X_I)         (F_I) - (A_B)*(X_B)
(0)       =

A_I X_I  = F_I - A_B*X_B

In the nonlinear case you have

F_I(X_I,X_B)    = ( 0 )
F_B(X_I,X_B)      ( 0)

where you know X_B  with Jacobian

(J_II  J_IB)
(J_BI J_BB)

Newtons’ method on all variables gives

(X_I)^{n+1}     =  (X_I)^{n}     +  (Y_I)
(X_B)                  (X_B)              (Y_B)

where   JY = F which written out in terms of I and B is

(J_II  J_IB)   (Y_I)      =   F_I( X_I,X_B)
(J_BI J_BB)   (Y_B)         F_B(X_I,X_B)

Now since X_B is the solution on the boundary the updates on the boundary at zero so Y_B is zero so this system reduces to

J_II   Y_I     = F_I(X_I,X_B) so Newton reduces to just the interior with

(X_I)^{n+1}     =  (X_I)^{n}     +  J_II^{-1} F_I(X_I,X_B)

Another way to look at it is you are simply solving F_I(X_I,X_B) = 0 with given X_B so Newton’s method only uses the Jacobian of F_I with respect to X_I

Barry

> How can I do a similar thing when solving a nonlinear system using a newton method?
>
> Thanks,
>
> Fande,

```