[petsc-users] nonzero prescribed boundary condition

Tian(ICT) rongtian at ncic.ac.cn
Wed May 11 01:46:53 CDT 2011


Pls ignore my previous email.

The followings are the test results:
the previous error in using -snes_mf_opertor was due to my own code.
After modification, i.e. using different A and B and assemble both
and in FormJacobian the native jacobian was assembled into B.
Then with -snes_mf_operator led to the results shown below.
The first three steps converged but with a diverged reason -6 at step 4.


With additional -snes_type test, the results were

> "-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
>
>
> "-pc_type 
> lu -ksp_monitor_true_residual -snes_monitor -ksp_monitor -snes_ms_operator"

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 9.102368266281e-009
  1 KSP preconditioned resid norm 9.102368266281e-009 true resid norm 
5.414197277222e-002 ||Ae||/||Ax|| 7.656831218811e-001
  1 SNES Function norm 6.401926196865e-002
  0 KSP Residual norm 8.969200166800e-002
  0 KSP preconditioned resid norm 8.969200166800e-002 true resid norm 
6.401926196865e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 8.492849351675e-009
  1 KSP preconditioned resid norm 8.492849351675e-009 true resid norm 
1.400035213572e-002 ||Ae||/||Ax|| 2.186896834670e-001
  2 SNES Function norm 5.849991037388e-002
  0 KSP Residual norm 8.072279482667e-002
  0 KSP preconditioned resid norm 8.072279482667e-002 true resid norm 
5.849991037388e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.610510067555e-009
  1 KSP preconditioned resid norm 3.610510067555e-009 true resid norm 
4.757549946973e-003 ||Ae||/||Ax|| 8.132576471599e-002
  3 SNES Function norm 5.376617142827e-002
  0 KSP Residual norm 7.265050986128e-002
  0 KSP preconditioned resid norm 7.265050986128e-002 true resid norm 
5.376617142827e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 6.941165647221e-009
  1 KSP preconditioned resid norm 6.941165647221e-009 true resid norm 
3.935270526562e-002 ||Ae||/||Ax|| 7.319231446138e-001
  4 SNES Function norm 4.956888929193e-002
  0 KSP Residual norm 6.538545408372e-002
  0 KSP preconditioned resid norm 6.538545408372e-002 true resid norm 
4.956888929193e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.457970649220e-009
  1 KSP preconditioned resid norm 3.457970649220e-009 true resid norm 
2.037700110050e-002 ||Ae||/||Ax|| 4.110844804388e-001
  5 SNES Function norm 4.575415001780e-002
  0 KSP Residual norm 5.884690527647e-002
  0 KSP preconditioned resid norm 5.884690527647e-002 true resid norm 
4.575415001780e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 2.832662187541e-009
  1 KSP preconditioned resid norm 2.832662187541e-009 true resid norm 
1.662420124938e-002 ||Ae||/||Ax|| 3.633375604818e-001
  6 SNES Function norm 4.223018337199e-002
  0 KSP Residual norm 5.296221162333e-002
  0 KSP preconditioned resid norm 5.296221162333e-002 true resid norm 
4.223018337199e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.091667005099e-009
  1 KSP preconditioned resid norm 3.091667005099e-009 true resid norm 
2.235399010718e-002 ||Ae||/||Ax|| 5.293367994705e-001
  7 SNES Function norm 3.894426990170e-002
  0 KSP Residual norm 4.766598828506e-002
  0 KSP preconditioned resid norm 4.766598828506e-002 true resid norm 
3.894426990170e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 4.223811830585e-009
  1 KSP preconditioned resid norm 4.223811830585e-009 true resid norm 
2.831156780040e-002 ||Ae||/||Ax|| 7.269764684732e-001
  8 SNES Function norm 3.586679674893e-002
  0 KSP Residual norm 4.289938722959e-002
  0 KSP preconditioned resid norm 4.289938722959e-002 true resid norm 
3.586679674893e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.504535460429e-009
  1 KSP preconditioned resid norm 3.504535460429e-009 true resid norm 
2.254598873838e-002 ||Ae||/||Ax|| 6.286033541328e-001
  9 SNES Function norm 3.298126871313e-002
  0 KSP Residual norm 3.860944657267e-002
  0 KSP preconditioned resid norm 3.860944657267e-002 true resid norm 
3.298126871313e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 4.439084585574e-009
  1 KSP preconditioned resid norm 4.439084585574e-009 true resid norm 
