Debian Codegraph @

demo/Biharmonic.ufl

raw
1 # Copyright (C) 2009 Kristian B. Oelgaard, Garth N. Wells and Anders Logg
2 #
3 # This file is part of FFC.
4 #
5 # FFC is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # FFC is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with FFC. If not, see <http://www.gnu.org/licenses/>.
17 #
18 # First added: 2009-06-26
19 # Last changed: 2011-03-08
20 #
21 # The bilinear form a(u, v) and linear form L(v) for
22 # Biharmonic equation in a discontinuous Galerkin (DG)
23 # formulation.
24 #
25 # Compile this form with FFC: ffc -l dolfin Biharmonic.ufl
26
27 # Elements
28 element = FiniteElement("Lagrange", triangle, 2)
29
30 # Trial and test functions
31 u = TrialFunction(element)
32 v = TestFunction(element)
33
34 # Facet normal, mesh size and right-hand side
35 n = FacetNormal(triangle)
36 h = 2.0*Circumradius(triangle)
37 f = Coefficient(element)
38
39 # Compute average of mesh size
40 h_avg = (h('+') + h('-'))/2.0
41
42 # Parameters
43 alpha = Coefficient(FiniteElement("Real", triangle, 0))
44
45 # Bilinear form
46 a = inner(div(grad(u)), div(grad(v)))*dx \
47 - inner(jump(grad(u), n), avg(div(grad(v))))*dS \
48 - inner(avg(div(grad(u))), jump(grad(v), n))*dS \
49 + alpha/h_avg*inner(jump(grad(u),n), jump(grad(v),n))*dS
50
51 # Linear form
52 L = f*v*dx