Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
jhale committed Oct 4, 2023
2 parents 7fdc60f + 1d27238 commit 829854a
Show file tree
Hide file tree
Showing 92 changed files with 3,100 additions and 4,001 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/dolfin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ jobs:
container: fenicsproject/test-env:nightly-openmpi

env:
CC: clang
CXX: clang++

PETSC_ARCH: linux-gnu-complex-32
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
Expand Down Expand Up @@ -67,6 +64,7 @@ jobs:
with:
path: ./dolfinx
repository: FEniCS/dolfinx
ref: main
- name: Get DOLFINx source (specified branch/tag)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
Expand All @@ -84,7 +82,7 @@ jobs:
- name: Build DOLFINx C++ unit tests
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/test/ -S build/test/
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/test/ -S dolfinx/cpp/test/
cmake --build build/test
- name: Run DOLFINx C++ unit tests
run: |
Expand All @@ -93,3 +91,5 @@ jobs:
- name: Run DOLFINx Python unit tests
run: python3 -m pytest -n auto dolfinx/python/test/unit
- name: Run DOLFINx Python demos
run: python3 -m pytest -n=2 -m serial dolfinx/python/demo/test.py
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', "3.11"]
python-version: ['3.8', '3.9', '3.10', "3.11"]

env:
CC: gcc-10
Expand Down
9 changes: 6 additions & 3 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
Changelog
=========

0.6.0
-----
See https://github.com/FEniCS/ffcx/compare/v0.5.0...v0.6.0

0.5.0
-----
See: https://github.com/FEniCS/ffcx/compare/v0.5.0...v0.4.0 for details
See: https://github.com/FEniCS/ffcx/compare/v0.5.0...v0.4.0

0.4.0
-----
See: https://github.com/FEniCS/ffcx/compare/v0.4.0...v0.3.0 for details
See: https://github.com/FEniCS/ffcx/compare/v0.4.0...v0.3.0

0.3.0
-----
See: https://github.com/FEniCS/ffcx/compare/v0.3.0...v0.2.0 for details
See: https://github.com/FEniCS/ffcx/compare/v0.3.0...v0.2.0

0.2.0
-----
Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.19)

project(ufcx VERSION 0.6.0 DESCRIPTION "UFCx interface header for finite element kernels"
project(ufcx VERSION 0.7.0 DESCRIPTION "UFCx interface header for finite element kernels"
LANGUAGES C
HOMEPAGE_URL https://github.com/fenics/ffcx)
include(GNUInstallDirs)
Expand Down
13 changes: 7 additions & 6 deletions demo/BiharmonicHHJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
# The bilinear form a(u, v) and linear form L(v) for
# Biharmonic equation in Hellan-Herrmann-Johnson (HHJ)
# formulation.
from ufl import (Coefficient, FacetNormal, FiniteElement, TestFunctions,
TrialFunctions, dot, dS, ds, dx, grad, inner, jump, triangle)
import basix.ufl
from ufl import (Coefficient, FacetNormal, TestFunctions, TrialFunctions, dot,
dS, ds, dx, grad, inner, jump, triangle)

HHJ = FiniteElement('HHJ', triangle, 2)
CG = FiniteElement('CG', triangle, 3)
mixed_element = HHJ * CG
HHJ = basix.ufl.element('HHJ', "triangle", 2)
P = basix.ufl.element('P', "triangle", 3)
mixed_element = basix.ufl.mixed_element([HHJ, P])

(sigma, u) = TrialFunctions(mixed_element)
(tau, v) = TestFunctions(mixed_element)
f = Coefficient(CG)
f = Coefficient(P)


def b(sigma, v):
Expand Down
15 changes: 8 additions & 7 deletions demo/BiharmonicRegge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
#
# The bilinear form a(u, v) and linear form L(v) for
# Biharmonic equation in Regge formulation.
from ufl import (Coefficient, FacetNormal, FiniteElement, Identity,
TestFunctions, TrialFunctions, dot, dS, ds, dx, grad, inner,
jump, tetrahedron, tr)
import basix.ufl
from ufl import (Coefficient, FacetNormal, Identity, TestFunctions,
TrialFunctions, dot, dS, ds, dx, grad, inner, jump,
tetrahedron, tr)

REG = FiniteElement('Regge', tetrahedron, 1)
CG = FiniteElement('Lagrange', tetrahedron, 2)
mixed_element = REG * CG
REG = basix.ufl.element("Regge", "tetrahedron", 1)
P = basix.ufl.element("Lagrange", "tetrahedron", 2)
mixed_element = basix.ufl.mixed_element([REG, P])

(sigma, u) = TrialFunctions(mixed_element)
(tau, v) = TestFunctions(mixed_element)
f = Coefficient(CG)
f = Coefficient(P)


def S(mu):
Expand Down
12 changes: 9 additions & 3 deletions demo/CellGeometry.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Copyright (C) 2013 Martin S. Alnaes
#
# A functional M involving a bunch of cell geometry quantities.
import basix.ufl
from ufl import (CellVolume, Circumradius, Coefficient, FacetArea, FacetNormal,
FiniteElement, SpatialCoordinate, ds, dx, tetrahedron)
SpatialCoordinate, ds, dx, tetrahedron, TrialFunction)
from ufl.geometry import FacetEdgeVectors

cell = tetrahedron

V = FiniteElement("CG", cell, 1)
V = basix.ufl.element("P", cell.cellname(), 1)
u = Coefficient(V)

# TODO: Add all geometry for all cell types to this and other demo files, need for regression test.
Expand All @@ -17,3 +18,8 @@
area = FacetArea(cell)

M = u * (x[0] * vol * rad) * dx + u * (x[0] * vol * rad * area) * ds # + u*area*avg(n[0]*x[0]*vol*rad)*dS

# Test some obscure functionality
fev = FacetEdgeVectors(cell)
v = TrialFunction(V)
L = fev[0, 0] * v * ds
39 changes: 39 additions & 0 deletions demo/ComplexPoisson.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (C) 2023 Chris Richardson
#
# This file is part of FFCx.
#
# FFCx 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.
#
# FFCx 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 FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# The bilinear form a(u, v) and linear form L(v) for
# Poisson's equation using bilinear elements on bilinear mesh geometry.
import basix.ufl
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
dx, grad, inner)

