## Re: [Libmesh-users] Approximation order

 Re: [Libmesh-users] Approximation order From: Kirk, Benjamin (JSC-EG311) - 2012-12-05 21:40:13 ```On Dec 5, 2012, at 2:54 PM, ernestol wrote: > Dear all, > > I am just starting using libmesh and trying to implement the > Cahn-Hilliard equation. I already had implemented that by myself and now > I am trying to do with libmesh to compare the results and futher use > adaptative mesh. > > The problem is that when I use an initial condition like a X with 1 on > the X and -1 outside the X. The way libmesh project the initial > condition when using second order approximation give me values under -1 > and above 1, that I don't want it. This is because the projection is using a least-squares type approximation which can cause ringing for discontinuous data. Alternatively you can set the nodal value directly, or tune the quadrature rule used to project the function to achieve this effect - what type of finite element approximation are you using? > I am trying to use first order approximation so I can compare with my > program and don't have the problem with the initial condition. > > Even with the initial condition problem, the model work with second > order approximation, but every problem that I tried to use didn't work > first order approximation. > > Just a basic question so, in system_of_equation_ex2 if I want to > approximate u and v as first order. I just need to put first oder there > and take off the mesh.all_second_order()? > > because when I do this doesn't work. This definitely won't work, because in example 2 we solve the incompressible Navier-Stokes equations, and there are strong limits on compatibility between the velocity and pressure approximation. In general, for finite element problems without this type of restriction, all you would need to do is change the ORDER when defining the variable. -Ben ```

 [Libmesh-users] Approximation order From: ernestol - 2012-12-05 20:55:06 ```Dear all, I am just starting using libmesh and trying to implement the Cahn-Hilliard equation. I already had implemented that by myself and now I am trying to do with libmesh to compare the results and futher use adaptative mesh. The problem is that when I use an initial condition like a X with 1 on the X and -1 outside the X. The way libmesh project the initial condition when using second order approximation give me values under -1 and above 1, that I don't want it. I am trying to use first order approximation so I can compare with my program and don't have the problem with the initial condition. Even with the initial condition problem, the model work with second order approximation, but every problem that I tried to use didn't work first order approximation. Just a basic question so, in system_of_equation_ex2 if I want to approximate u and v as first order. I just need to put first oder there and take off the mesh.all_second_order()? because when I do this doesn't work. Thank you all Ernesto ```
 Re: [Libmesh-users] Approximation order From: Kirk, Benjamin (JSC-EG311) - 2012-12-05 21:40:13 ```On Dec 5, 2012, at 2:54 PM, ernestol wrote: > Dear all, > > I am just starting using libmesh and trying to implement the > Cahn-Hilliard equation. I already had implemented that by myself and now > I am trying to do with libmesh to compare the results and futher use > adaptative mesh. > > The problem is that when I use an initial condition like a X with 1 on > the X and -1 outside the X. The way libmesh project the initial > condition when using second order approximation give me values under -1 > and above 1, that I don't want it. This is because the projection is using a least-squares type approximation which can cause ringing for discontinuous data. Alternatively you can set the nodal value directly, or tune the quadrature rule used to project the function to achieve this effect - what type of finite element approximation are you using? > I am trying to use first order approximation so I can compare with my > program and don't have the problem with the initial condition. > > Even with the initial condition problem, the model work with second > order approximation, but every problem that I tried to use didn't work > first order approximation. > > Just a basic question so, in system_of_equation_ex2 if I want to > approximate u and v as first order. I just need to put first oder there > and take off the mesh.all_second_order()? > > because when I do this doesn't work. This definitely won't work, because in example 2 we solve the incompressible Navier-Stokes equations, and there are strong limits on compatibility between the velocity and pressure approximation. In general, for finite element problems without this type of restriction, all you would need to do is change the ORDER when defining the variable. -Ben ```
 Re: [Libmesh-users] Approximation order From: ernestol - 2012-12-05 22:22:53 ```I am using Lagrange approximation. I asked about that example just to use as a reference of problem that use second order and to change to first order. My model is a Cahn-Hilliard mixed linear formulation. I already have a code running with first order approximation. (not using libmesh) Now I am trying to do the same with libmesh. But only work for second order approximation. When I use first order approximation work for 15x15 elements but if I use 20x20 or more elements doesn't give me the correct solution. So I wasn't sure if I was changing the correct place. I will try to set the nodal value directly, thank you. Em 2012-12-05 15:39, Kirk, Benjamin (JSC-EG311) escreveu: > On Dec 5, 2012, at 2:54 PM, ernestol wrote: > >> Dear all, >> >> I am just starting using libmesh and trying to implement the >> Cahn-Hilliard equation. I already had implemented that by myself and >> now >> I am trying to do with libmesh to compare the results and futher use >> adaptative mesh. >> >> The problem is that when I use an initial condition like a X with 1 >> on >> the X and -1 outside the X. The way libmesh project the initial >> condition when using second order approximation give me values under >> -1 >> and above 1, that I don't want it. > > > This is because the projection is using a least-squares type > approximation which can cause ringing for discontinuous data. > Alternatively you can set the nodal value directly, or tune the > quadrature rule used to project the function to achieve this effect - > what type of finite element approximation are you using? > >> I am trying to use first order approximation so I can compare with >> my >> program and don't have the problem with the initial condition. >> >> Even with the initial condition problem, the model work with second >> order approximation, but every problem that I tried to use didn't >> work >> first order approximation. >> >> Just a basic question so, in system_of_equation_ex2 if I want to >> approximate u and v as first order. I just need to put first oder >> there >> and take off the mesh.all_second_order()? >> >> because when I do this doesn't work. > > This definitely won't work, because in example 2 we solve the > incompressible Navier-Stokes equations, and there are strong limits > on > compatibility between the velocity and pressure approximation. In > general, for finite element problems without this type of > restriction, > all you would need to do is change the ORDER when defining the > variable. > > -Ben ```
 Re: [Libmesh-users] Approximation order From: Roy Stogner - 2012-12-05 22:51:52 ```On Wed, 5 Dec 2012, ernestol wrote: > I will try to set the nodal value directly, thank you. This *still* won't give you a ringing-free solution. Imagine you're trying to interpolate a step function which changes from 0 to 1 less than halfway through a 3-node quadratic line element. You'll set the first node to 0, the second node to 1, and the third to 1, and the quadratic function will peak 3/4 of the way through the element with a value of 9/8, greater than 1. What's more, didn't you say you're doing Cahn-Hilliard with the typical polynomial free energy functional with a trough at 1? In that case even the *true solution* can temporarily exceed 1, IIRC - the local free energy term penalizes but doesn't forbid such excess, and in the transient case the local term can be temporarily dominated by the interfacial free energy effects. If you're coupling Cahn-Hilliard to another equation that NaNs or goes unstable or whatever when it sees c>1, you'll need to either truncate c in the coupling or use something like a Flory-Huggins free energy that really does prevent c>1 solutions. --- Roy ```
 Re: [Libmesh-users] Approximation order From: ernestol - 2012-12-05 23:06:53 ```Even when the initial condition exceed 1 the system is able to converge to the right solution with no problem. But with first order approximation the system doesn't work. Ernesto Em 2012-12-05 16:51, Roy Stogner escreveu: > On Wed, 5 Dec 2012, ernestol wrote: > >> I will try to set the nodal value directly, thank you. > > This *still* won't give you a ringing-free solution. Imagine you're > trying to interpolate a step function which changes from 0 to 1 less > than halfway through a 3-node quadratic line element. You'll set the > first node to 0, the second node to 1, and the third to 1, and the > quadratic function will peak 3/4 of the way through the element with > a > value of 9/8, greater than 1. > > What's more, didn't you say you're doing Cahn-Hilliard with the > typical polynomial free energy functional with a trough at 1? > In that case even the *true solution* can temporarily exceed 1, IIRC > - > the local free energy term penalizes but doesn't forbid such excess, > and in the transient case the local term can be temporarily dominated > by the interfacial free energy effects. If you're coupling > Cahn-Hilliard to another equation that NaNs or goes unstable or > whatever when it sees c>1, you'll need to either truncate c in the > coupling or use something like a Flory-Huggins free energy that > really > does prevent c>1 solutions. > --- > Roy ```