CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

How would I write a 2d steady, inviscid, and incompressible flow simulation?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 13, 2017, 13:24
Default How would I write a 2d steady, inviscid, and incompressible flow simulation?
  #1
New Member
 
Join Date: Jan 2017
Posts: 3
Rep Power: 9
7he404guy is on a distinguished road
I'm trying to write a 2D steady, inviscid, and incompressible flow simulation in matlab incorporating some potential flow elements. Essentially, I'll have a few sources and a sink and I want to calculate the velocity for each cell in my mesh. For starters, I'm just doing a simple 3x3 grid with one source and one sink. Which equations are of particular usefulness in completing this program?

Where I've started is with continuity -- mass flow into any cell is equal to mass flow out of that cell. This leaves me a few equations short of having a solvable problem (9 equations with 12 unknowns where each cell just has an equation for mass flow in and mass flow out to surrounding cells). How would I go about solving such a system? My end goal is to have a 64x64 grid with multiple sources and a couple of barriers leading to a single sink. Potential flow equations won't work for this since the geometry may be variable.

Again, I want to implement this in Matlab (or possibly C++) so I won't be using any CFD software. This is because I want to learn the process for developing/implementing the equations and not the applied method for solving them in a software package.

Any help is appreciated.
7he404guy is offline   Reply With Quote

Old   January 13, 2017, 15:28
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
I am not sure of what you want to do ...however, the set of equations and BC you have to work with is

div v = 0
curl v =0
n.v =vn

This problem can be solved in a very simple way by introducing the either the real or the immaginary part of the potential function:

v =grad phi -> dif grad phi = 0 being curl v =0 satisfied

v =curl k psi -> Lap psi =0 being div v = 0

that allows to compute the complete flow field (the pressure being computed by Bernouilli).

Differently, in a boundary element formulation you solve only for the flow over the geometry along which you introduce vortices, sources and sink (singular solution)
FMDenaro is offline   Reply With Quote

Old   January 13, 2017, 15:46
Default
  #3
New Member
 
Join Date: Jan 2017
Posts: 3
Rep Power: 9
7he404guy is on a distinguished road
What I basically want to do is solve for velocity in an arbitrarily shaped geometry defined by a grid (for my first test case, a 3x3 grid, but expanding that to a 64x64 grid with arbitrarily shaped boundaries defined within) with a "source" (either an inlet or a potential flow source) and a "sink" (either an outlet or a potential flow sink).

For example: If I define a rectangular "obstacle" within my grid, I need to solve the flow around that rectangular obstacle and determine the velocity at each node in my grid.

Would the potential function work if I have an arbitrarily-defined obstacle in the middle of my grid?

My test 3x3 grid case is going to be done on paper, then I'm going to model a program to do other problems.
7he404guy is offline   Reply With Quote

Old   January 13, 2017, 16:05
Default
  #4
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
yes, you can use the stream-function for multi-connected geometry
FMDenaro is offline   Reply With Quote

Old   January 13, 2017, 16:57
Default
  #5
New Member
 
Join Date: Jan 2017
Posts: 3
Rep Power: 9
7he404guy is on a distinguished road
Could you please direct me towards some reading material that would cover designing boundaries/obstacles in potential flow? The best I can think of with the material I've been able to find is just marking which cells in my grid contain an obstacle and placing a source for each of the faces to make the normal component of velocity at the face zero.
7he404guy is offline   Reply With Quote

Old   January 13, 2017, 17:04
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by 7he404guy View Post
Could you please direct me towards some reading material that would cover designing boundaries/obstacles in potential flow? The best I can think of with the material I've been able to find is just marking which cells in my grid contain an obstacle and placing a source for each of the faces to make the normal component of velocity at the face zero.

Immagine a rectangular obstacle in a channel. If it is located at the centre, due to the symmetry of the solution for an inviscid flow, you can set the constant value of the psi over the obstacle that is equal to the value Psi_wall_up/2 (given the arbitrary value Psi_wall_down=0). Then solve the Laplace equation for the flow nodes.
FMDenaro is offline   Reply With Quote

Reply

Tags
equations, incompressible flow, inviscid flow, steady flow


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
test cases for 1D inviscid incompressible flow LUQILIN Main CFD Forum 11 May 27, 2016 08:54
Drag in inviscid flow jinny Main CFD Forum 6 June 2, 2014 00:59
Solving for two phase, incompressible, inviscid flow (OpenFOAM) Betsy OpenFOAM Running, Solving & CFD 6 July 16, 2012 06:58
internal steady incompressible inviscid fluid flow Nina Shokina Main CFD Forum 0 October 21, 2003 07:11
Inviscid Drag at subsonic, subcritical Mach # Axel Rohde Main CFD Forum 1 November 19, 2001 13:19


All times are GMT -4. The time now is 02:48.