coords = basix.ufl.element("P", "triangle", 2, shape=(2, ))
mesh = Mesh(coords)
dx = dx(mesh)

element = basix.ufl.element("P", mesh.ufl_cell().cellname(), 2)
space = FunctionSpace(mesh, element)

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

# Test literal complex number in form
k = 3.213 + 1.023j

a = k * inner(grad(u), grad(v)) * dx
L = inner(k * f, v) * dx
6 changes: 3 additions & 3 deletions demo/Components.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# This example demonstrates how to create vectors component-wise
from ufl import (Coefficient, TestFunction, VectorElement, as_vector, dot, dx,
tetrahedron)
import basix.ufl
from ufl import Coefficient, TestFunction, as_vector, dot, dx

element = VectorElement("Lagrange", tetrahedron, 1)
element = basix.ufl.element("Lagrange", "tetrahedron", 1, shape=(3, ))

v = TestFunction(element)
f = Coefficient(element)
Expand Down
7 changes: 4 additions & 3 deletions demo/Conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# Illustration on how to use Conditional to define a source term
from ufl import (And, Constant, FiniteElement, Not, Or, SpatialCoordinate,
TestFunction, conditional, dx, ge, gt, le, lt, triangle)
import basix.ufl
from ufl import (And, Constant, Not, Or, SpatialCoordinate, TestFunction,
conditional, dx, ge, gt, le, lt, triangle)

element = FiniteElement("Lagrange", triangle, 2)
element = basix.ufl.element("Lagrange", "triangle", 2)

v = TestFunction(element)
g = Constant(triangle)
Expand Down
25 changes: 13 additions & 12 deletions demo/ExpressionInterpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@
# a set of interpolation points

import basix
from ufl import (Coefficient, FiniteElement, FunctionSpace, Mesh, MixedElement,
VectorElement, grad, triangle)
import basix.ufl
from ffcx.element_interface import QuadratureElement
from ufl import Coefficient, FunctionSpace, Mesh, grad

# Define mesh
cell = triangle
v_el = VectorElement("Lagrange", cell, 1)
cell = "triangle"
v_el = basix.ufl.element("Lagrange", cell, 1, shape=(2, ))
mesh = Mesh(v_el)

# Define mixed function space
el = FiniteElement("CG", cell, 2)
el_int = VectorElement("Discontinuous Lagrange", cell, 1)
me = MixedElement([el, el_int])
el = basix.ufl.element("P", cell, 2)
el_int = basix.ufl.element("Discontinuous Lagrange", cell, 1, shape=(2, ))
me = basix.ufl.mixed_element([el, el_int])
V = FunctionSpace(mesh, me)
u = Coefficient(V)

Expand All @@ -41,21 +42,21 @@
# Define an expression using quadrature elements
q_rule = "gauss_jacobi"
q_degree = 3
q_el = FiniteElement("Quadrature", cell, q_degree, quad_scheme=q_rule)
q_el = QuadratureElement(cell, (), q_rule, q_degree)
Q = FunctionSpace(mesh, q_el)
q = Coefficient(Q)
powq = 3 * q**2

# Extract basix cell type
b_cell = basix.cell.string_to_type(cell.cellname())
b_cell = basix.cell.string_to_type(cell)

