On Tue, May 15, 2018 at 8:31 AM, Griffith, Boyce Eugene <
boy...@email.unc.edu> wrote:

>
>
> On May 15, 2018, at 10:23 AM, John Peterson <jwpeter...@gmail.com> wrote:
>
>
>
> On Tue, May 15, 2018 at 8:17 AM, Griffith, Boyce Eugene <
> boy...@email.unc.edu> wrote:
>
>>
>>
>> On May 15, 2018, at 10:13 AM, John Peterson <jwpeter...@gmail.com> wrote:
>>
>>
>>
>> On Tue, May 15, 2018 at 5:37 AM, Griffith, Boyce Eugene <
>> boy...@email.unc.edu> wrote:
>>
>>> Folks --
>>>
>>> Is there an easy way in the library to get normal vectors on surface
>>> meshes (e.g. 2D elements in 3D space, 1D elements in 2D space, etc)?  It
>>> seems like most of the support for this assumes that these are only needed
>>> for doing surface integrals on volumetric meshes, but I am sure I am
>>> overlooking something.
>>>
>>
>> The "simplest" way is to build an FE object and only pre-request the
>> normals by calling:
>>
>> const std::vector<Point> & face_normals = fe_face->get_normals();
>>
>>
>> I may be making a blunder here, but this doesn't seem to work if the
>> dimension of the quadrature rule is equal to the dimension of the mesh ---
>> the normals do not appear to be computed.
>>
>
>
> Hmm... yes generally you would use a dim-1 dimensional quadrature rule in
> this context, e.g. the following (from adaptivity_ex4) should work:
>
> std::unique_ptr<FEBase> fe_face (FEBase::build(dim, fe_type));
> std::unique_ptr<QBase> qface(fe_type.default_quadrature_rule(dim-1));
> fe_face->attach_quadrature_rule (qface.get());
> const std::vector<Point> & face_normals = fe_face->get_normals();
> fe_face->reinit(elem, s);
>
>
> I need to integrate on a surface mesh (for instance, a boundary mesh
> extracted from a volumetric mesh --- although it could simply be a surface
> that is not derived from a volumetric mesh) and to get the normals ---
> something like:
>
> std::unique_ptr<FEBase> fe_surface(FEBase::build(dim, fe_type));
> std::unique_ptr<QBase> quad_surface(fe_type.default_quadrature_rule(dim));
> fe_surface->attach_quadrature_rule (quad_surface.get());
> const std::vector<Point> & face_normals = fe_surface->get_normals();
> fe_surface->reinit(elem);
>


I see now what you are saying. Yeah, the normals are only computed during
*side* reinits, since they are outward normals relative to
higher-dimensional element.

So, for a 2D element I would compute them manually by computing dx/d(xi)
\cross dx/d(eta), (those two quantities are available from the FE object to
help you).

-- 
John
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to