From: Vikram Garg <vikramvgarg@ma...>  20100819 15:40:35

Andrew, The point_value and point_gradient functions should do the job. See below for an example of their use. See system.C for the function implementation. These functions currently do not support vectors of points but that should be added. Note that the arguments to the point_value/gradient function are the variable number and Point object. x = number; y = number; Point p(x, y); Number u_p = point_value(0, p); Gradient grad_u_p = point_gradient(0, p); Thanks. On Thu, Aug 19, 2010 at 4:30 AM, < libmeshusersrequest@...> wrote: > Send Libmeshusers mailing list submissions to > libmeshusers@... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/libmeshusers > or, via email, send a message with subject or body 'help' to > libmeshusersrequest@... > > You can reach the person managing the list at > libmeshusersowner@... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Libmeshusers digest..." > > > Today's Topics: > > 1. Re: Periodic BC with adaptive mesh (Roy Stogner) > 2. Interpolating at specific point(s) between nodes. (Andrew Wharmby) > 3. Re: Interpolating at specific point(s) between nodes. > (Derek Gaston) > 4. Re: Interpolating at specific point(s) between nodes. > (Andrew Wharmby) > 5. Re: Interpolating at specific point(s) between nodes. > (Derek Gaston) > 6. Re: Periodic BC with adaptive mesh (Ming Q) > > >  > > Message: 1 > Date: Wed, 18 Aug 2010 19:41:32 0500 (CDT) > From: Roy Stogner <roystgnr@...> > Subject: Re: [Libmeshusers] Periodic BC with adaptive mesh > To: Minq Q <micavn@...> > Cc: libmeshusers@... > MessageID: > <alpine.DEB.2.00.1008181932500.24735@...> > ContentType: TEXT/PLAIN; charset=USASCII; format=flowed > > > On Thu, 19 Aug 2010, Minq Q wrote: > > > I am having a problem when using the periodic BC together with the mesh > > refinement. When one BC is set to refine, the other paired BC is not > > allocated the new nodes as it should. > > That's actually correct  the new node is a hanging node on one side > of the boundary, and shouldn't exist on the other until the element on > the other side is refined. > > > The strange thing is: The first time of the refinement is OK. But > > from the second time the two paired BCs are become different. > > There are currently two issues with combining the periodic BC and the > AMR feature: > > The "level 1 conformity" constraint is not supported across the > boundary. I.e. if you set enforce_level_one to true it will only be > enforced on the mesh interior, not from one side of a periodic > boundary to another. > > The mix of AMR and periodic constraint equations may not be working > correctly. The two features are supposed to be compatible, but when I > wrote the latter I was mostly using one or the other, or at best > running periodic problems where the nonuniform refinement occurred > away from the periodic BC, so I haven't tested it thoroughly. If you > can set up a test case (as simple as possible, please) where the > constraints are coming out wrong, please post the code to the list, > and we can at least see if it's a simple bug/fix. >  > Roy > > > >  > > Message: 2 > Date: Wed, 18 Aug 2010 19:59:12 0500 > From: Andrew Wharmby <awharmby@...> > Subject: [Libmeshusers] Interpolating at specific point(s) between > nodes. > To: libmeshusers@... > MessageID: > <AANLkTikcp_VnFi5=3MCgTSbP2vmgmeXMWEueXjYRaTU7@...> > ContentType: text/plain; charset=ISO88591 > > I've read some discussion these boards on how to go about doing this, but > didn't find any real concrete answer. Is there an easy way of after running > a model, to go back and use the interpolation functions used to approximate > the nodal values to approximate points between the nodes? > > Thanks, > _Andrew_ > > >  > > Message: 3 > Date: Wed, 18 Aug 2010 20:31:53 0600 > From: Derek Gaston <friedmud@...> > Subject: Re: [Libmeshusers] Interpolating at specific point(s) > between nodes. > To: Andrew Wharmby <awharmby@...> > Cc: "libmeshusers@..." > <libmeshusers@...> > MessageID: <2161286881363897123@...> > ContentType: text/plain; charset=ISO88591 > > Andrew, > > There are multiple ways to achieve this... But they are all variations > on the same theme: you have to remember that your finite element > "solution" is really nothing more than coefficients. These > coefficients, when multiplied by their paired shape functions and > added together are the actual solution. > > It just so happens (well not really as they are chosen like that on > purpose) that lagrange shape functions are interpolary at the nodes... > ie at the nodes the value of the function you solved for happens to > correspond to the value of the coefficient associated with the shape > function there... these are the "nodal values" most people refer to. > Note that that is just a property of those particular functions (and > actually are how they are defined / derived). > > So how to get values at non nodal points when using lagrange (or any > other shape functions)? You actually need to evaluate your TRUE > solution... that is: the coefficients multiplied by the shape > functions. With normal finite element formulations that use shape > functions with compact support this amounts to finding the element > that contains the physical point you want to evaluate the solution > at... then summing the local coefficients multiplied by their > respective shape functions evaluated at the physical point. > > Specifically, in libmesh this can be accomplished by looping over the > elements, calling contains_point() on each element then when you have > found the element containing the point you need to reinitialize an FE > object using that element and the physical point inverse mapped into > the reference domain... that will give you your shape functions > evaluated at the physical point... Now loop over the dofs on that > element and multiply the coefficients from the solution vector by each > associated shape function... and sum the results. That will be the > value of the solution at that point. > > Firstly, this is NOT interpolation! This is EVALUATION. This is one > of the large differences between finite elements and other > discretization techniques (like finite difference and finite volume). > In finite elements you are literally solving for a _function_ that > covers the entire domain. In continuous galerkin (like you are > probably using with lagrange shape functions) that function is even > _continuous_ over the entire domain! > > Secondly... If this sounds like a lot of work.... It kind of is. > That's why the MeshFunction object exists... Just initialize it with > your solution and EquationSystems and it will do all of the above for > you... Allowing you to evaluate your solution at any point in the > domain (with some more efficiency than if you tried to do it > yourself). > > Hope that helps! > > Derek > > Sent from my iPad > > On Aug 18, 2010, at 6:59 PM, Andrew Wharmby <awharmby@...> wrote: > > > I've read some discussion these boards on how to go about doing this, but > > didn't find any real concrete answer. Is there an easy way of after > running > > a model, to go back and use the interpolation functions used to > approximate > > the nodal values to approximate points between the nodes? > > > > Thanks, > > _Andrew_ > > >  > > This SF.net email is sponsored by > > > > Make an app they can't live without > > Enter the BlackBerry Developer Challenge > > http://p.sf.net/sfu/RIMdev2dev > > _______________________________________________ > > Libmeshusers mailing list > > Libmeshusers@... > > https://lists.sourceforge.net/lists/listinfo/libmeshusers > > > >  > > Message: 4 > Date: Wed, 18 Aug 2010 23:11:00 0500 > From: Andrew Wharmby <awharmby@...> > Subject: Re: [Libmeshusers] Interpolating at specific point(s) > between nodes. > To: Derek Gaston <friedmud@...> > Cc: "libmeshusers@..." > <libmeshusers@...> > MessageID: > <AANLkTikAX=1g0QA91j69Ubix6UPYGYK40_iDWuZJys=h@...> > ContentType: text/plain; charset=ISO88591 > > Derek, > > This does indeed clear some of the theory up for me as well as answers my > question on there being an "easy" way to do it. I've located the > documentation regarding the object here: > > http://libmesh.sourceforge.net/doxygen/classlibMesh_1_1MeshFunction.php#a18dc4d4c722e1961fac15b2a337da62a > and > it looks like it does indeed perform all of the tasks you described. Is > there any chance of there being an example where the MeshFunction object is > used? > > Thanks, > _Andrew_ > > On Wed, Aug 18, 2010 at 9:31 PM, Derek Gaston <friedmud@...> wrote: > > > Andrew, > > > > There are multiple ways to achieve this... But they are all variations > > on the same theme: you have to remember that your finite element > > "solution" is really nothing more than coefficients. These > > coefficients, when multiplied by their paired shape functions and > > added together are the actual solution. > > > > It just so happens (well not really as they are chosen like that on > > purpose) that lagrange shape functions are interpolary at the nodes... > > ie at the nodes the value of the function you solved for happens to > > correspond to the value of the coefficient associated with the shape > > function there... these are the "nodal values" most people refer to. > > Note that that is just a property of those particular functions (and > > actually are how they are defined / derived). > > > > So how to get values at non nodal points when using lagrange (or any > > other shape functions)? You actually need to evaluate your TRUE > > solution... that is: the coefficients multiplied by the shape > > functions. With normal finite element formulations that use shape > > functions with compact support this amounts to finding the element > > that contains the physical point you want to evaluate the solution > > at... then summing the local coefficients multiplied by their > > respective shape functions evaluated at the physical point. > > > > Specifically, in libmesh this can be accomplished by looping over the > > elements, calling contains_point() on each element then when you have > > found the element containing the point you need to reinitialize an FE > > object using that element and the physical point inverse mapped into > > the reference domain... that will give you your shape functions > > evaluated at the physical point... Now loop over the dofs on that > > element and multiply the coefficients from the solution vector by each > > associated shape function... and sum the results. That will be the > > value of the solution at that point. > > > > Firstly, this is NOT interpolation! This is EVALUATION. This is one > > of the large differences between finite elements and other > > discretization techniques (like finite difference and finite volume). > > In finite elements you are literally solving for a _function_ that > > covers the entire domain. In continuous galerkin (like you are > > probably using with lagrange shape functions) that function is even > > _continuous_ over the entire domain! > > > > Secondly... If this sounds like a lot of work.... It kind of is. > > That's why the MeshFunction object exists... Just initialize it with > > your solution and EquationSystems and it will do all of the above for > > you... Allowing you to evaluate your solution at any point in the > > domain (with some more efficiency than if you tried to do it > > yourself). > > > > Hope that helps! > > > > Derek > > > > Sent from my iPad > > > > On Aug 18, 2010, at 6:59 PM, Andrew Wharmby <awharmby@...> wrote: > > > > > I've read some discussion these boards on how to go about doing this, > but > > > didn't find any real concrete answer. Is there an easy way of after > > running > > > a model, to go back and use the interpolation functions used to > > approximate > > > the nodal values to approximate points between the nodes? > > > > > > Thanks, > > > _Andrew_ > > > > > >  > > > This SF.net email is sponsored by > > > > > > Make an app they can't live without > > > Enter the BlackBerry Developer Challenge > > > http://p.sf.net/sfu/RIMdev2dev > > > _______________________________________________ > > > Libmeshusers mailing list > > > Libmeshusers@... > > > https://lists.sourceforge.net/lists/listinfo/libmeshusers > > > > >  > > Message: 5 > Date: Wed, 18 Aug 2010 22:55:18 0600 > From: Derek Gaston <friedmud@...> > Subject: Re: [Libmeshusers] Interpolating at specific point(s) > between nodes. > To: Andrew Wharmby <awharmby@...> > Cc: "libmeshusers@..." > <libmeshusers@...> > MessageID: <914001338438821886@...> > ContentType: text/plain; charset=ISO88591 > > I don't believe there is. There probably should be since we get this > question fairly often (which is one reason for my long winded answer... > Because now I can just forward it as a future answer ;) > > It really should just work... Give it a whirl and let us know if you run > into trouble. > > Derek > > Sent from my iPad > > On Aug 18, 2010, at 10:11 PM, Andrew Wharmby <awharmby@...> wrote: > > Derek, > > This does indeed clear some of the theory up for me as well as answers my > question on there being an "easy" way to do it. I've located the > documentation regarding the object here: > > http://libmesh.sourceforge.net/doxygen/classlibMesh_1_1MeshFunction.php#a18dc4d4c722e1961fac15b2a337da62a > and > it looks like it does indeed perform all of the tasks you described. Is > there any chance of there being an example where the MeshFunction object is > used? > > Thanks, > _Andrew_ > > On Wed, Aug 18, 2010 at 9:31 PM, Derek Gaston <friedmud@...> wrote: > > > Andrew, > > > > There are multiple ways to achieve this... But they are all variations > > on the same theme: you have to remember that your finite element > > "solution" is really nothing more than coefficients. These > > coefficients, when multiplied by their paired shape functions and > > added together are the actual solution. > > > > It just so happens (well not really as they are chosen like that on > > purpose) that lagrange shape functions are interpolary at the nodes... > > ie at the nodes the value of the function you solved for happens to > > correspond to the value of the coefficient associated with the shape > > function there... these are the "nodal values" most people refer to. > > Note that that is just a property of those particular functions (and > > actually are how they are defined / derived). > > > > So how to get values at non nodal points when using lagrange (or any > > other shape functions)? You actually need to evaluate your TRUE > > solution... that is: the coefficients multiplied by the shape > > functions. With normal finite element formulations that use shape > > functions with compact support this amounts to finding the element > > that contains the physical point you want to evaluate the solution > > at... then summing the local coefficients multiplied by their > > respective shape functions evaluated at the physical point. > > > > Specifically, in libmesh this can be accomplished by looping over the > > elements, calling contains_point() on each element then when you have > > found the element containing the point you need to reinitialize an FE > > object using that element and the physical point inverse mapped into > > the reference domain... that will give you your shape functions > > evaluated at the physical point... Now loop over the dofs on that > > element and multiply the coefficients from the solution vector by each > > associated shape function... and sum the results. That will be the > > value of the solution at that point. > > > > Firstly, this is NOT interpolation! This is EVALUATION. This is one > > of the large differences between finite elements and other > > discretization techniques (like finite difference and finite volume). > > In finite elements you are literally solving for a _function_ that > > covers the entire domain. In continuous galerkin (like you are > > probably using with lagrange shape functions) that function is even > > _continuous_ over the entire domain! > > > > Secondly... If this sounds like a lot of work.... It kind of is. > > That's why the MeshFunction object exists... Just initialize it with > > your solution and EquationSystems and it will do all of the above for > > you... Allowing you to evaluate your solution at any point in the > > domain (with some more efficiency than if you tried to do it > > yourself). > > > > Hope that helps! > > > > Derek > > > > Sent from my iPad > > > > On Aug 18, 2010, at 6:59 PM, Andrew Wharmby <awharmby@...> wrote: > > > > > I've read some discussion these boards on how to go about doing this, > but > > > didn't find any real concrete answer. Is there an easy way of after > > running > > > a model, to go back and use the interpolation functions used to > > approximate > > > the nodal values to approximate points between the nodes? > > > > > > Thanks, > > > _Andrew_ > > > > > >  > > > This SF.net email is sponsored by > > > > > > Make an app they can't live without > > > Enter the BlackBerry Developer Challenge > > > http://p.sf.net/sfu/RIMdev2dev > > > _______________________________________________ > > > Libmeshusers mailing list > > > Libmeshusers@... > > > https://lists.sourceforge.net/lists/listinfo/libmeshusers > > > > >  > > Message: 6 > Date: Thu, 19 Aug 2010 11:29:57 +0200 > From: Ming Q <micavn@...> > Subject: Re: [Libmeshusers] Periodic BC with adaptive mesh > To: Roy Stogner <roystgnr@...> > Cc: libmeshusers@... > MessageID: <FB05193520CE4A7C8A658D3AED98E9F3@...> > ContentType: text/plain; charset="usascii" > > Here is the test case that will show the BC constrain is broken after the > refinement. > > Thanks, > / Ming >  next part  > > > On Aug 19, 2010, at 2:41 AM, Roy Stogner wrote: > > > > > On Thu, 19 Aug 2010, Minq Q wrote: > > > >> I am having a problem when using the periodic BC together with the mesh > >> refinement. When one BC is set to refine, the other paired BC is not > >> allocated the new nodes as it should. > > > > That's actually correct  the new node is a hanging node on one side > > of the boundary, and shouldn't exist on the other until the element on > > the other side is refined. > > > >> The strange thing is: The first time of the refinement is OK. But > >> from the second time the two paired BCs are become different. > > > > There are currently two issues with combining the periodic BC and the > > AMR feature: > > > > The "level 1 conformity" constraint is not supported across the > > boundary. I.e. if you set enforce_level_one to true it will only be > > enforced on the mesh interior, not from one side of a periodic > > boundary to another. > > > > The mix of AMR and periodic constraint equations may not be working > > correctly. The two features are supposed to be compatible, but when I > > wrote the latter I was mostly using one or the other, or at best > > running periodic problems where the nonuniform refinement occurred > > away from the periodic BC, so I haven't tested it thoroughly. If you > > can set up a test case (as simple as possible, please) where the > > constraints are coming out wrong, please post the code to the list, > > and we can at least see if it's a simple bug/fix. > >  > > Roy > > >  > > >  > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIMdev2dev > >  > > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers > > > End of Libmeshusers Digest, Vol 51, Issue 8 > ******************************************** >  Vikram 