Re: [petsc-users] dmplex normal vector incorrect for periodic gmsh grids

2022-12-13 Thread Praveen C
Thank you, this MR works if I generate the mesh within the code. But using a mesh made in gmsh, I see the same issue. Thanks praveen > On 14-Dec-2022, at 12:51 AM, Matthew Knepley wrote: > > On Tue, Dec 13, 2022 at 10:57 AM Matthew Knepley > wrote: >> On Tue, Dec

Re: [petsc-users] GAMG and linearized elasticity

2022-12-13 Thread Jed Brown
Do you have slip/symmetry boundary conditions, where some components are constrained? In that case, there is no uniform block size and I think you'll need DMPlexCreateRigidBody() and MatSetNearNullSpace(). The PCSetCoordinates() code won't work for non-constant block size. -pc_type gamg should

[petsc-users] GAMG and linearized elasticity

2022-12-13 Thread Blaise Bourdin
Hi, I am getting close to finish porting a code from petsc 3.3 / sieve to main / dmplex, but am now encountering difficulties I am reasonably sure that the Jacobian and residual are correct. The codes handle boundary conditions differently (MatZeroRowCols vs dmplex constraints) so it

Re: [petsc-users] dmplex normal vector incorrect for periodic gmsh grids

2022-12-13 Thread Matthew Knepley
On Tue, Dec 13, 2022 at 10:57 AM Matthew Knepley wrote: > On Tue, Dec 13, 2022 at 6:11 AM Praveen C wrote: > >> Hello >> >> In the attached test, I read a small grid made in gmsh with periodic bc. >> >> This is a 2d mesh. >> >> The cell numbers are shown in the figure. >> >> All faces have

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

2022-12-13 Thread Guglielmo, Tyler Hardy via petsc-users
Thanks guys, Yes, this looks like exactly what I need. Appreciate everyone’s help! Best, Tyler From: Barry Smith Date: Tuesday, December 13, 2022 at 9:56 AM To: hongzh...@anl.gov Cc: Guglielmo, Tyler Hardy , PETSc users list Subject: Re: [petsc-users] Saving solution with monitor function

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

2022-12-13 Thread Barry Smith
It is also possible to read the solutions back from the trajectory object from your running code. It is not just for saving to files. > On Dec 13, 2022, at 12:51 PM, Zhang, Hong via petsc-users > wrote: > > Tyler, > > The quickest solution is to use TSTrajectory as Matt mentioned. You

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] dmplex normal vector incorrect for periodic gmsh grids

2022-12-13 Thread Matthew Knepley
On Tue, Dec 13, 2022 at 6:11 AM Praveen C wrote: > Hello > > In the attached test, I read a small grid made in gmsh with periodic bc. > > This is a 2d mesh. > > The cell numbers are shown in the figure. > > All faces have length = 2.5 > > But using PetscFVFaceGeom I am getting length of 7.5 for

Re: [petsc-users] parallelize matrix assembly process

2022-12-13 Thread Barry Smith
"MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 73239" The preallocation is VERY wrong. This is why the computation is so slow; this number should be zero. > On Dec 12, 2022, at 10:20 PM, 김성익 wrote: > > Following your comments, > I checked by using '-info'. > > As

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

2022-12-13 Thread Matthew Knepley
On Tue, Dec 13, 2022 at 8:40 AM Guglielmo, Tyler Hardy via petsc-users < petsc-users@mcs.anl.gov> wrote: > Hi all, > > > > I am a new PETSc user (and new to MPI in general), and was wondering if > someone could help me out with what I am sure is a basic question (if this > is not the appropriate

Re: [petsc-users] Seg fault in gdb but program runs

2022-12-13 Thread Matthew Knepley
On Tue, Dec 13, 2022 at 1:52 AM Yuyun Yang wrote: > Ok I’ll check that, thanks for taking a look! By the way, when I reduce > the domain size this error doesn’t appear anymore, so I don’t know whether > gdb just cannot handle the memory, and start to cut things off which is > causing the seg

[petsc-users] Saving solution with monitor function

2022-12-13 Thread Guglielmo, Tyler Hardy via petsc-users
Hi all, I am a new PETSc user (and new to MPI in general), and was wondering if someone could help me out with what I am sure is a basic question (if this is not the appropriate email list or there is a better place please let me know!). Basically, I am writing a code that requires a solution

Re: [petsc-users] Seg fault in gdb but program runs

2022-12-13 Thread Satish Balay via petsc-users
suggest running your code with valgrind Satish On Mon, 12 Dec 2022, Matthew Knepley wrote: > On Mon, Dec 12, 2022 at 9:56 PM Yuyun Yang > wrote: > > > Hello team, > > > > > > > > I’m debugging my code using gdb. The program runs just fine if I don’t > > debug it, but when I use gdb, it seg

Re: [petsc-users] realCoords for DOFs

2022-12-13 Thread Yann Jobic
That a really smart trick ! Thanks for sharing it. I previously looked closeley to the DMProjectFunction without success yet as it has the solution, but yours is just too good. Yann Le 12/13/2022 à 1:52 PM, Mark Adams a écrit : You should be able to use PetscFECreateDefault instead of

Re: [petsc-users] realCoords for DOFs

2022-12-13 Thread Mark Adams
You should be able to use PetscFECreateDefault instead of PetscFECreateLagrange here and set the "order" on the command line, which is recommended, but start with this and low order to debug. Mark static PetscErrorCode crd_func(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt

Re: [petsc-users] Insert one sparse matrix as a block in another

2022-12-13 Thread Peder Jørgensgaard Olesen via petsc-users
Yes, MATNEST seems do to just what I wanted, and extremely fast too. Thanks! For context, I am doing a snapshot POD (like SVD, but less memory intensive) in which I'm building a dense matrix S_pq = u_p^T B u_q for the EVP Sa=λa, where {u_p} and {u_q} are vectors in a particular dataset. The

[petsc-users] dmplex normal vector incorrect for periodic gmsh grids

2022-12-13 Thread Praveen C
HelloIn the attached test, I read a small grid made in gmsh with periodic bc.This is a 2d mesh.The cell numbers are shown in the figure.All faces have length = 2.5But using PetscFVFaceGeom I am getting length of 7.5 for some faces. E.g.,face: 59, centroid = 3.75, 2.50, normal = 0.00,

Re: [petsc-users] realCoords for DOFs

2022-12-13 Thread Yann Jobic
Le 12/13/2022 à 2:04 AM, Mark Adams a écrit : PETSc does not store the coordinates for high order elements (ie, the "midside nodes"). I get them by projecting a f(x) = x, function. Not sure if that is what you want but I can give you a code snippet if there are no better ideas. It could

Re: [petsc-users] realCoords for DOFs

2022-12-13 Thread Yann Jobic
Le 12/13/2022 à 5:43 AM, Matthew Knepley a écrit : On Mon, Dec 12, 2022 at 6:06 PM Yann Jobic > wrote: Hi all, I'm trying to get the coords of the dofs of a DMPlex for a PetscFE discretization, for orders greater than 1. I'm struggling to run