In [1]:
from dolfin import *

#!/usr/bin/python
import petsc4py
import sys

petsc4py.init(sys.argv)

from petsc4py import PETSc
import numpy as np

In [ ]:


In [2]:
nn = 8
mesh = RectangleMesh(0, 0, 1, 1, nn, nn,'left')

order  = 2
Magnetic = FunctionSpace(mesh, "N1curl", order)
Lagrange = FunctionSpace(mesh, "CG", order)
LagrangeVec = VectorFunctionSpace(mesh, "CG", order)
L = FunctionSpace(mesh, "CG", order)


DEBUG:UFL:No integrals left after transformation, returning empty form.
DEBUG:FFC:Reusing form from cache.
DEBUG:UFL:No integrals left after transformation, returning empty form.
DEBUG:FFC:Reusing form from cache.
DEBUG:UFL:No integrals left after transformation, returning empty form.
DEBUG:FFC:Reusing form from cache.
DEBUG:UFL:No integrals left after transformation, returning empty form.
DEBUG:FFC:Reusing form from cache.

In [3]:
u = Function(Lagrange)
u.vector()[0] = 1
J = derivative(u, u)

In [5]:
assemble(J)


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-d99da7b455ab> in <module>()
----> 1 assemble(J)

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dolfin/fem/assembling.py in assemble(form, tensor, mesh, coefficients, function_spaces, cell_domains, exterior_facet_domains, interior_facet_domains, reset_sparsity, add_values, finalize_tensor, keep_diagonal, backend, form_compiler_parameters, bcs)
    166                            coefficients=coefficients,
    167                            form_compiler_parameters=form_compiler_parameters,
