Actual source code: ex62.c

petsc-3.11.4 2019-09-28
Report Typos and Errors
  1: static char help[] = "Stokes Problem in 2d and 3d with simplicial finite elements.\n\
  2: We solve the Stokes problem in a rectangular\n\
  3: domain, using a parallel unstructured mesh (DMPLEX) to discretize it.\n\n\n";

  5: /*
  6: The isoviscous Stokes problem, which we discretize using the finite
  7: element method on an unstructured mesh. The weak form equations are

  9:   < \nabla v, \nabla u + {\nabla u}^T > - < \nabla\cdot v, p > + < v, f > = 0
 10:   < q, \nabla\cdot u >                                                    = 0

 12: Viewing:

 14: To produce nice output, use

 16:   -dm_refine 3 -show_error -dm_view hdf5:sol1.h5 -error_vec_view hdf5:sol1.h5::append -sol_vec_view hdf5:sol1.h5::append -exact_vec_view hdf5:sol1.h5::append

 18: You can get a LaTeX view of the mesh, with point numbering using

 20:   -dm_view :mesh.tex:ascii_latex -dm_plex_view_scale 8.0

 22: The data layout can be viewed using

 24:   -dm_petscsection_view

 26: Lots of information about the FEM assembly can be printed using

 28:   -dm_plex_print_fem 2

 30: Field Data:

 32:   DMPLEX data is organized by point, and the closure operation just stacks up the
 33: data from each sieve point in the closure. Thus, for a P_2-P_1 Stokes element, we
 34: have

 36:   cl{e} = {f e_0 e_1 e_2 v_0 v_1 v_2}
 37:   x     = [u_{e_0} v_{e_0} u_{e_1} v_{e_1} u_{e_2} v_{e_2} u_{v_0} v_{v_0} p_{v_0} u_{v_1} v_{v_1} p_{v_1} u_{v_2} v_{v_2} p_{v_2}]

 39: The problem here is that we would like to loop over each field separately for
 40: integration. Therefore, the closure visitor in DMPlexVecGetClosure() reorders
 41: the data so that each field is contiguous

 43:   x'    = [u_{e_0} v_{e_0} u_{e_1} v_{e_1} u_{e_2} v_{e_2} u_{v_0} v_{v_0} u_{v_1} v_{v_1} u_{v_2} v_{v_2} p_{v_0} p_{v_1} p_{v_2}]

 45: Likewise, DMPlexVecSetClosure() takes data partitioned by field, and correctly
 46: puts it into the Sieve ordering.

 48: TODO:
 49:  - Update FETI test output
 50:  - Reorder mesh
 51:  - Check the q1-p0 Vanka domains are correct (I think its correct)
 52:    - Check scaling of iterates, right now it is bad
 53:  - Check the q2-q1 domains since convergence is bad
 54:    - Ask Patrick about domains
 55:  - Plot residual by fields after each smoother iterate
 56:  - Get Diskin checks going
 57: */

 59:  #include <petscdmplex.h>
 60:  #include <petscsnes.h>
 61:  #include <petscds.h>

 63: PetscInt spatialDim = 0;

 65: typedef enum {NEUMANN, DIRICHLET, NUM_BC_TYPES} BCType;
 66: const char *bcTypes[NUM_BC_TYPES+1]  = {"neumann", "dirichlet", "unknown"};
 67: typedef enum {RUN_FULL, RUN_TEST, NUM_RUN_TYPES} RunType;
 68: const char *runTypes[NUM_RUN_TYPES+1] = {"full", "test", "unknown"};
 69: typedef enum {SOL_QUADRATIC, SOL_CUBIC, SOL_TRIG, NUM_SOL_TYPES} SolType;
 70: const char *solTypes[NUM_SOL_TYPES+1] = {"quadratic", "cubic", "trig", "unknown"};

 72: typedef struct {
 73:   PetscInt      debug;             /* The debugging level */
 74:   RunType       runType;           /* Whether to run tests, or solve the full problem */
 75:   PetscLogEvent createMeshEvent;
 76:   PetscBool     showInitial, showError;
 77:   /* Domain and mesh definition */
 78:   PetscInt      dim;               /* The topological mesh dimension */
 79:   PetscBool     interpolate;       /* Generate intermediate mesh elements */
 80:   PetscBool     simplex;           /* Use simplices or tensor product cells */
 81:   PetscInt      cells[3];          /* The initial domain division */
 82:   PetscReal     refinementLimit;   /* The largest allowable cell volume */
 83:   PetscBool     testPartition;     /* Use a fixed partitioning for testing */
 84:   /* Problem definition */
 85:   BCType        bcType;
 86:   SolType       solType;
 87:   PetscErrorCode (**exactFuncs)(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *u, void *ctx);
 88: } AppCtx;

 90: PetscErrorCode zero_scalar(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *u, void *ctx)
 91: {
 92:   u[0] = 0.0;
 93:   return 0;
 94: }
 95: PetscErrorCode zero_vector(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *u, void *ctx)
 96: {
 97:   PetscInt d;
 98:   for (d = 0; d < spatialDim; ++d) u[d] = 0.0;
 99:   return 0;
100: }

102: /*
103:   In 2D we use exact solution:

105:     u = x^2 + y^2
106:     v = 2 x^2 - 2xy
107:     p = x + y - 1
108:     f_x = f_y = 3

110:   so that

112:     -\Delta u + \nabla p + f = <-4, -4> + <1, 1> + <3, 3> = 0
113:     \nabla \cdot u           = 2x - 2x                    = 0
114: */
115: PetscErrorCode quadratic_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *u, void *ctx)
116: {
117:   u[0] = x[0]*x[0] + x[1]*x[1];
118:   u[1] = 2.0*x[0]*x[0] - 2.0*x[0]*x[1];
119:   return 0;
120: }

122: PetscErrorCode linear_p_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *p, void *ctx)
123: {
124:   *p = x[0] + x[1] - 1.0;
125:   return 0;
126: }
127: PetscErrorCode constant_p(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *p, void *ctx)
128: {
129:   *p = 1.0;
130:   return 0;
131: }

133: /*
134:   In 2D we use exact solution:

136:     u = x^3 + y^3
137:     v = 2 x^3 - 3 x^2 y
138:     p = 3/2 x^2 + 3/2 y^2 - 1
139:     f_x = 6 (x + y)
140:     f_y = 12 x - 3 y

142:   so that

144:     -\Delta u + \nabla p + f = <-6 x - 6 y, -12 x + 6 y> + <3 x, 3 y> + <6 (x + y), 12 x - 6 y> = 0
145:     \nabla \cdot u           = 3 x^2 - 3 x^2 = 0
146: */
147: PetscErrorCode cubic_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *u, void *ctx)
148: {
149:   u[0] =     x[0]*x[0]*x[0] +     x[1]*x[1]*x[1];
150:   u[1] = 2.0*x[0]*x[0]*x[0] - 3.0*x[0]*x[0]*x[1];
151:   return 0;
152: }

154: PetscErrorCode quadratic_p_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *p, void *ctx)
155: {
156:   *p = 3.0*x[0]*x[0]/2.0 + 3.0*x[1]*x[1]/2.0 - 1.0;
157:   return 0;
158: }

160: /*
161:   In 2D we use exact solution:

163:     u =  sin(n pi x) + y^2
164:     v = -sin(n pi y)
165:     p = 3/2 x^2 + 3/2 y^2 - 1
166:     f_x = 4 - 3x - n^2 pi^2 sin (n pi x)
167:     f_y =   - 3y + n^2 pi^2 sin(n pi y)

169:   so that

171:     -\Delta u + \nabla p + f = <n^2 pi^2 sin (n pi x) - 4, -n^2 pi^2 sin(n pi y)> + <3 x, 3 y> + <4 - 3x - n^2 pi^2 sin (n pi x), -3y + n^2 pi^2 sin(n pi y)> = 0
172:     \nabla \cdot u           = n pi cos(n pi x) - n pi cos(n pi y) = 0
173: */
174: PetscErrorCode trig_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *u, void *ctx)
175: {
176:   const PetscReal n = 1.0;

178:   u[0] =  PetscSinReal(n*PETSC_PI*x[0]) + x[1]*x[1];
179:   u[1] = -PetscSinReal(n*PETSC_PI*x[1]);
180:   return 0;
181: }

