forked from mmcgurn/petscDebug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex45.c
535 lines (486 loc) · 25.7 KB
/
ex45.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
static char help[] = "Heat Equation in 2d and 3d with finite elements.\n\
We solve the heat equation in a rectangular\n\
domain, using a parallel unstructured mesh (DMPLEX) to discretize it.\n\
Contributed by: Julian Andrej <juan@tf.uni-kiel.de>\n\n\n";
#include <petscdmplex.h>
#include <petscds.h>
#include <petscts.h>
/*
Heat equation:
du/dt - \Delta u + f = 0
*/
typedef enum {
SOL_QUADRATIC_LINEAR,
SOL_QUADRATIC_TRIG,
SOL_TRIG_LINEAR,
SOL_TRIG_TRIG,
NUM_SOLUTION_TYPES
} SolutionType;
const char *solutionTypes[NUM_SOLUTION_TYPES + 1] = {"quadratic_linear", "quadratic_trig", "trig_linear", "trig_trig", "unknown"};
typedef struct {
SolutionType solType; /* Type of exact solution */
/* Solver setup */
PetscBool expTS; /* Flag for explicit timestepping */
PetscBool lumped; /* Lump the mass matrix */
} AppCtx;
/*
Exact 2D solution:
u = 2t + x^2 + y^2
u_t = 2
\Delta u = 2 + 2 = 4
f = 2
F(u) = 2 - (2 + 2) + 2 = 0
Exact 3D solution:
u = 3t + x^2 + y^2 + z^2
F(u) = 3 - (2 + 2 + 2) + 3 = 0
*/
static PetscErrorCode mms_quad_lin(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
{
PetscInt d;
*u = dim * time;
for (d = 0; d < dim; ++d) *u += x[d] * x[d];
return PETSC_SUCCESS;
}
static PetscErrorCode mms_quad_lin_t(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
{
*u = dim;
return PETSC_SUCCESS;
}
static void f0_quad_lin_exp(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
{
f0[0] = -(PetscScalar)dim;
}
static void f0_quad_lin(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
{
PetscScalar exp[1] = {0.};
f0_quad_lin_exp(dim, Nf, NfAux, uOff, uOff_x, u, u_t, u_x, aOff, aOff_x, a, a_t, a_x, t, x, numConstants, constants, exp);
f0[0] = u_t[0] - exp[0];
}
/*
Exact 2D solution:
u = 2*cos(t) + x^2 + y^2
F(u) = -2*sint(t) - (2 + 2) + 2*sin(t) + 4 = 0
Exact 3D solution:
u = 3*cos(t) + x^2 + y^2 + z^2
F(u) = -3*sin(t) - (2 + 2 + 2) + 3*sin(t) + 6 = 0
*/
static PetscErrorCode mms_quad_trig(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
{
PetscInt d;
*u = dim * PetscCosReal(time);
for (d = 0; d < dim; ++d) *u += x[d] * x[d];
return PETSC_SUCCESS;
}
static PetscErrorCode mms_quad_trig_t(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
{
*u = -dim * PetscSinReal(time);
return PETSC_SUCCESS;
}
static void f0_quad_trig_exp(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
{
f0[0] = -dim * (PetscSinReal(t) + 2.0);
}
static void f0_quad_trig(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
{
PetscScalar exp[1] = {0.};
f0_quad_trig_exp(dim, Nf, NfAux, uOff, uOff_x, u, u_t, u_x, aOff, aOff_x, a, a_t, a_x, t, x, numConstants, constants, exp);
f0[0] = u_t[0] - exp[0];
}
/*
Exact 2D solution:
u = 2\pi^2 t + cos(\pi x) + cos(\pi y)
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
Exact 3D solution:
u = 3\pi^2 t + cos(\pi x) + cos(\pi y) + cos(\pi z)
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
*/
static PetscErrorCode mms_trig_lin(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
{
PetscInt d;
*u = dim * PetscSqr(PETSC_PI) * time;
for (d = 0; d < dim; ++d) *u += PetscCosReal(PETSC_PI * x[d]);
return PETSC_SUCCESS;
}
static PetscErrorCode mms_trig_lin_t(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
{
*u = dim * PetscSqr(PETSC_PI);
return PETSC_SUCCESS;
}
static void f0_trig_lin(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
{
PetscInt d;
f0[0] = u_t[0];
for (d = 0; d < dim; ++d) f0[0] += PetscSqr(PETSC_PI) * (PetscCosReal(PETSC_PI * x[d]) - 1.0);
}
/*
Exact 2D solution:
u = pi^2 cos(t) + cos(\pi x) + cos(\pi y)
u_t = -pi^2 sin(t)
\Delta u = -\pi^2 (cos(\pi x) + cos(\pi y))
f = pi^2 sin(t) - \pi^2 (cos(\pi x) + cos(\pi y))
F(u) = -\pi^2 sin(t) + \pi^2 (cos(\pi x) + cos(\pi y)) - \pi^2 (cos(\pi x) + cos(\pi y)) + \pi^2 sin(t) = 0
Exact 3D solution:
u = pi^2 cos(t) + cos(\pi x) + cos(\pi y) + cos(\pi z)
u_t = -pi^2 sin(t)
\Delta u = -\pi^2 (cos(\pi x) + cos(\pi y) + cos(\pi z))
f = pi^2 sin(t) - \pi^2 (cos(\pi x) + cos(\pi y) + cos(\pi z))
F(u) = -\pi^2 sin(t) + \pi^2 (cos(\pi x) + cos(\pi y) + cos(\pi z)) - \pi^2 (cos(\pi x) + cos(\pi y) + cos(\pi z)) + \pi^2 sin(t) = 0
*/
static PetscErrorCode mms_trig_trig(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
{
PetscInt d;
*u = PetscSqr(PETSC_PI) * PetscCosReal(time);
for (d = 0; d < dim; ++d) *u += PetscCosReal(PETSC_PI * x[d]);
return PETSC_SUCCESS;
}
static PetscErrorCode mms_trig_trig_t(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
{
*u = -PetscSqr(PETSC_PI) * PetscSinReal(time);
return PETSC_SUCCESS;
}
static void f0_trig_trig_exp(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
{
PetscInt d;
f0[0] -= PetscSqr(PETSC_PI) * PetscSinReal(t);
for (d = 0; d < dim; ++d) f0[0] += PetscSqr(PETSC_PI) * PetscCosReal(PETSC_PI * x[d]);
}
static void f0_trig_trig(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
{
PetscScalar exp[1] = {0.};
f0_trig_trig_exp(dim, Nf, NfAux, uOff, uOff_x, u, u_t, u_x, aOff, aOff_x, a, a_t, a_x, t, x, numConstants, constants, exp);
f0[0] = u_t[0] - exp[0];
}
static void f1_temp_exp(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f1[])
{
for (PetscInt d = 0; d < dim; ++d) f1[d] = -u_x[d];
}
static void f1_temp(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f1[])
{
for (PetscInt d = 0; d < dim; ++d) f1[d] = u_x[d];
}
static void g3_temp(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, PetscReal u_tShift, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g3[])
{
for (PetscInt d = 0; d < dim; ++d) g3[d * dim + d] = 1.0;
}
static void g0_temp(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, PetscReal u_tShift, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g0[])
{
g0[0] = u_tShift * 1.0;
}
static PetscErrorCode ProcessOptions(MPI_Comm comm, AppCtx *options)
{
PetscInt sol;
PetscFunctionBeginUser;
options->solType = SOL_QUADRATIC_LINEAR;
options->expTS = PETSC_FALSE;
options->lumped = PETSC_TRUE;
PetscOptionsBegin(comm, "", "Heat Equation Options", "DMPLEX");
PetscCall(PetscOptionsEList("-sol_type", "Type of exact solution", "ex45.c", solutionTypes, NUM_SOLUTION_TYPES, solutionTypes[options->solType], &sol, NULL));
options->solType = (SolutionType)sol;
PetscCall(PetscOptionsBool("-explicit", "Use explicit timestepping", "ex45.c", options->expTS, &options->expTS, NULL));
PetscCall(PetscOptionsBool("-lumped", "Lump the mass matrix", "ex45.c", options->lumped, &options->lumped, NULL));
PetscOptionsEnd();
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode CreateMesh(MPI_Comm comm, DM *dm, AppCtx *ctx)
{
PetscFunctionBeginUser;
PetscCall(DMCreate(comm, dm));
PetscCall(DMSetType(*dm, DMPLEX));
PetscCall(DMSetFromOptions(*dm));
PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view"));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode SetupProblem(DM dm, AppCtx *ctx)
{
PetscDS ds;
DMLabel label;
const PetscInt id = 1;
PetscFunctionBeginUser;
PetscCall(DMGetLabel(dm, "marker", &label));
PetscCall(DMGetDS(dm, &ds));
PetscCall(PetscDSSetJacobian(ds, 0, 0, g0_temp, NULL, NULL, g3_temp));
switch (ctx->solType) {
case SOL_QUADRATIC_LINEAR:
PetscCall(PetscDSSetResidual(ds, 0, f0_quad_lin, f1_temp));
PetscCall(PetscDSSetRHSResidual(ds, 0, f0_quad_lin_exp, f1_temp_exp));
PetscCall(PetscDSSetExactSolution(ds, 0, mms_quad_lin, ctx));
PetscCall(PetscDSSetExactSolutionTimeDerivative(ds, 0, mms_quad_lin_t, ctx));
PetscCall(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));
break;
case SOL_QUADRATIC_TRIG:
PetscCall(PetscDSSetResidual(ds, 0, f0_quad_trig, f1_temp));
PetscCall(PetscDSSetRHSResidual(ds, 0, f0_quad_trig_exp, f1_temp_exp));
PetscCall(PetscDSSetExactSolution(ds, 0, mms_quad_trig, ctx));
PetscCall(PetscDSSetExactSolutionTimeDerivative(ds, 0, mms_quad_trig_t, ctx));
PetscCall(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));
break;
case SOL_TRIG_LINEAR:
PetscCall(PetscDSSetResidual(ds, 0, f0_trig_lin, f1_temp));
PetscCall(PetscDSSetExactSolution(ds, 0, mms_trig_lin, ctx));
PetscCall(PetscDSSetExactSolutionTimeDerivative(ds, 0, mms_trig_lin_t, ctx));
PetscCall(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));
break;
case SOL_TRIG_TRIG:
PetscCall(PetscDSSetResidual(ds, 0, f0_trig_trig, f1_temp));
PetscCall(PetscDSSetRHSResidual(ds, 0, f0_trig_trig_exp, f1_temp_exp));
PetscCall(PetscDSSetExactSolution(ds, 0, mms_trig_trig, ctx));
PetscCall(PetscDSSetExactSolutionTimeDerivative(ds, 0, mms_trig_trig_t, ctx));
break;
default:
SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Invalid solution type: %s (%d)", solutionTypes[PetscMin(ctx->solType, NUM_SOLUTION_TYPES)], ctx->solType);
}
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode SetupDiscretization(DM dm, AppCtx *ctx)
{
DM cdm = dm;
PetscFE fe;
DMPolytopeType ct;
PetscInt dim, cStart;
PetscFunctionBeginUser;
PetscCall(DMGetDimension(dm, &dim));
PetscCall(DMPlexGetHeightStratum(dm, 0, &cStart, NULL));
PetscCall(DMPlexGetCellType(dm, cStart, &ct));
/* Create finite element */
PetscCall(PetscFECreateByCell(PETSC_COMM_SELF, dim, 1, ct, "temp_", -1, &fe));
PetscCall(PetscObjectSetName((PetscObject)fe, "temperature"));
/* Set discretization and boundary conditions for each mesh */
PetscCall(DMSetField(dm, 0, NULL, (PetscObject)fe));
PetscCall(DMCreateDS(dm));
if (ctx->expTS) {
PetscDS ds;
PetscCall(DMGetDS(dm, &ds));
PetscCall(PetscDSSetImplicit(ds, 0, PETSC_FALSE));
}
PetscCall(SetupProblem(dm, ctx));
while (cdm) {
PetscCall(DMCopyDisc(dm, cdm));
PetscCall(DMGetCoarseDM(cdm, &cdm));
}
PetscCall(PetscFEDestroy(&fe));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode SetInitialConditions(TS ts, Vec u)
{
DM dm;
PetscReal t;
PetscFunctionBeginUser;
PetscCall(TSGetDM(ts, &dm));
PetscCall(TSGetTime(ts, &t));
PetscCall(DMComputeExactSolution(dm, t, u, NULL));
PetscFunctionReturn(PETSC_SUCCESS);
}
int main(int argc, char **argv)
{
DM dm;
TS ts;
Vec u;
AppCtx ctx;
PetscFunctionBeginUser;
PetscCall(PetscInitialize(&argc, &argv, NULL, help));
PetscCall(ProcessOptions(PETSC_COMM_WORLD, &ctx));
PetscCall(CreateMesh(PETSC_COMM_WORLD, &dm, &ctx));
PetscCall(DMSetApplicationContext(dm, &ctx));
PetscCall(SetupDiscretization(dm, &ctx));
PetscCall(TSCreate(PETSC_COMM_WORLD, &ts));
PetscCall(TSSetDM(ts, dm));
PetscCall(DMTSSetBoundaryLocal(dm, DMPlexTSComputeBoundary, &ctx));
if (ctx.expTS) {
PetscCall(DMTSSetRHSFunctionLocal(dm, DMPlexTSComputeRHSFunctionFEM, &ctx));
if (ctx.lumped) PetscCall(DMTSCreateRHSMassMatrixLumped(dm));
else PetscCall(DMTSCreateRHSMassMatrix(dm));
} else {
PetscCall(DMTSSetIFunctionLocal(dm, DMPlexTSComputeIFunctionFEM, &ctx));
PetscCall(DMTSSetIJacobianLocal(dm, DMPlexTSComputeIJacobianFEM, &ctx));
}
PetscCall(TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP));
PetscCall(TSSetFromOptions(ts));
PetscCall(TSSetComputeInitialCondition(ts, SetInitialConditions));
PetscCall(DMCreateGlobalVector(dm, &u));
PetscCall(DMTSCheckFromOptions(ts, u));
PetscCall(SetInitialConditions(ts, u));
PetscCall(PetscObjectSetName((PetscObject)u, "temperature"));
PetscCall(TSSolve(ts, u));
PetscCall(DMTSCheckFromOptions(ts, u));
if (ctx.expTS) PetscCall(DMTSDestroyRHSMassMatrix(dm));
PetscCall(VecDestroy(&u));
PetscCall(TSDestroy(&ts));
PetscCall(DMDestroy(&dm));
PetscCall(PetscFinalize());
return 0;
}
/*TEST
test:
suffix: 2d_p1
requires: triangle
args: -sol_type quadratic_linear -dm_refine 1 -temp_petscspace_degree 1 -dmts_check .0001 \
-ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
suffix: 2d_p1_exp
requires: triangle
args: -sol_type quadratic_linear -dm_refine 1 -temp_petscspace_degree 1 -explicit \
-ts_type euler -ts_max_steps 4 -ts_dt 1e-3 -ts_monitor_error
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [1.9]
suffix: 2d_p1_sconv
requires: triangle
args: -sol_type quadratic_linear -temp_petscspace_degree 1 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 0.00001 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [2.1]
suffix: 2d_p1_sconv_2
requires: triangle
args: -sol_type trig_trig -temp_petscspace_degree 1 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 1e-6 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 4 -convest_num_refine 3 get L_2 convergence rate: [1.2]
suffix: 2d_p1_tconv
requires: triangle
args: -sol_type quadratic_trig -temp_petscspace_degree 1 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 6 -convest_num_refine 3 get L_2 convergence rate: [1.0]
suffix: 2d_p1_tconv_2
requires: triangle
args: -sol_type trig_trig -temp_petscspace_degree 1 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# The L_2 convergence rate cannot be seen since stability of the explicit integrator requires that is be more accurate than the grid
suffix: 2d_p1_exp_tconv_2
requires: triangle
args: -sol_type trig_trig -temp_petscspace_degree 1 -explicit -ts_convergence_estimate -convest_num_refine 1 \
-ts_type euler -ts_max_steps 4 -ts_dt 1e-4 -lumped 0 -mass_pc_type lu
test:
# The L_2 convergence rate cannot be seen since stability of the explicit integrator requires that is be more accurate than the grid
suffix: 2d_p1_exp_tconv_2_lump
requires: triangle
args: -sol_type trig_trig -temp_petscspace_degree 1 -explicit -ts_convergence_estimate -convest_num_refine 1 \
-ts_type euler -ts_max_steps 4 -ts_dt 1e-4
test:
suffix: 2d_p2
requires: triangle
args: -sol_type quadratic_linear -dm_refine 0 -temp_petscspace_degree 2 -dmts_check .0001 \
-ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [2.9]
suffix: 2d_p2_sconv
requires: triangle
args: -sol_type trig_linear -temp_petscspace_degree 2 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 0.00000001 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [3.1]
suffix: 2d_p2_sconv_2
requires: triangle
args: -sol_type trig_trig -temp_petscspace_degree 2 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 0.00000001 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 3 -convest_num_refine 3 get L_2 convergence rate: [1.0]
suffix: 2d_p2_tconv
requires: triangle
args: -sol_type quadratic_trig -temp_petscspace_degree 2 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 3 -convest_num_refine 3 get L_2 convergence rate: [1.0]
suffix: 2d_p2_tconv_2
requires: triangle
args: -sol_type trig_trig -temp_petscspace_degree 2 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
suffix: 2d_q1
args: -sol_type quadratic_linear -dm_plex_simplex 0 -dm_refine 1 -temp_petscspace_degree 1 -dmts_check .0001 \
-ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [1.9]
suffix: 2d_q1_sconv
args: -sol_type quadratic_linear -dm_plex_simplex 0 -temp_petscspace_degree 1 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 0.00001 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 4 -convest_num_refine 3 get L_2 convergence rate: [1.2]
suffix: 2d_q1_tconv
args: -sol_type quadratic_trig -dm_plex_simplex 0 -temp_petscspace_degree 1 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
suffix: 2d_q2
args: -sol_type quadratic_linear -dm_plex_simplex 0 -dm_refine 0 -temp_petscspace_degree 2 -dmts_check .0001 \
-ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [2.9]
suffix: 2d_q2_sconv
args: -sol_type trig_linear -dm_plex_simplex 0 -temp_petscspace_degree 2 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 0.00000001 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 3 -convest_num_refine 3 get L_2 convergence rate: [1.0]
suffix: 2d_q2_tconv
args: -sol_type quadratic_trig -dm_plex_simplex 0 -temp_petscspace_degree 2 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
suffix: 3d_p1
requires: ctetgen
args: -sol_type quadratic_linear -dm_refine 1 -temp_petscspace_degree 1 -dmts_check .0001 \
-ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [1.9]
suffix: 3d_p1_sconv
requires: ctetgen
args: -sol_type quadratic_linear -temp_petscspace_degree 1 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 0.00001 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 4 -convest_num_refine 3 get L_2 convergence rate: [1.2]
suffix: 3d_p1_tconv
requires: ctetgen
args: -sol_type quadratic_trig -temp_petscspace_degree 1 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
suffix: 3d_p2
requires: ctetgen
args: -sol_type quadratic_linear -dm_refine 0 -temp_petscspace_degree 2 -dmts_check .0001 \
-ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [2.9]
suffix: 3d_p2_sconv
requires: ctetgen
args: -sol_type trig_linear -temp_petscspace_degree 2 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 0.00000001 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 3 -convest_num_refine 3 get L_2 convergence rate: [1.0]
suffix: 3d_p2_tconv
requires: ctetgen
args: -sol_type quadratic_trig -temp_petscspace_degree 2 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
suffix: 3d_q1
args: -sol_type quadratic_linear -dm_plex_simplex 0 -dm_refine 1 -temp_petscspace_degree 1 -dmts_check .0001 \
-ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [1.9]
suffix: 3d_q1_sconv
args: -sol_type quadratic_linear -dm_plex_simplex 0 -temp_petscspace_degree 1 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 0.00001 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 4 -convest_num_refine 3 get L_2 convergence rate: [1.2]
suffix: 3d_q1_tconv
args: -sol_type quadratic_trig -dm_plex_simplex 0 -temp_petscspace_degree 1 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
suffix: 3d_q2
args: -sol_type quadratic_linear -dm_plex_simplex 0 -dm_refine 0 -temp_petscspace_degree 2 -dmts_check .0001 \
-ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 2 -convest_num_refine 3 get L_2 convergence rate: [2.9]
suffix: 3d_q2_sconv
args: -sol_type trig_linear -dm_plex_simplex 0 -temp_petscspace_degree 2 -ts_convergence_estimate -ts_convergence_temporal 0 -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 1 -ts_dt 0.00000001 -snes_error_if_not_converged -pc_type lu
test:
# -dm_refine 3 -convest_num_refine 3 get L_2 convergence rate: [1.0]
suffix: 3d_q2_tconv
args: -sol_type quadratic_trig -dm_plex_simplex 0 -temp_petscspace_degree 2 -ts_convergence_estimate -convest_num_refine 1 \
-ts_type beuler -ts_max_steps 4 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
test:
# 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
suffix: egads_sphere
requires: egads ctetgen
args: -sol_type quadratic_linear \
-dm_plex_boundary_filename ${wPETSC_DIR}/share/petsc/datafiles/meshes/sphere_example.egadslite -dm_plex_boundary_label marker \
-temp_petscspace_degree 2 -dmts_check .0001 \
-ts_type beuler -ts_max_steps 5 -ts_dt 0.1 -snes_error_if_not_converged -pc_type lu
TEST*/