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

Boundary condition in Spectral method

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 5, 2013, 15:18
Default Boundary condition in Spectral method
  #1
New Member
 
Join Date: Feb 2011
Posts: 23
Rep Power: 6
jollage is on a distinguished road
Hi All

I am playing with the boundary conditions in spectral method using Chebyshev grids.

Say, I want to solve the eigenfunction of \frac{\partial^2}{\partial x^2}. Analytically, the eigenfunction will be sin or cosine.

Indeed, in Matlab, the following small code will generate the eigenfunction with three different boundary conditions. I choose to plot from each boundary condition case an eigenfunction and attach here.

clear;
nrmod=357;

[y,DM]=chebdif(nrmod,4);

D2=DM(:,:,2);

% q is the eigenfunction.

% bc: q(-1)=0,q(1)=0
% [ef,ev]=eig(D2(2:end-1,2:end-1));

% bc: q(-1)=0,q(1)=1. Just change the last 1 to 2 for q(-1)=0,q(1)=2
% [ef,ev]=eig(D2(2:end-1,2:end-1)+diag(D2(2:end-1,1))*1);

% bc: q(-1)=1,q(1)=1
[ef,ev]=eig(D2(2:end-1,2:end-1)+diag(D2(2:end-1,1))*1+diag(D2(2:end-1,end))*1);

for i=nrmod-2:-1:1
plot(y(2:end-1),real(ef(:,i)),'-*b')
title([num2str(i) ' eigenvalue is ' num2str(ev(i,i))])
pause
end

My question is:

Does it make sense to require the eigenfunction to have boundary condition q(-1)=0,q(1)=2? I tried in Matlab, but strange things happens, it returns the results of q(-1)=0,q(1)=0. Why is this?

Thanks a lot in advance!

Jo
Attached Images
File Type: jpg bc01.jpg (80.5 KB, 4 views)
File Type: jpg bc00.jpg (70.3 KB, 2 views)
File Type: jpg nobc.jpg (65.7 KB, 2 views)
jollage is offline   Reply With Quote

Old   April 5, 2013, 16:58
Default
  #2
New Member
 
Join Date: Feb 2011
Posts: 23
Rep Power: 6
jollage is on a distinguished road
I am sorry.

I just realized that the way imposing the boundary condition as implemented here is not right. Could anyone tell me the right way?......Thanks.

Jo
jollage is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mixed inflow/outflow downstream boundary condition question peob OpenFOAM Running, Solving & CFD 2 August 14, 2014 09:07
domain imbalance for enrgy equation happy CFX 14 September 6, 2012 01:54
Mixed/Robin boundary condition aaev OpenFOAM Bugs 2 December 15, 2011 15:03
Immersed Boundary Ghost Cell Method thehexman Main CFD Forum 1 February 5, 2010 07:10
Airfoil boundary condition Frank Main CFD Forum 1 April 21, 2008 18:36


All times are GMT -4. The time now is 16:06.