Skip to content

symbolic evaluation problem in an annulus mesh #57

@NengLu

Description

@NengLu

Describe the bug
Encountering a symbolic evaluation problem in an annulus mesh. Evaluating a variable or the mesh coordinate system unit individually works, but it fails when calculating the expression involving the product of the variable and mesh.coordinatesystem_unit_e_0.

Reproduce

import underworld3 as uw
import sympy

mesh = uw.meshing.Annulus(radiusOuter=2, radiusInner=1, cellSize=0.05, qdegree=2, degree=1) 
D = uw.discretisation.MeshVariable("D", mesh, vtype=uw.VarType.SCALAR, degree=1, continuous=True) 
D.data[:,0] = 1.

uw.function.evaluate(D.sym * mesh.CoordinateSystem.unit_e_0 , mesh.X.coords)

Error

File <lambdifygenerated-10>:4, in _lambdifygenerated(_Dummy_68, _Dummy_69)
      2 [Dummy_67, Dummy_66] = _Dummy_68
      3 [PKBSM] = _Dummy_69
----> 4 return array([[1.0e-18*Dummy_66*Dummy_67 + Dummy_67*PKBSM[/sqrt](http://localhost:8888/sqrt)(_uw_x**2 + _uw_y**2), 1.0e-18*Dummy_66*Dummy_67 + PKBSM*_uw_y[/sqrt](http://localhost:8888/sqrt)(_uw_x**2 + _uw_y**2)]])

NameError: name '_uw_x' is not defined

Environment
Python 3.12
PETSc via Pixi environment
Branch: latest development (2026-02-24)

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