Debian Codegraph @

demo/RestrictedElement.ufl

raw
1 # Copyright (C) 2009 Kristian B. Oelgaard
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 # Restriction of a finite element.
19 # The below syntax show how one can restrict a higher order Lagrange element
20 # to only take into account those DOFs that live on the facets.
21 #
22 # Compile this form with FFC: ffc RestrictedElement.ufl
23
24 # Restricted element
25 CG_R = FiniteElement("Lagrange", triangle, 4)["facet"]
26 u_r = TrialFunction(CG_R)
27 v_r = TestFunction(CG_R)
28 a = avg(v_r)*avg(u_r)*dS + v_r*u_r*ds
29
30 #CG = FiniteElement("Lagrange", triangle, 4)
31 #CG_R = CG["facet"]
32 #u_r = TrialFunction(CG_R)
33 #v_r = TestFunction(CG_R)
34 #a = v_r('+')*u_r('+')*dS + v_r('-')*u_r('-')*dS + v_r*u_r*ds
35
36 # Mixed element
37 #CG = FiniteElement("Lagrange", triangle, 4)
38 #CG_R = CG["facet"]
39 #ME = CG * CG_R
40 #u, u_r = TrialFunctions(ME)
41 #v, v_r = TestFunctions(ME)
42 #a = v*u*dx + v_r('+')*u_r('+')*dS + v_r('+')*u_r('+')*dS + v_r*u_r*ds
43