Re: [petsc-users] Periodic BC in petsc DMPlex / firedrake
Did you forget to attach "The nice picture attached" Stephen > From: "Stefano Zampini" > To: "petsc-maint" > Cc: "imilian hartig" , "PETSc users list" > > Sent: Thursday, October 25, 2018 4:47:43 PM > Subject: Re: [petsc-users] Periodic BC in petsc DMPlex / firedrake > Opened the PR [ > https://bitbucket.org/petsc/petsc/pull-requests/1203/fix-dump-vtk-field-with-periodic-meshes/diff > | > https://bitbucket.org/petsc/petsc/pull-requests/1203/fix-dump-vtk-field-with-periodic-meshes/diff > ] > Il giorno gio 25 ott 2018 alle ore 17:44 Matthew Knepley < [ > mailto:knep...@gmail.com | knep...@gmail.com ] > ha scritto: >> Good catch Stefano. >> Matt >> On Thu, Oct 25, 2018 at 9:36 AM Stefano Zampini < [ >> mailto:stefano.zamp...@gmail.com | stefano.zamp...@gmail.com ] > wrote: >>> Maybe this is a fix >>> diff --git a/src/dm/impls/plex/plexvtu.c b/src/dm/impls/plex/plexvtu.c >>> index acdea12c2f..1a8bbada6a 100644 >>> --- a/src/dm/impls/plex/plexvtu.c >>> +++ b/src/dm/impls/plex/plexvtu.c >>> @@ -465,10 +465,11 @@ PetscErrorCode DMPlexVTKWriteAll_VTU(DM dm,PetscViewer >>> viewer) >>> if ((closure[v] >= vStart) && (closure[v] < vEnd)) { >>> PetscScalar *xpoint; >>> - ierr = DMPlexPointLocalRead(dm,v,x,);CHKERRQ(ierr); >>> + ierr = DMPlexPointLocalRead(dm,closure[v],x,);CHKERRQ(ierr); >>> y[cnt + off++] = xpoint[i]; >>> } >>> } >>> + cnt += off; >>> ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, , >>> );CHKERRQ(ierr); >>> } >>> } >>> Max, does this fix your problem? If you confirm, I'll fix this in the maint >>> branch >>> If I run the below command line with the patch and with snes tutorials ex12 >>> I >>> get the nice picture attached >>> $ ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet >>> -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f >>> ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh >>> -dm_plex_gmsh_periodic -x_periodicity periodic -y_periodicity periodic >>> -dm_refine 4 >>> Il giorno gio 25 ott 2018 alle ore 15:11 Stefano Zampini < [ >>> mailto:stefano.zamp...@gmail.com | stefano.zamp...@gmail.com ] > ha scritto: Matt, you can reproduce it via $ valgrind ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh -dm_plex_gmsh_periodic Long time ago I added support for viewing meshes with periodic vertices in the VTK_VTU viewer, but I did not fix the part that writes fields Il giorno mer 24 ott 2018 alle ore 21:04 Matthew Knepley < [ mailto:knep...@gmail.com | knep...@gmail.com ] > ha scritto: > On Wed, Oct 24, 2018 at 11:36 AM Maximilian Hartig < [ > mailto:imilian.har...@gmail.com | imilian.har...@gmail.com ] > wrote: >>> On 24. Oct 2018, at 12:49, Matthew Knepley < [ mailto:knep...@gmail.com >>> | >>> knep...@gmail.com ] > wrote: >>> On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell < [ >>> mailto:we...@gmx.li | >>> we...@gmx.li ] > wrote: Hi Max, (I'm cc'ing in the petsc-users mailing list which may have more advice, if you are using PETSc you should definitely subscribe! > On 24 Oct 2018, at 09:27, Maximilian Hartig < [ > mailto:imilian.har...@gmail.com > | imilian.har...@gmail.com ] > wrote: > Hello Lawrence, > sorry to message you out of the blue. My name is Max and I found your > post on > GitHub ( [ https://github.com/firedrakeproject/firedrake/issues/1246 | > https://github.com/firedrakeproject/firedrake/issues/1246 ] ) on > DMPlex being > able to read periodic gmsh files. I am currently trying to do just > that > (creating a periodic DMPlex mesh with gmsh) in the context of my PhD > work. So > far I haven’ t found any documentation on the periodic BC’s with > DMPlex and > gmsh in the official petsc documentation. > I was wondering whether you’d be so kind as to point me in a general > direction > concerning how to achieve this. You seem experienced in using petsc > and I would > greatly appreciate your help. I think the answer is "it depends". If you're just using DMPlex directly and all the of the functionality with PetscDS, then I /think/ that reading periodic meshes via gmsh (assuming you're using the appropriate gmsh mesh format [v2]) "just works". >>> There are two phases here: topological and geometric. DMPlex represents >>> the >>> periodic topological entity directly. For example, a circle is just a >>> segment >>> with one end hooked to the other. Vertices are not duplicated, or >>> mapped to >>> each other. This makes topology simple and easy to implement. However, >>> then >>> geometry
[petsc-users] Novice: How to implement the petsc Gmres libraries in my CFD code
I am disparate to implement the petsc library gmres in an CFD code and need a little help to get going. 23 years ago, gmres was implemented/written in the code by Y. Saad, modified by A. Malevsky, version February 1, 1995. petsc, most likely started with the same version, added new solvers, ...etc and maintained and corrected bugs reported by users and I would like to use the latest petsc version of gmres Why? Normally we have no convergence problems using gmres. However sometimes gmres diverges instantaneously, no warning, just a negative density. Our code is parallel mpi, unstructured, uses a low Mach preconditioner, FV Roe scheme. Thus I would like to add an petsc option. Would someone outline, in detail, the steps that I need to follow? I need all the encourage that I can get to add the option in the code. petsc is installed on our computers Thanks in advance, Stephen IF ( petsc .EQ. 1 ) THEN c petsc CALL MatAssembleBegin c petsc CALL MatAssembleEnd ... add steps ELSE CALL GMRESASR ! from our code ENDIF This is from our code which may be useful information c--- c flexible GMRES routine. This is a version of GMRES which allows a c a variable preconditioner. Implemented with a reverse communication c protocole for flexibility - c DISTRIBUTED VERSION (USES DISTDOT FOR DDOT) c explicit (exact) residual norms for restarts c written by Y. Saad, modified by A. Malevsky, version February 1, 1995 c--- c This Is A Reverse Communication Implementation. c- c USAGE: (see also comments for icode below). CGMRES c should be put in a loop and the loop should be active for as c long as icode is not equal to 0. On RETURN fgmres will c 1) either be requesting the new preconditioned vector applied c to wk1 in case icode.eq.1 (result should be put in wk2) c 2) or be requesting the product of A applied to the vector wk1 c in case icode.eq.2 (result should be put in wk2) c 3) or be terminated in case icode .eq. 0. c on entry always set icode = 0. So icode should be set back to zero c upon convergence. c--- c Here is a typical way of running fgmres: c c icode = 0 c 1 continue c CALL fgmres (n,im,rhs,sol,i,vv,w,wk1, wk2,eps,maxits,iout,icode) c c if (icode .eq. 1) then c CALL precon(n, wk1, wk2) <--- user's variable preconditioning c goto 1 c else if (icode .ge. 2) then c CALL matvec (n,wk1, wk2) <--- user's matrix vector product. c goto 1 c else c - done c .
[petsc-users] MPI-IO
I have an unstructured mesh code used to compute vortex shedding problems saving the solutions every 500-1000 time steps. The mesh size is 3 to 20 MNodes. The minimum number of cores that I us is 128 for the 3MNode mesh. I would like to know if PETSC could be used to use to save the solutions using MPI-IO? Hope my question is clear, Stephen
[petsc-users] PETSc recommended visualization packages
Jed Brown wrote: On Mon, Jul 4, 2011 at 21:44, Barry Smith bsmith at mcs.anl.gov mailto:bsmith at mcs.anl.gov wrote: What are the recommended visualization packages for use with PETSc (for example making movies of contour plots and isosurfaces) and what are the recommended data formats to use to save Vecs for visualization? VisIt Any links to VisIt? Goggle produced nothing. Thanks, Stephen and ParaView are the primary choices. In my experience, VisIt is a more complete system, but ParaView is easier to install and probably easier to get started with. The VTK XML or binary formats are the easiest to get started with. See src/ts/examples/tutorials/ex14.c for an example of writing an XML file containing two fields on different grids (2D and 3D, structured, but deformed) in parallel. All file formats are horrible non-extensible crud, usually grown out of a particular application with structured grids of low-order/non-exotic basis functions on unstructured grids. They tend not to retain enough semantic information to reconstruct a state for further computations and also work for visualization without needing additional application-provided information. -- stephen.wornom at inria.fr 2004 route des lucioles - BP93 Sophia Antipolis 06902 CEDEX Tel: 04 92 38 50 54 Fax: 04 97 15 53 51 -- next part -- A non-text attachment was scrubbed... Name: stephen_wornom.vcf Type: text/x-vcard Size: 160 bytes Desc: not available URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110705/5d409b73/attachment.vcf
[petsc-users] best PETSC solver for long nozzles
Geometry: Tube with L/D is 1 Characteristics: -Unstructured partitioned mesh with 500K vertices globally. -The tube wall is heated, thus solution evolves in the x-direction. -X is the dominant flow direction. -Seek steady solution using the time advancing scheme with a low Mach number preconditionner. *Question*: Which *PETSC* solver would give the best convergence? Stephen p.s. My present solver does not take into consideration that the flow has a dominant flow direction (x). Thus the convergence is very slow, 3 time steps using 64-processors with a CFLmax= 50 applied in each cell. At 15000 time steps the 0-L/2 portion of the tube is converged with an additional 15000 time steps needed to converge the L/2-L part of the tube. -- stephen.wornom at inria.fr 2004 route des lucioles - BP93 Sophia Antipolis 06902 CEDEX Tel: 04 92 38 50 54 Fax: 04 97 15 53 51 -- next part -- A non-text attachment was scrubbed... Name: stephen_wornom.vcf Type: text/x-vcard Size: 160 bytes Desc: not available URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110129/0fdceea5/attachment.vcf
[petsc-users] default preconditioner
Christian Klettner wrote: Thanks Jed. Dear PETSc, What is the default preconditioner (if i do not explicitly set one)? Best regards, Christian Apparently Jed gave you the answer in a non-list e-mail. For the list users, please let the list know for what you are thanking Jed. Stephen -- stephen.wornom at sophia.inria.fr 2004 route des lucioles - BP93 Sophia Antipolis 06902 CEDEX Tel: 04 92 38 50 54 Fax: 04 97 15 53 51 -- next part -- A non-text attachment was scrubbed... Name: stephen_wornom.vcf Type: text/x-vcard Size: 160 bytes Desc: not available URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100223/3cc2886a/attachment.vcf
Which way to decompose domain/grid
Wee-Beng Tay wrote: Hi, I'm working on a 2D Cartesian grid and I'm going to decompose the grid for MPI for my CFD Fortran code. The grid size is in the ratio of 110 x 70. I wonder how I should decompose the grid - horizontally or vertically? For e.g., for 2 processors, to 2 55x70 grids, or 2 110x35 grids. I thought that communication between grids will be less if I do 55x70 because communication will only involve 70 values. I wrote a Cartesian mesh partitioner that partitions in slices as it involves the minimum communication time. For general meshes I partition with METIS. Question: I would like to use the PETSC partitioner if use one has the option to partition on in the x-y coordinates. Is that possible? Hope my question is clear. Stephen However, if it's 110x35, it'll involve 110 values Hence does it matter in PETSc how the decomposition is done? On the other hand, since Fortran is column major and hence I do the calculation: do j=1,size_y do i=1,size_x f(i,j)= end do end do I'll need to package the 70 values in a chunk for efficient sending. However, if it's in 110x35, I can use mpi_isend directly since it's contagious data. So is there a better option since there seems to be a conflict? I read about the use of DMMG. Will this problem be dealt with much better if I use DMMG instead? Thank you very much -- stephen.wornom at sophia.inria.fr 2004 route des lucioles - BP93 Sophia Antipolis 06902 CEDEX Tel: 04 92 38 50 54 Fax: 04 97 15 53 51 -- next part -- A non-text attachment was scrubbed... Name: stephen_wornom.vcf Type: text/x-vcard Size: 160 bytes Desc: not available URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20091210/6334d2c2/attachment.vcf
Off topic - Some advice on solving Navier-Stokes with Finite Difference
Shengyong wrote: Hi, Farshid Maybe she should use the staggered grid method which is very simple to implement. Does it remain simple for curvilinear meshes? Stephen On Tue, Aug 11, 2009 at 5:16 AM, Farshid Mossaiby mossaiby at yahoo.com mailto:mossaiby at yahoo.com wrote: Hi all, Sorry for this off-topic post. I am helping a master studnet which is working on solving Navier-Stokes equation with Finite Difference method. She is trying to eliminate spourious pressure modes from the solution. She needs to know some details that are not usually found in the papers but important when programming, e.g. boundary condition for pressure. If someone has expertise on this or know a *simple* FD code, I would be thankful to let me know. Best regards, Farshid Mossaiby -- Pang Shengyong Solidification Simulation Lab, State Key Lab of Mould Die Technology, Huazhong Univ. of Sci. Tech. China
Off topic - Some advice on solving Navier-Stokes with FiniteDifference
Matthew Knepley wrote: 1) You should really handle this by creating the constant vector on the pressure space and using MatNullSpaceCreate() 2) You can also easily handle this by fixing the pressure at one point At what indices or location does one fix the pressure? What value is it set. Usually pressure is part of the solution. It would seem to introduce an inconsistency. I would like to understand how to do it. Stephen Matt On Wed, Aug 12, 2009 at 10:19 AM, William A. Perkins william.perkins at pnl.gov mailto:william.perkins at pnl.gov wrote: Stephen, There are two ways that I know of to deal with pressure checker boarding: staggered grids or some form of Rhie-Chow interpolation. IMO, these are simple only for uniform, Cartesian grids. For grids that are curvilinear, unstructured, non-uniform, and/or non-orthogonal, things get real complicated. There may be other methods, but something is required. Regarding boundary conditions, I would suggest this text book: H. K. Versteeg and W. Malalasekera. An Introduction to Computational Fluid Dynamics, the Finite Volume Method. 2nd edition. Prentice-Hall. 2007 While this book uses the finite volume method, the explanation of boundary conditions and staggered grids is very good and relatively easy to interpret for finite difference. I would also recommend Joel H. Ferziger and Milovan Peric. Computational Methods for Fluid Dynamics. Springer-Verlag, 3rd edition, 2002. This is a little more general with regard to method discussing finite difference and finite volume, but still settling on finite volume. My $0.02: I question the use of finite difference. For Navier-Stokes, the use of finite volume is much more prevalent in commercial and research codes. If your student follows Versteeg and Malalasekera a simple, working, staggered grid FV code could be built in a very short time. If something more complicated is needed, it's probably explained in Ferziger and Peric. Also My $0.02: Unless the point of your student's work is to experience building her own code, why not download something like OpenFOAM (http://www.opencfd.co.uk/openfoam/) and just use it? I expect the effort to learn something like OpenFOAM for a simple application will be much less than writing a new code. Hope this helps. Bill Stephen == Stephen Wornom stephen.wornom at sophia.inria.fr mailto:stephen.wornom at sophia.inria.fr writes: Stephen Shengyong wrote: Hi, Farshid Maybe she should use the staggered grid method which is very simple to implement. Stephen Does it remain simple for curvilinear meshes? Stephen Stephen On Tue, Aug 11, 2009 at 5:16 AM, Farshid Mossaiby mossaiby at yahoo.com mailto:mossaiby at yahoo.com mailto:mossaiby at yahoo.com mailto:mossaiby at yahoo.com wrote: Hi all, Sorry for this off-topic post. I am helping a master studnet which is working on solving Navier-Stokes equation with Finite Difference method. She is trying to eliminate spourious pressure modes from the solution. She needs to know some details that are not usually found in the papers but important when programming, e.g. boundary condition for pressure. If someone has expertise on this or know a *simple* FD code, I would be thankful to let me know. Best regards, Farshid Mossaiby -- Pang Shengyong Solidification Simulation Lab, State Key Lab of Mould Die Technology, Huazhong Univ. of Sci. Tech. China -- Bill Perkins Research Engineer Hydrology Group Pacific Northwest National Laboratory 902 Battelle Boulevard P.O. Box 999, MSIN K9-36 Richland, WA 99352 USA Tel: 509-372-6131 Fax: 509-372-6089 william.perkins at pnl.gov mailto:william.perkins at pnl.gov www.pnl.gov http://www.pnl.gov -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener