Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is using matlab. please answer the question in picture one 6. Coding problem: write Matlab code to solve the following advection problem using forward

image text in transcribed
image text in transcribed
this is using matlab. please answer the question in picture one
6. Coding problem: write Matlab code to solve the following advection problem using forward Euler and 1st-order upwinding spatial discretization scheme. + - + -= 0 which is solved on a 2D domain, [0, 1] x [0, 1] with periodicity along both x and y directions. The initial condition is u0(x,y) = exp (- [(x-0.5)*+(59 -0.5)?). The time integration is carried out for one period, and then we perform convergence study. (Hint: the initial condition is the exact solution at final time; a code template is provided in the next page and you might develop your own code based on it or from scratch.) Error Rate Ngrid x Ngrid 41 x 41 81 x 81 161 x 161 321 x 321 clc close clear Ngrid = 81; & no. of grid pts along x . x = linspace(0, 1, Ngrid); Y = linspace(0, 1, Ngrid); h = 1/(Ngrid-1); % grid spacing [X, Y] = meshgrid(x, y); % 2d arrays of x,y values X = X'; % transpose so that x(i, j),Y(i.) are Y = Y'; $ coordinates of (1,1) point F = expl - ((X-0.5).^2 + (Y-0.5). 2) / 0.05 ); $ initial condition & contourt(X, Y, F); dt = 0.001; 8 time-step size (adjustable) u = F; & initialization tour = 0; Ntime = 1/dt; for itime = 1:Ntime tour - tour + dt; end error evaluation err = sqrt(sum( sum( (u - F). 2)) / Ngrid/Ngrid); fprintf('discretization error is id ', err); contourf (X, Y, u)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago