Hi David,
On 12/06/2016 03:17 PM, David Jessop wrote:
I have a non-linear form of the Poisson equation where the "diffusion" coefficient depends on the derivatives of the state variable (see image). There are no Dirichlet-type boundary conditions (i.e. no ebcs) so I really need to specify a good initial guess at the solution.
My questions are:
- How are initial guesses passed to the solver? From the documentation, it doesn't seem like initial guesses can be directly passed to the nls.newton solver as an argument (though they are an argument of the subroutine __call__).
You are right that it is not possible to influence the initial guess of the
(non)linear solver from the problem description file. However, you can use the
interactive approach, where everything can be controlled in fine detail. See
[1], for example, where the line vec = pb.solve()
[2] calls the solver. Its
first (optional) argument is the initial state guess (instance of State [3] -
State.vec is the numpy array holding the DOFs - you can set it in-place to
whatever you want, see below). You can also call the solvers directly (see the
parallel examples).
- In what form should the initial guess vector/array be written? Can a function be passed? Do numerical values have be be specified at the mesh nodes?
For the Lagrange basis (the default), you can use a function of nodal coordinates - just evaluate what you need in the coordinates returned by Field.get_coor().
Or, more general, you could misuse the initial conditions facilities for time dependent problems - create the initial conditions as in [4], and call State.apply_ic().
Let me know if you need a more detailed help.
r.
[1] http://sfepy.org/doc-devel/examples/linear_elasticity/linear_elastic_interac... [2] http://sfepy.org/doc-devel/src/sfepy/discrete/problem.html?highlight=problem... [3] http://sfepy.org/doc-devel/src/sfepy/discrete/state.html?#sfepy.discrete.sta... [4] http://sfepy.org/doc-devel/examples/diffusion/time_poisson_interactive.html