MATLAB DNS Low Speed Compressible Code for Air
Great news dear visitor, I provide
here an educational DNS MATLAB code for the study of a low speed air
compressible code. The code is to be used for educational purposes. The zipfile
has a text file telling you how to run it, this is the first version one for
the simplest constructed case, the Navier Stokes equations are solved for a box
without any input or output boundaries, the user after understanding the code
can adapt it for his own interest.
The user will have to validate it
once he starts using it for the flow cases he implements it on. I would very
much appreciate any input about my code. A more higher order differencing
scheme is required in addition to apply more complex boundary conditions, I hope this code contributes to your development.
DNS Code for a Subsonic Case in Cartisian Coordinates
A zip file of the full code will be uploaded soon. The code still needs development and that will be done gradually through linking the calculated derivatives to the generated mesh. The code relaying on random generators can create a homogenous flow field inside the box. I plan next to apply the boundary condition after constructing the model to function properly. Then comes applying inflow and outflow conditions. This code is a DNS code applicable to be applied for a subsonic compressible flow case. The nice thing about a DNS subsonic flow that pressure can be handled easily. This code is recommended to be run on a quad core machine that has four gig ram to be able to handle the big generated data output for the data analysis part later.
For people interested in having a copy of the code then please contact me in order to get a copy.
For people interested in having a copy of the code then please contact me in order to get a copy.
I would very much appriciate any feedback relating to the provided code, I will soon upload its mannual and how the code should be run.
This is the Main Body of the Code
clc
clear
delete u.mat
delete v.mat
delete w.mat
delete dudx.mat
delete dvdy.mat
delete dwdz.mat
delete ru.mat
delete rv.mat
delete rw.mat
delete drudx.mat
delete drvdy.mat
delete drwdz.mat
delete r.mat
delete r.mat
delete T.mat
delete T0.mat
delete mu.mat
delete m0.mat
delete e.mat
delete E.mat
delete CV.mat
M=12;
N=12;
L=12;
LX=1;
LY=1;
LZ=1;
DX=LX/M;
DY=LY/N;
DZ=LZ/L;
IT=0; %INITIAL TIME
FT=3; %FINAL TIME
NTS=10; %NUMBER OF TIME STEPS
dt=(FT-IT)/NTS;
U
v
W
R
Heat1
Heat2
DUDX
DVDY
DWDZ
RU
RV
RW
DRDX
DRDY
DRDZ
DRUDY
DRUDZ
DRVDX
DRVDZ
DRWDX
DRWDY
DRUDX
DRVDY
DRWDZ
D2RU2X
D2RU2Y
D2RU2Z
D2RV2X
D2RV2Y
D2RV2Z
D2RW2X
D2RW2Y
D2RW2Z
RNEW
RUNEW
RVNEW
RWNEW
save u
save v
save w
save dudx
save dvdy
save dwdz
save ru
save rv
save rw
save drudx
save drvdy
save drwdz
save r
save T
save T0
save mu
save m0
save e
save E
save CV
for i=1:NTS;
figure(i)
contour(r(:,:,2,i),30)
grid on
pause(1)
end
display('press enter to close')
close all
clear
delete u.mat
delete v.mat
delete w.mat
delete dudx.mat
delete dvdy.mat
delete dwdz.mat
delete ru.mat
delete rv.mat
delete rw.mat
delete drudx.mat
delete drvdy.mat
delete drwdz.mat
delete r.mat
delete r.mat
delete T.mat
delete T0.mat
delete mu.mat
delete m0.mat
delete e.mat
delete E.mat
delete CV.mat
M=12;
N=12;
L=12;
LX=1;
LY=1;
LZ=1;
DX=LX/M;
DY=LY/N;
DZ=LZ/L;
IT=0; %INITIAL TIME
FT=3; %FINAL TIME
NTS=10; %NUMBER OF TIME STEPS
dt=(FT-IT)/NTS;
U
v
W
R
Heat1
Heat2
DUDX
DVDY
DWDZ
RU
RV
RW
DRDX
DRDY
DRDZ
DRUDY
DRUDZ
DRVDX
DRVDZ
DRWDX
DRWDY
DRUDX
DRVDY
DRWDZ
D2RU2X
D2RU2Y
D2RU2Z
D2RV2X
D2RV2Y
D2RV2Z
D2RW2X
D2RW2Y
D2RW2Z
RNEW
RUNEW
RVNEW
RWNEW
save u
save v
save w
save dudx
save dvdy
save dwdz
save ru
save rv
save rw
save drudx
save drvdy
save drwdz
save r
save T
save T0
save mu
save m0
save e
save E
save CV
for i=1:NTS;
figure(i)
contour(r(:,:,2,i),30)
grid on
pause(1)
end
display('press enter to close')
close all
The code out put