Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractFiniteElement #197

Merged
merged 120 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
dd33b8a
Remove a lots of finiteelement stuff
mscroggs Mar 8, 2023
b3f2ba7
__all_classes__
mscroggs Mar 13, 2023
1943aec
remove mixedelement
mscroggs Mar 13, 2023
ea56719
remove use of deleted elements
mscroggs Mar 13, 2023
035435f
remove print
mscroggs Mar 13, 2023
caf7b38
working on element interface
mscroggs Mar 22, 2023
e868900
Merge branch 'main' into mscroggs/remove-elements
mscroggs May 9, 2023
3f22624
Merge branch 'mscroggs/remove-elements' of github.com:FEniCS/ufl into…
mscroggs May 15, 2023
ba1f25d
working on new elements
mscroggs May 16, 2023
f33ceb7
Add broken demos
mscroggs May 16, 2023
07c6880
Merge branch 'main' into mscroggs/remove-elements
mscroggs May 16, 2023
ba2a61c
make (almost) all tests pass
mscroggs May 16, 2023
ee86194
Move demos out of broken folder, fix a few tests
mscroggs May 16, 2023
4efb929
Hermite is H1
mscroggs May 18, 2023
d3382e5
flake8
mscroggs May 18, 2023
0250353
symmetric elements
mscroggs May 19, 2023
11f0397
subelements in splitting test
mscroggs May 19, 2023
44ec85f
fix another test
mscroggs May 19, 2023
47aec60
MixedElasticity demo
mscroggs May 23, 2023
3e445a6
fix final test
mscroggs May 23, 2023
a9a6805
Merge branch 'main' into mscroggs/remove-elements
mscroggs Sep 12, 2023
ca6954d
rename FiniteElementBase -> AbstractFiniteElement
mscroggs Sep 12, 2023
244825f
Merge branch 'main' into mscroggs/remove-elements
mscroggs Sep 12, 2023
1b53373
doc
mscroggs Sep 12, 2023
45f30d6
Template structure for pullback
mscroggs Sep 12, 2023
cbd437b
working on pull back
mscroggs Sep 18, 2023
5e0acfa
Merge branch 'main' into mscroggs/remove-elements
mscroggs Sep 19, 2023
e3c2278
fixes
mscroggs Sep 19, 2023
c24ffbf
skip flake8 on pull_back for now
mscroggs Sep 19, 2023
f685621
flake and pydocstyle
mscroggs Sep 19, 2023
1a8cd87
update tests
mscroggs Sep 19, 2023
926cd1d
basix branch
mscroggs Sep 19, 2023
106d602
Merge branch 'main' into mscroggs/remove-elements
mscroggs Sep 19, 2023
b8cec14
flake8
mscroggs Sep 19, 2023
8f07327
start making ffc tests pass
mscroggs Sep 19, 2023
1e36fef
Merge branch 'main' into mscroggs/remove-elements
mscroggs Sep 20, 2023
2c9f2cd
fix imports
mscroggs Sep 20, 2023
dcd9a31
flake
mscroggs Sep 20, 2023
8da1942
isort
mscroggs Sep 20, 2023
6a79e81
make test pass
mscroggs Sep 20, 2023
5a227bd
ffc branch
mscroggs Sep 20, 2023
bcce71d
as_domain in measure (if domain is not None)
mscroggs Sep 20, 2023
1792bdc
corrections
mscroggs Sep 20, 2023
c50c6af
dolfinx branch
mscroggs Sep 20, 2023
d3c7d20
Merge branch 'main' into mscroggs/remove-elements
mscroggs Sep 21, 2023
fa87aeb
Merge branch 'main' into mscroggs/remove-elements
mscroggs Sep 21, 2023
244a063
Add some types
mscroggs Sep 21, 2023
05ffc87
no product needed
mscroggs Sep 21, 2023
8589d8f
sub_rsh
mscroggs Sep 21, 2023
9a07a0b
()
mscroggs Sep 21, 2023
a2d93f1
flattened... not property
mscroggs Sep 21, 2023
f00f578
documentation
mscroggs Sep 21, 2023
e26a52d
Merge branch 'main' into mscroggs/remove-elements
mscroggs Sep 22, 2023
bdadf51
remove component functions
mscroggs Sep 22, 2023
1f9cd59
flake, remove unused function
mscroggs Sep 22, 2023
a0fbe3c
remove _is_linear
mscroggs Sep 22, 2023
7d431b7
put function back
mscroggs Sep 22, 2023
108d55a
remove is_cellwise_constant
mscroggs Sep 22, 2023
3e5bc90
remove is_globally_constant
mscroggs Sep 22, 2023
e51464a
remove sorting of elements by hash
mscroggs Sep 22, 2023
368ec3c
improve doc
mscroggs Sep 22, 2023
b48d4e2
working on new pull back classes
mscroggs Sep 22, 2023
1dbf669
update pull backs in demos and tests
mscroggs Sep 22, 2023
829cd09
flake8
mscroggs Sep 22, 2023
2cf70fa
add mixed pull back
mscroggs Sep 23, 2023
c4d1fc6
symmetric pull back
mscroggs Sep 24, 2023
1766e06
flake
mscroggs Sep 24, 2023
07f300c
flake8
mscroggs Sep 24, 2023
1e642d1
a -> A
mscroggs Sep 24, 2023
ee1ca9b
Get (physical) value shape from the pull back
mscroggs Sep 24, 2023
cf021d5
tidy up element classes
mscroggs Sep 24, 2023
7c0f911
flake
mscroggs Sep 24, 2023
bf2dc41
add embedded super- and sub-degrees
mscroggs Sep 24, 2023
8218750
Add Legacy elements (for TSFC support)
mscroggs Sep 25, 2023
5fb58c0
flake
mscroggs Sep 25, 2023
b562cd3
tsfc branch
mscroggs Sep 25, 2023
7e728fe
don't look up components for scalar-valued elements
mscroggs Sep 25, 2023
f269e04
sub_elements() -> sub_elements
mscroggs Sep 25, 2023
74511e0
sobolev_space() -> sobolev_space
mscroggs Sep 25, 2023
2813a94
is_identity rather than checking type
mscroggs Sep 25, 2023
4df037a
abstractproperty
mscroggs Sep 25, 2023
cbae750
docs
mscroggs Sep 25, 2023
bd5ebe3
Merge branch 'mscroggs/remove-elements' of github.com:FEniCS/ufl into…
mscroggs Sep 25, 2023
fe48774
use is_identity
mscroggs Sep 25, 2023
7f10026
doc
mscroggs Sep 25, 2023
eacf1a2
simplify pullback code
mscroggs Sep 25, 2023
8040982
tweak docstrings
mscroggs Sep 25, 2023
fbc1e31
clarify
mscroggs Sep 25, 2023
00d13cb
property and custom pullback
mscroggs Sep 25, 2023
d1d1153
()
mscroggs Sep 25, 2023
48dc533
Use IdentityPullBack if mixed elements sub elements all use it
mscroggs Sep 25, 2023
6147370
Docstring
mscroggs Sep 26, 2023
4cb9e69
fixes in legacy
mscroggs Sep 26, 2023
064a795
l -> L
mscroggs Sep 26, 2023
274c8cc
physical pull back
mscroggs Sep 26, 2023
3527355
@property in legacy
mscroggs Sep 26, 2023
e37805f
fixing legacy elements
mscroggs Sep 26, 2023
4ea9602
fix symmetry ordering
mscroggs Sep 26, 2023
7567d97
generalise symmetric pull back to sub-elements with a value size
mscroggs Sep 26, 2023
4b8f35f
update AUTHORS
mscroggs Sep 26, 2023
e18fe90
fdlake
mscroggs Sep 26, 2023
2bb149e
fix when element may not be fully initialised
mscroggs Sep 26, 2023
cd28ee6
set self._sub_elements before they're needed
mscroggs Sep 26, 2023
973f6c5
update index order in legacy
mscroggs Sep 26, 2023
a349d27
Rename pull_back -> pullback and improve docs
mscroggs Sep 26, 2023
909b19a
rename pullback in tests
mscroggs Sep 26, 2023
329051b
fix embedded degrees
mscroggs Sep 26, 2023
5ba23b9
flake
mscroggs Sep 26, 2023
5f479dd
pullback rename in demos
mscroggs Sep 26, 2023
a61eeb7
replace degree() with embedded_superdegree
mscroggs Sep 26, 2023
610a9c1
embedded degrees in hdivcurl
mscroggs Sep 26, 2023
5002c80
fix more embedded degrees
mscroggs Sep 26, 2023
c4716d9
correct blockshape
mscroggs Sep 26, 2023
145fbb4
max not sum
mscroggs Sep 27, 2023
d0f3af6
Revert "max not sum"
mscroggs Sep 27, 2023
c7e0d5f
only for testing
mscroggs Sep 28, 2023
99d2bcc
Merge branch 'main' into mscroggs/remove-elements
mscroggs Oct 9, 2023
93940f4
Merge branch 'main' into mscroggs/remove-elements
mscroggs Oct 13, 2023
614719a
Merge branch 'main' into mscroggs/remove-elements
mscroggs Oct 16, 2023
06971e9
set branches to main
mscroggs Oct 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tsfc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
path: ./tsfc
repository: firedrakeproject/tsfc
ref: master
ref: mscroggs/newfl-legacy
- name: Install tsfc
run: |
cd tsfc
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ Contributors:
| Nacime Bouziani <[email protected]>
| Reuben W. Hill <[email protected]>
| Nacime Bouziani <[email protected]>
| Matthew Scroggs <[email protected]>
15 changes: 9 additions & 6 deletions demo/Constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,23 @@
# Modified by Martin Sandve Alnes, 2009
#
# Test form for scalar and vector constants.
from ufl import (Coefficient, Constant, FiniteElement, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorConstant,
VectorElement, dot, dx, grad, inner, triangle)
from ufl import (Coefficient, Constant, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorConstant, dot, dx, grad,
inner, triangle)
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

