Re: [petsc-users] Question on MatMatmult

2024-05-29 Thread Zhang, Hong via petsc-users
Frank, We do not have support of MatMatMult() for BAIJ*BAIJ matrices. For BAIJ matrix, we only support BAIJ*DENSE. You may have to convert BAIJ to AIJ to use MatMatMult(). Hong From: petsc-users on behalf of Frank Bramkamp Sent: Wednesday, May 29, 2024 9:23

Re: [petsc-users] MatCreateTranspose

2024-04-09 Thread Zhang, Hong via petsc-users
Carl-Johan, You can use MatSolveTranspose() to solve A'*x = b. See petsc/src/ksp/ksp/tutorials/ex79.c `MatCreateTranspose()` is used if you only need a matrix that behaves like the transpose, but don't need the storage to be changed, i.e., A and A' share same matrix storage, thus MatGetRow()

Re: [petsc-users] Does ILU(15) still make sense or should just use LU?

2024-03-28 Thread Zhang, Hong via petsc-users
Ling, MUMPS https://urldefense.us/v3/__https://mumps-solver.org/index.php__;!!G_uCfscf7eWS!ZsKnKahMkux3fTqW0NYBAAuRPfa8VNlYxJ2Hgzncb5usvfOcxUprP3hpnguiSsgrGL0pTveINquoqSfUnAu_MXFg$ , superlu and superlu_dist

Re: [petsc-users] Does ILU(15) still make sense or should just use LU?

2024-03-27 Thread Zhang, Hong via petsc-users
Ling, ILU(level) is used for saving storage space with more computations. Normally, we use level=1 or 2. It does not make sense to use level 15. If you have sufficient space, LU would be the best. Hong From: petsc-users on behalf of Zou, Ling via petsc-users

Re: [petsc-users] 'Preconditioning' with lower-order method

2024-03-04 Thread Zhang, Hong via petsc-users
Ling, Are you using PETSc TS? If so, it may worth trying Crank-Nicolson first to see if the nonlinear solve becomes faster. In addition, you can try to improve the performance by pruning the Jacobian matrix.

Re: [petsc-users] Problem of using PCFactorSetDropTolerance

2024-02-28 Thread Zhang, Hong via petsc-users
Sequential solver superlu ILU supports drop tolerance. For example, petsc/src/ksp/ksp/tutorials/ex2.c: ./ex2 -pc_type ilu -pc_factor_mat_solver_type superlu -help |grep superlu ... -mat_superlu_ilu_droptol: : ILU_DropTol (None) i.e., you can run it as $ ./ex2 -pc_type ilu

Re: [petsc-users] question on PCLSC with matrix blocks of type MATNEST

2024-02-13 Thread Zhang, Hong via petsc-users
Pierre Jolivet Sent: Tuesday, February 13, 2024 2:48 PM To: Zhang, Hong Cc: petsc-users@mcs.anl.gov ; Hana Honnerová Subject: Re: [petsc-users] question on PCLSC with matrix blocks of type MATNEST On 13 Feb 2024, at 9:21 PM, Zhang, Hong via petsc-users wrote: Pierre, I can repeat your

Re: [petsc-users] question on PCLSC with matrix blocks of type MATNEST

2024-02-13 Thread Zhang, Hong via petsc-users
Thanks, Pierre Hong From: Pierre Jolivet Sent: Sunday, February 11, 2024 7:43 AM To: Zhang, Hong Cc: Hana Honnerová ; petsc-users@mcs.anl.gov Subject: Re: [petsc-users] question on PCLSC with matrix blocks of type MATNEST On 8 Feb 2024, at 5:37 PM, Zhang, Hong via petsc-

Re: [petsc-users] question on PCLSC with matrix blocks of type MATNEST

2024-02-12 Thread Zhang, Hong via petsc-users
on PCLSC with matrix blocks of type MATNEST On 8 Feb 2024, at 5:37 PM, Zhang, Hong via petsc-users wrote: Hana, "product AB with A nest, B nest" is not supported by PETSc. I do not know why PETSc does not display such an error message. I'll check it. Did you? A naive fix is to

Re: [petsc-users] question on PCLSC with matrix blocks of type MATNEST

2024-02-08 Thread Zhang, Hong via petsc-users
Hana, "product AB with A nest, B nest" is not supported by PETSc. I do not know why PETSc does not display such an error message. I'll check it. Hong From: petsc-users on behalf of Hana Honnerová Sent: Thursday, February 8, 2024 4:45 AM To:

Re: [petsc-users] MUMPS valgrind error

2023-11-20 Thread Zhang, Hong via petsc-users
Can you provide us a test code that reveals this error? Hong From: petsc-users on behalf of Alexander Lindsay Sent: Monday, November 20, 2023 2:48 PM To: PETSc Subject: [petsc-users] MUMPS valgrind error I recently ran into some parallel crashes and valgrind

Re: [petsc-users] Error using Metis with PETSc installed with MUMPS

2023-11-01 Thread Zhang, Hong via petsc-users
Victoria, "** Maximum transversal (ICNTL(6)) not allowed because matrix is distributed Ordering based on METIS" Try parmetis. Hong From: petsc-users on behalf of Victoria Rolandi Sent: Tuesday, October 31, 2023 10:30 PM To: petsc-users@mcs.anl.gov Subject:

