The interface of RectangleMesh has changed. You need to do

  mesh = RectangleMesh(Point(-1.0, -1.0), Point(1.0, 1.0), n, n)

see
http://fenicsproject.org/documentation/dolfin/dev/python/programmers-reference/cpp/mesh/RectangleMesh.html#dolfin.cpp.mesh.RectangleMesh

dolfin-adjoint is not supported by FEniCS team. Please aim these
questions to dolfin-adjoint team
http://www.dolfin-adjoint.org/en/latest/support/index.html

Jan


On Wed, 28 Oct 2015 15:56:52 +0100
Christian Landrock <[email protected]> wrote:

> 
> 
> Dear fenics-team, 
> 
> i'm new to fenics. i'm student an working on my
> masterthesis, in which i should use fenics. 
> 
> >From the page
> 
> 
> http://www.dolfin-adjoint.org/en/latest/documentation/optimisation.html
> 
> 
> i want to test the example code of the heat equation. There i get
> some errors. Please help me to remove them! 
> 
> At first in the line (n =
> 256 for all following lines) 
> 
> mesh = Rectangle(-1,-1,1,1,n,n) 
> 
> i get
> that rectangle is not defined. So i've change it into 
> 
> mesh =
> RectangleMesh(-1,-1,1,1,n,n) 
> 
> and then i get the error message 
> 
> File
> "/home/chla2091/workspace/test/hitze.py", line 12, in 
>  mesh =
> RectangleMesh(-1,-1,1,1,n, n)
>  File
> "/usr/python278/lib/python2.7/site-packages/dolfin/cpp/mesh.py", line
> 9690, in __init__
>  _mesh.RectangleMesh_swiginit(self,
> _mesh.new_RectangleMesh(*args))
> TypeError: in method
> 'new_RectangleMesh', argument 1 of type 'MPI_Comm' 
> 
> My idea was, only
> for testing, to change this line again into 
> 
> mesh = UnitSquareMesh(n,
> n) 
> 
> so it start running with some messages "...this may take some time"
> and i think for testing it's ok...but i want also to use the
> rectanglemesh in code...it does not work...what i do wrong in this
> line?
> 
> 
> After running there is the next error in line 
> 
> m_opt =
> minimize(J_Tilde, method = "L-BFGS-B", tol=2e-08, bounds = (0, 1),
> options = {"disp": True}) 
> 
> No Jacobian form specified for nonlinear
> variational problem.
> Differentiating residual form F to obtain Jacobian
> J = F'.
> Solving nonlinear variational problem.
>  Newton iteration 0: r
> (abs) = 0.000e+00 (tol = 1.000e-10) r (rel) = -nan (tol = 1.000e-09)
> 
> Newton solver finished in 0 iterations and 0 linear solver
> iterations.
> cell.x is deprecated, please use
> SpatialCoordinate(domain) instead
> RUNNING THE L-BFGS-B CODE
> 
>  * *
> *
> 
> Machine precision = 2.220D-16
>  N = 66049 M = 10
> 
> At X0 66049
> variables are exactly at the bounds
> Traceback (most recent call last):
> 
> File "/home/chla2091/workspace/test/hitze.py", line 33, in 
>  m_opt =
> minimize(J_Tilde, method = "L-BFGS-B", tol=2e-08, bounds = (0, 1),
> options = {"disp": True})
>  File
> "/usr/python278/lib/python2.7/site-packages/dolfin_adjoint/optimization/optimization.py",
> line 224, in minimize
>  opt = algorithm(rf_np, **kwargs)
>  File
> "/usr/python278/lib/python2.7/site-packages/dolfin_adjoint/optimization/optimization.py",
> line 126, in minimize_scipy_generic
>  res = scipy_minimize(J, m_global,
> method=method, bounds=bounds, **kwargs)
>  File
> "/usr/python278/lib/python2.7/site-packages/scipy/optimize/_minimize.py",
> line 427, in minimize
>  callback=callback, **options)
>  File
> "/usr/python278/lib/python2.7/site-packages/scipy/optimize/lbfgsb.py",
> line 314, in _minimize_lbfgsb
>  f, g = func_and_grad(x)
>  File
> "/usr/python278/lib/python2.7/site-packages/scipy/optimize/lbfgsb.py",
> line 265, in func_and_grad
>  f = fun(x, *args)
>  File
> "/usr/python278/lib/python2.7/site-packages/scipy/optimize/optimize.py",
> line 281, in function_wrapper
>  return function(*(wrapper_args + args))
> 
> File
> "/usr/python278/lib/python2.7/site-packages/dolfin_adjoint/reduced_functional_numpy.py",
> line 53, in __call__
>  return self.__base_call__(m)
>  File
> "/usr/python278/lib/python2.7/site-packages/dolfin_adjoint/reduced_functional.py",
> line 145, in __call__
>  ListControl(self.controls).update(value)
>  File
> "/usr/python278/lib/python2.7/site-packages/dolfin_adjoint/controls.py",
> line 506, in update
>  [c.update(v) for c, v in zip(self.controls,
> value)]
>  File
> "/usr/python278/lib/python2.7/site-packages/dolfin_adjoint/controls.py",
> line 147, in update
>  eqn_nb =
> self.var.equation_nb(adjglobals.adjointer)
>  File
> "/usr/python278/lib/python2.7/site-packages/libadjoint/libadjoint.py",
> line 124, in equation_nb
> 
> clib.adj_find_variable_equation_nb(adjointer.adjointer, self.var,
> equation_nb)
>  File
> "/usr/python278/lib/python2.7/site-packages/libadjoint/libadjoint.py",
> line 18, in handle_error
>  raise exception,
> errstr
> libadjoint.exceptions.LibadjointErrorHashFailed: The queried
> variable Control:0:0:Forward is not known to the adjointer. 
> 
> So i can't
> see plots and solve the problem. Please help me! What is wrong? 
> 
> Best
> regards and hope to read soon. 

_______________________________________________
fenics-support mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics-support

Reply via email to