0001 function A=patch_sp(dx,jacx,dy,jacy);
0002
0003
0004
0005
0006
0007
0008 npdx=length(dx);
0009 npdy=length(dy);
0010
0011 nm=npdx*(npdy-1);
0012 mn=npdx*npdy;
0013 A=sparse(mn,mn);
0014
0015 for i=1:npdx
0016 ki=i;
0017 for j=1:npdy
0018 kj=(j-1)*npdx+i;
0019 A(ki,kj)=-dy(1,j)/jacy;
0020 end
0021 end
0022
0023
0024 for j=1:npdy
0025 kj=j*npdx;
0026 for i=1:npdx
0027 ki=(j-1)*npdx+i;
0028 A(kj,ki)=A(kj,ki)+dx(npdx,i)/jacx;
0029 end
0030 end
0031
0032
0033 for i=1:npdx
0034 ki=nm+i;
0035 for j=1:npdy
0036 kj=(j-1)*npdx+i;
0037 A(ki,kj)=A(ki,kj)+dy(npdy,j)/jacy;
0038 end
0039 end
0040
0041
0042 for j=1:npdy
0043 kj=(j-1)*npdx+1;
0044 for i=1:npdx
0045 ki=(j-1)*npdx+i;
0046 A(kj,ki)=A(kj,ki)-dx(1,i)/jacx;
0047 end
0048 end
0049