mech7220-numerical-mmcode

mech7220-numerical-mmcode -...

Info iconThis preview shows pages 1–3. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx starting length X s y x inflow outflow surface length L = 1 H i ,0 i ,1 i , N y Figure 1: External boundary layer control volume. 4 Mathematica Code for streamfunctionvorticity CFD Listed below is a Mathematica code which implements the solution procedure for the flat plate, external boundary layer problem. The domain consists of a rectangular region show in Fig. ( 1 ). The mathematical formulation of the boundary conditions for this flow configuration was discussed in the previous set of notes. The objective here is to show how it is coded into Mathematica . The code consists of the following basic modules (or elements): A module to numerically solve for stream function values, as a function of the vorticity values and the stream function boundary conditions. The system of equations that are solved have the form i +1 ,j + i- 1 ,j- 2 i,j ( x ) 2 + i,j +1 + i,j- 1- 2 i,j ( y ) 2 =- i,j (1) A module to explicitly calculate the values of either i,j or T i,j at the k time step from the flow information at the k- 1 time step. This procedure utilizes the explicit time integration, upwind differencing scheme. Associated modules and functions to interpolate the numerical results, compute derivatives of results, produce plots, and so on. The code is presented as follows The first lines set up global definitions and define assorted utility functions. Remove["Global*"] Off[General::"spell1",General::"spell"] sp[x_]:=Simplify[PowerExpand[x]] $TextStyle={FontFamily->"Times",FontSize->16}; zeroprint[n_]:=Module[{s},s="";Do[s=s<>"0",{i,1,n}];s]; index[l_]:=Which[l<10,"00",l<100,"0",1==1,""]<>ToString[l]; 1 printtodigits[x_,nd_]:=Module[{t,lt,ndot,ndrop,t2,nzero,t3}, t=ToString[x]; lt=SyntaxLength[t]; ndot=StringPosition[t,"."][[1,1]]; ndrop=Max[0,lt-ndot-nd]; t2=StringDrop[t,-ndrop]; nzero=Max[0,nd+ndot-lt]; t3=t2<>zeroprint[nzero]; t3] The system consists of a rectangular region, with length 1+ X s , where X s is the starting region, and a height of H . The number of interior control volumes in the x and...
View Full Document

This note was uploaded on 09/24/2011 for the course MECH 7220 taught by Professor Staff during the Fall '10 term at Auburn University.

Page1 / 6

mech7220-numerical-mmcode -...

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

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