Subject: [FFC-dev] dofmap() bug for discontinuous Lagrange

From: Johan Jansson <[email-masked]>
Date: Sat, 4 Jun 2005 15:54:31 +0200

Hi!

There seems to be a bug in the dofmap generation for discontinuous
Lagrange elements. What happens is that dofmap() seems to think there
are more dofs than there really are. Consider this form:

# Test form for updated elasticity

name = "ElasticityUpdatedSigma0"
element1 = FiniteElement("Vector Lagrange", "tetrahedron", 1)
element2 = FiniteElement("Discontinuous vector Lagrange", "tetrahedron", 0)

c1 = Constant() # Lame coefficient
c2 = Constant() # Lame coefficient

q = BasisFunction(element2)
v = Function(element1)

L = ((2 * c1 * v[i].dx(i) * q[0]) +
        (c2 * (v[i].dx(0) + v[0].dx(i))) * q[i]) * dx

The generated code looks like this:

...

    inline unsigned int spacedim() const
    {
      return 3;
    }

...

    void dofmap(int dofs[], const Cell& cell, const Mesh& mesh) const
    {
      dofs[0] = 3*cell.id() + 0;
      dofs[1] = 3*cell.id() + 1;
      dofs[2] = 3*cell.id() + 2;
      int offset = 3*mesh.noCells();
      dofs[3] = offset + 3*cell.id() + 0;
      dofs[4] = offset + 3*cell.id() + 1;
      dofs[5] = offset + 3*cell.id() + 2;
      offset = offset + 3*mesh.noCells();
      dofs[6] = offset + 3*cell.id() + 0;
      dofs[7] = offset + 3*cell.id() + 1;
      dofs[8] = offset + 3*cell.id() + 2;
    }

...

For some reason dofmap() seems to think there are 9 dofs on the
element. If I just remove the extra lines, then it works ok.

  Johan

---

From: Anders Logg <[email-masked]>
Date: Sat, 4 Jun 2005 11:01:20 -0500

Yes, this seems to be a bug. I will take a look.

/Anders

On Sat, Jun 04, 2005 at 03:54:31PM +0200, Johan Jansson wrote:
> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
> 

-- 
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/

---

From: Anders Logg <[email-masked]>
Date: Sat, 4 Jun 2005 11:06:57 -0500

Looks like a bug in FIAT in DiscontinuousVectorLagrange with q = 0.

This is entity_ids for q = 0:

{0: {0: {}, 1: {}, 2: {}, 3: {}}, 1: {0: {}, 1: {}, 2: {}, 3: {}, 4:
{}, 5: {}}, 2: {0: {}, 1: {}, 2: {}, 3: {}}, 3: {0: [0, 1, 2]}}

This is entity_ids for q = 1:

{0: {0: {}, 1: {}, 2: {}, 3: {}}, 1: {0: {}, 1: {}, 2: {}, 3: {}, 4:
{}, 5: {}}, 2: {0: {}, 1: {}, 2: {}, 3: {}}, 3: {0: [0, 1, 2, 3]}}

Shouldn't the last dictionary should be {0: [0]} for q = 0?
The number of nodes should be 0, not 3. Right?

/Anders

---

From: Robert C. Kirby <[email-masked]>
Date: Mon, 6 Jun 2005 12:30:58 -0500

Yes -- the problem is that I haven't propogated num_reps to P0.  I will 
do that this afternoon.

Rob

Robert C. Kirby
Assistant Professor
Department of Computer Science
The University of Chicago
http://people.cs.uchicago.edu/~kirby
On Jun 4, 2005, at 11:06 AM, Anders Logg wrote:

> FIAT-dev mailing list
> [email-masked]
> http://www.fenics.org/cgi-bin/mailman/listinfo/fiat-dev