6.936792391193e-003 ||Ae||/||Ax|| 2.103252137305e-001
 10 SNES Function norm 3.027806037514e-002
  0 KSP Residual norm 3.474850031738e-002
  0 KSP preconditioned resid norm 3.474850031738e-002 true resid norm 
3.027806037514e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.476854671229e-009
  1 KSP preconditioned resid norm 3.476854671229e-009 true resid norm 
1.935717696630e-002 ||Ae||/||Ax|| 6.393136391984e-001
 11 SNES Function norm 2.775064646763e-002
  0 KSP Residual norm 3.127364888698e-002
  0 KSP preconditioned resid norm 3.127364888698e-002 true resid norm 
2.775064646763e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 2.380857715198e-009
  1 KSP preconditioned resid norm 2.380857715198e-009 true resid norm 
1.646856223644e-002 ||Ae||/||Ax|| 5.934478771746e-001
 12 SNES Function norm 2.430399371900e-002
  0 KSP Residual norm 2.602654480862e-002
  0 KSP preconditioned resid norm 2.602654480862e-002 true resid norm 
2.430399371900e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 2.556142726483e-009
  1 KSP preconditioned resid norm 2.556142726483e-009 true resid norm 
1.794651743617e-002 ||Ae||/||Ax|| 7.384184526900e-001
 13 SNES Function norm 2.029256664631e-002
  0 KSP Residual norm 1.954645630691e-002
  0 KSP preconditioned resid norm 1.954645630691e-002 true resid norm 
2.029256664631e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.913585412092e-010
  1 KSP preconditioned resid norm 3.913585412092e-010 true resid norm 
1.903675728342e-003 ||Ae||/||Ax|| 9.381148089946e-002
 14 SNES Function norm 1.566638821565e-002
  0 KSP Residual norm 1.231404128086e-002
  0 KSP preconditioned resid norm 1.231404128086e-002 true resid norm 
1.566638821565e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 7.258598971379e-010
  1 KSP preconditioned resid norm 7.258598971379e-010 true resid norm 
1.221317129610e-003 ||Ae||/||Ax|| 7.795779810881e-002
 15 SNES Function norm 1.064422587384e-002
  0 KSP Residual norm 3.723145759360e-009
  0 KSP preconditioned resid norm 3.723145759360e-009 true resid norm 
1.064422587384e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 5.546825086207e-016
  1 KSP preconditioned resid norm 5.546825086207e-016 true resid norm 
2.984647735625e-009 ||Ae||/||Ax|| 2.804006389003e-007
 16 SNES Function norm 9.689226075617e-008
  0 KSP Residual norm 1.643080767133e-014
  0 KSP preconditioned resid norm 1.643080767133e-014 true resid norm 
9.689226075617e-008 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 7.291965935374e-022
  1 KSP preconditioned resid norm 7.291965935374e-022 true resid norm 
5.001850432973e-015 ||Ae||/||Ax|| 5.162280654758e-008
 17 SNES Function norm 3.747290584108e-008
STEP 0 (Newton iterations: 17)

  0 SNES Function norm 7.071067811866e-002
  0 KSP Residual norm 9.965769844003e-002
  0 KSP preconditioned resid norm 9.965769844003e-002 true resid norm 
7.071067811866e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 4.919247724727e-009
  1 KSP preconditioned resid norm 4.919247724727e-009 true resid norm 
2.073848008334e-002 ||Ae||/||Ax|| 2.932863979685e-001
  1 SNES Function norm 6.402041310994e-002
  0 KSP Residual norm 8.969192038029e-002
  0 KSP preconditioned resid norm 8.969192038029e-002 true resid norm 
6.402041310994e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 4.072962844649e-009
  1 KSP preconditioned resid norm 4.072962844649e-009 true resid norm 
2.116458841832e-002 ||Ae||/||Ax|| 3.305912503559e-001
  2 SNES Function norm 5.850358277995e-002
  0 KSP Residual norm 8.072272129834e-002
  0 KSP preconditioned resid norm 8.072272129834e-002 true resid norm 
5.850358277995e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.535693836801e-009
  1 KSP preconditioned resid norm 1.535693836801e-009 true resid norm 
1.378413836547e-002 ||Ae||/||Ax|| 2.356118670085e-001
  3 SNES Function norm 5.377276379928e-002
  0 KSP Residual norm 7.265044334812e-002
  0 KSP preconditioned resid norm 7.265044334812e-002 true resid norm 
5.377276379928e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 8.196914267894e-009
  1 KSP preconditioned resid norm 8.196914267894e-009 true resid norm 
