Discussion:
[petsc-users] SNESSetConvergenceTest usage?
William Coirier
2015-10-07 22:12:13 UTC
Permalink
Without going into too many details regarding the application, here is a problem I've encountered and wonder if anyone has any suggestions.

I have supplied a convergence test function for SNES using the SNESSetConvergenceTest API. My convergence test function sets the SNESConvergedReason variable referenced in the argument list to a handful of SNESConvergedReasons (and does other stuff, but that is not relevant...)

In my application code, after I call SNESSolve, I call SNESGetConvergedReason, and for some reason I will occasionally see SNESConvergedReasons that are NOT in the subset of those I supply with my convergence test function.

It's as if my test function setting of the converged reason is either being overwritten, or ignored.

As an example, I'm using the newtonls (default) scheme, and (an inexact, but workable) Jacobian. My test function only will set SNESConvergedReason to SNES_CONVERGED_ITERATING, SNES_CONVERGED_SNORM_RELATIVE or SNES_DIVERGED_MAX_IT. But, I see DIVERGED_LINE_SEARCH from the call to SNESGetConvergedReason.

Is the line search diverging (most likely?!) and blowing by my convergence test function?? Maybe (most likely?) I'm doing something stupid...

Otherwise things are working great. PETSc is awesome!

Any help/suggestions/input is appreciated.


-----------------------------------------------------------------------
William J. Coirier, Ph.D.
Director, Aerosciences and Engineering Analysis
Advanced Technology Division
Kratos/Digital Fusion, Inc.
4904 Research Drive
Huntsville, AL 35805
256-327-8170
256-327-8120 (fax)


--------------------------------------------------------------------------------------------------------------------

***NOTICE*** This e-mail and/or the attached documents may contain technical data within the definition of the International Traffic in Arms Regulations and/or Export Administration Regulations, and are subject to the export control laws of the U.S. Government. Transfer of this data by any means to a foreign person, whether in the United States or abroad, without an export license or other approval from the U.S. Department of State or Commerce, as applicable, is prohibited. No portion of this e-mail or its attachment(s) may be reproduced without written consent of Kratos Defense & Security Solutions, Inc. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient or believe that you may have received this document in error, please notify the sender and delete this e-mail and any attachments immediately.
Barry Smith
2015-10-07 22:21:46 UTC
Permalink
Without going into too many details regarding the application, here is a problem I’ve encountered and wonder if anyone has any suggestions.
I have supplied a convergence test function for SNES using the SNESSetConvergenceTest API. My convergence test function sets the SNESConvergedReason variable referenced in the argument list to a handful of SNESConvergedReasons (and does other stuff, but that is not relevant…)
In my application code, after I call SNESSolve, I call SNESGetConvergedReason, and for some reason I will occasionally see SNESConvergedReasons that are NOT in the subset of those I supply with my convergence test function.
It’s as if my test function setting of the converged reason is either being overwritten, or ignored.
As an example, I’m using the newtonls (default) scheme, and (an inexact, but workable) Jacobian. My test function only will set SNESConvergedReason to SNES_CONVERGED_ITERATING, SNES_CONVERGED_SNORM_RELATIVE or SNES_DIVERGED_MAX_IT. But, I see DIVERGED_LINE_SEARCH from the call to SNESGetConvergedReason.
The line search routines themselves can set the converged reason, when the line search fails, this happens before it has the next solution so before the next time your line search tester is called. So your value is not been overwritten or ignored.

I am not sure what you want to do about this? It is just the way it is.

