Comments (9)
An alternative way to do hybridisation would be if we could assemble matrices from bilinear forms with local solver operators inside them.
from firedrake.
If I understand David's comment correctly. This may well be the firedrake part of this change:
diff --git a/python/firedrake/core_types.pyx b/python/firedrake/core_types.pyx
index c0ab0bf..5a2c305 100644
--- a/python/firedrake/core_types.pyx
+++ b/python/firedrake/core_types.pyx
@@ -252,7 +252,7 @@ cdef void vector_field_destructor(object capsule):
cdef void *vf = py.PyCapsule_GetPointer(capsule, _vector_field_name)
ft.vector_field_destructor_f(vf)
-cdef ft.element_t as_element(object fiat_element):
+cdef ft.element_t as_element(object fiat_element, bool dgify):
"""Convert a FIAT element into a Fluidity element_t struct.
This is used to build Fluidity element_types from FIAT element
@@ -275,6 +275,22 @@ cdef ft.element_t as_element(object fiat_element):
element.entity_dofs = <int *>malloc(3 * element.ndof * sizeof(int))
entity_dofs = f_element.entity_dofs()
+ if dgify:
+ dimN = len(entity_dofs.keys()) - 1
+ dg_dofs = []
+ for k in entity_dofs.keys():
+ for v in entity_dofs[k].values():
+ dg_dofs.extend(v)
+ replacement = {}
+ for k in entity_dofs.keys():
+ replacement[k] = {}
+ for idx in entity_dofs[k]:
+ if k == dimN:
+ replacement[k][idx] = dg_dofs
+ else:
+ replacement[k][idx] = []
+ entity_dofs = replacement
+
cdef int d
cdef int e
cdef int dof
@@ -779,7 +795,7 @@ class FunctionSpaceBase(object):
derived types.
"""
- def __init__(self, mesh, element, name=None, dim=1, rank=0):
+ def __init__(self, mesh, element, name=None, dim=1, rank=0, dgify=False):
"""
:param mesh: :class:`Mesh` to build this space on
:param element: :class:`ufl.FiniteElementBase` to build this space from
@@ -826,7 +842,7 @@ class FunctionSpaceBase(object):
self.extruded = False
# Create the extruded function space
- cdef ft.element_t element_f = as_element(self.fiat_element)
+ cdef ft.element_t element_f = as_element(self.fiat_element, dgify)
cdef void *fluidity_mesh = py.PyCapsule_GetPointer(mesh._fluidity_mesh, _mesh_name)
if fluidity_mesh == NULL:
Effectively, we perform a lie to children when passing information to fluidity to compute the numbering and transfer all the dofs on an element to the entity of dimension mesh_dim. Probably we'd want some ufl foo to say:
Q = DGify(HCurl(...)) # attach a flag to Q saying this should be dgified when global numbering sees it
V = FunctionSpace(m, Q)
from firedrake.
I also have an alternative approach to hybridisation where we encode the Schur complement locally in an element assembly kernel for the Lagrange multiplier matrix. We should talk about this too.
from firedrake.
Shall we do this at the FIAT level or the Firedrake level? Either way, it's really not difficult. I have an approximate FIAT implementation at https://bitbucket.org/mapdes/fiat/branch/discontinuize
from firedrake.
I think this should definitely be a FIAT thing. It's just defining new finite elements, after all, and that's what FIAT does.
from firedrake.
I noticed that ^^^ is missing entity_closure_dofs(), otherwise it's basically complete.
Is there a separate discussion for trace spaces? I have some thoughts about those too.
from firedrake.
Andrew: why not start a trace spaces issue?
from firedrake.
Available with all the BrokenELement stuff, right?
from firedrake.
Yep, I think BrokenElement ain't no broken anymore.
from firedrake.
Related Issues (20)
- Fully integrate TinyASM functionality into Firedrake
- Create a Zenodo release for M4R project. HOT 3
- superconvergence HOT 7
- tqdm HOT 1
- When calculating with Firedrake, the calculation is aborted. How do I resolve it? HOT 5
- Spatial Convergence Order of Unsteady Problems HOT 1
- BUG: VTKFile fails in parallel after creating a mesh with mpi.COMM_SELF in a single process HOT 6
- BUG: `-log_view` reports mismatch between objects created and destroyed when running with multiple procs HOT 7
- `utils._new_uid` should be collective over a communicator
- BUG: CheckpointFile mesh saving crash HOT 4
- Derivative returns cofunction instead of function when the functional is independent of a control
- INSTALL: Script fails at PETSc while downloading HWLOC HOT 13
- running error for Marmousi model HOT 2
- BUG: Solving the Stokes equations defined with TrialFunction returns an error HOT 1
- BUG: Greater error than expected in quadrilateral GLL elements HOT 4
- Compute norm of assembled derivative HOT 5
- "Too many indices for sum factorisation!" for calculating radius on extruded CubedSphereMesh. HOT 1
- INSTALL: ImportError when running firedrake-update on Linux HOT 2
- INSTALL: Linux (Ubuntu 22.04.4 LTS) HOT 12
- Tests for `to_petsc_local_numbering`
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.