[petsc-users] Refinement on TS

Smith, Barry F. bsmith at mcs.anl.gov
Thu Jul 5 12:47:36 CDT 2018


  Is this a memory leak? Please send the entire valgrind message.

   If a memory leak it just means you did not destroy all the vectors that you accessed in the code.

   Barry


> On Jul 5, 2018, at 12:26 PM, Amir <mhbaghaei at mail.sjtu.edu.cn> wrote:
> 
> This is what I get from Valgrind. I think there is a problem in setting TS in the loop. But I am not sure what it really is. Sorry for may be confusing you.
> 
> Amir
> 
> Thread 1: status = VgTs_Runnable (lwpid 23154)
> ==23154== at 0x4C320A6: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==23154== by 0x4FA68E0: PetscMallocAlign (mal.c:42)
> ==23154== by 0x4FA6EEA: PetscMallocA (mal.c:390)
> ==23154== by 0x50FFBAF: VecCreate (veccreate.c:35)
> ==23154== by 0x54E77BB: DMCreateGlobalVector_DA (dadist.c:36)
> ==23154== by 0x5463DDD: DMCreateGlobalVector (dm.c:928)
> ==23154== by 0x54E7613: VecDuplicate_MPI_DA (dadist.c:16)
> ==23154== by 0x50FC014: VecDuplicate (vector.c:375)
> ==23154== by 0x593ED55: SNESSolve (snes.c:4296)
> ==23154== by 0x59D9519: TSStep_Pseudo (posindep.c:151)
> ==23154== by 0x59B8A88: TSStep (ts.c:3548)
> ==23154== by 0x59C383D: TSSolve (ts.c:3731)
> ==23154== by 0x115BEC: main (1d.c:1253)
> 
> On Jul 6 2018, at 1:20 am, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
> 
> 
> When it exits the loop will depend on your criteria for adapativitiy so I have no way of knowing if it is enough, surely you can tighten your criteria so that it requires several refinements in the loop.
> 
> Barry
> 
> 
> On Jul 5, 2018, at 5:38 AM, Amir <mhbaghaei at mail.sjtu.edu.cn> wrote:
> 
> Hello
> Trying to loop over the TSolve() to apply the refinement, I used the below procedure. However, this only goes 1 level of refinement and then it exits. Do you think this is a right algorithm?
> Thanks for your great time.
> Amir
> 
> PetscInt GRID=1;
> for (GRID=1;GRID<GRID_MAX;){
> //
> // FIND THE ADAPTED SOLUTION
> // USING PREVIOUS SOLUTION VECTORS
> //
> //
> // BUILDING THE ADAPTED SOLUTION AND DM
> //
> DMDACreate1d();
> DMSetFromOptions();
> DMSetUp();
> DMCreateGlobalVector();
> //
> // INTERPOLATE FROM COARSE TO REFINE
> //
> // DESTROYING THE FINE TEMPERORAY VECS AND
> // RESETTING THE COARSE VECS WITH REFINED NEW VECS
> //
> //
> // BUILDING TS
> //
> TSCreate();
> TSSetApplicationContext();
> TSSetDM();
> TSSetProblemType(ts,TS_NONLINEAR);
> TSSetType(ts,TSPSEUDO);
> TSSetIFunction();
> TSSetTimeStep();
> //
> TSSolve();
> //
> TSDestroy();
> DMDestroy();
> //
> GRID=GRID+1;
> //
> }//end GRID-loop
> 



More information about the petsc-users mailing list