# Copyright (C) 2006-2007 Anders Logg and Marie E. Rognes
#
# This file is part of FFC.
#
# FFC is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FFC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFC. If not, see <http://www.gnu.org/licenses/>.
#
# The bilinear form a and linear form L for a mixed formulation of
# Poisson's equation with BDM (Brezzi-Douglas-Marini) elements.

# Compile this form with FFC: ffc MixedPoisson.ufl

q = 1

BDM = FiniteElement("Brezzi-Douglas-Marini", triangle, q)
DG  = FiniteElement("Discontinuous Lagrange", triangle, q - 1)

mixed_element = BDM * DG

(sigma, u) = TrialFunctions(mixed_element)
(tau, w) = TestFunctions(mixed_element)

f = Coefficient(DG)

a = (inner(sigma, tau) - div(tau)*u + div(sigma)*w)*dx
L = f*w*dx
