<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jan 10, 2014 at 3:09 PM, Dharmendar Reddy <span dir="ltr"><<a href="mailto:dharmareddy84@gmail.com" target="_blank">dharmareddy84@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Well, I was wondering, if i could use:<br>
<br>
DMPlexCreateSectionBCDof (1) and DMPlexCreateSectionBCIndicesAll (2)<br></blockquote><div><br></div><div>I would just do it by hand first, and then maybe we can abstract it.</div><div><br></div><div> Matt</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
as is done in DMPLexCreateSection<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-current/src/dm/impls/plex/plex.c.html#DMPlexCreateSection" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/src/dm/impls/plex/plex.c.html#DMPlexCreateSection</a><br>
<br>
Since I am trying to setup section for a problem with different number<br>
of fields in different domains (regions). I redid the code for initial<br>
section creation.<br>
<br>
So the concern is if i am to setup BC's for the above scenario, is<br>
the code going to be different from the sequence of calls inside (1)<br>
and (2), once the initial section is defined.<br>
<br>
Thanks<br>
Reddy<br>
<br>
Thanks<br>
<span class="HOEnZb"><font color="#888888">Reddy<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Fri, Jan 10, 2014 at 2:37 PM, Brad Aagaard <<a href="mailto:baagaard@usgs.gov">baagaard@usgs.gov</a>> wrote:<br>
> On 01/10/2014 11:19 AM, Dharmendar Reddy wrote:<br>
>><br>
>> Hello,<br>
>> I was able to create the petsc section as per your advice.<br>
>>><br>
>>> DMPlexSetChart()<br>
>>> <loop over region 1><br>
>>> DMPlexSetDof() and DMPlexSetFieldDof()<br>
>>> <loop over region 2><br>
>>> DMPlexSetDof() and DMPlexSetFieldDof()<br>
>><br>
>><br>
>> I could program the code upto this step.<br>
>><br>
>> ! Create Section<br>
>> call PetscSectionCreate(comm, section, ierr)<br>
>> ! This call sets the number of fields in the section. Default number<br>
>> of compents per field is 1<br>
>> call PetscSectionSetNumFields(section, numField, ierr)<br>
>> ! Set the number of componets per field<br>
>> do fid=0,numField-1<br>
>> call PetscSectionSetFieldComponents(section, fid, numComp(fid+1),<br>
>> ierr)<br>
>> end do<br>
>> ! Set the chart for section<br>
>> call DMPlexGetChart(meshDM, cellIdStart, cellIdEnd, ierr)<br>
>> call PetscSectionSetChart(section, cellIdStart, cellIdEnd, ierr)<br>
>> print*,'Sucessfully set chart',cellIdStart,cellIdEnd<br>
>> rgnLabel = "region"<br>
>> call DMPlexGetLabelIdIS(meshDM,rgnLabel,regionIS,ierr)<br>
>> call ISView(regionIS,PETSC_VIEWER_STDOUT_SELF,ierr)<br>
>> call ISGetIndicesF90(regionIS, regionId, ierr)<br>
>> print*, 'region', regionId<br>
>> do jc=1,size(regionId) ! Loop Over region1<br>
>> rgnId = regionId(jc)<br>
>> call DMPlexGetStratumIS(meshDM, "region",rgnId, regionCellIS, ierr)<br>
>> !print*,'Number of cells in region',rgnId<br>
>> call ISGetSize(regionCellIS, numCell, ierr)<br>
>> !print*,'Number of cells in region',rgnId, 'is',numCell<br>
>> call ISGetIndicesF90(regionCellIS, regionCell, ierr)<br>
>> do ic=1,numCell ! Get the cells of this region and loop over Cells<br>
>> cellId = regionCell(ic)<br>
>> ! Get the dimension of the cell<br>
>> call DMPlexGetLabelValue(meshDM, "depth", cellId, cellDim, ierr)<br>
>> do fid=0,numField-1 ! Loop over fields<br>
>> ! Set field only if the field is defined for this region<br>
>> !print*, 'settinf Field<br>
>> for',cellId,cellDim,fid,rgnId,numDof(fid+1,cellDim+1)<br>
>> if(fieldInRegion(fid+1,rgnId)) then<br>
>> call PetscSectionSetFieldDof(section, cellId, fid,<br>
>> numDof(fid+1,cellDim+1), ierr)<br>
>> end if<br>
>> end do<br>
>> call PetscSectionSetDof(section, cellId,<br>
>> numDofTot(cellDim+1,rgnId), ierr)<br>
>> end do<br>
>> call ISRestoreIndicesF90(regionCellIS, regionCell, ierr)<br>
>> end do<br>
>> call ISRestoreIndicesF90(regionIS, regionId, ierr)<br>
>><br>
>><br>
>> Now I need to work on the code for BC. Can you help me with a bit more<br>
>> detail here.<br>
>>><br>
>>> <loop over BC><br>
>>> DMPlexSetConstraintDof() and DMPlexSetFieldConstraintDof()<br>
><br>
><br>
> Use DMPlexSetConstraintDof() to set the number of DOF constrained at each<br>
> point on the BC. DMPlexSetFieldConstraintDof() is used if you have multiple<br>
> fields in a section.<br>
><br>
><br>
>>> DMPlexSetUp()<br>
>>> <loop over BC><br>
>>> DMPlexSetConstraintIndices() and DMPlexSetFieldConstraintIndices()<br>
><br>
><br>
> Use DMPlexSetConstraintIndices() to set the indices of the DOF that are<br>
> constrained.<br>
><br>
> For example, one might constrain the DOF normal and/or tangential to a<br>
> boundary in an elasticity problem. You first set the size for all the<br>
> points, allocate via DMPlexSetUp, and then set the indices for the<br>
> constrained DOF at each point.<br>
><br>
> Regards,<br>
> Brad<br>
><br>
><br>
>> On Thu, Jan 2, 2014 at 9:56 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
>>><br>
>>> On Thu, Jan 2, 2014 at 4:11 AM, Dharmendar Reddy<br>
>>> <<a href="mailto:dharmareddy84@gmail.com">dharmareddy84@gmail.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>><br>
>>>> Hello,<br>
>>>> I am trying to use DMPlexCreateSection from fortran. I was<br>
>>>> able to solve a Poisson equation earlier using DMPlex for handling<br>
>>>> mesh data.<br>
>>>><br>
>>>> Now i need to solve a system of equations: (poisson + continuity<br>
>>>> equations)<br>
>>>><br>
>>>> - div (grad phi) = (C + n) --- (1)<br>
>>>> div (J ) = 0 --------------- (2)<br>
>>>> J = n grad(phi)<br>
>>>> ( C is constant)<br>
>>>> Simulation domain is defined as, rectangular regions 1 and 2 shown<br>
>>>> below.<br>
>>>><br>
>>>> -------------<br>
>>>> | 1 |<br>
>>>> -------------<br>
>>>> | |<br>
>>>> | 2 |<br>
>>>> | |<br>
>>>> --------------<br>
>>>><br>
>>>> Now, equation 1 is defined in region 1 and 2<br>
>>>> and equation 2 is defined only for region 2.<br>
>>>><br>
>>>> How do i setup the section ? DMPlexCreateSection applies the given<br>
>>>> DOF layout per cell to all cells in the mesh.<br>
>>>><br>
>>>> I am not sure if all the function calls inside<br>
>>>> DMPlexCreateSectionIntial and DMPlexCreateSectionBCDof are accessible<br>
>>>> from Fotran.<br>
>>><br>
>>><br>
>>><br>
>>> You don't want them anyway since they apply to the whole domain. The<br>
>>> control<br>
>>> flow could be:<br>
>>><br>
>>> DMPlexSetChart()<br>
>>> <loop over region 1><br>
>>> DMPlexSetDof() and DMPlexSetFieldDof()<br>
>>> <loop over region 2><br>
>>> DMPlexSetDof() and DMPlexSetFieldDof()<br>
>>> <loop over BC><br>
>>> DMPlexSetConstraintDof() and DMPlexSetFieldConstraintDof()<br>
>>> DMPlexSetUp()<br>
>>> <loop over BC><br>
>>> DMPlexSetConstraintIndices() and DMPlexSetFieldConstraintIndices()<br>
>>><br>
>>> We could try and package some of this up if it looks generic.<br>
>>><br>
>>> Thanks,<br>
>>><br>
>>> Matt<br>
>>><br>
>>>><br>
>>>> Thanks<br>
>>>> Reddy<br>
>>>><br>
>>>> --<br>
>>>> -----------------------------------------------------<br>
>>>> Dharmendar Reddy Palle<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> What most experimenters take for granted before they begin their<br>
>>> experiments<br>
>>> is infinitely more interesting than any results to which their<br>
>>> experiments<br>
>>> lead.<br>
>>> -- Norbert Wiener<br>
>><br>
>><br>
>><br>
>><br>
><br>
<br>
<br>
<br>
--<br>
-----------------------------------------------------<br>
Dharmendar Reddy Palle<br>
</div></div><div class="HOEnZb"><div class="h5">Graduate Student<br>
Microelectronics Research center,<br>
University of Texas at Austin,<br>
10100 Burnet Road, Bldg. 160<br>
MER 2.608F, TX 78758-4445<br>
e-mail: <a href="mailto:dharmareddy84@gmail.com">dharmareddy84@gmail.com</a><br>
Phone: <a href="tel:%2B1-512-350-9082" value="+15123509082">+1-512-350-9082</a><br>
United States of America.<br>
Homepage: <a href="https://webspace.utexas.edu/~dpr342" target="_blank">https://webspace.utexas.edu/~dpr342</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>