Git Product home page Git Product logo

Comments (9)

colinjcotter avatar colinjcotter commented on July 29, 2024

An alternative way to do hybridisation would be if we could assemble matrices from bilinear forms with local solver operators inside them.

from firedrake.

wence- avatar wence- commented on July 29, 2024

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.

colinjcotter avatar colinjcotter commented on July 29, 2024

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.

dorugeber avatar dorugeber commented on July 29, 2024

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.

dham avatar dham commented on July 29, 2024

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.

dorugeber avatar dorugeber commented on July 29, 2024

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.

dham avatar dham commented on July 29, 2024

Andrew: why not start a trace spaces issue?

from firedrake.

wence- avatar wence- commented on July 29, 2024

Available with all the BrokenELement stuff, right?

from firedrake.

dorugeber avatar dorugeber commented on July 29, 2024

Yep, I think BrokenElement ain't no broken anymore.

from firedrake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.