11function [D_all ] = RBF_PHS_FD_all(xy1 ,xy_s ,Nearest_Idx ,k ,m ,d )
22
33% RBF_PHS_FD_ALL RBF-FD-based (PHS+poly) global differentiation matrices
4-
5-
64% [D_ALL] = RBF_PHS_FD_ALL(XY1,XY_S,NEAREST_IDX,K,M,D,VARARGIN) returns
75% the global differentiation matrices from the node set {xy_s} to node set
86% {xy1}, including Dx, Dy, DL, Dxx, Dyy, Dxy.
97% NEAREST_IDX is the index matrix return by NEAREST_INTERP.
108% k is local RBF stencil size, m is the order of PHS-RBF, and d is the
119% degree of the polynomial Augmentation.
12-
13-
1410% Reference:
1511% [1] T. Chu, O. T. Schmidt, RBF-FD discretization of the Navier-Stokes
1612% equations on scattered but staggered nodes,
1915% Submitted to Journal of Computational Physics
2016%
2117% T. Chu (tic173@ucsd.edu), O. T. Schmidt (oschmidt@ucsd.edu)
22-
23-
24-
25- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2618%%
2719X1 = xy1(: ,1 );
2820NxNy1 = length(X1 );
3527weight_yy = zeros(NxNy1 ,k );
3628weight_xy = zeros(NxNy1 ,k );
3729
38- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39-
4030 %% Local RBF-FDs for each grid
4131
4232
139129% A_inv = V*S*(U');
140130%
141131% W = A_inv*L;
142-
143-
144132 w = W(1 : k ,: ); % Extragct the RBF-FD weights
145133
146134 weight_x(m1 ,1 : k ) = w(: ,1 )/scale_x ;
158146
159147
160148end
161-
162-
163149%% Assigning RBF-FD weights to global matrices
164-
165-
166150Idx_x = reshape((1 : NxNy1 ).*ones(k ,1 ),1 ,[]);
167151
168152Idx_y = reshape(Nearest_Idx(: ,1 : k )' ,1 ,[]);
169-
170-
171153Wx = reshape(weight_x ' ,1 ,[]);
172154Wy = reshape(weight_y ' ,1 ,[]);
173155WL = reshape(weight_L ' ,1 ,[]);
174156Wxx = reshape(weight_xx ' ,1 ,[]);
175157Wyy = reshape(weight_yy ' ,1 ,[]);
176158Wxy = reshape(weight_xy ' ,1 ,[]);
177-
178-
179159Dx = sparse(Idx_x ,Idx_y ,Wx ,NxNy1 ,NxNy2 );
180160Dy = sparse(Idx_x ,Idx_y ,Wy ,NxNy1 ,NxNy2 );
181161L = sparse(Idx_x ,Idx_y ,WL ,NxNy1 ,NxNy2 );
184164Dxy = sparse(Idx_x ,Idx_y ,Wxy ,NxNy1 ,NxNy2 );
185165
186166D_all = {Dx ,Dy ,L ,Dxx ,Dyy ,Dxy };
187-
188-
189167end
0 commit comments