4 #beginMacro updateForAdaptiveGridsMacro()
7 const int regridFrequency = parameters.dbase.get<
int >(
"amrRegridFrequency")>0 ?
8 parameters.dbase.get<
int >(
"amrRegridFrequency") :
9 parameters.dbase.get<Regrid* >(
"regrid")==NULL ? 2 :
10 parameters.dbase.get<Regrid* >(
"regrid")->getRefinementRatio();
12 if( parameters.isAdaptiveGridProblem() && ((globalStepNumber %
regridFrequency) == 0) )
20 printP(
"***** advance: AMR regrid at step %i t=%e dt=%8.2e***** \n",globalStepNumber,t,dt);
21 fPrintF(debugFile,
"***** advance: AMR regrid at step %i t=%e dt=%8.2e***** \n",globalStepNumber,t,dt);
27 fPrintF(debugFile,
"\n ***** advance: AMR regrid at step %i ***** \n\n",globalStepNumber);
32 if( parameters.dbase.get<
bool >(
"twilightZoneFlow") )
34 getErrors( current,t,dt,sPrintF(
" advance: errors before regrid, t=%e \n",t) );
38 fPrintF(debugFile,
" ***advance: before regrid: solution ***\n");
39 outputSolution( gf[current].
u,t );
50 adaptGrids( gf[current], numberToUpdate,&(gf[prev].
u), NULL );
53 cg.reference(gf[current].
cg);
54 gf[prev].cg.reference(gf[current].cg);
55 gf[next].cg.reference(gf[current].cg);
56 gf[next].u.updateToMatchGrid(cg);
59 for(
int n=0;
n<numberOfTimeLevels;
n++ )
63 gf[
n].cg.reference(gf[current].cg);
65 gf[
n].u.updateToMatchGrid(gf[current].cg);
68 gf[
n].u.setOperators(*cgop);
77 (*cgerrp).updateToMatchGrid(cg);
89 outputSolution( gf[current].u,t,
90 sPrintF(
" advance:after adaptGrids, before interpAndApplyBC at t=%11.4e \n",t) );
93 interpolateAndApplyBoundaryConditions( gf[current] );
96 if( numberToUpdate==1 )
98 interpolateAndApplyBoundaryConditions( gf[prev] );
102 parameters.
dbase.get<RealArray>(
"timing")(parameters.
dbase.get<
int>(
"timeForAmrBoundaryConditions"))+=getCPU()-time1;
106 if( parameters.
dbase.get<
bool >(
"twilightZoneFlow") )
108 getErrors( prev ,t-dt,dt,sPrintF(
" advance: errors in prev after regrid, t=%e \n",t-dt) );
109 getErrors( current,t ,dt,sPrintF(
" advance: errors in current after regrid, t=%e \n",t) );
113 fPrintF(debugFile,
" ***after regrid: solution ***\n");
114 outputSolution( gf[current].u,t );
119 parameters.
dbase.get<RealArray>(
"timing")(parameters.
dbase.get<
int>(
"timeForAmrRegrid"))+=getCPU()-timea;