Re: [petsc-users] [EXTERNAL] Re: Unexpected performance losses switching to COO interface

2023-10-06 Thread Zhang, Hong via petsc-users
I noticed that you are using ARKIMEX in the code. A temporary workaround you can try is to disable adaptive time stepping, e.g. by using the option -ts_adapt_type none. Then MatShift() will not be called when the Jacobians are computed. Hong (Mr.) On Oct 5, 2023, at 4:52 PM, Fackler, Philip

Re: [petsc-users] Is precondition works for ill-conditioned jacobian matrix

2023-09-15 Thread Zhang, Hong via petsc-users
Gong, Iterative refinement might help, i.e., more than one MatSolve ( LU x = b) is applied. If you use superlu_dist, this operation can be activated at runtime by the option '-pc_type lu -pc_factor_mat_solver_type superlu_dist -mat_superlu_dist_iterrefine' (run your code withe '-help' for

Re: [petsc-users] Is precondition works for ill-conditioned jacobian matrix

2023-09-14 Thread Zhang, Hong via petsc-users
Gong Ding, When you use a LU solver, the preconditioner M = inv(LU) = inv (J) on theory. I suspect your jacobian evaluation by 64bit might be inaccurate. What LU solver did you use? Run your code with option '-snes_view -snes_monitor -ksp_monitor' and compare the displays. Hong

Re: [petsc-users] PCFIELDSPLIT with MATSBAIJ

2023-08-28 Thread Zhang, Hong via petsc-users
a lower triangular part of entry, it has to jump around searching for that entry (column search instead of row accessing in AIJ), causing overhead for data-accessing. In parallel computation, it leads to extra inter-processor communication. Hong On Sat, Aug 26, 2023 at 6:27 PM Zhang, Hong via petsc

Re: [petsc-users] PCFIELDSPLIT with MATSBAIJ

2023-08-26 Thread Zhang, Hong via petsc-users
I would suggest avoiding using SBAIJ matrices, at least in the phase of application code development. We implemented SBAIJ for saving storage, not computational efficiency. SBAIJ does not have as many support as AIJ. After your code works for AIJ, then you may consider taking advantage of

Re: [petsc-users] Filling non-zero values of a Petsc matrix using numpy arrays with non-zero indices and values (petsc4py)

2023-08-18 Thread Zhang, Hong via petsc-users
You can use this to build a PETSc matrix with the index arrays ai,aj and the value array aa: PETSc.Mat().createAIJ(size=(nrows,ncols), csr=(ai,aj,aa)) Hong (Mr.) > On Aug 17, 2023, at 7:37 AM, Erik Kneller via petsc-users > wrote: > > Hi All, > > I need to fill non-zero values of a

Re: [petsc-users] Python PETSc performance vs scipy ZVODE

2023-08-14 Thread Zhang, Hong via petsc-users
PETSs is not necessarily faster than scipy for your problem when executed in serial. But you get benefits when running in parallel. The PETSc code you wrote uses float64 while your scipy code uses complex128, so the comparison may not be fair. In addition, using the RHS Jacobian does not

Re: [petsc-users] Step size setting in TS

2023-05-09 Thread Zhang, Hong via petsc-users
On May 6, 2023, at 6:24 PM, Jorti, Zakariae via petsc-users wrote: Hello, I have a time-dependent model that I solve using TSSolve. And I am trying to adaptively change the step size (dt). I found that there are some TSAdapt schemes already available. I have tried TSADAPTBASIC and

Re: [petsc-users] question about MatSetLocalToGlobalMapping

2023-04-21 Thread Zhang, Hong via petsc-users
ers, which conduct sequential computation and send KKT matrices to multiple processors, then they show scaling results on matrix computation only. Again, I wish someone can help to improve tao/pdipm. This is a useful solver. We should improve our pdipm. Hong On 20 Apr 2023, at 5:47 PM, Zhang, Hong

Re: [petsc-users] question about MatSetLocalToGlobalMapping

2023-04-20 Thread Zhang, Hong via petsc-users
. Hong On 20 Apr 2023, at 5:47 PM, Zhang, Hong via petsc-users wrote: Karthik, We built a KKT matrix in TaoSNESJacobian_PDIPM() (see petsc/src/tao/constrained/impls/ipm/pdipm.c) which assembles several small matrices into a large KKT matrix in mpiaij format. You could take the same approach

Re: [petsc-users] [petsc-maint] Some questions about matrix multiplication in sell format

2023-03-20 Thread Zhang, Hong via petsc-users
See https://dl.acm.org/doi/10.1145/3225058.3225100 for more information about SELL. The example used in the paper is src/ts/tutorials/advection-diffusion-reaction/ex5adj.c src/mat/tests/bench_spmv.c provides a driver to test SpMV using matrices stored in binary or matrix market format (from

Re: [petsc-users] Installation of SuperLU_MT?

2023-02-21 Thread Zhang, Hong via petsc-users
PETSc does not have support for SuperLU_MT. It only supports superlu (sequential) and superlu_dist. Hong From: petsc-users on behalf of Salman Ahmad Sent: Tuesday, February 21, 2023 8:20 PM To: petsc-users@mcs.anl.gov Subject: [petsc-users] Installation of

Re: [petsc-users] puzzling arkimex logic

2023-01-04 Thread Zhang, Hong via petsc-users
Hi Mark, You might want to try -ts_adapt_time_step_increase_delay to delay increasing the time step after it has been decreased due to a failed solve. Hong (Mr.) > On Jan 2, 2023, at 12:17 PM, Mark Adams wrote: > > I am using arkimex and the logic with a failed KSP solve is puzzling. This >

Re: [petsc-users] Saving solution with monitor function

2022-12-14 Thread Zhang, Hong via petsc-users
It seems that you do not intend to do an offline analysis on the solutions. If the goal is just to get the solutions at each step on the fly, you can probably also try TSSetTimeSpan() and TSGetTimeSpanSolutions(). They can give you an array of solution vectors at the time points you specify

Re: [petsc-users] Saving solution with monitor function

2022-12-13 Thread Zhang, Hong via petsc-users
Tyler, The quickest solution is to use TSTrajectory as Matt mentioned. You can add the following command line options to save the solution into a binary file under a folder at each time step. -ts_save_trajectory -ts_trajectory_type visualization The folder name and the file name can be

Re: [petsc-users] Different solution while running in parallel

2022-11-16 Thread Zhang, Hong via petsc-users
Karhik, Can you find out the condition number of your matrix? Hong From: petsc-users on behalf of Karthikeyan Chockalingam - STFC UKRI via petsc-users Sent: Wednesday, November 16, 2022 6:04 PM To: petsc-users@mcs.anl.gov Subject: [petsc-users] Different

Re: [petsc-users] Doubt about PCILU

2022-11-03 Thread Zhang, Hong via petsc-users
PETSc does not support 'ilutp' . Sequential superlu supports it. You can install petsc with superlu, then use runtime options to activate 'ilutp' , e.g., petsc/src/ksp/ksp/tutorials ./ex2 -ksp_view -pc_type ilu -pc_factor_mat_solver_type superlu -help |grep superlu ...

Re: [petsc-users] Issue with single precision complex numbers in petsc4py

2022-10-13 Thread Zhang, Hong via petsc-users
It seems that you installed petsc4py separately. I would suggest to add the configure option --with-petsc4py=1 and follow the instructions to set PYTHONPATH before using petsc4py. Hong (Mr.) > On Oct 13, 2022, at 10:42 AM, Peng Sun wrote: > > Hi Matt, > > Sure, please see the attached

Re: [petsc-users] Using matrix-free with KSP

2022-09-06 Thread Zhang, Hong via petsc-users
You can refer to the example src/ts/tutorials/advection-diffusion-reaction/ex5adj_mf.c which uses a matrix-free approach for a 2D multi-component reaction-diffusion PDE. In particular, you only need to look at MyIMatMult() and ignore the transposed version which is intended for adjoint

Re: [petsc-users] Preallocating a matrix with the d_nnz and o_nnz arrays

2022-08-22 Thread Zhang, Hong via petsc-users
See https://petsc.org/release/docs/manualpages/Mat/MatMPIAIJSetPreallocation.html#MatMPIAIJSetPreallocation MatMPIAIJSetPreallocation - PETSc MatMPIAIJSetPreallocation Preallocates memory for

Re: [petsc-users] Question about speed of MatMatSolveTranspose with MUMPS

2022-08-04 Thread Zhang, Hong via petsc-users
about speed of MatMatSolveTranspose with MUMPS Hi Hong, The second option, I want to solve A^T X = B. The MatMatSolveTranspose() function in petsc. Lucas From: petsc-users on behalf of Zhang, Hong via petsc-users Sent: Thursday, August 4, 2022 6:02:21 PM To: Junchao Zhang ; Bar

Re: [petsc-users] Question about speed of MatMatSolveTranspose with MUMPS

2022-08-04 Thread Zhang, Hong via petsc-users
Lucas, Solving A X = B^T #MatMatTransposeSolve() -- supported by petsc/mumps interface or A^T X = B #MatTransposeMatSolve() -- not supported which one do you want ? Hong From: petsc-users on behalf of Junchao Zhang Sent: Thursday, August 4, 2022 5:21 PM To:

Re: [petsc-users] Calling Pytorch and Python within PETSc C/C++ code

2022-06-13 Thread Zhang, Hong via petsc-users
No. It is not common to execute Python scripts or libraries from C/C++ code. If you are looking for ways to use PETSc and PyTorch together, it is best to build your application in Python so that you can use both petsc4py and PyTorch. See the following code for an example:

Re: [petsc-users] [EXTERNAL] Question about SuperLU

2022-06-11 Thread Zhang, Hong via petsc-users
If each block is sequential, try replace SuperLU_DIST with SuperLU, which would be more robust. You may also try MUMPS LU. Hong From: petsc-users on behalf of Barry Smith Sent: Saturday, June 11, 2022 9:45 AM To: Jorti, Zakariae Cc: petsc-users@mcs.anl.gov ;

Re: [petsc-users] An internal abort when perform LU decomposition.

2022-05-17 Thread Zhang, Hong via petsc-users
It crashes at /home/z2yang/opt/firedrake-env/firedrake-mini-petsc/src/petsc/default/lib/libpetsc.so.3.016(MatLUFactorNumeric+0x369) [0x7fd520272431] Please run it in debugging mode and get error info. Hong From: petsc-users on behalf of Matthew Knepley Sent:

Re: [petsc-users] TSAdapt minimum step and exact final time

2022-04-20 Thread Zhang, Hong via petsc-users
> On Apr 20, 2022, at 3:58 PM, Phlipot, Greg wrote: > > Hello, > > When using TS with the option TS_EXACT_FINALTIME_MATCHSTEP to force TS > to stop at the final time, I'm seeing the adaptive step controller > choose smaller time steps than the minimum time step that is set with >

Re: [petsc-users] [KSP] solveTranspose fails with Strumpack and SuperLU_dist

2022-04-09 Thread Zhang, Hong via petsc-users
Jean, You can use -ksp_use_explicittranspose to make KSP transpose the system explicitly in the transposed solve. This option was designed to enable more choices of linear solvers and preconditions in adjoint solves, of course, at a cost. Hong (Mr.) On Apr 8, 2022, at 4:52 PM, Jean Marques

Re: [petsc-users] Question about how to solve the DAE step by step using PETSC4PY.

2022-04-05 Thread Zhang, Hong via petsc-users
Hi Jing, Please send your message to the mailing list when reply, so our response time will be fastest and the messages could potentially be helpful to other users. 1. You need to set up the final time step properly with ts.setExactFinalTime(PETSc.TS.ExactFinalTime.MATCHSTEP) or the command

Re: [petsc-users] Question about how to solve the DAE step by step using PETSC4PY.

2022-03-27 Thread Zhang, Hong via petsc-users
On Mar 25, 2022, at 1:14 PM, Xiong, Jing via petsc-users mailto:petsc-users@mcs.anl.gov>> wrote: Good afternoon, Thanks for all your help. I got a question about how to solve the DAE step by step using PETSC4PY. I got two DAE systems, let's say f1(x1, u1) and f2(x2, u2). The simplified

Re: [petsc-users] TSBDF prr-load higher order solution

2022-03-10 Thread Zhang, Hong via petsc-users
> On Mar 10, 2022, at 2:51 PM, Jed Brown wrote: > > Would the order be inferred by the number of vectors in TSBDFSetStepVecs(TS > ts, PetscInt num_steps, const PetscReal *times, const Vec *vecs)? Ah! Yes. num_steps could be used to set bdf->k which is the current order of BDF. Hong (Mr.) >

Re: [petsc-users] TSBDF prr-load higher order solution

2022-03-10 Thread Zhang, Hong via petsc-users
It is clear to me now. You need TSBDFGetStepVecs(TS ts, PetscInt *num_steps, const PetscReal **times, const Vec *vecs) as Jed suggested so that you can access the work vectors for TSBDF. In addition, you need to save the step size and the current order to jumpstart BDF (without starting from

Re: [petsc-users] TSBDF prr-load higher order solution

2022-03-10 Thread Zhang, Hong via petsc-users
On Mar 10, 2022, at 10:05 AM, Alfredo J Duarte Gomez mailto:aduar...@utexas.edu>> wrote: Hello Zhang and Hong, Thank you for your reply. As I described, I simply wanted to be able to restart a higher order BDF from a previous solution. For example, if I want to restart a BDF-2 solution I

Re: [petsc-users] TSBDF prr-load higher order solution

2022-03-09 Thread Zhang, Hong via petsc-users
TSTrajectory supports checkpointing for multistage methods and can certainly be extended to multistep methods. But I doubt it is the best solution to Alfredo’s problem. Alfredo, can you elaborate a bit on what you would like to do? TSBDF_Restart is already using the previous solution to restart

Re: [petsc-users] Control adaptive time step

2022-03-05 Thread Zhang, Hong via petsc-users
You can control the factors with -ts_adapt_clip ,- to set admissible time step decrease and increase factors The default setting uses low=0.1, high=10. https://petsc.org/release/docs/manualpages/TS/TSAdaptSetClip.html#TSAdaptSetClip Hong (Mr.) On Mar 5, 2022, at 12:26 PM, Tang, Qi wrote:

Re: [petsc-users] Missing Function MatSeqAIJGetArray_C

2022-03-02 Thread Zhang, Hong via petsc-users
Ferrand, We do not have support for PtAP with P in aij format and A in dense format yet. MatProductReplaceMats() is used only when a new matrix has the SAME non-zero pattern as the one to be replace, which is not your case. You may do: B = A*P (MatMatMult) C = Pt*B (MatTransposeMatMult) in

Re: [petsc-users] Hessenberg Index-2 DAE and IMEX

2022-02-15 Thread Zhang, Hong via petsc-users
Yes. I am talking about a general usage. To be accurate, direct application of these methods does not always work. There are examples of high-index DAEs for which backward Euler and all multi-step and RK methods fail. You can find one such example in

Re: [petsc-users] Restarting Multistep methods

2022-02-15 Thread Zhang, Hong via petsc-users
ALfredo, If you want PETSc to restart BDF, you can use TSRestartStep(). Hong (Mr.) On Feb 14, 2022, at 12:29 PM, Alfredo J Duarte Gomez mailto:aduar...@utexas.edu>> wrote: Good morning PETSC team, I have been

Re: [petsc-users] Hessenberg Index-2 DAE and IMEX

2022-02-15 Thread Zhang, Hong via petsc-users
Hi Qi, The index-2 DAE cannot be solved directly with ARK or implicit methods such as backward Euler and Crank-Nicolson. You need to convert the system to an index-1 DAE as illustrated in the documentation. Hong (Mr.) On Feb 15, 2022, at 9:43 AM, Tang, Qi mailto:tan...@msu.edu>> wrote: Hi,

Re: [petsc-users] Asking examples about solving DAE in python

2022-01-25 Thread Zhang, Hong via petsc-users
words, the algebraic equations (the last equation in your case) should be satisfied when you choose initial values. Hong > On Jan 25, 2022, at 2:29 PM, Zhang, Hong via petsc-users > wrote: > > The following code should work. > > class Pendulum(object): > n = 5 >

Re: [petsc-users] Asking examples about solving DAE in python

2022-01-25 Thread Zhang, Hong via petsc-users
The following code should work. class Pendulum(object): n = 5 comm = PETSc.COMM_SELF l = 1.0 m = 1.0 g = 1.0 def initialCondition(self, x): # mu = self.mu_ #initial condition theta0= np.pi/3 #starting angle x0=np.sin(theta0)

Re: [petsc-users] Asking examples about solving DAE in python

2022-01-20 Thread Zhang, Hong via petsc-users
On Jan 20, 2022, at 4:13 PM, Xiong, Jing via petsc-users mailto:petsc-users@mcs.anl.gov>> wrote: Hi, I hope you are well. I'm very interested in PETSc and want to explore the possibility of whether it could solve Differential-algebraic equations (DAE) in python. I know there are great

Re: [petsc-users] PETSc MUMPS interface

2022-01-19 Thread Zhang, Hong via petsc-users
Varun, This feature is merged to petsc main https://gitlab.com/petsc/petsc/-/merge_requests/4727 Hong From: petsc-users on behalf of Zhang, Hong via petsc-users Sent: Wednesday, January 19, 2022 9:37 AM To: Varun Hiremath Cc: Peder Jørgensgaard Olesen via petsc

Re: [petsc-users] PETSc MUMPS interface

2022-01-19 Thread Zhang, Hong via petsc-users
Varun, Good to know it works. FactorSymbolic function is still being called twice, but the 2nd call is a no-op, thus it still appears in '-log_view'. I made changes in the low level of mumps routine, not within PCSetUp() because I feel your use case is limited to mumps, not other matrix package

Re: [petsc-users] PETSc MUMPS interface

2022-01-17 Thread Zhang, Hong via petsc-users
Varun, I created a branch hzhang/feature-mumps-mem-estimate, see https://gitlab.com/petsc/petsc/-/merge_requests/4727 You may give it a try and let me know if this is what you want. src/ksp/ksp/tutorials/ex52.c is an example. Hong From: Varun Hiremath Sent:

Re: [petsc-users] PETSc MUMPS interface

2022-01-17 Thread Zhang, Hong via petsc-users
Varun, I am trying to find a way to enable you to switch options after MatLUFactorSymbolic(). A hack is modifying the flag 'mumps->matstruc' inside MatLUFactorSymbolic_AIJMUMPS() and MatFactorNumeric_MUMPS(). My understanding of what you want is: // collect mumps memory info ...

Re: [petsc-users] PETSc MUMPS interface

2022-01-16 Thread Zhang, Hong via petsc-users
Varun, I believe Jose is correct. You may verify it by running your code with option '-log_view', then check the number of calls to MatLUFactorSym. I guess I can add a flag in PCSetUp() to check if user has already called MatLUFactorSymbolic() and wants to skip it. Normally, users simply

Re: [petsc-users] PETSc MUMPS interface

2022-01-12 Thread Zhang, Hong via petsc-users
PCFactorSetMatSolverType(pc,MATSOLVERMUMPS); PCFactorSetUpMatSolverType(pc); PCFactorGetMatrix(pc,); MatLUFactorSymbolic(F,A,...) You must provide row and column permutations etc, petsc/src/mat/tests/ex125.c may give you a clue on how to get these inputs. Hong

Re: [petsc-users] PETSC TS Extrapolation

2021-12-15 Thread Zhang, Hong via petsc-users
On Dec 14, 2021, at 2:18 PM, Alfredo J Duarte Gomez mailto:aduar...@utexas.edu>> wrote: Hello PETSC team, I have some questions about the extrapolation routines used in the TS solvers. I wish to use an extrapolation as the initial guess for the solution at the next time step, which should

Re: [petsc-users] How to use F and G for TS

2021-12-03 Thread Zhang, Hong via petsc-users
On Dec 3, 2021, at 2:52 AM, Pierre Seize mailto:pierre.se...@onera.fr>> wrote: Hello, I want to set a TS object for the time integration of my FV CFD solver. The equation is M dQ/dt = f(Q) where M is a diagonal mass matrix filled with the cell volumes from my FV discretisation. I've read

Re: [petsc-users] Orthogonality of eigenvectors in SLEPC

2021-12-02 Thread Zhang, Hong via petsc-users
Kuang, PETSc supports MatIsHermitian() for SeqAIJ, IS and SeqSBAIJ matrix types. What is your matrix type? We should be able to add this support to other mat types. Hong From: petsc-users on behalf of Wang, Kuang-chung Sent: Thursday, December 2, 2021 2:06 PM

Re: [petsc-users] matrix-vector and matrix-matrix products in PETSc

2021-11-11 Thread Zhang, Hong via petsc-users
"Sparse Matrix-Matrix Products Executed Through Coloring" paper is a sequential algorithm for C=A*B^T. We do not have paper discussing the parallel mat-mat product algorithms used in PETSc. For source code, you may look at MatMatMultSymbolic_MPIAIJ_MPIAIJ() and

Re: [petsc-users] Strange behavior of TS after setting hand-coded Jacobian

2021-11-08 Thread Zhang, Hong via petsc-users
On Nov 8, 2021, at 10:59 PM, Zhang, Hong via petsc-users wrote:  You are essentially solving an index-2 DAE in the form: dx/dt = f(x,y) 0 = g(x) Note that the solvers you have tried, including 'ode15s' and 'ode23' in MATLAB and PETSc TS solvers, are all designed for ODEs or index-1

Re: [petsc-users] Strange behavior of TS after setting hand-coded Jacobian

2021-11-08 Thread Zhang, Hong via petsc-users
You are essentially solving an index-2 DAE in the form: dx/dt = f(x,y) 0 = g(x) Note that the solvers you have tried, including 'ode15s' and 'ode23' in MATLAB and PETSc TS solvers, are all designed for ODEs or index-1 DAEs, and they cannot be used to solve index-2 DAEs directly. In

Re: [petsc-users] Strange behavior of TS after setting hand-coded Jacobian

2021-11-01 Thread Zhang, Hong via petsc-users
You can avoid the zero-diagonal elements in your case. Just remove the boundary points and the \hat{\Lambda}_r from the solution vector Y (eq(17) in your PDE file). You can calculate them separately in your RHS function (when computing the residual vector for 2 <=i<=N-1). It is not necessary to

Re: [petsc-users] Strange behavior of TS after setting hand-coded Jacobian

2021-10-29 Thread Zhang, Hong via petsc-users
One way to avoid the zero element in Jacobian is to exclude the boundary point from the solution vector. I often do this for Dirichlet boundary conditions since the value at the boundary is given directly and does not need to be taken as a degree of freedom. Hong (Mr.) On Oct 28, 2021, at

Re: [petsc-users] Strange behavior of TS after setting hand-coded Jacobian

2021-10-27 Thread Zhang, Hong via petsc-users
Since your Jacobian matrix is small, it is possible to compare your hand-written Jacobian with the finite-difference approximation directly. Add -snes_test_jacobian_view to print out the matrices. Then you can see exactly where the difference is. Hong > On Oct 27, 2021, at 12:47 AM, 仓宇

Re: [petsc-users] FGMRES and BCGS

2021-09-29 Thread Zhang, Hong via petsc-users
See https://doc.comsol.com/5.5/doc/com.comsol.help.comsol/comsol_ref_solver.27.123.html The Iterative Solvers - COMSOL Multiphysics The relaxation factor ω to some extent controls the stability and convergence

Re: [petsc-users] TSBDF info

2021-09-02 Thread Zhang, Hong via petsc-users
On Sep 2, 2021, at 9:24 AM, Alfredo J Duarte Gomez mailto:aduar...@utexas.edu>> wrote: Good morning PETSC team, I am looking to implement a fully implicit BDF-DAE solver and I came across the TSBDF object https://petsc.org/release/src/ts/impls/bdf/bdf.c.html#TSBDF. This seems to be exactly

Re: [petsc-users] [EXTERNAL] Re: Problem with PCFIELDSPLIT

2021-07-14 Thread Zhang, Hong via petsc-users
On Jul 14, 2021, at 10:01 AM, Tang, Qi mailto:tan...@msu.edu>> wrote: Thanks a lot for the explanation, Matt and Stefano. That helps a lot. Just to confirm, the comment in src/ts/impls/implicit/theta/theta.c seems to indicates TS solves U_{n+1} in its SNES/KSP solve, but it actually solves

Re: [petsc-users] Visualization and I/O

2021-06-30 Thread Zhang, Hong via petsc-users
Alfredo, TSTrajectory currently supports binary format only. See https://www.mcs.anl.gov/petsc/petsc-current/src/ts/trajectory/impls/basic/trajbasic.c.html#TSTrajectorySet_Basic

Re: [petsc-users] Collect Trajectories components

2021-05-31 Thread Zhang, Hong via petsc-users
On May 31, 2021, at 3:25 AM, Francesco Brarda mailto:brardafrance...@gmail.com>> wrote: Thank you very much for the insights. I don’t believe I was clear enough in my previous message, I am sorry. The final vector I am trying to build should contain only 1 component of the trajectory (the

Re: [petsc-users] Detecting steady-state with TS

2021-05-01 Thread Zhang, Hong via petsc-users
could also store the norm of the RHS function (since this is equal to the time derivative \frac{\partial \phi}{\partial t}). Miguel From: Mark Adams mailto:mfad...@lbl.gov>> Date: Friday, April 30, 2021 at 3:56 PM To: "Salazar De Troya, Miguel" mailto:salazardet...@llnl.gov>>

Re: [petsc-users] Parallel TS for ODE

2021-04-29 Thread Zhang, Hong via petsc-users
RQ(ierr); ierr = MatView(K,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr); I would very much appreciate any kind of help or advice. Best, Francesco Il giorno 2 apr 2021, alle ore 04:45, Barry Smith mailto:bsm...@petsc.dev>> ha scritto: On Apr 1, 2021, at 9:17 PM, Zhang, Hong via petsc-users

Re: [petsc-users] Rather different matrix product results on multiple processes

2021-04-19 Thread Zhang, Hong via petsc-users
Peder, I tested your code on a linux machine. I got $ ./acorr_mwe Data matrix norm: 5.0538e+01 Autocorrelation matrix norm: 1.0473e+03 mpiexec -n 40 ./acorr_mwe -matmattransmult_mpidense_mpidense_via allgatherv (default) Data matrix norm: 5.0538e+01 Autocorrelation matrix norm: 1.0363e+03

Re: [petsc-users] correction to previous email

2021-04-05 Thread Zhang, Hong via petsc-users
The size you observed is the physical size of the file which is different from the logical size of the file. The difference is usually OS-dependent. In your case, the logical size of the file should be 64 bytes, but the physical size is 4KB on Mac and 12KB on linux. So these numbers make sense.

Re: [petsc-users] correction to previous email

2021-04-05 Thread Zhang, Hong via petsc-users
I just tried to run ex20opt_ic.c (a two-variable ODE) which should be very similar to your problem. The file size is 64 bytes on my laptop. Can you prepare a minimal working example for us to reproduce the issue? Since the size of your ODE is so small, it would be much better to store the

Re: [petsc-users] TSSetEventHandler and TSSetPostEventIntervalStep

2021-04-03 Thread Zhang, Hong via petsc-users
Hi Sophie, TSSetPostEventIntervalStep() was designed to reset the step size after an event interval. For example, suppose there is an event at 0.16, TS may identify it when integrating over a time step from 0.1 to 0.2. After the event, the next step size would be 0.04 to reach the end of this

Re: [petsc-users] Parallel TS for ODE

2021-04-01 Thread Zhang, Hong via petsc-users
> On Mar 31, 2021, at 2:53 AM, Francesco Brarda > wrote: > > Hi everyone! > > I am trying to solve a system of 3 ODEs (a basic SIR model) with TS. > Sequentially works pretty well, but I need to switch it into a parallel > version. > I started working with TS not very long time ago, there

Re: [petsc-users] 64bit indices and revolve compiler warnings

2021-02-23 Thread Zhang, Hong via petsc-users
On Feb 23, 2021, at 5:32 AM, Anton Glazkov mailto:anton.glaz...@chch.ox.ac.uk>> wrote: Good morning, I have been trying to compile PETSc with 64bit indices and revolve. It compiles ok but gives out warnings of the kind: {PETSCDIR PATH

Re: [petsc-users] Error occurred when version change

2020-12-29 Thread Zhang, Hong via petsc-users
Zhaoni, petsc-3.4 - Public Release, May 13, 2013 i.e., it is a version released 7 years ago. Why you have to use such an old version? Hong From: petsc-users on behalf of 朱昭霓 Sent: Tuesday, December

Re: [petsc-users] Calculating adjoint of more than one cost function separately

2020-12-28 Thread Zhang, Hong via petsc-users
On Dec 28, 2020, at 9:31 PM, Salazar De Troya, Miguel mailto:salazardet...@llnl.gov>> wrote: Hello, Thanks for your response, Hong. I see that all cost functionals are evaluated in a single backward run. All gradients, not necessarily the cost functionals. However, I want to do it

Re: [petsc-users] Calculating adjoint of more than one cost function separately

2020-12-28 Thread Zhang, Hong via petsc-users
On Dec 27, 2020, at 5:01 PM, Salazar De Troya, Miguel via petsc-users mailto:petsc-users@mcs.anl.gov>> wrote: Hello, I am interested in calculating the gradients of an optimization problem with one goal and one constraint functions which need TSAdjoint for their adjoints. I’d like to call

Re: [petsc-users] Support for full jacobianP in TSSetIJacobianP

2020-12-22 Thread Zhang, Hong via petsc-users
Miguel, You can now use my branch hongzh/support-parameterized-mass-matrix. It may take a few days or weeks to be merged. Your original script should work out of box with any checkpointing scheme. Nothing needs to be changed. The IJacobianP is simply M_P*U_t. Hong On Dec 22, 2020, at 11:46

Re: [petsc-users] Support for full jacobianP in TSSetIJacobianP

2020-12-21 Thread Zhang, Hong via petsc-users
Thank you for providing the example. This is very helpful. Sorry that I was not accurate about what should be in IJacobianP. With current API, a little hack is needed to get it work. In IJacobianP, we have to provide shift*M_P*dt if we expand the formula in the paper to accommodate parameters

Re: [petsc-users] TSAdjoint multilevel checkpointing running out of memory

2020-12-20 Thread Zhang, Hong via petsc-users
..@gmail.com>> Date: Wednesday, 9 December 2020 at 01:38 To: Zhang, Hong mailto:hongzh...@anl.gov>> Cc: Anton Glazkov mailto:anton.glaz...@chch.ox.ac.uk>>, petsc-users@mcs.anl.gov<mailto:petsc-users@mcs.anl.gov> mailto:petsc-users@mcs.anl.gov>> Subject: Re: [petsc-users] TS

Re: [petsc-users] Support for full jacobianP in TSSetIJacobianP

2020-12-19 Thread Zhang, Hong via petsc-users
On Dec 18, 2020, at 6:35 PM, Salazar De Troya, Miguel mailto:salazardet...@llnl.gov>> wrote: Ok, I was not able to get such case to work in my firedrake-ts implementation. Maybe I am missing something in my code. I looked at the TSAdjoint paper https://arxiv.org/pdf/1912.07696.pdf Equation 2.1

Re: [petsc-users] Support for full jacobianP in TSSetIJacobianP

2020-12-18 Thread Zhang, Hong via petsc-users
The current interface is general and should be applicable to this case as soon as users can provide IJacobianP, which is dF(Udot,U,P,t)/dP. Were you able to generate it in firedrake? If so, could you provide an example that I can test? Thanks, Hong On Dec 18, 2020, at 10:58 AM, Salazar De

Re: [petsc-users] Support for full jacobianP in TSSetIJacobianP

2020-12-17 Thread Zhang, Hong via petsc-users
Hi Miguel, Thank you for the nice work. I do not understand what you propose to do here. What is the obstacle to using current TSSetIJacobianP() for the corner case you mentioned? Are you considering a case in which the mass matrix is parameterized, e.g. M(p) udot - f(t,u) = g(t,u) ? Thanks,

Re: [petsc-users] TSAdjoint multilevel checkpointing running out of memory

2020-12-08 Thread Zhang, Hong via petsc-users
Anton, TSAdjoint should manage checkpointing automatically, and the number of checkpoints in RAM and disk should not exceed the user-specified values. Can you send us the output for -ts_trajectory_monitor in your case? Hong (Mr.) On Dec 8, 2020, at 3:37 PM, Anton Glazkov

Re: [petsc-users] Using MatGetColumnVector() on multiprocess

2020-11-09 Thread Zhang, Hong via petsc-users
Things may go south in your computation made on A. To rule it out, I would check A directly to see if the results are correct for multiple processes. Btw, MatGetColumnVector is efficient only for dense matrices. Why do you need it for sparse matrices? Hong (Mr.) On Nov 9, 2020, at 8:44 AM,

Re: [petsc-users] TSAdjoint and adaptive time stepping

2020-10-28 Thread Zhang, Hong via petsc-users
I think it depends on the functional for which the sensitivities are calculated. For most cases, the objective functional should not be sensitive to the step sizes when a converged solution is achieved. What the adapter does is just to choose a step size so that the solution is accurate within

Re: [petsc-users] superlu_dist segfault

2020-10-28 Thread Zhang, Hong via petsc-users
Marius, I tested your code with petsc-release on my mac laptop using np=2 cores. I first tested a small matrix data file successfully. Then I switch to your data file and run out of memory, likely due to the dense matrices B and X. I got an error "Your system has run out of application memory"

Re: [petsc-users] superlu_dist segfault

2020-10-27 Thread Zhang, Hong via petsc-users
Marius, It fails at the line 1075 in file /home/petsc3.14.release/arch-linux-c-debug/externalpackages/git.superlu_dist/SRC/pzgstrs.c if ( !(lsum = (doublecomplex*)SUPERLU_MALLOC(sizelsum*num_thread * sizeof(doublecomplex ABORT("Malloc fails for lsum[]."); We do not know what it

Re: [petsc-users] change lib names

2020-10-26 Thread Zhang, Hong via petsc-users
Sam, You can build petsc with different PETSC_ARCH under same PETSC_DIR, e.g., define PETSC_ARCH = arch_real or arch_complex to build different petsc libraries. Simply switch to different PETSC_ARCH when you use them. See https://www.mcs.anl.gov/petsc/documentation/installation.html#compilers

Re: [petsc-users] Compute C*Ct using MatCreateTranspose for Ct

2020-09-27 Thread Zhang, Hong via petsc-users
calls y = N*x, PETSc actually does MatMultTranspose with C. I do not think you can uses N to do N*C, which is not supported. -- Hong On 24/09/2020 16:16, Zhang, Hong via petsc-users wrote: Olivier and Matt, MatPtAP with A=I gives Pt*P, not P*Pt. We have sequential MatRARt

Re: [petsc-users] Compute C*Ct using MatCreateTranspose for Ct

2020-09-24 Thread Zhang, Hong via petsc-users
) for mpiaij. Can you use this instead? Hong From: petsc-users on behalf of Zhang, Hong via petsc-users Sent: Thursday, September 24, 2020 8:56 AM To: Matthew Knepley ; Mark Adams Cc: PETSc Subject: Re: [petsc-users] Compute C*Ct using MatCreateTranspose for Ct

Re: [petsc-users] Compute C*Ct using MatCreateTranspose for Ct

2020-09-24 Thread Zhang, Hong via petsc-users
Indeed, we do not have MatCreateTranspose for mpaij matrix. I can adding such support. How soon do you need it? Hong From: petsc-users on behalf of Matthew Knepley Sent: Thursday, September 24, 2020 6:12 AM To: Mark Adams Cc: PETSc Subject: Re: [petsc-users]

Re: [petsc-users] Compute C*Ct using MatCreateTranspose for Ct

2020-09-23 Thread Zhang, Hong via petsc-users
You can use MatMatTransposeMult(). Hong From: petsc-users on behalf of Olivier Jamond Sent: Wednesday, September 23, 2020 11:56 AM To: PETSc Subject: [petsc-users] Compute C*Ct using MatCreateTranspose for Ct Hi all, I have a rectangle MPIAIJ matrix C. I

  1   2   3   >