[petsc-users] Many warning in my code

Ivan Luthfi ivanluthfi5 at gmail.com
Tue Jul 16 08:54:25 CDT 2024


Hello guys,
I am still trying to compile my old multigrid code. But i get so many
warning, one of those warning is like this:
MsFEM_poisson2D_DMDA.c: In function ‘int main(int, char**)’:
MsFEM_poisson2D_DMDA.c:185:48: warning: variable ‘finest’ set but not used
[-Wunused-but-set-variable]
  185 |                         PetscInt mg_level = 2, finest;
      |                                                ^~~~~~
MsFEM_poisson2D_DMDA.c:56:44: warning: variable ‘pi’ set but not used
[-Wunused-but-set-variable]
   56 |         PetscScalar             a,b,c,d,dt,pi;
      |                                            ^~
MsFEM_poisson2D_DMDA.c:57:35: warning: variable ‘Lx’ set but not used
[-Wunused-but-set-variable]
   57 |         PetscInt                M,Lx,Ly,Nx,Ny,Mx,My;
      |                                   ^~
MsFEM_poisson2D_DMDA.c:57:38: warning: variable ‘Ly’ set but not used
[-Wunused-but-set-variable]
   57 |         PetscInt                M,Lx,Ly,Nx,Ny,Mx,My;
      |                                      ^~
MsFEM_poisson2D_DMDA.c:58:33: warning: variable ‘hx’ set but not used
[-Wunused-but-set-variable]
   58 |         PetscScalar             hx,hy,Hx,Hy;
      |                                 ^~
MsFEM_poisson2D_DMDA.c:58:36: warning: variable ‘hy’ set but not used
[-Wunused-but-set-variable]
   58 |         PetscScalar             hx,hy,Hx,Hy;
      |                                    ^~
MsFEM_poisson2D_DMDA.c:58:39: warning: variable ‘Hx’ set but not used
[-Wunused-but-set-variable]
   58 |         PetscScalar             hx,hy,Hx,Hy;
      |                                       ^~
MsFEM_poisson2D_DMDA.c:58:42: warning: variable ‘Hy’ set but not used
[-Wunused-but-set-variable]
   58 |         PetscScalar             hx,hy,Hx,Hy;
      |                                          ^~
MsFEM_poisson2D_DMDA.c:60:58: warning: variable ‘Nondimensionalization’ set
but not used [-Wunused-but-set-variable]
   60 |         PetscInt
 Compute_finegridsolution,Nondimensionalization;
      |
 ^~~~~~~~~~~~~~~~~~~~~
MsFEM_poisson2D_DMDA.c:283:54: warning: ‘%d’ directive writing between 1
and 11 bytes into a region of size between 0 and 99


Can you guys help me to fix or solve this warning in order to get the code
run smoothly. Please help


-- 
Best regards,

Ivan Luthfi Ihwani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240716/f4e8abeb/attachment.html>


More information about the petsc-users mailing list