File: MixedGradient.py

package info (click to toggle)
fenics-ffcx 1%3A0.9.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 948 kB
  • sloc: python: 8,246; ansic: 109; makefile: 58
file content (15 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""Mixed gradient demo."""

import basix.ufl
from ufl import FunctionSpace, Mesh, TestFunctions, TrialFunctions, ds, grad, inner

element1 = basix.ufl.element("DG", "triangle", 1)
element2 = basix.ufl.element("DGT", "triangle", 1)
element = basix.ufl.mixed_element([element1, element2])
domain = Mesh(basix.ufl.element("Lagrange", "triangle", 1, shape=(2,)))
space = FunctionSpace(domain, element)

u = TrialFunctions(space)[0]
v = TestFunctions(space)[0]

a = inner(grad(u), grad(v)) * ds