Codes to some popular problems and methods in Viscous Flow Theory.
Computes the derivative of the function f(x) where x is the grid on which f(x) has been computed. We assume f(x) = sin(x) and the limits to be [-2pi, 2pi], but this is customizable for different functions.
a. Computes the derivative using the forward difference, backward difference and central difference formula and plots the analytical derivative on the same graph.
b. Computes the error at each point for different values of dx and plots on a separate log-log graph for each difference formula.
c. Plots max error in the entire domain as function of dx for all the three difference formulae on the same graph.
Computes the integral of the function f(x) between the lower limit a and upper limit b. Here x is the grid on which f(x) has been computed. We assume f(x) = sin(x) and the limits to be [-2pi, 2pi], but this is customizable for different functions.
a. Computes the integral using the trapezoidal rule and Simpson’s rule and plots the analytical derivative on the same graph.
b. Computes the error at each point for different values of dx and plots it on a separate graph.
c. Computes the integral using inbuilt functions trapz and compare it with the calculated integrals.
Creates a function, mystreamline(u,v,x,y) to compute the streamlines for a given velocity field u(x,y) and v(x,y), where -
u(x,y) = cx/(x^2 + y^2)
v(x,y) = cy/(x^2 + y^2)
where c is a constant. These functions are customizable.
a. Computes the streamlines analytically.
b. Computes the streamlines numerically and compares them with the analytical solution in a domain [x, y] ⊆ [[−1,1],[−1,1]], which is also customizable based on the fields chosen. The inbuilt matlab function is used to compare the streamlines.
c. Computes the pathlines numerically using a similar method mypathline(u,v,x,y,t) for 20 particles starting from random locations on the domain and shows that they lie on the streamlines. Identifies stagnation points, if any.
Solves the ordinary differential equation numerically and compares it with the analytical solution of the Hagen-Poiseuille flow. For more information on this flow, please read this article.
Consider the flow between two rotating cylinders rotating with angular velocity Ω1, Ω2 such that r1 ≤ r ≤ r2. Here the subscripts 1, 2 refer to the inner and the outer cylinders respectively. The streamlines are assumed to be circular so that the only component of velocity is the tangential velocity, uθ. Furthermore, uθ is only a function of radial distance r, and time t.
a. Solves the ordinary differential equation numerically and compares with the analytical solution of the flow between two rotating cylinders.
To learn more about the stability of such flows, please watch this video.
a. Computes the numerical solution of the model Paintbrush problem (Page 183 of “An Introduction to Fluid Dynamics” by G K Batchelor) and compares it with the analytical solution.
b. Plots the error and the residual as a function of iterations and the grid resolution.
Is a function to implement the tridiagonal matrix algorithm (TDMA). For more information on the TDMA solver, please read this article.
Ruthu S Sanketh (2022). Viscous Flow Theory (https://github.com/ruthussanketh/viscous-flow/releases/tag/v1.0.0), GitHub. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!