Barry
Is the line search diverging (most likely?!) and blowing by my convergence test function?? Maybe (most likely?) I’m doing something stupid…
Otherwise things are working great. PETSc is awesome!
Any help/suggestions/input is appreciated.
-----------------------------------------------------------------------
William J. Coirier, Ph.D.
Director, Aerosciences and Engineering Analysis
Advanced Technology Division
Kratos/Digital Fusion, Inc.
4904 Research Drive
Huntsville, AL 35805
256-327-8170
256-327-8120 (fax)
--------------------------------------------------------------------------------------------------------------------
***NOTICE*** This e-mail and/or the attached documents may contain technical data within the definition of the International Traffic in Arms Regulations and/or Export Administration Regulations, and are subject to the export control laws of the U.S. Government. Transfer of this data by any means to a foreign person, whether in the United States or abroad, without an export license or other approval from the U.S. Department of State or Commerce, as applicable, is prohibited. No portion of this e-mail or its attachment(s) may be reproduced without written consent of Kratos Defense & Security Solutions, Inc. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient or believe that you may have received this document in error, please notify the sender and delete this e-mail and any attachments immediately.
William Coirier
2015-10-07 22:28:10 UTC
Permalink
Thank you Barry. This explains the behavior.

Maybe I should try a different search strategy? Perhaps newtontr?

Thanks for your help.

-----------------------------------------------------------------------
William J. Coirier, Ph.D.
Director, Aerosciences and Engineering Analysis
Advanced Technology Division
Kratos/Digital Fusion, Inc.
4904 Research Drive
Huntsville, AL 35805
256-327-8170
256-327-8120 (fax)


-----Original Message-----
From: Barry Smith [mailto:***@mcs.anl.gov]
Sent: Wednesday, October 07, 2015 5:22 PM
To: William Coirier
Cc: petsc-***@mcs.anl.gov
Subject: Re: [petsc-users] SNESSetConvergenceTest usage?
Without going into too many details regarding the application, here is a problem I’ve encountered and wonder if anyone has any suggestions.
I have supplied a convergence test function for SNES using the
SNESSetConvergenceTest API. My convergence test function sets the
SNESConvergedReason variable referenced in the argument list to a
handful of SNESConvergedReasons (and does other stuff, but that is not
relevant…)
In my application code, after I call SNESSolve, I call SNESGetConvergedReason, and for some reason I will occasionally see SNESConvergedReasons that are NOT in the subset of those I supply with my convergence test function.
It’s as if my test function setting of the converged reason is either being overwritten, or ignored.
As an example, I’m using the newtonls (default) scheme, and (an inexact, but workable) Jacobian. My test function only will set SNESConvergedReason to SNES_CONVERGED_ITERATING, SNES_CONVERGED_SNORM_RELATIVE or SNES_DIVERGED_MAX_IT. But, I see DIVERGED_LINE_SEARCH from the call to SNESGetConvergedReason.
The line search routines themselves can set the converged reason, when the line search fails, this happens before it has the next solution so before the next time your line search tester is called. So your value is not been overwritten or ignored.

I am not sure what you want to do about this? It is just the way it is.

Barry
Is the line search diverging (most likely?!) and blowing by my
convergence test function?? Maybe (most likely?) I’m doing something
stupid…
Otherwise things are working great. PETSc is awesome!
Any help/suggestions/input is appreciated.
----------------------------------------------------------------------
-
William J. Coirier, Ph.D.
Director, Aerosciences and Engineering Analysis Advanced Technology
Division Kratos/Digital Fusion, Inc.
4904 Research Drive
Huntsville, AL 35805
256-327-8170
256-327-8120 (fax)
----------------------------------------------------------------------
----------------------------------------------
***NOTICE*** This e-mail and/or the attached documents may contain technical data within the definition of the International Traffic in Arms Regulations and/or Export Administration Regulations, and are subject to the export control laws of the U.S. Government. Transfer of this data by any means to a foreign person, whether in the United States or abroad, without an export license or other approval from the U.S. Department of State or Commerce, as applicable, is prohibited. No portion of this e-mail or its attachment(s) may be reproduced without written consent of Kratos Defense & Security Solutions, Inc. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient or believe that you may have received this document in error, please notify the sender and delete this e-mail and any attachments immediately.
--------------------------------------------------------------------------------------------------------------------

