Hi Adriano, Thanks for reporting this. The fix for this got put into the "primary" PETSc classes, but not this one (again, this isn't exercised very much). I'll put in a fix.
(As an aside: Hopefully in the next few days, I'll have an interface to this in GRINS so we can exercise this in some tests.) On Wed, Mar 16, 2016 at 1:33 PM, Adriano Côrtes <adrimacor...@gmail.com> wrote: > Dear Paul, > > Thank you for your reply. I tried what you told. It worked somehow, that > is, the diff_solver is changed to PetscDiffSolver, but Petsc gave the error > bellow: > > *Solving time step 0, time = 0* > *Assembling the residual* > > *[0]PETSC ERROR: --------------------- Error Message > --------------------------------------------------------------* > *[0]PETSC ERROR: Object is in wrong state* > *[0]PETSC ERROR: Vec is locked read only, argument # 1* > *[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > <http://www.mcs.anl.gov/petsc/documentation/faq.html> for trouble shooting.* > *[0]PETSC ERROR: Petsc Release Version 3.6.3, unknown * > *[0]PETSC ERROR: ./example-opt on a arch-darwin-c-debug named > Adrianos-MacBook-Pro.local by cortesam Tue Mar 15 15:08:49 2016* > *[0]PETSC ERROR: Configure options --download-blacs --download-hypre > --download-metis --download-ml --download-mumps --download-superlu > --download-superlu_dist --download-ptscotch --download-pastix > --download-p4est --download-pardiso --download-parmetis > --download-scalapack --download-fblaslapack=1 --download-hdf5 --with-opencl > --with-blacs=1 --with-debugging=yes --with-precision=double > --with-scalar-type=real --with-pcbddc=1 --with-shared-libraries=1 > PETSC_ARCH=arch-darwin-c-debug* > *[0]PETSC ERROR: #1 VecGetArray() line 1646 in > /Users/cortesam/petsc-3.6/src/vec/vec/interface/rvector.c* > *[0]PETSC ERROR: #2 VecSetValues_MPI() line 908 in > /Users/cortesam/petsc-3.6/src/vec/vec/impls/mpi/pdvec.c* > *[0]PETSC ERROR: #3 VecSetValues() line 890 in > /Users/cortesam/petsc-3.6/src/vec/vec/interface/rvector.c* > > > I could find how the error appears, but do not know how to solve it. > Attached is a screenshot of my Xcode with the stack of functions call. The > problem as you can see above is that Vec is locked, that is, the lock > variable inside Vec is equal to 1, and by the screenshot you can see that > it happens inside the function *DofMap::enforce_constraints_exactly* > What I realize debugging is that this function is called twice at > *PetscDiffSolver::solve().* The first time is here: > > 372: #ifdef LIBMESH_ENABLE_CONSTRAINTS > 373: _system.get_dof_map().enforce_constraints_exactly(_system); > 374: #endif > > I checked and at this moment the Vec is not locked, that is, lock variable > is 0, so everything goes well. The second time it is called is > > 400: ierr = SNESSolve (_snes, PETSC_NULL, x.vec()); > > But this time vec is locked, and I could not find where this variable was > set to 1. > > Any help? > > Thank you very much. > Best, > Adriano. > > > 2016-03-11 17:59 GMT-03:00 Paul T. Bauman <ptbau...@gmail.com>: > >> Hi Adriano, >> >> On Fri, Mar 11, 2016 at 1:49 PM, Adriano Côrtes <adrimacor...@gmail.com> >> wrote: >> >>> Dear Roy, >>> >>> I discovered that the example 1 of FEMSystem (NS equation) uses >>> NewtonSolver, that is, _diff_solver in libMesh::TimeSolver points to >>> NewtonSolver. Where should I change the code to use PetscDiffSolver? Is >>> there an example where I can take a look? >>> >> >> Unfortunately there's not an example (that I know of). But, what you can >> do is when the TimeSolver is first created (line 144 in the unmodifeed >> fem_system_ex1.C), you can the the diff_solver() ( >> http://libmesh.github.io/doxygen/classlibMesh_1_1TimeSolver.html#abaf790fa7f3fc464e6e607a9b914a753) >> and reset it to PetscDiffSolver: system.time_sover.diff_solver().reset( new >> PetscDiffSolver(system) ) >> >> Let us know if you have any trouble. I don't think anyone has hit >> PetscDiffSolver very hard, so please do let us know if anything peculiar >> pops up. >> >> Thanks, >> >> Paul >> > > > > -- > Adriano Côrtes > ================================================= > Research assistant > High-performance Computing Center (NACAD) > Federal University of Rio de Janeiro (UFRJ) > ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140 _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users