Re: [petsc-users] ARKIMEX produces incorrect values

2020-08-31 Thread Constantinescu, Emil M. via petsc-users
Ed, I agree with you that there is a problem with how the interface is presented and guidelines need to be improved. That's why your feedback is so valuable - and we appreciate it. I created Table 12 (ref below) to make things more clear, but based on your and others feedback is definitely not

Re: [petsc-users] is there a function to append matrix

2020-08-31 Thread Jed Brown
Karl Lin writes: > Thanks for the feedback. What about if I build A to have as many rows as A > and B and then later on use MatGetRow and MatSetValues to add B matrix > entries to A? Can MatGetRow and MatSetValues be used after MatAssembly is > called? B is much much smaller than A so the number

Re: [petsc-users] is there a function to append matrix

2020-08-31 Thread Karl Lin
Thanks for the feedback. What about if I build A to have as many rows as A and B and then later on use MatGetRow and MatSetValues to add B matrix entries to A? Can MatGetRow and MatSetValues be used after MatAssembly is called? B is much much smaller than A so the number of rows can be added to

Re: [petsc-users] is there a function to append matrix

2020-08-31 Thread Jed Brown
Karl Lin writes: > I guess another way to look at this is if I already build matrix A and > MatAssembly has been called. Can I populate more rows to matrix A later on? > With the number of columns and column ownership pattern not changed of > course. Thank you. No.

Re: [petsc-users] is there a function to append matrix

2020-08-31 Thread Karl Lin
I guess another way to look at this is if I already build matrix A and MatAssembly has been called. Can I populate more rows to matrix A later on? With the number of columns and column ownership pattern not changed of course. Thank you. On Mon, Aug 31, 2020 at 10:29 PM Jed Brown wrote: > Karl

Re: [petsc-users] is there a function to append matrix

2020-08-31 Thread Jed Brown
Karl Lin writes: > Thanks for the quick reply. The reason why I want to do this is because I > would like to build A and B separately first. Then do something with B by > itself. Then scale B by a constant. Then append B to A to make C and > continue some other matrix operations. I took a look

Re: [petsc-users] is there a function to append matrix

2020-08-31 Thread Karl Lin
Thanks for the quick reply. The reason why I want to do this is because I would like to build A and B separately first. Then do something with B by itself. Then scale B by a constant. Then append B to A to make C and continue some other matrix operations. I took a look at MatGetLocalSubMatrix()

Re: [petsc-users] is there a function to append matrix

2020-08-31 Thread Jed Brown
Karl Lin writes: > If I have two matrix A and B with the same number of columns, same > distribution pattern (column ownership pattern) among processes but > different number of rows, is there a function to append B to A to make a > new matrix C = [A; B]? Thanks. Sort of; you can create a

[petsc-users] is there a function to append matrix

2020-08-31 Thread Karl Lin
If I have two matrix A and B with the same number of columns, same distribution pattern (column ownership pattern) among processes but different number of rows, is there a function to append B to A to make a new matrix C = [A; B]? Thanks.

Re: [petsc-users] ARKIMEX produces incorrect values

2020-08-31 Thread Ed Bueler
Emil -- When I use PETSc on various tasks, so far, I have separated (1) how I describe the problem structure for use by the PETSc component, and (2) the choice of solver. For TS I am confused about what is expected by the design you describe. I would like to describe my ODE system as clearly as

Re: [petsc-users] ARKIMEX produces incorrect values

2020-08-31 Thread Constantinescu, Emil M. via petsc-users
On 8/31/20 12:17 PM, Ed Bueler wrote: Emil -- Thanks for looking at this. > Hi Ed, can you please add the following > TSSetEquationType(ts,TS_EQ_IMPLICIT); > before calling TSSolve and try again? This is described in Table 12 in the > pdf doc. Yep, that fixes it. After setting the

Re: [petsc-users] DMAdaptLabel with triangle mesh

2020-08-31 Thread Matthew Knepley
On Mon, Aug 31, 2020 at 4:00 PM Thibault Bridel-Bertomeu < thibault.bridelberto...@gmail.com> wrote: > > > Le lun. 31 août 2020 à 20:35, Matthew Knepley a > écrit : > >> On Mon, Aug 31, 2020 at 9:45 AM Thibault Bridel-Bertomeu < >> thibault.bridelberto...@gmail.com> wrote: >> >>> Hi Matt, >>>

Re: [petsc-users] DMAdaptLabel with triangle mesh

2020-08-31 Thread Thibault Bridel-Bertomeu
Le lun. 31 août 2020 à 20:35, Matthew Knepley a écrit : > On Mon, Aug 31, 2020 at 9:45 AM Thibault Bridel-Bertomeu < > thibault.bridelberto...@gmail.com> wrote: > >> Hi Matt, >> >> OK so I tried to replicate the problem starting from one of the tests in >> PETSc repo. >> I found >>

Re: [petsc-users] [Ext] change matrix

2020-08-31 Thread Kun Jiao via petsc-users
thanks for the info. regards, kun On Aug 31, 2020 2:20 PM, Matthew Knepley wrote: On Mon, Aug 31, 2020 at 3:12 PM Barry Smith mailto:bsm...@petsc.dev>> wrote: On Aug 31, 2020, at 2:08 PM, Kun Jiao mailto:kj...@slb.com>> wrote: If I am correct, to do this, it will double the peak memory

Re: [petsc-users] [Ext] change matrix

2020-08-31 Thread Matthew Knepley
On Mon, Aug 31, 2020 at 3:12 PM Barry Smith wrote: > On Aug 31, 2020, at 2:08 PM, Kun Jiao wrote: > > If I am correct, to do this, it will double the peak memory usage. > > > Yes > > > Is there any way no to double the peak memory usage? > > > The only way would be to destroy the old

Re: [petsc-users] [Ext] change matrix

2020-08-31 Thread Barry Smith
> On Aug 31, 2020, at 2:08 PM, Kun Jiao wrote: > > If I am correct, to do this, it will double the peak memory usage. Yes > > Is there any way no to double the peak memory usage? The only way would be to destroy the old matrix, allocate a new one and recompute the entries. Barry

Re: [petsc-users] [Ext] Re: change matrix

2020-08-31 Thread Kun Jiao via petsc-users
If I am correct, to do this, it will double the peak memory usage. Is there any way no to double the peak memory usage? Schlumberger-Private From: Barry Smith Sent: Monday, August 31, 2020 1:56 PM To: Kun Jiao Cc: petsc-users Subject: [Ext] Re: [petsc-users] change matrix Kun, This

Re: [petsc-users] change matrix

