# Copyright (C) 2014-2015 Anders Logg # # This file is part of DOLFIN. # # DOLFIN 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. # # DOLFIN 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 DOLFIN. If not, see . # # First added: 2013-06-26 # Last changed: 2017-08-23 # # The bilinear form a(u, v) and linear form L(v) for a multimesh # formulation of Poisson's equation. # # Compile this form with FFC: ffc -l dolfin MultiMeshPoisson.ufl. from ufl_legacy import (avg, Circumradius, Coefficient, dI, dO, dX, dx, FiniteElement, dot, grad, FacetNormal, jump, tetrahedron, TestFunction, TrialFunction) # Define element simplex = tetrahedron element = FiniteElement("Lagrange", simplex, 1) # Define trial and test functions and right-hand side u = TrialFunction(element) v = TestFunction(element) f = Coefficient(element) # Define facet normal and mesh size n = FacetNormal(simplex) h = 2.0*Circumradius(simplex) h = (h('+') + h('-')) / 2 # Parameters alpha = 4.0 beta = 4.0 # Define bilinear form a = dot(grad(u), grad(v))*dX \ - dot(avg(grad(u)), jump(v, n))*dI \ - dot(avg(grad(v)), jump(u, n))*dI \ + alpha/h*jump(u)*jump(v)*dI \ + beta*dot(jump(grad(u)), jump(grad(v)))*dO # Define linear form L = f*v*dX