Cannot infer geometric dimension for this expression
Greetings
I am running into an interesting problem when I try to add a non-isotropic permeability tensor term to my code. Simplified, what I want to do is something as follows:
coefficient = divergence( K_perm_tensor * gradient ( Pressure ) )
Can someone please help me identify the issue and fix it? I have created a dummy code that mimics the problem here:
from dolfin import *
# Create mesh and define function space
degree = 2
mesh = UnitSquare(32, 32)
V = FunctionSpace(mesh, 'Lagrange', degree)
# Define Dirichlet boundary (x=0,y=0,x=1 or y=1)
def boundary(x):
return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS or \
x[1] < DOLFIN_EPS or x[1] > 1.0 - DOLFIN_EPS
# Define boundary condition
Pw0 = Constant(1.0)
bc = DirichletBC(V, Pw0, boundary)
# Define the permeability tensor
kxx = 2.0
kyy = 1.0
K = Expression((('k11', '0'), \
# Define variational problem for Picard iteration
Pw = TrialFunction(V)
v = TestFunction(V)
Pw_k = interpolate(
Sw = interpolate(
a = inner(Pw_
#f = Expression(
f = div( K* grad(Pw_k) )
L = f*v*dx
# Picard iterations
Pw = Function(V) # new unknown function
solve(a == L, Pw, bc)
And the following is the error generated when I try to solve the problem:
-------
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling DOLFIN just-in-time (JIT) compiler, this may take some time.
Calling DOLFIN just-in-time (JIT) compiler, this may take some time.
Cannot infer geometric dimension for this expression.
Traceback (most recent call last):
File "TensorProduct.py", line 39, in <module>
solve(a == L, Pw, bc)
File "/home/
_solve_
File "/home/
.......
File "/home/
raise self._exception
ufl.log.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Johan Hake
- Solved:
- Last query:
- Last reply: