Ok, the linear solver looks like it is working ok. The likely problem is 
that Jacobian does not match the function evaluation.

   Run the same thing but with the additional option -snes_mf_operator

   Then run with -snes_type test (instead of -snes_mf_operator).

   Barry

On May 10, 2011, at 8:14 PM, Tian(ICT) wrote:

> Dear Barry,  here is the output using -pc_type lu -ksp_monitor_true_residual 
> -snes_monitor -ksp_monitor
> the attached is the same and for clear reference. Thanks again for helps.
> 
> atol=1e-050, rtol=1e-008, stol=1e-008, maxit=50, maxf=10000
> 0 SNES Function norm 7.071067811865e-002
> 0 KSP Residual norm 9.965778978387e-002
> 0 KSP preconditioned resid norm 9.965778978387e-002 true resid norm 
> 7.071067811865e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 6.823187455811e-017
> 1 KSP preconditioned resid norm 6.823187455811e-017 true resid norm 
> 8.847298885656e-011 ||Ae||/||Ax|| 1.251197007446e-009
> 1 SNES Function norm 6.401926523423e-002
> 0 KSP Residual norm 8.969200212486e-002
> 0 KSP preconditioned resid norm 8.969200212486e-002 true resid norm 
> 6.401926523423e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 1.106757475780e-016
> 1 KSP preconditioned resid norm 1.106757475780e-016 true resid norm 
> 6.211830067439e-011 ||Ae||/||Ax|| 9.703063671087e-010
> 2 SNES Function norm 5.849992149767e-002
> 0 KSP Residual norm 8.072279488157e-002
> 0 KSP preconditioned resid norm 8.072279488157e-002 true resid norm 
> 5.849992149767e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 1.268750073799e-017
> 1 KSP preconditioned resid norm 1.268750073799e-017 true resid norm 
> 3.802431036387e-011 ||Ae||/||Ax|| 6.499890835816e-010
> 3 SNES Function norm 5.376618503592e-002
> 0 KSP Residual norm 7.265050969883e-002
> 0 KSP preconditioned resid norm 7.265050969883e-002 true resid norm 
> 5.376618503592e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 2.677655733356e-017
> 1 KSP preconditioned resid norm 2.677655733356e-017 true resid norm 
> 8.120397788686e-011 ||Ae||/||Ax|| 1.510316899602e-009
> 4 SNES Function norm 4.956894354459e-002
> 0 KSP Residual norm 6.538545411661e-002
> 0 KSP preconditioned resid norm 6.538545411661e-002 true resid norm 
> 4.956894354459e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 9.557004153175e-017
> 1 KSP preconditioned resid norm 9.557004153175e-017 true resid norm 
> 2.944250802029e-011 ||Ae||/||Ax|| 5.939708598754e-010
> 5 SNES Function norm 4.575418613137e-002
> 0 KSP Residual norm 5.884690496914e-002
> 0 KSP preconditioned resid norm 5.884690496914e-002 true resid norm 
> 4.575418613137e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 5.470969262115e-017
> 1 KSP preconditioned resid norm 5.470969262115e-017 true resid norm 
> 3.659003166095e-011 ||Ae||/||Ax|| 7.997089393284e-010
> 6 SNES Function norm 4.223022245585e-002
> 0 KSP Residual norm 5.296221144636e-002
> 0 KSP preconditioned resid norm 5.296221144636e-002 true resid norm 
> 4.223022245585e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 8.255198782390e-017
> 1 KSP preconditioned resid norm 8.255198782390e-017 true resid norm 
> 1.955545658933e-011 ||Ae||/||Ax|| 4.630678090739e-010
> 7 SNES Function norm 3.894430065910e-002
> 0 KSP Residual norm 4.766598785088e-002
> 0 KSP preconditioned resid norm 4.766598785088e-002 true resid norm 
> 3.894430065910e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 3.322615478395e-017
> 1 KSP preconditioned resid norm 3.322615478395e-017 true resid norm 
> 3.485328148673e-011 ||Ae||/||Ax|| 8.949520442496e-010
> 8 SNES Function norm 3.586683371135e-002
> 0 KSP Residual norm 4.289938708067e-002
> 0 KSP preconditioned resid norm 4.289938708067e-002 true resid norm 
> 3.586683371135e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 6.181358328498e-017
> 1 KSP preconditioned resid norm 6.181358328498e-017 true resid norm 
> 3.246902818086e-011 ||Ae||/||Ax|| 9.052660862724e-010
> 9 SNES Function norm 3.298130202025e-002
> 0 KSP Residual norm 3.860944676473e-002
> 0 KSP preconditioned resid norm 3.860944676473e-002 true resid norm 
> 3.298130202025e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 4.635174776374e-017
> 1 KSP preconditioned resid norm 4.635174776374e-017 true resid norm 
> 1.497516842272e-011 ||Ae||/||Ax|| 4.540502498513e-010
> 10 SNES Function norm 3.027806208930e-002
> 0 KSP Residual norm 3.474850078591e-002
> 0 KSP preconditioned resid norm 3.474850078591e-002 true resid norm 
> 3.027806208930e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 2.389914053685e-017
> 1 KSP preconditioned resid norm 2.389914053685e-017 true resid norm 
> 6.007440888596e-011 ||Ae||/||Ax|| 1.984090286517e-009
> 11 SNES Function norm 2.749422924729e-002
> 0 KSP Residual norm 3.081350823297e-002
> 0 KSP preconditioned resid norm 3.081350823297e-002 true resid norm 
> 2.749422924729e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 2.640567497647e-017
> 1 KSP preconditioned resid norm 2.640567497647e-017 true resid norm 
> 1.281638295853e-011 ||Ae||/||Ax|| 4.661481085089e-010
> 12 SNES Function norm 2.437488247885e-002
> 0 KSP Residual norm 2.633007441879e-002
> 0 KSP preconditioned resid norm 2.633007441879e-002 true resid norm 
> 2.437488247885e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 2.772331460094e-017
> 1 KSP preconditioned resid norm 2.772331460094e-017 true resid norm 
> 1.918212496143e-011 ||Ae||/||Ax|| 7.869627670236e-010
> 13 SNES Function norm 2.079664278637e-002
> 0 KSP Residual norm 2.104738289397e-002
> 0 KSP preconditioned resid norm 2.104738289397e-002 true resid norm 
> 2.079664278637e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 1.650632708670e-017
> 1 KSP preconditioned resid norm 1.650632708670e-017 true resid norm 
> 2.316371967362e-011 ||Ae||/||Ax|| 1.113820144509e-009
> 14 SNES Function norm 1.657344626858e-002
> 0 KSP Residual norm 1.454141853505e-002
> 0 KSP preconditioned resid norm 1.454141853505e-002 true resid norm 
> 1.657344626858e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 1.129401160070e-017
> 1 KSP preconditioned resid norm 1.129401160070e-017 true resid norm 
> 7.885499327559e-012 ||Ae||/||Ax|| 4.757911661686e-010
> 15 SNES Function norm 1.484243752612e-002
> 0 KSP Residual norm 5.241948491751e-009
> 0 KSP preconditioned resid norm 5.241948491751e-009 true resid norm 
> 1.484243752612e-002 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 2.729506849025e-024
> 1 KSP preconditioned resid norm 2.729506849025e-024 true resid norm 
> 6.386677851085e-018 ||Ae||/||Ax|| 4.302984492839e-016
> 16 SNES Function norm 2.828002157497e-008
> 0 KSP Residual norm 6.042518362322e-015
> 0 KSP preconditioned resid norm 6.042518362322e-015 true resid norm 
> 2.828002157497e-008 ||Ae||/||Ax|| 1.000000000000e+000
> 1 KSP Residual norm 6.272441346127e-030
> 1 KSP preconditioned resid norm 6.272441346127e-030 true resid norm 
> 1.112857698032e-023 ||Ae||/||Ax|| 3.935137372797e-016
> 17 SNES Function norm 2.960967020289e-008
> STEP 0 (Newton iterations: 17)
> 
> diverged reason: -6
> 
> 
> ----- Original Message ----- From: "Barry Smith" <bsmith at mcs.anl.gov>
> To: "PETSc users list" <petsc-users at mcs.anl.gov>
> Sent: Wednesday, May 11, 2011 2:54 AM
> Subject: Re: [petsc-users] nonzero prescribed boundary condition
> 
> 
> 
>  Use -pc_type lu -ksp_monitor_true_residual -snes_monitor -ksp_monitor and 
> send the outputs
> 
> 
>  Barry
> 
> On May 9, 2011, at 10:43 PM, Tian(ICT) wrote:
> 
>> by the way, the increment size is like that
>> for a 100 lengh model, the increment is set to 0.05,
>> the engineering strain is around 5%% per load step.
>> This is already too small increment size for a large deformation analysis.
>> a 0.5 increment size leads to both linear search and trust region failed.
>> linear search failed for 0.05 while trust region converges with 17 Newton 
>> iterations each load step.
>> Rong
>> 
>> ----- Original Message ----- From: "Tian(ICT)" <rongtian at ncic.ac.cn>
>> To: "PETSc users list" <petsc-users at mcs.anl.gov>
>> Sent: Tuesday, May 10, 2011 11:37 AM
>> Subject: Re: [petsc-users] nonzero prescribed boundary condition
>> 
>> 
>>> First, thanks again, the issue was gone.
>>> 
>>> I just followed up with some test results.
>>> I have tested SNES using one finite element for a geometric large 
>>> deformation problem.
>>> Those are just the very early test results so they may be not telling what 
>>> happened exactly.
>>> For the displacement controlled load, I found that convergence is much 
>>> slower than that of force loading.
>>> Even worse, linear search is so sensitive to the displacement increment and 
>>> diverged no matter what the increment size was used (too small incremnt 
>>> also led to diverged soloution (-6 reason), trust region works well in the 
>>> sense of not sensitive to the displacement increment, but during each load 
>>> step, it requires around ten to several tens of Newton interations whereas 
>>> for the force loading case and the almost same amount of deformation, this 
>>> is normally 3. This is against my expectation. Any hint?
>>> 
>>> 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 10:22 AM
>>> Subject: Re: [petsc-users] nonzero prescribed boundary condition
>>> 
>>> 
>>> 
>>> 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
>>>> 
>>>> 
>>> 
>>> 
>> 
> 
> <aa>

Reply via email to