← Back to team overview

ffc team mailing list archive

Patch for Vector Crouzeix-Raviart

 

Hello,

Here is a patch for ffc that I required in order to get Crouzeix-Raviart and Vector Crouzeix-Raviart working. It does depend on the patch I sent to the FIAT mailing list and is based off the 0.3.5 release. As far as testing goes, everything works for my stokes problem using the Crouzeix-Raviart + P0 elements. I can send a demo file if you would like. Oh when I say everything works, I mean the velocity errors are doing what I would expect, the visualization is junk but I think as someone pointed out in the list a while back this is a problem with paraview.

Thanks,
Andy

--

====================
Andy Terrel
Computer Science Dept
University of Chicago
aterrel@xxxxxxxxxxxx
---------------------

I believe in getting into hot water; it keeps you clean.
                   -G.K. Chesterton


diff -u --new-file --recursive ffc-0.3.5/src/ffc/compiler/finiteelement.py ffc-0.3.5-mod/src/ffc/compiler/finiteelement.py
--- ffc-0.3.5/src/ffc/compiler/finiteelement.py	2006-12-01 04:30:01.000000000 -0600
+++ ffc-0.3.5-mod/src/ffc/compiler/finiteelement.py	2007-01-14 10:13:16.000000000 -0600
@@ -4,6 +4,7 @@
 __license__  = "GNU GPL Version 2"
 
 # Modified by Garth N. Wells 2006
+# Modified by Andy R Terrel 2007
 
 # Python modules
 import sys
@@ -12,7 +13,7 @@
 from FIAT.shapes import *
 from FIAT.Lagrange import Lagrange, VectorLagrange
 from FIAT.DiscontinuousLagrange import DiscontinuousLagrange, DiscontinuousVectorLagrange
-from FIAT.CrouzeixRaviart import CrouzeixRaviart
+from FIAT.CrouzeixRaviart import CrouzeixRaviart, VectorCrouzeixRaviart
 from FIAT.RaviartThomas import RaviartThomas
 from FIAT.BDM import BDM
 from FIAT.Nedelec import Nedelec
@@ -80,6 +81,9 @@
             elif type == "Crouzeix-Raviart":
                 print "Warning: element untested"
                 self.element = CrouzeixRaviart(self.fiat_shape)
+            elif type == "Vector Crouzeix-Raviart":
+                print "Warning: element untested"
+                self.element = VectorCrouzeixRaviart(self.fiat_shape)
             elif type == "Raviart-Thomas" or type == "RT":
                 print "Warning: element untested"
                 self.element = RaviartThomas(self.fiat_shape, degree)
diff -u --new-file --recursive ffc-0.3.5/src/ffc/compiler/pointmap.py ffc-0.3.5-mod/src/ffc/compiler/pointmap.py
--- ffc-0.3.5/src/ffc/compiler/pointmap.py	2006-12-01 04:30:02.000000000 -0600
+++ ffc-0.3.5-mod/src/ffc/compiler/pointmap.py	2007-01-14 10:13:16.000000000 -0600
@@ -3,6 +3,8 @@
 __copyright__ = "Copyright (C) 2005-2006 Anders Logg"
 __license__  = "GNU GPL Version 2"
 
+# Modified by Andy R Terrel 2007
+
 # FIAT modules
 from FIAT.dualbasis import *
 from FIAT.shapes import *
@@ -88,7 +90,7 @@
         local_offset = 0
         component_offset = 0
         for element in elements:
-            # Only works for Lagrange
-            if "Lagrange" in element.type_str:
+            # Only works for Lagrange and Crouzeix-Raviart
+            if "Lagrange" or "Crouzeix-Raviart" in element.type_str:
                 (declarations, local_offset, component_offset) = compute_pointmap(element, local_offset, component_offset)
                 self.declarations += declarations

Follow ups