147d993e7Ssuyashtn /* Portions of this code are under: 247d993e7Ssuyashtn Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. 347d993e7Ssuyashtn */ 4c4762a1bSJed Brown static char help[] = "Nonlinear driven cavity with multigrid in 2d.\n \ 5c4762a1bSJed Brown \n\ 6c4762a1bSJed Brown The 2D driven cavity problem is solved in a velocity-vorticity formulation.\n\ 7da81f932SPierre Jolivet The flow can be driven with the lid or with buoyancy or both:\n\ 8c4762a1bSJed Brown -lidvelocity <lid>, where <lid> = dimensionless velocity of lid\n\ 9c4762a1bSJed Brown -grashof <gr>, where <gr> = dimensionless temperature gradent\n\ 10c4762a1bSJed Brown -prandtl <pr>, where <pr> = dimensionless thermal/momentum diffusity ratio\n\ 11c4762a1bSJed Brown -contours : draw contour plots of solution\n\n"; 12c4762a1bSJed Brown /* in HTML, '<' = '<' and '>' = '>' */ 13c4762a1bSJed Brown 14c4762a1bSJed Brown /* 15c4762a1bSJed Brown See src/ksp/ksp/tutorials/ex45.c 16c4762a1bSJed Brown */ 17c4762a1bSJed Brown 18c4762a1bSJed Brown /*F----------------------------------------------------------------------- 19c4762a1bSJed Brown 20c4762a1bSJed Brown We thank David E. Keyes for contributing the driven cavity discretization within this example code. 21c4762a1bSJed Brown 22c4762a1bSJed Brown This problem is modeled by the partial differential equation system 23c4762a1bSJed Brown 24c4762a1bSJed Brown \begin{eqnarray} 25c4762a1bSJed Brown - \triangle U - \nabla_y \Omega & = & 0 \\ 26c4762a1bSJed Brown - \triangle V + \nabla_x\Omega & = & 0 \\ 27c4762a1bSJed Brown - \triangle \Omega + \nabla \cdot ([U*\Omega,V*\Omega]) - GR* \nabla_x T & = & 0 \\ 28c4762a1bSJed Brown - \triangle T + PR* \nabla \cdot ([U*T,V*T]) & = & 0 29c4762a1bSJed Brown \end{eqnarray} 30c4762a1bSJed Brown 31c4762a1bSJed Brown in the unit square, which is uniformly discretized in each of x and y in this simple encoding. 32c4762a1bSJed Brown 33c4762a1bSJed Brown No-slip, rigid-wall Dirichlet conditions are used for $ [U,V]$. 34c4762a1bSJed Brown Dirichlet conditions are used for Omega, based on the definition of 35c4762a1bSJed Brown vorticity: $ \Omega = - \nabla_y U + \nabla_x V$, where along each 36c4762a1bSJed Brown constant coordinate boundary, the tangential derivative is zero. 37c4762a1bSJed Brown Dirichlet conditions are used for T on the left and right walls, 38c4762a1bSJed Brown and insulation homogeneous Neumann conditions are used for T on 39c4762a1bSJed Brown the top and bottom walls. 40c4762a1bSJed Brown 41c4762a1bSJed Brown A finite difference approximation with the usual 5-point stencil 42c4762a1bSJed Brown is used to discretize the boundary value problem to obtain a 43c4762a1bSJed Brown nonlinear system of equations. Upwinding is used for the divergence 44c4762a1bSJed Brown (convective) terms and central for the gradient (source) terms. 45c4762a1bSJed Brown 46c4762a1bSJed Brown The Jacobian can be either 47c4762a1bSJed Brown * formed via finite differencing using coloring (the default), or 48c4762a1bSJed Brown * applied matrix-free via the option -snes_mf 49c4762a1bSJed Brown (for larger grid problems this variant may not converge 50c4762a1bSJed Brown without a preconditioner due to ill-conditioning). 51c4762a1bSJed Brown 52c4762a1bSJed Brown ------------------------------------------------------------------------F*/ 53c4762a1bSJed Brown 54c4762a1bSJed Brown /* 55c4762a1bSJed Brown Include "petscdmda.h" so that we can use distributed arrays (DMDAs). 56c4762a1bSJed Brown Include "petscsnes.h" so that we can use SNES solvers. Note that this 57c4762a1bSJed Brown file automatically includes: 58c4762a1bSJed Brown petscsys.h - base PETSc routines petscvec.h - vectors 59c4762a1bSJed Brown petscmat.h - matrices 60c4762a1bSJed Brown petscis.h - index sets petscksp.h - Krylov subspace methods 61c4762a1bSJed Brown petscviewer.h - viewers petscpc.h - preconditioners 62c4762a1bSJed Brown petscksp.h - linear solvers 63c4762a1bSJed Brown */ 64c4762a1bSJed Brown #if defined(PETSC_APPLE_FRAMEWORK) 65c4762a1bSJed Brown #import <PETSc/petscsnes.h> 66c4762a1bSJed Brown #import <PETSc/petscdmda.h> 67c4762a1bSJed Brown #else 68c4762a1bSJed Brown #include <petscsnes.h> 69c4762a1bSJed Brown #include <petscdm.h> 70c4762a1bSJed Brown #include <petscdmda.h> 71c4762a1bSJed Brown #endif 72c4762a1bSJed Brown 73c4762a1bSJed Brown /* 74c4762a1bSJed Brown User-defined routines and data structures 75c4762a1bSJed Brown */ 76c4762a1bSJed Brown typedef struct { 77c4762a1bSJed Brown PetscScalar u, v, omega, temp; 78c4762a1bSJed Brown } Field; 79c4762a1bSJed Brown 80c4762a1bSJed Brown PetscErrorCode FormFunctionLocal(DMDALocalInfo *, Field **, Field **, void *); 81c4762a1bSJed Brown 82c4762a1bSJed Brown typedef struct { 83c4762a1bSJed Brown PetscReal lidvelocity, prandtl, grashof; /* physical parameters */ 84c4762a1bSJed Brown PetscBool draw_contours; /* flag - 1 indicates drawing contours */ 85c4762a1bSJed Brown } AppCtx; 86c4762a1bSJed Brown 87c4762a1bSJed Brown extern PetscErrorCode FormInitialGuess(AppCtx *, DM, Vec); 88c4762a1bSJed Brown extern PetscErrorCode NonlinearGS(SNES, Vec, Vec, void *); 89c4762a1bSJed Brown 90d71ae5a4SJacob Faibussowitsch int main(int argc, char **argv) 91d71ae5a4SJacob Faibussowitsch { 92c4762a1bSJed Brown AppCtx user; /* user-defined work context */ 93c4762a1bSJed Brown PetscInt mx, my, its; 94c4762a1bSJed Brown MPI_Comm comm; 95c4762a1bSJed Brown SNES snes; 96c4762a1bSJed Brown DM da; 97c4762a1bSJed Brown Vec x; 98c4762a1bSJed Brown 99327415f7SBarry Smith PetscFunctionBeginUser; 100c8025a54SPierre Jolivet PetscCall(PetscInitialize(&argc, &argv, NULL, help)); 101c4762a1bSJed Brown comm = PETSC_COMM_WORLD; 1029566063dSJacob Faibussowitsch PetscCall(SNESCreate(comm, &snes)); 103c4762a1bSJed Brown 104c4762a1bSJed Brown /* 105c4762a1bSJed Brown Create distributed array object to manage parallel grid and vectors 106c4762a1bSJed Brown for principal unknowns (x) and governing residuals (f) 107c4762a1bSJed Brown */ 1089566063dSJacob Faibussowitsch PetscCall(DMDACreate2d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, 4, 4, PETSC_DECIDE, PETSC_DECIDE, 4, 1, 0, 0, &da)); 1099566063dSJacob Faibussowitsch PetscCall(DMSetFromOptions(da)); 1109566063dSJacob Faibussowitsch PetscCall(DMSetUp(da)); 1119566063dSJacob Faibussowitsch PetscCall(SNESSetDM(snes, (DM)da)); 1129566063dSJacob Faibussowitsch PetscCall(SNESSetNGS(snes, NonlinearGS, (void *)&user)); 113c4762a1bSJed Brown 1149566063dSJacob Faibussowitsch PetscCall(DMDAGetInfo(da, 0, &mx, &my, PETSC_IGNORE, PETSC_IGNORE, PETSC_IGNORE, PETSC_IGNORE, PETSC_IGNORE, PETSC_IGNORE, PETSC_IGNORE, PETSC_IGNORE, PETSC_IGNORE, PETSC_IGNORE)); 115c4762a1bSJed Brown /* 116c4762a1bSJed Brown Problem parameters (velocity of lid, prandtl, and grashof numbers) 117c4762a1bSJed Brown */ 118c4762a1bSJed Brown user.lidvelocity = 1.0 / (mx * my); 119c4762a1bSJed Brown user.prandtl = 1.0; 120c4762a1bSJed Brown user.grashof = 1.0; 121c4762a1bSJed Brown 1229566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetReal(NULL, NULL, "-lidvelocity", &user.lidvelocity, NULL)); 1239566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetReal(NULL, NULL, "-prandtl", &user.prandtl, NULL)); 1249566063dSJacob Faibussowitsch PetscCall(PetscOptionsGetReal(NULL, NULL, "-grashof", &user.grashof, NULL)); 1259566063dSJacob Faibussowitsch PetscCall(PetscOptionsHasName(NULL, NULL, "-contours", &user.draw_contours)); 126c4762a1bSJed Brown 1279566063dSJacob Faibussowitsch PetscCall(DMDASetFieldName(da, 0, "x_velocity")); 1289566063dSJacob Faibussowitsch PetscCall(DMDASetFieldName(da, 1, "y_velocity")); 1299566063dSJacob Faibussowitsch PetscCall(DMDASetFieldName(da, 2, "Omega")); 1309566063dSJacob Faibussowitsch PetscCall(DMDASetFieldName(da, 3, "temperature")); 131c4762a1bSJed Brown 132c4762a1bSJed Brown /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 133c4762a1bSJed Brown Create user context, set problem data, create vector data structures. 134c4762a1bSJed Brown Also, compute the initial guess. 135c4762a1bSJed Brown - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 136c4762a1bSJed Brown 137c4762a1bSJed Brown /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 138c4762a1bSJed Brown Create nonlinear solver context 139c4762a1bSJed Brown 140c4762a1bSJed Brown - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 1419566063dSJacob Faibussowitsch PetscCall(DMSetApplicationContext(da, &user)); 1429566063dSJacob Faibussowitsch PetscCall(DMDASNESSetFunctionLocal(da, INSERT_VALUES, (PetscErrorCode (*)(DMDALocalInfo *, void *, void *, void *))FormFunctionLocal, &user)); 1439566063dSJacob Faibussowitsch PetscCall(SNESSetFromOptions(snes)); 1449566063dSJacob Faibussowitsch PetscCall(PetscPrintf(comm, "lid velocity = %g, prandtl # = %g, grashof # = %g\n", (double)user.lidvelocity, (double)user.prandtl, (double)user.grashof)); 145c4762a1bSJed Brown 146c4762a1bSJed Brown /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 147c4762a1bSJed Brown Solve the nonlinear system 148660278c0SBarry Smith - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 1499566063dSJacob Faibussowitsch PetscCall(DMCreateGlobalVector(da, &x)); 1509566063dSJacob Faibussowitsch PetscCall(FormInitialGuess(&user, da, x)); 151c4762a1bSJed Brown 1529566063dSJacob Faibussowitsch PetscCall(SNESSolve(snes, NULL, x)); 153c4762a1bSJed Brown 1549566063dSJacob Faibussowitsch PetscCall(SNESGetIterationNumber(snes, &its)); 15563a3b9bcSJacob Faibussowitsch PetscCall(PetscPrintf(comm, "Number of SNES iterations = %" PetscInt_FMT "\n", its)); 156c4762a1bSJed Brown 157c4762a1bSJed Brown /* 158c4762a1bSJed Brown Visualize solution 159c4762a1bSJed Brown */ 1601baa6e33SBarry Smith if (user.draw_contours) PetscCall(VecView(x, PETSC_VIEWER_DRAW_WORLD)); 161c4762a1bSJed Brown 162c4762a1bSJed Brown /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 163c4762a1bSJed Brown Free work space. All PETSc objects should be destroyed when they 164c4762a1bSJed Brown are no longer needed. 165c4762a1bSJed Brown - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 1669566063dSJacob Faibussowitsch PetscCall(VecDestroy(&x)); 1679566063dSJacob Faibussowitsch PetscCall(DMDestroy(&da)); 1689566063dSJacob Faibussowitsch PetscCall(SNESDestroy(&snes)); 1699566063dSJacob Faibussowitsch PetscCall(PetscFinalize()); 170b122ec5aSJacob Faibussowitsch return 0; 171c4762a1bSJed Brown } 172c4762a1bSJed Brown 173c4762a1bSJed Brown /* ------------------------------------------------------------------- */ 174c4762a1bSJed Brown 175c4762a1bSJed Brown /* 176c4762a1bSJed Brown FormInitialGuess - Forms initial approximation. 177c4762a1bSJed Brown 178c4762a1bSJed Brown Input Parameters: 179c4762a1bSJed Brown user - user-defined application context 180c4762a1bSJed Brown X - vector 181c4762a1bSJed Brown 182c4762a1bSJed Brown Output Parameter: 183c4762a1bSJed Brown X - vector 184c4762a1bSJed Brown */ 185d71ae5a4SJacob Faibussowitsch PetscErrorCode FormInitialGuess(AppCtx *user, DM da, Vec X) 186d71ae5a4SJacob Faibussowitsch { 187c4762a1bSJed Brown PetscInt i, j, mx, xs, ys, xm, ym; 188c4762a1bSJed Brown PetscReal grashof, dx; 189c4762a1bSJed Brown Field **x; 190c4762a1bSJed Brown 191c4762a1bSJed Brown PetscFunctionBeginUser; 192c4762a1bSJed Brown grashof = user->grashof; 193c4762a1bSJed Brown 1949566063dSJacob Faibussowitsch PetscCall(DMDAGetInfo(da, 0, &mx, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); 195c4762a1bSJed Brown dx = 1.0 / (mx - 1); 196c4762a1bSJed Brown 197c4762a1bSJed Brown /* 198c4762a1bSJed Brown Get local grid boundaries (for 2-dimensional DMDA): 199c4762a1bSJed Brown xs, ys - starting grid indices (no ghost points) 200c4762a1bSJed Brown xm, ym - widths of local grid (no ghost points) 201c4762a1bSJed Brown */ 2029566063dSJacob Faibussowitsch PetscCall(DMDAGetCorners(da, &xs, &ys, NULL, &xm, &ym, NULL)); 203c4762a1bSJed Brown 204c4762a1bSJed Brown /* 205c4762a1bSJed Brown Get a pointer to vector data. 206c4762a1bSJed Brown - For default PETSc vectors, VecGetArray() returns a pointer to 207c4762a1bSJed Brown the data array. Otherwise, the routine is implementation dependent. 208c4762a1bSJed Brown - You MUST call VecRestoreArray() when you no longer need access to 209c4762a1bSJed Brown the array. 210c4762a1bSJed Brown */ 2119566063dSJacob Faibussowitsch PetscCall(DMDAVecGetArrayWrite(da, X, &x)); 212c4762a1bSJed Brown 213c4762a1bSJed Brown /* 214c4762a1bSJed Brown Compute initial guess over the locally owned part of the grid 215c4762a1bSJed Brown Initial condition is motionless fluid and equilibrium temperature 216c4762a1bSJed Brown */ 217c4762a1bSJed Brown for (j = ys; j < ys + ym; j++) { 218c4762a1bSJed Brown for (i = xs; i < xs + xm; i++) { 219c4762a1bSJed Brown x[j][i].u = 0.0; 220c4762a1bSJed Brown x[j][i].v = 0.0; 221c4762a1bSJed Brown x[j][i].omega = 0.0; 222c4762a1bSJed Brown x[j][i].temp = (grashof > 0) * i * dx; 223c4762a1bSJed Brown } 224c4762a1bSJed Brown } 225c4762a1bSJed Brown 226c4762a1bSJed Brown /* 227c4762a1bSJed Brown Restore vector 228c4762a1bSJed Brown */ 2299566063dSJacob Faibussowitsch PetscCall(DMDAVecRestoreArrayWrite(da, X, &x)); 2303ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 231c4762a1bSJed Brown } 232c4762a1bSJed Brown 233d71ae5a4SJacob Faibussowitsch PetscErrorCode FormFunctionLocal(DMDALocalInfo *info, Field **x, Field **f, void *ptr) 234d71ae5a4SJacob Faibussowitsch { 235c4762a1bSJed Brown AppCtx *user = (AppCtx *)ptr; 236c4762a1bSJed Brown PetscInt xints, xinte, yints, yinte, i, j; 237c4762a1bSJed Brown PetscReal hx, hy, dhx, dhy, hxdhy, hydhx; 238c4762a1bSJed Brown PetscReal grashof, prandtl, lid; 239c4762a1bSJed Brown PetscScalar u, uxx, uyy, vx, vy, avx, avy, vxp, vxm, vyp, vym; 240c4762a1bSJed Brown 241c4762a1bSJed Brown PetscFunctionBeginUser; 242c4762a1bSJed Brown grashof = user->grashof; 243c4762a1bSJed Brown prandtl = user->prandtl; 244c4762a1bSJed Brown lid = user->lidvelocity; 245c4762a1bSJed Brown 246c4762a1bSJed Brown /* 247c4762a1bSJed Brown Define mesh intervals ratios for uniform grid. 248c4762a1bSJed Brown 249c4762a1bSJed Brown Note: FD formulae below are normalized by multiplying through by 250c4762a1bSJed Brown local volume element (i.e. hx*hy) to obtain coefficients O(1) in two dimensions. 251c4762a1bSJed Brown 252c4762a1bSJed Brown */ 2539371c9d4SSatish Balay dhx = (PetscReal)(info->mx - 1); 2549371c9d4SSatish Balay dhy = (PetscReal)(info->my - 1); 2559371c9d4SSatish Balay hx = 1.0 / dhx; 2569371c9d4SSatish Balay hy = 1.0 / dhy; 2579371c9d4SSatish Balay hxdhy = hx * dhy; 2589371c9d4SSatish Balay hydhx = hy * dhx; 259c4762a1bSJed Brown 2609371c9d4SSatish Balay xints = info->xs; 2619371c9d4SSatish Balay xinte = info->xs + info->xm; 2629371c9d4SSatish Balay yints = info->ys; 2639371c9d4SSatish Balay yinte = info->ys + info->ym; 264c4762a1bSJed Brown 265c4762a1bSJed Brown /* Test whether we are on the bottom edge of the global array */ 266c4762a1bSJed Brown if (yints == 0) { 267c4762a1bSJed Brown j = 0; 268c4762a1bSJed Brown yints = yints + 1; 269c4762a1bSJed Brown /* bottom edge */ 270c4762a1bSJed Brown for (i = info->xs; i < info->xs + info->xm; i++) { 271c4762a1bSJed Brown f[j][i].u = x[j][i].u; 272c4762a1bSJed Brown f[j][i].v = x[j][i].v; 273c4762a1bSJed Brown f[j][i].omega = x[j][i].omega + (x[j + 1][i].u - x[j][i].u) * dhy; 274c4762a1bSJed Brown f[j][i].temp = x[j][i].temp - x[j + 1][i].temp; 275c4762a1bSJed Brown } 276c4762a1bSJed Brown } 277c4762a1bSJed Brown 278c4762a1bSJed Brown /* Test whether we are on the top edge of the global array */ 279c4762a1bSJed Brown if (yinte == info->my) { 280c4762a1bSJed Brown j = info->my - 1; 281c4762a1bSJed Brown yinte = yinte - 1; 282c4762a1bSJed Brown /* top edge */ 283c4762a1bSJed Brown for (i = info->xs; i < info->xs + info->xm; i++) { 284c4762a1bSJed Brown f[j][i].u = x[j][i].u - lid; 285c4762a1bSJed Brown f[j][i].v = x[j][i].v; 286c4762a1bSJed Brown f[j][i].omega = x[j][i].omega + (x[j][i].u - x[j - 1][i].u) * dhy; 287c4762a1bSJed Brown f[j][i].temp = x[j][i].temp - x[j - 1][i].temp; 288c4762a1bSJed Brown } 289c4762a1bSJed Brown } 290c4762a1bSJed Brown 291c4762a1bSJed Brown /* Test whether we are on the left edge of the global array */ 292c4762a1bSJed Brown if (xints == 0) { 293c4762a1bSJed Brown i = 0; 294c4762a1bSJed Brown xints = xints + 1; 295c4762a1bSJed Brown /* left edge */ 296c4762a1bSJed Brown for (j = info->ys; j < info->ys + info->ym; j++) { 297c4762a1bSJed Brown f[j][i].u = x[j][i].u; 298c4762a1bSJed Brown f[j][i].v = x[j][i].v; 299c4762a1bSJed Brown f[j][i].omega = x[j][i].omega - (x[j][i + 1].v - x[j][i].v) * dhx; 300c4762a1bSJed Brown f[j][i].temp = x[j][i].temp; 301c4762a1bSJed Brown } 302c4762a1bSJed Brown } 303c4762a1bSJed Brown 304c4762a1bSJed Brown /* Test whether we are on the right edge of the global array */ 305c4762a1bSJed Brown if (xinte == info->mx) { 306c4762a1bSJed Brown i = info->mx - 1; 307c4762a1bSJed Brown xinte = xinte - 1; 308c4762a1bSJed Brown /* right edge */ 309c4762a1bSJed Brown for (j = info->ys; j < info->ys + info->ym; j++) { 310c4762a1bSJed Brown f[j][i].u = x[j][i].u; 311c4762a1bSJed Brown f[j][i].v = x[j][i].v; 312c4762a1bSJed Brown f[j][i].omega = x[j][i].omega - (x[j][i].v - x[j][i - 1].v) * dhx; 313c4762a1bSJed Brown f[j][i].temp = x[j][i].temp - (PetscReal)(grashof > 0); 314c4762a1bSJed Brown } 315c4762a1bSJed Brown } 316c4762a1bSJed Brown 317c4762a1bSJed Brown /* Compute over the interior points */ 318c4762a1bSJed Brown for (j = yints; j < yinte; j++) { 319c4762a1bSJed Brown for (i = xints; i < xinte; i++) { 320c4762a1bSJed Brown /* 321c4762a1bSJed Brown convective coefficients for upwinding 322c4762a1bSJed Brown */ 3239371c9d4SSatish Balay vx = x[j][i].u; 3249371c9d4SSatish Balay avx = PetscAbsScalar(vx); 3259371c9d4SSatish Balay vxp = .5 * (vx + avx); 3269371c9d4SSatish Balay vxm = .5 * (vx - avx); 3279371c9d4SSatish Balay vy = x[j][i].v; 3289371c9d4SSatish Balay avy = PetscAbsScalar(vy); 3299371c9d4SSatish Balay vyp = .5 * (vy + avy); 3309371c9d4SSatish Balay vym = .5 * (vy - avy); 331c4762a1bSJed Brown 332c4762a1bSJed Brown /* U velocity */ 333c4762a1bSJed Brown u = x[j][i].u; 334c4762a1bSJed Brown uxx = (2.0 * u - x[j][i - 1].u - x[j][i + 1].u) * hydhx; 335c4762a1bSJed Brown uyy = (2.0 * u - x[j - 1][i].u - x[j + 1][i].u) * hxdhy; 336c4762a1bSJed Brown f[j][i].u = uxx + uyy - .5 * (x[j + 1][i].omega - x[j - 1][i].omega) * hx; 337c4762a1bSJed Brown 338c4762a1bSJed Brown /* V velocity */ 339c4762a1bSJed Brown u = x[j][i].v; 340c4762a1bSJed Brown uxx = (2.0 * u - x[j][i - 1].v - x[j][i + 1].v) * hydhx; 341c4762a1bSJed Brown uyy = (2.0 * u - x[j - 1][i].v - x[j + 1][i].v) * hxdhy; 342c4762a1bSJed Brown f[j][i].v = uxx + uyy + .5 * (x[j][i + 1].omega - x[j][i - 1].omega) * hy; 343c4762a1bSJed Brown 344c4762a1bSJed Brown /* Omega */ 345c4762a1bSJed Brown u = x[j][i].omega; 346c4762a1bSJed Brown uxx = (2.0 * u - x[j][i - 1].omega - x[j][i + 1].omega) * hydhx; 347c4762a1bSJed Brown uyy = (2.0 * u - x[j - 1][i].omega - x[j + 1][i].omega) * hxdhy; 3489371c9d4SSatish Balay f[j][i].omega = uxx + uyy + (vxp * (u - x[j][i - 1].omega) + vxm * (x[j][i + 1].omega - u)) * hy + (vyp * (u - x[j - 1][i].omega) + vym * (x[j + 1][i].omega - u)) * hx - .5 * grashof * (x[j][i + 1].temp - x[j][i - 1].temp) * hy; 349c4762a1bSJed Brown 350c4762a1bSJed Brown /* Temperature */ 351c4762a1bSJed Brown u = x[j][i].temp; 352c4762a1bSJed Brown uxx = (2.0 * u - x[j][i - 1].temp - x[j][i + 1].temp) * hydhx; 353c4762a1bSJed Brown uyy = (2.0 * u - x[j - 1][i].temp - x[j + 1][i].temp) * hxdhy; 3549371c9d4SSatish Balay f[j][i].temp = uxx + uyy + prandtl * ((vxp * (u - x[j][i - 1].temp) + vxm * (x[j][i + 1].temp - u)) * hy + (vyp * (u - x[j - 1][i].temp) + vym * (x[j + 1][i].temp - u)) * hx); 355c4762a1bSJed Brown } 356c4762a1bSJed Brown } 357c4762a1bSJed Brown 358c4762a1bSJed Brown /* 359c4762a1bSJed Brown Flop count (multiply-adds are counted as 2 operations) 360c4762a1bSJed Brown */ 3619566063dSJacob Faibussowitsch PetscCall(PetscLogFlops(84.0 * info->ym * info->xm)); 3623ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 363c4762a1bSJed Brown } 364c4762a1bSJed Brown 365c4762a1bSJed Brown /* 366c4762a1bSJed Brown Performs sweeps of point block nonlinear Gauss-Seidel on all the local grid points 367c4762a1bSJed Brown */ 368d71ae5a4SJacob Faibussowitsch PetscErrorCode NonlinearGS(SNES snes, Vec X, Vec B, void *ctx) 369d71ae5a4SJacob Faibussowitsch { 370c4762a1bSJed Brown DMDALocalInfo info; 371c4762a1bSJed Brown Field **x, **b; 372c4762a1bSJed Brown Vec localX, localB; 373c4762a1bSJed Brown DM da; 374c4762a1bSJed Brown PetscInt xints, xinte, yints, yinte, i, j, k, l; 375c4762a1bSJed Brown PetscInt max_its, tot_its; 376c4762a1bSJed Brown PetscInt sweeps; 377c4762a1bSJed Brown PetscReal rtol, atol, stol; 378c4762a1bSJed Brown PetscReal hx, hy, dhx, dhy, hxdhy, hydhx; 379c4762a1bSJed Brown PetscReal grashof, prandtl, lid; 380c4762a1bSJed Brown PetscScalar u, uxx, uyy, vx, vy, avx, avy, vxp, vxm, vyp, vym; 381c4762a1bSJed Brown PetscScalar fu, fv, fomega, ftemp; 382c4762a1bSJed Brown PetscScalar dfudu; 383c4762a1bSJed Brown PetscScalar dfvdv; 384c4762a1bSJed Brown PetscScalar dfodu, dfodv, dfodo; 385c4762a1bSJed Brown PetscScalar dftdu, dftdv, dftdt; 386c4762a1bSJed Brown PetscScalar yu = 0, yv = 0, yo = 0, yt = 0; 387c4762a1bSJed Brown PetscScalar bjiu, bjiv, bjiomega, bjitemp; 388c4762a1bSJed Brown PetscBool ptconverged; 389c4762a1bSJed Brown PetscReal pfnorm, pfnorm0, pynorm, pxnorm; 390c4762a1bSJed Brown AppCtx *user = (AppCtx *)ctx; 391c4762a1bSJed Brown 392c4762a1bSJed Brown PetscFunctionBeginUser; 393c4762a1bSJed Brown grashof = user->grashof; 394c4762a1bSJed Brown prandtl = user->prandtl; 395c4762a1bSJed Brown lid = user->lidvelocity; 396c4762a1bSJed Brown tot_its = 0; 3979566063dSJacob Faibussowitsch PetscCall(SNESNGSGetTolerances(snes, &rtol, &atol, &stol, &max_its)); 3989566063dSJacob Faibussowitsch PetscCall(SNESNGSGetSweeps(snes, &sweeps)); 3999566063dSJacob Faibussowitsch PetscCall(SNESGetDM(snes, (DM *)&da)); 4009566063dSJacob Faibussowitsch PetscCall(DMGetLocalVector(da, &localX)); 40148a46eb9SPierre Jolivet if (B) PetscCall(DMGetLocalVector(da, &localB)); 402c4762a1bSJed Brown /* 403c4762a1bSJed Brown Scatter ghost points to local vector, using the 2-step process 404c4762a1bSJed Brown DMGlobalToLocalBegin(), DMGlobalToLocalEnd(). 405c4762a1bSJed Brown */ 4069566063dSJacob Faibussowitsch PetscCall(DMGlobalToLocalBegin(da, X, INSERT_VALUES, localX)); 4079566063dSJacob Faibussowitsch PetscCall(DMGlobalToLocalEnd(da, X, INSERT_VALUES, localX)); 408c4762a1bSJed Brown if (B) { 4099566063dSJacob Faibussowitsch PetscCall(DMGlobalToLocalBegin(da, B, INSERT_VALUES, localB)); 4109566063dSJacob Faibussowitsch PetscCall(DMGlobalToLocalEnd(da, B, INSERT_VALUES, localB)); 411c4762a1bSJed Brown } 4129566063dSJacob Faibussowitsch PetscCall(DMDAGetLocalInfo(da, &info)); 4139566063dSJacob Faibussowitsch PetscCall(DMDAVecGetArrayWrite(da, localX, &x)); 41448a46eb9SPierre Jolivet if (B) PetscCall(DMDAVecGetArrayRead(da, localB, &b)); 415c4762a1bSJed Brown /* looks like a combination of the formfunction / formjacobian routines */ 4169371c9d4SSatish Balay dhx = (PetscReal)(info.mx - 1); 4179371c9d4SSatish Balay dhy = (PetscReal)(info.my - 1); 4189371c9d4SSatish Balay hx = 1.0 / dhx; 4199371c9d4SSatish Balay hy = 1.0 / dhy; 4209371c9d4SSatish Balay hxdhy = hx * dhy; 4219371c9d4SSatish Balay hydhx = hy * dhx; 422c4762a1bSJed Brown 4239371c9d4SSatish Balay xints = info.xs; 4249371c9d4SSatish Balay xinte = info.xs + info.xm; 4259371c9d4SSatish Balay yints = info.ys; 4269371c9d4SSatish Balay yinte = info.ys + info.ym; 427c4762a1bSJed Brown 428c4762a1bSJed Brown /* Set the boundary conditions on the momentum equations */ 429c4762a1bSJed Brown /* Test whether we are on the bottom edge of the global array */ 430c4762a1bSJed Brown if (yints == 0) { 431c4762a1bSJed Brown j = 0; 432c4762a1bSJed Brown /* bottom edge */ 433c4762a1bSJed Brown for (i = info.xs; i < info.xs + info.xm; i++) { 434c4762a1bSJed Brown if (B) { 435c4762a1bSJed Brown bjiu = b[j][i].u; 436c4762a1bSJed Brown bjiv = b[j][i].v; 437c4762a1bSJed Brown } else { 438c4762a1bSJed Brown bjiu = 0.0; 439c4762a1bSJed Brown bjiv = 0.0; 440c4762a1bSJed Brown } 441c4762a1bSJed Brown x[j][i].u = 0.0 + bjiu; 442c4762a1bSJed Brown x[j][i].v = 0.0 + bjiv; 443c4762a1bSJed Brown } 444c4762a1bSJed Brown } 445c4762a1bSJed Brown 446c4762a1bSJed Brown /* Test whether we are on the top edge of the global array */ 447c4762a1bSJed Brown if (yinte == info.my) { 448c4762a1bSJed Brown j = info.my - 1; 449c4762a1bSJed Brown /* top edge */ 450c4762a1bSJed Brown for (i = info.xs; i < info.xs + info.xm; i++) { 451c4762a1bSJed Brown if (B) { 452c4762a1bSJed Brown bjiu = b[j][i].u; 453c4762a1bSJed Brown bjiv = b[j][i].v; 454c4762a1bSJed Brown } else { 455c4762a1bSJed Brown bjiu = 0.0; 456c4762a1bSJed Brown bjiv = 0.0; 457c4762a1bSJed Brown } 458c4762a1bSJed Brown x[j][i].u = lid + bjiu; 459c4762a1bSJed Brown x[j][i].v = bjiv; 460c4762a1bSJed Brown } 461c4762a1bSJed Brown } 462c4762a1bSJed Brown 463c4762a1bSJed Brown /* Test whether we are on the left edge of the global array */ 464c4762a1bSJed Brown if (xints == 0) { 465c4762a1bSJed Brown i = 0; 466c4762a1bSJed Brown /* left edge */ 467c4762a1bSJed Brown for (j = info.ys; j < info.ys + info.ym; j++) { 468c4762a1bSJed Brown if (B) { 469c4762a1bSJed Brown bjiu = b[j][i].u; 470c4762a1bSJed Brown bjiv = b[j][i].v; 471c4762a1bSJed Brown } else { 472c4762a1bSJed Brown bjiu = 0.0; 473c4762a1bSJed Brown bjiv = 0.0; 474c4762a1bSJed Brown } 475c4762a1bSJed Brown x[j][i].u = 0.0 + bjiu; 476c4762a1bSJed Brown x[j][i].v = 0.0 + bjiv; 477c4762a1bSJed Brown } 478c4762a1bSJed Brown } 479c4762a1bSJed Brown 480c4762a1bSJed Brown /* Test whether we are on the right edge of the global array */ 481c4762a1bSJed Brown if (xinte == info.mx) { 482c4762a1bSJed Brown i = info.mx - 1; 483c4762a1bSJed Brown /* right edge */ 484c4762a1bSJed Brown for (j = info.ys; j < info.ys + info.ym; j++) { 485c4762a1bSJed Brown if (B) { 486c4762a1bSJed Brown bjiu = b[j][i].u; 487c4762a1bSJed Brown bjiv = b[j][i].v; 488c4762a1bSJed Brown } else { 489c4762a1bSJed Brown bjiu = 0.0; 490c4762a1bSJed Brown bjiv = 0.0; 491c4762a1bSJed Brown } 492c4762a1bSJed Brown x[j][i].u = 0.0 + bjiu; 493c4762a1bSJed Brown x[j][i].v = 0.0 + bjiv; 494c4762a1bSJed Brown } 495c4762a1bSJed Brown } 496c4762a1bSJed Brown 497c4762a1bSJed Brown for (k = 0; k < sweeps; k++) { 498c4762a1bSJed Brown for (j = info.ys; j < info.ys + info.ym; j++) { 499c4762a1bSJed Brown for (i = info.xs; i < info.xs + info.xm; i++) { 500c4762a1bSJed Brown ptconverged = PETSC_FALSE; 501c4762a1bSJed Brown pfnorm0 = 0.0; 502c4762a1bSJed Brown fu = 0.0; 503c4762a1bSJed Brown fv = 0.0; 504c4762a1bSJed Brown fomega = 0.0; 505c4762a1bSJed Brown ftemp = 0.0; 506c4762a1bSJed Brown /* Run Newton's method on a single grid point */ 507c4762a1bSJed Brown for (l = 0; l < max_its && !ptconverged; l++) { 508c4762a1bSJed Brown if (B) { 509c4762a1bSJed Brown bjiu = b[j][i].u; 510c4762a1bSJed Brown bjiv = b[j][i].v; 511c4762a1bSJed Brown bjiomega = b[j][i].omega; 512c4762a1bSJed Brown bjitemp = b[j][i].temp; 513c4762a1bSJed Brown } else { 514c4762a1bSJed Brown bjiu = 0.0; 515c4762a1bSJed Brown bjiv = 0.0; 516c4762a1bSJed Brown bjiomega = 0.0; 517c4762a1bSJed Brown bjitemp = 0.0; 518c4762a1bSJed Brown } 519c4762a1bSJed Brown 520c4762a1bSJed Brown if (i != 0 && i != info.mx - 1 && j != 0 && j != info.my - 1) { 521c4762a1bSJed Brown /* U velocity */ 522c4762a1bSJed Brown u = x[j][i].u; 523c4762a1bSJed Brown uxx = (2.0 * u - x[j][i - 1].u - x[j][i + 1].u) * hydhx; 524c4762a1bSJed Brown uyy = (2.0 * u - x[j - 1][i].u - x[j + 1][i].u) * hxdhy; 525c4762a1bSJed Brown fu = uxx + uyy - .5 * (x[j + 1][i].omega - x[j - 1][i].omega) * hx - bjiu; 526c4762a1bSJed Brown dfudu = 2.0 * (hydhx + hxdhy); 527c4762a1bSJed Brown /* V velocity */ 528c4762a1bSJed Brown u = x[j][i].v; 529c4762a1bSJed Brown uxx = (2.0 * u - x[j][i - 1].v - x[j][i + 1].v) * hydhx; 530c4762a1bSJed Brown uyy = (2.0 * u - x[j - 1][i].v - x[j + 1][i].v) * hxdhy; 531c4762a1bSJed Brown fv = uxx + uyy + .5 * (x[j][i + 1].omega - x[j][i - 1].omega) * hy - bjiv; 532c4762a1bSJed Brown dfvdv = 2.0 * (hydhx + hxdhy); 533c4762a1bSJed Brown /* 534c4762a1bSJed Brown convective coefficients for upwinding 535c4762a1bSJed Brown */ 5369371c9d4SSatish Balay vx = x[j][i].u; 5379371c9d4SSatish Balay avx = PetscAbsScalar(vx); 5389371c9d4SSatish Balay vxp = .5 * (vx + avx); 5399371c9d4SSatish Balay vxm = .5 * (vx - avx); 5409371c9d4SSatish Balay vy = x[j][i].v; 5419371c9d4SSatish Balay avy = PetscAbsScalar(vy); 5429371c9d4SSatish Balay vyp = .5 * (vy + avy); 5439371c9d4SSatish Balay vym = .5 * (vy - avy); 544c4762a1bSJed Brown /* Omega */ 545c4762a1bSJed Brown u = x[j][i].omega; 546c4762a1bSJed Brown uxx = (2.0 * u - x[j][i - 1].omega - x[j][i + 1].omega) * hydhx; 547c4762a1bSJed Brown uyy = (2.0 * u - x[j - 1][i].omega - x[j + 1][i].omega) * hxdhy; 5489371c9d4SSatish Balay fomega = uxx + uyy + (vxp * (u - x[j][i - 1].omega) + vxm * (x[j][i + 1].omega - u)) * hy + (vyp * (u - x[j - 1][i].omega) + vym * (x[j + 1][i].omega - u)) * hx - .5 * grashof * (x[j][i + 1].temp - x[j][i - 1].temp) * hy - bjiomega; 549c4762a1bSJed Brown /* convective coefficient derivatives */ 550c4762a1bSJed Brown dfodo = 2.0 * (hydhx + hxdhy) + ((vxp - vxm) * hy + (vyp - vym) * hx); 551c4762a1bSJed Brown if (PetscRealPart(vx) > 0.0) dfodu = (u - x[j][i - 1].omega) * hy; 552c4762a1bSJed Brown else dfodu = (x[j][i + 1].omega - u) * hy; 553c4762a1bSJed Brown 554c4762a1bSJed Brown if (PetscRealPart(vy) > 0.0) dfodv = (u - x[j - 1][i].omega) * hx; 555c4762a1bSJed Brown else dfodv = (x[j + 1][i].omega - u) * hx; 556c4762a1bSJed Brown 557c4762a1bSJed Brown /* Temperature */ 558c4762a1bSJed Brown u = x[j][i].temp; 559c4762a1bSJed Brown uxx = (2.0 * u - x[j][i - 1].temp - x[j][i + 1].temp) * hydhx; 560c4762a1bSJed Brown uyy = (2.0 * u - x[j - 1][i].temp - x[j + 1][i].temp) * hxdhy; 561c4762a1bSJed Brown ftemp = uxx + uyy + prandtl * ((vxp * (u - x[j][i - 1].temp) + vxm * (x[j][i + 1].temp - u)) * hy + (vyp * (u - x[j - 1][i].temp) + vym * (x[j + 1][i].temp - u)) * hx) - bjitemp; 562c4762a1bSJed Brown dftdt = 2.0 * (hydhx + hxdhy) + prandtl * ((vxp - vxm) * hy + (vyp - vym) * hx); 563c4762a1bSJed Brown if (PetscRealPart(vx) > 0.0) dftdu = prandtl * (u - x[j][i - 1].temp) * hy; 564c4762a1bSJed Brown else dftdu = prandtl * (x[j][i + 1].temp - u) * hy; 565c4762a1bSJed Brown 566c4762a1bSJed Brown if (PetscRealPart(vy) > 0.0) dftdv = prandtl * (u - x[j - 1][i].temp) * hx; 567c4762a1bSJed Brown else dftdv = prandtl * (x[j + 1][i].temp - u) * hx; 568c4762a1bSJed Brown 569c4762a1bSJed Brown /* invert the system: 570c4762a1bSJed Brown [ dfu / du 0 0 0 ][yu] = [fu] 571c4762a1bSJed Brown [ 0 dfv / dv 0 0 ][yv] [fv] 572c4762a1bSJed Brown [ dfo / du dfo / dv dfo / do 0 ][yo] [fo] 573c4762a1bSJed Brown [ dft / du dft / dv 0 dft / dt ][yt] [ft] 574c4762a1bSJed Brown by simple back-substitution 575c4762a1bSJed Brown */ 576c4762a1bSJed Brown yu = fu / dfudu; 577c4762a1bSJed Brown yv = fv / dfvdv; 578c4762a1bSJed Brown yo = (fomega - (dfodu * yu + dfodv * yv)) / dfodo; 579c4762a1bSJed Brown yt = (ftemp - (dftdu * yu + dftdv * yv)) / dftdt; 580c4762a1bSJed Brown 581c4762a1bSJed Brown x[j][i].u = x[j][i].u - yu; 582c4762a1bSJed Brown x[j][i].v = x[j][i].v - yv; 583c4762a1bSJed Brown x[j][i].temp = x[j][i].temp - yt; 584c4762a1bSJed Brown x[j][i].omega = x[j][i].omega - yo; 585c4762a1bSJed Brown } 586c4762a1bSJed Brown if (i == 0) { 587c4762a1bSJed Brown fomega = x[j][i].omega - (x[j][i + 1].v - x[j][i].v) * dhx - bjiomega; 588c4762a1bSJed Brown ftemp = x[j][i].temp - bjitemp; 589c4762a1bSJed Brown yo = fomega; 590c4762a1bSJed Brown yt = ftemp; 591c4762a1bSJed Brown x[j][i].omega = x[j][i].omega - fomega; 592c4762a1bSJed Brown x[j][i].temp = x[j][i].temp - ftemp; 593c4762a1bSJed Brown } 594c4762a1bSJed Brown if (i == info.mx - 1) { 595c4762a1bSJed Brown fomega = x[j][i].omega - (x[j][i].v - x[j][i - 1].v) * dhx - bjiomega; 596c4762a1bSJed Brown ftemp = x[j][i].temp - (PetscReal)(grashof > 0) - bjitemp; 597c4762a1bSJed Brown yo = fomega; 598c4762a1bSJed Brown yt = ftemp; 599c4762a1bSJed Brown x[j][i].omega = x[j][i].omega - fomega; 600c4762a1bSJed Brown x[j][i].temp = x[j][i].temp - ftemp; 601c4762a1bSJed Brown } 602c4762a1bSJed Brown if (j == 0) { 603c4762a1bSJed Brown fomega = x[j][i].omega + (x[j + 1][i].u - x[j][i].u) * dhy - bjiomega; 604c4762a1bSJed Brown ftemp = x[j][i].temp - x[j + 1][i].temp - bjitemp; 605c4762a1bSJed Brown yo = fomega; 606c4762a1bSJed Brown yt = ftemp; 607c4762a1bSJed Brown x[j][i].omega = x[j][i].omega - fomega; 608c4762a1bSJed Brown x[j][i].temp = x[j][i].temp - ftemp; 609c4762a1bSJed Brown } 610c4762a1bSJed Brown if (j == info.my - 1) { 611c4762a1bSJed Brown fomega = x[j][i].omega + (x[j][i].u - x[j - 1][i].u) * dhy - bjiomega; 612c4762a1bSJed Brown ftemp = x[j][i].temp - x[j - 1][i].temp - bjitemp; 613c4762a1bSJed Brown yo = fomega; 614c4762a1bSJed Brown yt = ftemp; 615c4762a1bSJed Brown x[j][i].omega = x[j][i].omega - fomega; 616c4762a1bSJed Brown x[j][i].temp = x[j][i].temp - ftemp; 617c4762a1bSJed Brown } 618c4762a1bSJed Brown tot_its++; 619c4762a1bSJed Brown pfnorm = PetscRealPart(fu * fu + fv * fv + fomega * fomega + ftemp * ftemp); 620c4762a1bSJed Brown pfnorm = PetscSqrtReal(pfnorm); 621c4762a1bSJed Brown pynorm = PetscRealPart(yu * yu + yv * yv + yo * yo + yt * yt); 622c4762a1bSJed Brown pynorm = PetscSqrtReal(pynorm); 623c4762a1bSJed Brown pxnorm = PetscRealPart(x[j][i].u * x[j][i].u + x[j][i].v * x[j][i].v + x[j][i].omega * x[j][i].omega + x[j][i].temp * x[j][i].temp); 624c4762a1bSJed Brown pxnorm = PetscSqrtReal(pxnorm); 625c4762a1bSJed Brown if (l == 0) pfnorm0 = pfnorm; 626c4762a1bSJed Brown if (rtol * pfnorm0 > pfnorm || atol > pfnorm || pxnorm * stol > pynorm) ptconverged = PETSC_TRUE; 627c4762a1bSJed Brown } 628c4762a1bSJed Brown } 629c4762a1bSJed Brown } 630c4762a1bSJed Brown } 6319566063dSJacob Faibussowitsch PetscCall(DMDAVecRestoreArrayWrite(da, localX, &x)); 63248a46eb9SPierre Jolivet if (B) PetscCall(DMDAVecRestoreArrayRead(da, localB, &b)); 6339566063dSJacob Faibussowitsch PetscCall(DMLocalToGlobalBegin(da, localX, INSERT_VALUES, X)); 6349566063dSJacob Faibussowitsch PetscCall(DMLocalToGlobalEnd(da, localX, INSERT_VALUES, X)); 6359566063dSJacob Faibussowitsch PetscCall(PetscLogFlops(tot_its * (84.0 + 41.0 + 26.0))); 6369566063dSJacob Faibussowitsch PetscCall(DMRestoreLocalVector(da, &localX)); 63748a46eb9SPierre Jolivet if (B) PetscCall(DMRestoreLocalVector(da, &localB)); 6383ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 639c4762a1bSJed Brown } 640c4762a1bSJed Brown 641c4762a1bSJed Brown /*TEST 642c4762a1bSJed Brown 643c4762a1bSJed Brown test: 644c4762a1bSJed Brown nsize: 2 645c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -pc_type mg -ksp_type fgmres -pc_mg_type full 646c4762a1bSJed Brown requires: !single 647c4762a1bSJed Brown 648c4762a1bSJed Brown test: 649c4762a1bSJed Brown suffix: 10 650c4762a1bSJed Brown nsize: 3 651c4762a1bSJed Brown args: -snes_monitor_short -ksp_monitor_short -pc_type fieldsplit -pc_fieldsplit_type symmetric_multiplicative -snes_view -da_refine 1 -ksp_type fgmres 652c4762a1bSJed Brown requires: !single 653c4762a1bSJed Brown 654c4762a1bSJed Brown test: 655c4762a1bSJed Brown suffix: 11 656c4762a1bSJed Brown nsize: 4 657c4762a1bSJed Brown requires: pastix 658*688c8ee7SFlorent Pruvost args: -snes_monitor_short -pc_type redundant -dm_mat_type mpiaij -redundant_pc_factor_mat_solver_type pastix -mat_pastix_thread_nbr 1 -pc_redundant_number 2 -da_refine 4 -ksp_type fgmres 659c4762a1bSJed Brown 660c4762a1bSJed Brown test: 661c4762a1bSJed Brown suffix: 12 662c4762a1bSJed Brown nsize: 12 663c4762a1bSJed Brown requires: pastix 664*688c8ee7SFlorent Pruvost args: -snes_monitor_short -pc_type redundant -dm_mat_type mpiaij -redundant_pc_factor_mat_solver_type pastix -mat_pastix_thread_nbr 1 -pc_redundant_number 5 -da_refine 4 -ksp_type fgmres 665c4762a1bSJed Brown 666c4762a1bSJed Brown test: 667c4762a1bSJed Brown suffix: 13 668c4762a1bSJed Brown nsize: 3 669c4762a1bSJed Brown args: -snes_monitor_short -ksp_monitor_short -pc_type fieldsplit -pc_fieldsplit_type multiplicative -snes_view -da_refine 1 -ksp_type fgmres -snes_mf_operator 670c4762a1bSJed Brown requires: !single 671c4762a1bSJed Brown 672c4762a1bSJed Brown test: 673c4762a1bSJed Brown suffix: 14 674c4762a1bSJed Brown nsize: 4 675c4762a1bSJed Brown args: -snes_monitor_short -pc_type mg -dm_mat_type baij -mg_coarse_pc_type bjacobi -da_refine 3 -ksp_type fgmres 676c4762a1bSJed Brown requires: !single 677c4762a1bSJed Brown 678c4762a1bSJed Brown test: 679c4762a1bSJed Brown suffix: 14_ds 680c4762a1bSJed Brown nsize: 4 681c4762a1bSJed Brown args: -snes_converged_reason -pc_type mg -dm_mat_type baij -mg_coarse_pc_type bjacobi -da_refine 3 -ksp_type fgmres -mat_fd_type ds 682c4762a1bSJed Brown output_file: output/ex19_2.out 683c4762a1bSJed Brown requires: !single 684c4762a1bSJed Brown 685c4762a1bSJed Brown test: 686c4762a1bSJed Brown suffix: 17 687c4762a1bSJed Brown args: -snes_monitor_short -ksp_pc_side right 688c4762a1bSJed Brown requires: !single 689c4762a1bSJed Brown 690c4762a1bSJed Brown test: 691c4762a1bSJed Brown suffix: 18 692798534f6SMatthew G. Knepley args: -snes_monitor_ksp draw::draw_lg -ksp_pc_side right 693c4762a1bSJed Brown requires: x !single 694c4762a1bSJed Brown 695c4762a1bSJed Brown test: 69641ba4c6cSHeeho Park suffix: 19 69741ba4c6cSHeeho Park nsize: 2 69841ba4c6cSHeeho Park args: -da_refine 3 -snes_monitor_short -pc_type mg -ksp_type fgmres -pc_mg_type full -snes_type newtontrdc 69941ba4c6cSHeeho Park requires: !single 70041ba4c6cSHeeho Park 70141ba4c6cSHeeho Park test: 70241ba4c6cSHeeho Park suffix: 20 70341ba4c6cSHeeho Park nsize: 2 70441ba4c6cSHeeho Park args: -da_refine 3 -snes_monitor_short -pc_type mg -ksp_type fgmres -pc_mg_type full -snes_type newtontrdc -snes_trdc_use_cauchy false 70541ba4c6cSHeeho Park requires: !single 70641ba4c6cSHeeho Park 70741ba4c6cSHeeho Park test: 708c4762a1bSJed Brown suffix: 2 709c4762a1bSJed Brown nsize: 4 710c4762a1bSJed Brown args: -da_refine 3 -snes_converged_reason -pc_type mg -mat_fd_type ds 711c4762a1bSJed Brown requires: !single 712c4762a1bSJed Brown 713c4762a1bSJed Brown test: 714c4762a1bSJed Brown suffix: 2_bcols1 715c4762a1bSJed Brown nsize: 4 716c4762a1bSJed Brown args: -da_refine 3 -snes_converged_reason -pc_type mg -mat_fd_type ds -mat_fd_coloring_bcols 717c4762a1bSJed Brown output_file: output/ex19_2.out 718c4762a1bSJed Brown requires: !single 719c4762a1bSJed Brown 720c4762a1bSJed Brown test: 721c4762a1bSJed Brown suffix: 3 722c4762a1bSJed Brown nsize: 4 723c4762a1bSJed Brown requires: mumps 724c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -pc_type redundant -dm_mat_type mpiaij -redundant_ksp_type preonly -redundant_pc_factor_mat_solver_type mumps -pc_redundant_number 2 725c4762a1bSJed Brown 726c4762a1bSJed Brown test: 727c4762a1bSJed Brown suffix: 4 728c4762a1bSJed Brown nsize: 12 729c4762a1bSJed Brown requires: mumps 730c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -pc_type redundant -dm_mat_type mpiaij -redundant_ksp_type preonly -redundant_pc_factor_mat_solver_type mumps -pc_redundant_number 5 731c4762a1bSJed Brown output_file: output/ex19_3.out 732c4762a1bSJed Brown 733c4762a1bSJed Brown test: 734c4762a1bSJed Brown suffix: 6 735c4762a1bSJed Brown args: -snes_monitor_short -ksp_monitor_short -pc_type fieldsplit -snes_view -ksp_type fgmres -da_refine 1 736c4762a1bSJed Brown requires: !single 737c4762a1bSJed Brown 738c4762a1bSJed Brown test: 739c4762a1bSJed Brown suffix: 7 740c4762a1bSJed Brown nsize: 3 741c4762a1bSJed Brown args: -snes_monitor_short -ksp_monitor_short -pc_type fieldsplit -snes_view -da_refine 1 -ksp_type fgmres 742c4762a1bSJed Brown 743c4762a1bSJed Brown requires: !single 744c4762a1bSJed Brown test: 745c4762a1bSJed Brown suffix: 8 746c4762a1bSJed Brown args: -snes_monitor_short -ksp_monitor_short -pc_type fieldsplit -pc_fieldsplit_block_size 2 -pc_fieldsplit_0_fields 0,1 -pc_fieldsplit_1_fields 0,1 -pc_fieldsplit_type multiplicative -snes_view -fieldsplit_pc_type lu -da_refine 1 -ksp_type fgmres 747c4762a1bSJed Brown requires: !single 748c4762a1bSJed Brown 749c4762a1bSJed Brown test: 750c4762a1bSJed Brown suffix: 9 751c4762a1bSJed Brown nsize: 3 752c4762a1bSJed Brown args: -snes_monitor_short -ksp_monitor_short -pc_type fieldsplit -pc_fieldsplit_type multiplicative -snes_view -da_refine 1 -ksp_type fgmres 753c4762a1bSJed Brown requires: !single 754c4762a1bSJed Brown 755c4762a1bSJed Brown test: 756c4762a1bSJed Brown suffix: aspin 757c4762a1bSJed Brown nsize: 4 758de54d9edSStefano Zampini args: -da_refine 3 -da_overlap 2 -snes_monitor_short -snes_type aspin -grashof 4e4 -lidvelocity 100 -ksp_monitor_short -npc_sub_ksp_type preonly -npc_sub_pc_type lu 759c4762a1bSJed Brown requires: !single 760c4762a1bSJed Brown 761c4762a1bSJed Brown test: 762c4762a1bSJed Brown suffix: bcgsl 763c4762a1bSJed Brown nsize: 2 764c4762a1bSJed Brown args: -ksp_type bcgsl -ksp_monitor_short -da_refine 2 -ksp_bcgsl_ell 3 -snes_view 765c4762a1bSJed Brown requires: !single 766c4762a1bSJed Brown 767c4762a1bSJed Brown test: 768c4762a1bSJed Brown suffix: bcols1 769c4762a1bSJed Brown nsize: 2 770c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -pc_type mg -ksp_type fgmres -pc_mg_type full -mat_fd_coloring_bcols 1 771c4762a1bSJed Brown output_file: output/ex19_1.out 772c4762a1bSJed Brown requires: !single 773c4762a1bSJed Brown 774c4762a1bSJed Brown test: 775c4762a1bSJed Brown suffix: bjacobi 776c4762a1bSJed Brown nsize: 4 777c4762a1bSJed Brown args: -da_refine 4 -ksp_type fgmres -pc_type bjacobi -pc_bjacobi_blocks 2 -sub_ksp_type gmres -sub_ksp_max_it 2 -sub_pc_type bjacobi -sub_sub_ksp_type preonly -sub_sub_pc_type ilu -snes_monitor_short 778c4762a1bSJed Brown requires: !single 779c4762a1bSJed Brown 780c4762a1bSJed Brown test: 781c4762a1bSJed Brown suffix: cgne 782c4762a1bSJed Brown args: -da_refine 2 -pc_type lu -ksp_type cgne -ksp_monitor_short -ksp_converged_reason -ksp_view -ksp_norm_type unpreconditioned 783c4762a1bSJed Brown filter: grep -v HERMITIAN 784c4762a1bSJed Brown requires: !single 785c4762a1bSJed Brown 786c4762a1bSJed Brown test: 787c4762a1bSJed Brown suffix: cgs 788c4762a1bSJed Brown args: -da_refine 1 -ksp_monitor_short -ksp_type cgs 789c4762a1bSJed Brown requires: !single 790c4762a1bSJed Brown 791c4762a1bSJed Brown test: 792c4762a1bSJed Brown suffix: composite_fieldsplit 793c4762a1bSJed Brown args: -ksp_type fgmres -pc_type composite -pc_composite_type MULTIPLICATIVE -pc_composite_pcs fieldsplit,none -sub_0_pc_fieldsplit_block_size 4 -sub_0_pc_fieldsplit_type additive -sub_0_pc_fieldsplit_0_fields 0,1,2 -sub_0_pc_fieldsplit_1_fields 3 -snes_monitor_short -ksp_monitor_short 794c4762a1bSJed Brown requires: !single 795c4762a1bSJed Brown 796c4762a1bSJed Brown test: 797c4762a1bSJed Brown suffix: composite_fieldsplit_bjacobi 798c4762a1bSJed Brown args: -ksp_type fgmres -pc_type composite -pc_composite_type MULTIPLICATIVE -pc_composite_pcs fieldsplit,bjacobi -sub_0_pc_fieldsplit_block_size 4 -sub_0_pc_fieldsplit_type additive -sub_0_pc_fieldsplit_0_fields 0,1,2 -sub_0_pc_fieldsplit_1_fields 3 -sub_1_pc_bjacobi_blocks 16 -sub_1_sub_pc_type lu -snes_monitor_short -ksp_monitor_short 799c4762a1bSJed Brown requires: !single 800c4762a1bSJed Brown 801c4762a1bSJed Brown test: 802c4762a1bSJed Brown suffix: composite_fieldsplit_bjacobi_2 803c4762a1bSJed Brown nsize: 4 804c4762a1bSJed Brown args: -ksp_type fgmres -pc_type composite -pc_composite_type MULTIPLICATIVE -pc_composite_pcs fieldsplit,bjacobi -sub_0_pc_fieldsplit_block_size 4 -sub_0_pc_fieldsplit_type additive -sub_0_pc_fieldsplit_0_fields 0,1,2 -sub_0_pc_fieldsplit_1_fields 3 -sub_1_pc_bjacobi_blocks 16 -sub_1_sub_pc_type lu -snes_monitor_short -ksp_monitor_short 805c4762a1bSJed Brown requires: !single 806c4762a1bSJed Brown 807c4762a1bSJed Brown test: 808c4762a1bSJed Brown suffix: composite_gs_newton 809c4762a1bSJed Brown nsize: 2 810c4762a1bSJed Brown args: -da_refine 3 -grashof 4e4 -lidvelocity 100 -snes_monitor_short -snes_type composite -snes_composite_type additiveoptimal -snes_composite_sneses ngs,newtonls -sub_0_snes_max_it 20 -sub_1_pc_type mg 811c4762a1bSJed Brown requires: !single 812c4762a1bSJed Brown 813c4762a1bSJed Brown test: 814c4762a1bSJed Brown suffix: cuda 815c4762a1bSJed Brown requires: cuda !single 816c4762a1bSJed Brown args: -dm_vec_type cuda -dm_mat_type aijcusparse -pc_type none -ksp_type fgmres -snes_monitor_short -snes_rtol 1.e-5 817c4762a1bSJed Brown 818c4762a1bSJed Brown test: 81947d993e7Ssuyashtn suffix: hip 82047d993e7Ssuyashtn requires: hip !single 82147d993e7Ssuyashtn args: -dm_vec_type hip -dm_mat_type aijhipsparse -pc_type none -ksp_type fgmres -snes_monitor_short -snes_rtol 1.e-5 82247d993e7Ssuyashtn 82347d993e7Ssuyashtn test: 824c4762a1bSJed Brown suffix: draw 825c4762a1bSJed Brown args: -pc_type fieldsplit -snes_view draw -fieldsplit_x_velocity_pc_type mg -fieldsplit_x_velocity_pc_mg_galerkin pmat -fieldsplit_x_velocity_pc_mg_levels 2 -da_refine 1 -fieldsplit_x_velocity_mg_coarse_pc_type svd 826c4762a1bSJed Brown requires: x !single 827c4762a1bSJed Brown 828c4762a1bSJed Brown test: 829c4762a1bSJed Brown suffix: drawports 830c4762a1bSJed Brown args: -snes_monitor_solution draw::draw_ports -da_refine 1 831c4762a1bSJed Brown output_file: output/ex19_draw.out 832c4762a1bSJed Brown requires: x !single 833c4762a1bSJed Brown 834c4762a1bSJed Brown test: 835c4762a1bSJed Brown suffix: fas 836c4762a1bSJed Brown args: -da_refine 4 -snes_monitor_short -snes_type fas -fas_levels_snes_type ngs -fas_levels_snes_ngs_sweeps 3 -fas_levels_snes_ngs_atol 0.0 -fas_levels_snes_ngs_stol 0.0 -grashof 4e4 -snes_fas_smoothup 6 -snes_fas_smoothdown 6 -lidvelocity 100 837c4762a1bSJed Brown requires: !single 838c4762a1bSJed Brown 839c4762a1bSJed Brown test: 840c4762a1bSJed Brown suffix: fas_full 841c4762a1bSJed Brown args: -da_refine 4 -snes_monitor_short -snes_type fas -snes_fas_type full -snes_fas_full_downsweep -fas_levels_snes_type ngs -fas_levels_snes_ngs_sweeps 3 -fas_levels_snes_ngs_atol 0.0 -fas_levels_snes_ngs_stol 0.0 -grashof 4e4 -snes_fas_smoothup 6 -snes_fas_smoothdown 6 -lidvelocity 100 842c4762a1bSJed Brown requires: !single 843c4762a1bSJed Brown 844c4762a1bSJed Brown test: 845c4762a1bSJed Brown suffix: fdcoloring_ds 846c4762a1bSJed Brown args: -da_refine 3 -snes_converged_reason -pc_type mg -mat_fd_type ds 847c4762a1bSJed Brown output_file: output/ex19_2.out 848c4762a1bSJed Brown requires: !single 849c4762a1bSJed Brown 850c4762a1bSJed Brown test: 851c4762a1bSJed Brown suffix: fdcoloring_ds_baij 852c4762a1bSJed Brown args: -da_refine 3 -snes_converged_reason -pc_type mg -mat_fd_type ds -dm_mat_type baij 853c4762a1bSJed Brown output_file: output/ex19_2.out 854c4762a1bSJed Brown requires: !single 855c4762a1bSJed Brown 856c4762a1bSJed Brown test: 857c4762a1bSJed Brown suffix: fdcoloring_ds_bcols1 858c4762a1bSJed Brown args: -da_refine 3 -snes_converged_reason -pc_type mg -mat_fd_type ds -mat_fd_coloring_bcols 1 859c4762a1bSJed Brown output_file: output/ex19_2.out 860c4762a1bSJed Brown requires: !single 861c4762a1bSJed Brown 862c4762a1bSJed Brown test: 863c4762a1bSJed Brown suffix: fdcoloring_wp 864c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -pc_type mg 865c4762a1bSJed Brown requires: !single 866c4762a1bSJed Brown 867c4762a1bSJed Brown test: 868c4762a1bSJed Brown suffix: fdcoloring_wp_baij 869c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -pc_type mg -dm_mat_type baij 870c4762a1bSJed Brown output_file: output/ex19_fdcoloring_wp.out 871c4762a1bSJed Brown requires: !single 872c4762a1bSJed Brown 873c4762a1bSJed Brown test: 874c4762a1bSJed Brown suffix: fdcoloring_wp_bcols1 875c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -pc_type mg -mat_fd_coloring_bcols 1 876c4762a1bSJed Brown output_file: output/ex19_fdcoloring_wp.out 877c4762a1bSJed Brown requires: !single 878c4762a1bSJed Brown 879c4762a1bSJed Brown test: 880c4762a1bSJed Brown suffix: fieldsplit_2 881c4762a1bSJed Brown args: -ksp_type fgmres -pc_type fieldsplit -pc_fieldsplit_block_size 4 -pc_fieldsplit_type additive -pc_fieldsplit_0_fields 0,1,2 -pc_fieldsplit_1_fields 3 -snes_monitor_short -ksp_monitor_short 882c4762a1bSJed Brown requires: !single 883c4762a1bSJed Brown 884c4762a1bSJed Brown test: 885c4762a1bSJed Brown suffix: fieldsplit_3 886c4762a1bSJed Brown args: -ksp_type fgmres -pc_type fieldsplit -pc_fieldsplit_block_size 4 -pc_fieldsplit_type additive -pc_fieldsplit_0_fields 0,1,2 -pc_fieldsplit_1_fields 3 -fieldsplit_0_pc_type lu -fieldsplit_1_pc_type lu -snes_monitor_short -ksp_monitor_short 887c4762a1bSJed Brown requires: !single 888c4762a1bSJed Brown 889c4762a1bSJed Brown test: 890c4762a1bSJed Brown suffix: fieldsplit_4 891c4762a1bSJed Brown args: -ksp_type fgmres -pc_type fieldsplit -pc_fieldsplit_block_size 4 -pc_fieldsplit_type SCHUR -pc_fieldsplit_0_fields 0,1,2 -pc_fieldsplit_1_fields 3 -fieldsplit_0_pc_type lu -fieldsplit_1_pc_type lu -snes_monitor_short -ksp_monitor_short 892c4762a1bSJed Brown requires: !single 893c4762a1bSJed Brown 894c4762a1bSJed Brown # HYPRE PtAP broken with complex numbers 895c4762a1bSJed Brown test: 896c4762a1bSJed Brown suffix: fieldsplit_hypre 897c4762a1bSJed Brown nsize: 2 898263f2b91SStefano Zampini requires: hypre mumps !complex !defined(PETSC_HAVE_HYPRE_DEVICE) 899c4762a1bSJed Brown args: -pc_type fieldsplit -pc_fieldsplit_block_size 4 -pc_fieldsplit_type SCHUR -pc_fieldsplit_0_fields 0,1,2 -pc_fieldsplit_1_fields 3 -fieldsplit_0_pc_type lu -fieldsplit_0_pc_factor_mat_solver_type mumps -fieldsplit_1_pc_type hypre -fieldsplit_1_pc_hypre_type boomeramg -snes_monitor_short -ksp_monitor_short 900c4762a1bSJed Brown 901c4762a1bSJed Brown test: 902c4762a1bSJed Brown suffix: fieldsplit_mumps 903c4762a1bSJed Brown nsize: 2 904c4762a1bSJed Brown requires: mumps 905c4762a1bSJed Brown args: -pc_type fieldsplit -pc_fieldsplit_block_size 4 -pc_fieldsplit_type SCHUR -pc_fieldsplit_0_fields 0,1,2 -pc_fieldsplit_1_fields 3 -fieldsplit_0_pc_type lu -fieldsplit_1_pc_type lu -snes_monitor_short -ksp_monitor_short -fieldsplit_0_pc_factor_mat_solver_type mumps -fieldsplit_1_pc_factor_mat_solver_type mumps 906c4762a1bSJed Brown output_file: output/ex19_fieldsplit_5.out 907c4762a1bSJed Brown 908c4762a1bSJed Brown test: 909c4762a1bSJed Brown suffix: greedy_coloring 910c4762a1bSJed Brown nsize: 2 911c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -snes_fd_color -snes_fd_color_use_mat -mat_coloring_type greedy -mat_coloring_weight_type lf -mat_coloring_view> ex19_greedy_coloring.tmp 2>&1 912c4762a1bSJed Brown requires: !single 913c4762a1bSJed Brown 914c4762a1bSJed Brown # HYPRE PtAP broken with complex numbers 915c4762a1bSJed Brown test: 916c4762a1bSJed Brown suffix: hypre 917c4762a1bSJed Brown nsize: 2 918263f2b91SStefano Zampini requires: hypre !complex !defined(PETSC_HAVE_HYPRE_DEVICE) 919263f2b91SStefano Zampini args: -da_refine 3 -snes_monitor_short -pc_type hypre -ksp_norm_type unpreconditioned 920c4762a1bSJed Brown 921263f2b91SStefano Zampini # ibcgs is broken when using device vectors 922c4762a1bSJed Brown test: 923c4762a1bSJed Brown suffix: ibcgs 924c4762a1bSJed Brown nsize: 2 925c4762a1bSJed Brown args: -ksp_type ibcgs -ksp_monitor_short -da_refine 2 -snes_view 926c4762a1bSJed Brown requires: !complex !single 927c4762a1bSJed Brown 928c4762a1bSJed Brown test: 929c4762a1bSJed Brown suffix: kaczmarz 930c4762a1bSJed Brown nsize: 2 931c4762a1bSJed Brown args: -pc_type kaczmarz -ksp_monitor_short -snes_monitor_short -snes_view 932c4762a1bSJed Brown requires: !single 933c4762a1bSJed Brown 934c4762a1bSJed Brown test: 935c4762a1bSJed Brown suffix: klu 936c4762a1bSJed Brown requires: suitesparse 937c4762a1bSJed Brown args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type klu 938c4762a1bSJed Brown output_file: output/ex19_superlu.out 939c4762a1bSJed Brown 940c4762a1bSJed Brown test: 941c4762a1bSJed Brown suffix: klu_2 942c4762a1bSJed Brown requires: suitesparse 9434ac6704cSBarry Smith args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type klu -pc_factor_mat_ordering_type nd 944c4762a1bSJed Brown output_file: output/ex19_superlu.out 945c4762a1bSJed Brown 946c4762a1bSJed Brown test: 947c4762a1bSJed Brown suffix: klu_3 948c4762a1bSJed Brown requires: suitesparse 949c4762a1bSJed Brown args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type klu -mat_klu_use_btf 0 950c4762a1bSJed Brown output_file: output/ex19_superlu.out 951c4762a1bSJed Brown 952c4762a1bSJed Brown test: 953c4762a1bSJed Brown suffix: ml 954c4762a1bSJed Brown nsize: 2 955c4762a1bSJed Brown requires: ml 956c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -pc_type ml 957c4762a1bSJed Brown 958c4762a1bSJed Brown test: 959c4762a1bSJed Brown suffix: ngmres_fas 960c4762a1bSJed Brown args: -da_refine 4 -snes_monitor_short -snes_type ngmres -npc_fas_levels_snes_type ngs -npc_fas_levels_snes_ngs_sweeps 3 -npc_fas_levels_snes_ngs_atol 0.0 -npc_fas_levels_snes_ngs_stol 0.0 -npc_snes_type fas -npc_fas_levels_snes_type ngs -npc_snes_max_it 1 -npc_snes_fas_smoothup 6 -npc_snes_fas_smoothdown 6 -lidvelocity 100 -grashof 4e4 961c4762a1bSJed Brown requires: !single 962c4762a1bSJed Brown 963c4762a1bSJed Brown test: 964c4762a1bSJed Brown suffix: ngmres_fas_gssecant 965c4762a1bSJed Brown args: -da_refine 3 -snes_monitor_short -snes_type ngmres -npc_snes_type fas -npc_fas_levels_snes_type ngs -npc_fas_levels_snes_max_it 6 -npc_fas_levels_snes_ngs_secant -npc_fas_levels_snes_ngs_max_it 1 -npc_fas_coarse_snes_max_it 1 -lidvelocity 100 -grashof 4e4 966c4762a1bSJed Brown requires: !single 967c4762a1bSJed Brown 968c4762a1bSJed Brown test: 969c4762a1bSJed Brown suffix: ngmres_fas_ms 970c4762a1bSJed Brown nsize: 2 971c4762a1bSJed Brown args: -snes_grid_sequence 2 -lidvelocity 200 -grashof 1e4 -snes_monitor_short -snes_view -snes_converged_reason -snes_type ngmres -npc_snes_type fas -npc_fas_coarse_snes_type newtonls -npc_fas_coarse_ksp_type preonly -npc_snes_max_it 1 972c4762a1bSJed Brown requires: !single 973c4762a1bSJed Brown 974c4762a1bSJed Brown test: 975c4762a1bSJed Brown suffix: ngmres_nasm 976c4762a1bSJed Brown nsize: 4 977c4762a1bSJed Brown args: -da_refine 4 -da_overlap 2 -snes_monitor_short -snes_type ngmres -snes_max_it 10 -npc_snes_type nasm -npc_snes_nasm_type basic -grashof 4e4 -lidvelocity 100 978c4762a1bSJed Brown requires: !single 979c4762a1bSJed Brown 980c4762a1bSJed Brown test: 981c4762a1bSJed Brown suffix: ngs 982c4762a1bSJed Brown args: -snes_type ngs -snes_view -snes_monitor -snes_rtol 1e-4 983c4762a1bSJed Brown requires: !single 984c4762a1bSJed Brown 985c4762a1bSJed Brown test: 986c4762a1bSJed Brown suffix: ngs_fd 987c4762a1bSJed Brown args: -snes_type ngs -snes_ngs_secant -snes_view -snes_monitor -snes_rtol 1e-4 988c4762a1bSJed Brown requires: !single 989c4762a1bSJed Brown 990c4762a1bSJed Brown test: 991c4762a1bSJed Brown suffix: parms 992c4762a1bSJed Brown nsize: 2 993c4762a1bSJed Brown requires: parms 994c4762a1bSJed Brown args: -pc_type parms -ksp_monitor_short -snes_view 995c4762a1bSJed Brown 996c4762a1bSJed Brown test: 997c4762a1bSJed Brown suffix: superlu 998c4762a1bSJed Brown requires: superlu 999c4762a1bSJed Brown args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type superlu 1000c4762a1bSJed Brown 1001c4762a1bSJed Brown test: 1002c4762a1bSJed Brown suffix: superlu_sell 1003c4762a1bSJed Brown requires: superlu 1004c4762a1bSJed Brown args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type superlu -dm_mat_type sell -pc_factor_mat_ordering_type natural 1005c4762a1bSJed Brown output_file: output/ex19_superlu.out 1006c4762a1bSJed Brown 1007c4762a1bSJed Brown test: 1008c4762a1bSJed Brown suffix: superlu_dist 1009c4762a1bSJed Brown requires: superlu_dist 1010c4762a1bSJed Brown args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type superlu_dist 1011c4762a1bSJed Brown output_file: output/ex19_superlu.out 1012c4762a1bSJed Brown 1013c4762a1bSJed Brown test: 1014c4762a1bSJed Brown suffix: superlu_dist_2 1015c4762a1bSJed Brown nsize: 2 1016c4762a1bSJed Brown requires: superlu_dist 1017c4762a1bSJed Brown args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type superlu_dist 1018c4762a1bSJed Brown output_file: output/ex19_superlu.out 1019c4762a1bSJed Brown 1020c4762a1bSJed Brown test: 10213e558968SBarry Smith suffix: superlu_dist_3d 10223e558968SBarry Smith nsize: 4 10233e558968SBarry Smith requires: superlu_dist !defined(PETSCTEST_VALGRIND) 10243e558968SBarry Smith filter: grep -v iam | grep -v openMP 10253e558968SBarry Smith args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type superlu_dist -mat_superlu_dist_3d -mat_superlu_dist_d 2 -snes_view -snes_monitor -ksp_monitor 10263e558968SBarry Smith 10273e558968SBarry Smith test: 1028b2d1094fSBarry Smith suffix: superlu_dist_2s 1029b2d1094fSBarry Smith nsize: 2 1030a6ad605dSBarry Smith requires: superlu_dist defined(PETSC_HAVE_SUPERLU_DIST_SINGLE) 1031b2d1094fSBarry Smith args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type superlu_dist -pc_precision single 1032b2d1094fSBarry Smith output_file: output/ex19_superlu.out 1033b2d1094fSBarry Smith 1034b2d1094fSBarry Smith test: 1035b2d1094fSBarry Smith suffix: superlu_dist_3ds 1036b2d1094fSBarry Smith nsize: 4 1037a6ad605dSBarry Smith requires: superlu_dist !defined(PETSCTEST_VALGRIND) defined(PETSC_HAVE_SUPERLU_DIST_SINGLE) 1038b2d1094fSBarry Smith filter: grep -v iam | grep -v openMP 1039b2d1094fSBarry Smith args: -da_grid_x 20 -da_grid_y 20 -pc_type lu -pc_factor_mat_solver_type superlu_dist -mat_superlu_dist_3d -mat_superlu_dist_d 2 -snes_view -snes_monitor -ksp_monitor -pc_precision single 1040b2d1094fSBarry Smith 1041b2d1094fSBarry Smith test: 1042c4762a1bSJed Brown suffix: superlu_equil 1043c4762a1bSJed Brown requires: superlu 1044c4762a1bSJed Brown args: -da_grid_x 20 -da_grid_y 20 -{snes,ksp}_monitor_short -pc_type lu -pc_factor_mat_solver_type superlu -mat_superlu_equil 1045c4762a1bSJed Brown 1046c4762a1bSJed Brown test: 1047c4762a1bSJed Brown suffix: superlu_equil_sell 1048c4762a1bSJed Brown requires: superlu 1049c4762a1bSJed Brown args: -da_grid_x 20 -da_grid_y 20 -{snes,ksp}_monitor_short -pc_type lu -pc_factor_mat_solver_type superlu -mat_superlu_equil -dm_mat_type sell -pc_factor_mat_ordering_type natural 1050c4762a1bSJed Brown output_file: output/ex19_superlu_equil.out 1051c4762a1bSJed Brown 1052c4762a1bSJed Brown test: 1053c4762a1bSJed Brown suffix: tcqmr 1054c4762a1bSJed Brown args: -da_refine 1 -ksp_monitor_short -ksp_type tcqmr 1055c4762a1bSJed Brown requires: !single 1056c4762a1bSJed Brown 1057c4762a1bSJed Brown test: 1058c4762a1bSJed Brown suffix: tfqmr 1059c4762a1bSJed Brown args: -da_refine 1 -ksp_monitor_short -ksp_type tfqmr 1060c4762a1bSJed Brown requires: !single 1061c4762a1bSJed Brown 1062c4762a1bSJed Brown test: 1063c4762a1bSJed Brown suffix: umfpack 1064c4762a1bSJed Brown requires: suitesparse 10652c7c0729SBarry Smith args: -da_refine 2 -pc_type lu -pc_factor_mat_solver_type umfpack -snes_view -snes_monitor_short -ksp_monitor_short -pc_factor_mat_ordering_type external 1066c4762a1bSJed Brown 1067c4762a1bSJed Brown test: 1068c4762a1bSJed Brown suffix: tut_1 1069c4762a1bSJed Brown nsize: 4 1070c4762a1bSJed Brown requires: !single 1071c4762a1bSJed Brown args: -da_refine 5 -snes_monitor -ksp_monitor -snes_view 1072c4762a1bSJed Brown 1073c4762a1bSJed Brown test: 1074c4762a1bSJed Brown suffix: tut_2 1075c4762a1bSJed Brown nsize: 4 1076c4762a1bSJed Brown requires: !single 1077c4762a1bSJed Brown args: -da_refine 5 -snes_monitor -ksp_monitor -snes_view -pc_type mg 1078c4762a1bSJed Brown 1079c4762a1bSJed Brown # HYPRE PtAP broken with complex numbers 1080c4762a1bSJed Brown test: 1081c4762a1bSJed Brown suffix: tut_3 1082c4762a1bSJed Brown nsize: 4 1083263f2b91SStefano Zampini requires: hypre !single !complex !defined(PETSC_HAVE_HYPRE_DEVICE) 10842f6a9af4SStefano Zampini args: -da_refine 5 -snes_monitor -snes_converged_reason -pc_type hypre -dm_mat_type {{aij baij}} 10852f6a9af4SStefano Zampini 10862f6a9af4SStefano Zampini test: 10872f6a9af4SStefano Zampini suffix: tut_3_seq 10882f6a9af4SStefano Zampini nsize: 1 10892f6a9af4SStefano Zampini requires: hypre !single !complex !defined(PETSC_HAVE_HYPRE_DEVICE) 10902f6a9af4SStefano Zampini args: -da_refine 1 -snes_monitor -snes_converged_reason -pc_type hypre -dm_mat_type {{seqaij mpiaij seqbaij mpibaij}} 1091c4762a1bSJed Brown 1092c4762a1bSJed Brown test: 1093c4762a1bSJed Brown suffix: tut_8 1094c4762a1bSJed Brown nsize: 4 1095c4762a1bSJed Brown requires: ml !single 1096c4762a1bSJed Brown args: -da_refine 5 -snes_monitor -ksp_monitor -snes_view -pc_type ml 1097c4762a1bSJed Brown 1098c4762a1bSJed Brown test: 1099c4762a1bSJed Brown suffix: tut_4 1100c4762a1bSJed Brown nsize: 1 1101c4762a1bSJed Brown requires: !single 1102c4762a1bSJed Brown args: -da_refine 5 -log_view 1103c4762a1bSJed Brown filter: head -n 2 1104c4762a1bSJed Brown filter_output: head -n 2 1105c4762a1bSJed Brown 1106c4762a1bSJed Brown test: 1107c4762a1bSJed Brown suffix: tut_5 1108c4762a1bSJed Brown nsize: 1 1109c4762a1bSJed Brown requires: !single 1110c4762a1bSJed Brown args: -da_refine 5 -log_view -pc_type mg 1111c4762a1bSJed Brown filter: head -n 2 1112c4762a1bSJed Brown filter_output: head -n 2 1113c4762a1bSJed Brown 1114c4762a1bSJed Brown test: 1115c4762a1bSJed Brown suffix: tut_6 1116c4762a1bSJed Brown nsize: 4 1117c4762a1bSJed Brown requires: !single 1118c4762a1bSJed Brown args: -da_refine 5 -log_view 1119c4762a1bSJed Brown filter: head -n 2 1120c4762a1bSJed Brown filter_output: head -n 2 1121c4762a1bSJed Brown 1122c4762a1bSJed Brown test: 1123c4762a1bSJed Brown suffix: tut_7 1124c4762a1bSJed Brown nsize: 4 1125c4762a1bSJed Brown requires: !single 1126c4762a1bSJed Brown args: -da_refine 5 -log_view -pc_type mg 1127c4762a1bSJed Brown filter: head -n 2 1128c4762a1bSJed Brown filter_output: head -n 2 1129c4762a1bSJed Brown 1130c4762a1bSJed Brown test: 1131c4762a1bSJed Brown suffix: cuda_1 1132c4762a1bSJed Brown nsize: 1 1133c4762a1bSJed Brown requires: cuda 1134d4adc10fSMark Adams args: -snes_monitor -dm_mat_type seqaijcusparse -dm_vec_type seqcuda -pc_type gamg -ksp_monitor -mg_levels_ksp_max_it 1 1135c4762a1bSJed Brown 1136c4762a1bSJed Brown test: 1137c4762a1bSJed Brown suffix: cuda_2 1138c4762a1bSJed Brown nsize: 3 1139c4762a1bSJed Brown requires: cuda !single 1140d4adc10fSMark Adams args: -snes_monitor -dm_mat_type mpiaijcusparse -dm_vec_type mpicuda -pc_type gamg -ksp_monitor -mg_levels_ksp_max_it 1 1141c4762a1bSJed Brown 1142c4762a1bSJed Brown test: 1143d38ac8baSRichard Tran Mills suffix: cuda_dm_bind_below 1144d38ac8baSRichard Tran Mills nsize: 2 1145f403549eSJunchao Zhang requires: cuda defined(PETSC_USE_LOG) 1146d38ac8baSRichard Tran Mills args: -dm_mat_type aijcusparse -dm_vec_type cuda -da_refine 3 -pc_type mg -mg_levels_ksp_type chebyshev -mg_levels_pc_type jacobi -log_view -pc_mg_log -dm_bind_below 10000 114717fc1e00SRichard Tran Mills filter: awk "/Level/ {print \$NF}" 1148d38ac8baSRichard Tran Mills 1149d38ac8baSRichard Tran Mills test: 115047d993e7Ssuyashtn suffix: hip_1 115147d993e7Ssuyashtn nsize: 1 115247d993e7Ssuyashtn requires: hip 1153d4adc10fSMark Adams args: -snes_monitor -dm_mat_type mpiaijhipsparse -dm_vec_type hip -pc_type gamg -ksp_monitor -mg_levels_ksp_max_it 1 115447d993e7Ssuyashtn 115547d993e7Ssuyashtn test: 115647d993e7Ssuyashtn suffix: hip_2 115747d993e7Ssuyashtn nsize: 3 115847d993e7Ssuyashtn requires: hip !single 1159d4adc10fSMark Adams args: -snes_monitor -dm_mat_type mpiaijhipsparse -dm_vec_type mpihip -pc_type gamg -ksp_monitor -mg_levels_ksp_max_it 1 116047d993e7Ssuyashtn 116147d993e7Ssuyashtn test: 116247d993e7Ssuyashtn suffix: hip_dm_bind_below 116347d993e7Ssuyashtn nsize: 2 116447d993e7Ssuyashtn requires: hip 116547d993e7Ssuyashtn args: -dm_mat_type aijhipsparse -dm_vec_type hip -da_refine 3 -pc_type mg -mg_levels_ksp_type chebyshev -mg_levels_pc_type jacobi -log_view -pc_mg_log -dm_bind_below 10000 116647d993e7Ssuyashtn filter: awk "/Level/ {print \$NF}" 116747d993e7Ssuyashtn 116847d993e7Ssuyashtn test: 1169d38ac8baSRichard Tran Mills suffix: viennacl_dm_bind_below 1170d38ac8baSRichard Tran Mills nsize: 2 1171d38ac8baSRichard Tran Mills requires: viennacl 1172d38ac8baSRichard Tran Mills args: -dm_mat_type aijviennacl -dm_vec_type viennacl -da_refine 3 -pc_type mg -mg_levels_ksp_type chebyshev -mg_levels_pc_type jacobi -log_view -pc_mg_log -dm_bind_below 10000 117317fc1e00SRichard Tran Mills filter: awk "/Level/ {print \$NF}" 1174d38ac8baSRichard Tran Mills 1175d38ac8baSRichard Tran Mills test: 1176c4762a1bSJed Brown suffix: seqbaijmkl 1177c4762a1bSJed Brown nsize: 1 1178dfd57a17SPierre Jolivet requires: defined(PETSC_HAVE_MKL_SPARSE_OPTIMIZE) 1179c4762a1bSJed Brown args: -dm_mat_type baij -snes_monitor -ksp_monitor -snes_view 1180c4762a1bSJed Brown 1181c4762a1bSJed Brown test: 1182c4762a1bSJed Brown suffix: mpibaijmkl 1183c4762a1bSJed Brown nsize: 2 1184dfd57a17SPierre Jolivet requires: defined(PETSC_HAVE_MKL_SPARSE_OPTIMIZE) 1185c4762a1bSJed Brown args: -dm_mat_type baij -snes_monitor -ksp_monitor -snes_view 1186c4762a1bSJed Brown 1187c4762a1bSJed Brown test: 1188c4762a1bSJed Brown suffix: cpardiso 1189c4762a1bSJed Brown nsize: 4 1190c4762a1bSJed Brown requires: mkl_cpardiso 1191c4762a1bSJed Brown args: -pc_type lu -pc_factor_mat_solver_type mkl_cpardiso -ksp_monitor 1192c4762a1bSJed Brown 1193c4762a1bSJed Brown test: 1194c4762a1bSJed Brown suffix: logviewmemory 1195e57ab8abSSatish Balay requires: defined(PETSC_USE_LOG) !defined(PETSC_HAVE_THREADSAFETY) 1196c4762a1bSJed Brown args: -log_view -log_view_memory -da_refine 4 1197c4762a1bSJed Brown filter: grep MatFDColorSetUp | wc -w | xargs -I % sh -c "expr % \> 21" 1198c4762a1bSJed Brown 1199534f0846SBarry Smith test: 1200534f0846SBarry Smith suffix: fs 12019d5502f9SJunchao Zhang requires: !single 1202534f0846SBarry Smith args: -pc_type fieldsplit -da_refine 3 -all_ksp_monitor -fieldsplit_y_velocity_pc_type lu -fieldsplit_temperature_pc_type lu -fieldsplit_x_velocity_pc_type lu -snes_view 1203534f0846SBarry Smith 120471f558e3SSatish Balay test: 1205a8e42557SLawrence Mitchell suffix: asm_matconvert 1206a8e42557SLawrence Mitchell args: -mat_type aij -pc_type asm -pc_asm_sub_mat_type dense -snes_view 1207a8e42557SLawrence Mitchell 12088bf83915SBarry Smith test: 12098bf83915SBarry Smith suffix: euclid 12108bf83915SBarry Smith nsize: 2 1211263f2b91SStefano Zampini requires: hypre !single !complex !defined(PETSC_HAVE_HYPRE_MIXEDINT) !defined(PETSC_HAVE_HYPRE_DEVICE) 12128bf83915SBarry Smith args: -da_refine 2 -ksp_monitor -snes_monitor -snes_view -pc_type hypre -pc_hypre_type euclid 12138bf83915SBarry Smith 12148bf83915SBarry Smith test: 12158bf83915SBarry Smith suffix: euclid_bj 12168bf83915SBarry Smith nsize: 2 1217263f2b91SStefano Zampini requires: hypre !single !complex !defined(PETSC_HAVE_HYPRE_MIXEDINT) !defined(PETSC_HAVE_HYPRE_DEVICE) 12188bf83915SBarry Smith args: -da_refine 2 -ksp_monitor -snes_monitor -snes_view -pc_type hypre -pc_hypre_type euclid -pc_hypre_euclid_bj 12198bf83915SBarry Smith 12208bf83915SBarry Smith test: 12218bf83915SBarry Smith suffix: euclid_droptolerance 12228bf83915SBarry Smith nsize: 1 1223263f2b91SStefano Zampini requires: hypre !single !complex !defined(PETSC_HAVE_HYPRE_MIXEDINT) !defined(PETSC_HAVE_HYPRE_DEVICE) 12248bf83915SBarry Smith args: -da_refine 2 -ksp_monitor -snes_monitor -snes_view -pc_type hypre -pc_hypre_type euclid -pc_hypre_euclid_droptolerance .1 12258bf83915SBarry Smith 1226660278c0SBarry Smith test: 1227660278c0SBarry Smith suffix: failure_size 1228660278c0SBarry Smith nsize: 1 12290ef292d3SStefano Zampini requires: !defined(PETSC_USE_64BIT_INDICES) !defined(PETSCTEST_VALGRIND) !defined(PETSC_HAVE_SANITIZER) 1230660278c0SBarry Smith args: -da_refine 100 -petsc_ci_portable_error_output -error_output_stdout 1231e9a33e21SBarry Smith filter: grep -E -v "(memory block|leaked context|not freed before MPI_Finalize|Could be the program crashed)" 1232660278c0SBarry Smith 1233b8093be5SPierre Jolivet testset: 1234b8093be5SPierre Jolivet requires: hpddm cuda 1235b8093be5SPierre Jolivet args: -snes_monitor -ksp_converged_reason -ksp_type hpddm -pc_type jacobi -dm_mat_type aijcusparse -dm_vec_type cuda 1236b8093be5SPierre Jolivet test: 1237b8093be5SPierre Jolivet suffix: hpddm_cuda 1238b8093be5SPierre Jolivet filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 15/Linear solve converged due to CONVERGED_RTOL iterations 14/g" 1239b8093be5SPierre Jolivet args: -ksp_hpddm_type {{gmres gcrodr}separate output} -ksp_hpddm_precision {{single double}shared output} 1240b8093be5SPierre Jolivet test: 1241b8093be5SPierre Jolivet suffix: hpddm_cuda_right 1242b8093be5SPierre Jolivet filter: sed -e "s/Linear solve converged due to CONVERGED_RTOL iterations 15/Linear solve converged due to CONVERGED_RTOL iterations 14/g" 1243b8093be5SPierre Jolivet args: -ksp_hpddm_type gcrodr -ksp_pc_side right 1244b8093be5SPierre Jolivet output_file: output/ex19_hpddm_cuda_ksp_hpddm_type-gcrodr.out 1245b8093be5SPierre Jolivet 1246c4762a1bSJed Brown TEST*/ 1247