## libmesh-users

 [Libmesh-users] Evaluating FE at arbitrary location From: Praveen C - 2013-08-22 13:59:04 ```Hello I want to use the FE space which is a discontinuous space of polynomials. Suppose I am at element "elem" and let nbr_elem = neighbour of elem I want to evaluate the shape functions of nbr_elem at the quadrature points of elem. Is this possible and how can I do it. I suppose I would have to do something like const std::vector& q_point = fe->get_xyz(); for ( ; el != end_el; ++el) { const Elem* elem = *el; fe->reinit(elem); // get iterator for neighbour: nbr_elem fe_nbr->reinit(nbr_elem); I want to evaluate fe_nbr at q_point but do not know how to do this. Thanks praveen ```
 Re: [Libmesh-users] Evaluating FE at arbitrary location From: Roy Stogner - 2013-08-22 14:16:21 ```On Thu, 22 Aug 2013, Praveen C wrote: > I want to evaluate the shape functions of nbr_elem at the quadrature points > of elem. I assume you mean just quadrature points on their shared side. > Is this possible and how can I do it. This is done in many places in the library to integrate jumps across faces. Perhaps the most applicable to your case would be the DG example, miscellaneous_ex5. --- Roy ```
 Re: [Libmesh-users] Evaluating FE at arbitrary location From: Roy Stogner - 2013-08-22 14:37:08 ```On Thu, 22 Aug 2013, Praveen C wrote: > No, not just on the shared face, but in the interior also. In that case, it can't be done even in theory with most elements. Interiors of elements shouldn't overlap, and most element shape functions aren't always well-defined outside their own interior. In particular, it's easy to come up with valid meshes where the master->physical element transformation's Jacobian is invertible on the element interior but not outside the element; in that case just trying to map quadrature points from one master element to the other would necessarily fail. The XYZ bases theoretically don't need to use the master->physical element transformation, so you could still hypothetically make this work by avoiding that entirely. You'd first have the easy-but-tedious task of writing your own compatibly ordered FEXYZ reimplementation, since the FE::reinit API in libMesh can take a list of xi-eta-zeta points but not a list of x-y-z points. More challenging, you'd also have to invent your own custom quadrature rule, since ours are defined on the master elements and then transformed to physical space. --- Roy ```
 Re: [Libmesh-users] Evaluating FE at arbitrary location From: Roy Stogner - 2013-08-22 16:09:29 ```Please hit "Reply to all" in the future - that way questions and answers go out to the mailing list and get archived for others too. On Thu, 22 Aug 2013, Praveen C wrote: > I was looking at some functions in XYZ like this > http://libmesh.sourceforge.net/doxygen/fe__xyz__shape__1D_8C_source.php > > It seemed like I can evaluate the basis function at any xyz location. I thought I will get the physical coordinates of the quadrature point on > "elem" and evaluate basis function on "nbr_elem" at these physical coordinates. Is this not possible ? Actually, it looks like you're right! Every other shape(), shape_deriv(), etc. implementation takes master space coordinates, but it looks like XYZ takes physical space coordinates. I'd call that an atrociously bad design (in particular it means that all our solution projection code is probably *broken* on XYZ elements...) but if it works for your case that's a nice silver lining. And yes, as long as you're using elem to generate the quadrature points interior to elem then the inverse mapping issues I raised before probably won't be a problem for you. --- Roy ```