sblauth/cashocs

[Feature Request] Consider supporting FEniCS > 2019.1.0

francesco-ballarin opened this issue · 2 comments

Is your feature request related to a problem? Please describe.
We have had a user posting on the FEniCS discourse forum inquiring how to use your library with FEniCS > 2019.1.0, see
https://fenicsproject.discourse.group/t/install-fenics-2019-1-on-terminal-ubuntu-22-04/12916

The request comes from the fact that, even though there are no officially released FEniCS versions after 2019.1.0, the ubuntu packages now (and for the foreseeable future) ship a 2019.2.dev0 version.
The version shipped by ubuntu has the backward incompatibility described in https://fenicsproject.discourse.group/t/announcement-ufl-legacy-and-legacy-dolfin/11583
which is motivated by the fact that debian/ubuntu packages need to be able to support different ufl versions, a legacy one for use within dolfin, and an up to date one for use within dolfinx.

cc @drew-parsons who manages FEniCS debian/ubuntu packaging

Describe the solution you'd like
Replace every

import ufl

in your code base with

try:
    import ufl_legacy as ufl
except ImportError:
    import ufl

Describe alternatives you've considered
None

Additional context
None

Thanks a lot for the feature request - I had read about the anouncement regarding the further development of ufl, but it had not occured to me that this might be a problem for cashocs.

I have incorporated the changes to PR #364 and this should be merged to main soon.
This change will then be part of the next feature release, v2.1, but can be installed directly from the main branch, if this functionality should be needed.

Looks good, thanks ;)