183: void f0_quadratic_u(PetscInt dim, PetscInt Nf, PetscInt NfAux,
184:                     const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
185:                     const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
186:                     PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
187: {
188:   PetscInt c;
189:   for (c = 0; c < dim; ++c) f0[c] = 3.0;
190: }

192: void f0_cubic_u(PetscInt dim, PetscInt Nf, PetscInt NfAux,
193:                 const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
194:                 const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
195:                 PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
196: {
197:   f0[0] =  3.0*x[0] + 6.0*x[1];
198:   f0[1] = 12.0*x[0] - 9.0*x[1];
199: }

201: void f0_trig_u(PetscInt dim, PetscInt Nf, PetscInt NfAux,
202:                const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
203:                const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
204:                PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
205: {
206:   const PetscReal n = 1.0;

208:   f0[0] = 4.0 - 3.0*x[0] - PetscSqr(n*PETSC_PI)*PetscSinReal(n*PETSC_PI*x[0]);
209:   f0[1] =      -3.0*x[1] + PetscSqr(n*PETSC_PI)*PetscSinReal(n*PETSC_PI*x[1]);
210: }

212: /* gradU[comp*dim+d] = {u_x, u_y, v_x, v_y} or {u_x, u_y, u_z, v_x, v_y, v_z, w_x, w_y, w_z}
213:    u[Ncomp]          = {p} */
214: void f1_u(PetscInt dim, PetscInt Nf, PetscInt NfAux,
215:           const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
216:           const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
217:           PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f1[])
218: {
219:   const PetscInt Ncomp = dim;
220:   PetscInt       comp, d;

222:   for (comp = 0; comp < Ncomp; ++comp) {
223:     for (d = 0; d < dim; ++d) {
224:       /* f1[comp*dim+d] = 0.5*(gradU[comp*dim+d] + gradU[d*dim+comp]); */
225:       f1[comp*dim+d] = u_x[comp*dim+d];
226:     }
227:     f1[comp*dim+comp] -= u[Ncomp];
228:   }
229: }

231: /* gradU[comp*dim+d] = {u_x, u_y, v_x, v_y} or {u_x, u_y, u_z, v_x, v_y, v_z, w_x, w_y, w_z} */
232: void f0_p(PetscInt dim, PetscInt Nf, PetscInt NfAux,
233:           const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
234:           const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
235:           PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
236: {
237:   PetscInt d;
238:   for (d = 0, f0[0] = 0.0; d < dim; ++d) f0[0] += u_x[d*dim+d];
239: }

241: void f1_p(PetscInt dim, PetscInt Nf, PetscInt NfAux,
242:           const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
243:           const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
244:           PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f1[])
245: {
246:   PetscInt d;
247:   for (d = 0; d < dim; ++d) f1[d] = 0.0;
248: }

250: /* < q, \nabla\cdot u >
251:    NcompI = 1, NcompJ = dim */
252: void g1_pu(PetscInt dim, PetscInt Nf, PetscInt NfAux,
253:            const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
254:            const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
255:            PetscReal t, PetscReal u_tShift, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g1[])
256: {
257:   PetscInt d;
258:   for (d = 0; d < dim; ++d) g1[d*dim+d] = 1.0; /* \frac{\partial\phi^{u_d}}{\partial x_d} */
259: }

261: /* -< \nabla\cdot v, p >
262:     NcompI = dim, NcompJ = 1 */
263: void g2_up(PetscInt dim, PetscInt Nf, PetscInt NfAux,
264:            const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
265:            const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
266:            PetscReal t, PetscReal u_tShift, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g2[])
267: {
268:   PetscInt d;
269:   for (d = 0; d < dim; ++d) g2[d*dim+d] = -1.0; /* \frac{\partial\psi^{u_d}}{\partial x_d} */
270: }

272: /* < \nabla v, \nabla u + {\nabla u}^T >
273:    This just gives \nabla u, give the perdiagonal for the transpose */
274: void g3_uu(PetscInt dim, PetscInt Nf, PetscInt NfAux,
275:            const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
276:            const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
277:            PetscReal t, PetscReal u_tShift, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g3[])
278: {
279:   const PetscInt Ncomp = dim;
280:   PetscInt       compI, d;

282:   for (compI = 0; compI < Ncomp; ++compI) {
283:     for (d = 0; d < dim; ++d) {
284:       g3[((compI*Ncomp+compI)*dim+d)*dim+d] = 1.0;
285:     }
286:   }
287: }

289: /*
290:   In 3D we use exact solution:

292:     u = x^2 + y^2
293:     v = y^2 + z^2
294:     w = x^2 + y^2 - 2(x+y)z
295:     p = x + y + z - 3/2
296:     f_x = f_y = f_z = 3

298:   so that

300:     -\Delta u + \nabla p + f = <-4, -4, -4> + <1, 1, 1> + <3, 3, 3> = 0
301:     \nabla \cdot u           = 2x + 2y - 2(x + y)                   = 0
302: */
303: PetscErrorCode quadratic_u_3d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *u, void *ctx)
304: {
305:   u[0] = x[0]*x[0] + x[1]*x[1];
306:   u[1] = x[1]*x[1] + x[2]*x[2];
307:   u[2] = x[0]*x[0] + x[1]*x[1] - 2.0*(x[0] + x[1])*x[2];
308:   return 0;
309: }

311: PetscErrorCode linear_p_3d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *p, void *ctx)
312: {
313:   *p = x[0] + x[1] + x[2] - 1.5;
314:   return 0;
315: }

317: void pressure(PetscInt dim, PetscInt Nf, PetscInt NfAux,
318:               const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
319:               const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
320:               PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar p[])
321: {
322:   p[0] = u[uOff[1]];
323: }

325: PetscErrorCode ProcessOptions(MPI_Comm comm, AppCtx *options)
326: {
327:   PetscInt       bc, run, sol, n;

331:   options->debug           = 0;
332:   options->runType         = RUN_FULL;
333:   options->dim             = 2;
334:   options->interpolate     = PETSC_FALSE;
335:   options->simplex         = PETSC_TRUE;
336:   options->cells[0]        = 3;
337:   options->cells[1]        = 3;
338:   options->cells[2]        = 3;
339:   options->refinementLimit = 0.0;
340:   options->testPartition   = PETSC_FALSE;
341:   options->bcType          = DIRICHLET;
342:   options->solType         = SOL_QUADRATIC;
343:   options->showInitial     = PETSC_FALSE;
344:   options->showError       = PETSC_FALSE;

346:   PetscOptionsBegin(comm, "", "Stokes Problem Options", "DMPLEX");
347:   PetscOptionsInt("-debug", "The debugging level", "ex62.c", options->debug, &options->debug, NULL);
348:   run  = options->runType;
349:   PetscOptionsEList("-run_type", "The run type", "ex62.c", runTypes, NUM_RUN_TYPES, runTypes[options->runType], &run, NULL);
350:   options->runType = (RunType) run;
351:   PetscOptionsInt("-dim", "The topological mesh dimension", "ex62.c", options->dim, &options->dim, NULL);
352:   spatialDim = options->dim;
353:   PetscOptionsBool("-interpolate", "Generate intermediate mesh elements", "ex62.c", options->interpolate, &options->interpolate, NULL);
354:   PetscOptionsBool("-simplex", "Use simplices or tensor product cells", "ex62.c", options->simplex, &options->simplex, NULL);
355:   if (options->simplex) {
356:     options->cells[0] = 4 - options->dim;
357:     options->cells[1] = 4 - options->dim;
358:     options->cells[2] = 4 - options->dim;
359:   }
360:   n = 3;
361:   PetscOptionsIntArray("-cells", "The initial mesh division", "ex62.c", options->cells, &n, NULL);
362:   PetscOptionsReal("-refinement_limit", "The largest allowable cell volume", "ex62.c", options->refinementLimit, &options->refinementLimit, NULL);
363:   PetscOptionsBool("-test_partition", "Use a fixed partition for testing", "ex62.c", options->testPartition, &options->testPartition, NULL);
364:   bc   = options->bcType;
365:   PetscOptionsEList("-bc_type","Type of boundary condition","ex62.c", bcTypes, NUM_BC_TYPES, bcTypes[options->bcType], &bc, NULL);
366:   options->bcType = (BCType) bc;
367:   sol  = options->solType;
368:   PetscOptionsEList("-sol_type", "The solution type", "ex62.c", solTypes, NUM_SOL_TYPES, solTypes[options->solType], &sol, NULL);
369:   options->solType = (SolType) sol;
370:   PetscOptionsBool("-show_initial", "Output the initial guess for verification", "ex62.c", options->showInitial, &options->showInitial, NULL);
371:   PetscOptionsBool("-show_error", "Output the error for verification", "ex62.c", options->showError, &options->showError, NULL);
372:   PetscOptionsEnd();

374:   PetscLogEventRegister("CreateMesh", DM_CLASSID, &options->createMeshEvent);
375:   return(0);
376: }

378: PetscErrorCode DMVecViewLocal(DM dm, Vec v)
379: {
380:   Vec            lv;

384:   DMGetLocalVector(dm, &lv);
385:   DMGlobalToLocalBegin(dm, v, INSERT_VALUES, lv);
386:   DMGlobalToLocalEnd(dm, v, INSERT_VALUES, lv);
387:   DMPrintLocalVec(dm, "Local function", 0.0, lv);
388:   DMRestoreLocalVector(dm, &lv);
389:   return(0);
390: }

392: PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user, DM *dm)
393: {
394:   PetscInt       dim             = user->dim;
395:   PetscBool      interpolate     = user->interpolate;
396:   PetscReal      refinementLimit = user->refinementLimit;

400:   PetscLogEventBegin(user->createMeshEvent,0,0,0,0);
401:   DMPlexCreateBoxMesh(comm, dim, user->simplex, user->cells, NULL, NULL, NULL, interpolate, dm);
402:   {
403:     DM refinedMesh     = NULL;
404:     DM distributedMesh = NULL;

406:     /* Refine mesh using a volume constraint */
407:     DMPlexSetRefinementLimit(*dm, refinementLimit);
408:     if (user->simplex) {DMRefine(*dm, comm, &refinedMesh);}
409:     if (refinedMesh) {
410:       DMDestroy(dm);
411:       *dm  = refinedMesh;
412:     }
413:     /* Setup test partitioning */
414:     if (user->testPartition) {
415:       PetscInt         triSizes_n2[2]         = {4, 4};
416:       PetscInt         triPoints_n2[8]        = {3, 5, 6, 7, 0, 1, 2, 4};
417:       PetscInt         triSizes_n3[3]         = {2, 3, 3};
418:       PetscInt         triPoints_n3[8]        = {3, 5, 1, 6, 7, 0, 2, 4};
419:       PetscInt         triSizes_n5[5]         = {1, 2, 2, 1, 2};
420:       PetscInt         triPoints_n5[8]        = {3, 5, 6, 4, 7, 0, 1, 2};
421:       PetscInt         triSizes_ref_n2[2]     = {8, 8};
422:       PetscInt         triPoints_ref_n2[16]   = {1, 5, 6, 7, 10, 11, 14, 15, 0, 2, 3, 4, 8, 9, 12, 13};
423:       PetscInt         triSizes_ref_n3[3]     = {5, 6, 5};
424:       PetscInt         triPoints_ref_n3[16]   = {1, 7, 10, 14, 15, 2, 6, 8, 11, 12, 13, 0, 3, 4, 5, 9};
425:       PetscInt         triSizes_ref_n5[5]     = {3, 4, 3, 3, 3};
426:       PetscInt         triPoints_ref_n5[16]   = {1, 7, 10, 2, 11, 13, 14, 5, 6, 15, 0, 8, 9, 3, 4, 12};
427:       PetscInt         triSizes_ref_n5_d3[5]  = {1, 1, 1, 1, 2};
428:       PetscInt         triPoints_ref_n5_d3[6] = {0, 1, 2, 3, 4, 5};
429:       const PetscInt  *sizes = NULL;
430:       const PetscInt  *points = NULL;
431:       PetscPartitioner part;
432:       PetscInt         cEnd;
433:       PetscMPIInt      rank, size;

435:       MPI_Comm_rank(comm, &rank);
436:       MPI_Comm_size(comm, &size);
437:       DMPlexGetHeightStratum(*dm, 0, NULL, &cEnd);
438:       if (!rank) {
439:         if (dim == 2 && user->simplex && size == 2 && cEnd == 8) {
440:            sizes = triSizes_n2; points = triPoints_n2;
441:         } else if (dim == 2 && user->simplex && size == 3 && cEnd == 8) {
442:           sizes = triSizes_n3; points = triPoints_n3;
443:         } else if (dim == 2 && user->simplex && size == 5 && cEnd == 8) {
444:           sizes = triSizes_n5; points = triPoints_n5;
445:         } else if (dim == 2 && user->simplex && size == 2 && cEnd == 16) {
446:            sizes = triSizes_ref_n2; points = triPoints_ref_n2;
447:         } else if (dim == 2 && user->simplex && size == 3 && cEnd == 16) {
448:           sizes = triSizes_ref_n3; points = triPoints_ref_n3;
449:         } else if (dim == 2 && user->simplex && size == 5 && cEnd == 16) {
450:           sizes = triSizes_ref_n5; points = triPoints_ref_n5;
451:         } else if (dim == 3 && user->simplex && size == 5 && cEnd == 6) {
452:           sizes = triSizes_ref_n5_d3; points = triPoints_ref_n5_d3;
453:         } else SETERRQ(comm, PETSC_ERR_ARG_WRONG, "No stored partition matching run parameters");
454:       }
455:       DMPlexGetPartitioner(*dm, &part);
456:       PetscPartitionerSetType(part, PETSCPARTITIONERSHELL);
457:       PetscPartitionerShellSetPartition(part, size, sizes, points);
458:     } else {
459:       PetscPartitioner part;

461:       DMPlexGetPartitioner(*dm, &part);
462:       PetscPartitionerSetFromOptions(part);
463:     }
464:     /* Distribute mesh over processes */
465:     DMPlexDistribute(*dm, 0, NULL, &distributedMesh);
466:     if (distributedMesh) {
467:       DMDestroy(dm);
468:       *dm  = distributedMesh;
469:     }
470:   }
471:   DMSetFromOptions(*dm);
472:   DMViewFromOptions(*dm, NULL, "-dm_view");
473:   PetscLogEventEnd(user->createMeshEvent,0,0,0,0);
474:   return(0);
475: }

477: PetscErrorCode SetupProblem(DM dm, AppCtx *user)
478: {
479:   PetscDS        prob;
480:   const PetscInt id = 1;

484:   DMGetDS(dm, &prob);
485:   switch (user->solType) {
486:   case SOL_QUADRATIC:
487:     switch (user->dim) {
488:     case 2:
489:       PetscDSSetResidual(prob, 0, f0_quadratic_u, f1_u);
490:       user->exactFuncs[0] = quadratic_u_2d;
491:       user->exactFuncs[1] = linear_p_2d;
492:       break;
493:     case 3:
494:       PetscDSSetResidual(prob, 0, f0_quadratic_u, f1_u);
495:       user->exactFuncs[0] = quadratic_u_3d;
496:       user->exactFuncs[1] = linear_p_3d;
497:       break;
498:     default: SETERRQ1(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Unsupported dimension %d for quadratic solution", user->dim);
499:     }
500:     break;
501:   case SOL_CUBIC:
502:     switch (user->dim) {
503:     case 2:
504:       PetscDSSetResidual(prob, 0, f0_cubic_u, f1_u);
505:       user->exactFuncs[0] = cubic_u_2d;
506:       user->exactFuncs[1] = quadratic_p_2d;
507:       break;
508:     default: SETERRQ1(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Unsupported dimension %d for quadratic solution", user->dim);
509:     }
510:     break;
511:   case SOL_TRIG:
512:     switch (user->dim) {
513:     case 2:
514:       PetscDSSetResidual(prob, 0, f0_trig_u, f1_u);
515:       user->exactFuncs[0] = trig_u_2d;
516:       user->exactFuncs[1] = quadratic_p_2d;
517:       break;
518:     default: SETERRQ1(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Unsupported dimension %d for trigonometric solution", user->dim);
519:     }
520:     break;
521:   default: SETERRQ2(PetscObjectComm((PetscObject) prob), PETSC_ERR_ARG_WRONG, "Unsupported solution type: %s (%D)", solTypes[PetscMin(user->solType, NUM_SOL_TYPES)], user->solType);
522:   }
523:   PetscDSSetResidual(prob, 1, f0_p, f1_p);
524:   PetscDSSetJacobian(prob, 0, 0, NULL, NULL,  NULL,  g3_uu);
525:   PetscDSSetJacobian(prob, 0, 1, NULL, NULL,  g2_up, NULL);
526:   PetscDSSetJacobian(prob, 1, 0, NULL, g1_pu, NULL,  NULL);

528:   PetscDSAddBoundary(prob, user->bcType == DIRICHLET ? DM_BC_ESSENTIAL : DM_BC_NATURAL, "wall", user->bcType == NEUMANN ? "boundary" : "marker", 0, 0, NULL, (void (*)(void)) user->exactFuncs[0], 1, &id, user);
529:   PetscDSSetExactSolution(prob, 0, user->exactFuncs[0]);
530:   PetscDSSetExactSolution(prob, 1, user->exactFuncs[1]);
531:   return(0);
532: }

534: PetscErrorCode SetupDiscretization(DM dm, AppCtx *user)
535: {
536:   DM              cdm   = dm;
537:   const PetscInt  dim   = user->dim;
538:   PetscFE         fe[2];
539:   PetscQuadrature q;
540:   MPI_Comm        comm;
541:   PetscErrorCode  ierr;

544:   /* Create finite element */
545:   PetscObjectGetComm((PetscObject) dm, &comm);
546:   PetscFECreateDefault(comm, dim, dim, user->simplex, "vel_", PETSC_DEFAULT, &fe[0]);
547:   PetscObjectSetName((PetscObject) fe[0], "velocity");
548:   PetscFEGetQuadrature(fe[0], &q);
549:   PetscFECreateDefault(comm, dim, 1, user->simplex, "pres_", PETSC_DEFAULT, &fe[1]);
550:   PetscFESetQuadrature(fe[1], q);
551:   PetscObjectSetName((PetscObject) fe[1], "pressure");
552:   /* Set discretization and boundary conditions for each mesh */
553:   DMSetField(dm, 0, NULL, (PetscObject) fe[0]);
554:   DMSetField(dm, 1, NULL, (PetscObject) fe[1]);
555:   DMCreateDS(dm);
556:   SetupProblem(dm, user);
557:   while (cdm) {
558:     DMCopyDisc(dm, cdm);
559:     DMGetCoarseDM(cdm, &cdm);
560:   }
561:   PetscFEDestroy(&fe[0]);
562:   PetscFEDestroy(&fe[1]);
563:   return(0);
564: }

566: static PetscErrorCode CreatePressureNullSpace(DM dm, PetscInt dummy, MatNullSpace *nullspace)
567: {
568:   Vec              vec;
569:   PetscErrorCode (*funcs[2])(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *u, void* ctx) = {zero_vector, constant_p};
570:   PetscErrorCode   ierr;

573:   DMCreateGlobalVector(dm, &vec);
574:   DMProjectFunction(dm, 0.0, funcs, NULL, INSERT_ALL_VALUES, vec);
575:   VecNormalize(vec, NULL);
576:   PetscObjectSetName((PetscObject) vec, "Pressure Null Space");
577:   VecViewFromOptions(vec, NULL, "-pressure_nullspace_view");
578:   MatNullSpaceCreate(PetscObjectComm((PetscObject)dm), PETSC_FALSE, 1, &vec, nullspace);
579:   VecDestroy(&vec);
580:   /* New style for field null spaces */
581:   {
582:     PetscObject  pressure;
583:     MatNullSpace nullspacePres;

585:     DMGetField(dm, 1, NULL, &pressure);
586:     MatNullSpaceCreate(PetscObjectComm(pressure), PETSC_TRUE, 0, NULL, &nullspacePres);
587:     PetscObjectCompose(pressure, "nullspace", (PetscObject) nullspacePres);
588:     MatNullSpaceDestroy(&nullspacePres);
589:   }
590:   return(0);
591: }

593: /* Add a vector in the nullspace to make the continuum integral 0.

595:    If int(u) = a and int(n) = b, then int(u - a/b n) = a - a/b b = 0
596: */
597: static PetscErrorCode CorrectDiscretePressure(DM dm, MatNullSpace nullspace, Vec u, AppCtx *user)
598: {
599:   PetscDS        prob;
600:   const Vec     *nullvecs;
601:   PetscScalar    pintd, intc[2], intn[2];
602:   MPI_Comm       comm;

606:   PetscObjectGetComm((PetscObject) dm, &comm);
607:   DMGetDS(dm, &prob);
608:   PetscDSSetObjective(prob, 1, pressure);
609:   MatNullSpaceGetVecs(nullspace, NULL, NULL, &nullvecs);
610:   VecDot(nullvecs[0], u, &pintd);
611:   if (PetscAbsScalar(pintd) > 1.0e-10) SETERRQ1(comm, PETSC_ERR_ARG_WRONG, "Discrete integral of pressure: %g\n", (double) PetscRealPart(pintd));
612:   DMPlexComputeIntegralFEM(dm, nullvecs[0], intn, user);
613:   DMPlexComputeIntegralFEM(dm, u, intc, user);
614:   VecAXPY(u, -intc[1]/intn[1], nullvecs[0]);
615:   DMPlexComputeIntegralFEM(dm, u, intc, user);
616:   if (PetscAbsScalar(intc[1]) > 1.0e-10) SETERRQ1(comm, PETSC_ERR_ARG_WRONG, "Continuum integral of pressure after correction: %g\n", (double) PetscRealPart(intc[1]));
617:   return(0);
618: }

620: static PetscErrorCode SNESConvergenceCorrectPressure(SNES snes, PetscInt it, PetscReal xnorm, PetscReal gnorm, PetscReal f, SNESConvergedReason *reason, void *user)
621: {

625:   SNESConvergedDefault(snes, it, xnorm, gnorm, f, reason, user);
626:   if (*reason > 0) {
627:     DM           dm;
628:     Mat          J;
629:     Vec          u;
630:     MatNullSpace nullspace;

632:     SNESGetDM(snes, &dm);
633:     SNESGetSolution(snes, &u);
634:     SNESGetJacobian(snes, &J, NULL, NULL, NULL);
635:     MatGetNullSpace(J, &nullspace);
636:     CorrectDiscretePressure(dm, nullspace, u, (AppCtx *) user);
637:   }
638:   return(0);
639: }

641: int main(int argc, char **argv)
642: {
643:   SNES           snes;                 /* nonlinear solver */
644:   DM             dm;                   /* problem definition */
645:   Vec            u, r;                 /* solution and residual */
646:   AppCtx         user;                 /* user-defined work context */
647:   PetscReal      error         = 0.0;  /* L_2 error in the solution */
648:   PetscReal      ferrors[2];

651:   PetscInitialize(&argc, &argv, NULL,help);if (ierr) return ierr;
652:   ProcessOptions(PETSC_COMM_WORLD, &user);
653:   SNESCreate(PETSC_COMM_WORLD, &snes);
654:   CreateMesh(PETSC_COMM_WORLD, &user, &dm);
655:   SNESSetDM(snes, dm);
656:   DMSetApplicationContext(dm, &user);

658:   PetscMalloc(2 * sizeof(void (*)(const PetscReal[], PetscScalar *, void *)), &user.exactFuncs);
659:   SetupDiscretization(dm, &user);
660:   DMPlexCreateClosureIndex(dm, NULL);

662:   DMCreateGlobalVector(dm, &u);
663:   VecDuplicate(u, &r);

665:   DMSetNullSpaceConstructor(dm, 2, CreatePressureNullSpace);
666:   SNESSetConvergenceTest(snes, SNESConvergenceCorrectPressure, &user, NULL);

668:   DMPlexSetSNESLocalFEM(dm,&user,&user,&user);

670:   SNESSetFromOptions(snes);

672:   DMProjectFunction(dm, 0.0, user.exactFuncs, NULL, INSERT_ALL_VALUES, u);
673:   PetscObjectSetName((PetscObject) u, "Exact Solution");
674:   VecViewFromOptions(u, NULL, "-exact_vec_view");
675:   PetscObjectSetName((PetscObject) u, "Solution");
676:   if (user.showInitial) {DMVecViewLocal(dm, u);}
677:   PetscObjectSetName((PetscObject) u, "Solution");
678:   if (user.runType == RUN_FULL) {
679:     PetscErrorCode (*initialGuess[2])(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar *u, void* ctx) = {zero_vector, zero_scalar};

681:     DMProjectFunction(dm, 0.0, initialGuess, NULL, INSERT_VALUES, u);
682:     if (user.debug) {
683:       PetscPrintf(PETSC_COMM_WORLD, "Initial guess\n");
684:       VecView(u, PETSC_VIEWER_STDOUT_WORLD);
685:     }
686:     SNESSolve(snes, NULL, u);
687:     DMComputeL2Diff(dm, 0.0, user.exactFuncs, NULL, u, &error);
688:     DMComputeL2FieldDiff(dm, 0.0, user.exactFuncs, NULL, u, ferrors);
689:     PetscPrintf(PETSC_COMM_WORLD, "L_2 Error: %g [%g, %g]\n", error, ferrors[0], ferrors[1]);
690:     if (user.showError) {
691:       Vec r;

693:       DMGetGlobalVector(dm, &r);
694:       DMProjectFunction(dm, 0.0, user.exactFuncs, NULL, INSERT_ALL_VALUES, r);
695:       VecAXPY(r, -1.0, u);
696:       PetscObjectSetName((PetscObject) r, "Solution Error");
697:       VecViewFromOptions(r, NULL, "-error_vec_view");
698:       DMRestoreGlobalVector(dm, &r);
699:     }
700:   } else {
701:     PetscReal res = 0.0;

703:     /* Check discretization error */
704:     PetscPrintf(PETSC_COMM_WORLD, "Initial guess\n");
705:     VecView(u, PETSC_VIEWER_STDOUT_WORLD);
706:     DMComputeL2Diff(dm, 0.0, user.exactFuncs, NULL, u, &error);
707:     if (error >= 1.0e-11) {PetscPrintf(PETSC_COMM_WORLD, "L_2 Error: %g\n", error);}
708:     else                  {PetscPrintf(PETSC_COMM_WORLD, "L_2 Error: < 1.0e-11\n");}
709:     /* Check residual */
710:     SNESComputeFunction(snes, u, r);
711:     PetscPrintf(PETSC_COMM_WORLD, "Initial Residual\n");
712:     VecChop(r, 1.0e-10);
713:     VecView(r, PETSC_VIEWER_STDOUT_WORLD);
714:     VecNorm(r, NORM_2, &res);
715:     PetscPrintf(PETSC_COMM_WORLD, "L_2 Residual: %g\n", res);
716:     /* Check Jacobian */
717:     {
718:       Mat          J, M;
719:       MatNullSpace nullspace;
720:       Vec          b;
721:       PetscBool    isNull;

723:       SNESSetUpMatrices(snes);
724:       SNESGetJacobian(snes, &J, &M, NULL, NULL);
725:       SNESComputeJacobian(snes, u, J, M);
726:       MatGetNullSpace(J, &nullspace);
727:       MatNullSpaceTest(nullspace, J, &isNull);
728:       VecDuplicate(u, &b);
729:       VecSet(r, 0.0);
730:       SNESComputeFunction(snes, r, b);
731:       MatMult(J, u, r);
732:       VecAXPY(r, 1.0, b);
733:       VecDestroy(&b);
734:       PetscPrintf(PETSC_COMM_WORLD, "Au - b = Au + F(0)\n");
735:       VecChop(r, 1.0e-10);
736:       VecView(r, PETSC_VIEWER_STDOUT_WORLD);
737:       VecNorm(r, NORM_2, &res);
738:       PetscPrintf(PETSC_COMM_WORLD, "Linear L_2 Residual: %g\n", res);
739:     }
740:   }
741:   VecViewFromOptions(u, NULL, "-sol_vec_view");

743:   VecDestroy(&u);
744:   VecDestroy(&r);
745:   SNESDestroy(&snes);
746:   DMDestroy(&dm);
747:   PetscFree(user.exactFuncs);
748:   PetscFinalize();
749:   return ierr;
750: }

752: /*TEST

754:   # 2D serial P1 tests 0-3
755:   test:
756:     suffix: 0
757:     requires: triangle
758:     args: -run_type test -refinement_limit 0.0    -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
759:   test:
760:     suffix: 1
761:     requires: triangle
762:     args: -run_type test -refinement_limit 0.0    -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
763:   test:
764:     suffix: 2
765:     requires: triangle
766:     args: -run_type test -refinement_limit 0.0625 -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
767:   test:
768:     suffix: 3
769:     requires: triangle
770:     args: -run_type test -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
771:   # 2D serial P2 tests 4-5
772:   test:
773:     suffix: 4
774:     requires: triangle
775:     args: -run_type test -refinement_limit 0.0    -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
776:   test:
777:     suffix: 5
778:     requires: triangle
779:     args: -run_type test -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
780:   # 2D serial P3 tests
781:   test:
782:     suffix: 2d_p3_0
783:     requires: triangle
784:     args: -run_type test -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 3 -pres_petscspace_degree 2
785:   test:
786:     suffix: 2d_p3_1
787:     requires: triangle !single
788:     args: -run_type full -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 3 -pres_petscspace_degree 2
789:   # Parallel tests 6-17
790:   test:
791:     suffix: 6
792:     requires: triangle
793:     nsize: 2
794:     args: -run_type test -refinement_limit 0.0    -test_partition -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
795:   test:
796:     suffix: 7
797:     requires: triangle
798:     nsize: 3
799:     args: -run_type test -refinement_limit 0.0    -test_partition -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
800:   test:
801:     suffix: 8
802:     requires: triangle
803:     nsize: 5
804:     args: -run_type test -refinement_limit 0.0    -test_partition -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
805:   test:
806:     suffix: 9
807:     requires: triangle
808:     nsize: 2
809:     args: -run_type test -refinement_limit 0.0    -test_partition -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
810:   test:
811:     suffix: 10
812:     requires: triangle
813:     nsize: 3
814:     args: -run_type test -refinement_limit 0.0    -test_partition -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
815:   test:
816:     suffix: 11
817:     requires: triangle
818:     nsize: 5
819:     args: -run_type test -refinement_limit 0.0    -test_partition -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
820:   test:
821:     suffix: 12
822:     requires: triangle
823:     nsize: 2
824:     args: -run_type test -refinement_limit 0.0625 -test_partition -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
825:   test:
826:     suffix: 13
827:     requires: triangle
828:     nsize: 3
829:     args: -run_type test -refinement_limit 0.0625 -test_partition -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
830:   test:
831:     suffix: 14
832:     requires: triangle
833:     nsize: 5
834:     args: -run_type test -refinement_limit 0.0625 -test_partition -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
835:   test:
836:     suffix: 15
837:     requires: triangle
838:     nsize: 2
839:     args: -run_type test -refinement_limit 0.0625 -test_partition -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
840:   test:
841:     suffix: 16
842:     requires: triangle
843:     nsize: 3
844:     args: -run_type test -refinement_limit 0.0625 -test_partition -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
845:   test:
846:     suffix: 17
847:     requires: triangle
848:     nsize: 5
849:     args: -run_type test -refinement_limit 0.0625 -test_partition -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -dm_plex_print_fem 1
850:   # 3D serial P1 tests 43-46
851:   test:
852:     suffix: 43
853:     requires: ctetgen
854:     args: -run_type test -dim 3 -refinement_limit 0.0    -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
855:   test:
856:     suffix: 44
857:     requires: ctetgen
858:     args: -run_type test -dim 3 -refinement_limit 0.0    -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
859:   test:
860:     suffix: 45
861:     requires: ctetgen
862:     args: -run_type test -dim 3 -refinement_limit 0.0125 -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
863:   test:
864:     suffix: 46
865:     requires: ctetgen
866:     args: -run_type test -dim 3 -refinement_limit 0.0125 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
867:   # Full solutions 18-29
868:   test:
869:     suffix: 18
870:     requires: triangle !single
871:     filter:  sed -e "s/total number of linear solver iterations=11/total number of linear solver iterations=12/g"
872:     args: -run_type full -refinement_limit 0.0625 -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
873:   test:
874:     suffix: 19
875:     requires: triangle !single
876:     nsize: 2
877:     filter:  sed -e "s/total number of linear solver iterations=11/total number of linear solver iterations=12/g"
878:     args: -run_type full -petscpartitioner_type simple -refinement_limit 0.0625 -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
879:   test:
880:     suffix: 20
881:     requires: triangle !single
882:     filter:  sed -e "s/total number of linear solver iterations=11/total number of linear solver iterations=12/g"
883:     nsize: 3
884:     args: -run_type full -petscpartitioner_type simple -refinement_limit 0.0625 -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
885:   test:
886:     suffix: 20_parmetis
887:     requires: parmetis triangle !single
888:     filter:  sed -e "s/total number of linear solver iterations=11/total number of linear solver iterations=12/g"
889:     nsize: 3
890:     args: -run_type full -petscpartitioner_type parmetis -refinement_limit 0.0625 -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
891:   test:
892:     suffix: 21
893:     requires: triangle !single
894:     filter:  sed -e "s/total number of linear solver iterations=11/total number of linear solver iterations=12/g"
895:     nsize: 5
896:     args: -run_type full -petscpartitioner_type simple -refinement_limit 0.0625 -bc_type dirichlet -interpolate 0 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
897:   test:
898:     suffix: 22
899:     requires: triangle !single
900:     filter:  sed -e "s/total number of linear solver iterations=11/total number of linear solver iterations=12/g"
901:     args: -run_type full -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
902:   test:
903:     suffix: 23
904:     requires: triangle !single
905:     nsize: 2
906:     filter:  sed -e "s/total number of linear solver iterations=11/total number of linear solver iterations=12/g"
907:     args: -run_type full -petscpartitioner_type simple -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
908:   test:
909:     suffix: 24
910:     requires: triangle !single
911:     nsize: 3
912:     filter:  sed -e "s/total number of linear solver iterations=11/total number of linear solver iterations=12/g"
913:     args: -run_type full -petscpartitioner_type simple -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
914:   test:
915:     suffix: 25
916:     requires: triangle !single
917:     filter:  sed -e "s/total number of linear solver iterations=11/total number of linear solver iterations=12/g"
918:     nsize: 5
919:     args: -run_type full -petscpartitioner_type simple -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
920:   test:
921:     suffix: 26
922:     requires: triangle !single
923:     args: -run_type full -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
924:   test:
925:     suffix: 27
926:     requires: triangle !single
927:     nsize: 2
928:     args: -run_type full -petscpartitioner_type simple -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
929:   test:
930:     suffix: 28
931:     requires: triangle !single
932:     nsize: 3
933:     args: -run_type full -petscpartitioner_type simple -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
934:   test:
935:     suffix: 29
936:     requires: triangle !single
937:     nsize: 5
938:     args: -run_type full -petscpartitioner_type simple -refinement_limit 0.0625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
939:   # Full solutions with quads
940:   #   FULL Schur with LU/Jacobi
941:   test:
942:     suffix: quad_q2q1_full
943:     requires: !single
944:     args: -run_type full -simplex 0 -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_type fgmres -ksp_gmres_restart 10 -ksp_rtol 1.0e-9 -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_velocity_ksp_type gmres -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
945:   test:
946:     suffix: quad_q2p1_full
947:     requires: !single
948:     args: -run_type full -simplex 0 -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -pres_petscspace_poly_tensor 0 -pres_petscdualspace_lagrange_continuity 0 -ksp_type fgmres -ksp_gmres_restart 10 -ksp_rtol 1.0e-9 -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_velocity_ksp_type gmres -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
949:   # Stokes preconditioners 30-36
950:   #   Jacobi
951:   test:
952:     suffix: 30
953:     requires: triangle !single
954:     filter:  sed -e "s/total number of linear solver iterations=756/total number of linear solver iterations=757/g" -e "s/total number of linear solver iterations=758/total number of linear solver iterations=757/g"
955:     args: -run_type full -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_gmres_restart 100 -pc_type jacobi -ksp_rtol 1.0e-9 -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
956:   #  Block diagonal \begin{pmatrix} A & 0 \\ 0 & I \end{pmatrix}
957:   test:
958:     suffix: 31
959:     requires: triangle !single
960:     args: -run_type full -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_type fgmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-4 -pc_type fieldsplit -pc_fieldsplit_type additive -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
961:   #  Block triangular \begin{pmatrix} A & B \\ 0 & I \end{pmatrix}
962:   test:
963:     suffix: 32
964:     requires: triangle !single
965:     args: -run_type full -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_type fgmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type fieldsplit -pc_fieldsplit_type multiplicative -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
966:   #  Diagonal Schur complement \begin{pmatrix} A & 0 \\ 0 & S \end{pmatrix}
967:   test:
968:     suffix: 33
969:     requires: triangle !single
970:     args: -run_type full -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_type fgmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type diag -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_velocity_ksp_type gmres -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
971:   #  Upper triangular Schur complement \begin{pmatrix} A & B \\ 0 & S \end{pmatrix}
972:   test:
973:     suffix: 34
974:     requires: triangle !single
975:     args: -run_type full -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_type fgmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type upper -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_velocity_ksp_type gmres -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
976:   #  Lower triangular Schur complement \begin{pmatrix} A & B \\ 0 & S \end{pmatrix}
977:   test:
978:     suffix: 35
979:     requires: triangle !single
980:     args: -run_type full -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_type fgmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type lower -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_velocity_ksp_type gmres -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
981:   #  Full Schur complement \begin{pmatrix} I & 0 \\ B^T A^{-1} & I \end{pmatrix} \begin{pmatrix} A & 0 \\ 0 & S \end{pmatrix} \begin{pmatrix} I & A^{-1} B \\ 0 & I \end{pmatrix}
982:   test:
983:     suffix: 36
984:     requires: triangle !single
985:     args: -run_type full -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_type fgmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_velocity_ksp_type gmres -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
986:   #  SIMPLE \begin{pmatrix} I & 0 \\ B^T A^{-1} & I \end{pmatrix} \begin{pmatrix} A & 0 \\ 0 & B^T diag(A)^{-1} B \end{pmatrix} \begin{pmatrix} I & diag(A)^{-1} B \\ 0 & I \end{pmatrix}
987:   test:
988:     suffix: pc_simple
989:     requires: triangle !single
990:     args: -run_type full -refinement_limit 0.00625 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_type fgmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_velocity_ksp_type gmres -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -fieldsplit_pressure_inner_ksp_type preonly -fieldsplit_pressure_inner_pc_type jacobi -fieldsplit_pressure_upper_ksp_type preonly -fieldsplit_pressure_upper_pc_type jacobi -snes_error_if_not_converged -ksp_error_if_not_converged -snes_view
991:   #  SIMPLEC \begin{pmatrix} I & 0 \\ B^T A^{-1} & I \end{pmatrix} \begin{pmatrix} A & 0 \\ 0 & B^T rowsum(A)^{-1} B \end{pmatrix} \begin{pmatrix} I & rowsum(A)^{-1} B \\ 0 & I \end{pmatrix}
992:   test:
993:     suffix: pc_simplec
994:     requires: triangle
995:     args: -run_type full -dm_refine 3 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -ksp_type fgmres -ksp_max_it 5 -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_pressure_ksp_max_it 10 -fieldsplit_velocity_ksp_type gmres -fieldsplit_velocity_pc_type lu -fieldsplit_pressure_pc_type jacobi -fieldsplit_pressure_inner_ksp_type preonly -fieldsplit_pressure_inner_pc_type jacobi -fieldsplit_pressure_inner_pc_jacobi_type rowsum -fieldsplit_pressure_upper_ksp_type preonly -fieldsplit_pressure_upper_pc_type jacobi -fieldsplit_pressure_upper_pc_jacobi_type rowsum -snes_converged_reason -ksp_converged_reason -snes_view
996:   # FETI-DP solvers
997:   test:
998:     suffix: fetidp_2d_tri
999:     requires: triangle mumps
1000:     filter: grep -v "variant HERMITIAN"
1001:     nsize: 5
1002:     args: -run_type full -dm_refine 2 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -snes_view -snes_error_if_not_converged -dm_mat_type is -ksp_type fetidp -ksp_rtol 1.0e-8 -ksp_fetidp_saddlepoint -fetidp_ksp_type cg -fetidp_fieldsplit_p_ksp_max_it 1 -fetidp_fieldsplit_p_ksp_type richardson -fetidp_fieldsplit_p_ksp_richardson_scale 200 -fetidp_fieldsplit_p_pc_type none -ksp_fetidp_saddlepoint_flip 1 -fetidp_bddc_pc_bddc_dirichlet_pc_factor_mat_solver_type mumps -fetidp_bddc_pc_bddc_neumann_pc_factor_mat_solver_type mumps -petscpartitioner_type simple -fetidp_fieldsplit_lag_ksp_type preonly
1003:   test:
1004:     suffix: fetidp_3d_tet
1005:     requires: ctetgen suitesparse
1006:     filter: grep -v "variant HERMITIAN" | sed -e "s/linear solver iterations=10[0-9]/linear solver iterations=100/g" | sed -e "s/linear solver iterations=9[0-9]/linear solver iterations=100/g"
1007:     nsize: 5
1008:     args: -run_type full -dm_refine 2 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -snes_view -snes_error_if_not_converged -dm_mat_type is -ksp_type fetidp -ksp_rtol 1.0e-8 -ksp_fetidp_saddlepoint -fetidp_ksp_type cg -fetidp_fieldsplit_p_ksp_max_it 1 -fetidp_fieldsplit_p_ksp_type richardson -fetidp_fieldsplit_p_ksp_richardson_scale 1000 -fetidp_fieldsplit_p_pc_type none -ksp_fetidp_saddlepoint_flip 1 -fetidp_bddc_pc_bddc_use_deluxe_scaling -fetidp_bddc_pc_bddc_benign_trick -fetidp_bddc_pc_bddc_deluxe_singlemat -dim 3 -fetidp_pc_discrete_harmonic -fetidp_harmonic_pc_factor_mat_solver_type cholmod -fetidp_harmonic_pc_type cholesky -fetidp_bddelta_pc_factor_mat_solver_type umfpack -fetidp_fieldsplit_lag_ksp_type preonly -test_partition

1010:   test:
1011:     suffix: fetidp_2d_quad
1012:     requires: mumps double
1013:     filter: grep -v "variant HERMITIAN"
1014:     nsize: 5
1015:     args: -run_type full -dm_refine 2 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -snes_view -snes_error_if_not_converged -dm_mat_type is -ksp_type fetidp -ksp_rtol 1.0e-8 -ksp_fetidp_saddlepoint -fetidp_ksp_type cg -fetidp_fieldsplit_p_ksp_max_it 1 -fetidp_fieldsplit_p_ksp_type richardson -fetidp_fieldsplit_p_ksp_richardson_scale 200 -fetidp_fieldsplit_p_pc_type none -ksp_fetidp_saddlepoint_flip 1 -fetidp_bddc_pc_bddc_dirichlet_pc_factor_mat_solver_type mumps -fetidp_bddc_pc_bddc_neumann_pc_factor_mat_solver_type mumps -simplex 0 -petscpartitioner_type simple -fetidp_fieldsplit_lag_ksp_type preonly
1016:   test:
1017:     suffix: fetidp_3d_hex
1018:     requires: suitesparse
1019:     filter: grep -v "variant HERMITIAN" | sed -e "s/linear solver iterations=7[0-9]/linear solver iterations=71/g"
1020:     nsize: 5
1021:     args: -run_type full -dm_refine 1 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -snes_view -snes_error_if_not_converged -dm_mat_type is -ksp_type fetidp -ksp_rtol 1.0e-8 -ksp_fetidp_saddlepoint -fetidp_ksp_type cg -fetidp_fieldsplit_p_ksp_max_it 1 -fetidp_fieldsplit_p_ksp_type richardson -fetidp_fieldsplit_p_ksp_richardson_scale 2000 -fetidp_fieldsplit_p_pc_type none -ksp_fetidp_saddlepoint_flip 1 -dim 3 -simplex 0 -fetidp_pc_discrete_harmonic -fetidp_harmonic_pc_factor_mat_solver_type cholmod -fetidp_harmonic_pc_type cholesky -petscpartitioner_type simple -fetidp_fieldsplit_lag_ksp_type preonly -fetidp_bddc_pc_bddc_dirichlet_pc_factor_mat_solver_type umfpack -fetidp_bddc_pc_bddc_neumann_pc_factor_mat_solver_type umfpack
1022:   # Convergence
1023:   test:
1024:     suffix: 2d_quad_q1_p0_conv
1025:     requires: !single
1026:     args: -run_type full -bc_type dirichlet -simplex 0 -interpolate 1 -dm_refine 0 -vel_petscspace_degree 1 -pres_petscspace_degree 0 \
1027:       -snes_convergence_estimate -convest_num_refine 3 -snes_error_if_not_converged \
1028:       -ksp_type fgmres -ksp_gmres_restart 10 -ksp_rtol 1.0e-9 -ksp_error_if_not_converged \
1029:       -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full \
1030:         -fieldsplit_velocity_pc_type lu \
1031:         -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_pressure_pc_type jacobi
1032:   test:
1033:     suffix: 2d_tri_p2_p1_conv
1034:     requires: triangle !single
1035:     args: -run_type full -sol_type cubic -bc_type dirichlet -interpolate 1 -dm_refine 0 \
1036:       -vel_petscspace_degree 2 -pres_petscspace_degree 1 \
1037:       -snes_convergence_estimate -convest_num_refine 3 -snes_error_if_not_converged \
1038:       -ksp_type fgmres -ksp_gmres_restart 10 -ksp_rtol 1.0e-9 -ksp_error_if_not_converged \
1039:       -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full \
1040:         -fieldsplit_velocity_pc_type lu \
1041:         -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_pressure_pc_type jacobi
1042:   test:
1043:     suffix: 2d_quad_q2_q1_conv
1044:     requires: !single
1045:     args: -run_type full -sol_type cubic -bc_type dirichlet -simplex 0 -interpolate 1 -dm_refine 0 \
1046:       -vel_petscspace_degree 2 -pres_petscspace_degree 1 \
1047:       -snes_convergence_estimate -convest_num_refine 3 -snes_error_if_not_converged \
1048:       -ksp_type fgmres -ksp_gmres_restart 10 -ksp_rtol 1.0e-9 -ksp_error_if_not_converged \
1049:       -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full \
1050:         -fieldsplit_velocity_pc_type lu \
1051:         -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_pressure_pc_type jacobi
1052:   test:
1053:     suffix: 2d_quad_q2_p1_conv
1054:     requires: !single
1055:     args: -run_type full -sol_type cubic -bc_type dirichlet -simplex 0 -interpolate 1 -dm_refine 0 \
1056:       -vel_petscspace_degree 2 -pres_petscspace_degree 1 -pres_petscspace_poly_tensor 0 -pres_petscdualspace_lagrange_continuity 0 \
1057:       -snes_convergence_estimate -convest_num_refine 3 -snes_error_if_not_converged \
1058:       -ksp_type fgmres -ksp_gmres_restart 10 -ksp_rtol 1.0e-9 -ksp_error_if_not_converged \
1059:       -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full \
1060:         -fieldsplit_velocity_pc_type lu \
1061:         -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_pressure_pc_type jacobi
1062:   # GMG solver
1063:   test:
1064:     suffix: 2d_tri_p2_p1_gmg_vcycle
1065:     requires: triangle
1066:     args: -run_type full -sol_type cubic -bc_type dirichlet -interpolate 1 -cells 2,2 -dm_refine_hierarchy 1 \
1067:       -vel_petscspace_degree 2 -pres_petscspace_degree 1 \
1068:       -snes_convergence_estimate -convest_num_refine 1 -snes_error_if_not_converged \
1069:       -ksp_type fgmres -ksp_gmres_restart 10 -ksp_rtol 1.0e-9 -ksp_error_if_not_converged \
1070:       -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full \
1071:         -fieldsplit_velocity_pc_type mg \
1072:         -fieldsplit_pressure_ksp_rtol 1e-10 -fieldsplit_pressure_pc_type jacobi
1073:   # Vanka solver
1074:   test:
1075:     suffix: 2d_quad_q1_p0_vanka_add
1076:     requires: double !complex
1077:     filter: sed -e "s/linear solver iterations=52/linear solver iterations=49/g" -e "s/Linear solve converged due to CONVERGED_RTOL iterations 52/Linear solve converged due to CONVERGED_RTOL iterations 49/g"
1078:     args: -run_type full -bc_type dirichlet -simplex 0 -dm_refine 1 -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 0 -petscds_jac_pre 0 \
1079:       -snes_rtol 1.0e-4 -snes_error_if_not_converged -snes_view -snes_monitor -snes_converged_reason \
1080:       -ksp_type gmres -ksp_rtol 1.0e-5 -ksp_error_if_not_converged -ksp_converged_reason \
1081:       -pc_type patch -pc_patch_partition_of_unity 0 -pc_patch_construct_codim 0 -pc_patch_construct_type vanka \
1082:         -sub_ksp_type preonly -sub_pc_type lu
1083:   test:
1084:     suffix: 2d_quad_q1_p0_vanka_add_unity
1085:     requires: double !complex
1086:     filter: sed -e "s/linear solver iterations=46/linear solver iterations=45/g" -e "s/Linear solve converged due to CONVERGED_RTOL iterations 46/Linear solve converged due to CONVERGED_RTOL iterations 45/g"
1087:     args: -run_type full -bc_type dirichlet -simplex 0 -dm_refine 1 -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 0 -petscds_jac_pre 0 \
1088:       -snes_rtol 1.0e-4 -snes_error_if_not_converged -snes_view -snes_monitor -snes_converged_reason \
1089:       -ksp_type gmres -ksp_rtol 1.0e-5 -ksp_error_if_not_converged -ksp_converged_reason \
1090:       -pc_type patch -pc_patch_partition_of_unity 1 -pc_patch_construct_codim 0 -pc_patch_construct_type vanka \
1091:         -sub_ksp_type preonly -sub_pc_type lu
1092:   test:
1093:     suffix: 2d_quad_q2_q1_vanka_add
1094:     requires: double !complex
1095:     filter: sed -e "s/linear solver iterations=[4-9][0-9][0-9]/linear solver iterations=489/g"
1096:     args: -run_type full -bc_type dirichlet -simplex 0 -dm_refine 0 -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -petscds_jac_pre 0 \
1097:       -snes_rtol 1.0e-4 -snes_error_if_not_converged -snes_view -snes_monitor -snes_converged_reason \
1098:       -ksp_type gmres -ksp_rtol 1.0e-5 -ksp_error_if_not_converged \
1099:       -pc_type patch -pc_patch_partition_of_unity 0 -pc_patch_construct_dim 0 -pc_patch_construct_type vanka \
1100:         -sub_ksp_type preonly -sub_pc_type lu
1101:   test:
1102:     suffix: 2d_quad_q2_q1_vanka_add_unity
1103:     requires: double !complex
1104:     filter: sed -e "s/linear solver iterations=[4-9][0-9][0-9]/linear solver iterations=795/g"
1105:     args: -run_type full -bc_type dirichlet -simplex 0 -dm_refine 0 -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -petscds_jac_pre 0 \
1106:       -snes_rtol 1.0e-4 -snes_error_if_not_converged -snes_view -snes_monitor -snes_converged_reason \
1107:       -ksp_type gmres -ksp_rtol 1.0e-5 -ksp_error_if_not_converged \
1108:       -pc_type patch -pc_patch_partition_of_unity 1 -pc_patch_construct_dim 0 -pc_patch_construct_type vanka \
1109:         -sub_ksp_type preonly -sub_pc_type lu
1110:   # Vanka smoother
1111:   test:
1112:     suffix: 2d_quad_q1_p0_gmg_vanka_add
1113:     requires: double !complex long_runtime
1114:     args: -run_type full -bc_type dirichlet -simplex 0 -dm_refine_hierarchy 3 -interpolate 1 -vel_petscspace_degree 1 -pres_petscspace_degree 0 -petscds_jac_pre 0 \
1115:       -snes_rtol 1.0e-4 -snes_error_if_not_converged -snes_view -snes_monitor -snes_converged_reason \
1116:       -ksp_type gmres -ksp_rtol 1.0e-5 -ksp_error_if_not_converged -ksp_monitor_true_residual \
1117:       -pc_type mg -pc_mg_levels 3 \
1118:         -mg_levels_ksp_type gmres -mg_levels_ksp_max_it 30 -mg_levels_ksp_monitor_true_residual_no \
1119:         -mg_levels_pc_type patch -mg_levels_pc_patch_partition_of_unity 0 -mg_levels_pc_patch_construct_codim 0 -mg_levels_pc_patch_construct_type vanka \
1120:           -mg_levels_sub_ksp_type preonly -mg_levels_sub_pc_type lu \
1121:         -mg_coarse_pc_type svd

1123:   test:
1124:     requires: !single
1125:     suffix: bddc_quad
1126:     nsize: 5
1127:     args: -run_type full -dm_refine 2 -bc_type dirichlet -interpolate 1 -vel_petscspace_degree 2 -pres_petscspace_degree 1 -snes_view -snes_error_if_not_converged -dm_mat_type is -ksp_type gmres -ksp_rtol 1.e-8 -pc_type bddc -pc_bddc_corner_selection -pc_bddc_dirichlet_pc_type svd -pc_bddc_neumann_pc_type svd -pc_bddc_coarse_redundant_pc_type svd -simplex 0 -petscpartitioner_type simple -ksp_monitor_short -pc_bddc_symmetric 0

1129: TEST*/