MATLAB code for Computational Fluid Mechanics

Click For Summary
SUMMARY

The discussion focuses on solving a computational fluid mechanics problem using MATLAB, specifically Example 8.5 from the book "Fluid Mechanics" by White. The user needs to compute the stream function values at inner nodes of a mesh defined by the PDE \(\dfrac{\partial^{2}\psi}{\partial x^{2}} + \dfrac{\partial^{2}\psi}{\partial y^{2}} = 0\) with given boundary conditions. The user has successfully defined the boundary conditions but requires assistance in iteratively calculating the inner node values using the finite difference approximation \(\psi_{i,j} = \dfrac{1}{4} (\psi_{i+1,j} + \psi_{i-1,j} + \psi_{i,j+1} + \psi_{i,j-1})\). Suggestions include utilizing MATLAB for implementation or exploring the Open Source Physics Java library for alternative solutions.

PREREQUISITES
  • Understanding of partial differential equations (PDEs)
  • Familiarity with finite difference methods
  • Proficiency in MATLAB programming
  • Knowledge of boundary value problems in fluid dynamics
NEXT STEPS
  • Implement the finite difference method in MATLAB to solve the PDE
  • Research iterative methods for solving systems of equations
  • Explore the Open Source Physics Java library for fluid dynamics simulations
  • Learn about boundary value problem solvers in MATLAB
USEFUL FOR

Students and professionals in computational fluid dynamics, MATLAB programmers, and anyone interested in solving PDEs related to fluid mechanics.

airliner
Messages
1
Reaction score
0
Hello guys, I'm writing to get some help on an exercise I've been thinking but I can't get to solve.

I have to write the code for the Example 8.5 of the book White, Fluid Mechanics. Here is the problem and the solution I have to obtain.

It is about one duct that has three sections in which I have to obtain the value of the stream function in every node of the mesh. The PDE I have to solve is ##\dfrac{\partial^{2}\psi}{\partial x^{2}} + \dfrac{\partial^{2}\psi}{\partial y^{2}} = 0##, I have approximated it using the finite element difference (2n order) and with ##\Delta x = \Delta y = 0## I have obtained the approximation: ##\psi_{i,j} = \dfrac{1}{4} (\psi_{i+1,j} + \psi_{i-1,j} + \psi_{i,j+1} + \psi_{i,j-1})##, that is that I need the upper, lower, right and left values to obtain the ##\psi_{i,j}## value at any point of the mesh.

I know the boundary conditions which are:
Through the whole upper wall: ##\psi = 10##
Through the whole lower wall: ##\psi = 0##
Inlet: ##\psi(1,j) = 2\cdot (j-6)## from: ## j=7 ## to: ##j=10##
Outlet: ##\psi(16,j) = j-1 ## from: ##j=2## to: ##j=10##

Up to this point, everything is OK. But the problem is that I need to solve the mesh (inner nodes are unknown), and I only know boundary nodes. How can I compute the inner nodes values if I need 4 values (to solve: ##\psi_{i,j} = \dfrac{1}{4} (\psi_{i+1,j} + \psi_{i-1,j} + \psi_{i,j+1} + \psi_{i,j-1})##) ?

I need to compile a program with Matlab, but my problem is not coding the program... It is that I don't know how can I do it to use the last equation to obtain the inner nodes values...

Does anyone know how to do it? Any help is useful.

Thank you very much. I hope you guys understand which is my problem with this exercise.
 
Physics news on Phys.org
You'll probably have to write a program to handle this as MATLAB libraries from what I've resd online are limited in what they can do in fluid dynamics.

An alternative might be to look into Open Source Physics Java library which provides the tools and framework to do this kind of simulation. It will require you to learn Java programming and become proficient using the OSP ODE solvers to solve it.

http://Www.compadre.org.osp /osp
 
Last edited by a moderator:

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 41 ·
2
Replies
41
Views
10K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 11 ·
Replies
11
Views
5K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K