1 #include "../src/snes/impls/fas/fasimpls.h" 2 3 #undef __FUNCT__ 4 #define __FUNCT__ "SNESFASGalerkinDefaultFunction" 5 /* 6 SNESFASGalerkinDefaultFunction 7 8 */ 9 PetscErrorCode SNESFASGalerkinDefaultFunction(SNES snes, Vec X, Vec F, void * ctx) { 10 /* the Galerkin FAS function evalutation is defined as 11 F^l(x^l) = I^l_0F^0(P^0_lx^l) 12 */ 13 SNES fassnes; 14 SNES_FAS * fas; 15 SNES_FAS * prevfas; 16 SNES prevsnes; 17 PetscErrorCode ierr; 18 PetscFunctionBegin; 19 /* prolong to the fine level and evaluate there. */ 20 fassnes = (SNES)ctx; 21 fas = (SNES_FAS *)fassnes->data; 22 prevsnes = fas->previous; 23 prevfas = (SNES_FAS *)prevsnes->data; 24 /* interpolate down the solution */ 25 ierr = MatInterpolate(prevfas->interpolate, X, prevfas->Xg);CHKERRQ(ierr); 26 ierr = SNESComputeFunction(prevsnes, prevfas->Xg, prevfas->Fg);CHKERRQ(ierr); 27 /* restrict up the function */ 28 ierr = MatRestrict(prevfas->restrct, prevfas->Fg, F);CHKERRQ(ierr); 29 PetscFunctionReturn(0); 30 } 31