Hi Matt,

My previous test is terminated after calling subroutine A as shown below.

>> In Subroutine A

      call DMPlexDistribute(dmda_flow%da,stencil_width,                &
                            PETSC_NULL_SF,distributedMesh,ierr)
      CHKERRQ(ierr)

      if (distributedMesh /= PETSC_NULL_DM) then

        call DMDestroy(dmda_flow%da,ierr)
        CHKERRQ(ierr)
        !c set the global mesh as distributed mesh
        dmda_flow%da = distributedMesh

        call DMDestroy(distributedMesh,ierr)

       !If DMDestroy(distributedMesh,ierr) called, then everything is destroyed and there is nothing output with -malloc_test. However, I got error in the next subroutine [0]PETSC ERROR: DMGetCoordinatesLocal() line 5545 in /home/dsu/Soft/PETSc/petsc-dev/src/dm/interface/dm.c Object already free: Parameter # 1

        CHKERRQ(ierr)

     end if

>> In Subroutine B

      !c get local mesh DM and set coordinates

      call DMGetCoordinatesLocal(dmda_flow%da,gc,ierr)
      CHKERRQ(ierr)

      call DMGetCoordinateDM(dmda_flow%da,cda,ierr)
      CHKERRQ(ierr)

Thanks,

Danyang


On 2019-10-10 6:15 p.m., Matthew Knepley wrote:

On Thu, Oct 10, 2019 at 9:00 PM Danyang Su <danyang...@gmail.com <mailto:danyang...@gmail.com>> wrote:

    Labels should be destroyed with the DM. Just make a small code
    that does nothing but distribute the mesh and end. If you
    run with -malloc_test you should see if everythign is destroyed
    properly.

      Thanks,

        Matt

    Attached is the output run with -malloc_test using 2 processor.
    It's a big file. How can I quick check if something is not
    properly destroyed?

Everything output has not been destroyed. It looks like you did not destroy the distributed DM.

  Thanks,

    Matt

    Thanks,

    Danyang

--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>

Reply via email to