Hi,
I am trying to use the auto-adaptive solver to locally refine my mesh. I am following this fenics resource,
https://fenicsproject.org/docs/dolfin/1.4.0/python/demo/documented/auto-adaptive-poisson/python/documentation.html. The only difference in my case is the definition of the Goal functional.
In the demo it is defined with respect to a scalar field
V = FunctionSpace(mesh, “Lagrange”, 1)
…
Define function for the solution
u = Function(V)
Define goal functional (quantity of interest)
M = u*dx
In my case V is a mixed space.
P1 = FiniteElement(“Lagrange”, mesh.ufl_cell(), 1)
R = FiniteElement(“Real”, mesh.ufl_cell(), 0)
element = MixedElement([P1, R])
V = FunctionSpace(mesh,element)
So, M=u*dx won’t work.
I tried:
u = Function(u)
tu = TestFunction(u)
Define goal functional
M = inner(u,tu)*dx
But the AdaptiveLinearVariationalSolver crushes in the end. What is the right way to do this?
The warning:
WARNING: user expression has not supplied value_shape method or an element. Assuming scalar element.
The error:
RuntimeError Traceback (most recent call last)
in
46 solver = AdaptiveLinearVariationalSolver(problem,M)
47 solver.parameters[“error_control”][“dual_variational_solver”][“linear_solver”] = “cg”
—> 48 solver.solve(tol)
49
50 solver.summary()
~/miniconda3/envs/fenicstest/lib/python3.8/site-packages/dolfin/fem/adaptivesolving.py in solve(self, tol)
75
76 # Call cpp.AdaptiveLinearVariationalSolver.solve directly
—> 77 cpp.adaptivity.AdaptiveLinearVariationalSolver.solve(self, tol)
78
79
RuntimeError:
*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
*** fenics-support@googlegroups.com
*** Remember to include the error message listed below and, if possible,
*** include a minimal running example to reproduce the error.
*** -------------------------------------------------------------------------
*** Error: Unable to assemble form.
*** Reason: Expecting a scalar form but rank is 1.
*** Where: This error was encountered inside assemble.cpp.
*** Process: 0
*** DOLFIN version: 2019.1.0
*** Git changeset:
*** -------------------------------------------------------------------------