[Libmesh-users] LAGRANGE versus MONOMIAL From: - 2007-04-24 08:45 ```Dear all, If I have two variables in a system (say, u and v), for both of which I use first order approximation, but u is continuous (i.e. FIRST,LAGRANGE) and v not (i.e. FIRST,MONOMIAL), I note that the number of dofs on each cell is the same for both (e.g. 4 on tetrahedrons). This is certainly not surprising. Now my question: If I want to assign v=u at some point in my code (thus not exploiting the possibility of v to be discontinuous), can I do this on every cell: for (unsigned int l=0; lset(dof_indices_v[l], (*system.current_local_solution)(dof_indices_u[l])); } or do I have to use a quadrature rule? Best Regards, Tim -- Dr. Tim Kroeger CeVis -- Center of Complex Systems and Visualization University of Bremen Universitaetsallee 29 (Office 3.13) tim@... D-28359 Bremen Phone +49-421-218-7710 Germany Fax +49-421-218-4236 ```
 Re: [Libmesh-users] LAGRANGE versus MONOMIAL From: Roy Stogner - 2007-04-24 12:31 ```On Tue, 24 Apr 2007, Tim Kröger wrote: > Now my question: If I want to assign v=u at some point in my code > (thus not exploiting the possibility of v to be discontinuous), can I > do this on every cell: > > for (unsigned int l=0; l { > system.solution->set(dof_indices_v[l], (*system.current_local_solution)(dof_indices_u[l])); > } That might work for the elements like you're using. I wouldn't trust it until I dug into the code and made sure the local shape functions were identical and identically ordered, though. It's certain to break on quads or hexes. > or do I have to use a quadrature rule? The safest thing in general would be a local L2 projection, but that's probably overkill here, and factoring even small dense matrices may not be as cheap as you'd like. Still, if you're thinking of bumping up p later it may be the thing to do. --- Roy ```
 Re: [Libmesh-users] LAGRANGE versus MONOMIAL From: - 2007-04-24 15:09 ```Dear Roy, On Tue, 24 Apr 2007, Roy Stogner wrote: > On Tue, 24 Apr 2007, Tim Kr=F6ger wrote: > >> Now my question: If I want to assign v=3Du at some point in my code >> (thus not exploiting the possibility of v to be discontinuous), can I >> do this on every cell: >> >> for (unsigned int l=3D0; l> { >> system.solution->set(dof_indices_v[l],=20 >> (*system.current_local_solution)(dof_indices_u[l])); >> } > > That might work for the elements like you're using. I wouldn't trust > it until I dug into the code and made sure the local shape functions > were identical and identically ordered, though. It's certain to break > on quads or hexes. I tried it out and found that it doesn't work. v is discontinuous=20 afterwards. >> or do I have to use a quadrature rule? > > The safest thing in general would be a local L2 projection, I don't think I need any projection since the u space is contained in=20 the v space. It would suffice to do the following: For each dof of v,=20 find the corresponding local coordinates, then find the values of the=20 ansatz functions for u at these points, multiply and sum up. Unfortunately, I have no idea how to do this. Do you have any hint=20 where to find an example code that does a similar thing? > but that's > probably overkill here, and factoring even small dense matrices may > not be as cheap as you'd like. Still, if you're thinking of bumping > up p later it may be the thing to do. Currenty, I don't plan to increase p. However, I would like to=20 work the thing on hex cells. Best Regards, Tim ```
 Re: [Libmesh-users] LAGRANGE versus MONOMIAL From: Roy Stogner - 2007-04-24 15:29 ```On Tue, 24 Apr 2007, Tim Kröger wrote: > On Tue, 24 Apr 2007, Roy Stogner wrote: > >> On Tue, 24 Apr 2007, Tim Kröger wrote: >> >>> for (unsigned int l=0; l>> { >>> system.solution->set(dof_indices_v[l], >>> (*system.current_local_solution)(dof_indices_u[l])); >>> } >> >> That might work for the elements like you're using. I wouldn't trust >> it until I dug into the code and made sure the local shape functions >> were identical and identically ordered, though. It's certain to break >> on quads or hexes. > > I tried it out and found that it doesn't work. v is discontinuous > afterwards. Yes, I suppose you're right. The Lagrange shape functions are (1-xi-eta), xi, eta; the monomial shapes are 1, xi, eta. >> The safest thing in general would be a local L2 projection, > > I don't think I need any projection since the u space is contained in the v > space. A projection doesn't necessarily have to imply a reduction in dimensionality. Doing the code as an L2 projection would simply ensure that it worked correctly for arbitrary nested spaces. > It would suffice to do the following: For each dof of v, find the > corresponding local coordinates, then find the values of the ansatz functions > for u at these points, multiply and sum up. > > Unfortunately, I have no idea how to do this. Do you have any hint where to > find an example code that does a similar thing? No - partly because we don't have the facilities for it. You'd need the functions sigma_i which satisfy sigma_i(shape_j) == (i == j), and we don't actually have those functions in code anywhere. They're straightforward for the Lagrange elements, but you need them for the monomials. And for the monomials, the degree of freedom functionals *aren't* local coordinates. Even for the p=1 case they're linear combinations of coordinate values. If you're only going to use linear elements, your best bet is probably to work out the local transformations by hand and just plug them into a loop like you've got above. It won't be as simple as vdof_i = udof_i, but it'll be close. > Currenty, I don't plan to increase p. However, I would like to work the > thing on hex cells. You'll have to add a new FE class (named TENSORMONOMIAL? POLYNOMIAL? QMONOMIAL?) to do that if you want the spaces nested. The discontinuous MONOMIAL class uses a P1 basis even on non-simplices; the LAGRANGE elements use Q1. --- Roy ```