Debian Codegraph @

demo/undocumented/lift-drag/cpp/Functionals.ufl

raw
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007 Anders Logg
3 #
4 # This file is part of DOLFIN.
5 #
6 # DOLFIN is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Lesser General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # DOLFIN is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public License
17 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
18 #
19 # Modified by Martin S. Alnæs, 2012
20 #
21 # First added: 2007-05-14
22 # Last changed: 2012-08-31
23 #
24 # This form defines the functional for computing the
25 # drag on a body.
26 #
27 # Compile this form with FFC: ffc -l dolfin Functionals.ufl
28
29 from ufl_legacy import (Coefficient, ds, FiniteElement,
30 FacetNormal, triangle)
31
32 cell = triangle
33 element = FiniteElement("Lagrange", cell, 1)
34
35 n = FacetNormal(cell)
36 p = Coefficient(element)
37 drag = -p*n[0]*ds(1)
38 lift = p*n[1]*ds(1)
39
40 forms = [drag, lift]