[petsc-users] DMPlexProjectFunction and Boundary Conditions

Dharmendar Reddy dharmareddy84 at gmail.com
Wed Apr 3 11:09:10 CDT 2013


On Wed, Apr 3, 2013 at 10:41 AM, Matthew Knepley <knepley at gmail.com> wrote:

> On Wed, Apr 3, 2013 at 11:04 PM, Dharmendar Reddy <dharmareddy84 at gmail.com
> > wrote:
>
>> Hello,
>>         I see that in DMPlexComputeResidualFEM boundary conditions are
>> applied using DMPlexProjectFunctionLocal. I was wondering why is there a
>> loop over all local vertex Ids and a call to
>> evaluation function on line 241 below. If i am not wrong, i can see that
>> VecSetValuesSection is only to the points indicated as boundary points in
>> DMPlexCreatSection.  Should one call lines 235:242 only if v is constrained
>> node ? Also, should the user provide functions for all components of all
>> fields, is there a way to update add value of only the field that is
>> constrained ?
>>
>> 234:   for (v = vStart; v < vEnd; ++v) {235:     PetscInt <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscInt.html#PetscInt> dof, off;
>> 237:     PetscSectionGetDof <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/IS/PetscSectionGetDof.html#PetscSectionGetDof>(cSection, v, &dof);238:     PetscSectionGetOffset <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/IS/PetscSectionGetOffset.html#PetscSectionGetOffset>(cSection, v, &off);239:     if (dof > dim) SETERRQ2 <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/SETERRQ2.html#SETERRQ2>(PetscObjectComm <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscObjectComm.html#PetscObjectComm>((PetscObject <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscObject.html#PetscObject>)dm), PETSC_ERR_ARG_WRONG, "Cannot have more coordinates %d then dimensions %d", dof, dim);240:     for (d = 0; d < dof; ++d) coords[d] = PetscRealPart(cArray[off+d]);241:     for (c = 0; c < numComp; ++c) values[c] = (*funcs[c])(coords);242:     VecSetValuesSection <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Vec/VecSetValuesSection.html#VecSetValuesSection>(localX, section, v, values, mode);243:   }
>>
>> ProjectFunction() just implements \int_\Omega v f(x). If you really don't
> want to add a no-op function, I can
> check for NULL, but I think that is slower in the inner loop.
>
> Hello,

I do not know how to pass Array of functions in Fortran. At this point i am
not that worried about performance, but my understanding was that
ProjectFunctionLocal along with fem.bcFuns was used set boundary conditions
in DMPlexComputeResidualFEM.

I think i miss understood the code then. How do i use the bcFields and
bcPoints information used to create defualtSection to set boundary
conditions ?

I was thinking VecSetValuesSection with mode=Insert_BC_values was updating
the field values on the points indicated as boundary.



>    Matt
>
>
>
>> --
>> -----------------------------------------------------
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130403/3008f7c6/attachment-0001.html>


More information about the petsc-users mailing list