/usr/share/doc/python-ufl/demo/Equation.ufl is in python-ufl-doc 2017.2.0.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # Copyright (C) 2007 Anders Logg
#
# This file is part of UFL.
#
# UFL 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.
#
# UFL 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 UFL. If not, see <http://www.gnu.org/licenses/>.
#
# Specification of a system F(v, u) = 0 and extraction of
# the bilinear and linear forms a and L for the left- and
# right-hand sides:
#
# F(v, u) = a(v, u) - L(v) = 0
#
# The example below demonstrates the specification of the
# linear system for a cG(1)/Crank-Nicholson time step for
# the heat equation.
#
# The below formulation is equivalent to writing
#
# a = v*u*dx + 0.5*k*dot(grad(v), grad(u))*dx
# L = v*u0*dx - 0.5*k*dot(grad(v), grad(u0))*dx
#
# but instead of manually shuffling terms not including
# the unknown u to the right-hand side, all terms may
# be listed on one line and left- and right-hand sides
# extracted by lhs() and rhs().
element = FiniteElement("Lagrange", triangle, 1)
k = 0.1
v = TestFunction(element)
u = TrialFunction(element)
u0 = Coefficient(element)
F = v*(u - u0)*dx + k*dot(grad(v), grad(0.5*(u0 + u)))*dx
a = lhs(F)
L = rhs(F)
|