finite difference method for continuity equation in polar form
Show older comments
the continuty equation for incompressible and 2 d irrotational flow in polar form is written as:

Using direct method, Lu decomposition
the domain is a circle with inner radius 1 and outer radius 2 and theta with a domain [0; 2*pi].
boundary conditions are u(1; theta) = 1 and u(2; theta) = 0
discretization with uniform (theta*r) (81 * 41), Implement Jacobi,
the discretization equation is : (j index for r and i index for theta)


use a direct solver (LU factorization) to solve. The domain can be imagined as rectangle.

%%%%%LU factorization
clc
clear all
%%%%%%%%%%%%%%% Inputs
r_in=1; % Inside Radius of polar coordinates, r_in, say 1 m
r_out = 2; % Outside Radins of polar coordinates, r_out, say 2 m
j_max = 40; % no. of sections divided between r_in and r_out, choose: 40, 80, 160
dr = (r_out - r_in)/j_max; % section length, m
% total angle = 2*pi
i_max= 80; % no. of angle steps, choose: 80, 160,320
dtheta= 2*pi/i_max; % angle step, rad
r = 1:dr:2;
theta=0:dtheta:2*pi;
[r,theta]=meshgrid(r,theta);
%%%%%initialize solution array
u=zeros(i_max+1,j_max+1);%%%%81*41 matrix
u_0=zeros(i_max+1,j_max+1);%%%% old
u(:,1)=u(:,1)+1; %%%%B.C
u(:,2)=u(:,2)+0;%%%%% B.C
beta=dr^2/dtheta^2;
7 Comments
aktham mansi
on 9 Apr 2022
Edited: aktham mansi
on 9 Apr 2022
Torsten
on 10 Apr 2022
And how do you plan to discretize the periodic boundary condition at theta=0 and theta = 2*pi and the condition
du/dr = 0 at r = 0 ?
aktham mansi
on 10 Apr 2022
Torsten
on 10 Apr 2022
Little problem with the periodicity ?
aktham mansi
on 10 Apr 2022
Edited: aktham mansi
on 10 Apr 2022
aktham mansi
on 10 Apr 2022
aktham mansi
on 11 Apr 2022
Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
