Hello, I am running the following script and want to run the same equation in 3D mesh. Could you give an idea how can I change the 2D mesh script to 3D mesh script?
https://fenicsproject.org/olddocs/dolfin/dev/python/demos/cahn-hilliard/demo_cahn-hilliard.py.html
For the mesh, I think you can just use UnitCubeMesh https://fenicsproject.org/olddocs/dolfin/2016.1.0/python/programmers-reference/cpp/mesh/UnitCubeMesh.html
1 Like
@Kei_Yamamoto Thanks a lot for your message. I used UnitCubeMesh and got this error. Do you know what this message means? I cannot get what the “shapes” means.
Can't add expressions with different shapes.
Traceback (most recent call last):
File "demo_cahn-hilliard.py", line 258, in <module>
f = 100*c**2*(1-c)**2
File "/usr/lib/python3/dist-packages/ufl/exproperators.py", line 232, in _rsub
return Sum(o, -self)
File "/usr/lib/python3/dist-packages/ufl/algebra.py", line 41, in __new__
error("Can't add expressions with different shapes.")
File "/usr/lib/python3/dist-packages/ufl/log.py", line 158, in error
raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Can't add expressions with different shapes.
@tkoyama010
I can’t tell what is causing error without looking your code but, my understanding of shgapes is the same as dimensions. So, you are probably trying add something that doesn’t have the same dimension (For example, trying to add scalar and vector).
1 Like