cell = triangle
element = FiniteElement("Lagrange", cell, 1)
domain = Mesh(VectorElement("Lagrange", cell, 1))
element = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

v = TestFunction(space)
u = TrialFunction(space)
f = Coefficient(space)

c = Constant(space)
d = VectorConstant(space)
c = Constant(domain)
d = VectorConstant(domain)

a = c * dot(grad(v), grad(u)) * dx
L = inner(d, grad(v)) * dx
9 changes: 6 additions & 3 deletions demo/ConvectionJacobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dot, dx, grad, triangle
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, dot, dx, grad, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

element = VectorElement("Lagrange", triangle, 1)
domain = Mesh(VectorElement("Lagrange", triangle, 1))
element = FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

u = TrialFunction(space)
Expand Down
9 changes: 6 additions & 3 deletions demo/ConvectionJacobi2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dx, i, j, triangle
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, dx, i, j, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

element = VectorElement("Lagrange", triangle, 1)
domain = Mesh(VectorElement("Lagrange", triangle, 1))
element = FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

u = TrialFunction(space)
Expand Down
9 changes: 6 additions & 3 deletions demo/ConvectionVector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, VectorElement, dot, dx, grad, triangle
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, dot, dx, grad, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

element = VectorElement("Lagrange", triangle, 1)
domain = Mesh(VectorElement("Lagrange", triangle, 1))
element = FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

