Actual source code: ex24.c
1: static char help[] = "Poisson Problem in mixed form with 2d and 3d with 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 automatic convergence estimation\n\
5: and Hdiv elements.\n\n\n";
7: /*
9: The mixed form of Poisson's equation, e.g. https://firedrakeproject.org/demos/poisson_mixed.py.html, is given
10: in the strong form by
11: \begin{align}
12: \vb{q} - \nabla u &= 0 \\
13: \nabla \cdot \vb{q} &= f
14: \end{align}
15: where $u$ is the potential, as in the original problem, but we also discretize the gradient of potential $\vb{q}$,
16: or flux, directly. The weak form is then
17: \begin{align}
18: <t, \vb{q}> + <\nabla \cdot t, u> - <t_n, u>_\Gamma &= 0 \\
19: <v, \nabla \cdot \vb{q}> &= <v, f>
20: \end{align}
21: For the original Poisson problem, the Dirichlet boundary forces an essential boundary condition on the potential space,
22: and the Neumann boundary gives a natural boundary condition in the weak form. In the mixed formulation, the Neumann
23: boundary gives an essential boundary condition on the flux space, $\vb{q} \cdot \vu{n} = h$, and the Dirichlet condition
24: becomes a natural condition in the weak form, <t_n, g>_\Gamma.
25: */
27: #include <petscdmplex.h>
28: #include <petscsnes.h>
29: #include <petscds.h>
30: #include <petscconvest.h>
32: typedef enum {
33: SOL_LINEAR,
34: SOL_QUADRATIC,
35: SOL_QUARTIC,
36: SOL_QUARTIC_NEUMANN,
37: SOL_UNKNOWN,
38: NUM_SOLTYPE
39: } SolType;
40: const char *SolTypeNames[NUM_SOLTYPE + 3] = {"linear", "quadratic", "quartic", "quartic_neumann", "unknown", "SolType", "SOL_", NULL};
42: typedef struct {
43: SolType solType; /* The type of exact solution */
44: } AppCtx;
46: 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[])
47: {
48: PetscInt d;
49: for (d = 0; d < dim; ++d) f0[0] += u_x[uOff_x[0] + d * dim + d];
50: }
52: /* 2D Dirichlet potential example
54: u = x
55: q = <1, 0>
56: f = 0
58: We will need a boundary integral of u over \Gamma.
59: */
60: static PetscErrorCode linear_u(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
61: {
62: u[0] = x[0];
63: return PETSC_SUCCESS;
64: }
65: static PetscErrorCode linear_q(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
66: {
67: PetscInt c;
68: for (c = 0; c < Nc; ++c) u[c] = c ? 0.0 : 1.0;
69: return PETSC_SUCCESS;
70: }
72: static void f0_linear_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[])
73: {
74: f0[0] = 0.0;
75: f0_u(dim, Nf, NfAux, uOff, uOff_x, u, u_t, u_x, aOff, aOff_x, a, a_t, a_x, t, x, numConstants, constants, f0);
76: }
77: static void f0_bd_linear_q(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[])
78: {
79: PetscScalar potential;
80: PetscInt d;
82: PetscCallAbort(PETSC_COMM_SELF, linear_u(dim, t, x, dim, &potential, NULL));
83: for (d = 0; d < dim; ++d) f0[d] = -potential * n[d];
84: }
86: /* 2D Dirichlet potential example
88: u = x^2 + y^2
89: q = <2x, 2y>
90: f = 4
92: We will need a boundary integral of u over \Gamma.
93: */
94: static PetscErrorCode quadratic_u(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
95: {
96: PetscInt d;
98: u[0] = 0.0;
99: for (d = 0; d < dim; ++d) u[0] += x[d] * x[d];
100: return PETSC_SUCCESS;
101: }
102: static PetscErrorCode quadratic_q(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
103: {
104: PetscInt c;
105: for (c = 0; c < Nc; ++c) u[c] = 2.0 * x[c];
106: return PETSC_SUCCESS;
107: }
109: static void f0_quadratic_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[])
110: {
111: f0[0] = -4.0;
112: f0_u(dim, Nf, NfAux, uOff, uOff_x, u, u_t, u_x, aOff, aOff_x, a, a_t, a_x, t, x, numConstants, constants, f0);
113: }
114: static void f0_bd_quadratic_q(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[])
115: {
116: PetscScalar potential;
117: PetscInt d;
119: PetscCallAbort(PETSC_COMM_SELF, quadratic_u(dim, t, x, dim, &potential, NULL));
120: for (d = 0; d < dim; ++d) f0[d] = -potential * n[d];
121: }
123: /* 2D Dirichlet potential example
125: u = x (1-x) y (1-y)
126: q = <(1-2x) y (1-y), x (1-x) (1-2y)>
127: f = -y (1-y) - x (1-x)
129: u|_\Gamma = 0 so that the boundary integral vanishes
130: */
131: static PetscErrorCode quartic_u(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
132: {
133: PetscInt d;
135: u[0] = 1.0;
136: for (d = 0; d < dim; ++d) u[0] *= x[d] * (1.0 - x[d]);
137: return PETSC_SUCCESS;
138: }
139: static PetscErrorCode quartic_q(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx)
140: {
141: PetscInt c, d;
143: for (c = 0; c < Nc; ++c) {
144: u[c] = 1.0;
145: for (d = 0; d < dim; ++d) {
146: if (c == d) u[c] *= 1 - 2.0 * x[d];
147: else u[c] *= x[d] * (1.0 - x[d]);
148: }
149: }
150: return PETSC_SUCCESS;
151: }
153: static void f0_quartic_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[])
154: {
155: PetscInt d;
156: f0[0] = 0.0;
157: for (d = 0; d < dim; ++d) f0[0] += 2.0 * x[d] * (1.0 - x[d]);
158: f0_u(dim, Nf, NfAux, uOff, uOff_x, u, u_t, u_x, aOff, aOff_x, a, a_t, a_x, t, x, numConstants, constants, f0);
159: }
161: /* 2D Dirichlet potential example
163: u = x (1-x) y (1-y)
164: q = <(1-2x) y (1-y), x (1-x) (1-2y)>
165: f = -y (1-y) - x (1-x)
167: du/dn_\Gamma = {(1-2x) y (1-y), x (1-x) (1-2y)} . n produces an essential condition on q
168: */
170: static void f0_q(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[])
171: {
172: PetscInt c;
173: for (c = 0; c < dim; ++c) f0[c] = u[uOff[0] + c];
174: }
176: /* <\nabla\cdot w, u> = <\nabla w, Iu> */
177: static void f1_q(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[])
178: {
179: PetscInt c;
180: for (c = 0; c < dim; ++c) f1[c * dim + c] = u[uOff[1]];
181: }
183: /* <t, q> */
184: static void g0_qq(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, PetscReal u_tShift, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g0[])
185: {
186: PetscInt c;
187: for (c = 0; c < dim; ++c) g0[c * dim + c] = 1.0;
188: }
190: /* <\nabla\cdot t, u> = <\nabla t, Iu> */
191: static void g2_qu(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 g2[])
192: {
193: PetscInt d;
194: for (d = 0; d < dim; ++d) g2[d * dim + d] = 1.0;
195: }
197: /* <v, \nabla\cdot q> */
198: static void g1_uq(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 g1[])
199: {
200: PetscInt d;
201: for (d = 0; d < dim; ++d) g1[d * dim + d] = 1.0;
202: }
204: static PetscErrorCode ProcessOptions(MPI_Comm comm, AppCtx *options)
205: {
206: PetscFunctionBeginUser;
207: options->solType = SOL_LINEAR;
208: PetscOptionsBegin(comm, "", "Poisson Problem Options", "DMPLEX");
209: PetscCall(PetscOptionsEnum("-sol_type", "Type of exact solution", "ex24.c", SolTypeNames, (PetscEnum)options->solType, (PetscEnum *)&options->solType, NULL));
210: PetscOptionsEnd();
211: PetscFunctionReturn(PETSC_SUCCESS);
212: }
214: static PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user, DM *dm)
215: {
216: PetscFunctionBeginUser;
217: PetscCall(DMCreate(comm, dm));
218: PetscCall(DMSetType(*dm, DMPLEX));
219: PetscCall(PetscObjectSetName((PetscObject)*dm, "Example Mesh"));
220: PetscCall(DMSetApplicationContext(*dm, user));
221: PetscCall(DMSetFromOptions(*dm));
222: PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view"));
223: PetscFunctionReturn(PETSC_SUCCESS);
224: }
226: static PetscErrorCode SetupPrimalProblem(DM dm, AppCtx *user)
227: {
228: PetscDS ds;
229: DMLabel label;
230: PetscWeakForm wf;
231: const PetscInt id = 1;
232: PetscInt bd;
234: PetscFunctionBeginUser;
235: PetscCall(DMGetLabel(dm, "marker", &label));
236: PetscCall(DMGetDS(dm, &ds));
237: PetscCall(PetscDSSetResidual(ds, 0, f0_q, f1_q));
238: PetscCall(PetscDSSetJacobian(ds, 0, 0, g0_qq, NULL, NULL, NULL));
239: PetscCall(PetscDSSetJacobian(ds, 0, 1, NULL, NULL, g2_qu, NULL));
240: PetscCall(PetscDSSetJacobian(ds, 1, 0, NULL, g1_uq, NULL, NULL));
241: switch (user->solType) {
242: case SOL_LINEAR:
243: PetscCall(PetscDSSetResidual(ds, 1, f0_linear_u, NULL));
244: PetscCall(DMAddBoundary(dm, DM_BC_NATURAL, "Dirichlet Bd Integral", label, 1, &id, 0, 0, NULL, NULL, NULL, user, &bd));
245: PetscCall(PetscDSGetBoundary(ds, bd, &wf, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL));
246: PetscCall(PetscWeakFormSetIndexBdResidual(wf, label, 1, 0, 0, 0, f0_bd_linear_q, 0, NULL));
247: PetscCall(PetscDSSetExactSolution(ds, 0, linear_q, user));
248: PetscCall(PetscDSSetExactSolution(ds, 1, linear_u, user));
249: break;
250: case SOL_QUADRATIC:
251: PetscCall(PetscDSSetResidual(ds, 1, f0_quadratic_u, NULL));
252: PetscCall(DMAddBoundary(dm, DM_BC_NATURAL, "Dirichlet Bd Integral", label, 1, &id, 0, 0, NULL, NULL, NULL, user, &bd));
253: PetscCall(PetscDSGetBoundary(ds, bd, &wf, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL));
254: PetscCall(PetscWeakFormSetIndexBdResidual(wf, label, 1, 0, 0, 0, f0_bd_quadratic_q, 0, NULL));
255: PetscCall(PetscDSSetExactSolution(ds, 0, quadratic_q, user));
256: PetscCall(PetscDSSetExactSolution(ds, 1, quadratic_u, user));
257: break;
258: case SOL_QUARTIC:
259: PetscCall(PetscDSSetResidual(ds, 1, f0_quartic_u, NULL));
260: PetscCall(PetscDSSetExactSolution(ds, 0, quartic_q, user));
261: PetscCall(PetscDSSetExactSolution(ds, 1, quartic_u, user));
262: break;
263: case SOL_QUARTIC_NEUMANN:
264: PetscCall(PetscDSSetResidual(ds, 1, f0_quartic_u, NULL));
265: PetscCall(PetscDSSetExactSolution(ds, 0, quartic_q, user));
266: PetscCall(PetscDSSetExactSolution(ds, 1, quartic_u, user));
267: PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL, "Flux condition", label, 1, &id, 0, 0, NULL, (void (*)(void))quartic_q, NULL, user, NULL));
268: break;
269: default:
270: SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Invalid exact solution type %s", SolTypeNames[PetscMin(user->solType, SOL_UNKNOWN)]);
271: }
272: PetscFunctionReturn(PETSC_SUCCESS);
273: }
275: static PetscErrorCode SetupDiscretization(DM dm, PetscErrorCode (*setup)(DM, AppCtx *), AppCtx *user)
276: {
277: DM cdm = dm;
278: PetscFE feq, feu;
279: DMPolytopeType ct;
280: PetscBool simplex;
281: PetscInt dim, cStart;
283: PetscFunctionBeginUser;
284: PetscCall(DMGetDimension(dm, &dim));
285: PetscCall(DMPlexGetHeightStratum(dm, 0, &cStart, NULL));
286: PetscCall(DMPlexGetCellType(dm, cStart, &ct));
287: simplex = DMPolytopeTypeGetNumVertices(ct) == DMPolytopeTypeGetDim(ct) + 1 ? PETSC_TRUE : PETSC_FALSE;
288: /* Create finite element */
289: PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, dim, simplex, "field_", -1, &feq));
290: PetscCall(PetscObjectSetName((PetscObject)feq, "field"));
291: PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, "potential_", -1, &feu));
292: PetscCall(PetscObjectSetName((PetscObject)feu, "potential"));
293: PetscCall(PetscFECopyQuadrature(feq, feu));
294: /* Set discretization and boundary conditions for each mesh */
295: PetscCall(DMSetField(dm, 0, NULL, (PetscObject)feq));
296: PetscCall(DMSetField(dm, 1, NULL, (PetscObject)feu));
297: PetscCall(DMCreateDS(dm));
298: PetscCall((*setup)(dm, user));
299: while (cdm) {
300: PetscCall(DMCopyDisc(dm, cdm));
301: PetscCall(DMGetCoarseDM(cdm, &cdm));
302: }
303: PetscCall(PetscFEDestroy(&feq));
304: PetscCall(PetscFEDestroy(&feu));
305: PetscFunctionReturn(PETSC_SUCCESS);
306: }
308: int main(int argc, char **argv)
309: {
310: DM dm; /* Problem specification */
311: SNES snes; /* Nonlinear solver */
312: Vec u; /* Solutions */
313: AppCtx user; /* User-defined work context */
315: PetscFunctionBeginUser;
316: PetscCall(PetscInitialize(&argc, &argv, NULL, help));
317: PetscCall(ProcessOptions(PETSC_COMM_WORLD, &user));
318: /* Primal system */
319: PetscCall(SNESCreate(PETSC_COMM_WORLD, &snes));
320: PetscCall(CreateMesh(PETSC_COMM_WORLD, &user, &dm));
321: PetscCall(SNESSetDM(snes, dm));
322: PetscCall(SetupDiscretization(dm, SetupPrimalProblem, &user));
323: PetscCall(DMCreateGlobalVector(dm, &u));
324: PetscCall(VecSet(u, 0.0));
325: PetscCall(PetscObjectSetName((PetscObject)u, "potential"));
326: PetscCall(DMPlexSetSNESLocalFEM(dm, &user, &user, &user));
327: PetscCall(SNESSetFromOptions(snes));
328: PetscCall(DMSNESCheckFromOptions(snes, u));
329: PetscCall(SNESSolve(snes, NULL, u));
330: PetscCall(SNESGetSolution(snes, &u));
331: PetscCall(VecViewFromOptions(u, NULL, "-potential_view"));
332: /* Cleanup */
333: PetscCall(VecDestroy(&u));
334: PetscCall(SNESDestroy(&snes));
335: PetscCall(DMDestroy(&dm));
336: PetscCall(PetscFinalize());
337: return 0;
338: }
340: /*TEST
342: test:
343: suffix: 2d_bdm1_p0
344: requires: triangle
345: args: -sol_type linear \
346: -field_petscspace_degree 1 -field_petscdualspace_type bdm -dm_refine 1 \
347: -dmsnes_check .001 -snes_error_if_not_converged \
348: -ksp_rtol 1e-10 -ksp_error_if_not_converged \
349: -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -pc_fieldsplit_schur_precondition full \
350: -fieldsplit_field_pc_type lu \
351: -fieldsplit_potential_ksp_rtol 1e-10 -fieldsplit_potential_pc_type lu
352: test:
353: # Using -dm_refine 2 -convest_num_refine 3 we get L_2 convergence rate: [2.0, 1.0]
354: # Using -sol_type quadratic -dm_refine 2 -convest_num_refine 3 we get L_2 convergence rate: [2.9, 1.0]
355: suffix: 2d_bdm1_p0_conv
356: requires: triangle
357: args: -sol_type quartic \
358: -field_petscspace_degree 1 -field_petscdualspace_type bdm -dm_refine 0 -convest_num_refine 1 -snes_convergence_estimate \
359: -snes_error_if_not_converged \
360: -ksp_rtol 1e-10 -ksp_error_if_not_converged \
361: -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -pc_fieldsplit_schur_precondition full \
362: -fieldsplit_field_pc_type lu \
363: -fieldsplit_potential_ksp_rtol 1e-10 -fieldsplit_potential_pc_type lu
365: test:
366: # HDF5 output: -dm_view hdf5:${PETSC_DIR}/sol.h5 -potential_view hdf5:${PETSC_DIR}/sol.h5::append -exact_vec_view hdf5:${PETSC_DIR}/sol.h5::append
367: # VTK output: -potential_view vtk: -exact_vec_view vtk:
368: # VTU output: -potential_view vtk:multifield.vtu -exact_vec_view vtk:exact.vtu
369: suffix: 2d_q2_p0
370: requires: triangle
371: args: -sol_type linear -dm_plex_simplex 0 \
372: -field_petscspace_degree 2 -dm_refine 0 \
373: -dmsnes_check .001 -snes_error_if_not_converged \
374: -ksp_rtol 1e-10 -ksp_error_if_not_converged \
375: -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -pc_fieldsplit_schur_precondition full \
376: -fieldsplit_field_pc_type lu \
377: -fieldsplit_potential_ksp_rtol 1e-10 -fieldsplit_potential_pc_type lu
378: test:
379: # Using -dm_refine 1 -convest_num_refine 3 we get L_2 convergence rate: [0.0057, 1.0]
380: suffix: 2d_q2_p0_conv
381: requires: triangle
382: args: -sol_type linear -dm_plex_simplex 0 \
383: -field_petscspace_degree 2 -dm_refine 0 -convest_num_refine 1 -snes_convergence_estimate \
384: -snes_error_if_not_converged \
385: -ksp_rtol 1e-10 -ksp_error_if_not_converged \
386: -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -pc_fieldsplit_schur_precondition full \
387: -fieldsplit_field_pc_type lu \
388: -fieldsplit_potential_ksp_rtol 1e-10 -fieldsplit_potential_pc_type lu
389: test:
390: # Using -dm_refine 1 -convest_num_refine 3 we get L_2 convergence rate: [-0.014, 0.0066]
391: suffix: 2d_q2_p0_neumann_conv
392: requires: triangle
393: args: -sol_type quartic_neumann -dm_plex_simplex 0 \
394: -field_petscspace_degree 2 -dm_refine 0 -convest_num_refine 1 -snes_convergence_estimate \
395: -snes_error_if_not_converged \
396: -ksp_rtol 1e-10 -ksp_error_if_not_converged \
397: -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -pc_fieldsplit_schur_precondition full \
398: -fieldsplit_field_pc_type lu \
399: -fieldsplit_potential_ksp_rtol 1e-10 -fieldsplit_potential_pc_type svd
401: TEST*/
403: /* These tests will be active once tensor P^- is working
405: test:
406: suffix: 2d_bdmq1_p0_0
407: requires: triangle
408: args: -dm_plex_simplex 0 -sol_type linear \
409: -field_petscspace_poly_type pminus_hdiv -field_petscspace_degree 1 -field_petscdualspace_type bdm -dm_refine 0 -convest_num_refine 3 -snes_convergence_estimate \
410: -dmsnes_check .001 -snes_error_if_not_converged \
411: -ksp_rtol 1e-10 -ksp_error_if_not_converged \
412: -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -pc_fieldsplit_schur_precondition full \
413: -fieldsplit_field_pc_type lu \
414: -fieldsplit_potential_ksp_rtol 1e-10 -fieldsplit_potential_pc_type lu
415: test:
416: suffix: 2d_bdmq1_p0_2
417: requires: triangle
418: args: -dm_plex_simplex 0 -sol_type quartic \
419: -field_petscspace_poly_type_no pminus_hdiv -field_petscspace_degree 1 -field_petscdualspace_type bdm -dm_refine 0 -convest_num_refine 3 -snes_convergence_estimate \
420: -dmsnes_check .001 -snes_error_if_not_converged \
421: -ksp_rtol 1e-10 -ksp_error_if_not_converged \
422: -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -pc_fieldsplit_schur_precondition full \
423: -fieldsplit_field_pc_type lu \
424: -fieldsplit_potential_ksp_rtol 1e-10 -fieldsplit_potential_pc_type lu
426: */