Question: TASK 2: Write a MATLAB function/script to implement the scheme on page 11 (40 points) MATLAB question Step by step implementation 1. Define the simulation
TASK 2: Write a MATLAB function/script to implement the scheme on page 11 (40 points)
MATLAB question
Step by step implementation 1. Define the simulation parameters 2. Initialize the simulation: A. Particle locations: place NXN particles randomly on a two dimensional plane. E.g., determine the (x, y) coordinates for each particle using the rand() function. (the upper script '0' denotes the temporal index) B. Particle velocities: zero for both velocity components. E.g., assign zero to (up, Vp) for each particle suing the zeros() function. 3. Advance in time for n=1, totaltimesteps Compute the flow velocity at the corresponding location for each particle, ur- 1=cos(xn-1)sin(yn-1), ven-1=-sin(xn-1) cos(yn-1) Compute forces on each particle, fxn-1=6 prvR(urn-1-Upn-1), fyn-1=6 prvR(vrn-1- Vpn-1) Compute the particle velocity at n, up=upn-1+Atfxn-1/(PpV.), Vp =Vph-1+Atfyn-1/(ppVD) Compute the particle location at n, Xp0=Xpn-1+Atup", Vpn=ypn-1+Atvph end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