v = TestFunction(space)
Expand Down
9 changes: 6 additions & 3 deletions demo/Elasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
# Modified by: Martin Sandve Alnes
# Date: 2009-01-12
#
from ufl import FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dx, grad, inner, tetrahedron
from ufl import FunctionSpace, Mesh, TestFunction, TrialFunction, dx, grad, inner, tetrahedron
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

element = VectorElement("Lagrange", tetrahedron, 1)
domain = Mesh(VectorElement("Lagrange", tetrahedron, 1))
element = FiniteElement("Lagrange", tetrahedron, 1, (3, ), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", tetrahedron, 1, (3, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

v = TestFunction(space)
Expand Down
9 changes: 6 additions & 3 deletions demo/EnergyNorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
#
# This example demonstrates how to define a functional, here
# the energy norm (squared) for a reaction-diffusion problem.
from ufl import Coefficient, FiniteElement, FunctionSpace, Mesh, VectorElement, dot, dx, grad, tetrahedron
from ufl import Coefficient, FunctionSpace, Mesh, dot, dx, grad, tetrahedron
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

element = FiniteElement("Lagrange", tetrahedron, 1)
domain = Mesh(VectorElement("Lagrange", tetrahedron, 1))
element = FiniteElement("Lagrange", tetrahedron, 1, (), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", tetrahedron, 1, (3, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

v = Coefficient(space)
Expand Down
10 changes: 6 additions & 4 deletions demo/Equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
# 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().
from ufl import (Coefficient, FiniteElement, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dot, dx,
grad, lhs, rhs, triangle)
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, dot, dx, grad, lhs, rhs, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

element = FiniteElement("Lagrange", triangle, 1)
domain = Mesh(VectorElement("Lagrange", triangle, 1))
element = FiniteElement("Lagrange", triangle, 1, (), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

k = 0.1
Expand Down
9 changes: 6 additions & 3 deletions demo/ExplicitConvection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dot, dx, grad, triangle
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, dot, dx, grad, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

element = VectorElement("Lagrange", triangle, 1)
domain = Mesh(VectorElement("Lagrange", triangle, 1))
element = FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

u = TrialFunction(space)
Expand Down
56 changes: 0 additions & 56 deletions demo/FEEC.py

This file was deleted.

10 changes: 6 additions & 4 deletions demo/FunctionOperators.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
# along with UFL. If not, see <http://www.gnu.org/licenses/>.
#
# Test form for operators on Coefficients.
from ufl import (Coefficient, FiniteElement, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dot, dx,
grad, max_value, sqrt, triangle)
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, dot, dx, grad, max_value, sqrt, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

element = FiniteElement("Lagrange", triangle, 1)
domain = Mesh(VectorElement("Lagrange", triangle, 1))
element = FiniteElement("Lagrange", triangle, 1, (), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

v = TestFunction(space)
Expand Down
9 changes: 6 additions & 3 deletions demo/H1norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import Coefficient, FiniteElement, FunctionSpace, Mesh, VectorElement, dot, dx, grad, triangle
from ufl import Coefficient, FunctionSpace, Mesh, dot, dx, grad, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

element = FiniteElement("Lagrange", triangle, 1)
domain = Mesh(VectorElement("Lagrange", triangle, 1))
element = FiniteElement("Lagrange", triangle, 1, (), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

f = Coefficient(space)
Expand Down
12 changes: 7 additions & 5 deletions demo/HarmonicMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
# Author: Martin Alnes
# Date: 2009-04-09
#
from ufl import (Coefficient, FiniteElement, FunctionSpace, Mesh, VectorElement, derivative, dot, dx, grad, inner,
triangle)
from ufl import Coefficient, FunctionSpace, Mesh, derivative, dot, dx, grad, inner, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

cell = triangle
X = VectorElement("Lagrange", cell, 1)
Y = FiniteElement("Lagrange", cell, 1)
domain = Mesh(VectorElement("Lagrange", cell, 1))
X = FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1)
Y = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1))
X_space = FunctionSpace(domain, X)
Y_space = FunctionSpace(domain, Y)

Expand Down
14 changes: 8 additions & 6 deletions demo/HarmonicMap2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
# Author: Martin Alnes
# Date: 2009-04-09
#
from ufl import (Coefficient, FiniteElement, FunctionSpace, Mesh, VectorElement, derivative, dot, dx, grad, inner,
split, triangle)
from ufl import Coefficient, FunctionSpace, Mesh, derivative, dot, dx, grad, inner, split, triangle
from ufl.finiteelement import FiniteElement, MixedElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

cell = triangle
X = VectorElement("Lagrange", cell, 1)
Y = FiniteElement("Lagrange", cell, 1)
M = X * Y
domain = Mesh(VectorElement("Lagrange", cell, 1))
X = FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1)
Y = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
M = MixedElement([X, Y])
domain = Mesh(FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, M)

u = Coefficient(space)
Expand Down
10 changes: 6 additions & 4 deletions demo/Heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
# The bilinear form a(v, u1) and linear form L(v) for
# one backward Euler step with the heat equation.
#
from ufl import (Coefficient, Constant, FiniteElement, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement,
dot, dx, grad, triangle)
from ufl import Coefficient, Constant, FunctionSpace, Mesh, TestFunction, TrialFunction, dot, dx, grad, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

cell = triangle
element = FiniteElement("Lagrange", cell, 1)
domain = Mesh(VectorElement("Lagrange", cell, 1))
element = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

v = TestFunction(space) # Test function
Expand Down
12 changes: 7 additions & 5 deletions demo/HornSchunck.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
# http://code.google.com/p/debiosee/wiki/DemosOptiocFlowHornSchunck
# but not tested so this could contain errors!
#
from ufl import (Coefficient, Constant, FiniteElement, FunctionSpace, Mesh, VectorElement, derivative, dot, dx, grad,
inner, triangle)
from ufl import Coefficient, Constant, FunctionSpace, Mesh, derivative, dot, dx, grad, inner, triangle
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

# Finite element spaces for scalar and vector fields
cell = triangle
S = FiniteElement("CG", cell, 1)
V = VectorElement("CG", cell, 1)
domain = Mesh(VectorElement("Lagrange", cell, 1))
S = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
V = FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1))
S_space = FunctionSpace(domain, S)
V_space = FunctionSpace(domain, V)

