evaluation a drag over a pre-designed model of a car using CFD
https://docs.google.com/document/d/1Nc89Y_wGmIrIAlx5-fdcgDCSJWuoJGJypjjsSJsr4u8/edit?usp=sharing
clear all
close all
clc
%defining all the constant values
L = 1;
n = 161;
c = 1;
dt = 0.01;
%calculation
x = linspace(0,L,n);
dx = L/(n-1);
x_start = find(x==0.1);
x_stop = find(x==0.3);
%initialize arrays and apply boundary conditions
u = ones(1,n);
u(1) = 1;
u(x_start:x_stop) = 2;
uold = u;
u_initial = u;
nt = 40;
%time loop
for k = 1:nt
%space loop
for i=2:n
u(i)=uold(i)-(((c*dt)/dx)*(uold(i)-uold(i-1)));
end
uold = u;
end
plot(x,u_initial,\'b\');
hold on
plot(x,u,\'r\');