FEniCS / ufl

UFL - Unified Form Language
https://fenicsproject.org
GNU Lesser General Public License v3.0
97 stars 64 forks source link

ufl.TrialFunction uses deprecated method #290

Closed jorgensd closed 3 months ago

jorgensd commented 3 months ago

Minimal example in ufl:

def test2():
    import ufl.finiteelement

    cell = ufl.triangle
    el = ufl.finiteelement.FiniteElement(
        "Lagrange",
        cell,
        1,
        (cell.topological_dimension(),),
        ufl.identity_pullback,
        ufl.H1,
    )
    mesh = ufl.Mesh(el)
    mix = ufl.finiteelement.MixedElement([el, el])
    W = ufl.FunctionSpace(mesh, mix)
    u = ufl.TrialFunctions(W)

executed with pytest returns

test_warning.py::test2
  /root/shared/ufl/ufl/core/expr.py:264: DeprecationWarning: Expr.ufl_domain() is deprecated, please use extract_unique_domain(expr) instead.
    warnings.warn(

which we also get in DOLFINx when using ufl.TrialFunctions

import basix.ufl
import dolfinx
import ufl
from mpi4py import MPI

def test():
    mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 10, 10)
    cellname = mesh.topology.cell_name()
    Ve = basix.ufl.element(
        basix.ElementFamily.P,
        cellname,
        2,
        shape=(mesh.geometry.dim,),
        dtype=dolfinx.default_real_type,
    )
    Qe = basix.ufl.element(
        basix.ElementFamily.P, cellname, 1, dtype=dolfinx.default_real_type
    )

    W = dolfinx.fem.functionspace(mesh, basix.ufl.mixed_element([Ve, Qe]))
    (u, v) = ufl.TrialFunctions(W)
======================================================================= warnings summary ========================================================================
test_mwe_error.py::test
  /root/shared/ufl/ufl/core/expr.py:264: DeprecationWarning: Expr.ufl_domain() is deprecated, please use extract_unique_domain(expr) instead.
    warnings.warn(