[petsc-users] nonzero prescribed boundary condition
Tian(ICT)
rongtian at ncic.ac.cn
Wed May 11 01:16:57 CDT 2011
With additional -snes_type test:
"-pc_type
lu -ksp_monitor_true_residual -snes_monitor -ksp_monitor -snes_type test"
atol=1e-050, rtol=1e-008, stol=1e-008, maxit=50, maxf=10000
Testing hand-coded Jacobian, if the ratio is
O(1.e-8), the hand-coded Jacobian is probably correct.
Run with -snes_test_display to show difference
of hand-coded and finite difference Jacobian.
Norm of matrix ratio 9.05702e-008 difference 3.94971
Norm of matrix ratio 3.6015e-007 difference 15.7059
Norm of matrix ratio 3.73941e-007 difference 16.3073
[0]PETSC ERROR: SNESSolve() line 1871 in
src/snes/interface/C:\cygwin\home\PETSC-~1.3-P\src\snes\INTERF~1\snes.c
[0]PETSC ERROR: User provided function() line 572 in
unknowndirectory/c:\cygwin\home\rabbit\pgfem - csrbf\domain.cpp
[0]PETSC ERROR: User provided function() line 40 in
unknowndirectory/c:\cygwin\home\rabbit\pgfem - csrbf\main.cpp
-snes_mf_operator does not work:
"-pc_type
lu -ksp_monitor_true_residual -snes_monitor -ksp_monitor -snes_ms_operator"
[0]PETSC ERROR: --------------------- Error
Message ------------------------------------
[0]PETSC ERROR: Object is in wrong state!
[0]PETSC ERROR: Not for unassembled matrix!
[0]PETSC
ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 2.3.3, Patch 15, Tue Sep 23 10:02:49
CDT 2008 HG revision: 31306062cd1a6f6a2496fccb4878f485c9b91760
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC
ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: pgfem on a cygwin-gc named RTI458-LAPTOP by rabbit Wed May
11 14:16:08 2011
[0]PETSC ERROR: Libraries linked from /home/petsc-2.3.3-p15/lib/cygwin-gcc
[0]PETSC ERROR: Configure run at Wed Dec 1 17:02:20 2010
[0]PETSC ERROR: Configure options --with-cc="win32fe cl" --with-cxx="win32fe
cl" --download-c-blas-lapack=1 --with-clanguage=cxx --with-fc=0 --useThreads=0
--with-shared=0
[0]PETSC
ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: MatDuplicate() line 3218 in
src/mat/interface/C:\cygwin\home\PETSC-~1.3-P\src\mat\INTERF~1\matrix.c
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]PETSC ERROR: --------------------- Error
Message ------------------------------------
[0]PETSC ERROR: Null argument, when expecting valid pointer!
[0]PETSC ERROR: Null Object: Parameter # 1!
[0]PETSC
ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 2.3.3, Patch 15, Tue Sep 23 10:02:49
CDT 2008 HG revision: 31306062cd1a6f6a2496fccb4878f485c9b91760
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC
ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: pgfem on a cygwin-gc named RTI458-LAPTOP by rabbit Wed May
11 14:16:08 2011
[0]PETSC ERROR: Libraries linked from /home/petsc-2.3.3-p15/lib/cygwin-gcc
[0]PETSC ERROR: Configure run at Wed Dec 1 17:02:20 2010
[0]PETSC ERROR: Configure options --with-cc="win32fe cl" --with-cxx="win32fe
cl" --download-c-blas-lapack=1 --with-clanguage=cxx --with-fc=0 --useThreads=0
--with-shared=0
[0]PETSC
ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: PetscObjectGetComm() line 34 in
src/sys/objects/C:\cygwin\home\PETSC-~1.3-P\src\sys\objects\gcomm.c
[0]PETSC ERROR: VecNormBegin() line 495 in
src/vec/vec/utils/C:\cygwin\home\PETSC-~1.3-P\src\vec\vec\utils\comb.c
[0]PETSC ERROR: MatMFFDCompute_WP() line 73 in
src/mat/impls/mffd/C:\cygwin\home\PETSC-~1.3-P\src\mat\impls\mffd\wp.c
[0]PETSC ERROR: MatMult_MFFD() line 294 in
src/mat/impls/mffd/C:\cygwin\home\PETSC-~1.3-P\src\mat\impls\mffd\mffd.c
[0]PETSC ERROR: MatMult() line 1632 in
src/mat/interface/C:\cygwin\home\PETSC-~1.3-P\src\mat\INTERF~1\matrix.c
[0]PETSC ERROR: KSPDefaultBuildResidual() line 605 in
src/ksp/ksp/interface/C:\cygwin\home\PETSC-~1.3-P\src\ksp\ksp\INTERF~1\iterativ.c
[0]PETSC ERROR: KSPBuildResidual() line 1587 in
src/ksp/ksp/interface/C:\cygwin\home\PETSC-~1.3-P\src\ksp\ksp\INTERF~1\itfunc.c
[0]PETSC ERROR: KSPMonitorTrueResidualNorm() line 258 in
src/ksp/ksp/interface/C:\cygwin\home\PETSC-~1.3-P\src\ksp\ksp\INTERF~1\iterativ.c
[0]PETSC ERROR: GMREScycle() line 155 in
src/ksp/ksp/impls/gmres/C:\cygwin\home\PETSC-~1.3-P\src\ksp\ksp\impls\gmres\gmres.c
[0]PETSC ERROR: KSPSolve_GMRES() line 241 in
src/ksp/ksp/impls/gmres/C:\cygwin\home\PETSC-~1.3-P\src\ksp\ksp\impls\gmres\gmres.c
[0]PETSC ERROR: KSPSolve() line 379 in
src/ksp/ksp/interface/C:\cygwin\home\PETSC-~1.3-P\src\ksp\ksp\INTERF~1\itfunc.c
[0]PETSC ERROR: SNES_KSPSolve() line 2578 in
src/snes/interface/C:\cygwin\home\PETSC-~1.3-P\src\snes\INTERF~1\snes.c
[0]PETSC ERROR: SNESSolve_LS() line 184 in
src/snes/impls/ls/C:\cygwin\home\PETSC-~1.3-P\src\snes\impls\ls\ls.c
[0]PETSC ERROR: SNESSolve() line 1871 in
src/snes/interface/C:\cygwin\home\PETSC-~1.3-P\src\snes\INTERF~1\snes.c
[0]PETSC ERROR: User provided function() line 574 in
unknowndirectory/c:\cygwin\home\rabbit\pgfem - csrbf\domain.cpp
[0]PETSC ERROR: User provided function() line 40 in
unknowndirectory/c:\cygwin\home\rabbit\pgfem - csrbf\main.cpp
Rong
----- 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 11:05 AM
Subject: Re: [petsc-users] nonzero prescribed boundary condition
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>
More information about the petsc-users
mailing list