1.643681592299e-002 ||Ae||/||Ax|| 3.056717706448e-001
  4 SNES Function norm 4.957825627064e-002
  0 KSP Residual norm 6.538539498475e-002
  0 KSP preconditioned resid norm 6.538539498475e-002 true resid norm 
4.957825627064e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.605278143372e-009
  1 KSP preconditioned resid norm 1.605278143372e-009 true resid norm 
1.365749144340e-002 ||Ae||/||Ax|| 2.754734125550e-001
  5 SNES Function norm 4.576573391352e-002
  0 KSP Residual norm 5.884685187863e-002
  0 KSP preconditioned resid norm 5.884685187863e-002 true resid norm 
4.576573391352e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.917790130377e-009
  1 KSP preconditioned resid norm 3.917790130377e-009 true resid norm 
2.918137698804e-002 ||Ae||/||Ax|| 6.376250196967e-001
  6 SNES Function norm 4.224348383506e-002
  0 KSP Residual norm 5.296216341013e-002
  0 KSP preconditioned resid norm 5.296216341013e-002 true resid norm 
4.224348383506e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.384279752582e-009
  1 KSP preconditioned resid norm 1.384279752582e-009 true resid norm 
8.645143617596e-003 ||Ae||/||Ax|| 2.046503468168e-001
  7 SNES Function norm 3.895875122953e-002
  0 KSP Residual norm 4.766594475257e-002
  0 KSP preconditioned resid norm 4.766594475257e-002 true resid norm 
3.895875122953e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 5.442999105246e-009
  1 KSP preconditioned resid norm 5.442999105246e-009 true resid norm 
3.199366262059e-002 ||Ae||/||Ax|| 8.212188946227e-001
  8 SNES Function norm 3.588203219083e-002
  0 KSP Residual norm 4.289934859308e-002
  0 KSP preconditioned resid norm 4.289934859308e-002 true resid norm 
3.588203219083e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 5.069272581944e-009
  1 KSP preconditioned resid norm 5.069272581944e-009 true resid norm 
3.315026802067e-002 ||Ae||/||Ax|| 9.238681868510e-001
  9 SNES Function norm 3.299674865285e-002
  0 KSP Residual norm 3.860941169595e-002
  0 KSP preconditioned resid norm 3.860941169595e-002 true resid norm 
3.299674865285e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 2.314510318621e-009
  1 KSP preconditioned resid norm 2.314510318621e-009 true resid norm 
1.422355468145e-002 ||Ae||/||Ax|| 4.310592789335e-001
 10 SNES Function norm 3.020092421335e-002
  0 KSP Residual norm 3.457428537321e-002
  0 KSP preconditioned resid norm 3.457428537321e-002 true resid norm 
3.020092421335e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.171225245965e-009
  1 KSP preconditioned resid norm 3.171225245965e-009 true resid norm 
6.700877909403e-003 ||Ae||/||Ax|| 2.218765843742e-001
 11 SNES Function norm 2.761432326644e-002
  0 KSP Residual norm 3.100402216444e-002
  0 KSP preconditioned resid norm 3.100402216444e-002 true resid norm 
2.761432326644e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 2.317753799744e-009
  1 KSP preconditioned resid norm 2.317753799744e-009 true resid norm 
1.143024510909e-002 ||Ae||/||Ax|| 4.139245057287e-001
 12 SNES Function norm 2.483228477543e-002
  0 KSP Residual norm 2.716039584199e-002
  0 KSP preconditioned resid norm 2.716039584199e-002 true resid norm 
2.483228477543e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.024860175617e-009
  1 KSP preconditioned resid norm 1.024860175617e-009 true resid norm 
5.071961436716e-003 ||Ae||/||Ax|| 2.042486820115e-001
 13 SNES Function norm 2.155599009420e-002
  0 KSP Residual norm 2.247739022940e-002
  0 KSP preconditioned resid norm 2.247739022940e-002 true resid norm 
2.155599009420e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.231896568498e-009
  1 KSP preconditioned resid norm 1.231896568498e-009 true resid norm 
2.253717888475e-003 ||Ae||/||Ax|| 1.045518150002e-001
 14 SNES Function norm 1.758159262430e-002
  0 KSP Residual norm 1.640654408633e-002
  0 KSP preconditioned resid norm 1.640654408633e-002 true resid norm 
1.758159262430e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.203409491551e-009
  1 KSP preconditioned resid norm 1.203409491551e-009 true resid norm 
