Hi guys.
I am having a little trouble finding my error in here. I have this working code that triggers no problem:
def F(mesh, boundary_parts, mu, u, z, lx, ly, Ao,p,moduleSimmetry2):
print "Entering SearchDirection"
parameters['allow_extrapolation' ] = True
n = FacetNormal(mesh)
V = VectorFunctionSpace(mesh,'Lagrange',1)
Q = FunctionSpace(mesh,'DG',1)
W= V * Q
ds = Measure('ds')[boundary_parts]
noslip = Constant((0,0))
bc0 = DirichletBC(W.sub(0), noslip, boundary_parts,3)
bc1 = DirichletBC(W.sub(0), noslip, boundary_parts,1)
bc2 = DirichletBC(W.sub(0), noslip, boundary_parts,2)
bcs = [bc0, bc1, bc2]
(w, p) = TrialFunctions(W)
(v, q) = TestFunctions(W)
g = assemble(Constant(1.0)*dx(mesh))-(lx*ly-Ao)
a = (inner(grad(w),grad(v))+inner(w,v))*dx+p*inner(v,n)*ds(0)+q*inner(w,n)*ds(0)
L = (2*mu*(inner(epsilon(u),epsilon(z))))*inner(n,v)*ds(0)-g*q*ds(0)
ww = Function(W)
solve(a == L,ww,bcs)
(w, p) = ww.split(True)
But I need to change the definition of g, hence typing:
g = assemble(moduleSimmetry2*dx(mesh))
print g
a = (inner(grad(w),grad(v))+inner(w,v))*dx(mesh)+p*moduleSimmetry2*inner(v,n)*ds(0)+q*moduleSimmetry2*inner(w,n)*ds(0)
b = (2*mu*(inner(epsilon(u),epsilon(z))))*inner(n,v)*ds(0)
c=g*q*ds(0,subdomain_data=boundary_parts)
L=b-c
Then solving again a==L. However, the following error triggers:
Calling FFC just-in-time (JIT) compiler, this may take some time. Notation dx[meshfunction] is deprecated. Please use
dx(subdomain_data=meshfunction) instead.
0.0 This integral is missing an integration domain. Traceback (most recent call last): File "main.py", line 85, in
w,lam = funcs.F(mesh,boundary_parts,mu,u,z,lx,ly,Ao,p,moduleSymmetry2)
File "funcs.py", line 391, in F
c=gqds(0,subdomain_data=boundary_parts) File "/usr/lib/python2.7/dist-packages/ufl/measure.py", line 398, in
rmul
error("This integral is missing an integration domain.") File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 158, in error
raise self._exception_type(self._format_raw(message)) ufl.log.UFLException: This integral is missing an integration domain.
Aborted (core dumped)*
I have already tried printing the value of g, which is 0.0. I have also thought that error is in the definition of moduleSymmetry2, but I discarded that possibility because if I remove the term g, the solver does not trigger any error (but, of course, fails to converge).
What am I missing?
If you need the full version of the code I can upload it, I have uploaded only this to be as brief as possible.