FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
792 stars 182 forks source link

Fix inconsistent ufl usage in examples #3532

Open schnellerhase opened 18 hours ago

schnellerhase commented 18 hours ago

Some examples use multiple import schemes of ufl, this switches to a single import style per example.

For example currenltly demo_elasticity.py contains:

import ufl
from ufl import dx, grad, inner

Other examples that share this:

francesco-ballarin commented 18 hours ago

Not sure if it is worth continuing to work on this.

Some of the developers are of the opinion that the choice of doing

from ufl import dx, grad, inner

is to ensure that the weak formulation of the problem is as close to the one on paper as possible, avoiding to have to add a prefix ufl. to every term in the formulation. Personally that's not my opinion, but they do have a valid point.

schnellerhase commented 18 hours ago

Good point, but could we then switch to consistent usage of from ufl import ... in all cases?

francesco-ballarin commented 17 hours ago

I guess so, unless the list of imported names gets super long. If I were you I would put this on hold until a few other developers have had the opportunity to comment.

jorgensd commented 16 hours ago

I guess so, unless the list of imported names gets super long. If I were you I would put this on hold until a few other developers have had the opportunity to comment.

I think having a mixture doesn’t hurt.