Actual source code: ex45.c

petsc-main 2021-04-20
Report Typos and Errors
  1: static char help[] = "Heat Equation in 2d and 3d with finite elements.\n\
  2: We solve the heat equation in a rectangular\n\
  3: domain, using a parallel unstructured mesh (DMPLEX) to discretize it.\n\
  4: Contributed by: Julian Andrej <juan@tf.uni-kiel.de>\n\n\n";

  6: #include <petscdmplex.h>
  7: #include <petscds.h>
  8: #include <petscts.h>

 10: /*
 11:   Heat equation:

 13:     du/dt - \Delta u + f = 0
 14: */

 16: typedef enum {SOL_QUADRATIC_LINEAR, SOL_QUADRATIC_TRIG, SOL_TRIG_LINEAR, NUM_SOLUTION_TYPES} SolutionType;
 17: const char *solutionTypes[NUM_SOLUTION_TYPES+1] = {"quadratic_linear", "quadratic_trig", "trig_linear", "unknown"};

 19: typedef struct {
 20:   char         filename[PETSC_MAX_PATH_LEN];   /* Mesh filename */
 21:   char         bdfilename[PETSC_MAX_PATH_LEN]; /* Mesh boundary filename */
 22:   PetscReal    scale;                          /* Scale factor for mesh */
 23:   SolutionType solType;                        /* Type of exact solution */
 24: } AppCtx;

 26: /*
 27: Exact 2D solution:
 28:   u = 2t + x^2 + y^2
 29:   F(u) = 2 - (2 + 2) + 2 = 0

 31: Exact 3D solution:
 32:   u = 3t + x^2 + y^2 + z^2
 33:   F(u) = 3 - (2 + 2 + 2) + 3 = 0
 34: */
 35: static PetscErrorCode mms_quad_lin(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
 36: {
 37:   PetscInt d;

 39:   *u = dim*time;
 40:   for (d = 0; d < dim; ++d) *u += x[d]*x[d];
 41:   return 0;
 42: }

 44: static PetscErrorCode mms_quad_lin_t(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
 45: {
 46:   *u = dim;
 47:   return 0;
 48: }

 50: static void f0_quad_lin(PetscInt dim, PetscInt Nf, PetscInt NfAux,
 51:                         const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
 52:                         const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
 53:                         PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
 54: {
 55:   f0[0] = u_t[0] + (PetscScalar) dim;
 56: }

 58: /*
 59: Exact 2D solution:
 60:   u = 2*cos(t) + x^2 + y^2
 61:   F(u) = -2*sint(t) - (2 + 2) + 2*sin(t) + 4 = 0

 63: Exact 3D solution:
 64:   u = 3*cos(t) + x^2 + y^2 + z^2
 65:   F(u) = -3*sin(t) - (2 + 2 + 2) + 3*sin(t) + 6 = 0
 66: */
 67: static PetscErrorCode mms_quad_trig(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
 68: {
 69:   PetscInt d;

 71:   *u = dim*PetscCosReal(time);
 72:   for (d = 0; d < dim; ++d) *u += x[d]*x[d];
 73:   return 0;
 74: }

 76: static PetscErrorCode mms_quad_trig_t(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
 77: {
 78:   *u = -dim*PetscSinReal(time);
 79:   return 0;
 80: }

 82: static void f0_quad_trig(PetscInt dim, PetscInt Nf, PetscInt NfAux,
 83:                          const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
 84:                          const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
 85:                          PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
 86: {
 87:   f0[0] = u_t[0] + dim*(PetscSinReal(t) + 2.0);
 88: }

 90: /*
 91: Exact 2D solution:
 92:   u = 2\pi^2 t + cos(\pi x) + cos(\pi y)
 93:   F(u) = 2\pi^2 - \pi^2 (cos(\pi x) + cos(\pi y)) + \pi^2 (cos(\pi x) + cos(\pi y)) - 2\pi^2 = 0

 95: Exact 3D solution:
 96:   u = 3\pi^2 t + cos(\pi x) + cos(\pi y) + cos(\pi z)
 97:   F(u) = 3\pi^2 - \pi^2 (cos(\pi x) + cos(\pi y) + cos(\pi z)) + \pi^2 (cos(\pi x) + cos(\pi y) + cos(\pi z)) - 3\pi^2 = 0
 98: */
 99: static PetscErrorCode mms_trig_lin(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
100: {
101:   PetscInt d;

103:   *u = dim*PetscSqr(PETSC_PI)*time;
104:   for (d = 0; d < dim; ++d) *u += PetscCosReal(PETSC_PI*x[d]);
105:   return 0;
106: }

108: static PetscErrorCode mms_trig_lin_t(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
109: {
110:   *u = dim*PetscSqr(PETSC_PI);
111:   return 0;
112: }

114: static void f0_trig_lin(PetscInt dim, PetscInt Nf, PetscInt NfAux,
115:                         const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
116:                         const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
117:                         PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
118: {
119:   PetscInt d;
120:   f0[0] = u_t[0];
121:   for (d = 0; d < dim; ++d) f0[0] += PetscSqr(PETSC_PI)*(PetscCosReal(PETSC_PI*x[d]) - 1.0);
122: }

124: static void f1_temp(PetscInt dim, PetscInt Nf, PetscInt NfAux,
125:                     const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
126:                     const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
127:                     PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f1[])
128: {
129:   PetscInt d;
130:   for (d = 0; d < dim; ++d) f1[d] = u_x[d];
131: }

133: static void g3_temp(PetscInt dim, PetscInt Nf, PetscInt NfAux,
134:                     const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
135:                     const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
136:                     PetscReal t, PetscReal u_tShift, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g3[])
137: {
138:   PetscInt d;
139:   for (d = 0; d < dim; ++d) g3[d*dim+d] = 1.0;
140: }

142: static void g0_temp(PetscInt dim, PetscInt Nf, PetscInt NfAux,
143:                     const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
144:                     const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
145:                     PetscReal t, PetscReal u_tShift, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g0[])
146: {
147:   g0[0] = u_tShift*1.0;
148: }

150: static PetscErrorCode ProcessOptions(MPI_Comm comm, AppCtx *options)
151: {
152:   PetscInt       sol;

156:   options->filename[0]   = '\0';
157:   options->bdfilename[0] = '\0';
158:   options->scale         = 0.0;
159:   options->solType       = SOL_QUADRATIC_LINEAR;

161:   PetscOptionsBegin(comm, "", "Heat Equation Options", "DMPLEX");
162:   PetscOptionsString("-filename", "The mesh file", "ex45.c", options->filename, options->filename, PETSC_MAX_PATH_LEN, NULL);
163:   PetscOptionsString("-bd_filename", "The mesh boundary file", "ex45.c", options->bdfilename, options->bdfilename, PETSC_MAX_PATH_LEN, NULL);
164:   PetscOptionsReal("-scale", "Scale factor for the mesh", "ex45.c", options->scale, &options->scale, NULL);
165:   sol  = options->solType;
166:   PetscOptionsEList("-sol_type", "Type of exact solution", "ex45.c", solutionTypes, NUM_SOLUTION_TYPES, solutionTypes[options->solType], &sol, NULL);
167:   options->solType = (SolutionType) sol;
168:   PetscOptionsEnd();
169:   return(0);
170: }

172: static PetscErrorCode CreateBCLabel(DM dm, const char name[])
173: {
174:   DM             plex;
175:   DMLabel        label;
176:   PetscBool      hasLabel;

180:   DMHasLabel(dm, name, &hasLabel);
181:   if (hasLabel) return(0);
182:   DMCreateLabel(dm, name);
183:   DMGetLabel(dm, name, &label);
184:   DMConvert(dm, DMPLEX, &plex);
185:   DMPlexMarkBoundaryFaces(plex, 1, label);
186:   DMDestroy(&plex);
187:   return(0);
188: }

190: static PetscErrorCode CreateMesh(MPI_Comm comm, DM *dm, AppCtx *ctx)
191: {
192:   size_t         len, lenbd;

196:   PetscStrlen(ctx->filename,   &len);
197:   PetscStrlen(ctx->bdfilename, &lenbd);
198:   if (lenbd) {
199:     DM bdm;

201:     DMPlexCreateFromFile(comm, ctx->bdfilename, PETSC_TRUE, &bdm);
202:     PetscObjectSetOptionsPrefix((PetscObject) bdm, "bd_");
203:     DMSetFromOptions(bdm);
204:     if (ctx->scale != 0.0) {
205:       Vec coordinates, coordinatesLocal;

207:       DMGetCoordinates(bdm, &coordinates);
208:       DMGetCoordinatesLocal(bdm, &coordinatesLocal);
209:       VecScale(coordinates, ctx->scale);
210:       VecScale(coordinatesLocal, ctx->scale);
211:     }
212:     DMViewFromOptions(bdm, NULL, "-dm_view");
213:     DMPlexGenerate(bdm, NULL, PETSC_TRUE, dm);
214:     DMDestroy(&bdm);
215:   } else if (len) {
216:     DMPlexCreateFromFile(comm, ctx->filename, PETSC_TRUE, dm);
217:   } else {
218:     DMPlexCreateBoxMesh(comm, 2, PETSC_TRUE, NULL, NULL, NULL, NULL, PETSC_TRUE, dm);
219:   }
220:   DMSetFromOptions(*dm);
221:   PetscObjectSetName((PetscObject) *dm, "Mesh");
222:   CreateBCLabel(*dm, "marker");
223:   DMViewFromOptions(*dm, NULL, "-dm_view");
224:   return(0);
225: }

227: static PetscErrorCode SetupProblem(DM dm, AppCtx *ctx)
228: {
229:   PetscDS        ds;
230:   DMLabel        label;
231:   const PetscInt id = 1;

235:   DMGetLabel(dm, "marker", &label);
236:   DMGetDS(dm, &ds);
237:   PetscDSSetJacobian(ds, 0, 0, g0_temp, NULL, NULL, g3_temp);
238:   switch (ctx->solType) {
239:     case SOL_QUADRATIC_LINEAR:
240:       PetscDSSetResidual(ds, 0, f0_quad_lin,  f1_temp);
241:       PetscDSSetExactSolution(ds, 0, mms_quad_lin, ctx);
242:       PetscDSSetExactSolutionTimeDerivative(ds, 0, mms_quad_lin_t, ctx);
243:       DMAddBoundary(dm, DM_BC_ESSENTIAL, "wall", label, 1, &id, 0, 0, NULL, (void (*)(void)) mms_quad_lin, (void (*)(void)) mms_quad_lin_t, ctx, NULL);
244:       break;
245:     case SOL_QUADRATIC_TRIG:
246:       PetscDSSetResidual(ds, 0, f0_quad_trig, f1_temp);
247:       PetscDSSetExactSolution(ds, 0, mms_quad_trig, ctx);
248:       PetscDSSetExactSolutionTimeDerivative(ds, 0, mms_quad_trig_t, ctx);
249:       DMAddBoundary(dm, DM_BC_ESSENTIAL, "wall", label, 1, &id, 0, 0, NULL, (void (*)(void)) mms_quad_trig, (void (*)(void)) mms_quad_trig_t, ctx, NULL);
250:       break;
251:     case SOL_TRIG_LINEAR:
252:       PetscDSSetResidual(ds, 0, f0_trig_lin,  f1_temp);
253:       PetscDSSetExactSolution(ds, 0, mms_trig_lin, ctx);
254:       PetscDSSetExactSolutionTimeDerivative(ds, 0, mms_trig_lin_t, ctx);
255:       DMAddBoundary(dm, DM_BC_ESSENTIAL, "wall", label, 1, &id, 0, 0, NULL, (void (*)(void)) mms_trig_lin, (void (*)(void)) mms_trig_lin_t, ctx, NULL);
256:       break;
257:     default: SETERRQ2(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "Invalid solution type: %s (%D)", solutionTypes[PetscMin(ctx->solType, NUM_SOLUTION_TYPES)], ctx->solType);
258:   }
259:   return(0);
260: }

262: static PetscErrorCode SetupDiscretization(DM dm, AppCtx* ctx)
263: {
264:   DM             cdm = dm;
265:   PetscFE        fe;
266:   DMPolytopeType ct;
267:   PetscBool      simplex;
268:   PetscInt       dim, cStart;

272:   DMGetDimension(dm, &dim);
273:   DMPlexGetHeightStratum(dm, 0, &cStart, NULL);
274:   DMPlexGetCellType(dm, cStart, &ct);
275:   simplex = DMPolytopeTypeGetNumVertices(ct) == DMPolytopeTypeGetDim(ct)+1 ? PETSC_TRUE : PETSC_FALSE;
276:   /* Create finite element */
277:   PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, "temp_", -1, &fe);
278:   PetscObjectSetName((PetscObject) fe, "temperature");
279:   /* Set discretization and boundary conditions for each mesh */
280:   DMSetField(dm, 0, NULL, (PetscObject) fe);
281:   DMCreateDS(dm);
282:   SetupProblem(dm, ctx);
283:   while (cdm) {
284:     CreateBCLabel(cdm, "marker");
285:     DMCopyDisc(dm, cdm);
286:     DMGetCoarseDM(cdm, &cdm);
287:   }
288:   PetscFEDestroy(&fe);
289:   return(0);
290: }

292: static PetscErrorCode SetInitialConditions(TS ts, Vec u)
293: {
294:   DM             dm;
295:   PetscReal      t;

299:   TSGetDM(ts, &dm);
300:   TSGetTime(ts, &t);
301:   DMComputeExactSolution(dm, t, u, NULL);
302:   return(0);
303: }

305: int main(int argc, char **argv)
306: {
307:   DM             dm;
308:   TS             ts;
309:   Vec            u;
310:   AppCtx         ctx;

313:   PetscInitialize(&argc, &argv, NULL, help);if (ierr) return ierr;
314:   ProcessOptions(PETSC_COMM_WORLD, &ctx);
315:   CreateMesh(PETSC_COMM_WORLD, &dm, &ctx);
316:   DMSetApplicationContext(dm, &ctx);
317:   SetupDiscretization(dm, &ctx);

319:   TSCreate(PETSC_COMM_WORLD, &ts);
320:   TSSetDM(ts, dm);
321:   DMTSSetBoundaryLocal(dm, DMPlexTSComputeBoundary, &ctx);
322:   DMTSSetIFunctionLocal(dm, DMPlexTSComputeIFunctionFEM, &ctx);
323:   DMTSSetIJacobianLocal(dm, DMPlexTSComputeIJacobianFEM, &ctx);
324:   TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
325:   TSSetFromOptions(ts);
326:   TSSetComputeInitialCondition(ts, SetInitialConditions);

328:   DMCreateGlobalVector(dm, &u);
329:   DMTSCheckFromOptions(ts, u);
330:   SetInitialConditions(ts, u);
331:   PetscObjectSetName((PetscObject) u, "temperature");
332:   TSSolve(ts, u);
333:   DMTSCheckFromOptions(ts, u);

335:   VecDestroy(&u);
336:   TSDestroy(&ts);
337:   DMDestroy(&dm);
338:   PetscFinalize();
339:   return ierr;
340: }

342: /*TEST

344:   test:
345:     suffix: 2d_p1
346:     requires: triangle
347:     args: -sol_type quadratic_linear -dm_refine 1 -temp_petscspace_degree 1 -dmts_check .0001 \
348:           -ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
349:   test:
350:     # -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [1.9]
351:     suffix: 2d_p1_sconv
352:     requires: triangle
353:     args: -sol_type quadratic_linear -temp_petscspace_degree 1 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
354:           -ts_type beuler -ts_max_steps 1 -ts_dt 0.00001 -snes_error_if_not_converged -pc_type lu
355:   test:
356:     # -dm_refine 4 -convest_num_refine 3 get L_2 convergence rate: [1.2]
357:     suffix: 2d_p1_tconv
358:     requires: triangle
359:     args: -sol_type quadratic_trig -temp_petscspace_degree 1 -ts_convergence_estimate -convest_num_refine 1 \
360:           -ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
361:   test:
362:     suffix: 2d_p2
363:     requires: triangle
364:     args: -sol_type quadratic_linear -dm_refine 0 -temp_petscspace_degree 2 -dmts_check .0001 \
365:           -ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
366:   test:
367:     # -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [2.9]
368:     suffix: 2d_p2_sconv
369:     requires: triangle
370:     args: -sol_type trig_linear -temp_petscspace_degree 2 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
371:           -ts_type beuler -ts_max_steps 1 -ts_dt 0.00000001 -snes_error_if_not_converged -pc_type lu
372:   test:
373:     # -dm_refine 3 -convest_num_refine 3 get L_2 convergence rate: [1.0]
374:     suffix: 2d_p2_tconv
375:     requires: triangle
376:     args: -sol_type quadratic_trig -temp_petscspace_degree 2 -ts_convergence_estimate -convest_num_refine 1 \
377:           -ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
378:   test:
379:     suffix: 2d_q1
380:     args: -sol_type quadratic_linear -dm_plex_box_simplex 0 -dm_refine 1 -temp_petscspace_degree 1 -dmts_check .0001 \
381:           -ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
382:   test:
383:     # -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [1.9]
384:     suffix: 2d_q1_sconv
385:     args: -sol_type quadratic_linear -dm_plex_box_simplex 0 -temp_petscspace_degree 1 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
386:           -ts_type beuler -ts_max_steps 1 -ts_dt 0.00001 -snes_error_if_not_converged -pc_type lu
387:   test:
388:     # -dm_refine 4 -convest_num_refine 3 get L_2 convergence rate: [1.2]
389:     suffix: 2d_q1_tconv
390:     args: -sol_type quadratic_trig -dm_plex_box_simplex 0 -temp_petscspace_degree 1 -ts_convergence_estimate -convest_num_refine 1 \
391:           -ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
392:   test:
393:     suffix: 2d_q2
394:     args: -sol_type quadratic_linear -dm_plex_box_simplex 0 -dm_refine 0 -temp_petscspace_degree 2 -dmts_check .0001 \
395:           -ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
396:   test:
397:     # -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [2.9]
398:     suffix: 2d_q2_sconv
399:     args: -sol_type trig_linear -dm_plex_box_simplex 0 -temp_petscspace_degree 2 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
400:           -ts_type beuler -ts_max_steps 1 -ts_dt 0.00000001 -snes_error_if_not_converged -pc_type lu
401:   test:
402:     # -dm_refine 3 -convest_num_refine 3 get L_2 convergence rate: [1.0]
403:     suffix: 2d_q2_tconv
404:     args: -sol_type quadratic_trig -dm_plex_box_simplex 0 -temp_petscspace_degree 2 -ts_convergence_estimate -convest_num_refine 1 \
405:           -ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu

407:   test:
408:     suffix: 3d_p1
409:     requires: ctetgen
410:     args: -sol_type quadratic_linear -dm_refine 1 -temp_petscspace_degree 1 -dmts_check .0001 \
411:           -ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
412:   test:
413:     # -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [1.9]
414:     suffix: 3d_p1_sconv
415:     requires: ctetgen
416:     args: -sol_type quadratic_linear -temp_petscspace_degree 1 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
417:           -ts_type beuler -ts_max_steps 1 -ts_dt 0.00001 -snes_error_if_not_converged -pc_type lu
418:   test:
419:     # -dm_refine 4 -convest_num_refine 3 get L_2 convergence rate: [1.2]
420:     suffix: 3d_p1_tconv
421:     requires: ctetgen
422:     args: -sol_type quadratic_trig -temp_petscspace_degree 1 -ts_convergence_estimate -convest_num_refine 1 \
423:           -ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
424:   test:
425:     suffix: 3d_p2
426:     requires: ctetgen
427:     args: -sol_type quadratic_linear -dm_refine 0 -temp_petscspace_degree 2 -dmts_check .0001 \
428:           -ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
429:   test:
430:     # -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [2.9]
431:     suffix: 3d_p2_sconv
432:     requires: ctetgen
433:     args: -sol_type trig_linear -temp_petscspace_degree 2 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
434:           -ts_type beuler -ts_max_steps 1 -ts_dt 0.00000001 -snes_error_if_not_converged -pc_type lu
435:   test:
436:     # -dm_refine 3 -convest_num_refine 3 get L_2 convergence rate: [1.0]
437:     suffix: 3d_p2_tconv
438:     requires: ctetgen
439:     args: -sol_type quadratic_trig -temp_petscspace_degree 2 -ts_convergence_estimate -convest_num_refine 1 \
440:           -ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
441:   test:
442:     suffix: 3d_q1
443:     args: -sol_type quadratic_linear -dm_plex_box_simplex 0 -dm_refine 1 -temp_petscspace_degree 1 -dmts_check .0001 \
444:           -ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
445:   test:
446:     # -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [1.9]
447:     suffix: 3d_q1_sconv
448:     args: -sol_type quadratic_linear -dm_plex_box_simplex 0 -temp_petscspace_degree 1 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
449:           -ts_type beuler -ts_max_steps 1 -ts_dt 0.00001 -snes_error_if_not_converged -pc_type lu
450:   test:
451:     # -dm_refine 4 -convest_num_refine 3 get L_2 convergence rate: [1.2]
452:     suffix: 3d_q1_tconv
453:     args: -sol_type quadratic_trig -dm_plex_box_simplex 0 -temp_petscspace_degree 1 -ts_convergence_estimate -convest_num_refine 1 \
454:           -ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
455:   test:
456:     suffix: 3d_q2
457:     args: -sol_type quadratic_linear -dm_plex_box_simplex 0 -dm_refine 0 -temp_petscspace_degree 2 -dmts_check .0001 \
458:           -ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
459:   test:
460:     # -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [2.9]
461:     suffix: 3d_q2_sconv
462:     args: -sol_type trig_linear -dm_plex_box_simplex 0 -temp_petscspace_degree 2 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
463:           -ts_type beuler -ts_max_steps 1 -ts_dt 0.00000001 -snes_error_if_not_converged -pc_type lu
464:   test:
465:     # -dm_refine 3 -convest_num_refine 3 get L_2 convergence rate: [1.0]
466:     suffix: 3d_q2_tconv
467:     args: -sol_type quadratic_trig -dm_plex_box_simplex 0 -temp_petscspace_degree 2 -ts_convergence_estimate -convest_num_refine 1 \
468:           -ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu

470:   test:
471:     # For a nice picture, -bd_dm_refine 2 -dm_refine 1 -dm_view hdf5:${PETSC_DIR}/sol.h5 -ts_monitor_solution hdf5:${PETSC_DIR}/sol.h5::append
472:     suffix: egads_sphere
473:     requires: egads ctetgen
474:     args: -sol_type quadratic_linear -bd_filename ${wPETSC_DIR}/share/petsc/datafiles/meshes/unit_sphere.egadslite -scale 40 \
475:           -temp_petscspace_degree 2 -dmts_check .0001 \
476:           -ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu

478: TEST*/