***NOTICE*** This e-mail and/or the attached documents may contain technical data within the definition of the International Traffic in Arms Regulations and/or Export Administration Regulations, and are subject to the export control laws of the U.S. Government. Transfer of this data by any means to a foreign person, whether in the United States or abroad, without an export license or other approval from the U.S. Department of State or Commerce, as applicable, is prohibited. No portion of this e-mail or its attachment(s) may be reproduced without written consent of Kratos Defense & Security Solutions, Inc. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient or believe that you may have received this document in error, please notify the sender and delete this e-mail and a
Barry Smith
2015-10-07 22:35:29 UTC
Permalink
Post by William Coirier
Thank you Barry. This explains the behavior.
Maybe I should try a different search strategy? Perhaps newtontr?
You can. But a failed line search is usually an indication of a bad Jacobian or not an accurate enough linear solve. http://www.mcs.anl.gov/petsc/documentation/faq.html#newton has many suggestions on how to debug failed convergence of Newton

Barry
Post by William Coirier
Thanks for your help.
-----------------------------------------------------------------------
William J. Coirier, Ph.D.
Director, Aerosciences and Engineering Analysis
Advanced Technology Division
Kratos/Digital Fusion, Inc.
4904 Research Drive
Huntsville, AL 35805
256-327-8170
256-327-8120 (fax)
-----Original Message-----
Sent: Wednesday, October 07, 2015 5:22 PM
To: William Coirier
Subject: Re: [petsc-users] SNESSetConvergenceTest usage?
Without going into too many details regarding the application, here is a problem I’ve encountered and wonder if anyone has any suggestions.
I have supplied a convergence test function for SNES using the
SNESSetConvergenceTest API. My convergence test function sets the
SNESConvergedReason variable referenced in the argument list to a
handful of SNESConvergedReasons (and does other stuff, but that is not
relevant…)
In my application code, after I call SNESSolve, I call SNESGetConvergedReason, and for some reason I will occasionally see SNESConvergedReasons that are NOT in the subset of those I supply with my convergence test function.
It’s as if my test function setting of the converged reason is either being overwritten, or ignored.
As an example, I’m using the newtonls (default) scheme, and (an inexact, but workable) Jacobian. My test function only will set SNESConvergedReason to SNES_CONVERGED_ITERATING, SNES_CONVERGED_SNORM_RELATIVE or SNES_DIVERGED_MAX_IT. But, I see DIVERGED_LINE_SEARCH from the call to SNESGetConvergedReason.
The line search routines themselves can set the converged reason, when the line search fails, this happens before it has the next solution so before the next time your line search tester is called. So your value is not been overwritten or ignored.
I am not sure what you want to do about this? It is just the way it is.
Barry
Is the line search diverging (most likely?!) and blowing by my
convergence test function?? Maybe (most likely?) I’m doing something
stupid…
Otherwise things are working great. PETSc is awesome!
Any help/suggestions/input is appreciated.
----------------------------------------------------------------------
-
William J. Coirier, Ph.D.
Director, Aerosciences and Engineering Analysis Advanced Technology
Division Kratos/Digital Fusion, Inc.
4904 Research Drive
Huntsville, AL 35805
256-327-8170
256-327-8120 (fax)
----------------------------------------------------------------------
----------------------------------------------
***NOTICE*** This e-mail and/or the attached documents may contain technical data within the definition of the International Traffic in Arms Regulations and/or Export Administration Regulations, and are subject to the export control laws of the U.S. Government. Transfer of this data by any means to a foreign person, whether in the United States or abroad, without an export license or other approval from the U.S. Department of State or Commerce, as applicable, is prohibited. No portion of this e-mail or its attachment(s) may be reproduced without written consent of Kratos Defense & Security Solutions, Inc. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient or believe that you may have received this document in error, please notify the sender and delete this e-mail and any attachments immediately.
--------------------------------------------------------------------------------------------------------------------
***NOTICE*** This e-mail and/or the attached documents may contain technical data within the definition of the International Traffic in Arms Regulations and/or Export Administration Regulations, and are subject to the export control laws of the U.S. Government. Transfer of this data by any means to a foreign person, whether in the United States or abroad, without an export license or other approval from the U.S. Department of State or Commerce, as applicable, is prohibited. No portion of this e-mail or its attachment(s) may be reproduced without written consent of Kratos Defense & Security Solutions, Inc. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient or believe that you may have received this document in error, please notify the sender and delete this e-mail and any attachments immediately.
Loading...