[petsc-users] Get grid sizes from DMMG finest grid in Fortran

Matthew Knepley knepley at gmail.com
Thu Feb 17 09:29:44 CST 2011


On Thu, Feb 17, 2011 at 9:00 AM, Pierre Navaro <elhombrefr at hotmail.fr>wrote:

>  Hi
> I add these lines on line 54
>      call DMMGGetDA(dmmg,db,ierr)
>       call DAGetInfo(db,PETSC_NULL_INTEGER,mx,my,mz,
> &
>      &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,
> &
>      &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,
> &
>      &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,
> &
>      &               PETSC_NULL_INTEGER,ierr)
>       print"('mx,my,mz =',3i4,X,i6)",mx,my,mz, mx*my*mz
>

Fortran is always so easy:

      DMMG             dmmg, dmmgLevel
      DM               da, db
      PetscInt mx,my,mz

      call DMMGArrayGetDMMG(dmmg,dmmgLevel,ierr)
      call DMMGGetDM(dmmgLevel,db,ierr)
      call DMDAGetInfo(db,PETSC_NULL_INTEGER,mx,my,mz,
 &
     &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,
&
     &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,
&
     &               PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,
&
     &               PETSC_NULL_INTEGER,ierr)
      print"('mx,my,mz =',3i4,X,i6)",mx,my,mz, mx*my*mz

   Matt


> and i get these errors
> [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> [0]PETSC ERROR: Invalid argument!
>
> [0]PETSC ERROR: Wrong type of object: Parameter # 1!
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20 14:26:37
> CST 2010
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> [0]PETSC ERROR: See docs/index.html for manual pages.
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: ./ex22 on a arch-osx- named m-navaro.u-strasbg.fr by
> navaro Thu Feb 17 15:59:43 2011
> [0]PETSC ERROR: Libraries linked from /opt/petsc-3.1-p7/arch-osx-10.6/lib
> [0]PETSC ERROR: Configure run at Tue Jan 25 09:41:36 2011
> [0]PETSC ERROR: Configure options --with-cc=gcc --with-fc="gfortran -m64"
> --with-cxx=g++ --download-mpich=1 PETSC_ARCH=arch-osx-10.6
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: DAGetInfo() line 309 in src/dm/da/src/daview.c
> mx,my,mz =   0   0   0      0
>
> Best regards
> Pierre
>
>
> On 17/02/11 15:19, Matthew Knepley wrote:
>
> On Thu, Feb 17, 2011 at 8:01 AM, El Hombre Frances <elhombrefr at hotmail.fr>wrote:
>
>> Hi,
>> I'm looking for how to get information about the DA of a DMMG finest grid.
>> I saw that you can access them with
>> call DMMGGetDA(...
>> call DAGetInfo(...
>> but it doesn't work in the main program, i get this error
>> 0]PETSC ERROR: Invalid argument!
>> [0]PETSC ERROR: Wrong type of object: Parameter # 1!
>>
>
>  1) Always send the COMPLETE error message
>
>  2) That should work. Notice that we use that on line 75
>
>     Matt
>
>
>> I tried with this example
>>
>> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/ksp/ksp/examples/tutorials/ex22f.F.html
>>
>> I don't know how to get DA infos outside the subroutines ComputeRHS and
>> ComputeJacobian
>>
>> I want grid size of the DA 3D in order to plot the field. I noticed that
>> it's possible with PetscObjectQuery in C language.
>>
>> Thanks for your help
>>
>> Pierre Navaro
>>
>>
>
>
> --
> 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
>
>
>
> --
> Pierre NAVARO
> IRMA - UMR 7501 CNRS/Universite de Strasbourg - Bureau i101
> 7 rue Rene Descartes F-67084 Strasbourg Cedex, FRANCE.
> tel : (33) [0]3 68 85 01 73, fax : (33) [0]3 68 85 01 05http://www-irma.u-strasbg.fr/~navaro
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110217/80f2e8cd/attachment.htm>


More information about the petsc-users mailing list