# -*- coding: utf-8 -*- # Copyright (C) 2007 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 . # # Modified by Martin S. Alnæs, 2012 # # First added: 2007-05-14 # Last changed: 2012-08-31 # # This form defines the functional for computing the # drag on a body. # # Compile this form with FFC: ffc -l dolfin Functionals.ufl from ufl_legacy import (Coefficient, ds, FiniteElement, FacetNormal, triangle) cell = triangle element = FiniteElement("Lagrange", cell, 1) n = FacetNormal(cell) p = Coefficient(element) drag = -p*n[0]*ds(1) lift = p*n[1]*ds(1) forms = [drag, lift]