Skip to content

Real elements with non-linear problems #114

Description

@RemDelaporteMathurin

I have a nonlinear problem and would like to be able to use real elements.

So I tried doing:

from mpi4py import MPI
import dolfinx
import numpy as np
from scifem import create_real_functionspace
import ufl

M = 20
mesh = dolfinx.mesh.create_unit_interval(MPI.COMM_WORLD, M, dtype=np.float64)
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
R = create_real_functionspace(mesh)

W = ufl.MixedFunctionSpace(V, R)


u = fem.Function(W)

But this doesn't seem to work:

Traceback (most recent call last):
  File "/home/remidm/FESTIM/example_real_element.py", line 20, in <module>
    u = dolfinx.fem.Function(W)
  File "/home/remidm/anaconda3/envs/festim2-dev/lib/python3.13/site-packages/dolfinx/fem/function.py", line 319, in __init__
    V.element.dtype, np.dtype(dtype).type(0).real.dtype
    ^^^^^^^^^
AttributeError: 'MixedFunctionSpace' object has no attribute 'element'

Is this supported by scifem or is it limited to TrialFunction for linear problems?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions