Question: QUESTION 2 [18 MARKS TOTAL] For the advection-diffusion equation shown in Eq (1), assume that u is a velocity (assume that u > 0)

QUESTION 2 [18 MARKS TOTAL] For the advection-diffusion equation shown in Eq

QUESTION 2 [18 MARKS TOTAL] For the advection-diffusion equation shown in Eq (1), assume that u is a "velocity" (assume that u > 0) and a is a diffusion coefficient (a> 0). You will solve this equation on a domain 0 x L with boundary conditions at x = 0 given by q(0,t) = 0 and aq (L,t)/ax = 0. The initial condition is a square wave given by q(x, 0) = {1, if 25 < x < 35 Q2a otherwise Write a MATLAB function that updates the values of q by ONE TIMESTEP using the FTCS scheme (it will be a short function). Ensure that your function has the function header function [q_new] = ftcs_step (q, dt, dx, u, alpha) The boundary condition at x = 0 is easily implemented using q(x=0) = 0, but you will need to set the boundary condition at x = L using a finite difference approximation to the derivative. Thus, when q(L,t) is needed in an expression, you will need to use the finite difference expression of the derivative to set the BC. (In this lab, centered or one-sided differences are OK to use for the BC - whatever you like).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mechanical Engineering Questions!