3.340286893989e-003 ||Ae||/||Ax|| 1.899877312236e-001
 15 SNES Function norm 1.275874713861e-002
  0 KSP Residual norm 8.737890404296e-003
  0 KSP preconditioned resid norm 8.737890404296e-003 true resid norm 
1.275874713861e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.862616851249e-010
  1 KSP preconditioned resid norm 3.862616851249e-010 true resid norm 
9.158071400861e-004 ||Ae||/||Ax|| 7.177876715771e-002
 16 SNES Function norm 5.367994969686e-003
  0 KSP Residual norm 1.873266786098e-009
  0 KSP preconditioned resid norm 1.873266786098e-009 true resid norm 
5.367994969686e-003 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 9.236612780542e-017
  1 KSP preconditioned resid norm 9.236612780542e-017 true resid norm 
4.487656305545e-010 ||Ae||/||Ax|| 8.360023306445e-008
 17 SNES Function norm 1.843858578272e-008
  0 KSP Residual norm 3.418191528615e-015
  0 KSP preconditioned resid norm 3.418191528615e-015 true resid norm 
1.843858578272e-008 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 2.091028447697e-022
  1 KSP preconditioned resid norm 2.091028447697e-022 true resid norm 
9.356082852780e-016 ||Ae||/||Ax|| 5.074186796662e-008
 18 SNES Function norm 1.582175998776e-008
STEP 1 (Newton iterations: 18)

  0 SNES Function norm 7.071067811866e-002
  0 KSP Residual norm 9.965760716669e-002
  0 KSP preconditioned resid norm 9.965760716669e-002 true resid norm 
7.071067811866e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 4.158690871520e-009
  1 KSP preconditioned resid norm 4.158690871520e-009 true resid norm 
1.356168089543e-002 ||Ae||/||Ax|| 1.917911305090e-001
  1 SNES Function norm 6.402155946870e-002
  0 KSP Residual norm 8.969183775926e-002
  0 KSP preconditioned resid norm 8.969183775926e-002 true resid norm 
6.402155946870e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 7.922035131300e-009
  1 KSP preconditioned resid norm 7.922035131300e-009 true resid norm 
4.173737132742e-002 ||Ae||/||Ax|| 6.519268145573e-001
  2 SNES Function norm 5.850726192206e-002
  0 KSP Residual norm 8.072264774465e-002
  0 KSP preconditioned resid norm 8.072264774465e-002 true resid norm 
5.850726192206e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 4.356474211542e-009
  1 KSP preconditioned resid norm 4.356474211542e-009 true resid norm 
2.083500604436e-002 ||Ae||/||Ax|| 3.561097436437e-001
  3 SNES Function norm 5.377933295280e-002
  0 KSP Residual norm 7.265037686612e-002
  0 KSP preconditioned resid norm 7.265037686612e-002 true resid norm 
5.377933295280e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 8.772318530630e-009
  1 KSP preconditioned resid norm 8.772318530630e-009 true resid norm 
5.284958913103e-002 ||Ae||/||Ax|| 9.827118751623e-001
  4 SNES Function norm 4.958751191600e-002
  0 KSP Residual norm 6.538533386375e-002
  0 KSP preconditioned resid norm 6.538533386375e-002 true resid norm 
4.958751191600e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.128741903850e-009
  1 KSP preconditioned resid norm 1.128741903850e-009 true resid norm 
2.526410501148e-003 ||Ae||/||Ax|| 5.094852319729e-002
  5 SNES Function norm 4.577729047509e-002
  0 KSP Residual norm 5.884679667348e-002
  0 KSP preconditioned resid norm 5.884679667348e-002 true resid norm 
4.577729047509e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 5.763627011382e-009
  1 KSP preconditioned resid norm 5.763627011382e-009 true resid norm 
1.051243252216e-002 ||Ae||/||Ax|| 2.296429608013e-001
  6 SNES Function norm 4.225677503639e-002
  0 KSP Residual norm 5.296211439112e-002
  0 KSP preconditioned resid norm 5.296211439112e-002 true resid norm 
4.225677503639e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.022912340341e-009
  1 KSP preconditioned resid norm 1.022912340341e-009 true resid norm 
3.573383237647e-003 ||Ae||/||Ax|| 8.456355778617e-002
  7 SNES Function norm 3.897321226706e-002
  0 KSP Residual norm 4.766590050155e-002
  0 KSP preconditioned resid norm 4.766590050155e-002 true resid norm 
