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

Finite Difference in MATLAB Help

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 28, 2010, 03:32
Question Finite Difference in MATLAB Help
  #1
New Member
 
Abe
Join Date: May 2010
Posts: 4
Rep Power: 16
abe_cooldude is on a distinguished road
Hi all,

I am working on a class project, which requires me to model blasius equation and pohlhausen eqaution (I posted regarding this a while back). I am finally getting back to it again. So for the blasius equation, I got it to work with the shooting method, and now working on the pohlhausen equation with finite difference and need help with it. To be honest, I took numerical methods 5-6 years ago, and vaguely remember it. I have looked online, and none help in matlab programming. I know I have to use for loop, but lost. Also, I don't know how would I implement the infinity boundary condition. Here's the POL eq:

dT/(dETA)^2+(Pr/2)f(dt/dETA)=0 with B.C. T(0) = 0, T(inf) = 1

Here's my finite difference form:

(T(i-1)-2T(i)+T(i+1))/(deltaETA)^2 + (Pr/2)(f)(T(i+1)-T(i-1))/(2*deltaETA) = 0

Then I collected the like terms:

T(i-1)[(1/(deltaETA)^2 - (Pr/2)(f)(1/(2*deltaETA))] + T(i)[-2] + T(i+1)[(1/(deltaETA)^2 - (Pr/4)(f)(1/(4*deltaETA))] = 0

Now, I have no idea to implement this into MATLAB

In the above equation, f is obtained from the Blasius solution, and here's my code for it.

clc
clear all

ti = 0.0;
tf = 8.0;
tintval = [ti tf]
delta = 0.1;

guess1 = 0.0;
guess2 = 0.0;
guess3 = 0.33206;

bcinit = [guess1 guess2 guess3];

[ETA,f]=ode45('BlasiusFunc',tintval,bcinit);
[ETA,f]

plot(ETA,f(:,2),'-k')
grid on

xlabel('ETA')
ylabel('Dimensionless velocity - u/U_i_n_f')
title('Blasius Equation - Laminar Flow Over A Flat Plate')

ETAFIT = [0:delta:8];
fFIT = interp1(ETA,f,ETAFIT,'spline'); % display in regular interval

[ETAFIT,fFIT]

CODE END

At the end of the code, I am using the interp1 function to make the [ETA f] at regular interval so use it in POL equation, but I end up getting this error:

??? Error using ==> horzcat
CAT arguments dimensions are not consistent.

Error in ==>Blasius at 39
[ETAFIT,fFIT]

I think it has to do something with the size of the matrix because ETA has 1 column, while f has 3 columns.

Can someone please help?

Thank you
abe_cooldude is offline   Reply With Quote

Reply


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
solving finite journal bearing problem by finite difference Atit Koonsrisuk Main CFD Forum 6 March 29, 2015 09:09
Finite element vs. finite difference Francisco Saldarriaga Main CFD Forum 23 December 17, 2014 09:21
Fininte difference and Finite element Technique Mahendra Singh Mehra FLUENT 3 December 23, 2005 00:49
finite difference method for navier-stokes problem dallybird Main CFD Forum 5 February 17, 2003 23:00
Oldroyd-B model using Finite Difference Luciane Grossi Main CFD Forum 1 July 28, 2000 00:28


All times are GMT -4. The time now is 01:44.