From: Andrew Wharmby <awharmby@gm...>  20100819 00:59:37

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_ 
From: Andrew Wharmby <awharmby@gm...>  20100819 00:59:37

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_ 
From: Derek Gaston <friedmud@gm...>  20100819 02:32:06

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 
From: Andrew Wharmby <awharmby@gm...>  20100819 04:11:10

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 > 
From: Derek Gaston <friedmud@gm...>  20100819 04:55:28

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 > 