# Find quadrature points for quadrature element
b_rule = basix.quadrature.string_to_type(q_rule)
quadrature_points, _ = basix.make_quadrature(b_rule, b_cell, q_degree)
quadrature_points, _ = basix.quadrature.make_quadrature(b_cell, q_degree, rule=b_rule)

# Get interpolation points for output space
family = basix.finite_element.string_to_family("Lagrange", cell.cellname())
b_element = basix.create_element(family, b_cell, 4, basix.LagrangeVariant.gll_warped, True)
family = basix.finite_element.string_to_family("Lagrange", cell)
b_element = basix.create_element(family, b_cell, 4, basix.LagrangeVariant.gll_warped, discontinuous=True)
interpolation_points = b_element.points

# Create expressions that can be used for interpolation
Expand Down
7 changes: 4 additions & 3 deletions demo/FacetIntegrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
# Last changed: 2011-03-08
#
# Simple example of a form defined over exterior and interior facets.
from ufl import (FacetNormal, FiniteElement, TestFunction, TrialFunction, avg,
ds, dS, grad, inner, jump, triangle)
import basix.ufl
from ufl import (FacetNormal, TestFunction, TrialFunction, avg, ds, dS, grad,
inner, jump, triangle)

element = FiniteElement("Discontinuous Lagrange", triangle, 1)
element = basix.ufl.element("Discontinuous Lagrange", "triangle", 1)

u = TrialFunction(element)
v = TestFunction(element)
Expand Down
7 changes: 4 additions & 3 deletions demo/FacetRestrictionAD.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
from ufl import (Coefficient, FiniteElement, TestFunction, TrialFunction, avg,
derivative, dot, dS, dx, grad, inner, triangle)
import basix.ufl
from ufl import (Coefficient, TestFunction, TrialFunction, avg, derivative,
dot, dS, dx, grad, inner)

element = FiniteElement("Discontinuous Lagrange", triangle, 1)
element = basix.ufl.element("Discontinuous Lagrange", "triangle", 1)

v = TestFunction(element)
w = Coefficient(element)
Expand Down
15 changes: 8 additions & 7 deletions demo/HyperElasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# Date: 2008-12-22
#

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

# Cell and its properties
cell = tetrahedron
Expand All @@ -16,9 +17,9 @@
x = SpatialCoordinate(cell)

# Elements
u_element = VectorElement("CG", cell, 2)
p_element = FiniteElement("CG", cell, 1)
A_element = TensorElement("CG", cell, 1)
u_element = basix.ufl.element("P", cell.cellname(), 2, shape=(3, ))
p_element = basix.ufl.element("P", cell.cellname(), 1)
A_element = basix.ufl.element("P", cell.cellname(), 1, shape=(3, 3))

# Test and trial functions
v = TestFunction(u_element)
Expand Down
6 changes: 3 additions & 3 deletions demo/MassDG0.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# The bilinear form for a mass matrix.
from ufl import (FiniteElement, TestFunction, TrialFunction, dx, inner,
tetrahedron)
import basix.ufl
from ufl import TestFunction, TrialFunction, dx, inner

element = FiniteElement("DG", tetrahedron, 0)
element = basix.ufl.element("DG", "tetrahedron", 0)

v = TestFunction(element)
u = TrialFunction(element)
Expand Down
5 changes: 3 additions & 2 deletions demo/MassHcurl_2D_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
from ufl import FiniteElement, TestFunction, TrialFunction, dx, inner, triangle
import basix.ufl
from ufl import TestFunction, TrialFunction, dx, inner

element = FiniteElement("N1curl", triangle, 1)
element = basix.ufl.element("N1curl", "triangle", 1)

v = TestFunction(element)
u = TrialFunction(element)
Expand Down
5 changes: 3 additions & 2 deletions demo/MassHdiv_2D_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
from ufl import FiniteElement, TestFunction, TrialFunction, dx, inner, triangle
import basix.ufl
from ufl import TestFunction, TrialFunction, dx, inner

element = FiniteElement("BDM", triangle, 1)
element = basix.ufl.element("BDM", "triangle", 1)

v = TestFunction(element)
u = TrialFunction(element)
Expand Down
7 changes: 4 additions & 3 deletions demo/MathFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# Test all algebra operators on Coefficients.
from ufl import (Coefficient, FiniteElement, acos, asin, atan, bessel_J,
bessel_Y, cos, dx, erf, exp, ln, sin, sqrt, tan, triangle)
import basix.ufl
from ufl import (Coefficient, acos, asin, atan, bessel_J, bessel_Y, cos, dx,
erf, exp, ln, sin, sqrt, tan)

element = FiniteElement("Lagrange", triangle, 1)
element = basix.ufl.element("Lagrange", "triangle", 1)

c0 = Coefficient(element)
c1 = Coefficient(element)
Expand Down
Loading

0 comments on commit 829854a

Please sign in to comment.