2020-08-31 Thread Barry Smith
Kun, This is not possible, PETSc matrices have a static size (resizing in parallel is tricky so we don't support it). If it is more efficient to reuse the matrix entries than recompute them you can create a larger matrix and then loop over the old matrix calling MatGetRow() and then

Re: [petsc-users] change matrix

2020-08-31 Thread Matthew Knepley
On Mon, Aug 31, 2020 at 2:51 PM Kun Jiao via petsc-users < petsc-users@mcs.anl.gov> wrote: > Hi Petsc Experts, > > > > Trying to do something like appending some rows (~100 rows) to an already > created matrix, but could not find any document about it. > > > > Could anyone provide some

Re: [petsc-users] Matrix Free Method questions

2020-08-31 Thread Barry Smith
Sophie, Thanks. The factor of 4 is lot, the 1.5 not so bad. You will definitely want to retain the full matrix assembly codes for speed and to verify a reduced matrix version. It is worth trying a "reduced matrix version" with matrix-free multiply based on these numbers. This

[petsc-users] change matrix

2020-08-31 Thread Kun Jiao via petsc-users
Hi Petsc Experts, Trying to do something like appending some rows (~100 rows) to an already created matrix, but could not find any document about it. Could anyone provide some information about it? Regards, Kun Schlumberger-Private

Re: [petsc-users] DMAdaptLabel with triangle mesh

2020-08-31 Thread Matthew Knepley
On Mon, Aug 31, 2020 at 9:45 AM Thibault Bridel-Bertomeu < thibault.bridelberto...@gmail.com> wrote: > Hi Matt, > > OK so I tried to replicate the problem starting from one of the tests in > PETSc repo. > I found > https://gitlab.com/petsc/petsc/-/blob/master/src/dm/impls/plex/tests/ex20.c >

Re: [petsc-users] Matrix Free Method questions

2020-08-31 Thread Blondel, Sophie via petsc-users
Hi Barry, I ran the 2 cases to look at the effect of the Jacobi pre-conditionner: * 1D with 200 grid points and 7759 DOF per grid point (for the PSI application), for 20 TS: the factor between SOR and Jacobi is ~4 (976 MatMult for SOR and 4162 MatMult for Jacobi) * 2D with 63x63 grid

Re: [petsc-users] EPSMonitorSet

2020-08-31 Thread Fande Kong
Oh, cool. Thanks, Jose, I will try that. Fande, On Mon, Aug 31, 2020 at 11:11 AM Jose E. Roman wrote: > Call EPSMonitorCancel() before EPSMonitorSet(). > Jose > > > > El 31 ago 2020, a las 18:33, Fande Kong escribió: > > > > Hi All, > > > > There is a statement on API EPSMonitorSet: > > > >

Re: [petsc-users] ARKIMEX produces incorrect values

2020-08-31 Thread Barry Smith
Sure, random definitely is better. Seems like worth putting in (at least debug mode) since it will catch nearly all incorrect uses of this functionality. Barry > On Aug 31, 2020, at 10:23 AM, Jed Brown wrote: > > Ed Bueler writes: > > I realize the ARKIMEX page does say

Re: [petsc-users] ARKIMEX produces incorrect values

2020-08-31 Thread Ed Bueler
Emil -- Thanks for looking at this. > Hi Ed, can you please add the following > TSSetEquationType(ts,TS_EQ_IMPLICIT); > before calling TSSolve and try again? This is described in Table 12 in the pdf doc. Yep, that fixes it. After setting the TS_EQ_IMPLICIT flag programmatically I get: $

Re: [petsc-users] EPSMonitorSet

2020-08-31 Thread Jose E. Roman
Call EPSMonitorCancel() before EPSMonitorSet(). Jose > El 31 ago 2020, a las 18:33, Fande Kong escribió: > > Hi All, > > There is a statement on API EPSMonitorSet: > > "Sets an ADDITIONAL function to be called at every iteration to monitor the > error estimates for each requested

[petsc-users] EPSMonitorSet

2020-08-31 Thread Fande Kong
Hi All, There is a statement on API EPSMonitorSet: "Sets an ADDITIONAL function to be called at every iteration to monitor the error estimates for each requested eigenpair." I was wondering how to replace SLEPc EPS monitors instead of adding one? I want to use my monitor only. Thanks, Fande,

Re: [petsc-users] ARKIMEX produces incorrect values

2020-08-31 Thread Jed Brown
Ed Bueler writes: I realize the ARKIMEX page does say "Methods with an explicit stage can only be used with ODE in which the stiff part G(t,X,Xdot) has the form > Xdot + Ghat(t,X)." So my example does not do that. Is there a way for ARKIMEX to detect that dG/d(Xdot) = I? >>

Re: [petsc-users] ARKIMEX produces incorrect values

2020-08-31 Thread Constantinescu, Emil M. via petsc-users
On 8/30/20 6:04 PM, Ed Bueler wrote: Actually, ARKIMEX is not off the hook. It still gets the wrong answer if told the whole thing is implicit: $ ./ex54 -ts_type arkimex -ts_arkimex_fully_implicit# WRONG (AND REALLY SLOW) error norm at tf = 1.00 from 224 steps: |u-u_exact| =

Re: [petsc-users] DMAdaptLabel with triangle mesh

2020-08-31 Thread Thibault Bridel-Bertomeu
Hi Matt, OK so I tried to replicate the problem starting from one of the tests in PETSc repo. I found https://gitlab.com/petsc/petsc/-/blob/master/src/dm/impls/plex/tests/ex20.c that actually uses DMAdaptLabel. Just add { DM

Re: [petsc-users] DMAdaptLabel with triangle mesh

2020-08-31 Thread Matthew Knepley
On Mon, Aug 31, 2020 at 5:34 AM Thibault Bridel-Bertomeu < thibault.bridelberto...@gmail.com> wrote: > Dear all, > > I have recently been playing around with the AMR capabilities embedded in > PETSc for quad meshes using p4est. Based on the TS tutorial ex11, I was > able to incorporate the AMR

[petsc-users] DMAdaptLabel with triangle mesh

2020-08-31 Thread Thibault Bridel-Bertomeu
Dear all, I have recently been playing around with the AMR capabilities embedded in PETSc for quad meshes using p4est. Based on the TS tutorial ex11, I was able to incorporate the AMR into a pre-existing code with different metrics for the adaptation process. Now I would like to do something

Re: [petsc-users] ARKIMEX produces incorrect values

2020-08-31 Thread Ed Bueler
>>> I realize the ARKIMEX page does say "Methods with an explicit stage can >>> only be used with ODE in which the stiff part G(t,X,Xdot) has the form Xdot >>> + Ghat(t,X)." So my example does not do that. Is there a way for >>> ARKIMEX to detect that dG/d(Xdot) = I? > >> Other than sampling its