Fem-fenics: Difference between revisions

29 bytes removed ,  8 September 2013
no edit summary
No edit summary
No edit summary
Line 428: Line 428:
u0 = assemble (L, bcs{:});
u0 = assemble (L, bcs{:});
# Create function for the resolution of the NL problem
# Create function for the resolution of the NL problem
function [y, jac] = f (problem, xx, V, bc1, bc2, B, T, mu, lmbda)
function [y, jac] = f (problem, xx, V, bc1, bc2, B, T, mu, lmbda)
#    u = Function ('u', V, xx);
  u = Function ('u', V, xx);
#    a = JacobianForm (problem, V, mu, lmbda, u);
  a = JacobianForm (problem, V, mu, lmbda, u);
#    L = ResidualForm (problem, V, mu, lmbda, B, T, u);
  L = ResidualForm (problem, V, mu, lmbda, B, T, u);
#    if (nargout == 1)
  if (nargout == 1)
#      [y, xx] = assemble (L, xx, bc1, bc2);
    [y, xx] = assemble (L, xx, bc1, bc2);
#    elseif (nargout == 2)
  elseif (nargout == 2)
#      [jac, y, xx] = assemble_system (a, L, xx, bc1, bc2);
    [jac, y, xx] = assemble_system (a, L, xx, bc1, bc2);
#    endif
  endif
endfunction
endfunction
 
fs = @(xx) f (problem, xx, V, bcl, bcr, B, T, mu, lmbda);
fs = @(xx) f (problem, xx, V, bcl, bcr, B, T, mu, lmbda);
[x, fval, info] = fsolve (fs, u0, optimset ("jacobian", "on"));
[x, fval, info] = fsolve (fs, u0, optimset ("jacobian", "on"));
60

edits