Skip to content

Commit e6acc5c

Browse files
committed
cleanup code
1 parent e60a9f0 commit e6acc5c

File tree

3 files changed

+56
-100
lines changed

3 files changed

+56
-100
lines changed

NS_2d_cylinder_PHS.m

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
% U0 = W0(1:L_W2/2);
1818
% V0 = W0(L_W2/2+1:end);
1919

20-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20+
2121

2222
%% advection: adams-bashforth method
2323

@@ -46,8 +46,6 @@
4646
V1(end-L_B+1:end-0) = V(end-L_B+1:end-0);
4747
%
4848
%
49-
50-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5149
%% viscousity: Crank-Nicolson
5250

5351
%
@@ -72,8 +70,6 @@
7270

7371
U2 = L_u_inv(U2);
7472
V2 = L_v_inv(V2);
75-
76-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7773
%% pressure correction
7874

7975
F0 = (D0_12_x*(U2-0)+D0_12_y*(V2-0));
@@ -85,7 +81,7 @@
8581
p = p(1:(length(F0)+L_B_S)); % regularization
8682
F = F(1:(length(F0)+L_B_S)); % regularization
8783

88-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84+
8985

9086
U3 = (U2-0) - [(D0_21_x*p ); zeros(L_B,1)];
9187

@@ -101,8 +97,6 @@
10197

10298
% V3(L_W+1:end) = V(L_W+1:end);
10399

104-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105-
106100
%% velocities at the following time-step
107101

108102
W3 = [U3;V3];

RBF_PHS_FD_all.m

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
function [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,
@@ -19,10 +15,6 @@
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
%%
2719
X1 = xy1(:,1);
2820
NxNy1 = length(X1);
@@ -35,8 +27,6 @@
3527
weight_yy = zeros(NxNy1,k);
3628
weight_xy = zeros(NxNy1,k);
3729

38-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39-
4030
%% Local RBF-FDs for each grid
4131

4232

@@ -139,8 +129,6 @@
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;
@@ -158,24 +146,16 @@
158146

159147

160148
end
161-
162-
163149
%% Assigning RBF-FD weights to global matrices
164-
165-
166150
Idx_x = reshape((1:NxNy1).*ones(k,1),1,[]);
167151

168152
Idx_y = reshape(Nearest_Idx(:,1:k)',1,[]);
169-
170-
171153
Wx = reshape(weight_x',1,[]);
172154
Wy = reshape(weight_y',1,[]);
173155
WL = reshape(weight_L',1,[]);
174156
Wxx = reshape(weight_xx',1,[]);
175157
Wyy = reshape(weight_yy',1,[]);
176158
Wxy = reshape(weight_xy',1,[]);
177-
178-
179159
Dx = sparse(Idx_x,Idx_y,Wx,NxNy1,NxNy2);
180160
Dy = sparse(Idx_x,Idx_y,Wy,NxNy1,NxNy2);
181161
L = sparse(Idx_x,Idx_y,WL,NxNy1,NxNy2);
@@ -184,6 +164,4 @@
184164
Dxy = sparse(Idx_x,Idx_y,Wxy,NxNy1,NxNy2);
185165

186166
D_all = {Dx,Dy,L,Dxx,Dyy,Dxy};
187-
188-
189167
end

0 commit comments

Comments
 (0)