[petsc-users] DMPlex Fortran examples

Matthew Knepley knepley at gmail.com
Wed Mar 13 18:08:09 CDT 2013


On Wed, Mar 13, 2013 at 7:07 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Wed, Mar 6, 2013 at 5:30 PM, Dharmendar Reddy <dharmareddy84 at gmail.com>wrote:
>
>> Hello Mathew,
>>                      I created an example (tutorial like) for creating DM
>> using cell list of a box mesh with quad cells (anti clockwise orientation
>> for cell nodes). The Box mesh is created locally. I also included in
>> comments explanations of cells, dimension, co-dimension based on my
>> understanding.
>>
>> May be you can add some explanation for understanding the idea of
>> stratum.
>>
>>
>> I find that DMPlexComputeCellGeometry gives incorrect results for J, detJ
>> and InvJ where as the same code that you used in
>> DMPlexComputeRectangleGeometry_private gives correct answers when i
>> evaluated those steps locally in the example code.
>>
>
> This was my bug. I forgot to declare an F90 interface for that function. I
> am including my changed version that worked for me.
>

I forgot to attach it.

  Matt


>
>
Can you tell me how i should go about this: I create mesh in gmsh for my
>> problem. The output of node coordinates, and connectivity which i use via
>> DMcreateFromcelllist to create a DM. In gmsh i also assign physical ids to
>> blokcs for region which i need to use for assigning material properties,
>> boundary conditions. How do i include this information into DMPlex ?
>>
>
> You use DMLabels. You can look at the implementation I use to read
> ExodusII files in plexexodusii.c
>
> We have recently converted the repository to Git. If you clone the new
> repository, and checkout the 'next'
> branch, you will get my fix. If you want to see the latest DMPlex
> development, I use the branch knepley/branch.
> If you have any problems, feel free to mail because we are trying to make
> it easy. There are directions online at
> https://bitbucket.org/petsc/petsc/wiki/Home.
>
> I understood how to create a Petscsection for Feild data layout. Now i
>> need to be able to access some auxilary data which is usually mesh positon
>> dependent but given information.
>>
>
> You can just create another one for this. I would make another DM using
> DMPlexClone() and set the
> PetscSection for the aux data as the default on that one.
>
>   Thanks,
>
>      Matt
>
>
>> I have design my code interface such that the user needs to write the
>> linear and blinear form with the DM, cell and basis functions as input. All
>> the data dof and aux data is to be access via DM
>>
>> Please give me some pointers, i will digg to learn more.
>>
>> Thanks
>> Reddy
>>
>> On Wed, Mar 6, 2013 at 4:51 AM, Matthew Knepley <knepley at gmail.com>wrote:
>>
>>> On Wed, Mar 6, 2013 at 2:43 AM, Dharmendar Reddy <
>>> dharmareddy84 at gmail.com> wrote:
>>>
>>>> I think i caught the issues, please see the reply inline below. It is
>>>> not clear to me for which DMPlex i should include petsc.h90 or petsc.h
>>>>
>>>> Still need to fix the DMPlexComputeCellGeometry  though
>>>>
>>>>
>>>> On Tue, Mar 5, 2013 at 9:52 PM, Dharmendar Reddy <
>>>> dharmareddy84 at gmail.com> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>>          I am having trouble with a couple of DMPlex routines.
>>>>>  I was doing tests on various function calls that i may need to write
>>>>> a test Poisson problem.
>>>>>
>>>>> First issue is with DMPlexComputeCellGeometry. For a rectangle cell
>>>>> geometry, I get , v0, J, invJ, and detJ as zero.
>>>>>
>>>>
>>> Geometric primitives of course depend on the way you specify a cell.
>>> Simplicies are nice in
>>> that you can only change the orientation, but hexes are harder. I
>>> specify quads so that the
>>> vertices go counter-clockwise around the boundary. Do you do this? If
>>> so, can you send
>>> a small example test that I can add to PETSc.
>>>
>>>
>>>> DMPlexGetConeSize gives run time error
>>>>>
>>>>>   I had to include petsc.h90 to fix this.
>>>>
>>>
>>> I have fixed the manpage documentation to reflect this.
>>>
>>>
>>>>
>>>> DMPlexVecGetClosure gives runtime error, Should not this call be
>>>>> DMPlexVecGetClosureF90 ? is there such interface ? I remember doing a
>>>>> procedure like VecGetArrayF90 and VecRestoreArrayF90 when i had to pass
>>>>> pointer which need to be restored.
>>>>>
>>>>>   Looks like there is an inconsistency in interface defined on
>>>> petsc-dev manual page. and the interface defined in
>>>> finclude/ftn-custom/petscdmplex.h90
>>>> Fortran interface does not have the csize parameter defined below
>>>>
>>>> PetscErrorCode DMPlexVecGetClosure(DM dm, PetscSection section, Vec v, PetscInt point, PetscInt *csize, const PetscScalar *values[])
>>>>
>>>> I have noted this on the manpage.
>>>
>>> Did you look at src/dm/impls/plex/examples/tests/ex2f90.F? It tests many
>>> of these operations.
>>>
>>>   Thanks,
>>>
>>>      Matt
>>>
>>>
>>>>
>>>>
>>>> I have attached test case with the make file and error.log. Please have
>>>>> a look at it.
>>>>> you need to run:
>>>>> make all debug=0
>>>>> ./testDMView
>>>>>
>>>>> Also, I have trouble compiling the code with debug=1 which uses petsc
>>>>> configured in debug mode everything else being same (you can see the
>>>>> configure options in the error.log).
>>>>> I get this error message:
>>>>> login1$ make all debug=1
>>>>> make: *** /home1/00924/Reddy135/LocalApps/petsc-dev/mpi_rScalar: Is a
>>>>> directory.  Stop
>>>>> .
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Mar 5, 2013 at 9:22 AM, Matthew Knepley <knepley at gmail.com>wrote:
>>>>>
>>>>>> On Tue, Mar 5, 2013 at 10:20 AM, Dharmendar Reddy <
>>>>>> dharmareddy84 at gmail.com> wrote:
>>>>>>
>>>>>>> Thanks, so numDof is basically number of dof per topological entity
>>>>>>> of a cell.  Did i get this right ?
>>>>>>>
>>>>>>
>>>>>> Yes, dof per field per topological entity (sieve point depth).
>>>>>>
>>>>>>    Matt
>>>>>>
>>>>>>
>>>>>>> +!     Let u be defined on vertices
>>>>>>>
>>>>>>>  +      numDof(0*(dim+1)+1)     = 1 (should not be number of nodes)
>>>>>>>
>>>>>>>  +!     Let v be defined on cells
>>>>>>>
>>>>>>>  +      numDof(1*(dim+1)+dim+1) = dim
>>>>>>>
>>>>>>>  +!     Let v be defined on faces
>>>>>>>
>>>>>>>  +      numDof(2*(dim+1)+dim)   = dim-1 (similarly, should not be number of faces time (dim-1))
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Mar 5, 2013 at 9:06 AM, Matthew Knepley <knepley at gmail.com>wrote:
>>>>>>>
>>>>>>>> On Tue, Mar 5, 2013 at 2:18 AM, Dharmendar Reddy <
>>>>>>>> dharmareddy84 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>>          Trying to understand the DMPlexCreateSection first. I
>>>>>>>>> have created a test case, can you please have a look at it? Actually the
>>>>>>>>> code has a link error on my system with petsc-dev.  I used
>>>>>>>>> DMPlexeCreateBoxMesh to create the mesh. Looks like there is no Fortran
>>>>>>>>> interface to that function. If i comment out the dmplexcreateboxmesh. It
>>>>>>>>> does create and executable.
>>>>>>>>>
>>>>>>>>
>>>>>>>> I have now pushed your example, slightly changed, to the repository:
>>>>>>>>
>>>>>>>>   src/dm/impls/plex/examples/tutorials/ex1.c/ex1f90.F
>>>>>>>>
>>>>>>>> and you can run with -dim 2 or -dim 3.
>>>>>>>>
>>>>>>>>   Thanks,
>>>>>>>>
>>>>>>>>      Matt
>>>>>>>>
>>>>>>>>
>>>>>>>>> petscDMTest_v2.o: In function `MAIN__':
>>>>>>>>> petscDMTest_v2.F90:(.text+0x9b): undefined reference to
>>>>>>>>> `dmplexcreateboxmesh_'
>>>>>>>>> make: [testDMMeshv2] Error 1 (ignored)
>>>>>>>>>
>>>>>>>>> Also, If include finclude/petsc.h90 instead of finclude/petsch.h i
>>>>>>>>> get compile error :
>>>>>>>>>
>>>>>>>>> petscDMTest_v2.F90(73): error #6691: A pointer dummy argument may
>>>>>>>>> only be argument a
>>>>>>>>> ssociated with a pointer.   [NUMCOMP]
>>>>>>>>>   call DMPlexCreateSection(dmMesh, topologyDim, numField, numComp,
>>>>>>>>> numDof, &
>>>>>>>>> ----------------------------------------------------------^
>>>>>>>>> petscDMTest_v2.F90(73): error #6691: A pointer dummy argument may
>>>>>>>>> only be argument a
>>>>>>>>> ssociated with a pointer.   [NUMDOF]
>>>>>>>>>   call DMPlexCreateSection(dmMesh, topologyDim, numField, numComp,
>>>>>>>>> numDof, &
>>>>>>>>>
>>>>>>>>> -------------------------------------------------------------------^
>>>>>>>>> petscDMTest_v2.F90(74): error #6691: A pointer dummy argument may
>>>>>>>>> only be argument a
>>>>>>>>> ssociated with a pointer.   [BCFIELD]
>>>>>>>>>                            numBC, bcField, bcPointIS,section,ierr)
>>>>>>>>> ----------------------------------^
>>>>>>>>> petscDMTest_v2.F90(74): error #6691: A pointer dummy argument may
>>>>>>>>> only be argument a
>>>>>>>>> ssociated with a pointer.   [BCPOINTIS]
>>>>>>>>>                            numBC, bcField, bcPointIS,section,ierr)
>>>>>>>>> -------------------------------------------^
>>>>>>>>>
>>>>>>>>> Please have a look at the attached test case and Makefile
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Mar 4, 2013 at 7:39 PM, Matthew Knepley <knepley at gmail.com
>>>>>>>>> > wrote:
>>>>>>>>>
>>>>>>>>>> On Mon, Mar 4, 2013 at 7:50 PM, Dharmendar Reddy <
>>>>>>>>>> dharmareddy84 at gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hello,
>>>>>>>>>>>          Is there a DMPlex based fortran example for solving a
>>>>>>>>>>> pde such as laplace ? Even a c example will do. I am not able to understand
>>>>>>>>>>> the terminology of chart, cone etc. Is there a paper or user guide to learn
>>>>>>>>>>> more about the definitions of terms such as chart cone stratum ? I remember
>>>>>>>>>>> reading a presentation file by mathew about sieve. Is there a newer
>>>>>>>>>>> tutorial with terminology mapped to the new DMPlex/DMMesh functions.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> There is a fully worked out Stokes example (SNES ex62) and a
>>>>>>>>>> Finite Volume example (TS ex11),
>>>>>>>>>> and there are a few tests. You should not need much of that stuff
>>>>>>>>>> for defining a problem. I am
>>>>>>>>>> writing up a paper about ex11 right now. There is a short manual
>>>>>>>>>> section on unstructured grids as well.
>>>>>>>>>>
>>>>>>>>>> I think the key thing to understand is how to define a data
>>>>>>>>>> layout over the mesh using a PetscSection.
>>>>>>>>>> Once that is done, all the DM functions work as normal, and the
>>>>>>>>>> last hard part is coding your residual
>>>>>>>>>> loop. I have support for FEM schemes, but its undocumented and
>>>>>>>>>> slightly complex in order to allow
>>>>>>>>>> GPU assembly, so you may be more comfortable with your own
>>>>>>>>>> element loop to start.
>>>>>>>>>>
>>>>>>>>>>   Thanks,
>>>>>>>>>>
>>>>>>>>>>      Matt
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Thanks
>>>>>>>>>>> Reddy
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> -----------------------------------------------------
>>>>>>>>>>> Dharmendar Reddy Palle
>>>>>>>>>>> Graduate Student
>>>>>>>>>>> Microelectronics Research center,
>>>>>>>>>>> University of Texas at Austin,
>>>>>>>>>>> 10100 Burnet Road, Bldg. 160
>>>>>>>>>>> MER 2.608F, TX 78758-4445
>>>>>>>>>>> e-mail: dharmareddy84 at gmail.com
>>>>>>>>>>> Phone: +1-512-350-9082
>>>>>>>>>>> United States of America.
>>>>>>>>>>> Homepage: https://webspace.utexas.edu/~dpr342
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> 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
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> -----------------------------------------------------
>>>>>>>>> Dharmendar Reddy Palle
>>>>>>>>> Graduate Student
>>>>>>>>> Microelectronics Research center,
>>>>>>>>> University of Texas at Austin,
>>>>>>>>> 10100 Burnet Road, Bldg. 160
>>>>>>>>> MER 2.608F, TX 78758-4445
>>>>>>>>> e-mail: dharmareddy84 at gmail.com
>>>>>>>>> Phone: +1-512-350-9082
>>>>>>>>> United States of America.
>>>>>>>>> Homepage: https://webspace.utexas.edu/~dpr342
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> -----------------------------------------------------
>>>>>>> Dharmendar Reddy Palle
>>>>>>> Graduate Student
>>>>>>> Microelectronics Research center,
>>>>>>> University of Texas at Austin,
>>>>>>> 10100 Burnet Road, Bldg. 160
>>>>>>> MER 2.608F, TX 78758-4445
>>>>>>> e-mail: dharmareddy84 at gmail.com
>>>>>>> Phone: +1-512-350-9082
>>>>>>> United States of America.
>>>>>>> Homepage: https://webspace.utexas.edu/~dpr342
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> -----------------------------------------------------
>>>>> Dharmendar Reddy Palle
>>>>> Graduate Student
>>>>> Microelectronics Research center,
>>>>> University of Texas at Austin,
>>>>> 10100 Burnet Road, Bldg. 160
>>>>> MER 2.608F, TX 78758-4445
>>>>> e-mail: dharmareddy84 at gmail.com
>>>>> Phone: +1-512-350-9082
>>>>> United States of America.
>>>>> Homepage: https://webspace.utexas.edu/~dpr342
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> -----------------------------------------------------
>>>> Dharmendar Reddy Palle
>>>> Graduate Student
>>>> Microelectronics Research center,
>>>> University of Texas at Austin,
>>>> 10100 Burnet Road, Bldg. 160
>>>> MER 2.608F, TX 78758-4445
>>>> e-mail: dharmareddy84 at gmail.com
>>>> Phone: +1-512-350-9082
>>>> United States of America.
>>>> Homepage: https://webspace.utexas.edu/~dpr342
>>>>
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>>
>>
>> --
>> -----------------------------------------------------
>> Dharmendar Reddy Palle
>> Graduate Student
>> Microelectronics Research center,
>> University of Texas at Austin,
>> 10100 Burnet Road, Bldg. 160
>> MER 2.608F, TX 78758-4445
>> e-mail: dharmareddy84 at gmail.com
>> Phone: +1-512-350-9082
>> United States of America.
>> Homepage: https://webspace.utexas.edu/~dpr342
>>
>
>
>
> --
> 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
>



-- 
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/20130313/5b494b39/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testDMView.F90
Type: application/octet-stream
Size: 8315 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130313/5b494b39/attachment-0001.obj>


More information about the petsc-users mailing list