MATLAB code for Computational Fluid Mechanics

In summary, the person is seeking help with solving an exercise in the book "White, Fluid Mechanics" involving a duct with three sections and a PDE to solve for the stream function in each node of the mesh. They have approximated the PDE using finite element difference and have obtained the upper, lower, right, and left values needed to solve for any point in the mesh. However, they are unsure how to compute the inner nodes values given only the boundary nodes. They are considering using MATLAB or Open Source Physics Java library to write a program to solve the exercise.
  • #1
airliner
1
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
  • #2
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:

Related to MATLAB code for Computational Fluid Mechanics

1. What is MATLAB code for Computational Fluid Mechanics?

MATLAB is a powerful programming language and software environment commonly used in the field of Computational Fluid Mechanics. It allows scientists and engineers to create and run numerical simulations of fluid flow and analyze the results.

2. How is MATLAB code used in Computational Fluid Mechanics?

MATLAB code is used in Computational Fluid Mechanics to create mathematical models of fluid flow, solve complex equations, and visualize the results. It also allows for the implementation of different numerical methods and algorithms to simulate various fluid flow scenarios.

3. What are the benefits of using MATLAB code in Computational Fluid Mechanics?

There are several benefits to using MATLAB code in Computational Fluid Mechanics, including its powerful built-in functions and libraries, its user-friendly interface, and its ability to handle large and complex data sets. It also allows for easy customization and automation of simulations.

4. Do I need to have previous experience with MATLAB to use it for Computational Fluid Mechanics?

While having some familiarity with MATLAB can be helpful, it is not necessary to have previous experience to use it for Computational Fluid Mechanics. There are many resources available, such as tutorials and documentation, to help beginners get started with coding in MATLAB.

5. Can MATLAB code be used for both two-dimensional and three-dimensional fluid flow simulations?

Yes, MATLAB code can be used for both two-dimensional and three-dimensional fluid flow simulations. It offers a range of tools and functions for creating and solving equations in both 2D and 3D, making it a versatile tool for Computational Fluid Mechanics.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
41
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
Back
Top