Question: C PROGRAMMING QUESTION. Hi i am coding up a program that solves the 1D linear convection equation in C. I am running into some issues

C PROGRAMMING QUESTION. Hi i am coding up a program that solves the 1D linear convection equation in C. I am running into some issues in my final nested loop which applies the update equation. (see code below). I dont know what going wrong. I have the problem coded up and working in python i also have attached that code below for reference. I followed that as psudeo code but my C program does not work as planned. Can anyone fix my C code. I would appreciate it a lot.

This is the C code

C PROGRAMMING QUESTION. Hi i am coding up a program that solves

THIS IS THE WORKING PYTHON SCRIPT

the 1D linear convection equation in C. I am running into some

# include # include # include # include int main() El //eqyation to be solved ID linear advection -- du/dt + c(du/dx) = 0 //initial conditions u(x,0) = 10 (x) //after discretisation using forward difference time and backward difference space //update equation becomes u[i] = 10[i] C * dt/dx * (u0[i] - ui 1]); int nx = 41; /um of grid points double dx = 2.0 / (nx 1.0); //magnitude of the spacing between grid points int nt = 25;/t is the number of timesteps double dt 0.25; //the amount of time each timestep covers int c = 1; //assume wavespeed //double uo_array: // set up our initial conditions. The initial velocity u_0 //is 2 across the interval of 0.5

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 Databases Questions!