Åsmund Ervik <[email protected]> writes: > Thanks Jed, > > The following works fine (for future reference): > > call DMDASetUniformCoordinates(SolScal,0.1,1.0,0.0,1.2,0.0,1.0,ierr) > > call DMGetCoordinatesLocal(SolScal,coordVec,ierr) > call DMGetCoordinateDM(SolScal,CoordDM,ierr) > call DMDAVecGetArrayF90(CoordDM,coordVec,coords,ierr) > > write(*,*) coords(:,0,0,0) > write(*,*) coords(:,imax-1,jmax-1,kmax-1) > gives > 0.1 0.0 0.0 > 1.0 1.2 1.0 > > Perfect. Not very logical though, that we need this new DM, so perhaps > add an example/something in the manual?
The coordinates live in a different space than the DM. Why is it illogical to use the coordinate DM to access coordinate vectors? It is used in several examples, though none of them in Fortran. > I'm by the way planning to send you a Fortran example solving van der > Pol with a 3D DMDA (if you want it). "van der Pol" normally refers to a 2-variable ODE system (e.g., src/ts/examples/tutorials/ex16.c). I assume you are talking about a PDE, however. > I could include the above code in that example if desired. The > example is written with some utility functions (discussed in emails a > few weeks ago) such that it is easy to reuse 95% of a legacy code > solving van der Pol (or other PDE). The main motivation for adding > this example (IMO) is that none of the current DM examples show how > DMDAs are used for solving a PDE in a very simple case, particularly > not for Fortran. We would welcome more Fortran examples. The best way to contribute is to add your example in a Git branch and send a pull request or patch. https://bitbucket.org/petsc/petsc/wiki/Home > One question in this regard: can you have examples split into two files? > That makes it easier to use Fortran modules in this case. You can, though we usually do single-file because it's simpler for people to copy out and modify. See src/vec/vec/examples/tutorials/makefile (ex21f90) for an example using multiple source files.
pgpcAMfi7gcRo.pgp
Description: PGP signature
