> On Jul 28, 2017, at 2:13 PM, Scott Norris <[email protected]> wrote: > > Hi, > > My graduate student and I are new to petsc -- we have worked through some of > the PDE examples, and modified them to use solve a single-variable nonlinear > PDE relevant to our research, by defining appropriate callback functions > (i.e. problem definition, jacobian of residual, and initial condition). > Although we are not numerical specialists, this seemed relatively > straightforward, and we are very much appreciative! > > Now we are looking to use it to solve a system of linear boundary-value > problems. This seems like it ought to be broadly similar in structure > despite the lack of timestepping (i.e. one still needs a problem definition, > residual jacobian, and initial guess), with the main complication being the > addition of multiple fields/components. > > We've found simple examples where a single linear BVP is solved directly > using KSP (which we've been able to run and modify successfully), but this > seems rather low-level, and we've found no KSP examples that involved multple > variables, and manually keeping track of which blocks of a vector / matrix > correspond to which variable seems a bit of a headache. In contrast, we've > found examples with multiple components, including one (ex19.c) with nice > notation such as > f[j][i].u = > f[j][i].v = > However, this seems much more complicated than our case, and we are > struggling to understand it (i.e., the the NonlinearGS-related code optional?)
You are safe to totally ignore the NonlinearGS code, it is not for regular users (or almost anyone else). > > > For someone who approaches this very much as an end-user (i.e. quick solution > to BVPs/PDEs on simple grids), I'm thinking a simple nonlinear system example > is likely to be the way to go -- it would resemble the PDEs we've already > solved, work for nonlinear problems if we get to them, and in the event that > our equations are actually linear, then the Jacobian would simply be the > matrix one creates in a simple KSP example (which, as an added bonus, could > be approximated). > > Okay, to our questions: > (1) Does this seem reasonable? Are we missing an important sense of the > overall structure of PETSc? > (2) Can multi-variable BVPs be solved in a user-friendly way (a.u, a.v, etc.) > using the linear solvers? Yes. > (3) If the nonlinear solvers allow a more user-friendly interface, are there > any special considerations to keep in mind? > (4) Most generally, where else should we look for inspiration? Are there > more detailed tutorials than the examples? Sadly our examples are not as clearly organized as they could be. There are several examples in src/ksp/ksp/examples/tutorials that use finite elements for multi-component problems but no good examples with finite differences. The only good example of multicomponent for finite differences is in src/snes/examples/tutorials/ex19.c but we don't even compute provide code for computing the Jacobian (though that would not be terribly difficult). Take a look also at src/ts/examples/tutorials/advection-diffusion-reaction/ex5.c that does a two component problem with finite differences (time dependent). Barry > > Thanks in advance for your time and any thoughts. > > Scott Norris > Department of Mathematics > Southern Methodist University > > > -- > Dr. Scott A. Norris > Associate Professor of Mathematics > Director of Undergraduate Studies > http://faculty.smu.edu/snorris > https://smu-snorris.ycb.me > Clements Hall, Room 239 > >
