Actual source code: ex56.c
1: static char help[] = "3D, tri-linear quadrilateral (Q1), displacement finite element formulation\n\
2: of linear elasticity. E=1.0, nu=0.25.\n\
3: Unit square domain with Dirichelet boundary condition on the y=0 side only.\n\
4: Load of 1.0 in x + 2y direction on all nodes (not a true uniform load).\n\
5: -ne <size> : number of (square) quadrilateral elements in each dimension\n\
6: -alpha <v> : scaling of material coefficient in embedded circle\n\n";
8: #include <petscksp.h>
10: static PetscBool log_stages = PETSC_TRUE;
11: static PetscErrorCode MaybeLogStagePush(PetscLogStage stage) { return log_stages ? PetscLogStagePush(stage) : 0; }
12: static PetscErrorCode MaybeLogStagePop() { return log_stages ? PetscLogStagePop() : 0; }
13: PetscErrorCode elem_3d_elast_v_25(PetscScalar *);
15: int main(int argc,char **args)
16: {
17: Mat Amat;
19: PetscInt m,nn,M,Istart,Iend,i,j,k,ii,jj,kk,ic,ne=4,id;
20: PetscReal x,y,z,h,*coords,soft_alpha=1.e-3;
21: PetscBool two_solves=PETSC_FALSE,test_nonzero_cols=PETSC_FALSE,use_nearnullspace=PETSC_FALSE,test_late_bs=PETSC_FALSE;
22: Vec xx,bb;
23: KSP ksp;
24: MPI_Comm comm;
25: PetscMPIInt npe,mype;
26: PetscScalar DD[24][24],DD2[24][24];
27: PetscLogStage stage[6];
28: PetscScalar DD1[24][24];
30: PetscInitialize(&argc,&args,(char*)0,help);
31: comm = PETSC_COMM_WORLD;
32: MPI_Comm_rank(comm, &mype);
33: MPI_Comm_size(comm, &npe);
35: PetscOptionsBegin(comm,NULL,"3D bilinear Q1 elasticity options","");
36: {
37: char nestring[256];
38: PetscSNPrintf(nestring,sizeof nestring,"number of elements in each direction, ne+1 must be a multiple of %D (sizes^{1/3})",(PetscInt)(PetscPowReal((PetscReal)npe,1./3.) + .5));
39: PetscOptionsInt("-ne",nestring,"",ne,&ne,NULL);
40: PetscOptionsBool("-log_stages","Log stages of solve separately","",log_stages,&log_stages,NULL);
41: PetscOptionsReal("-alpha","material coefficient inside circle","",soft_alpha,&soft_alpha,NULL);
42: PetscOptionsBool("-two_solves","solve additional variant of the problem","",two_solves,&two_solves,NULL);
43: PetscOptionsBool("-test_nonzero_cols","nonzero test","",test_nonzero_cols,&test_nonzero_cols,NULL);
44: PetscOptionsBool("-use_mat_nearnullspace","MatNearNullSpace API test","",use_nearnullspace,&use_nearnullspace,NULL);
45: PetscOptionsBool("-test_late_bs","","",test_late_bs,&test_late_bs,NULL);
46: }
47: PetscOptionsEnd();
49: if (log_stages) {
50: PetscLogStageRegister("Setup", &stage[0]);
51: PetscLogStageRegister("Solve", &stage[1]);
52: PetscLogStageRegister("2nd Setup", &stage[2]);
53: PetscLogStageRegister("2nd Solve", &stage[3]);
54: PetscLogStageRegister("3rd Setup", &stage[4]);
55: PetscLogStageRegister("3rd Solve", &stage[5]);
56: } else {
57: for (i=0; i<(PetscInt)(sizeof(stage)/sizeof(stage[0])); i++) stage[i] = -1;
58: }
60: h = 1./ne; nn = ne+1;
61: /* ne*ne; number of global elements */
62: M = 3*nn*nn*nn; /* global number of equations */
63: if (npe==2) {
64: if (mype==1) m=0;
65: else m = nn*nn*nn;
66: npe = 1;
67: } else {
68: m = nn*nn*nn/npe;
69: if (mype==npe-1) m = nn*nn*nn - (npe-1)*m;
70: }
71: m *= 3; /* number of equations local*/
72: /* Setup solver */
73: KSPCreate(PETSC_COMM_WORLD,&ksp);
74: KSPSetComputeSingularValues(ksp, PETSC_TRUE);
75: KSPSetFromOptions(ksp);
76: {
77: /* configuration */
78: const PetscInt NP = (PetscInt)(PetscPowReal((PetscReal)npe,1./3.) + .5);
79: const PetscInt ipx = mype%NP, ipy = (mype%(NP*NP))/NP, ipz = mype/(NP*NP);
80: const PetscInt Ni0 = ipx*(nn/NP), Nj0 = ipy*(nn/NP), Nk0 = ipz*(nn/NP);
81: const PetscInt Ni1 = Ni0 + (m>0 ? (nn/NP) : 0), Nj1 = Nj0 + (nn/NP), Nk1 = Nk0 + (nn/NP);
82: const PetscInt NN = nn/NP, id0 = ipz*nn*nn*NN + ipy*nn*NN*NN + ipx*NN*NN*NN;
83: PetscInt *d_nnz, *o_nnz,osz[4]={0,9,15,19},nbc;
84: PetscScalar vv[24], v2[24];
88: /* count nnz */
89: PetscMalloc1(m+1, &d_nnz);
90: PetscMalloc1(m+1, &o_nnz);
91: for (i=Ni0,ic=0; i<Ni1; i++) {
92: for (j=Nj0; j<Nj1; j++) {
93: for (k=Nk0; k<Nk1; k++) {
94: nbc = 0;
95: if (i==Ni0 || i==Ni1-1) nbc++;
96: if (j==Nj0 || j==Nj1-1) nbc++;
97: if (k==Nk0 || k==Nk1-1) nbc++;
98: for (jj=0; jj<3; jj++,ic++) {
99: d_nnz[ic] = 3*(27-osz[nbc]);
100: o_nnz[ic] = 3*osz[nbc];
101: }
102: }
103: }
104: }
107: /* create stiffness matrix */
108: MatCreate(comm,&Amat);
109: MatSetSizes(Amat,m,m,M,M);
110: if (!test_late_bs) {
111: MatSetBlockSize(Amat,3);
112: }
113: MatSetType(Amat,MATAIJ);
114: MatSetOption(Amat,MAT_SPD,PETSC_TRUE);
115: MatSetFromOptions(Amat);
116: MatSeqAIJSetPreallocation(Amat,0,d_nnz);
117: MatMPIAIJSetPreallocation(Amat,0,d_nnz,0,o_nnz);
119: PetscFree(d_nnz);
120: PetscFree(o_nnz);
121: MatCreateVecs(Amat,&bb,&xx);
123: MatGetOwnershipRange(Amat,&Istart,&Iend);
126: /* generate element matrices */
127: {
128: PetscBool hasData = PETSC_TRUE;
129: if (!hasData) {
130: PetscPrintf(PETSC_COMM_WORLD,"\t No data is provided\n");
131: for (i=0; i<24; i++) {
132: for (j=0; j<24; j++) {
133: if (i==j) DD1[i][j] = 1.0;
134: else DD1[i][j] = -.25;
135: }
136: }
137: } else {
138: /* Get array data */
139: elem_3d_elast_v_25((PetscScalar*)DD1);
140: }
142: /* BC version of element */
143: for (i=0; i<24; i++) {
144: for (j=0; j<24; j++) {
145: if (i<12 || (j < 12 && !test_nonzero_cols)) {
146: if (i==j) DD2[i][j] = 0.1*DD1[i][j];
147: else DD2[i][j] = 0.0;
148: } else DD2[i][j] = DD1[i][j];
149: }
150: }
151: /* element residual/load vector */
152: for (i=0; i<24; i++) {
153: if (i%3==0) vv[i] = h*h;
154: else if (i%3==1) vv[i] = 2.0*h*h;
155: else vv[i] = .0;
156: }
157: for (i=0; i<24; i++) {
158: if (i%3==0 && i>=12) v2[i] = h*h;
159: else if (i%3==1 && i>=12) v2[i] = 2.0*h*h;
160: else v2[i] = .0;
161: }
162: }
164: PetscMalloc1(m+1, &coords);
165: coords[m] = -99.0;
167: /* forms the element stiffness and coordinates */
168: for (i=Ni0,ic=0,ii=0; i<Ni1; i++,ii++) {
169: for (j=Nj0,jj=0; j<Nj1; j++,jj++) {
170: for (k=Nk0,kk=0; k<Nk1; k++,kk++,ic++) {
171: /* coords */
172: x = coords[3*ic] = h*(PetscReal)i;
173: y = coords[3*ic+1] = h*(PetscReal)j;
174: z = coords[3*ic+2] = h*(PetscReal)k;
175: /* matrix */
176: id = id0 + ii + NN*jj + NN*NN*kk;
177: if (i<ne && j<ne && k<ne) {
178: /* radius */
179: PetscReal radius = PetscSqrtReal((x-.5+h/2)*(x-.5+h/2)+(y-.5+h/2)*(y-.5+h/2)+(z-.5+h/2)*(z-.5+h/2));
180: PetscReal alpha = 1.0;
181: PetscInt jx,ix,idx[8],idx3[24];
182: idx[0] = id;
183: idx[1] = id+1;
184: idx[2] = id+NN+1;
185: idx[3] = id+NN;
186: idx[4] = id + NN*NN;
187: idx[5] = id+1 + NN*NN;
188: idx[6] = id+NN+1 + NN*NN;
189: idx[7] = id+NN + NN*NN;
191: /* correct indices */
192: if (i==Ni1-1 && Ni1!=nn) {
193: idx[1] += NN*(NN*NN-1);
194: idx[2] += NN*(NN*NN-1);
195: idx[5] += NN*(NN*NN-1);
196: idx[6] += NN*(NN*NN-1);
197: }
198: if (j==Nj1-1 && Nj1!=nn) {
199: idx[2] += NN*NN*(nn-1);
200: idx[3] += NN*NN*(nn-1);
201: idx[6] += NN*NN*(nn-1);
202: idx[7] += NN*NN*(nn-1);
203: }
204: if (k==Nk1-1 && Nk1!=nn) {
205: idx[4] += NN*(nn*nn-NN*NN);
206: idx[5] += NN*(nn*nn-NN*NN);
207: idx[6] += NN*(nn*nn-NN*NN);
208: idx[7] += NN*(nn*nn-NN*NN);
209: }
211: if (radius < 0.25) alpha = soft_alpha;
213: for (ix=0; ix<24; ix++) {
214: for (jx=0;jx<24;jx++) DD[ix][jx] = alpha*DD1[ix][jx];
215: }
216: if (k>0) {
217: if (!test_late_bs) {
218: MatSetValuesBlocked(Amat,8,idx,8,idx,(const PetscScalar*)DD,ADD_VALUES);
219: VecSetValuesBlocked(bb,8,idx,(const PetscScalar*)vv,ADD_VALUES);
220: } else {
221: for (ix=0; ix<8; ix++) { idx3[3*ix] = 3*idx[ix]; idx3[3*ix+1] = 3*idx[ix]+1; idx3[3*ix+2] = 3*idx[ix]+2; }
222: MatSetValues(Amat,24,idx3,24,idx3,(const PetscScalar*)DD,ADD_VALUES);
223: VecSetValues(bb,24,idx3,(const PetscScalar*)vv,ADD_VALUES);
224: }
225: } else {
226: /* a BC */
227: for (ix=0;ix<24;ix++) {
228: for (jx=0;jx<24;jx++) DD[ix][jx] = alpha*DD2[ix][jx];
229: }
230: if (!test_late_bs) {
231: MatSetValuesBlocked(Amat,8,idx,8,idx,(const PetscScalar*)DD,ADD_VALUES);
232: VecSetValuesBlocked(bb,8,idx,(const PetscScalar*)v2,ADD_VALUES);
233: } else {
234: for (ix=0; ix<8; ix++) { idx3[3*ix] = 3*idx[ix]; idx3[3*ix+1] = 3*idx[ix]+1; idx3[3*ix+2] = 3*idx[ix]+2; }
235: MatSetValues(Amat,24,idx3,24,idx3,(const PetscScalar*)DD,ADD_VALUES);
236: VecSetValues(bb,24,idx3,(const PetscScalar*)v2,ADD_VALUES);
237: }
238: }
239: }
240: }
241: }
243: }
244: MatAssemblyBegin(Amat,MAT_FINAL_ASSEMBLY);
245: MatAssemblyEnd(Amat,MAT_FINAL_ASSEMBLY);
246: VecAssemblyBegin(bb);
247: VecAssemblyEnd(bb);
248: }
249: MatAssemblyBegin(Amat,MAT_FINAL_ASSEMBLY);
250: MatAssemblyEnd(Amat,MAT_FINAL_ASSEMBLY);
251: VecAssemblyBegin(bb);
252: VecAssemblyEnd(bb);
253: if (test_late_bs) {
254: VecSetBlockSize(xx,3);
255: VecSetBlockSize(bb,3);
256: MatSetBlockSize(Amat,3);
257: }
259: if (!PETSC_TRUE) {
260: PetscViewer viewer;
261: PetscViewerASCIIOpen(comm, "Amat.m", &viewer);
262: PetscViewerPushFormat(viewer, PETSC_VIEWER_ASCII_MATLAB);
263: MatView(Amat,viewer);
264: PetscViewerPopFormat(viewer);
265: PetscViewerDestroy(&viewer);
266: }
268: /* finish KSP/PC setup */
269: KSPSetOperators(ksp, Amat, Amat);
270: if (use_nearnullspace) {
271: MatNullSpace matnull;
272: Vec vec_coords;
273: PetscScalar *c;
275: VecCreate(MPI_COMM_WORLD,&vec_coords);
276: VecSetBlockSize(vec_coords,3);
277: VecSetSizes(vec_coords,m,PETSC_DECIDE);
278: VecSetUp(vec_coords);
279: VecGetArray(vec_coords,&c);
280: for (i=0; i<m; i++) c[i] = coords[i]; /* Copy since Scalar type might be Complex */
281: VecRestoreArray(vec_coords,&c);
282: MatNullSpaceCreateRigidBody(vec_coords,&matnull);
283: MatSetNearNullSpace(Amat,matnull);
284: MatNullSpaceDestroy(&matnull);
285: VecDestroy(&vec_coords);
286: } else {
287: PC pc;
288: KSPGetPC(ksp,&pc);
289: PCSetCoordinates(pc, 3, m/3, coords);
290: }
292: MaybeLogStagePush(stage[0]);
294: /* PC setup basically */
295: KSPSetUp(ksp);
297: MaybeLogStagePop();
298: MaybeLogStagePush(stage[1]);
300: /* test BCs */
301: if (test_nonzero_cols) {
302: VecZeroEntries(xx);
303: if (mype==0) VecSetValue(xx,0,1.0,INSERT_VALUES);
304: VecAssemblyBegin(xx);
305: VecAssemblyEnd(xx);
306: KSPSetInitialGuessNonzero(ksp,PETSC_TRUE);
307: }
309: /* 1st solve */
310: KSPSolve(ksp, bb, xx);
312: MaybeLogStagePop();
314: /* 2nd solve */
315: if (two_solves) {
316: PetscReal emax, emin;
317: PetscReal norm,norm2;
318: Vec res;
320: MaybeLogStagePush(stage[2]);
321: /* PC setup basically */
322: MatScale(Amat, 100000.0);
323: KSPSetOperators(ksp, Amat, Amat);
324: KSPSetUp(ksp);
326: MaybeLogStagePop();
327: MaybeLogStagePush(stage[3]);
328: KSPSolve(ksp, bb, xx);
329: KSPComputeExtremeSingularValues(ksp, &emax, &emin);
331: MaybeLogStagePop();
332: MaybeLogStagePush(stage[4]);
334: MaybeLogStagePop();
335: MaybeLogStagePush(stage[5]);
337: /* 3rd solve */
338: KSPSolve(ksp, bb, xx);
340: MaybeLogStagePop();
342: VecNorm(bb, NORM_2, &norm2);
344: VecDuplicate(xx, &res);
345: MatMult(Amat, xx, res);
346: VecAXPY(bb, -1.0, res);
347: VecDestroy(&res);
348: VecNorm(bb, NORM_2, &norm);
349: PetscPrintf(PETSC_COMM_WORLD,"[%d]%s |b-Ax|/|b|=%e, |b|=%e, emax=%e\n",0,PETSC_FUNCTION_NAME,(double)(norm/norm2),(double)norm2,(double)emax);
350: }
352: /* Free work space */
353: KSPDestroy(&ksp);
354: VecDestroy(&xx);
355: VecDestroy(&bb);
356: MatDestroy(&Amat);
357: PetscFree(coords);
359: PetscFinalize();
360: return 0;
361: }
363: /* Data was previously provided in the file data/elem_3d_elast_v_25.tx */
364: PetscErrorCode elem_3d_elast_v_25(PetscScalar *dd)
365: {
366: PetscScalar DD[] = {
367: 0.18981481481481474 ,
368: 5.27777777777777568E-002,
369: 5.27777777777777568E-002,
370: -5.64814814814814659E-002,
371: -1.38888888888889072E-002,
372: -1.38888888888889089E-002,
373: -8.24074074074073876E-002,
374: -5.27777777777777429E-002,
375: 1.38888888888888725E-002,
376: 4.90740740740740339E-002,
377: 1.38888888888889124E-002,
378: 4.72222222222222071E-002,
379: 4.90740740740740339E-002,
380: 4.72222222222221932E-002,
381: 1.38888888888888968E-002,
382: -8.24074074074073876E-002,
383: 1.38888888888888673E-002,
384: -5.27777777777777429E-002,
385: -7.87037037037036785E-002,
386: -4.72222222222221932E-002,
387: -4.72222222222222071E-002,
388: 1.20370370370370180E-002,
389: -1.38888888888888742E-002,
390: -1.38888888888888829E-002,
391: 5.27777777777777568E-002,
392: 0.18981481481481474 ,
393: 5.27777777777777568E-002,
394: 1.38888888888889124E-002,
395: 4.90740740740740269E-002,
396: 4.72222222222221932E-002,
397: -5.27777777777777637E-002,
398: -8.24074074074073876E-002,
399: 1.38888888888888725E-002,
400: -1.38888888888889037E-002,
401: -5.64814814814814728E-002,
402: -1.38888888888888985E-002,
403: 4.72222222222221932E-002,
404: 4.90740740740740478E-002,
405: 1.38888888888888968E-002,
406: -1.38888888888888673E-002,
407: 1.20370370370370058E-002,
408: -1.38888888888888742E-002,
409: -4.72222222222221932E-002,
410: -7.87037037037036785E-002,
411: -4.72222222222222002E-002,
412: 1.38888888888888742E-002,
413: -8.24074074074073598E-002,
414: -5.27777777777777568E-002,
415: 5.27777777777777568E-002,
416: 5.27777777777777568E-002,
417: 0.18981481481481474 ,
418: 1.38888888888889055E-002,
419: 4.72222222222222002E-002,
420: 4.90740740740740269E-002,
421: -1.38888888888888829E-002,
422: -1.38888888888888829E-002,
423: 1.20370370370370180E-002,
424: 4.72222222222222002E-002,
425: 1.38888888888888985E-002,
426: 4.90740740740740339E-002,
427: -1.38888888888888985E-002,
428: -1.38888888888888968E-002,
429: -5.64814814814814520E-002,
430: -5.27777777777777568E-002,
431: 1.38888888888888777E-002,
432: -8.24074074074073876E-002,
433: -4.72222222222222002E-002,
434: -4.72222222222221932E-002,
435: -7.87037037037036646E-002,
436: 1.38888888888888794E-002,
437: -5.27777777777777568E-002,
438: -8.24074074074073598E-002,
439: -5.64814814814814659E-002,
440: 1.38888888888889124E-002,
441: 1.38888888888889055E-002,
442: 0.18981481481481474 ,
443: -5.27777777777777568E-002,
444: -5.27777777777777499E-002,
445: 4.90740740740740269E-002,
446: -1.38888888888889072E-002,
447: -4.72222222222221932E-002,
448: -8.24074074074073876E-002,
449: 5.27777777777777568E-002,
450: -1.38888888888888812E-002,
451: -8.24074074074073876E-002,
452: -1.38888888888888742E-002,
453: 5.27777777777777499E-002,
454: 4.90740740740740269E-002,
455: -4.72222222222221863E-002,
456: -1.38888888888889089E-002,
457: 1.20370370370370162E-002,
458: 1.38888888888888673E-002,
459: 1.38888888888888742E-002,
460: -7.87037037037036785E-002,
461: 4.72222222222222002E-002,
462: 4.72222222222222071E-002,
463: -1.38888888888889072E-002,
464: 4.90740740740740269E-002,
465: 4.72222222222222002E-002,
466: -5.27777777777777568E-002,
467: 0.18981481481481480 ,
468: 5.27777777777777568E-002,
469: 1.38888888888889020E-002,
470: -5.64814814814814728E-002,
471: -1.38888888888888951E-002,
472: 5.27777777777777637E-002,
473: -8.24074074074073876E-002,
474: 1.38888888888888881E-002,
475: 1.38888888888888742E-002,
476: 1.20370370370370232E-002,
477: -1.38888888888888812E-002,
478: -4.72222222222221863E-002,
479: 4.90740740740740339E-002,
480: 1.38888888888888933E-002,
481: -1.38888888888888812E-002,
482: -8.24074074074073876E-002,
483: -5.27777777777777568E-002,
484: 4.72222222222222071E-002,
485: -7.87037037037036924E-002,
486: -4.72222222222222140E-002,
487: -1.38888888888889089E-002,
488: 4.72222222222221932E-002,
489: 4.90740740740740269E-002,
490: -5.27777777777777499E-002,
491: 5.27777777777777568E-002,
492: 0.18981481481481477 ,
493: -4.72222222222222071E-002,
494: 1.38888888888888968E-002,
495: 4.90740740740740131E-002,
496: 1.38888888888888812E-002,
497: -1.38888888888888708E-002,
498: 1.20370370370370267E-002,
499: 5.27777777777777568E-002,
500: 1.38888888888888812E-002,
501: -8.24074074074073876E-002,
502: 1.38888888888889124E-002,
503: -1.38888888888889055E-002,
504: -5.64814814814814589E-002,
505: -1.38888888888888812E-002,
506: -5.27777777777777568E-002,
507: -8.24074074074073737E-002,
508: 4.72222222222222002E-002,
509: -4.72222222222222002E-002,
510: -7.87037037037036924E-002,
511: -8.24074074074073876E-002,
512: -5.27777777777777637E-002,
513: -1.38888888888888829E-002,
514: 4.90740740740740269E-002,
515: 1.38888888888889020E-002,
516: -4.72222222222222071E-002,
517: 0.18981481481481480 ,
518: 5.27777777777777637E-002,
519: -5.27777777777777637E-002,
520: -5.64814814814814728E-002,
521: -1.38888888888889037E-002,
522: 1.38888888888888951E-002,
523: -7.87037037037036785E-002,
524: -4.72222222222222002E-002,
525: 4.72222222222221932E-002,
526: 1.20370370370370128E-002,
527: -1.38888888888888725E-002,
528: 1.38888888888888812E-002,
529: 4.90740740740740408E-002,
530: 4.72222222222222002E-002,
531: -1.38888888888888951E-002,
532: -8.24074074074073876E-002,
533: 1.38888888888888812E-002,
534: 5.27777777777777637E-002,
535: -5.27777777777777429E-002,
536: -8.24074074074073876E-002,
537: -1.38888888888888829E-002,
538: -1.38888888888889072E-002,
539: -5.64814814814814728E-002,
540: 1.38888888888888968E-002,
541: 5.27777777777777637E-002,
542: 0.18981481481481480 ,
543: -5.27777777777777568E-002,
544: 1.38888888888888916E-002,
545: 4.90740740740740339E-002,
546: -4.72222222222222210E-002,
547: -4.72222222222221932E-002,
548: -7.87037037037036924E-002,
549: 4.72222222222222002E-002,
550: 1.38888888888888742E-002,
551: -8.24074074074073876E-002,
552: 5.27777777777777429E-002,
553: 4.72222222222222002E-002,
554: 4.90740740740740269E-002,
555: -1.38888888888888951E-002,
556: -1.38888888888888846E-002,
557: 1.20370370370370267E-002,
558: 1.38888888888888916E-002,
559: 1.38888888888888725E-002,
560: 1.38888888888888725E-002,
561: 1.20370370370370180E-002,
562: -4.72222222222221932E-002,
563: -1.38888888888888951E-002,
564: 4.90740740740740131E-002,
565: -5.27777777777777637E-002,
566: -5.27777777777777568E-002,
567: 0.18981481481481480 ,
568: -1.38888888888888968E-002,
569: -4.72222222222221932E-002,
570: 4.90740740740740339E-002,
571: 4.72222222222221932E-002,
572: 4.72222222222222071E-002,
573: -7.87037037037036646E-002,
574: -1.38888888888888742E-002,
575: 5.27777777777777499E-002,
576: -8.24074074074073737E-002,
577: 1.38888888888888933E-002,
578: 1.38888888888889020E-002,
579: -5.64814814814814589E-002,
580: 5.27777777777777568E-002,
581: -1.38888888888888794E-002,
582: -8.24074074074073876E-002,
583: 4.90740740740740339E-002,
584: -1.38888888888889037E-002,
585: 4.72222222222222002E-002,
586: -8.24074074074073876E-002,
587: 5.27777777777777637E-002,
588: 1.38888888888888812E-002,
589: -5.64814814814814728E-002,
590: 1.38888888888888916E-002,
591: -1.38888888888888968E-002,
592: 0.18981481481481480 ,
593: -5.27777777777777499E-002,
594: 5.27777777777777707E-002,
595: 1.20370370370370180E-002,
596: 1.38888888888888812E-002,
597: -1.38888888888888812E-002,
598: -7.87037037037036785E-002,
599: 4.72222222222222002E-002,
600: -4.72222222222222071E-002,
601: -8.24074074074073876E-002,
602: -1.38888888888888742E-002,
603: -5.27777777777777568E-002,
604: 4.90740740740740616E-002,
605: -4.72222222222222002E-002,
606: 1.38888888888888846E-002,
607: 1.38888888888889124E-002,
608: -5.64814814814814728E-002,
609: 1.38888888888888985E-002,
610: 5.27777777777777568E-002,
611: -8.24074074074073876E-002,
612: -1.38888888888888708E-002,
613: -1.38888888888889037E-002,
614: 4.90740740740740339E-002,
615: -4.72222222222221932E-002,
616: -5.27777777777777499E-002,
617: 0.18981481481481480 ,
618: -5.27777777777777568E-002,
619: -1.38888888888888673E-002,
620: -8.24074074074073598E-002,
621: 5.27777777777777429E-002,
622: 4.72222222222222002E-002,
623: -7.87037037037036785E-002,
624: 4.72222222222222002E-002,
625: 1.38888888888888708E-002,
626: 1.20370370370370128E-002,
627: 1.38888888888888760E-002,
628: -4.72222222222222002E-002,
629: 4.90740740740740478E-002,
630: -1.38888888888888951E-002,
631: 4.72222222222222071E-002,
632: -1.38888888888888985E-002,
633: 4.90740740740740339E-002,
634: -1.38888888888888812E-002,
635: 1.38888888888888881E-002,
636: 1.20370370370370267E-002,
637: 1.38888888888888951E-002,
638: -4.72222222222222210E-002,
639: 4.90740740740740339E-002,
640: 5.27777777777777707E-002,
641: -5.27777777777777568E-002,
642: 0.18981481481481477 ,
643: 1.38888888888888829E-002,
644: 5.27777777777777707E-002,
645: -8.24074074074073598E-002,
646: -4.72222222222222140E-002,
647: 4.72222222222222140E-002,
648: -7.87037037037036646E-002,
649: -5.27777777777777707E-002,
650: -1.38888888888888829E-002,
651: -8.24074074074073876E-002,
652: -1.38888888888888881E-002,
653: 1.38888888888888881E-002,
654: -5.64814814814814589E-002,
655: 4.90740740740740339E-002,
656: 4.72222222222221932E-002,
657: -1.38888888888888985E-002,
658: -8.24074074074073876E-002,
659: 1.38888888888888742E-002,
660: 5.27777777777777568E-002,
661: -7.87037037037036785E-002,
662: -4.72222222222221932E-002,
663: 4.72222222222221932E-002,
664: 1.20370370370370180E-002,
665: -1.38888888888888673E-002,
666: 1.38888888888888829E-002,
667: 0.18981481481481469 ,
668: 5.27777777777777429E-002,
669: -5.27777777777777429E-002,
670: -5.64814814814814659E-002,
671: -1.38888888888889055E-002,
672: 1.38888888888889055E-002,
673: -8.24074074074074153E-002,
674: -5.27777777777777429E-002,
675: -1.38888888888888760E-002,
676: 4.90740740740740408E-002,
677: 1.38888888888888968E-002,
678: -4.72222222222222071E-002,
679: 4.72222222222221932E-002,
680: 4.90740740740740478E-002,
681: -1.38888888888888968E-002,
682: -1.38888888888888742E-002,
683: 1.20370370370370232E-002,
684: 1.38888888888888812E-002,
685: -4.72222222222222002E-002,
686: -7.87037037037036924E-002,
687: 4.72222222222222071E-002,
688: 1.38888888888888812E-002,
689: -8.24074074074073598E-002,
690: 5.27777777777777707E-002,
691: 5.27777777777777429E-002,
692: 0.18981481481481477 ,
693: -5.27777777777777499E-002,
694: 1.38888888888889107E-002,
695: 4.90740740740740478E-002,
696: -4.72222222222221932E-002,
697: -5.27777777777777568E-002,
698: -8.24074074074074153E-002,
699: -1.38888888888888812E-002,
700: -1.38888888888888846E-002,
701: -5.64814814814814659E-002,
702: 1.38888888888888812E-002,
703: 1.38888888888888968E-002,
704: 1.38888888888888968E-002,
705: -5.64814814814814520E-002,
706: 5.27777777777777499E-002,
707: -1.38888888888888812E-002,
708: -8.24074074074073876E-002,
709: 4.72222222222221932E-002,
710: 4.72222222222222002E-002,
711: -7.87037037037036646E-002,
712: -1.38888888888888812E-002,
713: 5.27777777777777429E-002,
714: -8.24074074074073598E-002,
715: -5.27777777777777429E-002,
716: -5.27777777777777499E-002,
717: 0.18981481481481474 ,
718: -1.38888888888888985E-002,
719: -4.72222222222221863E-002,
720: 4.90740740740740339E-002,
721: 1.38888888888888829E-002,
722: 1.38888888888888777E-002,
723: 1.20370370370370249E-002,
724: -4.72222222222222002E-002,
725: -1.38888888888888933E-002,
726: 4.90740740740740339E-002,
727: -8.24074074074073876E-002,
728: -1.38888888888888673E-002,
729: -5.27777777777777568E-002,
730: 4.90740740740740269E-002,
731: -4.72222222222221863E-002,
732: 1.38888888888889124E-002,
733: 1.20370370370370128E-002,
734: 1.38888888888888742E-002,
735: -1.38888888888888742E-002,
736: -7.87037037037036785E-002,
737: 4.72222222222222002E-002,
738: -4.72222222222222140E-002,
739: -5.64814814814814659E-002,
740: 1.38888888888889107E-002,
741: -1.38888888888888985E-002,
742: 0.18981481481481474 ,
743: -5.27777777777777499E-002,
744: 5.27777777777777499E-002,
745: 4.90740740740740339E-002,
746: -1.38888888888889055E-002,
747: 4.72222222222221932E-002,
748: -8.24074074074074153E-002,
749: 5.27777777777777499E-002,
750: 1.38888888888888829E-002,
751: 1.38888888888888673E-002,
752: 1.20370370370370058E-002,
753: 1.38888888888888777E-002,
754: -4.72222222222221863E-002,
755: 4.90740740740740339E-002,
756: -1.38888888888889055E-002,
757: -1.38888888888888725E-002,
758: -8.24074074074073876E-002,
759: 5.27777777777777499E-002,
760: 4.72222222222222002E-002,
761: -7.87037037037036785E-002,
762: 4.72222222222222140E-002,
763: -1.38888888888889055E-002,
764: 4.90740740740740478E-002,
765: -4.72222222222221863E-002,
766: -5.27777777777777499E-002,
767: 0.18981481481481469 ,
768: -5.27777777777777499E-002,
769: 1.38888888888889072E-002,
770: -5.64814814814814659E-002,
771: 1.38888888888889003E-002,
772: 5.27777777777777429E-002,
773: -8.24074074074074153E-002,
774: -1.38888888888888812E-002,
775: -5.27777777777777429E-002,
776: -1.38888888888888742E-002,
777: -8.24074074074073876E-002,
778: -1.38888888888889089E-002,
779: 1.38888888888888933E-002,
780: -5.64814814814814589E-002,
781: 1.38888888888888812E-002,
782: 5.27777777777777429E-002,
783: -8.24074074074073737E-002,
784: -4.72222222222222071E-002,
785: 4.72222222222222002E-002,
786: -7.87037037037036646E-002,
787: 1.38888888888889055E-002,
788: -4.72222222222221932E-002,
789: 4.90740740740740339E-002,
790: 5.27777777777777499E-002,
791: -5.27777777777777499E-002,
792: 0.18981481481481474 ,
793: 4.72222222222222002E-002,
794: -1.38888888888888985E-002,
795: 4.90740740740740339E-002,
796: -1.38888888888888846E-002,
797: 1.38888888888888812E-002,
798: 1.20370370370370284E-002,
799: -7.87037037037036785E-002,
800: -4.72222222222221932E-002,
801: -4.72222222222222002E-002,
802: 1.20370370370370162E-002,
803: -1.38888888888888812E-002,
804: -1.38888888888888812E-002,
805: 4.90740740740740408E-002,
806: 4.72222222222222002E-002,
807: 1.38888888888888933E-002,
808: -8.24074074074073876E-002,
809: 1.38888888888888708E-002,
810: -5.27777777777777707E-002,
811: -8.24074074074074153E-002,
812: -5.27777777777777568E-002,
813: 1.38888888888888829E-002,
814: 4.90740740740740339E-002,
815: 1.38888888888889072E-002,
816: 4.72222222222222002E-002,
817: 0.18981481481481477 ,
818: 5.27777777777777429E-002,
819: 5.27777777777777568E-002,
820: -5.64814814814814659E-002,
821: -1.38888888888888846E-002,
822: -1.38888888888888881E-002,
823: -4.72222222222221932E-002,
824: -7.87037037037036785E-002,
825: -4.72222222222221932E-002,
826: 1.38888888888888673E-002,
827: -8.24074074074073876E-002,
828: -5.27777777777777568E-002,
829: 4.72222222222222002E-002,
830: 4.90740740740740269E-002,
831: 1.38888888888889020E-002,
832: -1.38888888888888742E-002,
833: 1.20370370370370128E-002,
834: -1.38888888888888829E-002,
835: -5.27777777777777429E-002,
836: -8.24074074074074153E-002,
837: 1.38888888888888777E-002,
838: -1.38888888888889055E-002,
839: -5.64814814814814659E-002,
840: -1.38888888888888985E-002,
841: 5.27777777777777429E-002,
842: 0.18981481481481469 ,
843: 5.27777777777777429E-002,
844: 1.38888888888888933E-002,
845: 4.90740740740740339E-002,
846: 4.72222222222222071E-002,
847: -4.72222222222222071E-002,
848: -4.72222222222222002E-002,
849: -7.87037037037036646E-002,
850: 1.38888888888888742E-002,
851: -5.27777777777777568E-002,
852: -8.24074074074073737E-002,
853: -1.38888888888888951E-002,
854: -1.38888888888888951E-002,
855: -5.64814814814814589E-002,
856: -5.27777777777777568E-002,
857: 1.38888888888888760E-002,
858: -8.24074074074073876E-002,
859: -1.38888888888888760E-002,
860: -1.38888888888888812E-002,
861: 1.20370370370370249E-002,
862: 4.72222222222221932E-002,
863: 1.38888888888889003E-002,
864: 4.90740740740740339E-002,
865: 5.27777777777777568E-002,
866: 5.27777777777777429E-002,
867: 0.18981481481481474 ,
868: 1.38888888888888933E-002,
869: 4.72222222222222071E-002,
870: 4.90740740740740339E-002,
871: 1.20370370370370180E-002,
872: 1.38888888888888742E-002,
873: 1.38888888888888794E-002,
874: -7.87037037037036785E-002,
875: 4.72222222222222071E-002,
876: 4.72222222222222002E-002,
877: -8.24074074074073876E-002,
878: -1.38888888888888846E-002,
879: 5.27777777777777568E-002,
880: 4.90740740740740616E-002,
881: -4.72222222222222002E-002,
882: -1.38888888888888881E-002,
883: 4.90740740740740408E-002,
884: -1.38888888888888846E-002,
885: -4.72222222222222002E-002,
886: -8.24074074074074153E-002,
887: 5.27777777777777429E-002,
888: -1.38888888888888846E-002,
889: -5.64814814814814659E-002,
890: 1.38888888888888933E-002,
891: 1.38888888888888933E-002,
892: 0.18981481481481477 ,
893: -5.27777777777777568E-002,
894: -5.27777777777777637E-002,
895: -1.38888888888888742E-002,
896: -8.24074074074073598E-002,
897: -5.27777777777777568E-002,
898: 4.72222222222222002E-002,
899: -7.87037037037036924E-002,
900: -4.72222222222222002E-002,
901: 1.38888888888888812E-002,
902: 1.20370370370370267E-002,
903: -1.38888888888888794E-002,
904: -4.72222222222222002E-002,
905: 4.90740740740740478E-002,
906: 1.38888888888888881E-002,
907: 1.38888888888888968E-002,
908: -5.64814814814814659E-002,
909: -1.38888888888888933E-002,
910: 5.27777777777777499E-002,
911: -8.24074074074074153E-002,
912: 1.38888888888888812E-002,
913: -1.38888888888888846E-002,
914: 4.90740740740740339E-002,
915: 4.72222222222222071E-002,
916: -5.27777777777777568E-002,
917: 0.18981481481481477 ,
918: 5.27777777777777637E-002,
919: -1.38888888888888829E-002,
920: -5.27777777777777568E-002,
921: -8.24074074074073598E-002,
922: 4.72222222222222071E-002,
923: -4.72222222222222140E-002,
924: -7.87037037037036924E-002,
925: 5.27777777777777637E-002,
926: 1.38888888888888916E-002,
927: -8.24074074074073876E-002,
928: 1.38888888888888846E-002,
929: -1.38888888888888951E-002,
930: -5.64814814814814589E-002,
931: -4.72222222222222071E-002,
932: 1.38888888888888812E-002,
933: 4.90740740740740339E-002,
934: 1.38888888888888829E-002,
935: -1.38888888888888812E-002,
936: 1.20370370370370284E-002,
937: -1.38888888888888881E-002,
938: 4.72222222222222071E-002,
939: 4.90740740740740339E-002,
940: -5.27777777777777637E-002,
941: 5.27777777777777637E-002,
942: 0.18981481481481477 ,
943: };
946: PetscArraycpy(dd,DD,576);
947: return 0;
948: }
950: /*TEST
952: test:
953: nsize: 8
954: args: -ne 13 -alpha 1.e-3 -ksp_type cg -pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true -two_solves -ksp_converged_reason -use_mat_nearnullspace -ksp_view -pc_gamg_square_graph 1 -mg_levels_ksp_max_it 1 -mg_levels_ksp_type chebyshev -mg_levels_ksp_chebyshev_esteig 0,0.2,0,1.05 -pc_gamg_esteig_ksp_max_it 10 -pc_gamg_asm_use_agg true -mg_levels_sub_pc_type lu -mg_levels_pc_asm_overlap 0 -pc_gamg_threshold -0.01 -pc_gamg_coarse_eq_limit 200 -pc_gamg_process_eq_limit 30 -pc_gamg_repartition false -pc_mg_cycle_type v -pc_gamg_use_parallel_coarse_grid_solver -mg_coarse_pc_type jacobi -mg_coarse_ksp_type cg -ksp_monitor_short -pc_gamg_rank_reduction_factors 2,2
955: filter: grep -v variant
957: test:
958: suffix: 2
959: nsize: 8
960: args: -ne 31 -alpha 1.e-3 -ksp_type cg -pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true -two_solves -ksp_converged_reason -use_mat_nearnullspace -pc_gamg_square_graph 1 -mg_levels_ksp_max_it 1 -mg_levels_ksp_type chebyshev -mg_levels_ksp_chebyshev_esteig 0,0.2,0,1.05 -pc_gamg_esteig_ksp_max_it 10 -pc_gamg_asm_use_agg true -mg_levels_sub_pc_type lu -mg_levels_pc_asm_overlap 0 -pc_gamg_threshold -0.01 -pc_gamg_coarse_eq_limit 200 -pc_gamg_process_eq_limit 30 -pc_gamg_repartition false -pc_mg_cycle_type v -pc_gamg_use_parallel_coarse_grid_solver -mg_coarse_pc_type jacobi -mg_coarse_ksp_type cg
961: filter: grep -v variant
963: test:
964: suffix: latebs
965: filter: grep -v variant
966: nsize: 8
967: args: -test_late_bs 0 -ne 9 -alpha 1.e-3 -ksp_type cg -pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true -two_solves -ksp_converged_reason -ksp_view -use_mat_nearnullspace -pc_gamg_square_graph 1 -mg_levels_ksp_max_it 1 -mg_levels_ksp_type chebyshev -mg_levels_ksp_chebyshev_esteig 0,0.2,0,1.05 -pc_gamg_esteig_ksp_max_it 10 -pc_gamg_asm_use_agg true -mg_levels_sub_pc_type lu -mg_levels_pc_asm_overlap 0 -pc_gamg_threshold -0.01 -pc_gamg_coarse_eq_limit 200 -pc_gamg_process_eq_limit 30 -pc_gamg_repartition false -pc_mg_cycle_type v -pc_gamg_use_parallel_coarse_grid_solver -mg_coarse_pc_type jacobi -mg_coarse_ksp_type cg -ksp_monitor_short -ksp_view
969: test:
970: suffix: latebs-2
971: filter: grep -v variant
972: nsize: 8
973: args: -test_late_bs -ne 9 -alpha 1.e-3 -ksp_type cg -pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true -two_solves -ksp_converged_reason -ksp_view -use_mat_nearnullspace -pc_gamg_square_graph 1 -mg_levels_ksp_max_it 1 -mg_levels_ksp_type chebyshev -mg_levels_ksp_chebyshev_esteig 0,0.2,0,1.05 -pc_gamg_esteig_ksp_max_it 10 -pc_gamg_asm_use_agg true -mg_levels_sub_pc_type lu -mg_levels_pc_asm_overlap 0 -pc_gamg_threshold -0.01 -pc_gamg_coarse_eq_limit 200 -pc_gamg_process_eq_limit 30 -pc_gamg_repartition false -pc_mg_cycle_type v -pc_gamg_use_parallel_coarse_grid_solver -mg_coarse_pc_type jacobi -mg_coarse_ksp_type cg -ksp_monitor_short -ksp_view
975: test:
976: suffix: ml
977: nsize: 8
978: args: -ne 9 -alpha 1.e-3 -ksp_type cg -pc_type ml -mg_levels_ksp_type chebyshev -mg_levels_ksp_chebyshev_esteig 0,0.05,0,1.05 -mg_levels_pc_type sor -ksp_monitor_short
979: requires: ml
981: test:
982: suffix: nns
983: args: -ne 9 -alpha 1.e-3 -ksp_converged_reason -ksp_type cg -ksp_max_it 50 -pc_type gamg -pc_gamg_esteig_ksp_type cg -pc_gamg_esteig_ksp_max_it 10 -pc_gamg_type agg -pc_gamg_agg_nsmooths 1 -pc_gamg_coarse_eq_limit 1000 -mg_levels_ksp_type chebyshev -mg_levels_pc_type sor -pc_gamg_reuse_interpolation true -two_solves -use_mat_nearnullspace -pc_gamg_use_sa_esteig 0 -mg_levels_esteig_ksp_max_it 10
985: test:
986: suffix: nns_telescope
987: nsize: 2
988: args: -use_mat_nearnullspace -ksp_monitor_short -pc_type telescope -pc_telescope_reduction_factor 2 -telescope_pc_type gamg -telescope_pc_gamg_esteig_ksp_type cg -telescope_pc_gamg_esteig_ksp_max_it 10
990: test:
991: suffix: seqaijmkl
992: nsize: 8
993: requires: mkl_sparse
994: args: -ne 9 -alpha 1.e-3 -ksp_type cg -pc_type gamg -pc_gamg_agg_nsmooths 1 -pc_gamg_reuse_interpolation true -two_solves -ksp_converged_reason -use_mat_nearnullspace -pc_gamg_square_graph 1 -mg_levels_ksp_max_it 2 -mg_levels_ksp_type chebyshev -mg_levels_pc_type jacobi -mg_levels_ksp_chebyshev_esteig 0,0.2,0,1.05 -pc_gamg_esteig_ksp_max_it 10 -pc_gamg_threshold 0.01 -pc_gamg_coarse_eq_limit 2000 -pc_gamg_process_eq_limit 200 -pc_gamg_repartition false -pc_mg_cycle_type v -ksp_monitor_short -mat_seqaij_type seqaijmkl
996: TEST*/