Skip to content

Commit afdbf48

Browse files
authored
Add Arbogast-Correa element (#150)
* Add AC element * Add to tests * changelog and version++ * update docs
1 parent f67b11e commit afdbf48

File tree

11 files changed

+73
-11
lines changed

11 files changed

+73
-11
lines changed

.github/workflows/test-packages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
python-version: ${{ matrix.python-version }}
1919
- uses: actions/checkout@v2
2020
with:
21-
ref: v2021.10.1
21+
ref: v2021.12.1
2222
name: Get latest Symfem version
2323
- run: rm -rf symfem VERSION
2424
name: Remove downloaded symfem
@@ -45,7 +45,7 @@ jobs:
4545
activate-environment: symfem
4646
- uses: actions/checkout@v2
4747
with:
48-
ref: v2021.10.1
48+
ref: v2021.12.1
4949
name: Get latest Symfem version
5050
- run: rm -rf symfem VERSION
5151
name: Remove downloaded symfem
@@ -71,13 +71,13 @@ jobs:
7171
with:
7272
python-version: ${{ matrix.python-version }}
7373
- run: |
74-
wget -O symfem.tar.gz https://pypi.io/packages/source/s/symfem/symfem-2021.10.1.tar.gz
74+
wget -O symfem.tar.gz https://pypi.io/packages/source/s/symfem/symfem-2021.12.1.tar.gz
7575
tar -xvzf symfem.tar.gz
7676
name: Download and unpack latest version of Symfem
7777
- run: pip install pytest
7878
name: Install pytest
7979
- run: |
80-
cd symfem-2021.10.1
80+
cd symfem-2021.12.1
8181
pip install -r requirements.txt
8282
python3 -m pytest test/
8383
name: Install requirements, run tests and demos

CHANGELOG_SINCE_LAST_VERSION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
- Added Regge element on tensor product cells.
22
- Added tensor product factorisation of Q element.
33
- Added Arnold-Boffi-Falk element
4+
- Added Arbogast-Correa element

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ authors:
55
given-names: Matthew W.
66
orcid: 0000-0002-4658-2443
77
title: Symfem
8-
version: 2021.10.1
9-
date-released: 2021-10-19
8+
version: 2021.12.1
9+
date-released: 2021-12-01
1010
license: MIT
1111
url: https://github.com/mscroggs/symfem
1212
preferred-citation:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ The reference quadrilateral has vertices (0, 0), (1, 0), (0, 1), and (1, 1). Its
197197
![The numbering of a reference quadrilateral](img/quadrilateral_numbering.png)
198198

199199
### List of supported elements
200+
- Arbogast-Correa (alternative names: AC, AC full, Arbogast-Correa full)
200201
- Arnold-Boffi-Falk (alternative names: ABF)
201202
- Bogner-Fox-Schmit (alternative names: BFS)
202203
- Brezzi-Douglas-Fortin-Marini (alternative names: BDFM)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021.10.1
1+
2021.12.1

codemeta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld", "@type": "Code", "author": [{"@id": "0000-0002-4658-2443", "@type": "Person", "email": "[email protected]", "name": "Matthew Scroggs", "affiliation": "Department of Engineering, University of Cambridge"}], "identifier": "", "codeRepository": "https://github.com/mscroggs/symfem", "datePublished": "2021-01-23", "dateModified": "2021-10-19", "dateCreated": "2021-01-23", "description": "A symbolic finite element definition library", "keywords": "Python, finite element method, numerical analysis", "license": "MIT", "title": "Symfem", "version": "2021.10.1"}
1+
{"@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld", "@type": "Code", "author": [{"@id": "0000-0002-4658-2443", "@type": "Person", "email": "[email protected]", "name": "Matthew Scroggs", "affiliation": "Department of Engineering, University of Cambridge"}], "identifier": "", "codeRepository": "https://github.com/mscroggs/symfem", "datePublished": "2021-01-23", "dateModified": "2021-12-01", "dateCreated": "2021-01-23", "description": "A symbolic finite element definition library", "keywords": "Python, finite element method, numerical analysis", "license": "MIT", "title": "Symfem", "version": "2021.12.1"}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
description="a symbolic finite element definition library",
2626
long_description=long_description,
2727
long_description_content_type="text/markdown",
28-
version="2021.10.1",
28+
version="2021.12.1",
2929
author="Matthew Scroggs",
3030
license="MIT",
3131
author_email="[email protected]",

symfem/create.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ def create_element(cell_type, element_type, order, **kwargs):
166166
TNT, tiniest tensor,
167167
TNTcurl, tiniest tensor Hcurl,
168168
TNTdiv, tiniest tensor Hdiv,
169-
Arnold-Boffi-Falk, ABF
169+
Arnold-Boffi-Falk, ABF,
170+
Arbogast-Correa, AC, AC full, Arbogast-Correa full
170171
order : int
171172
The order of the element.
172173
"""

symfem/elements/ac.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
"""Arbogast-Correa elements on quadrilaterals.
2+
3+
This element's definition appears in https://epubs.siam.org/doi/10.1137/15M1013705
4+
(Arbogast, Correa, 2016)
5+
"""
6+
7+
from ..finite_element import CiarletElement
8+
from ..moments import make_integral_moment_dofs
9+
from ..polynomials import polynomial_set, Hdiv_serendipity
10+
from ..functionals import NormalIntegralMoment, IntegralAgainst
11+
from .dpc import DPC
12+
from ..symbolic import x
13+
14+
15+
class AC(CiarletElement):
16+
"""Arbogast-Correa Hdiv finite element."""
17+
18+
def __init__(self, reference, order, variant="equispaced"):
19+
poly = polynomial_set(reference.tdim, reference.tdim, order)
20+
if order == 0:
21+
poly += [(x[0], 0), (0, x[1])]
22+
else:
23+
poly += Hdiv_serendipity(reference.tdim, reference.tdim, order)
24+
poly += [(x[0] ** (i + 1) * x[1] ** (order - i), x[0] ** i * x[1] ** (1 + order - i))
25+
for i in range(order + 1)]
26+
27+
dofs = make_integral_moment_dofs(
28+
reference,
29+
facets=(NormalIntegralMoment, DPC, order, {"variant": variant}),
30+
)
31+
32+
for i in range(order + 1):
33+
for j in range(order + 1 - i):
34+
if i + j > 0:
35+
f = (i * x[0] ** (i - 1) * x[1] ** j, j * x[0] ** i * x[1] ** (j - 1))
36+
dofs.append(IntegralAgainst(reference, f, entity=(2, 0),
37+
mapping="contravariant"))
38+
39+
for i in range(1, order - 1):
40+
for j in range(1, order - i):
41+
f = (
42+
x[0] ** i * (1 - x[0]) * x[1] ** (j - 1) * (j * (1 - x[1]) - x[1]),
43+
-x[0] ** (i - 1) * (i * (1 - x[0]) - x[0]) * x[1] ** j * (1 - x[1])
44+
)
45+
dofs.append(IntegralAgainst(reference, f, entity=(2, 0),
46+
mapping="contravariant"))
47+
48+
super().__init__(reference, order, poly, dofs, reference.tdim, reference.tdim)
49+
self.variant = variant
50+
51+
def init_kwargs(self):
52+
"""Return the kwargs used to create this element."""
53+
return {"variant": self.variant}
54+
55+
names = ["Arbogast-Correa", "AC", "AC full", "Arbogast-Correa full"]
56+
references = ["quadrilateral"]
57+
min_order = 0
58+
continuity = "H(div)"

symfem/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Version number."""
22

3-
version = "2021.10.1"
3+
version = "2021.12.1"

0 commit comments

Comments
 (0)