Re: [petsc-users] Element by element comparison of matrices

2025-01-02 Thread Hammond, Glenn E via petsc-users
I need to element info (which row/col combo) to pinpoint which crossterm may be defective. This is important when debugging analytical derivatives for chemical reactions. I will look into thr SNES approach. Thanks, Glenn On Jan 2, 2025, at 2:25 PM, Barry Smith wrote:  Check twice before you

Re: [petsc-users] Reproducibility when restarting generalized-alpha

2025-01-02 Thread David Kamensky via petsc-users
> > Are you up to trying this by adding this functionality to > TSView_*/TSLoad_*, or should we try to fit in time to add this (needed) > support? I'll have to consult with the team to decide what direction we want to go. We may want to keep our restart data in a neutral format to support other u

[petsc-users] Element by element comparison of matrices

2025-01-02 Thread Hammond, Glenn E via petsc-users
PETSc Users, I want to compare two Jacobians matrices (one with derivatives calculated analytically; the other numerically). I want to apply relatives and/or absolute tolerances. Does anyone know if such capability is built into PETSc? I cannot find anything other the MatEqual() with compares d

Re: [petsc-users] Element by element comparison of matrices

2025-01-02 Thread Stefano Zampini
MatAXPY for the difference, MatNorm for the relative error On Thu, Jan 2, 2025, 22:32 Hammond, Glenn E via petsc-users < petsc-users@mcs.anl.gov> wrote: > PETSc Users, > > > > I want to compare two Jacobians matrices (one with derivatives calculated > analytically; the other numerically). I want

Re: [petsc-users] Reproducibility when restarting generalized-alpha

2025-01-02 Thread Barry Smith
David, I think Stefano was saying the TSView/Load approach should be improved to save the additional vector(s) and use them in the restart. Are you up to trying this by adding this functionality to TSView_*/TSLoad_*, or should we try to fit in time to add this (needed) support?

Re: [petsc-users] Reproducibility when restarting generalized-alpha

2025-01-02 Thread Barry Smith
Sure, I was suggesting you might implement it for your one-needed TSView_*/TSLoad_*. With a single template done we can easily add the rest. I agree having an API to start with multiple solutions is a good idea and would be needed for any TSView_*/TSLoad_*. so that may be the simplest way f

Re: [petsc-users] Element by element comparison of matrices

2025-01-02 Thread Barry Smith
> -snes_test_jacobian -snes_test_jacobian_view > On Jan 2, 2025, at 5:34 PM, Hammond, Glenn E wrote: > > I need to element info (which row/col combo) to pinpoint which crossterm may > be defective. This is important when debugging analytical derivatives for > chemical reactions. I will look

Re: [petsc-users] Element by element comparison of matrices

2025-01-02 Thread Barry Smith
We also have support for this built into SNES. For example, you provide the analytic to SNES which then compute via differencing, mostly to check if the analytic implementation was correct. You can run an entire set of SNESSolve with this turned on and it will check at all vectors the Jacobi

[petsc-users] Reproducibility when restarting generalized-alpha

2025-01-02 Thread David Kamensky via petsc-users
Hi, I've recently been helping some co-workers with restarting PETSc time integrators from saved solution data. It looks like the only supported path for restarting the generalized-alpha integrator for 2nd-order-in-time systems (`TSALPHA2`) is to follow the same procedure as initialization, in wh

Re: [petsc-users] Reproducibility when restarting generalized-alpha

2025-01-02 Thread Stefano Zampini
Note that BDF has the same issue. I think the correct way to handle this is to support storing/loading these extra vectors via TSView()/TSLoad(). How are you currently restarting the simulation? Il giorno gio 2 gen 2025 alle ore 19:25 David Kamensky via petsc-users < petsc-users@mcs.anl.gov> ha sc

Re: [petsc-users] Reproducibility when restarting generalized-alpha

2025-01-02 Thread David Kamensky via petsc-users
> > How are you currently restarting the simulation? I just reviewed the code, and we're not currently using the `TSView/Load` functions. We're just manually (de)serializing displacement, velocity, and acceleration data using a neutral format, populating PETSc `Vec`s with this data, and associat