60
edits
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) | |||
u = Function ('u', V, xx); | |||
a = JacobianForm (problem, V, mu, lmbda, u); | |||
L = ResidualForm (problem, V, mu, lmbda, B, T, u); | |||
if (nargout == 1) | |||
[y, xx] = assemble (L, xx, bc1, bc2); | |||
elseif (nargout == 2) | |||
[jac, y, xx] = assemble_system (a, L, xx, bc1, bc2); | |||
endif | |||
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")); |
edits