Last change
on this file since 4 was
4,
checked in by zhangj, 10 years ago
|
Initial import--MML version from SOLEIL@2013
|
File size:
766 bytes
|
Rev | Line | |
---|
[4] | 1 | function pass = falknershan |
---|
| 2 | |
---|
| 3 | tol = chebfunpref('eps'); |
---|
| 4 | dom = domain(0,6); |
---|
| 5 | beta = 0.5; |
---|
| 6 | |
---|
| 7 | I = eye(dom); D = diff(dom); |
---|
| 8 | |
---|
| 9 | f = @(u) D^3*u + u.*(D^2*u) + beta*(1-(D*u).^2); |
---|
| 10 | dfdu = @(u) D^3 + diag(D^2*u) + diag(u)*D^2 - 2*beta*diag(D*u)*D; |
---|
| 11 | |
---|
| 12 | % Initial guess satisfies u(0)=u'(0)=0, u'(dom(2))=1 |
---|
| 13 | u = chebfun( @(x) x.^2/(2*dom(2)), dom ); |
---|
| 14 | |
---|
| 15 | % Boundary conditions for the Newton correction |
---|
| 16 | bcleft = struct('op',{I,D},'val',{0,0}); |
---|
| 17 | bcright = struct('op',D,'val',0); |
---|
| 18 | bc = struct('left',bcleft,'right',bcright); |
---|
| 19 | |
---|
| 20 | % Newton iteration |
---|
| 21 | du = Inf; niter = 0; |
---|
| 22 | while norm(du)>1e-10*(tol/eps) && niter < 11 |
---|
| 23 | r = f(u); |
---|
| 24 | J = dfdu(u); |
---|
| 25 | J.bc = bc; |
---|
| 26 | J.scale = norm(u); |
---|
| 27 | du = -(J\r); |
---|
| 28 | u = (u+du); |
---|
| 29 | niter = niter+1; |
---|
| 30 | end |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | pass = abs( feval(diff(u,2),0) - 0.927680043004878) < 1e8*tol; |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | |
---|
Note: See
TracBrowser
for help on using the repository browser.