Numerical_Potential_Flow.nb

Numerical_Potential_Flow.nb - Numerical Solution of Plane...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Numerical Solution of Plane Irrotational Flow APPH 4200 Physics of Fluids Columbia University Solve Laplace's equation for the streamfunction, y [ x,y ], for two relatively simple examples. Since Mathematica can solve thousands of simultaneous equations quickly, the only challenge to this problem is defining the computational grid and the boundary conditions on the flow. Two dimensional solutions to elliptical PDE's can be easily and accurately solved using today's computers. Define Laplace's Equation on a Grid In[1]:= Off @ General:: spell1 D ; Define Laplace's Equation… In[2]:= eqn @ i _ , j _ D : = H y @ i + 1, j D- 2 y @ i, j D + y @ i- 1, j DL ê d x^2 + H y @ i, j + 1 D- 2 y @ i, j D + y @ i, j- 1 DL ê d y^2 ã In[3]:= eqn @ i, j D Out[3]= y @ i,- 1 + j D- 2 y @ i, j D + y @ i, 1 + j D d y 2 + y @- 1 + i, j D- 2 y @ i, j D + y @ 1 + i, j D d x 2 ã Define a Grid In[4]:= height = 1.0 H * meter * L ; length = 5.0 H * meter * L ; wallHeight = 0.5 H * meter * L ; wallLength = 0.5 H * meter * L ; Grid points go from 1 to numX and from 1 to numY . In[8]:= numX = 80; numY = 60; Print @ "Number of Grid Points = " , numX numY D ; Number of Grid Points = 4800 In[11]:= dx = length ê H numX- 1 L ; dy = height ê H numY- 1 L ; In[13]:= wallLength ê dx Out[13]= 7.9 In[14]:= wallHeight ê dy Out[14]= 29.5 In[15]:= flow = 5.0 H * m ê s * L ; In[16]:= grid = Table @ If @ length ê 2- wallLength ê 2 § H ix- 1 L dx § length ê 2 + wallLength ê 2 && H iy- 1 L dy § wallHeight »» ix ã 1 »» ix == numX »» iy ã 1 »» iy == numY, 1, 0 D , 8 ix, 1, numX < , 8 iy, 1, numY <D ; In[17]:= Dimensions @ grid D Out[17]= 8 80, 60 < In[18]:= Count @ Flatten @ grid D , x _ ê ; x ã 1 D H * number of known grid values * L Out[18]= 508 In[19]:= Count @ Flatten @ grid D , x _ ê ; x ã D H * number of unknown grid values * L Out[19]= 4292 In[20]:= Length @ Flatten @ grid DD Out[20]= 4800 2 Numerical_Potential_Flow.nb In[21]:= ArrayPlot @ Transpose @ grid D , Mesh Ø True D Out[21]= In[22]:= wallBound @ ix _ D : = If @ length ê 2- wallLength ê 2 § H ix- 1 L dx § length ê 2 + wallLength ê 2 , Floor @ wallHeight ê dy D + 1, 1 D Numerical_Potential_Flow.nb 3 In[23]:= ListPlot B Table B wallBound @ ix D , : ix, Floor B numX 4 F , Floor B 3 numX 4 F>F , Frame Ø True, PlotStyle Ø PointSize @ 0.02` D , Axes Ø False, FrameLabel Ø 8 "x" , "h" , "Wall Boundary Index" , "" <F Out[23]= 10 20 30 40 5 10 15 20 25 30 x h Wall Boundary Index Define Boundary Conditions In[24]:=...
View Full Document

This document was uploaded on 10/18/2011.

Page1 / 22

Numerical_Potential_Flow.nb - Numerical Solution of Plane...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online