Yes, I think it was connection issue, now I've updated firedrake and
following code
size = 64
mesh = UnitSquareMesh(size, size, quadrilateral = True)
V = FunctionSpace(mesh, "CG", 1)
f = Function(V)
f.interpolate(Expression("1"))
u_tilde = Function(V)
u_tilde.interpolate(Expression("1.0/(1+exp(-10*x[0]))/(1+exp(-10*(1-x[0])))/(1+exp(-10*x[1]))/(1+exp(-10*(1-x[1])))"
))
w_tilde = TrialFunction(V)
v = TestFunction(V)
a_tilde = (w_tilde * dot(grad(u_tilde), grad(v))) * dx
frm_tilde = assemble( a_tilde )
L = f * v * dx
rhs = assemble(L)
w_sol = Function(V)
solve(a_tilde == L, w_sol)
File("w_sol.pvd").write(w_sol)
runs, but result looks suspicious: the f and u_tilde have symmetries,
while w_sol, does not (look at lower left corner of the image attached).
Also, solve runs only without any parameters, attempt to set any results
in errors. For example
solve(a_tilde == L, w_sol, solver_parameters={'ksp_type': 'richardson',
'pc_type': 'jacobi'})
results in
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-12-682f5be8ad08> in <module>()
22 w_sol = Function(V)
23 solve(a_tilde == L, w_sol, solver_parameters={'ksp_type':
'richardson',
---> 24 'pc_type': 'jacobi'})
25
26 File("w_sol.pvd").write(w_sol)
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/firedrake/solving.pyc
in solve(*args, **kwargs)
118 # Call variational problem solver if we get an equation
119 if isinstance(args[0], ufl.classes.Equation):
--> 120 _solve_varproblem(*args, **kwargs)
121 else:
122 # Solve pre-assembled system
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/firedrake/solving.pyc
in _solve_varproblem(*args, **kwargs)
145
options_prefix=options_prefix)
146 with progress(INFO, 'Solving linear variational problem'):
--> 147 solver.solve()
148
149 # Solve nonlinear variational problem
<decorator-gen-418> in solve(self)
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/pyop2/profiling.pyc
in wrapper(f, *args, **kwargs)
201 self.stop()
202 else:
--> 203 return f(*args, **kwargs)
204 return decorator(wrapper, f)
205
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/firedrake/variational_solver.pyc
in solve(self)
188 self.snes.solve(None, v)
189
--> 190 solving_utils.check_snes_convergence(self.snes)
191
192
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/firedrake/solving_utils.pyc
in check_snes_convergence(snes)
60 raise RuntimeError("""Nonlinear solve failed to converge
after %d nonlinear iterations.
61 Reason:
---> 62 %s""" % (snes.getIterationNumber(), msg))
63
64
RuntimeError: Nonlinear solve failed to converge after 0 nonlinear
iterations.
Reason:
Inner linear solve failed to converge after 3 iterations with reason:
DIVERGED_DTOL
and
solve(a_tilde == L, w_sol, solver_parameters={'ksp_type': 'preonly',
'pc_type': 'lu'})
results in:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-13-7297871754fa> in <module>()
22 w_sol = Function(V)
23 solve(a_tilde == L, w_sol, solver_parameters={'ksp_type':
'preonly',
---> 24 'pc_type': 'lu'})
25
26 File("w_sol.pvd").write(w_sol)
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/firedrake/solving.pyc
in solve(*args, **kwargs)
118 # Call variational problem solver if we get an equation
119 if isinstance(args[0], ufl.classes.Equation):
--> 120 _solve_varproblem(*args, **kwargs)
121 else:
122 # Solve pre-assembled system
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/firedrake/solving.pyc
in _solve_varproblem(*args, **kwargs)
145
options_prefix=options_prefix)
146 with progress(INFO, 'Solving linear variational problem'):
--> 147 solver.solve()
148
149 # Solve nonlinear variational problem
<decorator-gen-418> in solve(self)
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/pyop2/profiling.pyc
in wrapper(f, *args, **kwargs)
201 self.stop()
202 else:
--> 203 return f(*args, **kwargs)
204 return decorator(wrapper, f)
205
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/firedrake/variational_solver.pyc
in solve(self)
188 self.snes.solve(None, v)
189
--> 190 solving_utils.check_snes_convergence(self.snes)
191
192
/home/george/polygon/firedrake/local/lib/python2.7/site-packages/firedrake/solving_utils.pyc
in check_snes_convergence(snes)
60 raise RuntimeError("""Nonlinear solve failed to converge
after %d nonlinear iterations.
61 Reason:
---> 62 %s""" % (snes.getIterationNumber(), msg))
63
64
RuntimeError: Nonlinear solve failed to converge after 0 nonlinear
iterations.
Reason:
Inner linear solve failed to converge after 0 iterations with reason:
unknown reason (petsc4py enum incomplete?)
On 30.03.2016 12:46, Andrew McRae wrote:
> The second and third of those links work for me, so perhaps there's an
> issue at your end.
>
> Anyway, let's bypass this for now by running in "minimal PETSc" mode.
> Can you edit your firedrake-update script (located at, I guess,
> /home/george/polygon/firedrake/bin/firedrake-update) by changing
> args.minimal_petsc from False to True (around line 120-130) and rerun?
> This should install PETSc without most third-party packages, including
> the one you're having trouble with, when you run firedrake-update.
>
> On 29 March 2016 at 20:18, George Ovchinnikov <lives9@gmail.com
> <mailto:lives9@gmail.com>> wrote:
>
> I'm trying to update firedrake, but getting
>
> TESTING: configureLibrary from
> config.packages.netcdf(/tmp/pip-YAhIai-build/config/BuildSystem/config/package.py:626)
>
> ===============================================================================
> Trying to download
> ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.3.2.tar.gz for NETCDF
>
> ===============================================================================
>
>
> ===============================================================================
> Trying to download
> http://ftp.mcs.anl.gov/pub/petsc/externalpackages/netcdf-4.3.2.tar.gz
> for NETCDF
>
> ===============================================================================
>
>
> ===============================================================================
> Trying to download
> ftp://ftp.mcs.anl.gov/pub/petsc/externalpackages/netcdf-4.3.2.tar.gz for
> NETCDF
>
> ===============================================================================
>
>
> *******************************************************************************
> UNABLE to CONFIGURE with GIVEN OPTIONS (see
> configure.log for details):
>
> -------------------------------------------------------------------------------
> Unable to download NETCDF
> Unable to download package NETCDF from:
> ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.3.2.tar.gz
> * If URL specified manually - perhaps there is a typo?
> * If your network is disconnected - please reconnect and rerun
> ./configure
> * Or perhaps you have a firewall blocking the download
> * Alternatively, you can download the above URL manually, to
> /yourselectedlocation/netcdf-4.3.2.tar.gz
> and use the configure option:
> --download-netcdf=/yourselectedlocation/netcdf-4.3.2.tar.gz
> file could not be opened successfully
> Downloaded package NETCDF from:
> http://ftp.mcs.anl.gov/pub/petsc/externalpackages/netcdf-4.3.2.tar.gz is
> not a tarball.
> [or installed python cannot process compressed files]
> * If you are behind a firewall - please fix your proxy and rerun
> ./configure
> For example at LANL you may need to set the environmental variable
> http_proxy (or HTTP_PROXY?) to http://proxyout.lanl.gov
> * Alternatively, you can download the above URL manually, to
> /yourselectedlocation/netcdf-4.3.2.tar.gz
> and use the configure option:
> --download-netcdf=/yourselectedlocation/netcdf-4.3.2.tar.gz
> Unable to download package NETCDF from:
> ftp://ftp.mcs.anl.gov/pub/petsc/externalpackages/netcdf-4.3.2.tar.gz
> * If URL specified manually - perhaps there is a typo?
> * If your network is disconnected - please reconnect and rerun
> ./configure
> * Or perhaps you have a firewall blocking the download
> * Alternatively, you can download the above URL manually, to
> /yourselectedlocation/netcdf-4.3.2.tar.gz
> and use the configure option:
> --download-netcdf=/yourselectedlocation/netcdf-4.3.2.tar.gz
>
> *******************************************************************************
>
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "/tmp/pip-YAhIai-build/setup.py", line 302, in <module>
> **metadata)
> File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
> dist.run_commands()
> File "/usr/lib/python2.7/distutils/dist.py", line 953, in
> run_commands
> self.run_command(cmd)
> File "/usr/lib/python2.7/distutils/dist.py", line 972, in
> run_command
> cmd_obj.run()
> File "/tmp/pip-YAhIai-build/setup.py", line 218, in run
> config(prefix, self.dry_run)
> File "/tmp/pip-YAhIai-build/setup.py", line 148, in config
> if status != 0: raise RuntimeError(status)
> RuntimeError: 256
>
> ----------------------------------------
> Command "/home/george/polygon/firedrake/bin/python -u -c "import
> setuptools,
> tokenize;__file__='/tmp/pip-YAhIai-build/setup.py';exec(compile(getattr(tokenize,
> 'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
> 'exec'))" install --record /tmp/pip-OhlEEH-record/install-record.txt
> --single-version-externally-managed --compile --install-headers
> /home/george/polygon/firedrake/include/site/python2.7/petsc" failed with
> error code 1 in /tmp/pip-YAhIai-build/
> Traceback (most recent call last):
> File "firedrake-install", line 836, in <module>
> install("petsc/")
> File "firedrake-install", line 497, in install
> run_pip_install(["--ignore-installed", package])
> File "firedrake-install", line 360, in run_pip_install
> check_call(pipinstall + pipargs)
> File "firedrake-install", line 211, in check_call
> subprocess.check_call(arguments, env=env)
> File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
> raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command
> '['/home/george/polygon/firedrake/bin/pip', 'install', '--no-deps',
> '--ignore-installed', 'petsc/']' returned non-zero exit status 1
>
>
> On all of the abovementioned urls I'm getting 403 error when trying to
> access manually.
>
> Sincerely,
> George
>
>
> On 29.03.2016 18:30, Andrew McRae wrote:
> > I also note that your line numbers don't match up with the current
> > codebase; e.g.
> > https://github.com/firedrakeproject/firedrake/blob/master/firedrake/linear_solver.py
> >
> > On 29 March 2016 at 16:13, George Ovchinnikov <lives9@gmail.com <mailto:lives9@gmail.com>
> > <mailto:lives9@gmail.com <mailto:lives9@gmail.com>>> wrote:
> >
> > Here it is
> >
> >
> ---------------------------------------------------------------------------
> > KeyError Traceback (most recent
> > call last)
> > <ipython-input-8-752634385ffb> in <module>()
> > 22
> > 23 w_sol = Function(V)
> > ---> 24 solve(frm_tilde, rhs, w_sol,
> solver_parameters={"ksp_type":
> > "preonly", "pc_type": "lu"})
> > 25 File("w_sol.pvd") << w_sol
> >
> >
> /home/george/polygon/firedrake_new/firedrake/local/lib/python2.7/site-packages/firedrake/solving.pyc
> > in solve(*args, **kwargs)
> > 121 else:
> > 122 # Solve pre-assembled system
> > --> 123 return _la_solve(*args, **kwargs)
> > 124
> > 125
> >
> >
> /home/george/polygon/firedrake_new/firedrake/local/lib/python2.7/site-packages/firedrake/solving.pyc
> > in _la_solve(A, x, b, **kwargs)
> > 209
> options_prefix=options_prefix)
> > 210
> > --> 211 solver.solve(x, b)
> > 212
> > 213
> >
> >
> /home/george/polygon/firedrake_new/firedrake/local/lib/python2.7/site-packages/firedrake/linear_solver.pyc
> > in solve(self, x, b)
> > 140 r = self.ksp.getConvergedReason()
> > 141 if r < 0:
> > --> 142 raise RuntimeError("LinearSolver failed to
> converge
> > after %d iterations with reason: %s",
> self.ksp.getIterationNumber(),
> > solving_utils.KSPReasons[r])
> >
> > KeyError: -11
> >
> >
> >
> > On 29.03.2016 18:10, Andrew McRae wrote:
> > > What output do you get?
> > >
> > > On 29 March 2016 at 16:09, George Ovchinnikov
> <lives9@gmail.com <mailto:lives9@gmail.com> <mailto:lives9@gmail.com
> <mailto:lives9@gmail.com>>
> > > <mailto:lives9@gmail.com <mailto:lives9@gmail.com>
> <mailto:lives9@gmail.com <mailto:lives9@gmail.com>>>> wrote:
> > >
> > > Dear All,
> > >
> > > I have trilinear form a(w,u,v) and usually solve
> > > a(w,u,v) = l(v), for u with fixed w.
> > >
> > > Here I have:
> > >
> > > a = w dot(grad(u), grad(v)) * dx,
> > > and
> > > l(v) = f * v * dx.
> > >
> > > Now, given u_tilde I want to solve for w, i.e. find
> > > w_tilde such, that
> > > a(w_tilde, u_tilde, v) = l(v), for any v in suitable
> subspace.
> > >
> > > I'm trying the following:
> > >
> > > mesh = UnitSquareMesh(size, size)
> > > V = FunctionSpace(mesh, "CG", 1)
> > >
> > > f = Function(V)
> > > f.interpolate(Expression("1"))
> > >
> > > u_tilde = Function(V)
> > > u_tilde.interpolate(Expression("1/(1+exp(-1*x[0])) *
> > > 1/(1+exp(-1*(1-x[0]))) *1/(1+exp(-1*x[1])) *
> > 1/(1+exp(-1*(1-x[1])))" ))
> > >
> > > w_tilde = TrialFunction(V)
> > > v = TestFunction(V)
> > >
> > > a_tilde = (w_tilde * dot(grad(u_tilde), grad(v))) * dx
> > > frm_tilde = assemble( a_tilde )
> > >
> > > L = f * v * dx
> > > rhs = assemble(L)
> > >
> > > w_sol = Function(V)
> > > solve(frm_tilde, rhs, w_sol, solver_parameters={"ksp_type":
> > "preonly",
> > > "pc_type": "lu"})
> > > File("w_sol.pvd") << w_sol
> > >
> > >
> > > It fails to converge:
> > > 140 r = self.ksp.getConvergedReason()
> > > 141 if r < 0:
> > > --> 142 raise RuntimeError("LinearSolver
> failed to
> > converge
> > > after %d iterations with reason: %s",
> > self.ksp.getIterationNumber(),
> > > solving_utils.KSPReasons[r])
> > >
> > > KeyError: -11
> > >
> > > I'm using direct method, not the iterative one, so what is
> > happening
> > > here?
> > >
> > > _______________________________________________
> > > firedrake mailing list
> > > firedrake@imperial.ac.uk
> <mailto:firedrake@imperial.ac.uk> <mailto:firedrake@imperial.ac.uk
> <mailto:firedrake@imperial.ac.uk>>
> > <mailto:firedrake@imperial.ac.uk
> <mailto:firedrake@imperial.ac.uk> <mailto:firedrake@imperial.ac.uk
> <mailto:firedrake@imperial.ac.uk>>>
> > > https://mailman.ic.ac.uk/mailman/listinfo/firedrake
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > firedrake mailing list
> > > firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk>
> <mailto:firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk>>
> > > https://mailman.ic.ac.uk/mailman/listinfo/firedrake
> > >
> >
> >
> > _______________________________________________
> > firedrake mailing list
> > firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk>
> <mailto:firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk>>
> > https://mailman.ic.ac.uk/mailman/listinfo/firedrake
> >
> >
> >
> >
> > _______________________________________________
> > firedrake mailing list
> > firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk>
> > https://mailman.ic.ac.uk/mailman/listinfo/firedrake
> >
>
>
> _______________________________________________
> firedrake mailing list
> firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk>
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
>
>
>
>
> _______________________________________________
> firedrake mailing list
> firedrake@imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
>