[petsc-users] How to build compatible MPI matrix for dmplex

2023-06-27 Thread Duan Junming via petsc-users
Dear all, I try to create a compatible sparse MPI matrix A with dmplex global vector x, so I can do matrix-vector multiplication y = A*x. I think I can first get the local and global sizes of x on comm, say n and N, also sizes of y, m, M, then create A by using MatCreate(comm, &A), set the si

Re: [petsc-users] Advice on small block matrix vector multiplication

2023-06-18 Thread Duan Junming via petsc-users
From: knep...@gmail.com Sent: Sunday, June 18, 2023 20:35 To: Duan Junming Cc: petsc-users@mcs.anl.gov Subject: Re: [petsc-users] Advice on small block matrix vector multiplication On Sun, Jun 18, 2023 at 2:13 PM Duan Junming via petsc-users mailto:petsc-users@mcs.anl.gov>> wrote: Dear a

[petsc-users] Advice on small block matrix vector multiplication

2023-06-18 Thread Duan Junming via petsc-users
Dear all, I am using DMPlex to manage the unknowns, two fields, one for pressure, and one for velocities with two/three components, defined in each cell. They're represented by polynomials, with N (10~50) dofs for each component. I have an operator which can be written in a matrix form (N-by-N,

Re: [petsc-users] dm_view of high-order geometry/solution

2023-06-12 Thread Duan Junming via petsc-users
Dear Jed, Thank you for your help! Now I moved the line using "DMViewFromOptions" after the function "PetscDSSetObjective", and it works for "-dm_coord_petscspace_degree 3 -petscspace_degree 3". But when I tried degree 4: ./ex33 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -mesh_transform annu

Re: [petsc-users] dm_view of high-order geometry/solution

2023-06-12 Thread Duan Junming via petsc-users
Dear Jed, Thank you for the suggestion. When I run tests/ex33.c with ./ex33 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -mesh_transform annulus -dm_coord_space 0 -dm_coord_petscspace_degree 3 -dm_refine 1 -dm_view cgns:test.cgns and load it using Paraview, the mesh is still with straight line

Re: [petsc-users] dm_view of high-order geometry/solution

2023-06-12 Thread Duan Junming via petsc-users
:34:24 PM To: Duan Junming Cc: petsc-users@mcs.anl.gov Subject: Re: [petsc-users] dm_view of high-order geometry/solution On Mon, Jun 12, 2023 at 4:13 AM Duan Junming via petsc-users mailto:petsc-users@mcs.anl.gov>> wrote: Dear all, I am playing with dm/impls/plex/tests/ex33.c and know

[petsc-users] dm_view of high-order geometry/solution

2023-06-12 Thread Duan Junming via petsc-users
Dear all, I am playing with dm/impls/plex/tests/ex33.c and know how to set high-order geometry. Is it possible to output the final mesh to vtu, e.g. annulus example? Thanks! Junming

[petsc-users] Gauss-Lobatto-Legendre Element Gradient -- Caught signal number 11 SEGV

2023-05-31 Thread Duan Junming via petsc-users
Dear all, I have a simple demo code attached below, which gives a segmentation violation error. Can you help me with this problem? I think the problem is due to the destroy function. I am using version 3.19.2 with debugging. #include static char help[] = "test.\n"; int main(int argc, char

[petsc-users] About Q3 tensor product Hermite element

2022-10-05 Thread Duan Junming via petsc-users
Dear all, I need to use Q3 tensor product Hermite element in 2D (point value, gradient, and mixed derivative at 4 vertices in a cell as unknowns). Is it available in PETSc FEM module now? I found that only Lagrange element is available. If not, what is the correct path to implement Q3 tensor

[petsc-users] Strange mpi timing and CPU load when -np > 2

2022-09-26 Thread Duan Junming via petsc-users
Dear all, I am using PETSc 3.17.4 on a Linux server, compiling with --download-exodus --download-hdf5 --download-openmpi --download-triangle --with-fc=0 --with-debugging=0 PETSC_ARCH=arch-linux-c-opt COPTFLAGS="-g -O3" CXXOPTFLAGS="-g -O3". The strange thing is when I run my code with mpirun -n

Re: [petsc-users] Adding more dofs to the coordinate DM crashes with either PetscSectionSetDof or PetscSectionFieldDof

2022-07-25 Thread Duan Junming via petsc-users
at 8:46 AM Duan Junming via petsc-users mailto:petsc-users@mcs.anl.gov>> wrote: Dear all, I want to add more dofs to the coordinate DM to represent a curved mesh. I first create a simple box mesh with one cell: PetscCall(DMCreate(comm, &dm)); PetscCall(DMSetType(dm, DMPLEX));

[petsc-users] Adding more dofs to the coordinate DM crashes with either PetscSectionSetDof or PetscSectionFieldDof

2022-07-24 Thread Duan Junming via petsc-users
Dear all, I want to add more dofs to the coordinate DM to represent a curved mesh. I first create a simple box mesh with one cell: PetscCall(DMCreate(comm, &dm)); PetscCall(DMSetType(dm, DMPLEX)); dim = 2; PetscInt n_faces[2] = {1, 1}; DMBoundaryType periodicity[2] = {DM_BOUNDARY_GHO

[petsc-users] Output of periodic DM

2022-04-19 Thread Duan Junming via petsc-users
Dear community, I create a 1D uniform mesh (3 cells) using DMDA with periodic boundary like this: x --- x --- x --- 0 1 2 When I output with HDF5 viewer, the solutions "0, 1, 2" are written to the file. Because I want to do the visualization, I wonder is it possible to write the s