3.897321226706e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.528025220977e-009
  1 KSP preconditioned resid norm 3.528025220977e-009 true resid norm 
1.960313404416e-002 ||Ae||/||Ax|| 5.029899488355e-001
  8 SNES Function norm 3.589720610234e-002
  0 KSP Residual norm 4.289930864255e-002
  0 KSP preconditioned resid norm 4.289930864255e-002 true resid norm 
3.589720610234e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 4.133432759880e-009
  1 KSP preconditioned resid norm 4.133432759880e-009 true resid norm 
1.940005023620e-002 ||Ae||/||Ax|| 5.404334304149e-001
  9 SNES Function norm 3.301230929196e-002
  0 KSP Residual norm 3.860937624684e-002
  0 KSP preconditioned resid norm 3.860937624684e-002 true resid norm 
3.301230929196e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 8.211304264406e-010
  1 KSP preconditioned resid norm 8.211304264406e-010 true resid norm 
7.328958637952e-003 ||Ae||/||Ax|| 2.220068451781e-001
 10 SNES Function norm 3.030900587812e-002
  0 KSP Residual norm 3.474843739750e-002
  0 KSP preconditioned resid norm 3.474843739750e-002 true resid norm 
3.030900587812e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.265840938498e-009
  1 KSP preconditioned resid norm 3.265840938498e-009 true resid norm 
1.358870142093e-002 ||Ae||/||Ax|| 4.483387371916e-001
 11 SNES Function norm 2.718409957830e-002
  0 KSP Residual norm 3.013614572851e-002
  0 KSP preconditioned resid norm 3.013614572851e-002 true resid norm 
2.718409957830e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.652744245097e-009
  1 KSP preconditioned resid norm 1.652744245097e-009 true resid norm 
1.202105117910e-002 ||Ae||/||Ax|| 4.422089149754e-001
 12 SNES Function norm 2.437348813670e-002
  0 KSP Residual norm 2.629377332723e-002
  0 KSP preconditioned resid norm 2.629377332723e-002 true resid norm 
2.437348813670e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 3.959255153953e-009
  1 KSP preconditioned resid norm 3.959255153953e-009 true resid norm 
2.578989386428e-002 ||Ae||/||Ax|| 1.058112557367e+000
 13 SNES Function norm 2.199784341474e-002
  0 KSP Residual norm 2.328182605620e-002
  0 KSP preconditioned resid norm 2.328182605620e-002 true resid norm 
2.199784341474e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 8.915626892590e-010
  1 KSP preconditioned resid norm 8.915626892590e-010 true resid norm 
6.263373898192e-003 ||Ae||/||Ax|| 2.847267243477e-001
 14 SNES Function norm 1.833996742657e-002
  0 KSP Residual norm 1.794186796967e-002
  0 KSP preconditioned resid norm 1.794186796967e-002 true resid norm 
1.833996742657e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 1.694980794482e-009
  1 KSP preconditioned resid norm 1.694980794482e-009 true resid norm 
2.372076451714e-003 ||Ae||/||Ax|| 1.293391856453e-001
 15 SNES Function norm 1.384131369872e-002
  0 KSP Residual norm 1.074320273869e-002
  0 KSP preconditioned resid norm 1.074320273869e-002 true resid norm 
1.384131369872e-002 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 7.118408455169e-010
  1 KSP preconditioned resid norm 7.118408455169e-010 true resid norm 
4.592913592019e-003 ||Ae||/||Ax|| 3.318264213927e-001
 16 SNES Function norm 8.126551489387e-003
  0 KSP Residual norm 2.817712852237e-009
  0 KSP preconditioned resid norm 2.817712852237e-009 true resid norm 
8.126551489387e-003 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 2.239560797627e-016
  1 KSP preconditioned resid norm 2.239560797627e-016 true resid norm 
1.053395037920e-009 ||Ae||/||Ax|| 1.296238680448e-007
 17 SNES Function norm 4.871218193429e-008
  0 KSP Residual norm 1.123675925695e-014
  0 KSP preconditioned resid norm 1.123675925695e-014 true resid norm 
4.871218193429e-008 ||Ae||/||Ax|| 1.000000000000e+000
  1 KSP Residual norm 5.307928330547e-022
  1 KSP preconditioned resid norm 5.307928330547e-022 true resid norm 
2.893354456541e-015 ||Ae||/||Ax|| 5.939693813026e-008
 18 SNES Function norm 5.035279029783e-008
STEP 2 (Newton iterations: 18)

diverged reason: -6


 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