## Re: [Libmesh-users] a simple question about ex3

 Re: [Libmesh-users] a simple question about ex3 From: Geordie McBain - 2009-10-25 23:44:34 ```On Mon, Oct 26, 2009 at 8:09 AM, Yujie wrote: > Dear LibMesh Developers, > > Regarding the third example (http://libmesh.sourceforge.net/ex3.php), my > question is as follows: > > in assemble_poission() function, > > for each element, we have > " > for (unsigned int i=0; i Fe(i) += JxW[qp]*fxy*phi[i][qp]; > " > for each boundary side, we have correspondingly > " > for (unsigned int i=0; i Fe(i) += JxW_face[qp]*penalty*value*phi_face[i][qp]; > " > Assuming that we use tetrahedral element and linear Lagrange shape function, > in this case, for an element, there are 4 vertices, that is i=0, 1, 2, 3. > for a boundary side, how to guarantee the vertices (i=0, 1, 2) on the > boundary? As I understand it, this guarantee isn't required as the triangular boundary elements phi_face[] are different to the tetrahedral domain elements phi[]. ```

 [Libmesh-users] a simple question about ex3 From: Yujie - 2009-10-25 21:09:47 ```Dear LibMesh Developers, Regarding the third example (http://libmesh.sourceforge.net/ex3.php), my question is as follows: in assemble_poission() function, for each element, we have " for (unsigned int i=0; i
 Re: [Libmesh-users] a simple question about ex3 From: Geordie McBain - 2009-10-25 23:44:34 ```On Mon, Oct 26, 2009 at 8:09 AM, Yujie wrote: > Dear LibMesh Developers, > > Regarding the third example (http://libmesh.sourceforge.net/ex3.php), my > question is as follows: > > in assemble_poission() function, > > for each element, we have > " > for (unsigned int i=0; i Fe(i) += JxW[qp]*fxy*phi[i][qp]; > " > for each boundary side, we have correspondingly > " > for (unsigned int i=0; i Fe(i) += JxW_face[qp]*penalty*value*phi_face[i][qp]; > " > Assuming that we use tetrahedral element and linear Lagrange shape function, > in this case, for an element, there are 4 vertices, that is i=0, 1, 2, 3. > for a boundary side, how to guarantee the vertices (i=0, 1, 2) on the > boundary? As I understand it, this guarantee isn't required as the triangular boundary elements phi_face[] are different to the tetrahedral domain elements phi[]. ```
 Re: [Libmesh-users] a simple question about ex3 From: Roy Stogner - 2009-10-26 00:35:35 ```On Sun, 25 Oct 2009, Yujie wrote: > for each element, we have > " > for (unsigned int i=0; i Fe(i) += JxW[qp]*fxy*phi[i][qp]; > " > for each boundary side, we have correspondingly > " > for (unsigned int i=0; i Fe(i) += JxW_face[qp]*penalty*value*phi_face[i][qp]; > " > Assuming that we use tetrahedral element and linear Lagrange shape function, > in this case, for an element, there are 4 vertices, that is i=0, 1, 2, 3. > for a boundary side, how to guarantee the vertices (i=0, 1, 2) on the > boundary? Thanks a lot. Simple: we don't guarantee that i is a boundary vertex. In fact, that would be an easy source of error when integrating Neumann or Robin type boundary conditions, where the interior vertices affect the gradients being integrated and you can't leave them out. But for Dirichlet conditions, the terms where i is an interior vertex don't matter, because phi_face is evaluated on boundary sides and we have phi_face[i_interior][qp] = 0. --- Roy ```
 Re: [Libmesh-users] a simple question about ex3 From: Yujie - 2009-10-26 00:48:22 ```Thanks, Roy. It means that one needs to judge which triangle (which three vertices) of an element is on boundary for Neumann or Robin type boundary conditions? Regards, Yujie On Sun, Oct 25, 2009 at 7:35 PM, Roy Stogner wrote: > > On Sun, 25 Oct 2009, Yujie wrote: > > for each element, we have >> " >> for (unsigned int i=0; i> Fe(i) += JxW[qp]*fxy*phi[i][qp]; >> " >> for each boundary side, we have correspondingly >> " >> for (unsigned int i=0; i> Fe(i) += JxW_face[qp]*penalty*value*phi_face[i][qp]; >> " >> Assuming that we use tetrahedral element and linear Lagrange shape >> function, >> in this case, for an element, there are 4 vertices, that is i=0, 1, 2, 3. >> for a boundary side, how to guarantee the vertices (i=0, 1, 2) on the >> boundary? Thanks a lot. >> > > Simple: we don't guarantee that i is a boundary vertex. In fact, > that would be an easy source of error when integrating Neumann or > Robin type boundary conditions, where the interior vertices affect the > gradients being integrated and you can't leave them out. > > But for Dirichlet conditions, the terms where i is an interior vertex > don't matter, because phi_face is evaluated on boundary sides and > we have phi_face[i_interior][qp] = 0. > --- > Roy > ```
 Re: [Libmesh-users] a simple question about ex3 From: Roy Stogner - 2009-10-26 01:18:08 ```On Sun, 25 Oct 2009, Yujie wrote: > Thanks, Roy. It means that one needs to judge which triangle (which three > vertices) of an element is on boundary for Neumann or Robin type boundary > conditions?   You need to know which side is on the boundary (elem->side(s) == NULL in libMesh) for every boundary condition, but you don't need to explicitly know which nodes are on the side for any boundary conditions. --- Roy```
 Re: [Libmesh-users] a simple question about ex3 From: Yujie - 2009-10-26 01:55:48 ```According the index of nodes of the tetrahedral element, if one knows which side is on the boundary, it means that he can know which nodes is not on the boundary side. However, how to know the corresponding relationship between the nodes of the boundary side and "i" of Fe(i)? Thanks. Regards, Yujie On Sun, Oct 25, 2009 at 8:17 PM, Roy Stogner wrote: > > On Sun, 25 Oct 2009, Yujie wrote: > > Thanks, Roy. It means that one needs to judge which triangle (which three >> vertices) of an element is on boundary for Neumann or Robin type boundary >> conditions? >> > > You need to know which side is on the boundary (elem->side(s) == NULL > in libMesh) for every boundary condition, but you don't need to > explicitly know which nodes are on the side for any boundary > conditions. > --- > Roy ```
 Re: [Libmesh-users] a simple question about ex3 From: Yujie - 2009-10-26 01:56:58 ```Dear Roy, " Simple: we don't guarantee that i is a boundary vertex. In fact, that would be an easy source of error when integrating Neumann or Robin type boundary conditions, where the interior vertices affect the gradients being integrated and you can't leave them out." Whether is the error avoided? If it is, how to do it? Thanks a lot. Regards, Yujie On Sun, Oct 25, 2009 at 7:35 PM, Roy Stogner wrote: > > On Sun, 25 Oct 2009, Yujie wrote: > > for each element, we have >> " >> for (unsigned int i=0; i> Fe(i) += JxW[qp]*fxy*phi[i][qp]; >> " >> for each boundary side, we have correspondingly >> " >> for (unsigned int i=0; i> Fe(i) += JxW_face[qp]*penalty*value*phi_face[i][qp]; >> " >> Assuming that we use tetrahedral element and linear Lagrange shape >> function, >> in this case, for an element, there are 4 vertices, that is i=0, 1, 2, 3. >> for a boundary side, how to guarantee the vertices (i=0, 1, 2) on the >> boundary? Thanks a lot. >> > > Simple: we don't guarantee that i is a boundary vertex. In fact, > that would be an easy source of error when integrating Neumann or > Robin type boundary conditions, where the interior vertices affect the > gradients being integrated and you can't leave them out. > > But for Dirichlet conditions, the terms where i is an interior vertex > don't matter, because phi_face is evaluated on boundary sides and > we have phi_face[i_interior][qp] = 0. > --- > Roy > ```
 Re: [Libmesh-users] a simple question about ex3 From: Derek Gaston - 2009-10-26 14:34:49 ```Let me take a whack at this... Yujie.... there is no error involved.... the statements in example 3 will work for any type of element. The trick is that example 3 is using a penalty equation to enforce a Dirichlet BC. It does NOT enforce the Dirichlet BC in the traditional way of modifying values at nodes. Instead... we are _integrating_ a penalty condition over the boundary such that when that penalty is taken into account the solution values on that boundary have no choice other than to take on the values you are trying to enforce. It's the fact that we are _integrating_ this condition that allows us to not care about element type. For every element type we know how to integrate something over the boundary... As Roy mentioned... for most shape functions (including Lagrange) _phi_face corresponding to an interior degree of freedom will be zero. This means that those shape functions don't have any support on the boundary and therefore their associated degrees of freedom aren't involved in the selection of values corresponding to the boundary condition.... which means their equations aren't modified by the penalty integration (again because _phi_face is _zero_ for those shape functions). Hope that helps, Derek On Oct 25, 2009, at 7:56 PM, Yujie wrote: > Dear Roy, > > " > Simple: we don't guarantee that i is a boundary vertex. In fact, > that would be an easy source of error when integrating Neumann or > Robin type boundary conditions, where the interior vertices affect the > gradients being integrated and you can't leave them out." > > Whether is the error avoided? If it is, how to do it? Thanks a lot. > > Regards, > Yujie > > On Sun, Oct 25, 2009 at 7:35 PM, Roy Stogner > wrote: > >> >> On Sun, 25 Oct 2009, Yujie wrote: >> >> for each element, we have >>> " >>> for (unsigned int i=0; i>> Fe(i) += JxW[qp]*fxy*phi[i][qp]; >>> " >>> for each boundary side, we have correspondingly >>> " >>> for (unsigned int i=0; i>> Fe(i) += JxW_face[qp]*penalty*value*phi_face[i][qp]; >>> " >>> Assuming that we use tetrahedral element and linear Lagrange shape >>> function, >>> in this case, for an element, there are 4 vertices, that is i=0, >>> 1, 2, 3. >>> for a boundary side, how to guarantee the vertices (i=0, 1, 2) on >>> the >>> boundary? Thanks a lot. >>> >> >> Simple: we don't guarantee that i is a boundary vertex. In fact, >> that would be an easy source of error when integrating Neumann or >> Robin type boundary conditions, where the interior vertices affect >> the >> gradients being integrated and you can't leave them out. >> >> But for Dirichlet conditions, the terms where i is an interior vertex >> don't matter, because phi_face is evaluated on boundary sides and >> we have phi_face[i_interior][qp] = 0. >> --- >> Roy >> > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@... > https://lists.sourceforge.net/lists/listinfo/libmesh-users ```
 Re: [Libmesh-users] a simple question about ex3 From: Yujie - 2009-10-26 17:44:33 ```Dear Derek, Thank you very much for your detailed explanations. I have understood the basic mechanism. Thanks a lot:). Regards, Yujie On Mon, Oct 26, 2009 at 9:34 AM, Derek Gaston wrote: > Let me take a whack at this... > > Yujie.... there is no error involved.... the statements in example 3 will > work for any type of element. > > The trick is that example 3 is using a penalty equation to enforce a > Dirichlet BC. It does NOT enforce the Dirichlet BC in the traditional way > of modifying values at nodes. Instead... we are _integrating_ a penalty > condition over the boundary such that when that penalty is taken into > account the solution values on that boundary have no choice other than to > take on the values you are trying to enforce. > > It's the fact that we are _integrating_ this condition that allows us to > not care about element type. For every element type we know how to > integrate something over the boundary... > > As Roy mentioned... for most shape functions (including Lagrange) _phi_face > corresponding to an interior degree of freedom will be zero. This means > that those shape functions don't have any support on the boundary and > therefore their associated degrees of freedom aren't involved in the > selection of values corresponding to the boundary condition.... which means > their equations aren't modified by the penalty integration (again because > _phi_face is _zero_ for those shape functions). > > Hope that helps, > Derek > > > On Oct 25, 2009, at 7:56 PM, Yujie wrote: > > Dear Roy, >> >> " >> Simple: we don't guarantee that i is a boundary vertex. In fact, >> that would be an easy source of error when integrating Neumann or >> Robin type boundary conditions, where the interior vertices affect the >> gradients being integrated and you can't leave them out." >> >> Whether is the error avoided? If it is, how to do it? Thanks a lot. >> >> Regards, >> Yujie >> >> On Sun, Oct 25, 2009 at 7:35 PM, Roy Stogner > >wrote: >> >> >>> On Sun, 25 Oct 2009, Yujie wrote: >>> >>> for each element, we have >>> >>>> " >>>> for (unsigned int i=0; i>>> Fe(i) += JxW[qp]*fxy*phi[i][qp]; >>>> " >>>> for each boundary side, we have correspondingly >>>> " >>>> for (unsigned int i=0; i>>> Fe(i) += JxW_face[qp]*penalty*value*phi_face[i][qp]; >>>> " >>>> Assuming that we use tetrahedral element and linear Lagrange shape >>>> function, >>>> in this case, for an element, there are 4 vertices, that is i=0, 1, 2, >>>> 3. >>>> for a boundary side, how to guarantee the vertices (i=0, 1, 2) on the >>>> boundary? Thanks a lot. >>>> >>>> >>> Simple: we don't guarantee that i is a boundary vertex. In fact, >>> that would be an easy source of error when integrating Neumann or >>> Robin type boundary conditions, where the interior vertices affect the >>> gradients being integrated and you can't leave them out. >>> >>> But for Dirichlet conditions, the terms where i is an interior vertex >>> don't matter, because phi_face is evaluated on boundary sides and >>> we have phi_face[i_interior][qp] = 0. >>> --- >>> Roy >>> >>> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart your >> developing skills, take BlackBerry mobile applications to market and stay >> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference >> _______________________________________________ >> Libmesh-users mailing list >> Libmesh-users@... >> https://lists.sourceforge.net/lists/listinfo/libmesh-users >> > > ```