1c4762a1bSJed Brown static char help[] = "Poisson Problem in 2d and 3d with simplicial finite elements.\n\ 2c4762a1bSJed Brown We solve the Poisson problem in a rectangular\n\ 3c4762a1bSJed Brown domain, using a parallel unstructured mesh (DMPLEX) to discretize it.\n\ 4c4762a1bSJed Brown This example supports discretized auxiliary fields (conductivity) as well as\n\ 5c4762a1bSJed Brown multilevel nonlinear solvers.\n\n\n"; 6c4762a1bSJed Brown 7c4762a1bSJed Brown /* 8c4762a1bSJed Brown A visualization of the adaptation can be accomplished using: 9c4762a1bSJed Brown 10c4762a1bSJed Brown -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 11c4762a1bSJed Brown 12c4762a1bSJed Brown Information on refinement: 13c4762a1bSJed Brown 14c20d7725SJed Brown -info :~sys,vec,is,mat,ksp,snes,ts 15c4762a1bSJed Brown */ 16c4762a1bSJed Brown 17c4762a1bSJed Brown #include <petscdmplex.h> 18c4762a1bSJed Brown #include <petscdmadaptor.h> 19c4762a1bSJed Brown #include <petscsnes.h> 20c4762a1bSJed Brown #include <petscds.h> 21c4762a1bSJed Brown #include <petscviewerhdf5.h> 22c4762a1bSJed Brown 239371c9d4SSatish Balay typedef enum { 249371c9d4SSatish Balay NEUMANN, 259371c9d4SSatish Balay DIRICHLET, 269371c9d4SSatish Balay NONE 279371c9d4SSatish Balay } BCType; 289371c9d4SSatish Balay typedef enum { 299371c9d4SSatish Balay RUN_FULL, 309371c9d4SSatish Balay RUN_EXACT, 319371c9d4SSatish Balay RUN_TEST, 329371c9d4SSatish Balay RUN_PERF 339371c9d4SSatish Balay } RunType; 349371c9d4SSatish Balay typedef enum { 359371c9d4SSatish Balay COEFF_NONE, 369371c9d4SSatish Balay COEFF_ANALYTIC, 379371c9d4SSatish Balay COEFF_FIELD, 389371c9d4SSatish Balay COEFF_NONLINEAR, 399371c9d4SSatish Balay COEFF_BALL, 409371c9d4SSatish Balay COEFF_CROSS, 419371c9d4SSatish Balay COEFF_CHECKERBOARD_0, 429371c9d4SSatish Balay COEFF_CHECKERBOARD_1 439371c9d4SSatish Balay } CoeffType; 44c4762a1bSJed Brown 45c4762a1bSJed Brown typedef struct { 46c4762a1bSJed Brown RunType runType; /* Whether to run tests, or solve the full problem */ 47c4762a1bSJed Brown PetscBool jacobianMF; /* Whether to calculate the Jacobian action on the fly */ 48c4762a1bSJed Brown PetscBool showInitial, showSolution, restart, quiet, nonzInit; 49c4762a1bSJed Brown /* Problem definition */ 50c4762a1bSJed Brown BCType bcType; 51c4762a1bSJed Brown CoeffType variableCoefficient; 52c4762a1bSJed Brown PetscErrorCode (**exactFuncs)(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx); 53c4762a1bSJed Brown PetscBool fieldBC; 549371c9d4SSatish Balay 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[]); 55c4762a1bSJed Brown PetscBool bdIntegral; /* Compute the integral of the solution on the boundary */ 56d6837840SMatthew G. Knepley /* Reproducing tests from SISC 40(3), pp. A1473-A1493, 2018 */ 57d6837840SMatthew G. Knepley PetscInt div; /* Number of divisions */ 58d6837840SMatthew G. Knepley PetscInt k; /* Parameter for checkerboard coefficient */ 59d6837840SMatthew G. Knepley PetscInt *kgrid; /* Random parameter grid */ 6030602db0SMatthew G. Knepley PetscBool rand; /* Make random assignments */ 61c4762a1bSJed Brown /* Solver */ 62c4762a1bSJed Brown PC pcmg; /* This is needed for error monitoring */ 63c4762a1bSJed Brown PetscBool checkksp; /* Whether to check the KSPSolve for runType == RUN_TEST */ 64c4762a1bSJed Brown } AppCtx; 65c4762a1bSJed Brown 66d71ae5a4SJacob Faibussowitsch static PetscErrorCode zero(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 67d71ae5a4SJacob Faibussowitsch { 68c4762a1bSJed Brown u[0] = 0.0; 693ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 70c4762a1bSJed Brown } 71c4762a1bSJed Brown 72d71ae5a4SJacob Faibussowitsch static PetscErrorCode ecks(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 73d71ae5a4SJacob Faibussowitsch { 74c4762a1bSJed Brown u[0] = x[0]; 753ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 76c4762a1bSJed Brown } 77c4762a1bSJed Brown 78c4762a1bSJed Brown /* 79c4762a1bSJed Brown In 2D for Dirichlet conditions, we use exact solution: 80c4762a1bSJed Brown 81c4762a1bSJed Brown u = x^2 + y^2 82c4762a1bSJed Brown f = 4 83c4762a1bSJed Brown 84c4762a1bSJed Brown so that 85c4762a1bSJed Brown 86c4762a1bSJed Brown -\Delta u + f = -4 + 4 = 0 87c4762a1bSJed Brown 88c4762a1bSJed Brown For Neumann conditions, we have 89c4762a1bSJed Brown 90c4762a1bSJed Brown -\nabla u \cdot -\hat y |_{y=0} = (2y)|_{y=0} = 0 (bottom) 91c4762a1bSJed Brown -\nabla u \cdot \hat y |_{y=1} = -(2y)|_{y=1} = -2 (top) 92c4762a1bSJed Brown -\nabla u \cdot -\hat x |_{x=0} = (2x)|_{x=0} = 0 (left) 93c4762a1bSJed Brown -\nabla u \cdot \hat x |_{x=1} = -(2x)|_{x=1} = -2 (right) 94c4762a1bSJed Brown 95c4762a1bSJed Brown Which we can express as 96c4762a1bSJed Brown 97c4762a1bSJed Brown \nabla u \cdot \hat n|_\Gamma = {2 x, 2 y} \cdot \hat n = 2 (x + y) 98c4762a1bSJed Brown 99c4762a1bSJed Brown The boundary integral of this solution is (assuming we are not orienting the edges) 100c4762a1bSJed Brown 101c4762a1bSJed Brown \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 102c4762a1bSJed Brown */ 103d71ae5a4SJacob Faibussowitsch static PetscErrorCode quadratic_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 104d71ae5a4SJacob Faibussowitsch { 105c4762a1bSJed Brown *u = x[0] * x[0] + x[1] * x[1]; 1063ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 107c4762a1bSJed Brown } 108c4762a1bSJed Brown 109d71ae5a4SJacob Faibussowitsch 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[]) 110d71ae5a4SJacob Faibussowitsch { 111c4762a1bSJed Brown uexact[0] = a[0]; 112c4762a1bSJed Brown } 113c4762a1bSJed Brown 114d71ae5a4SJacob Faibussowitsch static PetscErrorCode ball_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 115d71ae5a4SJacob Faibussowitsch { 116c4762a1bSJed Brown const PetscReal alpha = 500.; 117c4762a1bSJed Brown const PetscReal radius2 = PetscSqr(0.15); 118c4762a1bSJed Brown const PetscReal r2 = PetscSqr(x[0] - 0.5) + PetscSqr(x[1] - 0.5); 119c4762a1bSJed Brown const PetscReal xi = alpha * (radius2 - r2); 120c4762a1bSJed Brown 121c4762a1bSJed Brown *u = PetscTanhScalar(xi) + 1.0; 1223ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 123c4762a1bSJed Brown } 124c4762a1bSJed Brown 125d71ae5a4SJacob Faibussowitsch static PetscErrorCode cross_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 126d71ae5a4SJacob Faibussowitsch { 127c4762a1bSJed Brown const PetscReal alpha = 50 * 4; 128c4762a1bSJed Brown const PetscReal xy = (x[0] - 0.5) * (x[1] - 0.5); 129c4762a1bSJed Brown 130c4762a1bSJed Brown *u = PetscSinReal(alpha * xy) * (alpha * PetscAbsReal(xy) < 2 * PETSC_PI ? 1 : 0.01); 1313ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 132c4762a1bSJed Brown } 133c4762a1bSJed Brown 134d71ae5a4SJacob Faibussowitsch 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[]) 135d71ae5a4SJacob Faibussowitsch { 136c4762a1bSJed Brown f0[0] = 4.0; 137c4762a1bSJed Brown } 138c4762a1bSJed Brown 139d71ae5a4SJacob Faibussowitsch 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[]) 140d71ae5a4SJacob Faibussowitsch { 1418d1b37daSJoe Wallwork PetscInt d; 1428d1b37daSJoe Wallwork const PetscReal alpha = 500., radius2 = PetscSqr(0.15); 1438d1b37daSJoe Wallwork PetscReal r2, xi; 144c4762a1bSJed Brown 1458d1b37daSJoe Wallwork for (d = 0, r2 = 0.0; d < dim; ++d) r2 += PetscSqr(x[d] - 0.5); 1468d1b37daSJoe Wallwork xi = alpha * (radius2 - r2); 1478d1b37daSJoe Wallwork f0[0] = (-2.0 * dim * alpha - 8.0 * PetscSqr(alpha) * r2 * PetscTanhReal(xi)) * PetscSqr(1.0 / PetscCoshReal(xi)); 148c4762a1bSJed Brown } 149c4762a1bSJed Brown 150d71ae5a4SJacob Faibussowitsch 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[]) 151d71ae5a4SJacob Faibussowitsch { 152c4762a1bSJed Brown const PetscReal alpha = 50 * 4; 153c4762a1bSJed Brown const PetscReal xy = (x[0] - 0.5) * (x[1] - 0.5); 154c4762a1bSJed Brown 155c4762a1bSJed Brown f0[0] = PetscSinReal(alpha * xy) * (alpha * PetscAbsReal(xy) < 2 * PETSC_PI ? 1 : 0.01); 156c4762a1bSJed Brown } 157c4762a1bSJed Brown 158d71ae5a4SJacob Faibussowitsch 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[]) 159d71ae5a4SJacob Faibussowitsch { 160d6837840SMatthew G. Knepley f0[0] = -20.0 * PetscExpReal(-(PetscSqr(x[0] - 0.5) + PetscSqr(x[1] - 0.5))); 161d6837840SMatthew G. Knepley } 162d6837840SMatthew G. Knepley 163d71ae5a4SJacob Faibussowitsch 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[]) 164d71ae5a4SJacob Faibussowitsch { 165c4762a1bSJed Brown PetscInt d; 166c4762a1bSJed Brown for (d = 0, f0[0] = 0.0; d < dim; ++d) f0[0] += -n[d] * 2.0 * x[d]; 167c4762a1bSJed Brown } 168c4762a1bSJed Brown 169c4762a1bSJed Brown /* gradU[comp*dim+d] = {u_x, u_y} or {u_x, u_y, u_z} */ 170d71ae5a4SJacob Faibussowitsch 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[]) 171d71ae5a4SJacob Faibussowitsch { 172c4762a1bSJed Brown PetscInt d; 173c4762a1bSJed Brown for (d = 0; d < dim; ++d) f1[d] = u_x[d]; 174c4762a1bSJed Brown } 175c4762a1bSJed Brown 176c4762a1bSJed Brown /* < \nabla v, \nabla u + {\nabla u}^T > 177c4762a1bSJed Brown This just gives \nabla u, give the perdiagonal for the transpose */ 178d71ae5a4SJacob Faibussowitsch 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[]) 179d71ae5a4SJacob Faibussowitsch { 180c4762a1bSJed Brown PetscInt d; 181c4762a1bSJed Brown for (d = 0; d < dim; ++d) g3[d * dim + d] = 1.0; 182c4762a1bSJed Brown } 183c4762a1bSJed Brown 184c4762a1bSJed Brown /* 185c4762a1bSJed Brown In 2D for x periodicity and y Dirichlet conditions, we use exact solution: 186c4762a1bSJed Brown 187c4762a1bSJed Brown u = sin(2 pi x) 188c4762a1bSJed Brown f = -4 pi^2 sin(2 pi x) 189c4762a1bSJed Brown 190c4762a1bSJed Brown so that 191c4762a1bSJed Brown 192c4762a1bSJed Brown -\Delta u + f = 4 pi^2 sin(2 pi x) - 4 pi^2 sin(2 pi x) = 0 193c4762a1bSJed Brown */ 194d71ae5a4SJacob Faibussowitsch static PetscErrorCode xtrig_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 195d71ae5a4SJacob Faibussowitsch { 196c4762a1bSJed Brown *u = PetscSinReal(2.0 * PETSC_PI * x[0]); 1973ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 198c4762a1bSJed Brown } 199c4762a1bSJed Brown 200d71ae5a4SJacob Faibussowitsch 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[]) 201d71ae5a4SJacob Faibussowitsch { 202c4762a1bSJed Brown f0[0] = -4.0 * PetscSqr(PETSC_PI) * PetscSinReal(2.0 * PETSC_PI * x[0]); 203c4762a1bSJed Brown } 204c4762a1bSJed Brown 205c4762a1bSJed Brown /* 206c4762a1bSJed Brown In 2D for x-y periodicity, we use exact solution: 207c4762a1bSJed Brown 208c4762a1bSJed Brown u = sin(2 pi x) sin(2 pi y) 209c4762a1bSJed Brown f = -8 pi^2 sin(2 pi x) 210c4762a1bSJed Brown 211c4762a1bSJed Brown so that 212c4762a1bSJed Brown 213c4762a1bSJed Brown -\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 214c4762a1bSJed Brown */ 215d71ae5a4SJacob Faibussowitsch static PetscErrorCode xytrig_u_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 216d71ae5a4SJacob Faibussowitsch { 217c4762a1bSJed Brown *u = PetscSinReal(2.0 * PETSC_PI * x[0]) * PetscSinReal(2.0 * PETSC_PI * x[1]); 2183ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 219c4762a1bSJed Brown } 220c4762a1bSJed Brown 221d71ae5a4SJacob Faibussowitsch 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[]) 222d71ae5a4SJacob Faibussowitsch { 223c4762a1bSJed Brown f0[0] = -8.0 * PetscSqr(PETSC_PI) * PetscSinReal(2.0 * PETSC_PI * x[0]); 224c4762a1bSJed Brown } 225c4762a1bSJed Brown 226c4762a1bSJed Brown /* 227c4762a1bSJed Brown In 2D for Dirichlet conditions with a variable coefficient, we use exact solution: 228c4762a1bSJed Brown 229c4762a1bSJed Brown u = x^2 + y^2 230c4762a1bSJed Brown f = 6 (x + y) 231c4762a1bSJed Brown nu = (x + y) 232c4762a1bSJed Brown 233c4762a1bSJed Brown so that 234c4762a1bSJed Brown 235c4762a1bSJed Brown -\div \nu \grad u + f = -6 (x + y) + 6 (x + y) = 0 236c4762a1bSJed Brown */ 237d71ae5a4SJacob Faibussowitsch static PetscErrorCode nu_2d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 238d71ae5a4SJacob Faibussowitsch { 239c4762a1bSJed Brown *u = x[0] + x[1]; 2403ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 241c4762a1bSJed Brown } 242c4762a1bSJed Brown 243d71ae5a4SJacob Faibussowitsch static PetscErrorCode checkerboardCoeff(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 244d71ae5a4SJacob Faibussowitsch { 245d6837840SMatthew G. Knepley AppCtx *user = (AppCtx *)ctx; 246d6837840SMatthew G. Knepley PetscInt div = user->div; 247d6837840SMatthew G. Knepley PetscInt k = user->k; 248d6837840SMatthew G. Knepley PetscInt mask = 0, ind = 0, d; 249d6837840SMatthew G. Knepley 250d6837840SMatthew G. Knepley PetscFunctionBeginUser; 251d6837840SMatthew G. Knepley for (d = 0; d < dim; ++d) mask = (mask + (PetscInt)(x[d] * div)) % 2; 252d6837840SMatthew G. Knepley if (user->kgrid) { 253d6837840SMatthew G. Knepley for (d = 0; d < dim; ++d) { 254d6837840SMatthew G. Knepley if (d > 0) ind *= dim; 255d6837840SMatthew G. Knepley ind += (PetscInt)(x[d] * div); 256d6837840SMatthew G. Knepley } 257d6837840SMatthew G. Knepley k = user->kgrid[ind]; 258d6837840SMatthew G. Knepley } 259d6837840SMatthew G. Knepley u[0] = mask ? 1.0 : PetscPowRealInt(10.0, -k); 2603ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 261d6837840SMatthew G. Knepley } 262d6837840SMatthew G. Knepley 263d71ae5a4SJacob Faibussowitsch 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[]) 264d71ae5a4SJacob Faibussowitsch { 265c4762a1bSJed Brown f0[0] = 6.0 * (x[0] + x[1]); 266c4762a1bSJed Brown } 267c4762a1bSJed Brown 268c4762a1bSJed Brown /* gradU[comp*dim+d] = {u_x, u_y} or {u_x, u_y, u_z} */ 269d71ae5a4SJacob Faibussowitsch 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[]) 270d71ae5a4SJacob Faibussowitsch { 271c4762a1bSJed Brown PetscInt d; 272c4762a1bSJed Brown for (d = 0; d < dim; ++d) f1[d] = (x[0] + x[1]) * u_x[d]; 273c4762a1bSJed Brown } 274c4762a1bSJed Brown 275d71ae5a4SJacob Faibussowitsch 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[]) 276d71ae5a4SJacob Faibussowitsch { 277c4762a1bSJed Brown PetscInt d; 278c4762a1bSJed Brown for (d = 0; d < dim; ++d) f1[d] = a[0] * u_x[d]; 279c4762a1bSJed Brown } 280c4762a1bSJed Brown 281c4762a1bSJed Brown /* < \nabla v, \nabla u + {\nabla u}^T > 282c4762a1bSJed Brown This just gives \nabla u, give the perdiagonal for the transpose */ 283d71ae5a4SJacob Faibussowitsch 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[]) 284d71ae5a4SJacob Faibussowitsch { 285c4762a1bSJed Brown PetscInt d; 286c4762a1bSJed Brown for (d = 0; d < dim; ++d) g3[d * dim + d] = x[0] + x[1]; 287c4762a1bSJed Brown } 288c4762a1bSJed Brown 289d71ae5a4SJacob Faibussowitsch 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[]) 290d71ae5a4SJacob Faibussowitsch { 291c4762a1bSJed Brown PetscInt d; 292c4762a1bSJed Brown for (d = 0; d < dim; ++d) g3[d * dim + d] = a[0]; 293c4762a1bSJed Brown } 294c4762a1bSJed Brown 295c4762a1bSJed Brown /* 296c4762a1bSJed Brown In 2D for Dirichlet conditions with a nonlinear coefficient (p-Laplacian with p = 4), we use exact solution: 297c4762a1bSJed Brown 298c4762a1bSJed Brown u = x^2 + y^2 299c4762a1bSJed Brown f = 16 (x^2 + y^2) 300c4762a1bSJed Brown nu = 1/2 |grad u|^2 301c4762a1bSJed Brown 302c4762a1bSJed Brown so that 303c4762a1bSJed Brown 304c4762a1bSJed Brown -\div \nu \grad u + f = -16 (x^2 + y^2) + 16 (x^2 + y^2) = 0 305c4762a1bSJed Brown */ 306d71ae5a4SJacob Faibussowitsch 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[]) 307d71ae5a4SJacob Faibussowitsch { 308c4762a1bSJed Brown f0[0] = 16.0 * (x[0] * x[0] + x[1] * x[1]); 309c4762a1bSJed Brown } 310c4762a1bSJed Brown 311c4762a1bSJed Brown /* gradU[comp*dim+d] = {u_x, u_y} or {u_x, u_y, u_z} */ 312d71ae5a4SJacob Faibussowitsch 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[]) 313d71ae5a4SJacob Faibussowitsch { 314c4762a1bSJed Brown PetscScalar nu = 0.0; 315c4762a1bSJed Brown PetscInt d; 316c4762a1bSJed Brown for (d = 0; d < dim; ++d) nu += u_x[d] * u_x[d]; 317c4762a1bSJed Brown for (d = 0; d < dim; ++d) f1[d] = 0.5 * nu * u_x[d]; 318c4762a1bSJed Brown } 319c4762a1bSJed Brown 320c4762a1bSJed Brown /* 321c4762a1bSJed Brown grad (u + eps w) - grad u = eps grad w 322c4762a1bSJed Brown 323c4762a1bSJed Brown 1/2 |grad (u + eps w)|^2 grad (u + eps w) - 1/2 |grad u|^2 grad u 324c4762a1bSJed Brown = 1/2 (|grad u|^2 + 2 eps <grad u,grad w>) (grad u + eps grad w) - 1/2 |grad u|^2 grad u 325c4762a1bSJed Brown = 1/2 (eps |grad u|^2 grad w + 2 eps <grad u,grad w> grad u) 326c4762a1bSJed Brown = eps (1/2 |grad u|^2 grad w + grad u <grad u,grad w>) 327c4762a1bSJed Brown */ 328d71ae5a4SJacob Faibussowitsch 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[]) 329d71ae5a4SJacob Faibussowitsch { 330c4762a1bSJed Brown PetscScalar nu = 0.0; 331c4762a1bSJed Brown PetscInt d, e; 332c4762a1bSJed Brown for (d = 0; d < dim; ++d) nu += u_x[d] * u_x[d]; 333c4762a1bSJed Brown for (d = 0; d < dim; ++d) { 334c4762a1bSJed Brown g3[d * dim + d] = 0.5 * nu; 335ad540459SPierre Jolivet for (e = 0; e < dim; ++e) g3[d * dim + e] += u_x[d] * u_x[e]; 336c4762a1bSJed Brown } 337c4762a1bSJed Brown } 338c4762a1bSJed Brown 339c4762a1bSJed Brown /* 340c4762a1bSJed Brown In 3D for Dirichlet conditions we use exact solution: 341c4762a1bSJed Brown 342c4762a1bSJed Brown u = 2/3 (x^2 + y^2 + z^2) 343c4762a1bSJed Brown f = 4 344c4762a1bSJed Brown 345c4762a1bSJed Brown so that 346c4762a1bSJed Brown 347c4762a1bSJed Brown -\Delta u + f = -2/3 * 6 + 4 = 0 348c4762a1bSJed Brown 349c4762a1bSJed Brown For Neumann conditions, we have 350c4762a1bSJed Brown 351c4762a1bSJed Brown -\nabla u \cdot -\hat z |_{z=0} = (2z)|_{z=0} = 0 (bottom) 352c4762a1bSJed Brown -\nabla u \cdot \hat z |_{z=1} = -(2z)|_{z=1} = -2 (top) 353c4762a1bSJed Brown -\nabla u \cdot -\hat y |_{y=0} = (2y)|_{y=0} = 0 (front) 354c4762a1bSJed Brown -\nabla u \cdot \hat y |_{y=1} = -(2y)|_{y=1} = -2 (back) 355c4762a1bSJed Brown -\nabla u \cdot -\hat x |_{x=0} = (2x)|_{x=0} = 0 (left) 356c4762a1bSJed Brown -\nabla u \cdot \hat x |_{x=1} = -(2x)|_{x=1} = -2 (right) 357c4762a1bSJed Brown 358c4762a1bSJed Brown Which we can express as 359c4762a1bSJed Brown 360c4762a1bSJed Brown \nabla u \cdot \hat n|_\Gamma = {2 x, 2 y, 2z} \cdot \hat n = 2 (x + y + z) 361c4762a1bSJed Brown */ 362d71ae5a4SJacob Faibussowitsch static PetscErrorCode quadratic_u_3d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 363d71ae5a4SJacob Faibussowitsch { 364c4762a1bSJed Brown *u = 2.0 * (x[0] * x[0] + x[1] * x[1] + x[2] * x[2]) / 3.0; 3653ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 366c4762a1bSJed Brown } 367c4762a1bSJed Brown 368d71ae5a4SJacob Faibussowitsch static PetscErrorCode ball_u_3d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 369d71ae5a4SJacob Faibussowitsch { 3708d1b37daSJoe Wallwork const PetscReal alpha = 500.; 3718d1b37daSJoe Wallwork const PetscReal radius2 = PetscSqr(0.15); 3728d1b37daSJoe Wallwork const PetscReal r2 = PetscSqr(x[0] - 0.5) + PetscSqr(x[1] - 0.5) + PetscSqr(x[2] - 0.5); 3738d1b37daSJoe Wallwork const PetscReal xi = alpha * (radius2 - r2); 3748d1b37daSJoe Wallwork 3758d1b37daSJoe Wallwork *u = PetscTanhScalar(xi) + 1.0; 3763ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 3778d1b37daSJoe Wallwork } 3788d1b37daSJoe Wallwork 379d71ae5a4SJacob Faibussowitsch 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[]) 380d71ae5a4SJacob Faibussowitsch { 381c4762a1bSJed Brown uexact[0] = a[0]; 382c4762a1bSJed Brown } 383c4762a1bSJed Brown 384d71ae5a4SJacob Faibussowitsch static PetscErrorCode cross_u_3d(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, void *ctx) 385d71ae5a4SJacob Faibussowitsch { 3868d1b37daSJoe Wallwork const PetscReal alpha = 50 * 4; 3878d1b37daSJoe Wallwork const PetscReal xyz = (x[0] - 0.5) * (x[1] - 0.5) * (x[2] - 0.5); 3888d1b37daSJoe Wallwork 3898d1b37daSJoe Wallwork *u = PetscSinReal(alpha * xyz) * (alpha * PetscAbsReal(xyz) < 2 * PETSC_PI ? (alpha * PetscAbsReal(xyz) > -2 * PETSC_PI ? 1.0 : 0.01) : 0.01); 3903ba16761SJacob Faibussowitsch return PETSC_SUCCESS; 3918d1b37daSJoe Wallwork } 3928d1b37daSJoe Wallwork 393d71ae5a4SJacob Faibussowitsch 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[]) 394d71ae5a4SJacob Faibussowitsch { 3958d1b37daSJoe Wallwork const PetscReal alpha = 50 * 4; 3968d1b37daSJoe Wallwork const PetscReal xyz = (x[0] - 0.5) * (x[1] - 0.5) * (x[2] - 0.5); 3978d1b37daSJoe Wallwork 3988d1b37daSJoe Wallwork f0[0] = PetscSinReal(alpha * xyz) * (alpha * PetscAbsReal(xyz) < 2 * PETSC_PI ? (alpha * PetscAbsReal(xyz) > -2 * PETSC_PI ? 1.0 : 0.01) : 0.01); 3998d1b37daSJoe Wallwork } 4008d1b37daSJoe Wallwork 401d71ae5a4SJacob Faibussowitsch 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) 402d71ae5a4SJacob Faibussowitsch { 403c4762a1bSJed Brown uint[0] = u[0]; 404c4762a1bSJed Brown } 405c4762a1bSJed Brown 406d71ae5a4SJacob Faibussowitsch static PetscErrorCode ProcessOptions(MPI_Comm comm, AppCtx *options) 407d71ae5a4SJacob Faibussowitsch { 408c4762a1bSJed Brown const char *bcTypes[3] = {"neumann", "dirichlet", "none"}; 409c4762a1bSJed Brown const char *runTypes[4] = {"full", "exact", "test", "perf"}; 4108d1b37daSJoe Wallwork const char *coeffTypes[8] = {"none", "analytic", "field", "nonlinear", "ball", "cross", "checkerboard_0", "checkerboard_1"}; 41130602db0SMatthew G. Knepley PetscInt bc, run, coeff; 412c4762a1bSJed Brown 413c4762a1bSJed Brown PetscFunctionBeginUser; 414c4762a1bSJed Brown options->runType = RUN_FULL; 415c4762a1bSJed Brown options->bcType = DIRICHLET; 416c4762a1bSJed Brown options->variableCoefficient = COEFF_NONE; 417c4762a1bSJed Brown options->fieldBC = PETSC_FALSE; 418c4762a1bSJed Brown options->jacobianMF = PETSC_FALSE; 419c4762a1bSJed Brown options->showInitial = PETSC_FALSE; 420c4762a1bSJed Brown options->showSolution = PETSC_FALSE; 421c4762a1bSJed Brown options->restart = PETSC_FALSE; 422c4762a1bSJed Brown options->quiet = PETSC_FALSE; 423c4762a1bSJed Brown options->nonzInit = PETSC_FALSE; 424c4762a1bSJed Brown options->bdIntegral = PETSC_FALSE; 425c4762a1bSJed Brown options->checkksp = PETSC_FALSE; 426d6837840SMatthew G. Knepley options->div = 4; 427d6837840SMatthew G. Knepley options->k = 1; 428d6837840SMatthew G. Knepley options->kgrid = NULL; 42930602db0SMatthew G. Knepley options->rand = PETSC_FALSE; 430c4762a1bSJed Brown 431d0609cedSBarry Smith PetscOptionsBegin(comm, "", "Poisson Problem Options", "DMPLEX"); 432c4762a1bSJed Brown run = options->runType; 4339566063dSJacob Faibussowitsch PetscCall(PetscOptionsEList("-run_type", "The run type", "ex12.c", runTypes, 4, runTypes[options->runType], &run, NULL)); 434c4762a1bSJed Brown options->runType = (RunType)run; 435c4762a1bSJed Brown bc = options->bcType; 4369566063dSJacob Faibussowitsch PetscCall(PetscOptionsEList("-bc_type", "Type of boundary condition", "ex12.c", bcTypes, 3, bcTypes[options->bcType], &bc, NULL)); 437c4762a1bSJed Brown options->bcType = (BCType)bc; 438c4762a1bSJed Brown coeff = options->variableCoefficient; 439da81f932SPierre Jolivet PetscCall(PetscOptionsEList("-variable_coefficient", "Type of variable coefficient", "ex12.c", coeffTypes, 8, coeffTypes[options->variableCoefficient], &coeff, NULL)); 440c4762a1bSJed Brown options->variableCoefficient = (CoeffType)coeff; 441c4762a1bSJed Brown 4429566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-field_bc", "Use a field representation for the BC", "ex12.c", options->fieldBC, &options->fieldBC, NULL)); 4439566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-jacobian_mf", "Calculate the action of the Jacobian on the fly", "ex12.c", options->jacobianMF, &options->jacobianMF, NULL)); 4449566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-show_initial", "Output the initial guess for verification", "ex12.c", options->showInitial, &options->showInitial, NULL)); 4459566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-show_solution", "Output the solution for verification", "ex12.c", options->showSolution, &options->showSolution, NULL)); 4469566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-restart", "Read in the mesh and solution from a file", "ex12.c", options->restart, &options->restart, NULL)); 4479566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-quiet", "Don't print any vecs", "ex12.c", options->quiet, &options->quiet, NULL)); 4489566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-nonzero_initial_guess", "nonzero initial guess", "ex12.c", options->nonzInit, &options->nonzInit, NULL)); 4499566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-bd_integral", "Compute the integral of the solution on the boundary", "ex12.c", options->bdIntegral, &options->bdIntegral, NULL)); 45048a46eb9SPierre Jolivet if (options->runType == RUN_TEST) PetscCall(PetscOptionsBool("-run_test_check_ksp", "Check solution of KSP", "ex12.c", options->checkksp, &options->checkksp, NULL)); 4519566063dSJacob Faibussowitsch PetscCall(PetscOptionsInt("-div", "The number of division for the checkerboard coefficient", "ex12.c", options->div, &options->div, NULL)); 4529566063dSJacob Faibussowitsch PetscCall(PetscOptionsInt("-k", "The exponent for the checkerboard coefficient", "ex12.c", options->k, &options->k, NULL)); 4539566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-k_random", "Assign random k values to checkerboard", "ex12.c", options->rand, &options->rand, NULL)); 454d0609cedSBarry Smith PetscOptionsEnd(); 4553ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 456c4762a1bSJed Brown } 457c4762a1bSJed Brown 458d71ae5a4SJacob Faibussowitsch static PetscErrorCode CreateBCLabel(DM dm, const char name[]) 459d71ae5a4SJacob Faibussowitsch { 460408cafa0SMatthew G. Knepley DM plex; 461c4762a1bSJed Brown DMLabel label; 462c4762a1bSJed Brown 463c4762a1bSJed Brown PetscFunctionBeginUser; 4649566063dSJacob Faibussowitsch PetscCall(DMCreateLabel(dm, name)); 4659566063dSJacob Faibussowitsch PetscCall(DMGetLabel(dm, name, &label)); 4669566063dSJacob Faibussowitsch PetscCall(DMConvert(dm, DMPLEX, &plex)); 4679566063dSJacob Faibussowitsch PetscCall(DMPlexMarkBoundaryFaces(plex, 1, label)); 4689566063dSJacob Faibussowitsch PetscCall(DMDestroy(&plex)); 4693ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 470c4762a1bSJed Brown } 471c4762a1bSJed Brown 472d71ae5a4SJacob Faibussowitsch static PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user, DM *dm) 473d71ae5a4SJacob Faibussowitsch { 474c4762a1bSJed Brown PetscFunctionBeginUser; 4759566063dSJacob Faibussowitsch PetscCall(DMCreate(comm, dm)); 4769566063dSJacob Faibussowitsch PetscCall(DMSetType(*dm, DMPLEX)); 4779566063dSJacob Faibussowitsch PetscCall(DMSetFromOptions(*dm)); 478c4762a1bSJed Brown { 479c4762a1bSJed Brown char convType[256]; 480c4762a1bSJed Brown PetscBool flg; 481c4762a1bSJed Brown 482d0609cedSBarry Smith PetscOptionsBegin(comm, "", "Mesh conversion options", "DMPLEX"); 4839566063dSJacob Faibussowitsch PetscCall(PetscOptionsFList("-dm_plex_convert_type", "Convert DMPlex to another format", "ex12", DMList, DMPLEX, convType, 256, &flg)); 484d0609cedSBarry Smith PetscOptionsEnd(); 485c4762a1bSJed Brown if (flg) { 486c4762a1bSJed Brown DM dmConv; 487c4762a1bSJed Brown 4889566063dSJacob Faibussowitsch PetscCall(DMConvert(*dm, convType, &dmConv)); 489c4762a1bSJed Brown if (dmConv) { 4909566063dSJacob Faibussowitsch PetscCall(DMDestroy(dm)); 491c4762a1bSJed Brown *dm = dmConv; 492c4762a1bSJed Brown } 4939566063dSJacob Faibussowitsch PetscCall(DMSetFromOptions(*dm)); 4949566063dSJacob Faibussowitsch PetscCall(DMSetUp(*dm)); 49530602db0SMatthew G. Knepley } 49630602db0SMatthew G. Knepley } 4979566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view")); 49830602db0SMatthew G. Knepley if (user->rand) { 49930602db0SMatthew G. Knepley PetscRandom r; 50030602db0SMatthew G. Knepley PetscReal val; 50130602db0SMatthew G. Knepley PetscInt dim, N, i; 502c4762a1bSJed Brown 5039566063dSJacob Faibussowitsch PetscCall(DMGetDimension(*dm, &dim)); 50430602db0SMatthew G. Knepley N = PetscPowInt(user->div, dim); 5059566063dSJacob Faibussowitsch PetscCall(PetscMalloc1(N, &user->kgrid)); 5069566063dSJacob Faibussowitsch PetscCall(PetscRandomCreate(PETSC_COMM_SELF, &r)); 5079566063dSJacob Faibussowitsch PetscCall(PetscRandomSetFromOptions(r)); 5089566063dSJacob Faibussowitsch PetscCall(PetscRandomSetInterval(r, 0.0, user->k)); 5099566063dSJacob Faibussowitsch PetscCall(PetscRandomSetSeed(r, 1973)); 5109566063dSJacob Faibussowitsch PetscCall(PetscRandomSeed(r)); 51130602db0SMatthew G. Knepley for (i = 0; i < N; ++i) { 5129566063dSJacob Faibussowitsch PetscCall(PetscRandomGetValueReal(r, &val)); 51330602db0SMatthew G. Knepley user->kgrid[i] = 1 + (PetscInt)val; 514c4762a1bSJed Brown } 5159566063dSJacob Faibussowitsch PetscCall(PetscRandomDestroy(&r)); 516c4762a1bSJed Brown } 5173ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 518c4762a1bSJed Brown } 519c4762a1bSJed Brown 520d71ae5a4SJacob Faibussowitsch static PetscErrorCode SetupProblem(DM dm, AppCtx *user) 521d71ae5a4SJacob Faibussowitsch { 52245480ffeSMatthew G. Knepley PetscDS ds; 52345480ffeSMatthew G. Knepley DMLabel label; 52445480ffeSMatthew G. Knepley PetscWeakForm wf; 5258fb5bd83SMatthew G. Knepley const PetscReal *L; 526c4762a1bSJed Brown const PetscInt id = 1; 52730602db0SMatthew G. Knepley PetscInt bd, dim; 528c4762a1bSJed Brown 529c4762a1bSJed Brown PetscFunctionBeginUser; 5309566063dSJacob Faibussowitsch PetscCall(DMGetDS(dm, &ds)); 5319566063dSJacob Faibussowitsch PetscCall(DMGetDimension(dm, &dim)); 5324fb89dddSMatthew G. Knepley PetscCall(DMGetPeriodicity(dm, NULL, NULL, &L)); 533c4762a1bSJed Brown switch (user->variableCoefficient) { 534c4762a1bSJed Brown case COEFF_NONE: 5358fb5bd83SMatthew G. Knepley if (L && L[0]) { 5368fb5bd83SMatthew G. Knepley if (L && L[1]) { 5379566063dSJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_xytrig_u, f1_u)); 5389566063dSJacob Faibussowitsch PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu)); 539c4762a1bSJed Brown } else { 5409566063dSJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_xtrig_u, f1_u)); 5419566063dSJacob Faibussowitsch PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu)); 542c4762a1bSJed Brown } 543c4762a1bSJed Brown } else { 5449566063dSJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_u, f1_u)); 5459566063dSJacob Faibussowitsch PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu)); 546c4762a1bSJed Brown } 547c4762a1bSJed Brown break; 548c4762a1bSJed Brown case COEFF_ANALYTIC: 5499566063dSJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_analytic_u, f1_analytic_u)); 5509566063dSJacob Faibussowitsch PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_analytic_uu)); 551c4762a1bSJed Brown break; 552c4762a1bSJed Brown case COEFF_FIELD: 5539566063dSJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_analytic_u, f1_field_u)); 5549566063dSJacob Faibussowitsch PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_field_uu)); 555c4762a1bSJed Brown break; 556c4762a1bSJed Brown case COEFF_NONLINEAR: 5579566063dSJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_analytic_nonlinear_u, f1_analytic_nonlinear_u)); 5589566063dSJacob Faibussowitsch PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_analytic_nonlinear_uu)); 559c4762a1bSJed Brown break; 5608d1b37daSJoe Wallwork case COEFF_BALL: 5619566063dSJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_ball_u, f1_u)); 5629566063dSJacob Faibussowitsch PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu)); 563c4762a1bSJed Brown break; 564c4762a1bSJed Brown case COEFF_CROSS: 5658d1b37daSJoe Wallwork switch (dim) { 566d71ae5a4SJacob Faibussowitsch case 2: 567d71ae5a4SJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_cross_u_2d, f1_u)); 568d71ae5a4SJacob Faibussowitsch break; 569d71ae5a4SJacob Faibussowitsch case 3: 570d71ae5a4SJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_cross_u_3d, f1_u)); 571d71ae5a4SJacob Faibussowitsch break; 572d71ae5a4SJacob Faibussowitsch default: 573d71ae5a4SJacob Faibussowitsch SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Invalid dimension %" PetscInt_FMT, dim); 5748d1b37daSJoe Wallwork } 5759566063dSJacob Faibussowitsch PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_uu)); 576c4762a1bSJed Brown break; 577d6837840SMatthew G. Knepley case COEFF_CHECKERBOARD_0: 5789566063dSJacob Faibussowitsch PetscCall(PetscDSSetResidual(ds, 0, f0_checkerboard_0_u, f1_field_u)); 5799566063dSJacob Faibussowitsch PetscCall(PetscDSSetJacobian(ds, 0, 0, NULL, NULL, NULL, g3_field_uu)); 580d6837840SMatthew G. Knepley break; 581d71ae5a4SJacob Faibussowitsch default: 582d71ae5a4SJacob Faibussowitsch SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Invalid variable coefficient type %d", user->variableCoefficient); 583c4762a1bSJed Brown } 58430602db0SMatthew G. Knepley switch (dim) { 585c4762a1bSJed Brown case 2: 586c4762a1bSJed Brown switch (user->variableCoefficient) { 587d71ae5a4SJacob Faibussowitsch case COEFF_BALL: 588d71ae5a4SJacob Faibussowitsch user->exactFuncs[0] = ball_u_2d; 589d71ae5a4SJacob Faibussowitsch break; 590d71ae5a4SJacob Faibussowitsch case COEFF_CROSS: 591d71ae5a4SJacob Faibussowitsch user->exactFuncs[0] = cross_u_2d; 592d71ae5a4SJacob Faibussowitsch break; 593d71ae5a4SJacob Faibussowitsch case COEFF_CHECKERBOARD_0: 594d71ae5a4SJacob Faibussowitsch user->exactFuncs[0] = zero; 595d71ae5a4SJacob Faibussowitsch break; 596c4762a1bSJed Brown default: 5978fb5bd83SMatthew G. Knepley if (L && L[0]) { 5988fb5bd83SMatthew G. Knepley if (L && L[1]) { 599c4762a1bSJed Brown user->exactFuncs[0] = xytrig_u_2d; 600c4762a1bSJed Brown } else { 601c4762a1bSJed Brown user->exactFuncs[0] = xtrig_u_2d; 602c4762a1bSJed Brown } 603c4762a1bSJed Brown } else { 604c4762a1bSJed Brown user->exactFuncs[0] = quadratic_u_2d; 605c4762a1bSJed Brown user->exactFields[0] = quadratic_u_field_2d; 606c4762a1bSJed Brown } 607c4762a1bSJed Brown } 60845480ffeSMatthew G. Knepley if (user->bcType == NEUMANN) { 6099566063dSJacob Faibussowitsch PetscCall(DMGetLabel(dm, "boundary", &label)); 6109566063dSJacob Faibussowitsch PetscCall(DMAddBoundary(dm, DM_BC_NATURAL, "wall", label, 1, &id, 0, 0, NULL, NULL, NULL, user, &bd)); 6119566063dSJacob Faibussowitsch PetscCall(PetscDSGetBoundary(ds, bd, &wf, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)); 6129566063dSJacob Faibussowitsch PetscCall(PetscWeakFormSetIndexBdResidual(wf, label, id, 0, 0, 0, f0_bd_u, 0, NULL)); 61345480ffeSMatthew G. Knepley } 614c4762a1bSJed Brown break; 615c4762a1bSJed Brown case 3: 6168d1b37daSJoe Wallwork switch (user->variableCoefficient) { 617d71ae5a4SJacob Faibussowitsch case COEFF_BALL: 618d71ae5a4SJacob Faibussowitsch user->exactFuncs[0] = ball_u_3d; 619d71ae5a4SJacob Faibussowitsch break; 620d71ae5a4SJacob Faibussowitsch case COEFF_CROSS: 621d71ae5a4SJacob Faibussowitsch user->exactFuncs[0] = cross_u_3d; 622d71ae5a4SJacob Faibussowitsch break; 623d71ae5a4SJacob Faibussowitsch default: 624d71ae5a4SJacob Faibussowitsch user->exactFuncs[0] = quadratic_u_3d; 625d71ae5a4SJacob Faibussowitsch user->exactFields[0] = quadratic_u_field_3d; 6268d1b37daSJoe Wallwork } 62745480ffeSMatthew G. Knepley if (user->bcType == NEUMANN) { 6289566063dSJacob Faibussowitsch PetscCall(DMGetLabel(dm, "boundary", &label)); 6299566063dSJacob Faibussowitsch PetscCall(DMAddBoundary(dm, DM_BC_NATURAL, "wall", label, 1, &id, 0, 0, NULL, NULL, NULL, user, &bd)); 6309566063dSJacob Faibussowitsch PetscCall(PetscDSGetBoundary(ds, bd, &wf, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)); 6319566063dSJacob Faibussowitsch PetscCall(PetscWeakFormSetIndexBdResidual(wf, label, id, 0, 0, 0, f0_bd_u, 0, NULL)); 63245480ffeSMatthew G. Knepley } 633c4762a1bSJed Brown break; 634d71ae5a4SJacob Faibussowitsch default: 635d71ae5a4SJacob Faibussowitsch SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Invalid dimension %" PetscInt_FMT, dim); 636c4762a1bSJed Brown } 637d6837840SMatthew G. Knepley /* Setup constants */ 638d6837840SMatthew G. Knepley switch (user->variableCoefficient) { 6399371c9d4SSatish Balay case COEFF_CHECKERBOARD_0: { 640d6837840SMatthew G. Knepley PetscScalar constants[2]; 641d6837840SMatthew G. Knepley 642d6837840SMatthew G. Knepley constants[0] = user->div; 643d6837840SMatthew G. Knepley constants[1] = user->k; 6449566063dSJacob Faibussowitsch PetscCall(PetscDSSetConstants(ds, 2, constants)); 6459371c9d4SSatish Balay } break; 646d71ae5a4SJacob Faibussowitsch default: 647d71ae5a4SJacob Faibussowitsch break; 648d6837840SMatthew G. Knepley } 6499566063dSJacob Faibussowitsch PetscCall(PetscDSSetExactSolution(ds, 0, user->exactFuncs[0], user)); 650d6837840SMatthew G. Knepley /* Setup Boundary Conditions */ 65145480ffeSMatthew G. Knepley if (user->bcType == DIRICHLET) { 6529566063dSJacob Faibussowitsch PetscCall(DMGetLabel(dm, "marker", &label)); 65345480ffeSMatthew G. Knepley if (!label) { 65445480ffeSMatthew G. Knepley /* Right now, p4est cannot create labels immediately */ 6559566063dSJacob Faibussowitsch PetscCall(PetscDSAddBoundaryByName(ds, user->fieldBC ? DM_BC_ESSENTIAL_FIELD : DM_BC_ESSENTIAL, "wall", "marker", 1, &id, 0, 0, NULL, user->fieldBC ? (void (*)(void))user->exactFields[0] : (void (*)(void))user->exactFuncs[0], NULL, user, NULL)); 65645480ffeSMatthew G. Knepley } else { 6579566063dSJacob Faibussowitsch PetscCall(DMAddBoundary(dm, user->fieldBC ? DM_BC_ESSENTIAL_FIELD : DM_BC_ESSENTIAL, "wall", label, 1, &id, 0, 0, NULL, user->fieldBC ? (void (*)(void))user->exactFields[0] : (void (*)(void))user->exactFuncs[0], NULL, user, NULL)); 65845480ffeSMatthew G. Knepley } 659c4762a1bSJed Brown } 6603ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 661c4762a1bSJed Brown } 662c4762a1bSJed Brown 663d71ae5a4SJacob Faibussowitsch static PetscErrorCode SetupMaterial(DM dm, DM dmAux, AppCtx *user) 664d71ae5a4SJacob Faibussowitsch { 665c4762a1bSJed Brown PetscErrorCode (*matFuncs[1])(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar u[], void *ctx) = {nu_2d}; 666d6837840SMatthew G. Knepley void *ctx[1]; 667c4762a1bSJed Brown Vec nu; 668c4762a1bSJed Brown 669c4762a1bSJed Brown PetscFunctionBegin; 670d6837840SMatthew G. Knepley ctx[0] = user; 671ad540459SPierre Jolivet if (user->variableCoefficient == COEFF_CHECKERBOARD_0) matFuncs[0] = checkerboardCoeff; 6729566063dSJacob Faibussowitsch PetscCall(DMCreateLocalVector(dmAux, &nu)); 6739566063dSJacob Faibussowitsch PetscCall(PetscObjectSetName((PetscObject)nu, "Coefficient")); 6749566063dSJacob Faibussowitsch PetscCall(DMProjectFunctionLocal(dmAux, 0.0, matFuncs, ctx, INSERT_ALL_VALUES, nu)); 6759566063dSJacob Faibussowitsch PetscCall(DMSetAuxiliaryVec(dm, NULL, 0, 0, nu)); 6769566063dSJacob Faibussowitsch PetscCall(VecDestroy(&nu)); 6773ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 678c4762a1bSJed Brown } 679c4762a1bSJed Brown 680d71ae5a4SJacob Faibussowitsch static PetscErrorCode SetupBC(DM dm, DM dmAux, AppCtx *user) 681d71ae5a4SJacob Faibussowitsch { 682c4762a1bSJed Brown PetscErrorCode (*bcFuncs[1])(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar u[], void *ctx); 683c4762a1bSJed Brown Vec uexact; 684c4762a1bSJed Brown PetscInt dim; 685c4762a1bSJed Brown 686c4762a1bSJed Brown PetscFunctionBegin; 6879566063dSJacob Faibussowitsch PetscCall(DMGetDimension(dm, &dim)); 688c4762a1bSJed Brown if (dim == 2) bcFuncs[0] = quadratic_u_2d; 689c4762a1bSJed Brown else bcFuncs[0] = quadratic_u_3d; 6909566063dSJacob Faibussowitsch PetscCall(DMCreateLocalVector(dmAux, &uexact)); 6919566063dSJacob Faibussowitsch PetscCall(DMProjectFunctionLocal(dmAux, 0.0, bcFuncs, NULL, INSERT_ALL_VALUES, uexact)); 6929566063dSJacob Faibussowitsch PetscCall(DMSetAuxiliaryVec(dm, NULL, 0, 0, uexact)); 6939566063dSJacob Faibussowitsch PetscCall(VecDestroy(&uexact)); 6943ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 695c4762a1bSJed Brown } 696c4762a1bSJed Brown 697d71ae5a4SJacob Faibussowitsch static PetscErrorCode SetupAuxDM(DM dm, PetscFE feAux, AppCtx *user) 698d71ae5a4SJacob Faibussowitsch { 699c4762a1bSJed Brown DM dmAux, coordDM; 700c4762a1bSJed Brown 701c4762a1bSJed Brown PetscFunctionBegin; 702c4762a1bSJed Brown /* MUST call DMGetCoordinateDM() in order to get p4est setup if present */ 7039566063dSJacob Faibussowitsch PetscCall(DMGetCoordinateDM(dm, &coordDM)); 7043ba16761SJacob Faibussowitsch if (!feAux) PetscFunctionReturn(PETSC_SUCCESS); 7059566063dSJacob Faibussowitsch PetscCall(DMClone(dm, &dmAux)); 7069566063dSJacob Faibussowitsch PetscCall(DMSetCoordinateDM(dmAux, coordDM)); 7079566063dSJacob Faibussowitsch PetscCall(DMSetField(dmAux, 0, NULL, (PetscObject)feAux)); 7089566063dSJacob Faibussowitsch PetscCall(DMCreateDS(dmAux)); 7099566063dSJacob Faibussowitsch if (user->fieldBC) PetscCall(SetupBC(dm, dmAux, user)); 7109566063dSJacob Faibussowitsch else PetscCall(SetupMaterial(dm, dmAux, user)); 7119566063dSJacob Faibussowitsch PetscCall(DMDestroy(&dmAux)); 7123ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 713c4762a1bSJed Brown } 714c4762a1bSJed Brown 715d71ae5a4SJacob Faibussowitsch static PetscErrorCode SetupDiscretization(DM dm, AppCtx *user) 716d71ae5a4SJacob Faibussowitsch { 71730602db0SMatthew G. Knepley DM plex, cdm = dm; 718c4762a1bSJed Brown PetscFE fe, feAux = NULL; 71930602db0SMatthew G. Knepley PetscBool simplex; 72030602db0SMatthew G. Knepley PetscInt dim; 721c4762a1bSJed Brown 722c4762a1bSJed Brown PetscFunctionBeginUser; 7239566063dSJacob Faibussowitsch PetscCall(DMGetDimension(dm, &dim)); 7249566063dSJacob Faibussowitsch PetscCall(DMConvert(dm, DMPLEX, &plex)); 7259566063dSJacob Faibussowitsch PetscCall(DMPlexIsSimplex(plex, &simplex)); 7269566063dSJacob Faibussowitsch PetscCall(DMDestroy(&plex)); 7279566063dSJacob Faibussowitsch PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, NULL, -1, &fe)); 7289566063dSJacob Faibussowitsch PetscCall(PetscObjectSetName((PetscObject)fe, "potential")); 729d6837840SMatthew G. Knepley if (user->variableCoefficient == COEFF_FIELD || user->variableCoefficient == COEFF_CHECKERBOARD_0) { 7309566063dSJacob Faibussowitsch PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, "mat_", -1, &feAux)); 7319566063dSJacob Faibussowitsch PetscCall(PetscObjectSetName((PetscObject)feAux, "coefficient")); 7329566063dSJacob Faibussowitsch PetscCall(PetscFECopyQuadrature(fe, feAux)); 733c4762a1bSJed Brown } else if (user->fieldBC) { 7349566063dSJacob Faibussowitsch PetscCall(PetscFECreateDefault(PETSC_COMM_SELF, dim, 1, simplex, "bc_", -1, &feAux)); 7359566063dSJacob Faibussowitsch PetscCall(PetscFECopyQuadrature(fe, feAux)); 736c4762a1bSJed Brown } 737c4762a1bSJed Brown /* Set discretization and boundary conditions for each mesh */ 7389566063dSJacob Faibussowitsch PetscCall(DMSetField(dm, 0, NULL, (PetscObject)fe)); 7399566063dSJacob Faibussowitsch PetscCall(DMCreateDS(dm)); 7409566063dSJacob Faibussowitsch PetscCall(SetupProblem(dm, user)); 741c4762a1bSJed Brown while (cdm) { 7429566063dSJacob Faibussowitsch PetscCall(SetupAuxDM(cdm, feAux, user)); 74330602db0SMatthew G. Knepley if (user->bcType == DIRICHLET) { 744c4762a1bSJed Brown PetscBool hasLabel; 745c4762a1bSJed Brown 7469566063dSJacob Faibussowitsch PetscCall(DMHasLabel(cdm, "marker", &hasLabel)); 7479566063dSJacob Faibussowitsch if (!hasLabel) PetscCall(CreateBCLabel(cdm, "marker")); 748c4762a1bSJed Brown } 7499566063dSJacob Faibussowitsch PetscCall(DMCopyDisc(dm, cdm)); 7509566063dSJacob Faibussowitsch PetscCall(DMGetCoarseDM(cdm, &cdm)); 751c4762a1bSJed Brown } 7529566063dSJacob Faibussowitsch PetscCall(PetscFEDestroy(&fe)); 7539566063dSJacob Faibussowitsch PetscCall(PetscFEDestroy(&feAux)); 7543ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 755c4762a1bSJed Brown } 756c4762a1bSJed Brown 757d71ae5a4SJacob Faibussowitsch int main(int argc, char **argv) 758d71ae5a4SJacob Faibussowitsch { 759c4762a1bSJed Brown DM dm; /* Problem specification */ 760c4762a1bSJed Brown SNES snes; /* nonlinear solver */ 761c4762a1bSJed Brown Vec u; /* solution vector */ 762c4762a1bSJed Brown Mat A, J; /* Jacobian matrix */ 763c4762a1bSJed Brown MatNullSpace nullSpace; /* May be necessary for Neumann conditions */ 764c4762a1bSJed Brown AppCtx user; /* user-defined work context */ 765c4762a1bSJed Brown JacActionCtx userJ; /* context for Jacobian MF action */ 766c4762a1bSJed Brown PetscReal error = 0.0; /* L_2 error in the solution */ 767c4762a1bSJed Brown 768327415f7SBarry Smith PetscFunctionBeginUser; 7699566063dSJacob Faibussowitsch PetscCall(PetscInitialize(&argc, &argv, NULL, help)); 7709566063dSJacob Faibussowitsch PetscCall(ProcessOptions(PETSC_COMM_WORLD, &user)); 7719566063dSJacob Faibussowitsch PetscCall(SNESCreate(PETSC_COMM_WORLD, &snes)); 7729566063dSJacob Faibussowitsch PetscCall(CreateMesh(PETSC_COMM_WORLD, &user, &dm)); 7739566063dSJacob Faibussowitsch PetscCall(SNESSetDM(snes, dm)); 7749566063dSJacob Faibussowitsch PetscCall(DMSetApplicationContext(dm, &user)); 775c4762a1bSJed Brown 7769566063dSJacob Faibussowitsch PetscCall(PetscMalloc2(1, &user.exactFuncs, 1, &user.exactFields)); 7779566063dSJacob Faibussowitsch PetscCall(SetupDiscretization(dm, &user)); 778c4762a1bSJed Brown 7799566063dSJacob Faibussowitsch PetscCall(DMCreateGlobalVector(dm, &u)); 7809566063dSJacob Faibussowitsch PetscCall(PetscObjectSetName((PetscObject)u, "potential")); 781c4762a1bSJed Brown 7829566063dSJacob Faibussowitsch PetscCall(DMCreateMatrix(dm, &J)); 783c4762a1bSJed Brown if (user.jacobianMF) { 784c4762a1bSJed Brown PetscInt M, m, N, n; 785c4762a1bSJed Brown 7869566063dSJacob Faibussowitsch PetscCall(MatGetSize(J, &M, &N)); 7879566063dSJacob Faibussowitsch PetscCall(MatGetLocalSize(J, &m, &n)); 7889566063dSJacob Faibussowitsch PetscCall(MatCreate(PETSC_COMM_WORLD, &A)); 7899566063dSJacob Faibussowitsch PetscCall(MatSetSizes(A, m, n, M, N)); 7909566063dSJacob Faibussowitsch PetscCall(MatSetType(A, MATSHELL)); 7919566063dSJacob Faibussowitsch PetscCall(MatSetUp(A)); 792c4762a1bSJed Brown #if 0 7939566063dSJacob Faibussowitsch PetscCall(MatShellSetOperation(A, MATOP_MULT, (void (*)(void))FormJacobianAction)); 794c4762a1bSJed Brown #endif 795c4762a1bSJed Brown 796c4762a1bSJed Brown userJ.dm = dm; 797c4762a1bSJed Brown userJ.J = J; 798c4762a1bSJed Brown userJ.user = &user; 799c4762a1bSJed Brown 8009566063dSJacob Faibussowitsch PetscCall(DMCreateLocalVector(dm, &userJ.u)); 8019566063dSJacob Faibussowitsch if (user.fieldBC) PetscCall(DMProjectFieldLocal(dm, 0.0, userJ.u, user.exactFields, INSERT_BC_VALUES, userJ.u)); 8029566063dSJacob Faibussowitsch else PetscCall(DMProjectFunctionLocal(dm, 0.0, user.exactFuncs, NULL, INSERT_BC_VALUES, userJ.u)); 8039566063dSJacob Faibussowitsch PetscCall(MatShellSetContext(A, &userJ)); 804c4762a1bSJed Brown } else { 805c4762a1bSJed Brown A = J; 806c4762a1bSJed Brown } 807c4762a1bSJed Brown 808c4762a1bSJed Brown nullSpace = NULL; 809c4762a1bSJed Brown if (user.bcType != DIRICHLET) { 8109566063dSJacob Faibussowitsch PetscCall(MatNullSpaceCreate(PetscObjectComm((PetscObject)dm), PETSC_TRUE, 0, NULL, &nullSpace)); 8119566063dSJacob Faibussowitsch PetscCall(MatSetNullSpace(A, nullSpace)); 812c4762a1bSJed Brown } 813c4762a1bSJed Brown 8146493148fSStefano Zampini PetscCall(DMPlexSetSNESLocalFEM(dm, PETSC_FALSE, &user)); 8159566063dSJacob Faibussowitsch PetscCall(SNESSetJacobian(snes, A, J, NULL, NULL)); 816c4762a1bSJed Brown 8179566063dSJacob Faibussowitsch PetscCall(SNESSetFromOptions(snes)); 818c4762a1bSJed Brown 8199566063dSJacob Faibussowitsch if (user.fieldBC) PetscCall(DMProjectField(dm, 0.0, u, user.exactFields, INSERT_ALL_VALUES, u)); 8209566063dSJacob Faibussowitsch else PetscCall(DMProjectFunction(dm, 0.0, user.exactFuncs, NULL, INSERT_ALL_VALUES, u)); 821c4762a1bSJed Brown if (user.restart) { 822c4762a1bSJed Brown #if defined(PETSC_HAVE_HDF5) 823c4762a1bSJed Brown PetscViewer viewer; 82430602db0SMatthew G. Knepley char filename[PETSC_MAX_PATH_LEN]; 825c4762a1bSJed Brown 8269566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetString(NULL, NULL, "-dm_plex_filename", filename, sizeof(filename), NULL)); 8279566063dSJacob Faibussowitsch PetscCall(PetscViewerCreate(PETSC_COMM_WORLD, &viewer)); 8289566063dSJacob Faibussowitsch PetscCall(PetscViewerSetType(viewer, PETSCVIEWERHDF5)); 8299566063dSJacob Faibussowitsch PetscCall(PetscViewerFileSetMode(viewer, FILE_MODE_READ)); 8309566063dSJacob Faibussowitsch PetscCall(PetscViewerFileSetName(viewer, filename)); 8319566063dSJacob Faibussowitsch PetscCall(PetscViewerHDF5PushGroup(viewer, "/fields")); 8329566063dSJacob Faibussowitsch PetscCall(VecLoad(u, viewer)); 8339566063dSJacob Faibussowitsch PetscCall(PetscViewerHDF5PopGroup(viewer)); 8349566063dSJacob Faibussowitsch PetscCall(PetscViewerDestroy(&viewer)); 835c4762a1bSJed Brown #endif 836c4762a1bSJed Brown } 837c4762a1bSJed Brown if (user.showInitial) { 838c4762a1bSJed Brown Vec lv; 8399566063dSJacob Faibussowitsch PetscCall(DMGetLocalVector(dm, &lv)); 8409566063dSJacob Faibussowitsch PetscCall(DMGlobalToLocalBegin(dm, u, INSERT_VALUES, lv)); 8419566063dSJacob Faibussowitsch PetscCall(DMGlobalToLocalEnd(dm, u, INSERT_VALUES, lv)); 8429566063dSJacob Faibussowitsch PetscCall(DMPrintLocalVec(dm, "Local function", 1.0e-10, lv)); 8439566063dSJacob Faibussowitsch PetscCall(DMRestoreLocalVector(dm, &lv)); 844c4762a1bSJed Brown } 845c4762a1bSJed Brown if (user.runType == RUN_FULL || user.runType == RUN_EXACT) { 846c4762a1bSJed Brown PetscErrorCode (*initialGuess[1])(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar u[], void *ctx) = {zero}; 847c4762a1bSJed Brown 848c4762a1bSJed Brown if (user.nonzInit) initialGuess[0] = ecks; 84948a46eb9SPierre Jolivet if (user.runType == RUN_FULL) PetscCall(DMProjectFunction(dm, 0.0, initialGuess, NULL, INSERT_VALUES, u)); 8509566063dSJacob Faibussowitsch PetscCall(VecViewFromOptions(u, NULL, "-guess_vec_view")); 8519566063dSJacob Faibussowitsch PetscCall(SNESSolve(snes, NULL, u)); 8529566063dSJacob Faibussowitsch PetscCall(SNESGetSolution(snes, &u)); 8539566063dSJacob Faibussowitsch PetscCall(SNESGetDM(snes, &dm)); 854c4762a1bSJed Brown 855c4762a1bSJed Brown if (user.showSolution) { 8569566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Solution\n")); 85793ec0da9SPierre Jolivet PetscCall(VecFilter(u, 3.0e-9)); 8589566063dSJacob Faibussowitsch PetscCall(VecView(u, PETSC_VIEWER_STDOUT_WORLD)); 859c4762a1bSJed Brown } 860c4762a1bSJed Brown } else if (user.runType == RUN_PERF) { 861c4762a1bSJed Brown Vec r; 862c4762a1bSJed Brown PetscReal res = 0.0; 863c4762a1bSJed Brown 8649566063dSJacob Faibussowitsch PetscCall(SNESGetFunction(snes, &r, NULL, NULL)); 8659566063dSJacob Faibussowitsch PetscCall(SNESComputeFunction(snes, u, r)); 8669566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Initial Residual\n")); 86793ec0da9SPierre Jolivet PetscCall(VecFilter(r, 1.0e-10)); 8689566063dSJacob Faibussowitsch PetscCall(VecNorm(r, NORM_2, &res)); 8699566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "L_2 Residual: %g\n", (double)res)); 870c4762a1bSJed Brown } else { 871c4762a1bSJed Brown Vec r; 872c4762a1bSJed Brown PetscReal res = 0.0, tol = 1.0e-11; 873c4762a1bSJed Brown 874c4762a1bSJed Brown /* Check discretization error */ 8759566063dSJacob Faibussowitsch PetscCall(SNESGetFunction(snes, &r, NULL, NULL)); 8769566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Initial guess\n")); 8779566063dSJacob Faibussowitsch if (!user.quiet) PetscCall(VecView(u, PETSC_VIEWER_STDOUT_WORLD)); 8789566063dSJacob Faibussowitsch PetscCall(DMComputeL2Diff(dm, 0.0, user.exactFuncs, NULL, u, &error)); 8799566063dSJacob Faibussowitsch if (error < tol) PetscCall(PetscPrintf(PETSC_COMM_WORLD, "L_2 Error: < %2.1e\n", (double)tol)); 8809566063dSJacob Faibussowitsch else PetscCall(PetscPrintf(PETSC_COMM_WORLD, "L_2 Error: %g\n", (double)error)); 881c4762a1bSJed Brown /* Check residual */ 8829566063dSJacob Faibussowitsch PetscCall(SNESComputeFunction(snes, u, r)); 8839566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Initial Residual\n")); 88493ec0da9SPierre Jolivet PetscCall(VecFilter(r, 1.0e-10)); 8859566063dSJacob Faibussowitsch if (!user.quiet) PetscCall(VecView(r, PETSC_VIEWER_STDOUT_WORLD)); 8869566063dSJacob Faibussowitsch PetscCall(VecNorm(r, NORM_2, &res)); 8879566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "L_2 Residual: %g\n", (double)res)); 888c4762a1bSJed Brown /* Check Jacobian */ 889c4762a1bSJed Brown { 890c4762a1bSJed Brown Vec b; 891c4762a1bSJed Brown 8929566063dSJacob Faibussowitsch PetscCall(SNESComputeJacobian(snes, u, A, A)); 8939566063dSJacob Faibussowitsch PetscCall(VecDuplicate(u, &b)); 8949566063dSJacob Faibussowitsch PetscCall(VecSet(r, 0.0)); 8959566063dSJacob Faibussowitsch PetscCall(SNESComputeFunction(snes, r, b)); 8969566063dSJacob Faibussowitsch PetscCall(MatMult(A, u, r)); 8979566063dSJacob Faibussowitsch PetscCall(VecAXPY(r, 1.0, b)); 8989566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Au - b = Au + F(0)\n")); 89993ec0da9SPierre Jolivet PetscCall(VecFilter(r, 1.0e-10)); 9009566063dSJacob Faibussowitsch if (!user.quiet) PetscCall(VecView(r, PETSC_VIEWER_STDOUT_WORLD)); 9019566063dSJacob Faibussowitsch PetscCall(VecNorm(r, NORM_2, &res)); 9029566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Linear L_2 Residual: %g\n", (double)res)); 903c4762a1bSJed Brown /* check solver */ 904c4762a1bSJed Brown if (user.checkksp) { 905c4762a1bSJed Brown KSP ksp; 906c4762a1bSJed Brown 9071baa6e33SBarry Smith if (nullSpace) PetscCall(MatNullSpaceRemove(nullSpace, u)); 9089566063dSJacob Faibussowitsch PetscCall(SNESComputeJacobian(snes, u, A, J)); 9099566063dSJacob Faibussowitsch PetscCall(MatMult(A, u, b)); 9109566063dSJacob Faibussowitsch PetscCall(SNESGetKSP(snes, &ksp)); 9119566063dSJacob Faibussowitsch PetscCall(KSPSetOperators(ksp, A, J)); 9129566063dSJacob Faibussowitsch PetscCall(KSPSolve(ksp, b, r)); 9139566063dSJacob Faibussowitsch PetscCall(VecAXPY(r, -1.0, u)); 9149566063dSJacob Faibussowitsch PetscCall(VecNorm(r, NORM_2, &res)); 9159566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "KSP Error: %g\n", (double)res)); 916c4762a1bSJed Brown } 9179566063dSJacob Faibussowitsch PetscCall(VecDestroy(&b)); 918c4762a1bSJed Brown } 919c4762a1bSJed Brown } 9209566063dSJacob Faibussowitsch PetscCall(VecViewFromOptions(u, NULL, "-vec_view")); 921d6837840SMatthew G. Knepley { 922d6837840SMatthew G. Knepley Vec nu; 923d6837840SMatthew G. Knepley 9249566063dSJacob Faibussowitsch PetscCall(DMGetAuxiliaryVec(dm, NULL, 0, 0, &nu)); 9259566063dSJacob Faibussowitsch if (nu) PetscCall(VecViewFromOptions(nu, NULL, "-coeff_view")); 926d6837840SMatthew G. Knepley } 927c4762a1bSJed Brown 928c4762a1bSJed Brown if (user.bdIntegral) { 929c4762a1bSJed Brown DMLabel label; 93079ab67a3SMatthew G. Knepley PetscBdPointFunc func[1] = {bd_integral_2d}; 931c4762a1bSJed Brown PetscInt id = 1; 932c4762a1bSJed Brown PetscScalar bdInt = 0.0; 933c4762a1bSJed Brown PetscReal exact = 3.3333333333; 934c4762a1bSJed Brown 9359566063dSJacob Faibussowitsch PetscCall(DMGetLabel(dm, "marker", &label)); 93679ab67a3SMatthew G. Knepley PetscCall(DMPlexComputeBdIntegral(dm, u, label, 1, &id, func, &bdInt, NULL)); 9379566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Solution boundary integral: %.4g\n", (double)PetscAbsScalar(bdInt))); 9380b121fc5SBarry Smith 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); 939c4762a1bSJed Brown } 940c4762a1bSJed Brown 9419566063dSJacob Faibussowitsch PetscCall(MatNullSpaceDestroy(&nullSpace)); 9429566063dSJacob Faibussowitsch if (user.jacobianMF) PetscCall(VecDestroy(&userJ.u)); 9439566063dSJacob Faibussowitsch if (A != J) PetscCall(MatDestroy(&A)); 9449566063dSJacob Faibussowitsch PetscCall(MatDestroy(&J)); 9459566063dSJacob Faibussowitsch PetscCall(VecDestroy(&u)); 9469566063dSJacob Faibussowitsch PetscCall(SNESDestroy(&snes)); 9479566063dSJacob Faibussowitsch PetscCall(DMDestroy(&dm)); 9489566063dSJacob Faibussowitsch PetscCall(PetscFree2(user.exactFuncs, user.exactFields)); 9499566063dSJacob Faibussowitsch PetscCall(PetscFree(user.kgrid)); 9509566063dSJacob Faibussowitsch PetscCall(PetscFinalize()); 951b122ec5aSJacob Faibussowitsch return 0; 952c4762a1bSJed Brown } 953c4762a1bSJed Brown 954c4762a1bSJed Brown /*TEST 955c4762a1bSJed Brown # 2D serial P1 test 0-4 956c4762a1bSJed Brown test: 957c4762a1bSJed Brown suffix: 2d_p1_0 958c4762a1bSJed Brown requires: triangle 95930602db0SMatthew G. Knepley args: -run_type test -bc_type dirichlet -dm_plex_interpolate 0 -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 960c4762a1bSJed Brown 961c4762a1bSJed Brown test: 962c4762a1bSJed Brown suffix: 2d_p1_1 963c4762a1bSJed Brown requires: triangle 96430602db0SMatthew G. Knepley args: -run_type test -bc_type dirichlet -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 965c4762a1bSJed Brown 966c4762a1bSJed Brown test: 967c4762a1bSJed Brown suffix: 2d_p1_2 968c4762a1bSJed Brown requires: triangle 96930602db0SMatthew G. Knepley args: -run_type test -dm_refine_volume_limit_pre 0.0625 -bc_type dirichlet -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 970c4762a1bSJed Brown 971c4762a1bSJed Brown test: 972c4762a1bSJed Brown suffix: 2d_p1_neumann_0 973c4762a1bSJed Brown requires: triangle 97430602db0SMatthew G. Knepley 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 975c4762a1bSJed Brown 976c4762a1bSJed Brown test: 977c4762a1bSJed Brown suffix: 2d_p1_neumann_1 978c4762a1bSJed Brown requires: triangle 97930602db0SMatthew G. Knepley 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 980c4762a1bSJed Brown 981c4762a1bSJed Brown # 2D serial P2 test 5-8 982c4762a1bSJed Brown test: 983c4762a1bSJed Brown suffix: 2d_p2_0 984c4762a1bSJed Brown requires: triangle 98530602db0SMatthew G. Knepley args: -run_type test -bc_type dirichlet -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 986c4762a1bSJed Brown 987c4762a1bSJed Brown test: 988c4762a1bSJed Brown suffix: 2d_p2_1 989c4762a1bSJed Brown requires: triangle 99030602db0SMatthew G. Knepley args: -run_type test -dm_refine_volume_limit_pre 0.0625 -bc_type dirichlet -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 991c4762a1bSJed Brown 992c4762a1bSJed Brown test: 993c4762a1bSJed Brown suffix: 2d_p2_neumann_0 994c4762a1bSJed Brown requires: triangle 99530602db0SMatthew G. Knepley 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 996c4762a1bSJed Brown 997c4762a1bSJed Brown test: 998c4762a1bSJed Brown suffix: 2d_p2_neumann_1 999c4762a1bSJed Brown requires: triangle 100030602db0SMatthew G. Knepley 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 1001c4762a1bSJed Brown 1002c4762a1bSJed Brown test: 1003c4762a1bSJed Brown suffix: bd_int_0 1004c4762a1bSJed Brown requires: triangle 100530602db0SMatthew G. Knepley args: -run_type test -bc_type dirichlet -petscspace_degree 2 -bd_integral -dm_view -quiet 1006c4762a1bSJed Brown 1007c4762a1bSJed Brown test: 1008c4762a1bSJed Brown suffix: bd_int_1 1009c4762a1bSJed Brown requires: triangle 101030602db0SMatthew G. Knepley args: -run_type test -dm_refine 2 -bc_type dirichlet -petscspace_degree 2 -bd_integral -dm_view -quiet 1011c4762a1bSJed Brown 1012c4762a1bSJed Brown # 3D serial P1 test 9-12 1013c4762a1bSJed Brown test: 1014c4762a1bSJed Brown suffix: 3d_p1_0 1015c4762a1bSJed Brown requires: ctetgen 101630602db0SMatthew G. Knepley 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 1017c4762a1bSJed Brown 1018c4762a1bSJed Brown test: 1019c4762a1bSJed Brown suffix: 3d_p1_1 1020c4762a1bSJed Brown requires: ctetgen 102130602db0SMatthew G. Knepley args: -run_type test -dm_plex_dim 3 -bc_type dirichlet -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 -dm_view 1022c4762a1bSJed Brown 1023c4762a1bSJed Brown test: 1024c4762a1bSJed Brown suffix: 3d_p1_2 1025c4762a1bSJed Brown requires: ctetgen 102630602db0SMatthew G. Knepley 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 1027c4762a1bSJed Brown 1028c4762a1bSJed Brown test: 1029c4762a1bSJed Brown suffix: 3d_p1_neumann_0 1030c4762a1bSJed Brown requires: ctetgen 103130602db0SMatthew G. Knepley 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 1032c4762a1bSJed Brown 1033c4762a1bSJed Brown # Analytic variable coefficient 13-20 1034c4762a1bSJed Brown test: 1035c4762a1bSJed Brown suffix: 13 1036c4762a1bSJed Brown requires: triangle 103730602db0SMatthew G. Knepley args: -run_type test -variable_coefficient analytic -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 1038c4762a1bSJed Brown test: 1039c4762a1bSJed Brown suffix: 14 1040c4762a1bSJed Brown requires: triangle 104130602db0SMatthew G. Knepley args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient analytic -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 1042c4762a1bSJed Brown test: 1043c4762a1bSJed Brown suffix: 15 1044c4762a1bSJed Brown requires: triangle 104530602db0SMatthew G. Knepley args: -run_type test -variable_coefficient analytic -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 1046c4762a1bSJed Brown test: 1047c4762a1bSJed Brown suffix: 16 1048c4762a1bSJed Brown requires: triangle 104930602db0SMatthew G. Knepley args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient analytic -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 1050c4762a1bSJed Brown test: 1051c4762a1bSJed Brown suffix: 17 1052c4762a1bSJed Brown requires: ctetgen 105330602db0SMatthew G. Knepley args: -run_type test -dm_plex_dim 3 -variable_coefficient analytic -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 1054c4762a1bSJed Brown 1055c4762a1bSJed Brown test: 1056c4762a1bSJed Brown suffix: 18 1057c4762a1bSJed Brown requires: ctetgen 105830602db0SMatthew G. Knepley 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 1059c4762a1bSJed Brown 1060c4762a1bSJed Brown test: 1061c4762a1bSJed Brown suffix: 19 1062c4762a1bSJed Brown requires: ctetgen 106330602db0SMatthew G. Knepley args: -run_type test -dm_plex_dim 3 -variable_coefficient analytic -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 1064c4762a1bSJed Brown 1065c4762a1bSJed Brown test: 1066c4762a1bSJed Brown suffix: 20 1067c4762a1bSJed Brown requires: ctetgen 106830602db0SMatthew G. Knepley 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 1069c4762a1bSJed Brown 1070c4762a1bSJed Brown # P1 variable coefficient 21-28 1071c4762a1bSJed Brown test: 1072c4762a1bSJed Brown suffix: 21 1073c4762a1bSJed Brown requires: triangle 107430602db0SMatthew G. Knepley args: -run_type test -variable_coefficient field -petscspace_degree 1 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1 1075c4762a1bSJed Brown 1076c4762a1bSJed Brown test: 1077c4762a1bSJed Brown suffix: 22 1078c4762a1bSJed Brown requires: triangle 107930602db0SMatthew G. Knepley 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 1080c4762a1bSJed Brown 1081c4762a1bSJed Brown test: 1082c4762a1bSJed Brown suffix: 23 1083c4762a1bSJed Brown requires: triangle 108430602db0SMatthew G. Knepley args: -run_type test -variable_coefficient field -petscspace_degree 2 -mat_petscspace_degree 1 -show_initial -dm_plex_print_fem 1 1085c4762a1bSJed Brown 1086c4762a1bSJed Brown test: 1087c4762a1bSJed Brown suffix: 24 1088c4762a1bSJed Brown requires: triangle 108930602db0SMatthew G. Knepley 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 1090c4762a1bSJed Brown 1091c4762a1bSJed Brown test: 1092c4762a1bSJed Brown suffix: 25 1093c4762a1bSJed Brown requires: ctetgen 109430602db0SMatthew G. Knepley 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 1095c4762a1bSJed Brown 1096c4762a1bSJed Brown test: 1097c4762a1bSJed Brown suffix: 26 1098c4762a1bSJed Brown requires: ctetgen 109930602db0SMatthew G. Knepley 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 1100c4762a1bSJed Brown 1101c4762a1bSJed Brown test: 1102c4762a1bSJed Brown suffix: 27 1103c4762a1bSJed Brown requires: ctetgen 110430602db0SMatthew G. Knepley 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 1105c4762a1bSJed Brown 1106c4762a1bSJed Brown test: 1107c4762a1bSJed Brown suffix: 28 1108c4762a1bSJed Brown requires: ctetgen 110930602db0SMatthew G. Knepley 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 1110c4762a1bSJed Brown 1111c4762a1bSJed Brown # P0 variable coefficient 29-36 1112c4762a1bSJed Brown test: 1113c4762a1bSJed Brown suffix: 29 1114c4762a1bSJed Brown requires: triangle 111530602db0SMatthew G. Knepley args: -run_type test -variable_coefficient field -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 1116c4762a1bSJed Brown 1117c4762a1bSJed Brown test: 1118c4762a1bSJed Brown suffix: 30 1119c4762a1bSJed Brown requires: triangle 112030602db0SMatthew G. Knepley args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient field -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 1121c4762a1bSJed Brown 1122c4762a1bSJed Brown test: 1123c4762a1bSJed Brown suffix: 31 1124c4762a1bSJed Brown requires: triangle 112530602db0SMatthew G. Knepley args: -run_type test -variable_coefficient field -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 1126c4762a1bSJed Brown 1127c4762a1bSJed Brown test: 1128c4762a1bSJed Brown requires: triangle 1129c4762a1bSJed Brown suffix: 32 113030602db0SMatthew G. Knepley args: -run_type test -dm_refine_volume_limit_pre 0.0625 -variable_coefficient field -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 1131c4762a1bSJed Brown 1132c4762a1bSJed Brown test: 1133c4762a1bSJed Brown requires: ctetgen 1134c4762a1bSJed Brown suffix: 33 113530602db0SMatthew G. Knepley args: -run_type test -dm_plex_dim 3 -variable_coefficient field -petscspace_degree 1 -show_initial -dm_plex_print_fem 1 1136c4762a1bSJed Brown 1137c4762a1bSJed Brown test: 1138c4762a1bSJed Brown suffix: 34 1139c4762a1bSJed Brown requires: ctetgen 114030602db0SMatthew G. Knepley 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 1141c4762a1bSJed Brown 1142c4762a1bSJed Brown test: 1143c4762a1bSJed Brown suffix: 35 1144c4762a1bSJed Brown requires: ctetgen 114530602db0SMatthew G. Knepley args: -run_type test -dm_plex_dim 3 -variable_coefficient field -petscspace_degree 2 -show_initial -dm_plex_print_fem 1 1146c4762a1bSJed Brown 1147c4762a1bSJed Brown test: 1148c4762a1bSJed Brown suffix: 36 1149c4762a1bSJed Brown requires: ctetgen 115030602db0SMatthew G. Knepley 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 1151c4762a1bSJed Brown 1152c4762a1bSJed Brown # Full solve 39-44 1153c4762a1bSJed Brown test: 1154c4762a1bSJed Brown suffix: 39 1155c4762a1bSJed Brown requires: triangle !single 1156bae903cbSmarkadams4 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 1157c4762a1bSJed Brown test: 1158c4762a1bSJed Brown suffix: 40 1159c4762a1bSJed Brown requires: triangle !single 116030602db0SMatthew G. Knepley 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 1161c4762a1bSJed Brown test: 1162c4762a1bSJed Brown suffix: 41 1163c4762a1bSJed Brown requires: triangle !single 116430602db0SMatthew G. Knepley 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 1165c4762a1bSJed Brown test: 1166c4762a1bSJed Brown suffix: 42 1167c4762a1bSJed Brown requires: triangle !single 116830602db0SMatthew G. Knepley 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 1169c4762a1bSJed Brown test: 1170c4762a1bSJed Brown suffix: 43 1171c4762a1bSJed Brown requires: triangle !single 1172c4762a1bSJed Brown nsize: 2 1173e600fa54SMatthew G. Knepley 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 1174c4762a1bSJed Brown 1175c4762a1bSJed Brown test: 1176c4762a1bSJed Brown suffix: 44 1177c4762a1bSJed Brown requires: triangle !single 1178c4762a1bSJed Brown nsize: 2 1179e600fa54SMatthew G. Knepley 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 1180c4762a1bSJed Brown 1181c4762a1bSJed Brown # These tests use a loose tolerance just to exercise the PtAP operations for MATIS and multiple PCBDDC setup calls inside PCMG 1182c4762a1bSJed Brown testset: 1183c4762a1bSJed Brown requires: triangle !single 1184c4762a1bSJed Brown nsize: 3 11852b3cbbdaSStefano Zampini 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 1186c4762a1bSJed Brown test: 1187c4762a1bSJed Brown suffix: gmg_bddc 1188c4762a1bSJed Brown filter: sed -e "s/CONVERGED_FNORM_RELATIVE iterations 3/CONVERGED_FNORM_RELATIVE iterations 4/g" 1189c4762a1bSJed Brown args: -mg_levels_pc_type jacobi 1190c4762a1bSJed Brown test: 1191c4762a1bSJed Brown filter: sed -e "s/iterations [0-4]/iterations 4/g" 1192c4762a1bSJed Brown suffix: gmg_bddc_lev 1193c4762a1bSJed Brown args: -mg_levels_pc_type bddc 1194c4762a1bSJed Brown 1195*c29ce622SStefano Zampini # VTU viewer with empty processes 1196*c29ce622SStefano Zampini test: 1197*c29ce622SStefano Zampini requires: !complex 1198*c29ce622SStefano Zampini suffix: vtu_empty 1199*c29ce622SStefano Zampini 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 1200*c29ce622SStefano Zampini 1201c4762a1bSJed Brown # Restarting 1202c4762a1bSJed Brown testset: 1203c4762a1bSJed Brown suffix: restart 1204c4762a1bSJed Brown requires: hdf5 triangle !complex 120530602db0SMatthew G. Knepley args: -run_type test -bc_type dirichlet -petscspace_degree 1 1206c4762a1bSJed Brown test: 1207c4762a1bSJed Brown args: -dm_view hdf5:sol.h5 -vec_view hdf5:sol.h5::append 1208c4762a1bSJed Brown test: 1209cd7e8a5eSksagiyam args: -dm_plex_filename sol.h5 -dm_plex_name box -restart 1210c4762a1bSJed Brown 1211c4762a1bSJed Brown # Periodicity 1212c4762a1bSJed Brown test: 1213c4762a1bSJed Brown suffix: periodic_0 1214c4762a1bSJed Brown requires: triangle 121530602db0SMatthew G. Knepley args: -run_type full -bc_type dirichlet -petscspace_degree 1 -snes_converged_reason ::ascii_info_detail 1216c4762a1bSJed Brown 1217c4762a1bSJed Brown test: 1218c4762a1bSJed Brown requires: !complex 1219c4762a1bSJed Brown suffix: periodic_1 122030602db0SMatthew G. Knepley 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 1221c4762a1bSJed Brown 1222c4762a1bSJed Brown # 2D serial P1 test with field bc 1223c4762a1bSJed Brown test: 1224c4762a1bSJed Brown suffix: field_bc_2d_p1_0 1225c4762a1bSJed Brown requires: triangle 122630602db0SMatthew G. Knepley args: -run_type test -bc_type dirichlet -field_bc -petscspace_degree 1 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1 1227c4762a1bSJed Brown 1228c4762a1bSJed Brown test: 1229c4762a1bSJed Brown suffix: field_bc_2d_p1_1 1230c4762a1bSJed Brown requires: triangle 123130602db0SMatthew G. Knepley 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 1232c4762a1bSJed Brown 1233c4762a1bSJed Brown test: 1234c4762a1bSJed Brown suffix: field_bc_2d_p1_neumann_0 1235c4762a1bSJed Brown requires: triangle 123630602db0SMatthew G. Knepley 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 1237c4762a1bSJed Brown 1238c4762a1bSJed Brown test: 1239c4762a1bSJed Brown suffix: field_bc_2d_p1_neumann_1 1240c4762a1bSJed Brown requires: triangle 124130602db0SMatthew G. Knepley 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 1242c4762a1bSJed Brown 1243c4762a1bSJed Brown # 3D serial P1 test with field bc 1244c4762a1bSJed Brown test: 1245c4762a1bSJed Brown suffix: field_bc_3d_p1_0 1246c4762a1bSJed Brown requires: ctetgen 124730602db0SMatthew G. Knepley 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 1248c4762a1bSJed Brown 1249c4762a1bSJed Brown test: 1250c4762a1bSJed Brown suffix: field_bc_3d_p1_1 1251c4762a1bSJed Brown requires: ctetgen 125230602db0SMatthew G. Knepley 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 1253c4762a1bSJed Brown 1254c4762a1bSJed Brown test: 1255c4762a1bSJed Brown suffix: field_bc_3d_p1_neumann_0 1256c4762a1bSJed Brown requires: ctetgen 125730602db0SMatthew G. Knepley 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 1258c4762a1bSJed Brown 1259c4762a1bSJed Brown test: 1260c4762a1bSJed Brown suffix: field_bc_3d_p1_neumann_1 1261c4762a1bSJed Brown requires: ctetgen 126230602db0SMatthew G. Knepley 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 1263c4762a1bSJed Brown 1264c4762a1bSJed Brown # 2D serial P2 test with field bc 1265c4762a1bSJed Brown test: 1266c4762a1bSJed Brown suffix: field_bc_2d_p2_0 1267c4762a1bSJed Brown requires: triangle 126830602db0SMatthew G. Knepley args: -run_type test -bc_type dirichlet -field_bc -petscspace_degree 2 -bc_petscspace_degree 2 -show_initial -dm_plex_print_fem 1 1269c4762a1bSJed Brown 1270c4762a1bSJed Brown test: 1271c4762a1bSJed Brown suffix: field_bc_2d_p2_1 1272c4762a1bSJed Brown requires: triangle 127330602db0SMatthew G. Knepley 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 1274c4762a1bSJed Brown 1275c4762a1bSJed Brown test: 1276c4762a1bSJed Brown suffix: field_bc_2d_p2_neumann_0 1277c4762a1bSJed Brown requires: triangle 127830602db0SMatthew G. Knepley 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 1279c4762a1bSJed Brown 1280c4762a1bSJed Brown test: 1281c4762a1bSJed Brown suffix: field_bc_2d_p2_neumann_1 1282c4762a1bSJed Brown requires: triangle 128330602db0SMatthew G. Knepley 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 1284c4762a1bSJed Brown 1285c4762a1bSJed Brown # 3D serial P2 test with field bc 1286c4762a1bSJed Brown test: 1287c4762a1bSJed Brown suffix: field_bc_3d_p2_0 1288c4762a1bSJed Brown requires: ctetgen 128930602db0SMatthew G. Knepley 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 1290c4762a1bSJed Brown 1291c4762a1bSJed Brown test: 1292c4762a1bSJed Brown suffix: field_bc_3d_p2_1 1293c4762a1bSJed Brown requires: ctetgen 129430602db0SMatthew G. Knepley 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 1295c4762a1bSJed Brown 1296c4762a1bSJed Brown test: 1297c4762a1bSJed Brown suffix: field_bc_3d_p2_neumann_0 1298c4762a1bSJed Brown requires: ctetgen 129930602db0SMatthew G. Knepley 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 1300c4762a1bSJed Brown 1301c4762a1bSJed Brown test: 1302c4762a1bSJed Brown suffix: field_bc_3d_p2_neumann_1 1303c4762a1bSJed Brown requires: ctetgen 130430602db0SMatthew G. Knepley 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 1305c4762a1bSJed Brown 1306c4762a1bSJed Brown # Full solve simplex: Convergence 1307c4762a1bSJed Brown test: 13080fdc7489SMatthew Knepley suffix: 3d_p1_conv 1309c4762a1bSJed Brown requires: ctetgen 131030602db0SMatthew G. Knepley args: -run_type full -dm_plex_dim 3 -dm_refine 1 -bc_type dirichlet -petscspace_degree 1 \ 13110fdc7489SMatthew Knepley -snes_convergence_estimate -convest_num_refine 1 -pc_type lu 1312c4762a1bSJed Brown 1313c4762a1bSJed Brown # Full solve simplex: PCBDDC 1314c4762a1bSJed Brown test: 1315c4762a1bSJed Brown suffix: tri_bddc 1316c4762a1bSJed Brown requires: triangle !single 1317c4762a1bSJed Brown nsize: 5 1318e600fa54SMatthew G. Knepley 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 1319c4762a1bSJed Brown 1320c4762a1bSJed Brown # Full solve simplex: PCBDDC 1321c4762a1bSJed Brown test: 1322c4762a1bSJed Brown suffix: tri_parmetis_bddc 1323c4762a1bSJed Brown requires: triangle !single parmetis 1324c4762a1bSJed Brown nsize: 4 1325e600fa54SMatthew G. Knepley 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 1326c4762a1bSJed Brown 1327c4762a1bSJed Brown testset: 1328e600fa54SMatthew G. Knepley 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 1329c4762a1bSJed Brown nsize: 5 1330c4762a1bSJed Brown output_file: output/ex12_quad_bddc.out 1331c4762a1bSJed Brown filter: sed -e "s/aijcusparse/aij/g" -e "s/aijviennacl/aij/g" -e "s/factorization: cusparse/factorization: petsc/g" 1332c4762a1bSJed Brown test: 1333c4762a1bSJed Brown requires: !single 1334c4762a1bSJed Brown suffix: quad_bddc 1335c4762a1bSJed Brown test: 1336c4762a1bSJed Brown requires: !single cuda 1337c4762a1bSJed Brown suffix: quad_bddc_cuda 13384f58015eSStefano Zampini args: -mat_is_localmat_type aijcusparse -pc_bddc_dirichlet_pc_factor_mat_solver_type cusparse -pc_bddc_neumann_pc_factor_mat_solver_type cusparse 1339c4762a1bSJed Brown test: 1340c4762a1bSJed Brown requires: !single viennacl 1341c4762a1bSJed Brown suffix: quad_bddc_viennacl 13424f58015eSStefano Zampini args: -mat_is_localmat_type aijviennacl 1343c4762a1bSJed Brown 1344c4762a1bSJed Brown # Full solve simplex: ASM 1345c4762a1bSJed Brown test: 1346c4762a1bSJed Brown suffix: tri_q2q1_asm_lu 1347c4762a1bSJed Brown requires: triangle !single 134830602db0SMatthew G. Knepley 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 1349c4762a1bSJed Brown 1350c4762a1bSJed Brown test: 1351c4762a1bSJed Brown suffix: tri_q2q1_msm_lu 1352c4762a1bSJed Brown requires: triangle !single 135330602db0SMatthew G. Knepley 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 1354c4762a1bSJed Brown 1355c4762a1bSJed Brown test: 1356c4762a1bSJed Brown suffix: tri_q2q1_asm_sor 1357c4762a1bSJed Brown requires: triangle !single 135830602db0SMatthew G. Knepley 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 1359c4762a1bSJed Brown 1360c4762a1bSJed Brown test: 1361c4762a1bSJed Brown suffix: tri_q2q1_msm_sor 1362c4762a1bSJed Brown requires: triangle !single 136330602db0SMatthew G. Knepley 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 1364c4762a1bSJed Brown 1365c4762a1bSJed Brown # Full solve simplex: FAS 1366c4762a1bSJed Brown test: 1367c4762a1bSJed Brown suffix: fas_newton_0 1368c4762a1bSJed Brown requires: triangle !single 136930602db0SMatthew G. Knepley 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 1370c4762a1bSJed Brown 1371c4762a1bSJed Brown test: 1372c4762a1bSJed Brown suffix: fas_newton_1 1373c4762a1bSJed Brown requires: triangle !single 137430602db0SMatthew G. Knepley 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 1375c4ef839dSSatish Balay filter: sed -e "s/total number of linear solver iterations=14/total number of linear solver iterations=15/g" 1376c4762a1bSJed Brown 1377c4762a1bSJed Brown test: 1378c4762a1bSJed Brown suffix: fas_ngs_0 1379c4762a1bSJed Brown requires: triangle !single 138030602db0SMatthew G. Knepley 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 1381c4762a1bSJed Brown 1382071b71afSMatthew G. Knepley # These two tests are broken because DMPlexComputeInjectorFEM() only works for regularly refined meshes 1383c4762a1bSJed Brown test: 1384c4762a1bSJed Brown suffix: fas_newton_coarse_0 1385c4762a1bSJed Brown requires: pragmatic triangle 1386c4762a1bSJed Brown TODO: broken 1387071b71afSMatthew G. Knepley args: -run_type full -variable_coefficient nonlinear -petscspace_degree 1 \ 138834b6e994SJoe Wallwork -dm_refine 2 -dm_coarsen_hierarchy 1 -dm_plex_hash_location -dm_adaptor pragmatic \ 1389071b71afSMatthew G. Knepley -snes_type fas -snes_fas_levels 2 -snes_converged_reason ::ascii_info_detail -snes_monitor_short -snes_view \ 1390071b71afSMatthew G. Knepley -fas_coarse_pc_type svd -fas_coarse_ksp_rtol 1.0e-10 -fas_coarse_snes_monitor_short -fas_coarse_snes_linesearch_type basic \ 1391071b71afSMatthew G. Knepley -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 1392c4762a1bSJed Brown 1393c4762a1bSJed Brown test: 1394c4762a1bSJed Brown suffix: mg_newton_coarse_0 1395c4762a1bSJed Brown requires: triangle pragmatic 1396c4762a1bSJed Brown TODO: broken 1397071b71afSMatthew G. Knepley args: -run_type full -petscspace_degree 1 \ 139834b6e994SJoe Wallwork -dm_refine 3 -dm_coarsen_hierarchy 3 -dm_plex_hash_location -dm_adaptor pragmatic \ 1399071b71afSMatthew G. Knepley -snes_atol 1.0e-8 -snes_rtol 0.0 -snes_monitor_short -snes_converged_reason ::ascii_info_detail -snes_view \ 1400071b71afSMatthew G. Knepley -ksp_type richardson -ksp_atol 1.0e-8 -ksp_rtol 0.0 -ksp_norm_type unpreconditioned -ksp_monitor_true_residual \ 1401071b71afSMatthew G. Knepley -pc_type mg -pc_mg_levels 4 \ 1402071b71afSMatthew G. Knepley -mg_levels_ksp_type gmres -mg_levels_pc_type ilu -mg_levels_ksp_max_it 10 1403c4762a1bSJed Brown 140459191b1eSJames Wright # Test cgns writer for ranks with no elements 140559191b1eSJames Wright test: 140659191b1eSJames Wright suffix: cgns 140759191b1eSJames Wright nsize: 5 140859191b1eSJames Wright requires: cgns 140959191b1eSJames Wright 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 141059191b1eSJames Wright 1411c4762a1bSJed Brown # Full solve tensor 1412c4762a1bSJed Brown test: 1413c4762a1bSJed Brown suffix: tensor_plex_2d 141430602db0SMatthew G. Knepley args: -run_type test -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 1 -dm_refine_hierarchy 2 1415c4762a1bSJed Brown 1416c4762a1bSJed Brown test: 1417c4762a1bSJed Brown suffix: tensor_p4est_2d 1418c4762a1bSJed Brown requires: p4est 141930602db0SMatthew G. Knepley 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 1420c4762a1bSJed Brown 1421c4762a1bSJed Brown test: 1422c4762a1bSJed Brown suffix: tensor_plex_3d 142330602db0SMatthew G. Knepley 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 1424c4762a1bSJed Brown 1425c4762a1bSJed Brown test: 1426c4762a1bSJed Brown suffix: tensor_p4est_3d 1427c4762a1bSJed Brown requires: p4est 142830602db0SMatthew G. Knepley 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 1429c4762a1bSJed Brown 1430c4762a1bSJed Brown test: 1431c4762a1bSJed Brown suffix: p4est_test_q2_conformal_serial 1432c4762a1bSJed Brown requires: p4est 143330602db0SMatthew G. Knepley 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 1434c4762a1bSJed Brown 1435c4762a1bSJed Brown test: 1436c4762a1bSJed Brown suffix: p4est_test_q2_conformal_parallel 1437c4762a1bSJed Brown requires: p4est 1438c4762a1bSJed Brown nsize: 7 1439e600fa54SMatthew G. Knepley 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 1440c4762a1bSJed Brown 1441c4762a1bSJed Brown test: 1442c4762a1bSJed Brown suffix: p4est_test_q2_conformal_parallel_parmetis 1443c4762a1bSJed Brown requires: parmetis p4est 1444c4762a1bSJed Brown nsize: 4 1445e600fa54SMatthew G. Knepley 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 1446c4762a1bSJed Brown 1447c4762a1bSJed Brown test: 1448c4762a1bSJed Brown suffix: p4est_test_q2_nonconformal_serial 1449c4762a1bSJed Brown requires: p4est 1450c4762a1bSJed Brown filter: grep -v "CG or CGNE: variant" 145130602db0SMatthew G. Knepley 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 1452c4762a1bSJed Brown 1453c4762a1bSJed Brown test: 1454c4762a1bSJed Brown suffix: p4est_test_q2_nonconformal_parallel 1455c4762a1bSJed Brown requires: p4est 1456c4762a1bSJed Brown filter: grep -v "CG or CGNE: variant" 1457c4762a1bSJed Brown nsize: 7 1458e600fa54SMatthew G. Knepley 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 1459c4762a1bSJed Brown 1460c4762a1bSJed Brown test: 1461c4762a1bSJed Brown suffix: p4est_test_q2_nonconformal_parallel_parmetis 1462c4762a1bSJed Brown requires: parmetis p4est 1463c4762a1bSJed Brown nsize: 4 1464e600fa54SMatthew G. Knepley 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 1465c4762a1bSJed Brown 1466c4762a1bSJed Brown test: 1467c4762a1bSJed Brown suffix: p4est_exact_q2_conformal_serial 1468c4762a1bSJed Brown requires: p4est !single !complex !__float128 146930602db0SMatthew G. Knepley 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 1470c4762a1bSJed Brown 1471c4762a1bSJed Brown test: 1472c4762a1bSJed Brown suffix: p4est_exact_q2_conformal_parallel 1473c4762a1bSJed Brown requires: p4est !single !complex !__float128 1474c4762a1bSJed Brown nsize: 4 1475e600fa54SMatthew G. Knepley 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 1476c4762a1bSJed Brown 1477c4762a1bSJed Brown test: 1478c4762a1bSJed Brown suffix: p4est_exact_q2_conformal_parallel_parmetis 1479c4762a1bSJed Brown requires: parmetis p4est !single 1480c4762a1bSJed Brown nsize: 4 1481d76a863bSStefano Zampini 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 1482c4762a1bSJed Brown 1483c4762a1bSJed Brown test: 1484c4762a1bSJed Brown suffix: p4est_exact_q2_nonconformal_serial 1485c4762a1bSJed Brown requires: p4est 148630602db0SMatthew G. Knepley 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 1487c4762a1bSJed Brown 1488c4762a1bSJed Brown test: 1489c4762a1bSJed Brown suffix: p4est_exact_q2_nonconformal_parallel 1490c4762a1bSJed Brown requires: p4est 1491c4762a1bSJed Brown nsize: 7 1492e600fa54SMatthew G. Knepley 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 1493c4762a1bSJed Brown 1494c4762a1bSJed Brown test: 1495c4762a1bSJed Brown suffix: p4est_exact_q2_nonconformal_parallel_parmetis 1496c4762a1bSJed Brown requires: parmetis p4est 1497c4762a1bSJed Brown nsize: 4 1498e600fa54SMatthew G. Knepley 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 1499c4762a1bSJed Brown 1500c4762a1bSJed Brown test: 1501c4762a1bSJed Brown suffix: p4est_full_q2_nonconformal_serial 1502c4762a1bSJed Brown requires: p4est !single 1503c4762a1bSJed Brown filter: grep -v "variant HERMITIAN" 150430602db0SMatthew G. Knepley 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 1505c4762a1bSJed Brown 1506c4762a1bSJed Brown test: 1507c4762a1bSJed Brown suffix: p4est_full_q2_nonconformal_parallel 1508c4762a1bSJed Brown requires: p4est !single 1509c4762a1bSJed Brown filter: grep -v "variant HERMITIAN" 1510c4762a1bSJed Brown nsize: 7 1511e600fa54SMatthew G. Knepley 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 1512c4762a1bSJed Brown 1513c4762a1bSJed Brown test: 1514c4762a1bSJed Brown suffix: p4est_full_q2_nonconformal_parallel_bddcfas 1515c4762a1bSJed Brown requires: p4est !single 1516c4762a1bSJed Brown filter: grep -v "variant HERMITIAN" 1517c4762a1bSJed Brown nsize: 7 1518e600fa54SMatthew G. Knepley 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 1519c4762a1bSJed Brown 1520c4762a1bSJed Brown test: 1521c4762a1bSJed Brown suffix: p4est_full_q2_nonconformal_parallel_bddc 1522c4762a1bSJed Brown requires: p4est !single 1523c4762a1bSJed Brown filter: grep -v "variant HERMITIAN" 1524c4762a1bSJed Brown nsize: 7 1525e600fa54SMatthew G. Knepley 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 1526c4762a1bSJed Brown 1527c4762a1bSJed Brown test: 1528c4762a1bSJed Brown TODO: broken 1529c4762a1bSJed Brown suffix: p4est_fas_q2_conformal_serial 1530c4762a1bSJed Brown requires: p4est !complex !__float128 153130602db0SMatthew G. Knepley 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 1532c4762a1bSJed Brown 1533c4762a1bSJed Brown test: 1534c4762a1bSJed Brown TODO: broken 1535c4762a1bSJed Brown suffix: p4est_fas_q2_nonconformal_serial 1536c4762a1bSJed Brown requires: p4est 153730602db0SMatthew G. Knepley 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 1538c4762a1bSJed Brown 1539c4762a1bSJed Brown test: 1540c4762a1bSJed Brown suffix: fas_newton_0_p4est 1541c4762a1bSJed Brown requires: p4est !single !__float128 154230602db0SMatthew G. Knepley 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 1543c4762a1bSJed Brown 1544c4762a1bSJed Brown # Full solve simplicial AMR 1545c4762a1bSJed Brown test: 1546ab5a7ff4SJoe Wallwork suffix: tri_p1_adapt_init_pragmatic 1547c4762a1bSJed Brown requires: pragmatic 15488d1b37daSJoe Wallwork 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 1549c4762a1bSJed Brown 1550c4762a1bSJed Brown test: 15510383c1e7SJoe Wallwork suffix: tri_p2_adapt_init_pragmatic 15520383c1e7SJoe Wallwork requires: pragmatic 15530383c1e7SJoe Wallwork 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 15540383c1e7SJoe Wallwork 15550383c1e7SJoe Wallwork test: 1556ab5a7ff4SJoe Wallwork suffix: tri_p1_adapt_init_mmg 1557ab5a7ff4SJoe Wallwork requires: mmg 15588d1b37daSJoe Wallwork 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 1559c4762a1bSJed Brown 1560c4762a1bSJed Brown test: 15610383c1e7SJoe Wallwork suffix: tri_p2_adapt_init_mmg 15620383c1e7SJoe Wallwork requires: mmg 15630383c1e7SJoe Wallwork 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 15640383c1e7SJoe Wallwork 15650383c1e7SJoe Wallwork test: 1566ab5a7ff4SJoe Wallwork suffix: tri_p1_adapt_seq_pragmatic 1567c4762a1bSJed Brown requires: pragmatic 15688d1b37daSJoe Wallwork 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 1569ab5a7ff4SJoe Wallwork 1570ab5a7ff4SJoe Wallwork test: 15710383c1e7SJoe Wallwork suffix: tri_p2_adapt_seq_pragmatic 15720383c1e7SJoe Wallwork requires: pragmatic 15730383c1e7SJoe Wallwork 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 15740383c1e7SJoe Wallwork 15750383c1e7SJoe Wallwork test: 1576ab5a7ff4SJoe Wallwork suffix: tri_p1_adapt_seq_mmg 1577ab5a7ff4SJoe Wallwork requires: mmg 15788d1b37daSJoe Wallwork 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 1579ab5a7ff4SJoe Wallwork 1580ab5a7ff4SJoe Wallwork test: 15810383c1e7SJoe Wallwork suffix: tri_p2_adapt_seq_mmg 15820383c1e7SJoe Wallwork requires: mmg 15830383c1e7SJoe Wallwork 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 15840383c1e7SJoe Wallwork 15850383c1e7SJoe Wallwork test: 1586ab5a7ff4SJoe Wallwork suffix: tri_p1_adapt_analytic_pragmatic 1587ab5a7ff4SJoe Wallwork requires: pragmatic 15885d5a2774SMatthew G. Knepley 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 1589ab5a7ff4SJoe Wallwork 1590ab5a7ff4SJoe Wallwork test: 15910383c1e7SJoe Wallwork suffix: tri_p2_adapt_analytic_pragmatic 15920383c1e7SJoe Wallwork requires: pragmatic 15935d5a2774SMatthew G. Knepley 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 15940383c1e7SJoe Wallwork 15950383c1e7SJoe Wallwork test: 1596ab5a7ff4SJoe Wallwork suffix: tri_p1_adapt_analytic_mmg 1597ab5a7ff4SJoe Wallwork requires: mmg 15985d5a2774SMatthew G. Knepley 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 1599c4762a1bSJed Brown 1600b8d0c900SJoe Wallwork test: 16010383c1e7SJoe Wallwork suffix: tri_p2_adapt_analytic_mmg 16020383c1e7SJoe Wallwork requires: mmg 16035d5a2774SMatthew G. Knepley 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 16040383c1e7SJoe Wallwork 16050383c1e7SJoe Wallwork test: 1606b8d0c900SJoe Wallwork suffix: tri_p1_adapt_uniform_pragmatic 1607b8d0c900SJoe Wallwork requires: pragmatic tetgen 1608dc13bed2SJoe Wallwork nsize: 2 1609e600fa54SMatthew G. Knepley 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 1610b8d0c900SJoe Wallwork timeoutfactor: 2 1611b8d0c900SJoe Wallwork 1612b8d0c900SJoe Wallwork test: 16130383c1e7SJoe Wallwork suffix: tri_p2_adapt_uniform_pragmatic 16140383c1e7SJoe Wallwork requires: pragmatic tetgen 1615dc13bed2SJoe Wallwork nsize: 2 1616e600fa54SMatthew G. Knepley 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 16170383c1e7SJoe Wallwork timeoutfactor: 1 16180383c1e7SJoe Wallwork 16190383c1e7SJoe Wallwork test: 1620b8d0c900SJoe Wallwork suffix: tri_p1_adapt_uniform_mmg 1621b8d0c900SJoe Wallwork requires: mmg tetgen 16228d1b37daSJoe Wallwork 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 1623b8d0c900SJoe Wallwork timeoutfactor: 2 1624b8d0c900SJoe Wallwork 1625b8d0c900SJoe Wallwork test: 16260383c1e7SJoe Wallwork suffix: tri_p2_adapt_uniform_mmg 162761451c10SMatthew G. Knepley requires: mmg tetgen broken 16280383c1e7SJoe Wallwork 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 16290383c1e7SJoe Wallwork timeoutfactor: 1 16300383c1e7SJoe Wallwork 16310383c1e7SJoe Wallwork test: 1632b8d0c900SJoe Wallwork suffix: tri_p1_adapt_uniform_parmmg 1633b8d0c900SJoe Wallwork requires: parmmg tetgen 1634dc13bed2SJoe Wallwork nsize: 2 1635e600fa54SMatthew G. Knepley 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 1636b8d0c900SJoe Wallwork timeoutfactor: 2 1637b8d0c900SJoe Wallwork 16380383c1e7SJoe Wallwork test: 16390383c1e7SJoe Wallwork suffix: tri_p2_adapt_uniform_parmmg 16400383c1e7SJoe Wallwork requires: parmmg tetgen 1641dc13bed2SJoe Wallwork nsize: 2 1642e600fa54SMatthew G. Knepley 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 16430383c1e7SJoe Wallwork timeoutfactor: 1 16440383c1e7SJoe Wallwork 1645c4762a1bSJed Brown # Full solve tensor AMR 1646c4762a1bSJed Brown test: 1647c4762a1bSJed Brown suffix: quad_q1_adapt_0 1648c4762a1bSJed Brown requires: p4est 16498d1b37daSJoe Wallwork 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 1650c4762a1bSJed Brown filter: grep -v DM_ 1651c4762a1bSJed Brown 1652c4762a1bSJed Brown test: 1653c4762a1bSJed Brown suffix: amr_0 1654c4762a1bSJed Brown nsize: 5 1655e600fa54SMatthew G. Knepley args: -run_type test -petscpartitioner_type simple -dm_plex_simplex 0 -bc_type dirichlet -petscspace_degree 1 -dm_refine 1 1656c4762a1bSJed Brown 1657c4762a1bSJed Brown test: 1658c4762a1bSJed Brown suffix: amr_1 1659c4762a1bSJed Brown requires: p4est !complex 166030602db0SMatthew G. Knepley 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 1661c4762a1bSJed Brown 1662c4762a1bSJed Brown test: 1663c4762a1bSJed Brown suffix: p4est_solve_bddc 1664c4762a1bSJed Brown requires: p4est !complex 1665e600fa54SMatthew G. Knepley 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 1666c4762a1bSJed Brown nsize: 4 1667c4762a1bSJed Brown 1668c4762a1bSJed Brown test: 1669c4762a1bSJed Brown suffix: p4est_solve_fas 1670c4762a1bSJed Brown requires: p4est 1671e600fa54SMatthew G. Knepley 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 1672c4762a1bSJed Brown nsize: 4 1673c4762a1bSJed Brown TODO: identical machine two runs produce slightly different solver trackers 1674c4762a1bSJed Brown 1675c4762a1bSJed Brown test: 1676c4762a1bSJed Brown suffix: p4est_convergence_test_1 1677c4762a1bSJed Brown requires: p4est 1678e600fa54SMatthew G. Knepley 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 1679c4762a1bSJed Brown nsize: 4 1680c4762a1bSJed Brown 1681c4762a1bSJed Brown # Serial tests with GLVis visualization 1682c4762a1bSJed Brown test: 1683c4762a1bSJed Brown suffix: glvis_2d_tet_p1 168430602db0SMatthew G. Knepley 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 1685c4762a1bSJed Brown test: 1686c4762a1bSJed Brown suffix: glvis_2d_tet_p2 168730602db0SMatthew G. Knepley 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 1688c4762a1bSJed Brown test: 1689c4762a1bSJed Brown suffix: glvis_2d_hex_p1 169030602db0SMatthew G. Knepley 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 1691c4762a1bSJed Brown test: 1692c4762a1bSJed Brown suffix: glvis_2d_hex_p2 169330602db0SMatthew G. Knepley 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 1694c4762a1bSJed Brown test: 1695c4762a1bSJed Brown suffix: glvis_2d_hex_p2_p4est 1696c4762a1bSJed Brown requires: p4est 169730602db0SMatthew G. Knepley 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 1698c4762a1bSJed Brown test: 1699c4762a1bSJed Brown suffix: glvis_2d_tet_p0 170061451c10SMatthew G. Knepley 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 1701c4762a1bSJed Brown test: 1702c4762a1bSJed Brown suffix: glvis_2d_hex_p0 170361451c10SMatthew G. Knepley 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 1704c4762a1bSJed Brown 1705c4762a1bSJed Brown # PCHPDDM tests 1706c4762a1bSJed Brown testset: 1707c4762a1bSJed Brown nsize: 4 1708dfd57a17SPierre Jolivet requires: hpddm slepc !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES) 1709e600fa54SMatthew G. Knepley 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 1710c4762a1bSJed Brown test: 1711c4762a1bSJed Brown suffix: quad_singular_hpddm 171230602db0SMatthew G. Knepley args: -dm_plex_box_faces 6,7 1713c4762a1bSJed Brown test: 1714c4762a1bSJed Brown requires: p4est 1715c4762a1bSJed Brown suffix: p4est_singular_2d_hpddm 1716c4762a1bSJed Brown args: -dm_plex_convert_type p4est -dm_forest_minimum_refinement 1 -dm_forest_initial_refinement 3 -dm_forest_maximum_refinement 3 1717c4762a1bSJed Brown test: 1718c4762a1bSJed Brown requires: p4est 1719c4762a1bSJed Brown suffix: p4est_nc_singular_2d_hpddm 1720c4762a1bSJed Brown 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 1721c4762a1bSJed Brown testset: 1722c4762a1bSJed Brown nsize: 4 1723dfd57a17SPierre Jolivet requires: hpddm slepc triangle !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES) 1724e600fa54SMatthew G. Knepley 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 1725c4762a1bSJed Brown test: 1726c4762a1bSJed Brown args: -pc_hpddm_coarse_mat_type baij -options_left no 1727c4762a1bSJed Brown suffix: tri_hpddm_reuse_baij 1728c4762a1bSJed Brown test: 1729c4762a1bSJed Brown requires: !complex 1730c4762a1bSJed Brown suffix: tri_hpddm_reuse 1731c4762a1bSJed Brown testset: 1732c4762a1bSJed Brown nsize: 4 1733dfd57a17SPierre Jolivet requires: hpddm slepc !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES) 1734e600fa54SMatthew G. Knepley 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 1735c4762a1bSJed Brown test: 1736c4762a1bSJed Brown args: -pc_hpddm_coarse_mat_type baij -options_left no 1737c4762a1bSJed Brown suffix: quad_hpddm_reuse_baij 1738c4762a1bSJed Brown test: 1739c4762a1bSJed Brown requires: !complex 1740c4762a1bSJed Brown suffix: quad_hpddm_reuse 1741c4762a1bSJed Brown testset: 1742c4762a1bSJed Brown nsize: 4 1743dfd57a17SPierre Jolivet requires: hpddm slepc !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES) 1744e600fa54SMatthew G. Knepley 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 0.1 -pc_hpddm_coarse_p 2 -pc_hpddm_coarse_pc_type redundant -ksp_rtol 1.e-1 1745c4762a1bSJed Brown test: 1746c4762a1bSJed Brown args: -pc_hpddm_coarse_mat_type baij -options_left no 1747c4762a1bSJed Brown suffix: quad_hpddm_reuse_threshold_baij 1748c4762a1bSJed Brown test: 1749c4762a1bSJed Brown requires: !complex 1750c4762a1bSJed Brown suffix: quad_hpddm_reuse_threshold 1751c4762a1bSJed Brown testset: 1752c4762a1bSJed Brown nsize: 4 1753dfd57a17SPierre Jolivet requires: hpddm slepc parmetis !single defined(PETSC_HAVE_DYNAMIC_LIBRARIES) defined(PETSC_USE_SHARED_LIBRARIES) 1754117ef88eSStefano Zampini filter: sed -e "s/linear solver iterations=17/linear solver iterations=16/g" 1755308041e4SStefano Zampini 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 1756c4762a1bSJed Brown test: 1757c4762a1bSJed Brown args: -pc_hpddm_coarse_mat_type baij -options_left no 1758ea5adb04SJed Brown 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" 1759c4762a1bSJed Brown suffix: tri_parmetis_hpddm_baij 1760c4762a1bSJed Brown test: 1761ea5adb04SJed Brown 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" 1762c4762a1bSJed Brown requires: !complex 1763c4762a1bSJed Brown suffix: tri_parmetis_hpddm 1764d6837840SMatthew G. Knepley 1765d6837840SMatthew G. Knepley # 2D serial P1 tests for adaptive MG 1766d6837840SMatthew G. Knepley test: 1767d6837840SMatthew G. Knepley suffix: 2d_p1_adaptmg_0 17682b3cbbdaSStefano Zampini requires: triangle 1769908b9b43SStefano Zampini args: -petscpartitioner_type simple -dm_refine_hierarchy 3 -dm_plex_box_faces 4,4 -bc_type dirichlet -petscspace_degree 1 \ 1770d6837840SMatthew G. Knepley -variable_coefficient checkerboard_0 -mat_petscspace_degree 0 -div 16 -k 3 \ 1771d6837840SMatthew G. Knepley -snes_max_it 1 -ksp_converged_reason \ 1772d6837840SMatthew G. Knepley -ksp_rtol 1e-8 -pc_type mg 1773d6837840SMatthew G. Knepley test: 1774d6837840SMatthew G. Knepley suffix: 2d_p1_adaptmg_1 1775908b9b43SStefano Zampini requires: triangle bamg todo 1776908b9b43SStefano Zampini args: -petscpartitioner_type simple -dm_refine_hierarchy 3 -dm_plex_box_faces 4,4 -bc_type dirichlet -petscspace_degree 1 \ 1777d6837840SMatthew G. Knepley -variable_coefficient checkerboard_0 -mat_petscspace_degree 0 -div 16 -k 3 \ 1778d6837840SMatthew G. Knepley -snes_max_it 1 -ksp_converged_reason \ 17792b3cbbdaSStefano Zampini -ksp_rtol 1e-8 -pc_type mg -pc_mg_galerkin -pc_mg_adapt_interp_coarse_space eigenvector -pc_mg_adapt_interp_n 1 \ 1780d6837840SMatthew G. Knepley -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 1781908b9b43SStefano Zampini test: 1782908b9b43SStefano Zampini suffix: 2d_p1_adaptmg_gdsw 1783908b9b43SStefano Zampini requires: triangle 1784908b9b43SStefano Zampini nsize: 4 1785908b9b43SStefano Zampini args: -petscpartitioner_type simple -dm_refine 3 -dm_plex_box_faces 4,4 -bc_type dirichlet -petscspace_degree 1 \ 1786908b9b43SStefano Zampini -variable_coefficient checkerboard_0 -mat_petscspace_degree 0 -div 16 -k 3 \ 1787908b9b43SStefano Zampini -snes_max_it 1 -ksp_converged_reason \ 1788908b9b43SStefano Zampini -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}} 1789908b9b43SStefano Zampini 1790908b9b43SStefano Zampini test: 1791908b9b43SStefano Zampini suffix: 2d_p1_adaptmg_agdsw 1792908b9b43SStefano Zampini requires: triangle mumps 1793908b9b43SStefano Zampini nsize: 4 1794908b9b43SStefano Zampini args: -petscpartitioner_type simple -dm_refine 3 -dm_plex_box_faces 4,4 -bc_type dirichlet -petscspace_degree 1 \ 1795908b9b43SStefano Zampini -variable_coefficient checkerboard_0 -mat_petscspace_degree 0 -div 16 -k 3 \ 1796908b9b43SStefano Zampini -snes_max_it 1 -ksp_converged_reason \ 1797908b9b43SStefano Zampini -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 1798d6837840SMatthew G. Knepley 179968d39a79SStefano Zampini test: 180068d39a79SStefano Zampini suffix: p4est_2d_asm 180168d39a79SStefano Zampini requires: p4est 180268d39a79SStefano Zampini nsize: 4 180368d39a79SStefano Zampini args: -run_type test -run_test_check_ksp -quiet -petscspace_degree 1 -petscpartitioner_type simple -bc_type none -dm_plex_simplex 0 \ 180468d39a79SStefano Zampini -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 \ 180568d39a79SStefano Zampini -pc_asm_dm_subdomains -dm_p4est_refine_pattern hash -dm_plex_dd_overlap 1 -sub_pc_type lu 180668d39a79SStefano Zampini 1807c4762a1bSJed Brown TEST*/ 1808