--> 168                            common_cell=common_cell)
    169 
    170     # Set mesh if specified (important for functionals without a function spaces)

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dolfin/fem/form.py in __init__(self, form, function_spaces, coefficients, subdomains, form_compiler_parameters, common_cell)
     67             cpp.dolfin_error("form.py",
     68                              "creating dolfin.Form",
---> 69                              "Expected a ufl.Form, ufc.form or a dolfin.Form")
     70 
     71         # Extract function spaces

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dolfin/cpp/common.py in dolfin_error(*args)
   2294 
   2295     """
-> 2296   return _common.dolfin_error(*args)
   2297 
   2298 def deprecation(*args):

RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics@fenicsproject.org
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to creating dolfin.Form.
*** Reason:  Expected a ufl.Form, ufc.form or a dolfin.Form.
*** Where:   This error was encountered inside form.py.
*** Process: 0
*** 
*** DOLFIN version: 1.3.0
*** Git changeset:  
*** -------------------------------------------------------------------------

In [ ]:


In [3]:
parameters["form_compiler"]["no-evaluate_basis_derivatives"] = False

In [4]:
class Constraint:
    """
    Constraint implements a tie between the values at two points p1 and p2.

    Example: 

    Create a tie between the values at (0.0, 0.5) and (1.0, 0.5)

    mesh = UnitSquareMesh(8, 8)
    V = FunctionSpace(mesh, 'CG', 2)
    constraint = Constraint(V)
    tie = constraint.vector(Point(0.0, 0.5), Point(1.0, 0.5))

    The constraint equation is given by tie.inner(u.vector()) == 0,
    i.e. all ties span the nullspace of the linear equation.
    """
    def __init__(self, V):
        self.V = V
        self.mesh = V.mesh()
        self.dofmap = V.dofmap()
        self.finite_element = V.element()
    def evaluate_basis(self, p):
        parameters["form_compiler"]["no-evaluate_basis_derivatives"] = False
        bbt = mesh.bounding_box_tree()
        id = bbt.compute_first_entity_collision(p)
        if id >= mesh.num_cells():
            id = bbt.compute_closest_entity(p)[0]
        c = Cell(self.mesh, id)
        vc = c.get_vertex_coordinates()
        dofs = self.dofmap.cell_dofs(id)
        no_basis_fns = self.finite_element.space_dimension()
        value_dimension = self.finite_element.value_dimension(0)
        print no_basis_fns, value_dimension
        basis = np.zeros((no_basis_fns, value_dimension))
        coords = np.zeros(2)
        coords[0], coords[1] = p.x(), p.y()
        self.finite_element.evaluate_basis_derivatives_all(1,basis, coords, vc, 0)
        u = Function(self.V)
        v = u.vector()
        # fixme: implement mixed spaces
        for k in range(value_dimension):
            for j in range(no_basis_fns):
                l = no_basis_fns*(k-1)+j
                v[dofs[l]] = basis[j][k]
        return v

In [5]:
print info(parameters, True)


None

In [126]:
(u) = TrialFunction(Magnetic)
(v) = TestFunction(Magnetic)
(p) = TrialFunction(L)
(q) = TestFunction(Lagrange)
a = dot(curl(u),curl(v))*dx + inner(u, v)*dx

In [137]:
VecFunc = Function(LagrangeVec)

In [5]:
C = Constraint(Lagrange)
u = C.evaluate_basis(Point(.4,.1))


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-e49ad324a0bb> in <module>()
      1 C = Constraint(Lagrange)
----> 2 u = C.evaluate_basis(Point(.4,.1))

<ipython-input-4-a588b5dd44eb> in evaluate_basis(self, p)
     35         coords = np.zeros(2)
     36         coords[0], coords[1] = p.x(), p.y()
---> 37         self.finite_element.evaluate_basis_derivatives_all(1,basis, coords, vc, 0)
     38         u = Function(self.V)
     39         v = u.vector()

RuntimeError: // Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)
6 1

In [142]:
print assemble(inner(VecFunc,dS))


Invalid type conversion: <class 'ufl.integral.Measure'> can not be converted to any UFL type.
The representation of the object is:
Measure('interior_facet', 'everywhere', None)
ERROR:UFL:Invalid type conversion: <class 'ufl.integral.Measure'> can not be converted to any UFL type.
The representation of the object is:
Measure('interior_facet', 'everywhere', None)
---------------------------------------------------------------------------
UFLException                              Traceback (most recent call last)
<ipython-input-142-bb4a75ba04fb> in <module>()
----> 1 print assemble(inner(VecFunc,dS))

/home/mwathen/Work/FEniCS/lib/python2.7/site-packages/ufl/operators.pyc in inner(a, b)
    123     "UFL operator: Take the inner product of a and b."
    124     a = as_ufl(a)
--> 125     b = as_ufl(b)
    126     if a.shape() == () and b.shape() == ():
    127         return a*b

/home/mwathen/Work/FEniCS/lib/python2.7/site-packages/ufl/constantvalue.pyc in as_ufl(expression)
    392         return FloatValue(expression)
    393     error(("Invalid type conversion: %s can not be converted to any UFL type.\n"+\
--> 394            "The representation of the object is:\n%r") % (type(expression), expression))

/home/mwathen/Work/FEniCS/lib/python2.7/site-packages/ufl/log.pyc in error(self, *message)
    152         "Write error message and raise an exception."
    153         self._log.error(*message)
--> 154         raise self._exception_type(self._format_raw(*message))
    155 
    156     def begin(self, *message):

UFLException: Invalid type conversion: <class 'ufl.integral.Measure'> can not be converted to any UFL type.
The representation of the object is:
Measure('interior_facet', 'everywhere', None)

In [143]:
gradU = Function(Lagrange)
gradU.vector()[:] = u.array()
gradU = grad(gradU)

In [148]:
gradU.evaluate(Point(.1,.1),dof,0,0)


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-148-40b2be6da38a> in <module>()
----> 1 gradU.evaluate(Point(.1,.1),dof,0,0)

/home/mwathen/Work/FEniCS/lib/python2.7/site-packages/ufl/differentiation.pyc in evaluate(self, x, mapping, component, index_values, derivatives)
    194     def evaluate(self, x, mapping, component, index_values, derivatives=()):
    195         "Get child from mapping and return the component asked for."
--> 196         r = len(component)
    197         component, i = component[:-1], component[-1]
    198         derivatives = derivatives + (i,)

TypeError: object of type 'int' has no len()

In [146]:
dof = Lagrange.dofmap()

In [3]:
U = Function(Lagrange)

In [12]:
N = FacetNormal(mesh)

In [14]:
assemble(inner(df,N)*ds)


Calling FFC just-in-time (JIT) compiler, this may take some time.
Level 25:FFC:Calling FFC just-in-time (JIT) compiler, this may take some time.
INFO:FFC:Compiling form ffc_form_4ef4f24626e284b7fac8288bcb2b13544ddcd552

INFO:FFC:Compiler stage 1: Analyzing form(s)
INFO:FFC:-----------------------------------
INFO:FFC:  
INFO:FFC:  Name:                   ''
  Cell:                   <triangle cell in 2D>
  Topological dimension:  2
  Geometric dimension:    2
  Rank:                   0
  Number of coefficients: 1
  Arguments:              '[]'
  Coefficients:           '[f_1]'
  Argument names:         '[]'
  Coefficient names:      '[w0]'
  Unique elements:        'N1curl2(?)'
  Unique sub elements:    'N1curl2(?)'
  Domains:                (Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2),
                          )
  Top level domains:      (Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2),
                          )
  
INFO:FFC:  Extracting monomial form representation from UFL form
DEBUG:FFC:  Monomial extraction failed: No handler defined for terminal FacetNormal.
DEBUG:FFC:  Estimated cost of tensor representation: -1
INFO:FFC:  representation:    auto --> quadrature
DEBUG:FFC:  Selecting quadrature degree based on total polynomial degree of integrand: 2
INFO:FFC:  quadrature_degree: auto --> 2
INFO:FFC:  quadrature_rule:   auto --> default
INFO:FFC:  
INFO:FFC:Compiler stage 1 finished in 0.00598979 seconds.

INFO:FFC:Compiler stage 2: Computing intermediate representation
INFO:FFC:-------------------------------------------------------
INFO:FFC:  Computing representation of 1 elements
DEBUG:FFC:  Reusing element from cache
INFO:FFC:  Computing representation of 1 dofmaps
DEBUG:FFC:  Reusing element from cache
INFO:FFC:  Computing representation of integrals
INFO:FFC:  Computing quadrature representation
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  
  QG-utils, psi_tables:
  {2: {FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None): {None: {0: {(0, 0): array([[[-0.45534180126147977, 0.12200846792814637],
          [0.91068360252295888, -0.24401693585629253]],
  
         [[0.24401693585629267, -0.91068360252295932],
          [-0.12200846792814576, 0.45534180126147961]],
  
         [[-0.21132486540518725, -0.78867513459481342],
          [-0.21132486540518697, -0.78867513459481298]],
  
         [[-0.24401693585629261, 0.91068360252295966],
          [-0.24401693585629267, 0.91068360252295955]],
  
         [[-0.78867513459481231, -0.21132486540518688],
          [-0.78867513459481253, -0.21132486540518716]],
  
         [[0.9106836025229591, -0.24401693585629242],
          [0.91068360252295877, -0.24401693585629225]],
  
         [[1.3333333333333357, 1.3333333333333348],
          [1.3333333333333368, 1.333333333333335]],
  
         [[1.3333333333333355, 1.3333333333333355],
          [1.3333333333333353, 1.3333333333333341]]], dtype=object)}, 1: {(0, 0): array([[[0.2113248654051873, 0.78867513459481331],
          [2.0122792321330962e-16, 1.5265566588595902e-16]],
  
         [[0.24401693585629258, -0.9106836025229591],
          [-2.0122792321330962e-16, 0.0]],
  
         [[0.45534180126148005, -0.12200846792814607],
          [1.3660254037844384, -0.36602540378443854]],
  
         [[-0.24401693585629247, 0.91068360252295943],
          [-0.3660254037844386, 1.3660254037844388]],
  
         [[0.91068360252295866, -0.244016935856293],
          [9.7144514654701197e-17, -2.2204460492503131e-16]],
  
         [[-0.78867513459481275, -0.21132486540518663],
          [1.8041124150158794e-16, 5.6898930012039273e-16]],
  
         [[2.6666666666666696, 2.666666666666671],
          [-6.6613381477509392e-16, 6.6613381477509392e-16]],
  
         [[-1.3333333333333355, -1.3333333333333355],
          [-9.0899510141184692e-16, -7.4940054162198066e-16]]], dtype=object)}, 2: {(0, 0): array([[[1.1102230246251565e-16, 0.0],
          [-0.24401693585629158, 0.91068360252295977]],
  
         [[-1.1102230246251565e-16, 1.6653345369377348e-16],
          [-0.21132486540518752, -0.78867513459481275]],
  
         [[8.3266726846886741e-17, 1.1102230246251565e-16],
          [0.91068360252295921, -0.24401693585629153]],
  
         [[5.5511151231257827e-17, -2.7755575615628914e-16],
          [-0.78867513459481264, -0.21132486540518761]],
  
         [[1.3660254037844384, -0.36602540378443843],
          [0.45534180126147933, -0.12200846792814635]],
  
         [[-0.36602540378443854, 1.3660254037844388],
          [-0.24401693585629192, 0.91068360252295943]],
  
         [[-8.8817841970012523e-16, 1.5543122344752192e-15],
          [-1.3333333333333346, -1.3333333333333317]],
  
         [[4.2600559825160902e-16, 4.2600559825160902e-16],
          [2.6666666666666661, 2.666666666666667]]], dtype=object)}}}}}
DEBUG:FFC:  
  QG-utils, psi_tables, flat_tables:
  {'FE0_f0_C1': array([[0.91068360252295888, -0.12200846792814576, -0.21132486540518697,
          -0.24401693585629267, -0.78867513459481253, 0.91068360252295877,
          1.3333333333333368, 1.3333333333333353],
         [-0.24401693585629253, 0.45534180126147961, -0.78867513459481298,
          0.91068360252295955, -0.21132486540518716, -0.24401693585629225,
          1.333333333333335, 1.3333333333333341]], dtype=object), 'FE0_f0_C0': array([[-0.45534180126147977, 0.24401693585629267, -0.21132486540518725,
          -0.24401693585629261, -0.78867513459481231, 0.9106836025229591,
          1.3333333333333357, 1.3333333333333355],
         [0.12200846792814637, -0.91068360252295932, -0.78867513459481342,
          0.91068360252295966, -0.21132486540518688, -0.24401693585629242,
          1.3333333333333348, 1.3333333333333355]], dtype=object), 'FE0_f2_C1': array([[-0.24401693585629158, -0.21132486540518752, 0.91068360252295921,
          -0.78867513459481264, 0.45534180126147933, -0.24401693585629192,
          -1.3333333333333346, 2.6666666666666661],
         [0.91068360252295977, -0.78867513459481275, -0.24401693585629153,
          -0.21132486540518761, -0.12200846792814635, 0.91068360252295943,
          -1.3333333333333317, 2.666666666666667]], dtype=object), 'FE0_f2_C0': array([[1.1102230246251565e-16, -1.1102230246251565e-16,
          8.3266726846886741e-17, 5.5511151231257827e-17, 1.3660254037844384,
          -0.36602540378443854, -8.8817841970012523e-16,
          4.2600559825160902e-16],
         [0.0, 1.6653345369377348e-16, 1.1102230246251565e-16,
          -2.7755575615628914e-16, -0.36602540378443843, 1.3660254037844388,
          1.5543122344752192e-15, 4.2600559825160902e-16]], dtype=object), 'FE0_f1_C0': array([[0.2113248654051873, 0.24401693585629258, 0.45534180126148005,
          -0.24401693585629247, 0.91068360252295866, -0.78867513459481275,
          2.6666666666666696, -1.3333333333333355],
         [0.78867513459481331, -0.9106836025229591, -0.12200846792814607,
          0.91068360252295943, -0.244016935856293, -0.21132486540518663,
          2.666666666666671, -1.3333333333333355]], dtype=object), 'FE0_f1_C1': array([[2.0122792321330962e-16, -2.0122792321330962e-16,
          1.3660254037844384, -0.3660254037844386, 9.7144514654701197e-17,
          1.8041124150158794e-16, -6.6613381477509392e-16,
          -9.0899510141184692e-16],
         [1.5265566588595902e-16, 0.0, -0.36602540378443854,
          1.3660254037844388, -2.2204460492503131e-16,
          5.6898930012039273e-16, 6.6613381477509392e-16,
          -7.4940054162198066e-16]], dtype=object)}
DEBUG:FFC:  
  tables: {'FE0_f0_C1': array([[0.91068360252295888, -0.12200846792814576, -0.21132486540518697,
          -0.24401693585629267, -0.78867513459481253, 0.91068360252295877,
          1.3333333333333368, 1.3333333333333353],
         [-0.24401693585629253, 0.45534180126147961, -0.78867513459481298,
          0.91068360252295955, -0.21132486540518716, -0.24401693585629225,
          1.333333333333335, 1.3333333333333341]], dtype=object), 'FE0_f0_C0': array([[-0.45534180126147977, 0.24401693585629267, -0.21132486540518725,
          -0.24401693585629261, -0.78867513459481231, 0.9106836025229591,
          1.3333333333333357, 1.3333333333333355],
         [0.12200846792814637, -0.91068360252295932, -0.78867513459481342,
          0.91068360252295966, -0.21132486540518688, -0.24401693585629242,
          1.3333333333333348, 1.3333333333333355]], dtype=object), 'FE0_f2_C1': array([[-0.24401693585629158, -0.21132486540518752, 0.91068360252295921,
          -0.78867513459481264, 0.45534180126147933, -0.24401693585629192,
          -1.3333333333333346, 2.6666666666666661],
         [0.91068360252295977, -0.78867513459481275, -0.24401693585629153,
          -0.21132486540518761, -0.12200846792814635, 0.91068360252295943,
          -1.3333333333333317, 2.666666666666667]], dtype=object), 'FE0_f2_C0': array([[1.1102230246251565e-16, -1.1102230246251565e-16,
          8.3266726846886741e-17, 5.5511151231257827e-17, 1.3660254037844384,
          -0.36602540378443854, -8.8817841970012523e-16,
          4.2600559825160902e-16],
         [0.0, 1.6653345369377348e-16, 1.1102230246251565e-16,
          -2.7755575615628914e-16, -0.36602540378443843, 1.3660254037844388,
          1.5543122344752192e-15, 4.2600559825160902e-16]], dtype=object), 'FE0_f1_C0': array([[0.2113248654051873, 0.24401693585629258, 0.45534180126148005,
          -0.24401693585629247, 0.91068360252295866, -0.78867513459481275,
          2.6666666666666696, -1.3333333333333355],
         [0.78867513459481331, -0.9106836025229591, -0.12200846792814607,
          0.91068360252295943, -0.244016935856293, -0.21132486540518663,
          2.666666666666671, -1.3333333333333355]], dtype=object), 'FE0_f1_C1': array([[2.0122792321330962e-16, -2.0122792321330962e-16,
          1.3660254037844384, -0.3660254037844386, 9.7144514654701197e-17,
          1.8041124150158794e-16, -6.6613381477509392e-16,
          -9.0899510141184692e-16],
         [1.5265566588595902e-16, 0.0, -0.36602540378443854,
          1.3660254037844388, -2.2204460492503131e-16,
          5.6898930012039273e-16, 6.6613381477509392e-16,
          -7.4940054162198066e-16]], dtype=object)}
DEBUG:FFC:  
  name_map: {}
DEBUG:FFC:  
  inv_name_map: {'FE0_f0_C1': 'FE0_f0_C1', 'FE0_f0_C0': 'FE0_f0_C0', 'FE0_f2_C1': 'FE0_f2_C1', 'FE0_f2_C0': 'FE0_f2_C0', 'FE0_f1_C0': 'FE0_f1_C0', 'FE0_f1_C1': 'FE0_f1_C1'}
DEBUG:FFC:  
  QG-utils, psi_tables, unique_tables:
  {'FE0_f0_C1': array([[0.91068360252295888, -0.12200846792814576, -0.21132486540518697,
          -0.24401693585629267, -0.78867513459481253, 0.91068360252295877,
          1.3333333333333368, 1.3333333333333353],
         [-0.24401693585629253, 0.45534180126147961, -0.78867513459481298,
          0.91068360252295955, -0.21132486540518716, -0.24401693585629225,
          1.333333333333335, 1.3333333333333341]], dtype=object), 'FE0_f0_C0': array([[-0.45534180126147977, 0.24401693585629267, -0.21132486540518725,
          -0.24401693585629261, -0.78867513459481231, 0.9106836025229591,
          1.3333333333333357, 1.3333333333333355],
         [0.12200846792814637, -0.91068360252295932, -0.78867513459481342,
          0.91068360252295966, -0.21132486540518688, -0.24401693585629242,
          1.3333333333333348, 1.3333333333333355]], dtype=object), 'FE0_f2_C1': array([[-0.24401693585629158, -0.21132486540518752, 0.91068360252295921,
          -0.78867513459481264, 0.45534180126147933, -0.24401693585629192,
          -1.3333333333333346, 2.6666666666666661],
         [0.91068360252295977, -0.78867513459481275, -0.24401693585629153,
          -0.21132486540518761, -0.12200846792814635, 0.91068360252295943,
          -1.3333333333333317, 2.666666666666667]], dtype=object), 'FE0_f2_C0': array([[0, 0, 0, 0, 1.3660254037844384, -0.36602540378443854, 0, 0],
         [0, 0, 0, 0, -0.36602540378443843, 1.3660254037844388, 0, 0]], dtype=object), 'FE0_f1_C0': array([[0.2113248654051873, 0.24401693585629258, 0.45534180126148005,
          -0.24401693585629247, 0.91068360252295866, -0.78867513459481275,
          2.6666666666666696, -1.3333333333333355],
         [0.78867513459481331, -0.9106836025229591, -0.12200846792814607,
          0.91068360252295943, -0.244016935856293, -0.21132486540518663,
          2.666666666666671, -1.3333333333333355]], dtype=object), 'FE0_f1_C1': array([[0, 0, 1.3660254037844384, -0.3660254037844386, 0, 0, 0, 0],
         [0, 0, -0.36602540378443854, 1.3660254037844388, 0, 0, 0, 0]], dtype=object)}
DEBUG:FFC:  
  QG-utils, psi_tables, name_map:
  {'FE0_f0_C1': ('FE0_f0_C1', (), False, False), 'FE0_f0_C0': ('FE0_f0_C0', (), False, False), 'FE0_f2_C1': ('FE0_f2_C1', (), False, False), 'FE0_f2_C0': ('FE0_f2_C0', (), False, False), 'FE0_f1_C0': ('FE0_f1_C0', (), False, False), 'FE0_f1_C1': ('FE0_f1_C1', (), False, False)}
INFO:FFC:  Transforming exterior facet integral 0
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
INFO:FFC:  Transforming exterior facet integral 1
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
INFO:FFC:  Transforming exterior facet integral 2
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
DEBUG:FFC:  Reusing element from cache
INFO:FFC:  Computing representation of forms
INFO:FFC:  
INFO:FFC:Compiler stage 2 finished in 0.083483 seconds.

INFO:FFC:Compiler stage 3: Optimizing intermediate representation
INFO:FFC:--------------------------------------------------------
INFO:FFC:  Skipping optimizations, add -O to optimize
INFO:FFC:  
INFO:FFC:Compiler stage 3 finished in 0.00103807 seconds.

INFO:FFC:Compiler stage 4: Generating code
INFO:FFC:---------------------------------
INFO:FFC:  Generating code for 1 element(s)
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
DEBUG:FFC:  Removing unused variable: tmp7
DEBUG:FFC:  Removing unused variable: tmp6
DEBUG:FFC:  Removing unused variable: tmp5
DEBUG:FFC:  Removing unused variable: tt
DEBUG:FFC:  Removing unused variable: ss
DEBUG:FFC:  Removing unused variable: rr
INFO:FFC:  Generating code for 1 dofmap(s)
INFO:FFC:  Generating code for integrals
DEBUG:FFC:  Removing unused variable: circumradius
DEBUG:FFC:  Removing unused variable: v0v1
DEBUG:FFC:  Removing unused variable: v0v2
DEBUG:FFC:  Removing unused variable: v1v2
DEBUG:FFC:  Removing unused variable: volume
DEBUG:FFC:  Removing unused variable: facet_area
INFO:FFC:  Exterior facet 0, number of operations to compute tensor: 88
INFO:FFC:  Exterior facet 1, number of operations to compute tensor: 88
INFO:FFC:  Exterior facet 2, number of operations to compute tensor: 88
INFO:FFC:  Generating code for forms
INFO:FFC:  
INFO:FFC:Compiler stage 4 finished in 0.135769 seconds.

INFO:FFC:Compiler stage 4.1 finished in 5.00679e-06 seconds.

INFO:FFC:Compiler stage 5: Formatting code
INFO:FFC:---------------------------------
INFO:FFC:  Output written to ./ffc_form_4ef4f24626e284b7fac8288bcb2b13544ddcd552.h.
INFO:FFC:  
INFO:FFC:Compiler stage 5 finished in 0.00138402 seconds.

INFO:FFC:FFC finished in 0.229268 seconds.
DEBUG:FFC:Compiling and linking Python extension module, this may take some time.
Out[14]:
0.0

In [130]:
A.array()


Out[130]:
array([  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
        -2.00000000e-02,  -1.31838984e-16,   2.00000000e-02,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   8.00000000e-02,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
        -8.00000000e-02,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00])

In [ ]:


In [17]:
gradUint.count

In [18]:
interior_facets = [f for f in facets(mesh) if not f.exterior()]

In [45]:
I =interior_facets[1]

In [42]:
N = I.mesh?

In [46]:
N = I.mesh()

In [52]:
N.cells()


Out[52]:
array([[ 0,  1,  9],
       [ 1,  9, 10],
       [ 1,  2, 10],
       [ 2, 10, 11],
       [ 2,  3, 11],
       [ 3, 11, 12],
       [ 3,  4, 12],
       [ 4, 12, 13],
       [ 4,  5, 13],
       [ 5, 13, 14],
       [ 5,  6, 14],
       [ 6, 14, 15],
       [ 6,  7, 15],
       [ 7, 15, 16],
       [ 7,  8, 16],
       [ 8, 16, 17],
       [ 9, 10, 18],
       [10, 18, 19],
       [10, 11, 19],
       [11, 19, 20],
       [11, 12, 20],
       [12, 20, 21],
       [12, 13, 21],
       [13, 21, 22],
       [13, 14, 22],
       [14, 22, 23],
       [14, 15, 23],
       [15, 23, 24],
       [15, 16, 24],
       [16, 24, 25],
       [16, 17, 25],
       [17, 25, 26],
       [18, 19, 27],
       [19, 27, 28],
       [19, 20, 28],
       [20, 28, 29],
       [20, 21, 29],
       [21, 29, 30],
       [21, 22, 30],
       [22, 30, 31],
       [22, 23, 31],
       [23, 31, 32],
       [23, 24, 32],
       [24, 32, 33],
       [24, 25, 33],
       [25, 33, 34],
       [25, 26, 34],
       [26, 34, 35],
       [27, 28, 36],
       [28, 36, 37],
       [28, 29, 37],
       [29, 37, 38],
       [29, 30, 38],
       [30, 38, 39],
       [30, 31, 39],
       [31, 39, 40],
       [31, 32, 40],
       [32, 40, 41],
       [32, 33, 41],
       [33, 41, 42],
       [33, 34, 42],
       [34, 42, 43],
       [34, 35, 43],
       [35, 43, 44],
       [36, 37, 45],
       [37, 45, 46],
       [37, 38, 46],
       [38, 46, 47],
       [38, 39, 47],
       [39, 47, 48],
       [39, 40, 48],
       [40, 48, 49],
       [40, 41, 49],
       [41, 49, 50],
       [41, 42, 50],
       [42, 50, 51],
       [42, 43, 51],
       [43, 51, 52],
       [43, 44, 52],
       [44, 52, 53],
       [45, 46, 54],
       [46, 54, 55],
       [46, 47, 55],
       [47, 55, 56],
       [47, 48, 56],
       [48, 56, 57],
       [48, 49, 57],
       [49, 57, 58],
       [49, 50, 58],
       [50, 58, 59],
       [50, 51, 59],
       [51, 59, 60],
       [51, 52, 60],
       [52, 60, 61],
       [52, 53, 61],
       [53, 61, 62],
       [54, 55, 63],
       [55, 63, 64],
       [55, 56, 64],
       [56, 64, 65],
       [56, 57, 65],
       [57, 65, 66],
       [57, 58, 66],
       [58, 66, 67],
       [58, 59, 67],
       [59, 67, 68],
       [59, 60, 68],
       [60, 68, 69],
       [60, 61, 69],
       [61, 69, 70],
       [61, 62, 70],
       [62, 70, 71],
       [63, 64, 72],
       [64, 72, 73],
       [64, 65, 73],
       [65, 73, 74],
       [65, 66, 74],
       [66, 74, 75],
       [66, 67, 75],
       [67, 75, 76],
       [67, 68, 76],
       [68, 76, 77],
       [68, 69, 77],
       [69, 77, 78],
       [69, 70, 78],
       [70, 78, 79],
       [70, 71, 79],
       [71, 79, 80]], dtype=uint32)

In [ ]:


In [41]:
N = I.adjacent_cells()


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-41-980b6fe3f183> in <module>()
----> 1 N = I.adjacent_cells()

TypeError: Facet_adjacent_cells expected 2 arguments, got 1

In [39]:
N


Out[39]:
False

In [ ]:


In [36]:
N.z()


Out[36]:
0.0

In [6]:
u = Function(Lagrange)

In [7]:
u.vector()[:] = U.array()

In [17]:
uGrad = grad(u)

In [19]:
uGrad.domain()


Out[19]:
Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2)

In [48]:
uGrad.evaluate


Out[48]:
<bound method Grad.evaluate of Grad(Coefficient(FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None), 3))>

In [57]:
B = BasisFunction?

In [58]:
import exter


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-58-8fdfa46d45b8> in <module>()
----> 1 cell

NameError: name 'cell' is not defined