Some basic questions about PETSC

Matthew Knepley knepley at gmail.com
Mon Dec 4 08:17:39 CST 2006


On 12/4/06, Ben Tay <zonexo at gmail.com> wrote:
>
> Hi,
>
> regarding qn 4 ie  the requirement of
> VecAssemblyBegin,VecAssemblyEnd, I used VecPlaceArray,
> VecResetArray to change the values. I did not use Assembly after the 1st
> time step and it works ok. So that is fine too, right?

Its alright, but probably not optimal. It could result in slower code
due to all the
allocation. Its normally better to change the values in place.

   Matt

> Thank you!
>
> On 12/4/06, Satish Balay <balay at mcs.anl.gov> wrote:
> > On Sun, 3 Dec 2006, Matthew Knepley wrote:
> >
> > > > 1. Are petscscaler the same as real nos.? I am writing in double
> precision
> > > > or real(8). So are these 2 interchangeable? (same as petscint and
> integer).
> > >
> > > Yes.
> >
> > You can check these defines in include/finclude/petscdef.h
> >
> > PetscInt -> integer*4
> > PetscScalar -> real*8
> >
> > >
> > > > 2. while linking in compaq visual fortran, I get the warning message
> about
> > > > conflict library with LIBCMT. Is it important or can I just ignore it?
> > >
> > > This is determined by your configure. Satish will know better how to
> control
> > > it.
> >
> > There are some warnings because of the way compqaq f90 tries to
> > workarround some bugs in Visual Studio 6 version of the libraries. It
> > will be fine as long as all code [PETSc & application] is compiled
> > with the same set of compiler options,
> >
> > >
> > > > 3. I am writing in f90 free form format. When I modify from fixed f77
> format
> > > > to f90, it gives me a lot of error, which seems to be the include file
> > > > error. So, is it possible to write in f90 format?
> > >
> > > Depending on which compiler you use, you might have to give a flag. For
> g95
> > > it is -ffree-form.
> >
> > We'll have to see the error messgaes to determine what the problem is
> > - however - if you check the PETSc fortran examples - they comply with
> > both fixed and free from syntax.
> >
> > > > 4. I am writing a Navier stokes solver and I'm using PETSC to solve
> the
> > > > poisson eqn. If only the RHS changes with each time step, do I need to
> call
> > > >
> > > > VecCreateSeq
> > > > <insert values in RHS b>
> > > > VecAssemblyBegin
> > > > VecAssemblyEnd
> > > > VecDestroy
> > > >
> > > > at each time step? I don't think I can (or I should) change values of
> b
> > > > after VecAssemblyBegin,VecAssemblyEnd, or can I?
> > >
> > > You can just change the values. Call AssemblyBegin/End() after each
> group
> > > of changes.
> >
> > Another note: - If you change values with VecSetValues() - you'll need
> > to call VecAssemblyBegin,VecAssemblyEnd. However if you
> do
> > VecGetArray() [or VecGetArrayF0()] - and change values - then you
> > don't need the calls to VecAssembly...
> >
> > Satish
> >
> >
>
>


-- 
"Failure has a thousand explanations. Success doesn't need one" -- Sir
Alec Guiness




More information about the petsc-users mailing list