[petsc-users] petsc4py - Convert c example code to Python
Smith, Barry F.
bsmith at mcs.anl.gov
Mon Apr 1 10:36:30 CDT 2019
You are in a very lucky position in terms of debugging because you have a running code you can compare with, take advantage of this fact.
Ok, you're going to have to see when the two codes start diverging from each other. First run with
-ts_monitor -snes_monitor -ksp_monitor
Do the initial values for the monitor match, or do no values match?
Put at VecView in both codes on your initial value for x (the initial conditions for the ODE) are they the same?
Next you should put a VecView() at the end of your IFunction routine and a MatView at the end of your IJacobian routine to make sure they are producing the same values.
Good luck
Barry
> On Apr 1, 2019, at 10:28 AM, Nicola Creati via petsc-users <petsc-users at mcs.anl.gov> wrote:
>
> The Python and C solutions are different. I used the following commands:
>
> Python: python ex13.py -ts_max_step 5 -pc_type lu
>
> C: ./ex13 -ts_max_step 5 -pc_type lu
>
> I attached the two solutions, values and distributions are different.
>
> Thanks.
>
> Nicola
>
> --
>
> Nicola Creati
> Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS www.inogs.it
> Dipartimento di Geofisica della Litosfera Geophysics of Lithosphere Department
> CARS (Cartography and Remote Sensing) Research Group http://www.inogs.it/Cars/
> Borgo Grotta Gigante 42/c 34010 Sgonico - Trieste - ITALY ncreati at ogs.trieste.it
> off. +39 040 2140 213
> fax. +39 040 327307
>
> _____________________________________________________________________
> This communication, that may contain confidential and/or legally privileged information, is intended solely for the use of the intended addressees. Opinions, conclusions and other information contained in this message, that do not relate to the official business of OGS, shall be considered as not given or endorsed by it. Every opinion or advice contained in this communication is subject to the terms and conditions provided by the agreement governing the engagement with such a client. Any use, disclosure, copying or distribution of the contents of this communication by a not-intended recipient or in violation of the purposes of this communication is strictly prohibited and may be unlawful. For Italy only: Ai sensi del D.Lgs.196/2003 - "T.U. sulla Privacy" si precisa che le informazioni contenute in questo messaggio sono riservate ed a uso esclusivo del destinatario.
>
> <python_sol.png><c_sol.png>
More information about the petsc-users
mailing list