[petsc-users] nonzero prescribed boundary condition

Barry Smith bsmith at mcs.anl.gov
Mon May 9 21:22:12 CDT 2011


On May 9, 2011, at 9:15 PM, Tian(ICT) wrote:

> Dear Barry, Thanks a lot for quick answering.
> I checked the development documents and found the new version of MatZeroRows() does support the nonzero prescribed boundary conditions.
> 
> I followed up with more details.
> I am using Petasc 2.3.3. to solve a nonlinear problem, e.g. using SNES solvers.
> I used a displacement-controlled load (as this type of loading works well for all cases).
> This is the reason the nonzero prescribed boundary came up.
> 
> In FormJacobian, I modified Jacobian and residual to satisfy the nonzero prescribed boundary.
> In FormFunction, I modified the solution to the known solution(this should not be necessary as the modified Jacobian and rhs should give the prescribed solution also)

   You should not do it this way. See below.
> 
> Now I found another issue, no matter if I prescried the solution or not in FormFunction,
> SNES solver always call FormFunction and never call FormJacobian.

   The only reason it would not call FormJacobian is if decided that the residual norm was small enough before any Newton steps; for example if the FormFunction() computed exactly the zero function initially. When you run with -snes_monitor -ksp_monitor what does it print for residual norms.

> Of course the solver finally diverged or converged to a zero solution.
> 
> So my quick follow up question is How a displacement-controled load is done corrently in Petsc 2.3.3?

   To do it in 2.3.3 simply have for those components of F() the formula     F_i = x_i - givenvalue_i and in your Jacobian just use MatZeroRows() for those rows 

   We strongly urge you to upgrade to the latest PETSc before doing anything further.


    Barry

> 
> Rong
> 
> ----- Original Message ----- From: "Barry Smith" <bsmith at mcs.anl.gov>
> To: "PETSc users list" <petsc-users at mcs.anl.gov>
> Sent: Tuesday, May 10, 2011 9:31 AM
> Subject: Re: [petsc-users] nonzero prescribed boundary condition
> 
> 
> 
>  In petsc-dev http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html we have modified the calling sequence for MatZeroRows() so that it can automatically adjust the appropriate right hand side values for the zeroed rows to support zero or non-zero prescribed boundary conditions easily.
> 
>   Barry
> 
> On May 9, 2011, at 8:18 PM, Tian(ICT) wrote:
> 
>> Dear all,
>> 
>> I got this question long ago and searched the prior posting but did not find the solution.
>> The question is about nonzero prescribed boundary condition.
>> My understanding is that MatZeroRows() works only for zero prescribed value, not non-zero value.
>> For the non-zero values, we have to remove the rows associated with the boundary, but this
>> will lead to a zero dignal and accordingly the rows in r.h.s should also be removed.
>> My question is that does MatZeroRows() also works for nonzero prescribed boundary and if so how to do it simply?
>> 
>> Rong
> 
> 



More information about the petsc-users mailing list