Object is in wrong state

Dear members,

I have stumbled upon a Petsc error.
Out of my full mesh, I am trying to solve the heat transfer problem on selected volume numbers defined as reg. Apart from these volume numbers, the rest are not solving for the heat transfer. So T=Tinitial for the unused volume numbers.

While adding the selected volume numbers in int3d(Th1,reg, qfV=qfV1), I am getting a Petsc error:
Object is in wrong state

I think it is due to the fact that I am trying to solve in a selected volume numbers because if I remove this it works perfectly.

How to overcome this error?

I am attaching a test version of my problem in the attachment.
Thanks in advance for your help and time.

https://drive.google.com/drive/folders/1xARiZzE3yTov5bIwE2EXL3UpUVhQKWGn?usp=sharing

Always look at the error message in full please…

[1]PETSC ERROR: Object is in wrong state
[1]PETSC ERROR: Matrix is missing diagonal entry 31

Furthermore, if you look at the trace, you’ll see something like:

[1]PETSC ERROR: #1 MatILUFactorSymbolic_SeqAIJ() at /ccc/work/cont003/rndm/rndm/petsc/src/mat/impls/aij/seq/aijfact.c:1697
[1]PETSC ERROR: #2 MatILUFactorSymbolic() at /ccc/work/cont003/rndm/rndm/petsc/src/mat/interface/matrix.c:6942
[1]PETSC ERROR: #3 PCSetUp_ILU() at /ccc/work/cont003/rndm/rndm/petsc/src/ksp/pc/impls/factor/ilu/ilu.c:144
[1]PETSC ERROR: #4 PCSetUp() at /ccc/work/cont003/rndm/rndm/petsc/src/ksp/pc/interface/precon.c:1016
[1]PETSC ERROR: #5 KSPSetUp() at /ccc/work/cont003/rndm/rndm/petsc/src/ksp/ksp/interface/itfunc.c:406
[1]PETSC ERROR: #6 PCSetUpOnBlocks_BJacobi_Singleblock() at /ccc/work/cont003/rndm/rndm/petsc/src/ksp/pc/impls/bjacobi/bjacobi.c:617
[1]PETSC ERROR: #7 PCSetUpOnBlocks() at /ccc/work/cont003/rndm/rndm/petsc/src/ksp/pc/interface/precon.c:1047
[1]PETSC ERROR: #8 KSPSetUpOnBlocks() at /ccc/work/cont003/rndm/rndm/petsc/src/ksp/ksp/interface/itfunc.c:214
[1]PETSC ERROR: #9 KSPSolve_Private() at /ccc/work/cont003/rndm/rndm/petsc/src/ksp/ksp/interface/itfunc.c:851
[1]PETSC ERROR: #10 KSPSolve() at /ccc/work/cont003/rndm/rndm/petsc/src/ksp/ksp/interface/itfunc.c:1084

You think you are using -pc_type hypre, but in reality your are not, since there is a typo in your sparams, --pc_type-pc_type.
Your problem is singular since you are only integrating on part of the domain. This is unlikely to work, even with -pc_type hypre.

Thanks for the reply.

Is there any solution or suggestion for this problem?

With PETSc, there is almost always a solution, which is almost always in one of the example from the distribution. Please see FreeFem-sources/restriction-2d-PETSc.edp at develop · FreeFem/FreeFem-sources · GitHub. In your case, line 19 should read Ph cond = region == reg;, and then remove the reg inside the integrals.

Are you suggesting by truncating the mesh?
Then I already have one approach with FreeFEM which works beautifully with trunc command.

I am trying a new approach with the region-based integration, despite the presence of the complete mesh. It works good with solve but not when do it with varf.

Why do you need a new approach? Is there a real need for the region-based integration? One way to bypass the problem may be to add a small regularization to make the problem definite, e.g., int3d(Th, !reg)(eps * u * v), with a small eps.

1 Like