[petsc-users] DMPlexProjectFunction and Boundary Conditions
Matthew Knepley
knepley at gmail.com
Wed Apr 3 10:41:23 CDT 2013
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.
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130404/6252cf30/attachment.html>
More information about the petsc-users
mailing list