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 <[email protected]> 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 > >
