Thanks! On Tue, Jun 2, 2020, 20:51 Zhang, Hong via petsc-users < [email protected]> wrote:
> I checked the results again and can confirm that it is a bug on our side. > A merge request has been created to fix it: > https://gitlab.com/petsc/petsc/-/merge_requests/2830 > > Thanks, > Hong (Mr.) > > On Jun 2, 2020, at 6:26 PM, Salazar De Troya, Miguel < > [email protected]> wrote: > > Hong, > > That is not the correct result, however, we can obtain the correct result > if we comment ts.setThetaEndpoint(True). Why is it so? > > Thanks > Miguel > > *From: *"Zhang, Hong" <[email protected]> > *Date: *Tuesday, June 2, 2020 at 3:31 PM > *To: *"Salazar De Troya, Miguel" <[email protected]> > *Cc: *"[email protected]" <[email protected]> > *Subject: *Re: [petsc-users] TSAdjoint not working correctly when using > TSThetaSetEndpoint(true) > > Miguel, > > After I uncommented ts.setThetaEndpoint(True) and > removed ts.setProblemType(False.ProblemType.LINEAR) in your code, I got the > following result: > > hongzhang@Hongs-MacBook-Pro$ python3 petsc_question_2.py > Cost function > Vec Object: 1 MPI processes > type: seq > 127.781 > Exact value: 127.78112 > > Numerical sensitivity w.r.t. a > 12.778122049945212 > Real sensitivity w.r.t a > 12.7781121978613 > > Numerical sensitivity w.r.t. b > 83.8907580310942 > Real sensitivity w.r.t b > 211.67168296791954 > > -ts_type cn gives the same result. What was the problem you encountered? > > Thanks, > Hong (Mr.) > > > On Jun 2, 2020, at 2:36 PM, Salazar De Troya, Miguel via petsc-users < > [email protected]> wrote: > > Hello, > > I am attaching a simple example that uses TSAdjoint to calculate the > sensitivity of a 1 degree of freedom ODE. When using theta methods, it > returns the right sensitivity as given by the analytical solution. When I > set `ts.setThetaEndpoint(True)`, it does not work. Is there a theoretical > reason why? I was using this option because using the options > > ts.setType(ts.Type.THETA) > ts.setTheta(0.5) > ts.setThetaEndpoint(True) > > is equivalent to using ts.Type.CN > > Thanks > Miguel > > Miguel A. Salazar de Troya > Postdoctoral Researcher, Lawrence Livermore National Laboratory > B141 > Rm: 1085-5 > Ph: 1(925) 422-6411 > <petsc_question_2.py> > > >
