Actual source code: ex12.c
1: static char help[] = "Poisson Problem in 2d and 3d with simplicial finite elements.\n\
2: We solve the Poisson problem in a rectangular\n\
3: domain, using a parallel unstructured mesh (DMPLEX) to discretize it.\n\
4: This example supports discretized auxiliary fields (conductivity) as well as\n\
5: multilevel nonlinear solvers.\n\n\n";
7: /*
8: A visualization of the adaptation can be accomplished using:
10: -dm_adapt_view hdf5:$PWD/adapt.h5 -sol_adapt_view hdf5:$PWD/adapt.h5::append -dm_adapt_pre_view hdf5:$PWD/orig.h5 -sol_adapt_pre_view hdf5:$PWD/orig.h5::append
12: Information on refinement:
14: -info :~sys,vec,is,mat,ksp,snes,ts
15: */
17: #include <petscdmplex.h>
18: #include <petscdmadaptor.h>
19: #include <petscsnes.h>
20: #include <petscds.h>
21: #include <petscviewerhdf5.h>
23: typedef enum {
24: NEUMANN,
25: DIRICHLET,
26: NONE
27: } BCType;
28: typedef enum {
29: RUN_FULL,
30: RUN_EXACT,
31: RUN_TEST,
32: RUN_PERF
33: } RunType;
34: typedef enum {
35: COEFF_NONE,
36: COEFF_ANALYTIC,
37: COEFF_FIELD,
38: COEFF_NONLINEAR,
39: COEFF_BALL,
40: COEFF_CROSS,
41: COEFF_CHECKERBOARD_0,
42: COEFF_CHECKERBOARD_1
43: } CoeffType;
45: typedef struct {
46: RunType runType; /* Whether to run tests, or solve the full problem */
47: PetscBool jacobianMF; /* Whether to calculate the Jacobian action on the fly */
48: PetscBool showInitial, showSolution, restart, quiet, nonzInit;
49: /* Problem definition */
50: BCType bcType;
51: CoeffType variableCoefficient;
52: PetscErrorCode (**exactFuncs)(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx);
53: PetscBool fieldBC;
54: void (**exactFields)(PetscInt, PetscInt, PetscInt, const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], PetscReal, const PetscReal[], PetscInt, const PetscScalar[], PetscScalar[]);
55: PetscBool bdIntegral; /* Compute the integral of the solution on the boundary */
56: /* Reproducing tests from SISC 40(3), pp. A1473-A1493, 2018 */
57: PetscInt div; /* Number of divisions */
58: PetscInt k; /* Parameter for checkerboard coefficient */
59: PetscInt *kgrid; /* Random parameter grid */
60: PetscBool rand; /* Make random assignments */
61: /* Solver */
62: PC pcmg; /* This is needed for error monitoring */
63: PetscBool checkksp; /* Whether to check the KSPSolve for runType == RUN_TEST */
64: } AppCtx;
66: static PetscErrorCode zero(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
67: {
68: u[0] = 0.0;
69: return PETSC_SUCCESS;
70: }
72: static PetscErrorCode ecks(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
73: {
74: u[0] = x[0];
75: return PETSC_SUCCESS;
76: }
78: /*
79: In 2D for Dirichlet conditions, we use exact solution:
81: u = x^2 + y^2
82: f = 4
84: so that
86: -\Delta u + f = -4 + 4 = 0
88: For Neumann conditions, we have
90: -\nabla u \cdot -\hat y |_{y=0} = (2y)|_{y=0} = 0 (bottom)
91: -\nabla u \cdot \hat y |_{y=1} = -(2y)|_{y=1} = -2 (top)
92: -\nabla u \cdot -\hat x |_{x=0} = (2x)|_{x=0} = 0 (left)
93: -\nabla u \cdot \hat x |_{x=1} = -(2x)|_{x=1} = -2 (right)
95: Which we can express as
97: \nabla u \cdot \hat n|_\Gamma = {2 x, 2 y} \cdot \hat n = 2 (x + y)
99: The boundary integral of this solution is (assuming we are not orienting the edges)
101: \int^1_0 x^2 dx + \int^1_0 (1 + y^2) dy + \int^1_0 (x^2 + 1) dx + \int^1_0 y^2 dy = 1/3 + 4/3 + 4/3 + 1/3 = 3 1/3
102: */
103: static PetscErrorCode quadratic_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
104: {
105: *u = x[0] * x[0] + x[1] * x[1];
106: return PETSC_SUCCESS;
107: }
109: static void quadratic_u_field_2d(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 uexact[])
110: {
111: uexact[0] = a[0];
112: }
114: static PetscErrorCode ball_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
115: {
116: const PetscReal alpha = 500.;
117: const PetscReal radius2 = PetscSqr(0.15);
118: const PetscReal r2 = PetscSqr(x[0] - 0.5) + PetscSqr(x[1] - 0.5);
119: const PetscReal xi = alpha * (radius2 - r2);
121: *u = PetscTanhScalar(xi) + 1.0;
122: return PETSC_SUCCESS;
123: }
125: static PetscErrorCode cross_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
126: {
127: const PetscReal alpha = 50 * 4;
128: const PetscReal xy = (x[0] - 0.5) * (x[1] - 0.5);
130: *u = PetscSinReal(alpha * xy) * (alpha * PetscAbsReal(xy) < 2 * PETSC_PI ? 1 : 0.01);
131: return PETSC_SUCCESS;
132: }
134: static void f0_u(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[])
135: {
136: f0[0] = 4.0;
137: }
139: static void f0_ball_u(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[])
140: {
141: PetscInt d;
142: const PetscReal alpha = 500., radius2 = PetscSqr(0.15);
143: PetscReal r2, xi;
145: for (d = 0, r2 = 0.0; d < dim; ++d) r2 += PetscSqr(x[d] - 0.5);
146: xi = alpha * (radius2 - r2);
147: f0[0] = (-2.0 * dim * alpha - 8.0 * PetscSqr(alpha) * r2 * PetscTanhReal(xi)) * PetscSqr(1.0 / PetscCoshReal(xi));
148: }
150: static void f0_cross_u_2d(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[])
151: {
152: const PetscReal alpha = 50 * 4;
153: const PetscReal xy = (x[0] - 0.5) * (x[1] - 0.5);
155: f0[0] = PetscSinReal(alpha * xy) * (alpha * PetscAbsReal(xy) < 2 * PETSC_PI ? 1 : 0.01);
156: }
158: static void f0_checkerboard_0_u(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[])
159: {
160: f0[0] = -20.0 * PetscExpReal(-(PetscSqr(x[0] - 0.5) + PetscSqr(x[1] - 0.5)));
161: }
163: static void f0_bd_u(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[], const PetscReal n[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])
164: {
165: PetscInt d;
166: for (d = 0, f0[0] = 0.0; d < dim; ++d) f0[0] += -n[d] * 2.0 * x[d];
167: }
169: /* gradU[comp*dim+d] = {u_x, u_y} or {u_x, u_y, u_z} */
170: static void f1_u(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[])
171: {
172: PetscInt d;
173: for (d = 0; d < dim; ++d) f1[d] = u_x[d];
174: }
176: /* < \nabla v, \nabla u + {\nabla u}^T >
177: This just gives \nabla u, give the perdiagonal for the transpose */
178: static void g3_uu(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[])
179: {
180: PetscInt d;
181: for (d = 0; d < dim; ++d) g3[d * dim + d] = 1.0;
182: }
184: /*
185: In 2D for x periodicity and y Dirichlet conditions, we use exact solution:
187: u = sin(2 pi x)
188: f = -4 pi^2 sin(2 pi x)
190: so that
192: -\Delta u + f = 4 pi^2 sin(2 pi x) - 4 pi^2 sin(2 pi x) = 0
193: */
194: static PetscErrorCode xtrig_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
195: {
196: *u = PetscSinReal(2.0 * PETSC_PI * x[0]);
197: return PETSC_SUCCESS;
198: }
200: static void f0_xtrig_u(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[])
201: {
202: f0[0] = -4.0 * PetscSqr(PETSC_PI) * PetscSinReal(2.0 * PETSC_PI * x[0]);
203: }
205: /*
206: In 2D for x-y periodicity, we use exact solution:
208: u = sin(2 pi x) sin(2 pi y)
209: f = -8 pi^2 sin(2 pi x)
211: so that
213: -\Delta u + f = 4 pi^2 sin(2 pi x) sin(2 pi y) + 4 pi^2 sin(2 pi x) sin(2 pi y) - 8 pi^2 sin(2 pi x) = 0
214: */
215: static PetscErrorCode xytrig_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
216: {
217: *u = PetscSinReal(2.0 * PETSC_PI * x[0]) * PetscSinReal(2.0 * PETSC_PI * x[1]);
218: return PETSC_SUCCESS;
219: }
221: static void f0_xytrig_u(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[])
222: {
223: f0[0] = -8.0 * PetscSqr(PETSC_PI) * PetscSinReal(2.0 * PETSC_PI * x[0]);
224: }
226: /*
227: In 2D for Dirichlet conditions with a variable coefficient, we use exact solution:
229: u = x^2 + y^2
230: f = 6 (x + y)
231: nu = (x + y)
233: so that
235: -\div \nu \grad u + f = -6 (x + y) + 6 (x + y) = 0
236: */
237: static PetscErrorCode nu_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
238: {
239: *u = x[0] + x[1];
240: return PETSC_SUCCESS;
241: }
243: static PetscErrorCode checkerboardCoeff(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
244: {
245: AppCtx *user = (AppCtx *)ctx;
246: PetscInt div = user->div;
247: PetscInt k = user->k;
248: PetscInt mask = 0, ind = 0, d;
250: PetscFunctionBeginUser;
251: for (d = 0; d < dim; ++d) mask = (mask + (PetscInt)(x[d] * div)) % 2;
252: if (user->kgrid) {
253: for (d = 0; d < dim; ++d) {
254: if (d > 0) ind *= dim;
255: ind += (PetscInt)(x[d] * div);
256: }
257: k = user->kgrid[ind];
258: }
259: u[0] = mask ? 1.0 : PetscPowRealInt(10.0, -k);
260: PetscFunctionReturn(PETSC_SUCCESS);
261: }
263: void f0_analytic_u(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[])
264: {
265: f0[0] = 6.0 * (x[0] + x[1]);
266: }
268: /* gradU[comp*dim+d] = {u_x, u_y} or {u_x, u_y, u_z} */
269: void f1_analytic_u(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[])
270: {
271: PetscInt d;
272: for (d = 0; d < dim; ++d) f1[d] = (x[0] + x[1]) * u_x[d];
273: }
275: void f1_field_u(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[])
276: {
277: PetscInt d;
278: for (d = 0; d < dim; ++d) f1[d] = a[0] * u_x[d];
279: }
281: /* < \nabla v, \nabla u + {\nabla u}^T >
282: This just gives \nabla u, give the perdiagonal for the transpose */
283: void g3_analytic_uu(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[])
284: {
285: PetscInt d;
286: for (d = 0; d < dim; ++d) g3[d * dim + d] = x[0] + x[1];
287: }
289: void g3_field_uu(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[])
290: {
291: for (PetscInt d = 0; d < dim; ++d) g3[d * dim + d] = a[0];
292: }
294: /*
295: In 2D for Dirichlet conditions with a nonlinear coefficient (p-Laplacian with p = 4), we use exact solution:
297: u = x^2 + y^2
298: f = 16 (x^2 + y^2)
299: nu = 1/2 |grad u|^2
301: so that
303: -\div \nu \grad u + f = -16 (x^2 + y^2) + 16 (x^2 + y^2) = 0
304: */
305: void f0_analytic_nonlinear_u(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[])
306: {
307: f0[0] = 16.0 * (x[0] * x[0] + x[1] * x[1]);
308: }
310: /* gradU[comp*dim+d] = {u_x, u_y} or {u_x, u_y, u_z} */
311: void f1_analytic_nonlinear_u(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[])
312: {
313: PetscScalar nu = 0.0;
314: for (PetscInt d = 0; d < dim; ++d) nu += u_x[d] * u_x[d];
315: for (PetscInt d = 0; d < dim; ++d) f1[d] = 0.5 * nu * u_x[d];
316: }
318: /*
319: grad (u + eps w) - grad u = eps grad w
321: 1/2 |grad (u + eps w)|^2 grad (u + eps w) - 1/2 |grad u|^2 grad u
322: = 1/2 (|grad u|^2 + 2 eps <grad u,grad w>) (grad u + eps grad w) - 1/2 |grad u|^2 grad u
323: = 1/2 (eps |grad u|^2 grad w + 2 eps <grad u,grad w> grad u)
324: = eps (1/2 |grad u|^2 grad w + grad u <grad u,grad w>)
325: */
326: void g3_analytic_nonlinear_uu(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[])
327: {
328: PetscScalar nu = 0.0;
329: for (PetscInt d = 0; d < dim; ++d) nu += u_x[d] * u_x[d];
330: for (PetscInt d = 0; d < dim; ++d) {
331: g3[d * dim + d] = 0.5 * nu;
332: for (PetscInt e = 0; e < dim; ++e) g3[d * dim + e] += u_x[d] * u_x[e];
333: }
334: }
336: /*
337: In 3D for Dirichlet conditions we use exact solution:
339: u = 2/3 (x^2 + y^2 + z^2)
340: f = 4
342: so that
344: -\Delta u + f = -2/3 * 6 + 4 = 0
346: For Neumann conditions, we have
348: -\nabla u \cdot -\hat z |_{z=0} = (2z)|_{z=0} = 0 (bottom)
349: -\nabla u \cdot \hat z |_{z=1} = -(2z)|_{z=1} = -2 (top)
350: -\nabla u \cdot -\hat y |_{y=0} = (2y)|_{y=0} = 0 (front)
351: -\nabla u \cdot \hat y |_{y=1} = -(2y)|_{y=1} = -2 (back)
352: -\nabla u \cdot -\hat x |_{x=0} = (2x)|_{x=0} = 0 (left)
353: -\nabla u \cdot \hat x |_{x=1} = -(2x)|_{x=1} = -2 (right)
355: Which we can express as
357: \nabla u \cdot \hat n|_\Gamma = {2 x, 2 y, 2z} \cdot \hat n = 2 (x + y + z)
358: */
359: static PetscErrorCode quadratic_u_3d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
360: {
361: *u = 2.0 * (x[0] * x[0] + x[1] * x[1] + x[2] * x[2]) / 3.0;
362: return PETSC_SUCCESS;
363: }
365: static PetscErrorCode ball_u_3d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
366: {
367: const PetscReal alpha = 500.;
368: const PetscReal radius2 = PetscSqr(0.15);
369: const PetscReal r2 = PetscSqr(x[0] - 0.5) + PetscSqr(x[1] - 0.5) + PetscSqr(x[2] - 0.5);
370: const PetscReal xi = alpha * (radius2 - r2);
372: *u = PetscTanhScalar(xi) + 1.0;
373: return PETSC_SUCCESS;
374: }
376: static void quadratic_u_field_3d(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 uexact[])
377: {
378: uexact[0] = a[0];
379: }
381: static PetscErrorCode cross_u_3d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx)
382: {
383: const PetscReal alpha = 50 * 4;
384: const PetscReal xyz = (x[0] - 0.5) * (x[1] - 0.5) * (x[2] - 0.5);
386: *u = PetscSinReal(alpha * xyz) * (alpha * PetscAbsReal(xyz) < 2 * PETSC_PI ? (alpha * PetscAbsReal(xyz) > -2 * PETSC_PI ? 1.0 : 0.01) : 0.01);
387: return PETSC_SUCCESS;
388: }
390: static void f0_cross_u_3d(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[])
391: {
392: const PetscReal alpha = 50 * 4;
393: const PetscReal xyz = (x[0] - 0.5) * (x[1] - 0.5) * (x[2] - 0.5);
395: f0[0] = PetscSinReal(alpha * xyz) * (alpha * PetscAbsReal(xyz) < 2 * PETSC_PI ? (alpha * PetscAbsReal(xyz) > -2 * PETSC_PI ? 1.0 : 0.01) : 0.01);
396: }
398: static void bd_integral_2d(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[], const PetscReal n[], PetscInt numConstants, const PetscScalar constants[], PetscScalar *uint)
399: {
400: uint[0] = u[0];
401: }
403: static PetscErrorCode ProcessOptions(MPI_Comm comm, AppCtx *options)
404: {
405: const char *bcTypes[3] = {"neumann", "dirichlet", "none"};
406: const char *runTypes[4] = {"full", "exact", "test", "perf"};
407: const char *coeffTypes[8] = {"none", "analytic", "field", "nonlinear", "ball", "cross", "checkerboard_0", "checkerboard_1"};
408: PetscInt bc, run, coeff;
410: PetscFunctionBeginUser;
411: options->runType = RUN_FULL;
412: options->bcType = DIRICHLET;
413: options->variableCoefficient = COEFF_NONE;
414: options->fieldBC = PETSC_FALSE;
415: options->jacobianMF = PETSC_FALSE;
416: options->showInitial = PETSC_FALSE;
417: options->showSolution = PETSC_FALSE;
418: options->restart = PETSC_FALSE;
419: options->quiet = PETSC_FALSE;
420: options->nonzInit = PETSC_FALSE;
421: options->bdIntegral = PETSC_FALSE;
422: options->checkksp = PETSC_FALSE;
423: options->div = 4;
424: options->k = 1;
425: options->kgrid = NULL;
426: options->rand = PETSC_FALSE;
428: PetscOptionsBegin(comm, "", "Poisson Problem Options", "DMPLEX");
429: run = options->runType;
430: PetscCall(PetscOptionsEList("-run_type", "The run type", "ex12.c", runTypes, 4, runTypes[options->runType], &run, NULL));
431: options->runType = (RunType)run;
432: bc = options->bcType;
433: PetscCall(PetscOptionsEList("-bc_type", "Type of boundary condition", "ex12.c", bcTypes, 3, bcTypes[options->bcType], &bc, NULL));
434: options->bcType = (BCType)bc;
435: coeff = options->variableCoefficient;
436: PetscCall(PetscOptionsEList("-variable_coefficient", "Type of variable coefficient", "ex12.c", coeffTypes, 8, coeffTypes[options->variableCoefficient], &coeff, NULL));
437: options->variableCoefficient = (CoeffType)coeff;
439: PetscCall(PetscOptionsBool("-field_bc", "Use a field representation for the BC", "ex12.c", options->fieldBC, &options->fieldBC, NULL));
440: PetscCall(PetscOptionsBool("-jacobian_mf", "Calculate the action of the Jacobian on the fly", "ex12.c", options->jacobianMF, &options->jacobianMF, NULL));
441: PetscCall(PetscOptionsBool("-show_initial", "Output the initial guess for verification", "ex12.c", options->showInitial, &options->showInitial, NULL));
442: PetscCall(PetscOptionsBool("-show_solution", "Output the solution for verification", "ex12.c", options->showSolution, &options->showSolution, NULL));
443: PetscCall(PetscOptionsBool("-restart", "Read in the mesh and solution from a file", "ex12.c", options->restart, &options->restart, NULL));
444: PetscCall(PetscOptionsBool("-quiet", "Don't print any vecs", "ex12.c", options->quiet, &options->quiet, NULL));
445: PetscCall(PetscOptionsBool("-nonzero_initial_guess", "nonzero initial guess", "ex12.c", options->nonzInit, &options->nonzInit, NULL));
446: PetscCall(PetscOptionsBool("-bd_integral", "Compute the integral of the solution on the boundary", "ex12.c", options->bdIntegral, &options->bdIntegral, NULL));
447: if (options->runType == RUN_TEST) PetscCall(PetscOptionsBool("-run_test_check_ksp", "Check solution of KSP", "ex12.c", options->checkksp, &options->checkksp, NULL));
448: PetscCall(PetscOptionsInt("-div", "The number of division for the checkerboard coefficient", "ex12.c", options->div, &options->div, NULL));
449: PetscCall(PetscOptionsInt("-k", "The exponent for the checkerboard coefficient", "ex12.c", options->k, &options->k, NULL));
450: PetscCall(PetscOptionsBool("-k_random", "Assign random k values to checkerboard", "ex12.c", options->rand, &options->rand, NULL));
451: PetscOptionsEnd();
452: PetscFunctionReturn(PETSC_SUCCESS);
453: }
455: static PetscErrorCode CreateBCLabel(DM dm, const char name[])
456: {
457: DM plex;
458: DMLabel label;
460: PetscFunctionBeginUser;
461: PetscCall(DMCreateLabel(dm, name));
462: PetscCall(DMGetLabel(dm, name, &label));
463: PetscCall(DMConvert(dm, DMPLEX, &plex));
464: PetscCall(DMPlexMarkBoundaryFaces(plex, 1, label));
465: PetscCall(DMDestroy(&plex));
466: PetscFunctionReturn(PETSC_SUCCESS);
467: }
469: static PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user, DM *dm)
470: {
471: PetscFunctionBeginUser;
472: PetscCall(DMCreate(comm, dm));
473: PetscCall(DMSetType(*dm, DMPLEX));
474: PetscCall(DMSetFromOptions(*dm));
475: {
476: char convType[256];
477: PetscBool flg;
479: PetscOptionsBegin(comm, "", "Mesh conversion options", "DMPLEX");
480: PetscCall(PetscOptionsFList("-dm_plex_convert_type", "Convert DMPlex to another format", "ex12", DMList, DMPLEX, convType, 256, &flg));
481: PetscOptionsEnd();
482: if (flg) {
483: DM dmConv;
485: PetscCall(DMConvert(*dm, convType, &dmConv));
486: if (dmConv) {
487: PetscCall(DMDestroy(dm));
488: *dm = dmConv;
489: }
490: PetscCall(DMSetFromOptions(*dm));
491: PetscCall(DMSetUp(*dm));
492: }
493: }
494: PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view"));
495: if (user->rand) {
496: PetscRandom r;
497: PetscReal val;
498: PetscInt dim, N, i;
500: PetscCall(DMGetDimension(*dm, &dim));
501: N = PetscPowInt(user->div, dim);
502: PetscCall(PetscMalloc1(N, &user->kgrid));
503: PetscCall(PetscRandomCreate(PETSC_COMM_SELF, &r));
504: PetscCall(PetscRandomSetFromOptions(r));
505: PetscCall(PetscRandomSetInterval(r, 0.0, user->k));
506: PetscCall(PetscRandomSetSeed(r, 1973));
507: PetscCall(PetscRandomSeed(r));
508: for (i = 0; i < N; ++i) {
509: PetscCall(PetscRandomGetValueReal(r, &val));
510: user->kgrid[i] = 1 + (PetscInt)val;
511: }
512: PetscCall(PetscRandomDestroy(&r));
513: }
514: PetscFunctionReturn(PETSC_SUCCESS);
515: }
517: static PetscErrorCode SetupProblem(DM dm, AppCtx *user)
518: {
519: PetscDS ds;
520: DMLabel label;
521: PetscWeakForm wf;
522: const PetscReal *L;
523: const PetscInt id = 1;
524: PetscInt bd, dim;
526: PetscFunctionBeginUser;
527: PetscCall(DMGetDS(dm, &ds));
528: PetscCall(DMGetDimension(dm, &dim));
529: PetscCall(DMGetPeriodicity(dm, NULL, NULL, &L));
530: switch (user->variableCoefficient) {
531: case COEFF_NONE:
532: if (L && L[0]) {
533: if (L && L[1]) {
534: PetscCall(PetscDSSetResidual(ds, 0, f0_xytrig_u, f1_u));
535: PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu));
536: } else {
537: PetscCall(PetscDSSetResidual(ds, 0, f0_xtrig_u, f1_u));
538: PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu));
539: }
540: } else {
541: PetscCall(PetscDSSetResidual(ds, 0, f0_u, f1_u));
542: PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu));
543: }
544: break;
545: case COEFF_ANALYTIC:
546: PetscCall(PetscDSSetResidual(ds, 0, f0_analytic_u, f1_analytic_u));
547: PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_analytic_uu));
548: break;
549: case COEFF_FIELD:
550: PetscCall(PetscDSSetResidual(ds, 0, f0_analytic_u, f1_field_u));
551: PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_field_uu));
552: break;
553: case COEFF_NONLINEAR:
554: PetscCall(PetscDSSetResidual(ds, 0, f0_analytic_nonlinear_u, f1_analytic_nonlinear_u));
555: PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_analytic_nonlinear_uu));
556: break;
557: case COEFF_BALL:
558: PetscCall(PetscDSSetResidual(ds, 0, f0_ball_u, f1_u));
559: PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu));
560: break;
561: case COEFF_CROSS:
562: switch (dim) {
563: case 2:
564: PetscCall(PetscDSSetResidual(ds, 0, f0_cross_u_2d, f1_u));
565: break;
566: case 3:
567: PetscCall(PetscDSSetResidual(ds, 0, f0_cross_u_3d, f1_u));
568: break;
569: default:
570: SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Invalid dimension %" PetscInt_FMT, dim);
571: }
572: PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu));
573: break;
574: case COEFF_CHECKERBOARD_0:
575: PetscCall(PetscDSSetResidual(ds, 0, f0_checkerboard_0_u, f1_field_u));
576: PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_field_uu));
577: break;
578: default:
579: SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Invalid variable coefficient type %d", user->variableCoefficient);
580: }
581: switch (dim) {
582: case 2:
583: switch (user->variableCoefficient) {
584: case COEFF_BALL:
585: user->exactFuncs[0] = ball_u_2d;
586: break;
587: case COEFF_CROSS:
588: user->exactFuncs[0] = cross_u_2d;
589: break;
590: case COEFF_CHECKERBOARD_0:
591: user->exactFuncs[0] = zero;
592: break;
593: default:
594: if (L && L[0]) {
595: if (L && L[1]) {
596: user->exactFuncs[0] = xytrig_u_2d;
597: } else {
598: user->exactFuncs[0] = xtrig_u_2d;
599: }
600: } else {
601: user->exactFuncs[0] = quadratic_u_2d;
602: user->exactFields[0] = quadratic_u_field_2d;
603: }
604: }
605: if (user->bcType == NEUMANN) {
606: PetscCall(DMGetLabel(dm, "boundary", &label));
607: PetscCall(DMAddBoundary(dm, DM_BC_NATURAL, "wall", label, 1, &id, 0, 0, NULL, NULL, NULL, user, &bd));
608: PetscCall(PetscDSGetBoundary(ds, bd, &wf, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL));
609: PetscCall(PetscWeakFormSetIndexBdResidual(wf, label, id, 0, 0, 0, f0_bd_u, 0, NULL));
610: }
611: break;
612: case 3:
613: switch (user->variableCoefficient) {
614: case COEFF_BALL:
615: user->exactFuncs[0] = ball_u_3d;
616: break;
617: case COEFF_CROSS:
618: user->exactFuncs[0] = cross_u_3d;
619: break;
620: default:
621: user->exactFuncs[0] = quadratic_u_3d;
622: user->exactFields[0] = quadratic_u_field_3d;
623: }
624: if (user->bcType == NEUMANN) {
625: PetscCall(DMGetLabel(dm, "boundary", &label));
626: PetscCall(DMAddBoundary(dm, DM_BC_NATURAL, "wall", label, 1, &id, 0, 0, NULL, NULL, NULL, user, &bd));
627: PetscCall(PetscDSGetBoundary(ds, bd, &wf, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL));
628: PetscCall(PetscWeakFormSetIndexBdResidual(wf, label, id, 0, 0, 0, f0_bd_u, 0, NULL));
629: }
630: break;
631: default:
632: SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Invalid dimension %" PetscInt_FMT, dim);
633: }
634: /* Setup constants */
635: switch (user->variableCoefficient) {
636: case COEFF_CHECKERBOARD_0: {
637: PetscScalar constants[2];
639: constants[0] = user->div;
640: constants[1] = user->k;
641: PetscCall(PetscDSSetConstants(ds, 2, constants));
642: } break;
643: default:
644: break;
645: }
646: PetscCall(PetscDSSetExactSolution(ds, 0, user->exactFuncs[0], user));
647: /* Setup Boundary Conditions */
648: if (user->bcType == DIRICHLET) {
649: PetscCall(DMGetLabel(dm, "marker", &label));
650: if (!label) {
651: /* Right now, p4est cannot create labels immediately */
652: PetscCall(PetscDSAddBoundaryByName(ds, user->fieldBC ? DM_BC_ESSENTIAL_FIELD : DM_BC_ESSENTIAL, "wall", "marker", 1, &id, 0, 0, NULL, user->fieldBC ? (PetscVoidFn *)user->exactFields[0] : (PetscVoidFn *)user->exactFuncs[0], NULL, user, NULL));
653: } else {
654: PetscCall(DMAddBoundary(dm, user->fieldBC ? DM_BC_ESSENTIAL_FIELD : DM_BC_ESSENTIAL, "wall", label, 1, &id, 0, 0, NULL, user->fieldBC ? (PetscVoidFn *)user->exactFields[0] : (PetscVoidFn *)user->exactFuncs[0], NULL, user, NULL));
655: }
656: }
657: PetscFunctionReturn(PETSC_SUCCESS);
658: }
660: static PetscErrorCode SetupMaterial(DM dm, DM dmAux, AppCtx *user)
661: {
662: PetscErrorCode (*matFuncs[1])(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar u[], PetscCtx ctx) = {nu_2d};
663: PetscCtx ctx[1];
664: Vec nu;
666: PetscFunctionBegin;
667: ctx[0] = user;
668: if (user->variableCoefficient == COEFF_CHECKERBOARD_0) matFuncs[0] = checkerboardCoeff;
669: PetscCall(DMCreateLocalVector(dmAux, &nu));
670: PetscCall(PetscObjectSetName((PetscObject)nu, "Coefficient"));
671: PetscCall(DMProjectFunctionLocal(dmAux, 0.0, matFuncs, ctx, INSERT_ALL_VALUES, nu));
672: PetscCall(DMSetAuxiliaryVec(dm, NULL, 0, 0, nu));
673: PetscCall(VecDestroy(&nu));
674: PetscFunctionReturn(PETSC_SUCCESS);
675: }
677: static PetscErrorCode SetupBC(DM dm, DM dmAux, AppCtx *user)
678: {
679: PetscErrorCode (*bcFuncs[1])(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar u[], PetscCtx ctx);
680: Vec uexact;
681: PetscInt dim;
683: PetscFunctionBegin;
684: PetscCall(DMGetDimension(dm, &dim));
685: if (dim == 2) bcFuncs[0] = quadratic_u_2d;
686: else bcFuncs[0] = quadratic_u_3d;
687: PetscCall(DMCreateLocalVector(dmAux, &uexact));
688: PetscCall(DMProjectFunctionLocal(dmAux, 0.0, bcFuncs, NULL, INSERT_ALL_VALUES, uexact));
689: PetscCall(DMSetAuxiliaryVec(dm, NULL, 0, 0, uexact));
690: PetscCall(VecDestroy(&uexact));
691: PetscFunctionReturn(PETSC_SUCCESS);
692: }
694: static PetscErrorCode SetupAuxDM(DM dm, PetscFE feAux, AppCtx *user)
695: {
696: DM dmAux, coordDM;
698: PetscFunctionBegin;
699: /* MUST call DMGetCoordinateDM() in order to get p4est setup if present */
700: PetscCall(DMGetCoordinateDM(dm, &coordDM));
701: if (!feAux) PetscFunctionReturn(PETSC_SUCCESS);
702: PetscCall(DMClone(dm, &dmAux));
703: PetscCall(DMSetCoordinateDM(dmAux, coordDM));
704: PetscCall(DMSetField(dmAux, 0, NULL, (PetscObject)feAux));
705: PetscCall(DMCreateDS(dmAux));
706: if (user->fieldBC) PetscCall(SetupBC(dm, dmAux, user));
707: else PetscCall(SetupMaterial(dm, dmAux, user));
708: PetscCall(DMDestroy(&dmAux));
709: PetscFunctionReturn(PETSC_SUCCESS);
710: }
712: static PetscErrorCode SetupDiscretization(DM dm, AppCtx *user)
713: {
714: DM plex, cdm = dm;
715: PetscFE fe, feAux = NULL;
716: PetscBool simplex;
717: PetscInt dim;
719: PetscFunctionBeginUser;
720: PetscCall(DMGetDimension(dm, &dim));
721: PetscCall(DMConvert(dm, DMPLEX, &plex));
722: PetscCall(DMPlexIsSimplex(plex, &simplex));
723: PetscCall(DMDestroy(&plex));
724: PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, NULL, -1, &fe));
725: PetscCall(PetscObjectSetName((PetscObject)fe, "potential"));
726: if (user->variableCoefficient == COEFF_FIELD || user->variableCoefficient == COEFF_CHECKERBOARD_0) {
727: PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, "mat_", -1, &feAux));
728: PetscCall(PetscObjectSetName((PetscObject)feAux, "coefficient"));
729: PetscCall(PetscFECopyQuadrature(fe, feAux));
730: } else if (user->fieldBC) {
731: PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, "bc_", -1, &feAux));
732: PetscCall(PetscFECopyQuadrature(fe, feAux));
733: }
734: /* Set discretization and boundary conditions for each mesh */
735: PetscCall(DMSetField(dm, 0, NULL, (PetscObject)fe));
736: PetscCall(DMCreateDS(dm));
737: PetscCall(SetupProblem(dm, user));
738: while (cdm) {
739: PetscCall(SetupAuxDM(cdm, feAux, user));
740: if (user->bcType == DIRICHLET) {
741: PetscBool hasLabel;
743: PetscCall(DMHasLabel(cdm, "marker", &hasLabel));
744: if (!hasLabel) PetscCall(CreateBCLabel(cdm, "marker"));
745: }
746: PetscCall(DMCopyDisc(dm, cdm));
747: PetscCall(DMGetCoarseDM(cdm, &cdm));
748: }
749: PetscCall(PetscFEDestroy(&fe));
750: PetscCall(PetscFEDestroy(&feAux));
751: PetscFunctionReturn(PETSC_SUCCESS);
752: }
754: int main(int argc, char **argv)
755: {
756: DM dm; /* Problem specification */
757: SNES snes; /* nonlinear solver */
758: Vec u; /* solution vector */
759: Mat A, J; /* Jacobian matrix */
760: MatNullSpace nullSpace; /* May be necessary for Neumann conditions */
761: AppCtx user; /* user-defined work context */
762: JacActionCtx userJ; /* context for Jacobian MF action */
763: PetscReal error = 0.0; /* L_2 error in the solution */
765: PetscFunctionBeginUser;
766: PetscCall(PetscInitialize(&argc, &argv, NULL, help));
767: PetscCall(ProcessOptions(PETSC_COMM_WORLD, &user));
768: PetscCall(SNESCreate(PETSC_COMM_WORLD, &snes));
769: PetscCall(CreateMesh(PETSC_COMM_WORLD, &user, &dm));
770: PetscCall(SNESSetDM(snes, dm));
771: PetscCall(DMSetApplicationContext(dm, &user));
773: PetscCall(PetscMalloc2(1, &user.exactFuncs, 1, &user.exactFields));
774: PetscCall(SetupDiscretization(dm, &user));
776: PetscCall(DMCreateGlobalVector(dm, &u));
777: PetscCall(PetscObjectSetName((PetscObject)u, "potential"));
779: PetscCall(DMCreateMatrix(dm, &J));
780: if (user.jacobianMF) {
781: PetscInt M, m, N, n;
783: PetscCall(MatGetSize(J, &M, &N));
784: PetscCall(MatGetLocalSize(J, &m, &n));
785: PetscCall(MatCreate(PETSC_COMM_WORLD, &A));
786: PetscCall(MatSetSizes(A, m, n, M, N));
787: PetscCall(MatSetType(A, MATSHELL));
788: PetscCall(MatSetUp(A));
789: #if 0
790: PetscCall(MatShellSetOperation(A, MATOP_MULT, (PetscErrorCodeFn *)FormJacobianAction));
791: #endif
793: userJ.dm = dm;
794: userJ.J = J;
795: userJ.user = &user;
797: PetscCall(DMCreateLocalVector(dm, &userJ.u));
798: if (user.fieldBC) PetscCall(DMProjectFieldLocal(dm, 0.0, userJ.u, user.exactFields, INSERT_BC_VALUES, userJ.u));
799: else PetscCall(DMProjectFunctionLocal(dm, 0.0, user.exactFuncs, NULL, INSERT_BC_VALUES, userJ.u));
800: PetscCall(MatShellSetContext(A, &userJ));
801: } else {
802: A = J;
803: }
805: nullSpace = NULL;
806: if (user.bcType != DIRICHLET) {
807: PetscCall(MatNullSpaceCreate(PetscObjectComm((PetscObject)dm), PETSC_TRUE, 0, NULL, &nullSpace));
808: PetscCall(MatSetNullSpace(A, nullSpace));
809: }
811: PetscCall(DMPlexSetSNESLocalFEM(dm, PETSC_FALSE, &user));
812: PetscCall(SNESSetJacobian(snes, A, J, NULL, NULL));
814: PetscCall(SNESSetFromOptions(snes));
816: if (user.fieldBC) PetscCall(DMProjectField(dm, 0.0, u, user.exactFields, INSERT_ALL_VALUES, u));
817: else PetscCall(DMProjectFunction(dm, 0.0, user.exactFuncs, NULL, INSERT_ALL_VALUES, u));
818: if (user.restart) {
819: #if defined(PETSC_HAVE_HDF5)
820: PetscViewer viewer;
821: char filename[PETSC_MAX_PATH_LEN];
823: PetscCall(PetscOptionsGetString(NULL, NULL, "-dm_plex_filename", filename, sizeof(filename), NULL));
824: PetscCall(PetscViewerCreate(PETSC_COMM_WORLD, &viewer));
825: PetscCall(PetscViewerSetType(viewer, PETSCVIEWERHDF5));
826: PetscCall(PetscViewerFileSetMode(viewer, FILE_MODE_READ));
827: PetscCall(PetscViewerFileSetName(viewer, filename));
828: PetscCall(PetscViewerHDF5PushGroup(viewer, "/fields"));
829: PetscCall(VecLoad(u, viewer));
830: PetscCall(PetscViewerHDF5PopGroup(viewer));
831: PetscCall(PetscViewerDestroy(&viewer));
832: #endif
833: }
834: if (user.showInitial) {
835: Vec lv;
836: PetscCall(DMGetLocalVector(dm, &lv));
837: PetscCall(DMGlobalToLocalBegin(dm, u, INSERT_VALUES, lv));
838: PetscCall(DMGlobalToLocalEnd(dm, u, INSERT_VALUES, lv));
839: PetscCall(DMPrintLocalVec(dm, "Local function", 1.0e-10, lv));
840: PetscCall(DMRestoreLocalVector(dm, &lv));
841: }
842: if (user.runType == RUN_FULL || user.runType == RUN_EXACT) {
843: PetscErrorCode (*initialGuess[1])(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar u[], PetscCtx ctx) = {zero};
845: if (user.nonzInit) initialGuess[0] = ecks;
846: if (user.runType == RUN_FULL) PetscCall(DMProjectFunction(dm, 0.0, initialGuess, NULL, INSERT_VALUES, u));
847: PetscCall(VecViewFromOptions(u, NULL, "-guess_vec_view"));
848: PetscCall(SNESSolve(snes, NULL, u));
849: PetscCall(SNESGetSolution(snes, &u));
850: PetscCall(SNESGetDM(snes, &dm));
852: if (user.showSolution) {
853: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Solution\n"));
854: PetscCall(VecFilter(u, 3.0e-9));
855: PetscCall(VecView(u, PETSC_VIEWER_STDOUT_WORLD));
856: }
857: } else if (user.runType == RUN_PERF) {
858: Vec r;
859: PetscReal res = 0.0;
861: PetscCall(SNESGetFunction(snes, &r, NULL, NULL));
862: PetscCall(SNESComputeFunction(snes, u, r));
863: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Initial Residual\n"));
864: PetscCall(VecFilter(r, 1.0e-10));
865: PetscCall(VecNorm(r, NORM_2, &res));
866: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "L_2 Residual: %g\n", (double)res));
867: } else {
868: Vec r;
869: PetscReal res = 0.0, tol = 1.0e-11;
871: /* Check discretization error */
872: PetscCall(SNESGetFunction(snes, &r, NULL, NULL));
873: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Initial guess\n"));
874: if (!user.quiet) PetscCall(VecView(u, PETSC_VIEWER_STDOUT_WORLD));
875: PetscCall(DMComputeL2Diff(dm, 0.0, user.exactFuncs, NULL, u, &error));
876: if (error < tol) PetscCall(PetscPrintf(PETSC_COMM_WORLD, "L_2 Error: < %2.1e\n", (double)tol));
877: else PetscCall(PetscPrintf(PETSC_COMM_WORLD, "L_2 Error: %g\n", (double)error));
878: /* Check residual */
879: PetscCall(SNESComputeFunction(snes, u, r));
880: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Initial Residual\n"));
881: PetscCall(VecFilter(r, 1.0e-10));
882: if (!user.quiet) PetscCall(VecView(r, PETSC_VIEWER_STDOUT_WORLD));
883: PetscCall(VecNorm(r, NORM_2, &res));
884: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "L_2 Residual: %g\n", (double)res));
885: /* Check Jacobian */
886: {
887: Vec b;
889: PetscCall(SNESComputeJacobian(snes, u, A, A));
890: PetscCall(VecDuplicate(u, &b));
891: PetscCall(VecSet(r, 0.0));
892: PetscCall(SNESComputeFunction(snes, r, b));
893: PetscCall(MatMult(A, u, r));
894: PetscCall(VecAXPY(r, 1.0, b));
895: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Au - b = Au + F(0)\n"));
896: PetscCall(VecFilter(r, 1.0e-10));
897: if (!user.quiet) PetscCall(VecView(r, PETSC_VIEWER_STDOUT_WORLD));
898: PetscCall(VecNorm(r, NORM_2, &res));
899: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Linear L_2 Residual: %g\n", (double)res));
900: /* check solver */
901: if (user.checkksp) {
902: KSP ksp;
904: if (nullSpace) PetscCall(MatNullSpaceRemove(nullSpace, u));
905: PetscCall(SNESComputeJacobian(snes, u, A, J));
906: PetscCall(MatMult(A, u, b));
907: PetscCall(SNESGetKSP(snes, &ksp));
908: PetscCall(KSPSetOperators(ksp, A, J));
909: PetscCall(KSPSolve(ksp, b, r));
910: PetscCall(VecAXPY(r, -1.0, u));
911: PetscCall(VecNorm(r, NORM_2, &res));
912: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "KSP Error: %g\n", (double)res));
913: }
914: PetscCall(VecDestroy(&b));
915: }
916: }
917: PetscCall(VecViewFromOptions(u, NULL, "-vec_view"));
918: {
919: Vec nu;
921: PetscCall(DMGetAuxiliaryVec(dm, NULL, 0, 0, &nu));
922: if (nu) PetscCall(VecViewFromOptions(nu, NULL, "-coeff_view"));
923: }
925: if (user.bdIntegral) {
926: DMLabel label;
927: PetscBdPointFn *func[1] = {bd_integral_2d};
928: PetscInt id = 1;
929: PetscScalar bdInt = 0.0;
930: PetscReal exact = 3.3333333333;
932: PetscCall(DMGetLabel(dm, "marker", &label));
933: PetscCall(DMPlexComputeBdIntegral(dm, u, label, 1, &id, func, &bdInt, NULL));
934: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Solution boundary integral: %.4g\n", (double)PetscAbsScalar(bdInt)));
935: PetscCheck(PetscAbsReal(PetscAbsScalar(bdInt) - exact) <= PETSC_SQRT_MACHINE_EPSILON, PETSC_COMM_WORLD, PETSC_ERR_PLIB, "Invalid boundary integral %g != %g", (double)PetscAbsScalar(bdInt), (double)exact);
936: }
938: PetscCall(MatNullSpaceDestroy(&nullSpace));
939: if (user.jacobianMF) PetscCall(VecDestroy(&userJ.u));
940: if (A != J) PetscCall(MatDestroy(&A));
941: PetscCall(MatDestroy(&J));
942: PetscCall(VecDestroy(&u));
943: PetscCall(SNESDestroy(&snes));
944: PetscCall(DMDestroy(&dm));
945: PetscCall(PetscFree2(user.exactFuncs, user.exactFields));
946: PetscCall(PetscFree(user.kgrid));
947: PetscCall(PetscFinalize());
948: return 0;
949: }
951: /*TEST
952: # 2D serial P1 test 0-4
953: test:
954: suffix: 2d_p1_0
955: requires: triangle
956: args: -run_type test -bc_type dirichlet -dm_plex_interpolate 0 -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
958: test:
959: suffix: 2d_p1_1
960: requires: triangle
961: args: -run_type test -bc_type dirichlet -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 -cdm_dm_plex_coordinate_dim {{2 3}}
963: test:
964: suffix: 2d_p1_1b
965: requires: triangle
966: args: -run_type test -bc_type dirichlet -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 -dm_refine 3 -dm_coord_space 0 \
967: -dm_plex_option_phases proj_ -cdm_proj_dm_plex_coordinate_dim 3 -proj_dm_coord_space \
968: -proj_dm_coord_remap -proj_dm_coord_map sinusoid -proj_dm_coord_map_params 0.1,1.,1.
970: test:
971: suffix: 2d_p1_2
972: requires: triangle
973: args: -run_type test -dm_refine_volume_limit_pre 0.0625 -bc_type dirichlet -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
975: test:
976: suffix: 2d_p1_neumann_0
977: requires: triangle
978: args: -dm_coord_space 0 -run_type test -bc_type neumann -dm_plex_boundary_label boundary -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 -dm_view ascii::ascii_info_detail
980: test:
981: suffix: 2d_p1_neumann_1
982: requires: triangle
983: args: -run_type test -dm_refine_volume_limit_pre 0.0625 -bc_type neumann -dm_plex_boundary_label boundary -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
985: # 2D serial P2 test 5-8
986: test:
987: suffix: 2d_p2_0
988: requires: triangle
989: args: -run_type test -bc_type dirichlet -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
991: test:
992: suffix: 2d_p2_1
993: requires: triangle
994: args: -run_type test -dm_refine_volume_limit_pre 0.0625 -bc_type dirichlet -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
996: test:
997: suffix: 2d_p2_neumann_0
998: requires: triangle
999: args: -dm_coord_space 0 -run_type test -bc_type neumann -dm_plex_boundary_label boundary -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 -dm_view ascii::ascii_info_detail
1001: test:
1002: suffix: 2d_p2_neumann_1
1003: requires: triangle
1004: args: -dm_coord_space 0 -run_type test -dm_refine_volume_limit_pre 0.0625 -bc_type neumann -dm_plex_boundary_label boundary -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 -dm_view ascii::ascii_info_detail
1006: test:
1007: suffix: bd_int_0
1008: requires: triangle
1009: args: -run_type test -bc_type dirichlet -petscspace_degree 2 -bd_integral -dm_view -quiet
1011: test:
1012: suffix: bd_int_1
1013: requires: triangle
1014: args: -run_type test -dm_refine 2 -bc_type dirichlet -petscspace_degree 2 -bd_integral -dm_view -quiet
1016: # 3D serial P1 test 9-12
1017: test:
1018: suffix: 3d_p1_0
1019: requires: ctetgen
1020: args: -run_type test -dm_plex_dim 3 -bc_type dirichlet -dm_plex_interpolate 0 -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 -dm_view
1022: test:
1023: suffix: 3d_p1_1
1024: requires: ctetgen
1025: args: -run_type test -dm_plex_dim 3 -bc_type dirichlet -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 -dm_view
1027: test:
1028: suffix: 3d_p1_2
1029: requires: ctetgen
1030: args: -run_type test -dm_plex_dim 3 -dm_refine_volume_limit_pre 0.0125 -bc_type dirichlet -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 -dm_view
1032: test:
1033: suffix: 3d_p1_neumann_0
1034: requires: ctetgen
1035: args: -run_type test -dm_plex_dim 3 -bc_type neumann -dm_plex_boundary_label boundary -petscspace_degree 1 -snes_fd -show_initial -dm_plex_print_fem 1 -dm_view
1037: # Analytic variable coefficient 13-20
1038: test:
1039: suffix: 13
1040: requires: triangle
1041: args: -run_type test -variable_coefficient analytic -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1042: test:
1043: suffix: 14
1044: requires: triangle
1045: args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient analytic -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1046: test:
1047: suffix: 15
1048: requires: triangle
1049: args: -run_type test -variable_coefficient analytic -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1050: test:
1051: suffix: 16
1052: requires: triangle
1053: args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient analytic -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1054: test:
1055: suffix: 17
1056: requires: ctetgen
1057: args: -run_type test -dm_plex_dim 3 -variable_coefficient analytic -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1059: test:
1060: suffix: 18
1061: requires: ctetgen
1062: args: -run_type test -dm_plex_dim 3 -dm_refine_volume_limit_pre 0.0125 -variable_coefficient analytic -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1064: test:
1065: suffix: 19
1066: requires: ctetgen
1067: args: -run_type test -dm_plex_dim 3 -variable_coefficient analytic -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1069: test:
1070: suffix: 20
1071: requires: ctetgen
1072: args: -run_type test -dm_plex_dim 3 -dm_refine_volume_limit_pre 0.0125 -variable_coefficient analytic -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1074: # P1 variable coefficient 21-28
1075: test:
1076: suffix: 21
1077: requires: triangle
1078: args: -run_type test -variable_coefficient field -petscspace_degree 1 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1080: test:
1081: suffix: 22
1082: requires: triangle
1083: args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient field -petscspace_degree 1 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1085: test:
1086: suffix: 23
1087: requires: triangle
1088: args: -run_type test -variable_coefficient field -petscspace_degree 2 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1090: test:
1091: suffix: 24
1092: requires: triangle
1093: args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient field -petscspace_degree 2 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1095: test:
1096: suffix: 25
1097: requires: ctetgen
1098: args: -run_type test -dm_plex_dim 3 -variable_coefficient field -petscspace_degree 1 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1100: test:
1101: suffix: 26
1102: requires: ctetgen
1103: args: -run_type test -dm_plex_dim 3 -dm_refine_volume_limit_pre 0.0125 -variable_coefficient field -petscspace_degree 1 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1105: test:
1106: suffix: 27
1107: requires: ctetgen
1108: args: -run_type test -dm_plex_dim 3 -variable_coefficient field -petscspace_degree 2 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1110: test:
1111: suffix: 28
1112: requires: ctetgen
1113: args: -run_type test -dm_plex_dim 3 -dm_refine_volume_limit_pre 0.0125 -variable_coefficient field -petscspace_degree 2 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1115: # P0 variable coefficient 29-36
1116: test:
1117: suffix: 29
1118: requires: triangle
1119: args: -run_type test -variable_coefficient field -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1121: test:
1122: suffix: 30
1123: requires: triangle
1124: args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient field -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1126: test:
1127: suffix: 31
1128: requires: triangle
1129: args: -run_type test -variable_coefficient field -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1131: test:
1132: requires: triangle
1133: suffix: 32
1134: args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient field -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1136: test:
1137: requires: ctetgen
1138: suffix: 33
1139: args: -run_type test -dm_plex_dim 3 -variable_coefficient field -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1141: test:
1142: suffix: 34
1143: requires: ctetgen
1144: args: -run_type test -dm_plex_dim 3 -dm_refine_volume_limit_pre 0.0125 -variable_coefficient field -petscspace_degree 1 -show_initial -dm_plex_print_fem 1
1146: test:
1147: suffix: 35
1148: requires: ctetgen
1149: args: -run_type test -dm_plex_dim 3 -variable_coefficient field -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1151: test:
1152: suffix: 36
1153: requires: ctetgen
1154: args: -run_type test -dm_plex_dim 3 -dm_refine_volume_limit_pre 0.0125 -variable_coefficient field -petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1156: # Full solve 39-44
1157: test:
1158: suffix: 39
1159: requires: triangle !single
1160: args: -run_type full -dm_refine_volume_limit_pre 0.015625 -petscspace_degree 2 -pc_type gamg -pc_gamg_esteig_ksp_type cg -pc_gamg_esteig_ksp_max_it 10 -snes_rtol 1.0e-6 -ksp_rtol 1.0e-7 -ksp_monitor -ksp_converged_reason -snes_monitor_short -snes_converged_reason ::ascii_info_detail
1161: test:
1162: suffix: 40
1163: requires: triangle !single
1164: args: -run_type full -dm_refine_volume_limit_pre 0.015625 -variable_coefficient nonlinear -petscspace_degree 2 -pc_type svd -ksp_rtol 1.0e-10 -snes_monitor_short -snes_converged_reason ::ascii_info_detail
1165: test:
1166: suffix: 41
1167: requires: triangle !single
1168: args: -run_type full -dm_refine_volume_limit_pre 0.03125 -variable_coefficient nonlinear -petscspace_degree 1 -snes_type fas -snes_fas_levels 2 -fas_coarse_pc_type svd -fas_coarse_ksp_rtol 1.0e-10 -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -dm_refine_hierarchy 1 -snes_view -fas_levels_1_snes_type newtonls -fas_levels_1_pc_type svd -fas_levels_1_ksp_rtol 1.0e-10 -fas_levels_1_snes_monitor_short
1169: test:
1170: suffix: 42
1171: requires: triangle !single
1172: args: -run_type full -dm_refine_volume_limit_pre 0.0625 -variable_coefficient nonlinear -petscspace_degree 1 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type svd -fas_coarse_ksp_rtol 1.0e-10 -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -dm_refine_hierarchy 2 -snes_view -fas_levels_1_snes_type newtonls -fas_levels_1_pc_type svd -fas_levels_1_ksp_rtol 1.0e-10 -fas_levels_1_snes_monitor_short -fas_levels_2_snes_type newtonls -fas_levels_2_pc_type svd -fas_levels_2_ksp_rtol 1.0e-10 -fas_levels_2_snes_atol 1.0e-11 -fas_levels_2_snes_monitor_short
1173: test:
1174: suffix: 43
1175: requires: triangle !single
1176: nsize: 2
1177: args: -run_type full -dm_refine_volume_limit_pre 0.03125 -variable_coefficient nonlinear -petscspace_degree 1 -snes_type fas -snes_fas_levels 2 -fas_coarse_pc_type svd -fas_coarse_ksp_rtol 1.0e-10 -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -dm_refine_hierarchy 1 -snes_view -fas_levels_1_snes_type newtonls -fas_levels_1_pc_type svd -fas_levels_1_ksp_rtol 1.0e-10 -fas_levels_1_snes_monitor_short
1179: test:
1180: suffix: 44
1181: requires: triangle !single
1182: nsize: 2
1183: args: -run_type full -dm_refine_volume_limit_pre 0.0625 -variable_coefficient nonlinear -petscspace_degree 1 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type svd -fas_coarse_ksp_rtol 1.0e-10 -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -dm_refine_hierarchy 2 -dm_plex_print_fem 0 -snes_view -fas_levels_1_snes_type newtonls -fas_levels_1_pc_type svd -fas_levels_1_ksp_rtol 1.0e-10 -fas_levels_1_snes_monitor_short -fas_levels_2_snes_type newtonls -fas_levels_2_pc_type svd -fas_levels_2_ksp_rtol 1.0e-10 -fas_levels_2_snes_atol 1.0e-11 -fas_levels_2_snes_monitor_short
1185: # These tests use a loose tolerance just to exercise the PtAP operations for MATIS and multiple PCBDDC setup calls inside PCMG
1186: testset:
1187: requires: triangle !single
1188: nsize: 3
1189: args: -run_type full -petscspace_degree 1 -dm_mat_type is -pc_type mg -mg_coarse_pc_type bddc -pc_mg_galerkin pmat -ksp_rtol 1.0e-2 -snes_converged_reason -dm_refine_hierarchy 2 -snes_max_it 4
1190: test:
1191: suffix: gmg_bddc
1192: filter: sed -e "s/CONVERGED_FNORM_RELATIVE iterations 3/CONVERGED_FNORM_RELATIVE iterations 4/g"
1193: args: -mg_levels_pc_type jacobi
1194: test:
1195: filter: sed -e "s/iterations [0-4]/iterations 4/g"
1196: suffix: gmg_bddc_lev
1197: args: -mg_levels_pc_type bddc
1199: # VTU viewer with empty processes
1200: test:
1201: requires: !complex
1202: suffix: vtu_empty
1203: args: -quiet -run_type test -dm_plex_simplex 0 -dm_plex_box_faces 2,2 -vec_view vtk:test.vtu:vtk_vtu -petscspace_degree 1 -petscpartitioner_type simple
1205: # Restarting
1206: testset:
1207: suffix: restart
1208: requires: hdf5 triangle !complex
1209: args: -run_type test -bc_type dirichlet -petscspace_degree 1
1210: test:
1211: args: -dm_view hdf5:sol.h5 -vec_view hdf5:sol.h5::append
1212: test:
1213: args: -dm_plex_filename sol.h5 -dm_plex_name box -restart
1215: # Periodicity
1216: test:
1217: suffix: periodic_0
1218: requires: triangle
1219: args: -run_type full -bc_type dirichlet -petscspace_degree 1 -snes_converged_reason ::ascii_info_detail
1221: test:
1222: requires: !complex
1223: suffix: periodic_1
1224: args: -quiet -run_type test -dm_plex_simplex 0 -dm_plex_box_faces 3,3 -dm_plex_box_bd periodic,periodic -vec_view vtk:test.vtu:vtk_vtu -petscspace_degree 1 -dm_refine 1
1226: # 2D serial P1 test with field bc
1227: test:
1228: suffix: field_bc_2d_p1_0
1229: requires: triangle
1230: args: -run_type test -bc_type dirichlet -field_bc -petscspace_degree 1 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1232: test:
1233: suffix: field_bc_2d_p1_1
1234: requires: triangle
1235: args: -run_type test -dm_refine 1 -bc_type dirichlet -field_bc -petscspace_degree 1 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1237: test:
1238: suffix: field_bc_2d_p1_neumann_0
1239: requires: triangle
1240: args: -run_type test -bc_type neumann -dm_plex_boundary_label boundary -field_bc -petscspace_degree 1 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1242: test:
1243: suffix: field_bc_2d_p1_neumann_1
1244: requires: triangle
1245: args: -run_type test -dm_refine 1 -bc_type neumann -dm_plex_boundary_label boundary -field_bc -petscspace_degree 1 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1247: # 3D serial P1 test with field bc
1248: test:
1249: suffix: field_bc_3d_p1_0
1250: requires: ctetgen
1251: args: -run_type test -dm_plex_dim 3 -bc_type dirichlet -field_bc -petscspace_degree 1 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1253: test:
1254: suffix: field_bc_3d_p1_1
1255: requires: ctetgen
1256: args: -run_type test -dm_plex_dim 3 -dm_refine 1 -bc_type dirichlet -field_bc -petscspace_degree 1 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1258: test:
1259: suffix: field_bc_3d_p1_neumann_0
1260: requires: ctetgen
1261: args: -run_type test -dm_plex_dim 3 -bc_type neumann -dm_plex_boundary_label boundary -field_bc -petscspace_degree 1 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1263: test:
1264: suffix: field_bc_3d_p1_neumann_1
1265: requires: ctetgen
1266: args: -run_type test -dm_plex_dim 3 -dm_refine 1 -bc_type neumann -dm_plex_boundary_label boundary -field_bc -petscspace_degree 1 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1268: # 2D serial P2 test with field bc
1269: test:
1270: suffix: field_bc_2d_p2_0
1271: requires: triangle
1272: args: -run_type test -bc_type dirichlet -field_bc -petscspace_degree 2 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1274: test:
1275: suffix: field_bc_2d_p2_1
1276: requires: triangle
1277: args: -run_type test -dm_refine 1 -bc_type dirichlet -field_bc -petscspace_degree 2 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1279: test:
1280: suffix: field_bc_2d_p2_neumann_0
1281: requires: triangle
1282: args: -run_type test -bc_type neumann -dm_plex_boundary_label boundary -field_bc -petscspace_degree 2 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1284: test:
1285: suffix: field_bc_2d_p2_neumann_1
1286: requires: triangle
1287: args: -run_type test -dm_refine 1 -bc_type neumann -dm_plex_boundary_label boundary -field_bc -petscspace_degree 2 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1289: # 3D serial P2 test with field bc
1290: test:
1291: suffix: field_bc_3d_p2_0
1292: requires: ctetgen
1293: args: -run_type test -dm_plex_dim 3 -bc_type dirichlet -field_bc -petscspace_degree 2 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1295: test:
1296: suffix: field_bc_3d_p2_1
1297: requires: ctetgen
1298: args: -run_type test -dm_plex_dim 3 -dm_refine 1 -bc_type dirichlet -field_bc -petscspace_degree 2 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1300: test:
1301: suffix: field_bc_3d_p2_neumann_0
1302: requires: ctetgen
1303: args: -run_type test -dm_plex_dim 3 -bc_type neumann -dm_plex_boundary_label boundary -field_bc -petscspace_degree 2 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1305: test:
1306: suffix: field_bc_3d_p2_neumann_1
1307: requires: ctetgen
1308: args: -run_type test -dm_plex_dim 3 -dm_refine 1 -bc_type neumann -dm_plex_boundary_label boundary -field_bc -petscspace_degree 2 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1
1310: # Full solve simplex: Convergence
1311: test:
1312: suffix: 3d_p1_conv
1313: requires: ctetgen
1314: args: -run_type full -dm_plex_dim 3 -dm_refine 1 -bc_type dirichlet -petscspace_degree 1 \
1315: -snes_convergence_estimate -convest_num_refine 1 -pc_type lu
1317: # Full solve simplex: PCBDDC
1318: test:
1319: suffix: tri_bddc
1320: requires: triangle !single
1321: nsize: 5
1322: args: -run_type full -petscpartitioner_type simple -dm_refine 2 -bc_type dirichlet -petscspace_degree 1 -ksp_type gmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -dm_mat_type is -pc_type bddc -snes_monitor_short -ksp_monitor_short -snes_converged_reason ::ascii_info_detail -ksp_converged_reason -snes_view -show_solution 0
1324: # Full solve simplex: PCBDDC
1325: test:
1326: suffix: tri_parmetis_bddc
1327: requires: triangle !single parmetis
1328: nsize: 4
1329: args: -run_type full -petscpartitioner_type parmetis -dm_refine 2 -bc_type dirichlet -petscspace_degree 1 -ksp_type gmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -dm_mat_type is -pc_type bddc -snes_monitor_short -ksp_monitor_short -snes_converged_reason ::ascii_info_detail -ksp_converged_reason -snes_view -show_solution 0
1331: testset:
1332: args: -run_type full -dm_plex_simplex 0 -dm_plex_box_faces 3,3 -petscpartitioner_type simple -dm_refine 2 -bc_type dirichlet -petscspace_degree 2 -dm_mat_type is -pc_type bddc -ksp_type gmres -snes_monitor_short -ksp_monitor_short -snes_view -petscspace_poly_tensor -pc_bddc_corner_selection -ksp_rtol 1.e-9 -pc_bddc_use_edges 0
1333: nsize: 5
1334: output_file: output/ex12_quad_bddc.out
1335: filter: sed -e "s/aijcusparse/aij/g" -e "s/aijviennacl/aij/g" -e "s/factorization: cusparse/factorization: petsc/g"
1336: test:
1337: requires: !single
1338: suffix: quad_bddc
1339: test:
1340: requires: !single cuda
1341: suffix: quad_bddc_cuda
1342: args: -mat_is_localmat_type aijcusparse -pc_bddc_dirichlet_pc_factor_mat_solver_type cusparse -pc_bddc_neumann_pc_factor_mat_solver_type cusparse
1343: test:
1344: requires: !single viennacl
1345: suffix: quad_bddc_viennacl
1346: args: -mat_is_localmat_type aijviennacl
1348: # Full solve simplex: ASM
1349: test:
1350: suffix: tri_q2q1_asm_lu
1351: requires: triangle !single
1352: args: -run_type full -dm_refine 3 -bc_type dirichlet -petscspace_degree 1 -ksp_type gmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type asm -pc_asm_type restrict -pc_asm_blocks 4 -sub_pc_type lu -snes_monitor_short -ksp_monitor_short -snes_converged_reason ::ascii_info_detail -ksp_converged_reason -snes_view -show_solution 0
1354: test:
1355: suffix: tri_q2q1_msm_lu
1356: requires: triangle !single
1357: args: -run_type full -dm_refine 3 -bc_type dirichlet -petscspace_degree 1 -ksp_type gmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type asm -pc_asm_type restrict -pc_asm_local_type multiplicative -pc_asm_blocks 4 -sub_pc_type lu -snes_monitor_short -ksp_monitor_short -snes_converged_reason ::ascii_info_detail -ksp_converged_reason -snes_view -show_solution 0
1359: test:
1360: suffix: tri_q2q1_asm_sor
1361: requires: triangle !single
1362: args: -run_type full -dm_refine 3 -bc_type dirichlet -petscspace_degree 1 -ksp_type gmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type asm -pc_asm_type restrict -pc_asm_blocks 4 -sub_pc_type sor -snes_monitor_short -ksp_monitor_short -snes_converged_reason ::ascii_info_detail -ksp_converged_reason -snes_view -show_solution 0
1364: test:
1365: suffix: tri_q2q1_msm_sor
1366: requires: triangle !single
1367: args: -run_type full -dm_refine 3 -bc_type dirichlet -petscspace_degree 1 -ksp_type gmres -ksp_gmres_restart 100 -ksp_rtol 1.0e-9 -pc_type asm -pc_asm_type restrict -pc_asm_local_type multiplicative -pc_asm_blocks 4 -sub_pc_type sor -snes_monitor_short -ksp_monitor_short -snes_converged_reason ::ascii_info_detail -ksp_converged_reason -snes_view -show_solution 0
1369: # Full solve simplex: FAS
1370: test:
1371: suffix: fas_newton_0
1372: requires: triangle !single
1373: args: -run_type full -variable_coefficient nonlinear -petscspace_degree 1 -snes_type fas -snes_fas_levels 2 -fas_coarse_pc_type svd -fas_coarse_ksp_rtol 1.0e-10 -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -dm_refine_hierarchy 1 -snes_view -fas_levels_1_snes_type newtonls -fas_levels_1_pc_type svd -fas_levels_1_ksp_rtol 1.0e-10 -fas_levels_1_snes_monitor_short
1375: test:
1376: suffix: fas_newton_1
1377: requires: triangle !single
1378: args: -run_type full -dm_refine_hierarchy 3 -petscspace_degree 1 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type lu -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_snes_linesearch_type basic -fas_levels_ksp_rtol 1.0e-10 -fas_levels_snes_monitor_short
1379: filter: sed -e "s/total number of linear solver iterations=14/total number of linear solver iterations=15/g"
1381: test:
1382: suffix: fas_ngs_0
1383: requires: triangle !single
1384: args: -run_type full -variable_coefficient nonlinear -petscspace_degree 1 -snes_type fas -snes_fas_levels 2 -fas_coarse_pc_type svd -fas_coarse_ksp_rtol 1.0e-10 -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -dm_refine_hierarchy 1 -snes_view -fas_levels_1_snes_type ngs -fas_levels_1_snes_monitor_short
1386: # These two tests are broken because DMPlexComputeInjectorFEM() only works for regularly refined meshes
1387: test:
1388: suffix: fas_newton_coarse_0
1389: requires: pragmatic triangle
1390: TODO: broken
1391: args: -run_type full -variable_coefficient nonlinear -petscspace_degree 1 \
1392: -dm_refine 2 -dm_coarsen_hierarchy 1 -dm_plex_hash_location -dm_adaptor pragmatic \
1393: -snes_type fas -snes_fas_levels 2 -snes_converged_reason ::ascii_info_detail -snes_monitor_short -snes_view \
1394: -fas_coarse_pc_type svd -fas_coarse_ksp_rtol 1.0e-10 -fas_coarse_snes_monitor_short -fas_coarse_snes_linesearch_type basic \
1395: -fas_levels_1_snes_type newtonls -fas_levels_1_pc_type svd -fas_levels_1_ksp_rtol 1.0e-10 -fas_levels_1_snes_monitor_short
1397: test:
1398: suffix: mg_newton_coarse_0
1399: requires: triangle pragmatic
1400: TODO: broken
1401: args: -run_type full -petscspace_degree 1 \
1402: -dm_refine 3 -dm_coarsen_hierarchy 3 -dm_plex_hash_location -dm_adaptor pragmatic \
1403: -snes_atol 1.0e-8 -snes_rtol 0.0 -snes_monitor_short -snes_converged_reason ::ascii_info_detail -snes_view \
1404: -ksp_type richardson -ksp_atol 1.0e-8 -ksp_rtol 0.0 -ksp_norm_type unpreconditioned -ksp_monitor_true_residual \
1405: -pc_type mg -pc_mg_levels 4 \
1406: -mg_levels_ksp_type gmres -mg_levels_pc_type ilu -mg_levels_ksp_max_it 10
1408: # Test cgns writer for ranks with no elements
1409: test:
1410: suffix: cgns
1411: nsize: 5
1412: requires: cgns
1413: args: -quiet -run_type test -dm_plex_simplex 0 -petscspace_degree 1 -dm_plex_box_faces 2,2 -vec_view cgns:test.cgns -dm_refine 0 -petscpartitioner_type simple
1415: # Full solve tensor
1416: test:
1417: suffix: tensor_plex_2d
1418: args: -run_type test -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 1 -dm_refine_hierarchy 2
1420: test:
1421: suffix: tensor_p4est_2d
1422: requires: p4est
1423: args: -run_type test -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 1 -dm_forest_initial_refinement 2 -dm_forest_minimum_refinement 0 -dm_plex_convert_type p4est
1425: test:
1426: suffix: tensor_plex_3d
1427: args: -run_type test -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 1 -dm_plex_dim 3 -dm_refine_hierarchy 1 -dm_plex_box_faces 2,2,2
1429: test:
1430: suffix: tensor_p4est_3d
1431: requires: p4est
1432: args: -run_type test -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 1 -dm_forest_initial_refinement 1 -dm_forest_minimum_refinement 0 -dm_plex_dim 3 -dm_plex_convert_type p8est -dm_plex_box_faces 2,2,2
1434: test:
1435: suffix: p4est_test_q2_conformal_serial
1436: requires: p4est
1437: args: -run_type test -petscspace_degree 2 -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2
1439: test:
1440: suffix: p4est_test_q2_conformal_parallel
1441: requires: p4est
1442: nsize: 7
1443: args: -run_type test -petscspace_degree 2 -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -petscpartitioner_type simple
1445: test:
1446: suffix: p4est_test_q2_conformal_parallel_parmetis
1447: requires: parmetis p4est
1448: nsize: 4
1449: args: -run_type test -petscspace_degree 2 -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -petscpartitioner_type parmetis
1451: test:
1452: suffix: p4est_test_q2_nonconformal_serial
1453: requires: p4est
1454: filter: grep -v "CG or CGNE: variant"
1455: args: -run_type test -petscspace_degree 2 -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash
1457: test:
1458: suffix: p4est_test_q2_nonconformal_parallel
1459: requires: p4est
1460: filter: grep -v "CG or CGNE: variant"
1461: nsize: 7
1462: args: -run_type test -petscspace_degree 2 -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash -petscpartitioner_type simple
1464: test:
1465: suffix: p4est_test_q2_nonconformal_parallel_parmetis
1466: requires: parmetis p4est
1467: nsize: 4
1468: args: -run_type test -petscspace_degree 2 -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash -petscpartitioner_type parmetis
1470: test:
1471: suffix: p4est_exact_q2_conformal_serial
1472: requires: p4est !single !complex !__float128
1473: args: -run_type exact -petscspace_degree 2 -fas_levels_snes_atol 1.e-10 -snes_max_it 1 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type none -fas_coarse_ksp_type preonly -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type none -fas_levels_ksp_type preonly -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2
1475: test:
1476: suffix: p4est_exact_q2_conformal_parallel
1477: requires: p4est !single !complex !__float128
1478: nsize: 4
1479: args: -run_type exact -petscspace_degree 2 -fas_levels_snes_atol 1.e-10 -snes_max_it 1 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type none -fas_coarse_ksp_type preonly -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type none -fas_levels_ksp_type preonly -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2
1481: test:
1482: suffix: p4est_exact_q2_conformal_parallel_parmetis
1483: requires: parmetis p4est !single
1484: nsize: 4
1485: args: -run_type exact -petscspace_degree 2 -fas_levels_snes_linesearch_type basic -fas_levels_snes_atol 1.e-10 -snes_max_it 1 -snes_type fas -snes_fas_levels 3 -fas_coarse_snes_converged_reason -fas_coarse_pc_type none -fas_coarse_ksp_type preonly -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type none -fas_levels_ksp_type preonly -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -petscpartitioner_type parmetis
1487: test:
1488: suffix: p4est_exact_q2_nonconformal_serial
1489: requires: p4est
1490: args: -run_type exact -petscspace_degree 2 -fas_levels_snes_atol 1.e-10 -snes_max_it 1 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type none -fas_coarse_ksp_type preonly -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type none -fas_levels_ksp_type preonly -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash
1492: test:
1493: suffix: p4est_exact_q2_nonconformal_parallel
1494: requires: p4est
1495: nsize: 7
1496: args: -run_type exact -petscspace_degree 2 -fas_levels_snes_atol 1.e-10 -snes_max_it 1 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type none -fas_coarse_ksp_type preonly -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type none -fas_levels_ksp_type preonly -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash -petscpartitioner_type simple
1498: test:
1499: suffix: p4est_exact_q2_nonconformal_parallel_parmetis
1500: requires: parmetis p4est
1501: nsize: 4
1502: args: -run_type exact -petscspace_degree 2 -fas_levels_snes_atol 1.e-10 -snes_max_it 1 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type none -fas_coarse_ksp_type preonly -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type none -fas_levels_ksp_type preonly -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash -petscpartitioner_type parmetis
1504: test:
1505: suffix: p4est_full_q2_nonconformal_serial
1506: requires: p4est !single
1507: filter: grep -v "variant HERMITIAN"
1508: args: -run_type full -petscspace_degree 2 -snes_max_it 20 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type jacobi -fas_coarse_ksp_type cg -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type jacobi -fas_levels_ksp_type cg -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash
1510: test:
1511: suffix: p4est_full_q2_nonconformal_parallel
1512: requires: p4est !single
1513: filter: grep -v "variant HERMITIAN"
1514: nsize: 7
1515: args: -run_type full -petscspace_degree 2 -snes_max_it 20 -snes_type fas -snes_fas_levels 3 -fas_coarse_pc_type jacobi -fas_coarse_ksp_type cg -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type jacobi -fas_levels_ksp_type cg -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash -petscpartitioner_type simple
1517: test:
1518: suffix: p4est_full_q2_nonconformal_parallel_bddcfas
1519: requires: p4est !single
1520: filter: grep -v "variant HERMITIAN"
1521: nsize: 7
1522: args: -run_type full -petscspace_degree 2 -snes_max_it 20 -snes_type fas -snes_fas_levels 3 -dm_mat_type is -fas_coarse_pc_type bddc -fas_coarse_ksp_type cg -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type bddc -fas_levels_ksp_type cg -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash -petscpartitioner_type simple
1524: test:
1525: suffix: p4est_full_q2_nonconformal_parallel_bddc
1526: requires: p4est !single
1527: filter: grep -v "variant HERMITIAN"
1528: nsize: 7
1529: args: -run_type full -petscspace_degree 2 -snes_max_it 20 -snes_type newtonls -dm_mat_type is -pc_type bddc -ksp_type cg -snes_monitor_short -snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash -petscpartitioner_type simple
1531: test:
1532: TODO: broken
1533: suffix: p4est_fas_q2_conformal_serial
1534: requires: p4est !complex !__float128
1535: args: -run_type full -variable_coefficient nonlinear -petscspace_degree 2 -snes_max_it 20 -snes_type fas -snes_fas_levels 3 -pc_type jacobi -ksp_type gmres -fas_coarse_pc_type svd -fas_coarse_ksp_type gmres -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type svd -fas_levels_ksp_type gmres -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_refine_hierarchy 3
1537: test:
1538: TODO: broken
1539: suffix: p4est_fas_q2_nonconformal_serial
1540: requires: p4est
1541: args: -run_type full -variable_coefficient nonlinear -petscspace_degree 2 -snes_max_it 20 -snes_type fas -snes_fas_levels 3 -pc_type jacobi -ksp_type gmres -fas_coarse_pc_type jacobi -fas_coarse_ksp_type gmres -fas_coarse_ksp_monitor_true_residual -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_snes_type newtonls -fas_levels_pc_type jacobi -fas_levels_ksp_type gmres -fas_levels_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash
1543: test:
1544: suffix: fas_newton_0_p4est
1545: requires: p4est !single !__float128
1546: args: -run_type full -variable_coefficient nonlinear -petscspace_degree 1 -snes_type fas -snes_fas_levels 2 -fas_coarse_pc_type svd -fas_coarse_ksp_rtol 1.0e-10 -fas_coarse_snes_monitor_short -snes_monitor_short -fas_coarse_snes_linesearch_type basic -snes_converged_reason ::ascii_info_detail -snes_view -fas_levels_1_snes_type newtonls -fas_levels_1_pc_type svd -fas_levels_1_ksp_rtol 1.0e-10 -fas_levels_1_snes_monitor_short -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash
1548: # Full solve simplicial AMR
1549: test:
1550: suffix: tri_p1_adapt_init_pragmatic
1551: requires: pragmatic
1552: args: -run_type exact -dm_refine 5 -bc_type dirichlet -petscspace_degree 1 -variable_coefficient ball -snes_converged_reason ::ascii_info_detail -pc_type lu -snes_adapt_initial 1 -adaptor_target_num 4000 -dm_plex_metric_h_max 0.5 -dm_adaptor pragmatic
1554: test:
1555: suffix: tri_p2_adapt_init_pragmatic
1556: requires: pragmatic
1557: args: -run_type exact -dm_refine 5 -bc_type dirichlet -petscspace_degree 2 -variable_coefficient ball -snes_converged_reason ::ascii_info_detail -pc_type lu -snes_adapt_initial 1 -adaptor_target_num 4000 -dm_plex_metric_h_max 0.5 -dm_adaptor pragmatic
1559: test:
1560: suffix: tri_p1_adapt_init_mmg
1561: requires: mmg
1562: args: -run_type exact -dm_refine 5 -bc_type dirichlet -petscspace_degree 1 -variable_coefficient ball -snes_converged_reason ::ascii_info_detail -pc_type lu -snes_adapt_initial 1 -adaptor_target_num 4000 -dm_plex_metric_h_max 0.5 -dm_adaptor mmg
1564: test:
1565: suffix: tri_p2_adapt_init_mmg
1566: requires: mmg
1567: args: -run_type exact -dm_refine 5 -bc_type dirichlet -petscspace_degree 2 -variable_coefficient ball -snes_converged_reason ::ascii_info_detail -pc_type lu -snes_adapt_initial 1 -adaptor_target_num 4000 -dm_plex_metric_h_max 0.5 -dm_adaptor mmg
1569: test:
1570: suffix: tri_p1_adapt_seq_pragmatic
1571: requires: pragmatic
1572: args: -run_type exact -dm_refine 5 -bc_type dirichlet -petscspace_degree 1 -variable_coefficient ball -snes_converged_reason ::ascii_info_detail -pc_type lu -snes_adapt_sequence 2 -adaptor_target_num 4000 -dm_plex_metric_h_max 0.5 -dm_adaptor pragmatic
1574: test:
1575: suffix: tri_p2_adapt_seq_pragmatic
1576: requires: pragmatic
1577: args: -run_type exact -dm_refine 5 -bc_type dirichlet -petscspace_degree 2 -variable_coefficient ball -snes_converged_reason ::ascii_info_detail -pc_type lu -snes_adapt_sequence 2 -adaptor_target_num 4000 -dm_plex_metric_h_max 0.5 -dm_adaptor pragmatic
1579: test:
1580: suffix: tri_p1_adapt_seq_mmg
1581: requires: mmg
1582: args: -run_type exact -dm_refine 5 -bc_type dirichlet -petscspace_degree 1 -variable_coefficient ball -snes_converged_reason ::ascii_info_detail -pc_type lu -snes_adapt_sequence 2 -adaptor_target_num 4000 -dm_plex_metric_h_max 0.5 -dm_adaptor mmg
1584: test:
1585: suffix: tri_p2_adapt_seq_mmg
1586: requires: mmg
1587: args: -run_type exact -dm_refine 5 -bc_type dirichlet -petscspace_degree 2 -variable_coefficient ball -snes_converged_reason ::ascii_info_detail -pc_type lu -snes_adapt_sequence 2 -adaptor_target_num 4000 -dm_plex_metric_h_max 0.5 -dm_adaptor mmg
1589: test:
1590: suffix: tri_p1_adapt_analytic_pragmatic
1591: requires: pragmatic
1592: args: -run_type exact -dm_refine 3 -bc_type dirichlet -petscspace_degree 1 -variable_coefficient cross -snes_adapt_initial 4 -adaptor_target_num 500 -dm_plex_metric_h_min 0.0001 -dm_plex_metric_h_max 0.05 -dm_adaptor pragmatic
1593: output_file: output/empty.out
1595: test:
1596: suffix: tri_p2_adapt_analytic_pragmatic
1597: requires: pragmatic
1598: args: -run_type exact -dm_refine 3 -bc_type dirichlet -petscspace_degree 2 -variable_coefficient cross -snes_adapt_initial 4 -adaptor_target_num 500 -dm_plex_metric_h_min 0.0001 -dm_plex_metric_h_max 0.05 -dm_adaptor pragmatic
1599: output_file: output/empty.out
1601: test:
1602: suffix: tri_p1_adapt_analytic_mmg
1603: requires: mmg
1604: args: -run_type exact -dm_refine 3 -bc_type dirichlet -petscspace_degree 1 -variable_coefficient cross -snes_adapt_initial 4 -adaptor_target_num 500 -dm_plex_metric_h_max 0.5 -dm_adaptor mmg
1605: output_file: output/empty.out
1607: test:
1608: suffix: tri_p2_adapt_analytic_mmg
1609: requires: mmg
1610: args: -run_type exact -dm_refine 3 -bc_type dirichlet -petscspace_degree 2 -variable_coefficient cross -snes_adapt_initial 4 -adaptor_target_num 500 -dm_plex_metric_h_max 0.5 -dm_adaptor mmg
1611: output_file: output/empty.out
1613: test:
1614: suffix: tri_p1_adapt_uniform_pragmatic
1615: requires: pragmatic tetgen
1616: nsize: 2
1617: args: -run_type full -dm_plex_box_faces 8,8,8 -bc_type dirichlet -petscspace_degree 1 -variable_coefficient none -snes_converged_reason ::ascii_info_detail -ksp_type cg -pc_type sor -snes_adapt_sequence 3 -adaptor_target_num 400 -dm_plex_metric_h_max 0.5 -dm_plex_dim 3 -dm_adaptor pragmatic
1618: timeoutfactor: 2
1620: test:
1621: suffix: tri_p2_adapt_uniform_pragmatic
1622: requires: pragmatic tetgen
1623: nsize: 2
1624: args: -run_type full -dm_plex_box_faces 8,8,8 -bc_type dirichlet -petscspace_degree 2 -variable_coefficient none -snes_converged_reason ::ascii_info_detail -ksp_type cg -pc_type sor -snes_adapt_sequence 1 -adaptor_target_num 400 -dm_plex_metric_h_max 0.5 -dm_plex_dim 3 -dm_adaptor pragmatic
1625: timeoutfactor: 1
1627: test:
1628: suffix: tri_p1_adapt_uniform_mmg
1629: requires: mmg tetgen
1630: args: -run_type full -dm_plex_box_faces 4,4,4 -bc_type dirichlet -petscspace_degree 1 -variable_coefficient none -snes_converged_reason ::ascii_info_detail -ksp_type cg -pc_type sor -snes_adapt_sequence 3 -adaptor_target_num 400 -dm_plex_metric_h_max 0.5 -dm_plex_dim 3 -dm_adaptor mmg
1631: timeoutfactor: 2
1633: test:
1634: suffix: tri_p2_adapt_uniform_mmg
1635: requires: mmg tetgen
1636: TODO: broken
1637: args: -run_type full -dm_plex_box_faces 4,4,4 -bc_type dirichlet -petscspace_degree 2 -variable_coefficient none -snes_converged_reason ::ascii_info_detail -ksp_type cg -pc_type sor -snes_adapt_sequence 1 -adaptor_target_num 400 -dm_plex_metric_h_max 0.5 -dm_plex_dim 3 -dm_adaptor mmg
1638: timeoutfactor: 1
1640: test:
1641: suffix: tri_p1_adapt_uniform_parmmg
1642: requires: parmmg tetgen
1643: nsize: 2
1644: args: -run_type full -dm_plex_box_faces 8,8,8 -bc_type dirichlet -petscspace_degree 1 -variable_coefficient none -snes_converged_reason ::ascii_info_detail -ksp_type cg -pc_type sor -snes_adapt_sequence 3 -adaptor_target_num 400 -dm_plex_metric_h_max 0.5 -dm_plex_dim 3 -dm_adaptor parmmg
1645: timeoutfactor: 2
1647: test:
1648: suffix: tri_p2_adapt_uniform_parmmg
1649: requires: parmmg tetgen
1650: nsize: 2
1651: args: -run_type full -dm_plex_box_faces 8,8,8 -bc_type dirichlet -petscspace_degree 2 -variable_coefficient none -snes_converged_reason ::ascii_info_detail -ksp_type cg -pc_type sor -snes_adapt_sequence 1 -adaptor_target_num 400 -dm_plex_metric_h_max 0.5 -dm_plex_dim 3 -dm_adaptor parmmg
1652: timeoutfactor: 1
1654: # Full solve tensor AMR
1655: test:
1656: suffix: quad_q1_adapt_0
1657: requires: p4est
1658: args: -run_type exact -dm_plex_simplex 0 -dm_plex_convert_type p4est -bc_type dirichlet -petscspace_degree 1 -variable_coefficient ball -snes_converged_reason ::ascii_info_detail -pc_type lu -dm_forest_initial_refinement 4 -snes_adapt_initial 1 -dm_view
1659: filter: grep -v DM_
1661: test:
1662: suffix: amr_0
1663: nsize: 5
1664: args: -run_type test -petscpartitioner_type simple -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 1 -dm_refine 1
1666: test:
1667: suffix: amr_1
1668: requires: p4est !complex
1669: args: -run_type test -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 1 -dm_plex_convert_type p4est -dm_p4est_refine_pattern center -dm_forest_maximum_refinement 5 -dm_view vtk:amr.vtu:vtk_vtu -vec_view vtk:amr.vtu:vtk_vtu:append
1671: test:
1672: suffix: p4est_solve_bddc
1673: requires: p4est !complex
1674: args: -run_type full -variable_coefficient nonlinear -nonzero_initial_guess 1 -petscspace_degree 2 -snes_max_it 20 -snes_type newtonls -dm_mat_type is -pc_type bddc -ksp_type cg -snes_monitor_short -ksp_monitor -snes_linesearch_type bt -snes_converged_reason -snes_view -dm_plex_simplex 0 -petscspace_poly_tensor -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash -petscpartitioner_type simple -pc_bddc_detect_disconnected
1675: nsize: 4
1677: test:
1678: suffix: p4est_solve_fas
1679: requires: p4est
1680: args: -run_type full -variable_coefficient nonlinear -nonzero_initial_guess 1 -petscspace_degree 2 -snes_max_it 10 -snes_type fas -snes_linesearch_type bt -snes_fas_levels 3 -fas_coarse_snes_type newtonls -fas_coarse_snes_linesearch_type basic -fas_coarse_ksp_type cg -fas_coarse_pc_type jacobi -fas_coarse_snes_monitor_short -fas_levels_snes_max_it 4 -fas_levels_snes_type newtonls -fas_levels_snes_linesearch_type bt -fas_levels_ksp_type cg -fas_levels_pc_type jacobi -fas_levels_snes_monitor_short -fas_levels_cycle_snes_linesearch_type bt -snes_monitor_short -snes_converged_reason -snes_view -dm_plex_simplex 0 -petscspace_poly_tensor -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash
1681: nsize: 4
1682: TODO: identical machine two runs produce slightly different solver trackers
1684: test:
1685: suffix: p4est_convergence_test_1
1686: requires: p4est
1687: args: -quiet -run_type test -petscspace_degree 1 -dm_plex_simplex 0 -petscspace_poly_tensor -dm_plex_convert_type p4est -dm_forest_minimum_refinement 2 -dm_forest_initial_refinement 2 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash
1688: nsize: 4
1690: # Serial tests with GLVis visualization
1691: test:
1692: suffix: glvis_2d_tet_p1
1693: args: -quiet -run_type test -bc_type dirichlet -petscspace_degree 1 -vec_view glvis: -dm_plex_filename ${wPETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh -dm_plex_boundary_label marker -dm_plex_gmsh_periodic 0 -dm_coord_space 0
1694: test:
1695: suffix: glvis_2d_tet_p2
1696: args: -quiet -run_type test -bc_type dirichlet -petscspace_degree 2 -vec_view glvis: -dm_plex_filename ${wPETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh -dm_plex_boundary_label marker -dm_plex_gmsh_periodic 0 -dm_coord_space 0
1697: test:
1698: suffix: glvis_2d_hex_p1
1699: args: -quiet -run_type test -bc_type dirichlet -petscspace_degree 1 -vec_view glvis: -dm_plex_simplex 0 -dm_refine 1 -dm_coord_space 0
1700: test:
1701: suffix: glvis_2d_hex_p2
1702: args: -quiet -run_type test -bc_type dirichlet -petscspace_degree 2 -vec_view glvis: -dm_plex_simplex 0 -dm_refine 1 -dm_coord_space 0
1703: test:
1704: suffix: glvis_2d_hex_p2_p4est
1705: requires: p4est
1706: args: -quiet -run_type test -bc_type dirichlet -petscspace_degree 2 -vec_view glvis: -dm_plex_simplex 0 -dm_plex_convert_type p4est -dm_forest_minimum_refinement 0 -dm_forest_initial_refinement 1 -dm_forest_maximum_refinement 4 -dm_p4est_refine_pattern hash -viewer_glvis_dm_plex_enable_ncmesh
1707: test:
1708: suffix: glvis_2d_tet_p0
1709: args: -run_type exact -guess_vec_view glvis: -nonzero_initial_guess 1 -dm_plex_filename ${wPETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh -dm_plex_boundary_label marker -petscspace_degree 0 -dm_coord_space 0 -pc_type jacobi
1710: test:
1711: suffix: glvis_2d_hex_p0
1712: args: -run_type exact -guess_vec_view glvis: -nonzero_initial_guess 1 -dm_plex_box_faces 5,7 -dm_plex_simplex 0 -petscspace_degree 0 -dm_coord_space 0 -pc_type jacobi
1714: # PCHPDDM tests
1715: testset:
1716: nsize: 4
1717: requires: hpddm slepc !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
1718: args: -run_type test -run_test_check_ksp -quiet -petscspace_degree 1 -petscpartitioner_type simple -bc_type none -dm_plex_simplex 0 -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type lu -pc_hpddm_levels_1_eps_nev 2 -pc_hpddm_coarse_p 1 -pc_hpddm_coarse_pc_type svd -ksp_rtol 1.e-10 -pc_hpddm_levels_1_st_pc_factor_shift_type INBLOCKS -ksp_converged_reason
1719: test:
1720: suffix: quad_singular_hpddm
1721: args: -dm_plex_box_faces 6,7
1722: test:
1723: requires: p4est
1724: suffix: p4est_singular_2d_hpddm
1725: args: -dm_plex_convert_type p4est -dm_forest_minimum_refinement 1 -dm_forest_initial_refinement 3 -dm_forest_maximum_refinement 3
1726: test:
1727: requires: p4est
1728: suffix: p4est_nc_singular_2d_hpddm
1729: args: -dm_plex_convert_type p4est -dm_forest_minimum_refinement 1 -dm_forest_initial_refinement 1 -dm_forest_maximum_refinement 3 -dm_p4est_refine_pattern hash
1730: testset:
1731: nsize: 4
1732: requires: hpddm slepc triangle !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
1733: args: -run_type full -petscpartitioner_type simple -dm_refine 2 -bc_type dirichlet -petscspace_degree 2 -ksp_type gmres -ksp_gmres_restart 100 -pc_type hpddm -snes_monitor_short -ksp_monitor_short -snes_converged_reason ::ascii_info_detail -ksp_converged_reason -snes_view -show_solution 0 -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type lu -pc_hpddm_levels_1_eps_nev 4 -pc_hpddm_coarse_p 2 -pc_hpddm_coarse_pc_type redundant -ksp_rtol 1.e-1
1734: test:
1735: args: -pc_hpddm_coarse_mat_type baij -options_left no
1736: suffix: tri_hpddm_reuse_baij
1737: test:
1738: requires: !complex
1739: suffix: tri_hpddm_reuse
1740: testset:
1741: nsize: 4
1742: requires: hpddm slepc !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
1743: args: -run_type full -petscpartitioner_type simple -dm_plex_box_faces 7,5 -dm_refine 2 -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 2 -ksp_type gmres -ksp_gmres_restart 100 -pc_type hpddm -snes_monitor_short -ksp_monitor_short -snes_converged_reason ::ascii_info_detail -ksp_converged_reason -snes_view -show_solution 0 -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type lu -pc_hpddm_levels_1_eps_nev 4 -pc_hpddm_coarse_p 2 -pc_hpddm_coarse_pc_type redundant -ksp_rtol 1.e-1
1744: test:
1745: args: -pc_hpddm_coarse_mat_type baij -options_left no
1746: suffix: quad_hpddm_reuse_baij
1747: test:
1748: requires: !complex
1749: suffix: quad_hpddm_reuse
1750: testset:
1751: nsize: 4
1752: requires: hpddm slepc !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
1753: args: -run_type full -petscpartitioner_type simple -dm_plex_box_faces 7,5 -dm_refine 2 -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 1 -ksp_type gmres -ksp_gmres_restart 100 -pc_type hpddm -snes_monitor_short -ksp_monitor_short -snes_converged_reason ::ascii_info_detail -ksp_converged_reason -snes_view -show_solution 0 -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type lu -pc_hpddm_levels_1_eps_threshold_absolute 0.1 -pc_hpddm_coarse_p 2 -pc_hpddm_coarse_pc_type redundant -ksp_rtol 1.e-1
1754: test:
1755: args: -pc_hpddm_coarse_mat_type baij -options_left no
1756: suffix: quad_hpddm_reuse_threshold_baij
1757: test:
1758: requires: !complex
1759: suffix: quad_hpddm_reuse_threshold
1760: testset:
1761: nsize: 4
1762: requires: hpddm slepc parmetis !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES)
1763: filter: sed -e "s/linear solver iterations=17/linear solver iterations=16/g"
1764: args: -run_type full -petscpartitioner_type parmetis -dm_refine 3 -bc_type dirichlet -petscspace_degree 1 -ksp_type gmres -ksp_gmres_restart 100 -pc_type hpddm -snes_monitor_short -snes_converged_reason ::ascii_info_detail -snes_view -show_solution 0 -pc_type hpddm -pc_hpddm_levels_1_sub_pc_type icc -pc_hpddm_levels_1_eps_nev 20 -pc_hpddm_coarse_p 2 -pc_hpddm_coarse_pc_type redundant -ksp_rtol 1.e-10 -dm_plex_filename ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh -dm_plex_boundary_label marker -pc_hpddm_levels_1_sub_pc_factor_levels 3 -variable_coefficient ball -dm_plex_gmsh_periodic 0 -fp_trap 0
1765: test:
1766: args: -pc_hpddm_coarse_mat_type baij -options_left no
1767: filter: grep -v " total: nonzeros=" | grep -v " rows=" | sed -e "s/total number of linear solver iterations=[1-2][4-7]/total number of linear solver iterations=16/g"
1768: suffix: tri_parmetis_hpddm_baij
1769: test:
1770: filter: grep -v " total: nonzeros=" | grep -v " rows=" | sed -e "s/total number of linear solver iterations=[1-2][4-7]/total number of linear solver iterations=16/g"
1771: requires: !complex
1772: suffix: tri_parmetis_hpddm
1774: # 2D serial P1 tests for adaptive MG
1775: test:
1776: suffix: 2d_p1_adaptmg_0
1777: requires: triangle
1778: args: -petscpartitioner_type simple -dm_refine_hierarchy 3 -dm_plex_box_faces 4,4 -bc_type dirichlet -petscspace_degree 1 \
1779: -variable_coefficient checkerboard_0 -mat_petscspace_degree 0 -div 16 -k 3 \
1780: -snes_max_it 1 -ksp_converged_reason \
1781: -ksp_rtol 1e-8 -pc_type mg
1782: test:
1783: suffix: 2d_p1_adaptmg_1
1784: requires: triangle bamg
1785: args: -petscpartitioner_type simple -dm_refine_hierarchy 3 -dm_plex_box_faces 4,4 -bc_type dirichlet -petscspace_degree 1 \
1786: -variable_coefficient checkerboard_0 -mat_petscspace_degree 0 -div 16 -k 3 \
1787: -snes_max_it 1 -ksp_converged_reason \
1788: -ksp_rtol 1e-8 -pc_type mg -pc_mg_galerkin -pc_mg_adapt_interp_coarse_space eigenvector -pc_mg_adapt_interp_n 1 \
1789: -pc_mg_mesp_ksp_type richardson -pc_mg_mesp_ksp_richardson_self_scale -pc_mg_mesp_ksp_max_it 100 -pc_mg_mesp_pc_type none
1790: test:
1791: suffix: 2d_p1_adaptmg_gdsw
1792: requires: triangle
1793: nsize: 4
1794: args: -petscpartitioner_type simple -dm_refine 3 -dm_plex_box_faces 4,4 -bc_type dirichlet -petscspace_degree 1 \
1795: -variable_coefficient checkerboard_0 -mat_petscspace_degree 0 -div 16 -k 3 \
1796: -snes_max_it 1 -ksp_converged_reason \
1797: -ksp_rtol 1e-8 -pc_type mg -pc_mg_galerkin -pc_mg_adapt_interp_coarse_space gdsw -pc_mg_levels 2 -mg_levels_pc_type asm -dm_mat_type {{aij is}}
1799: test:
1800: suffix: 2d_p1_adaptmg_agdsw
1801: requires: triangle mumps
1802: nsize: 4
1803: args: -petscpartitioner_type simple -dm_refine 3 -dm_plex_box_faces 4,4 -bc_type dirichlet -petscspace_degree 1 \
1804: -variable_coefficient checkerboard_0 -mat_petscspace_degree 0 -div 16 -k 3 \
1805: -snes_max_it 1 -ksp_converged_reason \
1806: -ksp_rtol 1e-8 -pc_type mg -pc_mg_galerkin -pc_mg_adapt_interp_coarse_space gdsw -pc_mg_levels 2 -mg_levels_pc_type asm -dm_mat_type is -mg_levels_gdsw_tolerance 0.1 -mg_levels_gdsw_pseudo_pc_type qr
1808: test:
1809: suffix: p4est_2d_asm
1810: requires: p4est
1811: nsize: 4
1812: args: -run_type test -run_test_check_ksp -quiet -petscspace_degree 1 -petscpartitioner_type simple -bc_type none -dm_plex_simplex 0 \
1813: -pc_type asm -ksp_converged_reason -dm_plex_convert_type p4est -dm_forest_minimum_refinement 1 -dm_forest_initial_refinement 3 -dm_forest_maximum_refinement 5 \
1814: -pc_asm_dm_subdomains -dm_p4est_refine_pattern hash -dm_plex_dd_overlap 1 -sub_pc_type lu
1816: TEST*/