Expand Down
16 changes: 9 additions & 7 deletions demo/HyperElasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
# Date: 2008-12-22
#

from ufl import (Coefficient, Constant, FacetNormal, FunctionSpace, Identity, Mesh, SpatialCoordinate, TestFunction,
TrialFunction, derivative, det, diff, dot, ds, dx, exp, grad, inner, inv, tetrahedron, tr, variable)
from ufl.finiteelement import FiniteElement
# Modified by Garth N. Wells, 2009
from ufl import (Coefficient, Constant, FacetNormal, FiniteElement, FunctionSpace, Identity, Mesh, SpatialCoordinate,
TensorElement, TestFunction, TrialFunction, VectorElement, derivative, det, diff, dot, ds, dx, exp,
grad, inner, inv, tetrahedron, tr, variable)
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

# Cell and its properties
cell = tetrahedron
domain = Mesh(VectorElement("Lagrange", cell, 1))
domain = Mesh(FiniteElement("Lagrange", cell, 1, (3, ), identity_pullback, H1))
d = cell.geometric_dimension()
N = FacetNormal(domain)
x = SpatialCoordinate(domain)

# Elements
u_element = VectorElement("CG", cell, 2)
p_element = FiniteElement("CG", cell, 1)
A_element = TensorElement("CG", cell, 1)
u_element = FiniteElement("Lagrange", cell, 2, (3, ), identity_pullback, H1)
p_element = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
A_element = FiniteElement("Lagrange", cell, 1, (3, 3), identity_pullback, H1)

# Spaces
u_space = FunctionSpace(domain, u_element)
Expand Down
10 changes: 6 additions & 4 deletions demo/HyperElasticity1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import (Coefficient, Constant, FiniteElement, FunctionSpace, Mesh, VectorElement, derivative, dx, exp,
interval, variable)
from ufl import Coefficient, Constant, FunctionSpace, Mesh, derivative, dx, exp, interval, variable
from ufl.finiteelement import FiniteElement
from ufl.pullback import identity_pullback
from ufl.sobolevspace import H1

cell = interval
element = FiniteElement("CG", cell, 2)
domain = Mesh(VectorElement("Lagrange", cell, 1))
element = FiniteElement("Lagrange", cell, 2, (), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", cell, 1, (1, ), identity_pullback, H1))
space = FunctionSpace(domain, element)

u = Coefficient(space)
Expand Down
Loading
Loading