JNTU Mechanical Engineering Worksheet

User Generated

NWznah

Engineering

Jawaharlal Nehru Technological University

Description

Unformatted Attachment Preview

ME 216 CFD PROJECT I Fall 2022 Due on Thursday by 11:59 PM on 11/3/2022. 10 Points of Total Course Grade. Instruction: If you were caught copying program or code from online source, you will receive zero score for this project. Project Prompt: Solve the wave equation u u + = 0 using t x i. First order upwind scheme ii. MacCormack scheme for the initial conditions u ( x, 0) = 1 x  10 u ( x, 0) = 0 x  10 and Dirichlet boundary conditions. Choose a 41-grid point mesh with x = 1 and compute to t=18. Solve this project for  = 1.0, 0.6, and 0.3. Each student has to submit the following items to Canvas portal to receive full credits: a. Tabulated results of u for exact and numerical solutions at t=18 (2 points) b. Graphs for comparison between exact and numerical solutions (4 points) c. An electronic MATLAB file for my code execution. (4 point) Project Assignment #1 Computational Grids for Project #1 n+2 n+1 n j j +1 j +2 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 𝑢𝑗=1 =1 Exact Solution is Pure Initial Value Problem 𝑢(𝑥, 𝑡)=F(x-ct) 𝑢(𝑥, 0)=F(x) First-Order Upwind Scheme 𝑢𝑗𝑛+1 - 𝑢𝑗𝑛 Δ𝑡 𝑛 𝑢𝑗𝑛 − 𝑢𝑗−1 +c Δ𝑥 =0 MacCormack Scheme Predictor Corrector 𝑛+1 𝑛 𝑢𝑗 = 𝑢𝑗 - cΔ𝑡 𝑛 (𝑢𝑗+1 − 𝑢𝑗𝑛) Δ𝑥 1 𝑛+1 𝑢𝑗 = [𝑢𝑗𝑛 +𝑢𝑗𝑛+1 - cΔ𝑡 2 𝑛+1 (𝑢𝑗𝑛+1 − 𝑢𝑗−1 ) Δ𝑥 ] ME 216 CFD PROJECT I Fall 2022 Due on Thursday by 11:59 PM on 11/3/2022. 10 Points of Total Course Grade. Instruction: If you were caught copying program or code from online source, you will receive zero score for this project. Project Prompt: Solve the wave equation u u + = 0 using t x i. First order upwind scheme ii. MacCormack scheme for the initial conditions u ( x, 0) = 1 x  10 u ( x, 0) = 0 x  10 and Dirichlet boundary conditions. Choose a 41-grid point mesh with x = 1 and compute to t=18. Solve this project for  = 1.0, 0.6, and 0.3. Each student has to submit the following items to Canvas portal to receive full credits: a. Tabulated results of u for exact and numerical solutions at t=18 (2 points) b. Graphs for comparison between exact and numerical solutions (4 points) c. An electronic MATLAB file for my code execution. (4 point)
Purchase answer to see full attachment
Explanation & Answer:
2 pages
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

View attached explanation and answer. Let me know if you have any questions.

CODE:
clc
dx = 1;
x = 0:dx:40;
% x will be the row direction
% t will be column direction
% BACKWARD DIFFERENCE IN TIME AND FORWARD DIFFERENCE IN
SPACE
for c = [1,0.6,0.3]
dt = c*dx;
t = 0:dt:18;
u_a = zeros(length(x),length(t));
u_a(:,1) = sin(2*pi*x/40);
A = zeros(length(x)-2);
for i = 1:length(x)-2
if i == 1
A(1,1:2) = [1 c/2];
elseif i == length(x)-2
A(end,end-1:end) = [-c/2 1];
else
A(i,i-1:i+1) = [-c/2 1 c/2];
end
end
for i = 2:length(t)
b = u_a(2:end-1,i-1); % here we can add boundary values, in our case (0)
u_a(2:end-1,i) = A\b;
end
figure;contourf(u_a)
title(['Backward(in t),Forward(in x) c = ' num2str(c)])
xlabel('t')
ylabel('x')
end

for c = [1,0.6,0.3]

dt = c*dx;
t = 0:dt:18;
u_b = zeros(length(x),length(t));
u_b(:,1) = sin(2*pi*x/40);
for it = 2:length(t)
for ix = 2:length(x)-1
u_b(ix,it) = 0.5*(u_b(ix+1,it-1)+u_b(ix-1,it-1))...
- 0.5*c*(u_b(...


Anonymous
Just the thing I needed, saved me a lot of time.

Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Related Tags