Comments (12)
RHS might be correct [probably not in general], but LHS matrix is incorrect. Can show using eigenvalue decomposition, say.
from firedrake.
Possible numbering issue.
First 6 dofs are from the RT part (horizontal), last 6 are from the P2 x P0 part (vertical)
In [13]: V1.cell_node_map().values
Out[13]: array([[14, 15, 7, 8, 2, 3, 0, 12, 19, 16, 9, 4]], dtype=int32)
In [14]: V1.offset + V1.cell_node_map().values
Out[14]: array([[16, 17, 9, 10, 4, 5, 1, 13, 20, 18, 11, 6]], dtype=int32)
Note that node 4 turns from a vertical to a horizontal dof (WRONG)
Looks like the numbering up the column goes "2, 4, 3, 6, 5", so although the offsets are correct, they don't work in the first layer, since node 2 + offset 2 lands at 4 instead of 3.
from firedrake.
We think this is a FIAT numbering bug:
P2 = FunctionSpace(mesh, 'CG', 2, vfamily='CG', vdegree=2)
P2.fiat_element.entity_dofs()
{(0, 0): {0: [0], 1: [1], 2: [3], 3: [4], 4: [6], 5: [7]},
(0, 1): {0: [2], 1: [5], 2: [8]},
(1, 0): {0: [9], 1: [10], 2: [12], 3: [13], 4: [15], 5: [16]},
(1, 1): {0: [11], 1: [14], 2: [17]},
(2, 0): {0: [], 1: []},
(2, 1): {0: []}}
P2.fiat_element.flattened_element().entity_dofs()
{0: {0: [0, 2, 1], 1: [3, 5, 4], 2: [6, 8, 7]},
1: {0: [9, 11, 10], 1: [12, 14, 13], 2: [15, 17, 16]},
2: {0: []}}
V1.fiat_element.entity_dofs()
{(0, 0): {0: [], 1: [], 2: [], 3: [], 4: [], 5: []},
(0, 1): {0: [6], 1: [7], 2: [8]},
(1, 0): {0: [0], 1: [1], 2: [2], 3: [3], 4: [4], 5: [5]},
(1, 1): {0: [9], 1: [10], 2: [11]},
(2, 0): {0: [], 1: []},
(2, 1): {0: []}}
V1.fiat_element.flattened_element().entity_dofs()
{0: {0: [6], 1: [7], 2: [8]},
1: {0: [0, 1, 9], 1: [2, 3, 10], 2: [4, 5, 11]},
2: {0: []}}
Note how in the P2 case the dofs from (1,1) have been interleaved into the dofs from (1, 0), whereas in the enriched case they have not. In global numbering we hand things out in this order, which is why things are wrong.
In particular, the entity_dofs of the V1 flattened element should be (we think).
{0: {0: [6], 1: [7], 2: [8]},
1: {0: [0, 9, 1], 1: [2, 10, 3], 2: [4, 11, 5]},
2: {0: []}}
then everything would fall out.
from firedrake.
Oh god... yes, TFE is currently hacked to output dofs from bottom to top,
as Doru requested originally. I'll think about how this can be done for
enriched elements.
from firedrake.
What is the minimum that needs to be done? Full sorting is probably
overkill, and unnecessarily hard (eg sorting the internal dofs of P3 and
P4). I will have a think.
from firedrake.
I think we just need shared ones to come out numbered after non-shared, full bottom to top sorting would be nice. Is it just a case of interchanging the order in which you concatenate the entities of a given dimension?
from firedrake.
Yeah, at the moment I think I generate the flattened dofs by concatenating
the flattened dofs of the constituent elements. I think I know how to
unhack and fix this.
from firedrake.
(it involves unhacking the actual flattening process)
from firedrake.
Mesdames et messieurs, je présente un Helmholtz mixte (avec un peu de superconvergence)
"""Tests for mixed Helmholtz convergence on extruded meshes"""
import numpy as np
from firedrake import *
for ii in [1, 2, 3, 4, 5]:
m = UnitSquareMesh(2**ii, 2**ii)
mesh = ExtrudedMesh(m, layers=(2**ii + 1), layer_height = 1.0/2**ii)
V2_a_horiz = FiniteElement("BDM", "triangle", 1)
V2_a_vert = FiniteElement("DG", "interval", 0)
V2_a = HDiv(OuterProductElement(V2_a_horiz, V2_a_vert))
V2_b_horiz = FiniteElement("DG", "triangle", 0)
V2_b_vert = FiniteElement("CG", "interval", 1)
V2_b = HDiv(OuterProductElement(V2_b_horiz, V2_b_vert))
V2_elt = EnrichedElement(V2_a, V2_b)
V2 = FunctionSpace(mesh, V2_elt)
V3 = FunctionSpace(mesh, "DG", 0, vfamily="DG", vdegree=0)
f = Function(V3)
exact = Function(V3)
f.interpolate(Expression("(1+12*pi*pi)*sin(x[0]*pi*2)*sin(x[1]*pi*2)*sin(x[2]*pi*2)"))
exact.interpolate(Expression("sin(x[0]*pi*2)*sin(x[1]*pi*2)*sin(x[2]*pi*2)"))
W = V2 * V3
u, p = TrialFunctions(W)
v, q = TestFunctions(W)
a = (p*q - q*div(u) + dot(v, u) + div(v)*p)*dx
L = f*q*dx
out = Function(W)
solve(a == L, out, solver_parameters={'pc_type': 'fieldsplit',
'pc_fieldsplit_type': 'schur',
'ksp_type': 'cg',
'pc_fieldsplit_schur_fact_type': 'FULL',
'fieldsplit_0_ksp_type': 'cg',
'fieldsplit_1_ksp_type': 'cg'})
print "L_inf norm: " + str(max(abs(out.dat[1].data - exact.dat.data)))
print "L2 norm: " + str(sqrt(assemble((out[3]-exact)*(out[3]-exact)*dx)))
from firedrake.
Ca c'est magnifique (magnifeec!?) !!!
from firedrake.
In which revision was this fixed?
from firedrake.
It was a FIAT bug, fixed in FIAT#9 (enriched) merge.
from firedrake.
Related Issues (20)
- BUG: unable to save CG 2 field to `pvd` when using hexahedral mesh HOT 1
- DOCS: Use Sphinx directives to include code _using tags_
- VomMover HOT 5
- BUG: UFLInequalityConstraint from firedrake.adjoint is not working HOT 7
- Checkpointing arbitrary tags
- Successful installation on HPC but code is not working HOT 6
- BUG: cannot import from firedrake.pyplot HOT 3
- BUG: Error in UFLInequalityConstraint with ROL
- BUG: bug in assembly or vertex-only mesh HOT 6
- Function assigning a Cofunction HOT 2
- BUG: Incorrect `Action` derivatives in the complex case HOT 3
- BUG: $VIRTUAL_ENV/.cache not created HOT 5
- Follow up to #3138: cannot install libspatialindex and firedrake in the same path HOT 7
- BUG: Fieldsplit doesn't work with a `Cofunction` right hand side. HOT 4
- BUG: Errors checkpointing extruded mesh HOT 3
- Zenodo release HOT 1
- interpolation calls the old interpolation implementaion which produces warnings, could be considered error due to code predictable execution path. HOT 2
- BUG: Interpolators do not work anymore. HOT 4
- Multigrid for Non-nested meshes HOT 1
- BUG: Assembling a `Cofunction` returns the `Cofunction` rather than a supplied `tensor` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firedrake.