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

problem in coding FEM for 2D incompressible flow with triangle elemets

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 24, 2014, 14:48
Exclamation problem in coding FEM for 2D incompressible flow with triangle elemets
  #1
New Member
 
Mahdi Salami
Join Date: Feb 2014
Posts: 6
Rep Power: 8
msalamih is on a distinguished road
Dear all
I have written a FEM code for 2D incompressible flow, but I have encountered a problem. In my code every thing seems OK but the results are dreadful. I check everything (almost) and find nothing. I'm attaching all the functions I wrote. Please check them and let me know if there is problem or bug. It turns out to be my nightmare....

Bests
Mahdi

PS: just run main.m and see the results. You can check the results in TECPLOT but reading data file (fem.dat)
Attached Files
File Type: zip FEM_triangleal.zip (9.2 KB, 18 views)

Last edited by wyldckat; May 24, 2014 at 15:07. Reason: accidental double post
msalamih is offline   Reply With Quote

Old   May 25, 2014, 12:37
Default
  #2
Senior Member
 
Jonas T. Holdeman, Jr.
Join Date: Mar 2009
Location: Knoxville, Tennessee
Posts: 126
Rep Power: 14
Jonas Holdeman is on a distinguished road
It would help if you described your application and method here.
Jonas Holdeman is offline   Reply With Quote

Old   May 25, 2014, 14:24
Default
  #3
New Member
 
Mahdi Salami
Join Date: Feb 2014
Posts: 6
Rep Power: 8
msalamih is on a distinguished road
Hi Jonas,

I used the method described in "nonlinear finite element analysis" by N.J. Reddy and it is a mixed method. I used linear triangle element for Ux and Uy and constant function for pressure (Np = 1). I'm writing this for lid driven problem to extend it for viscoelastic flow. The program is made up of five files, one main and four functions. read_data.m is reading the mesh information from node.txt, elements.txt and boundary conditions. KFlocal.m integrate local K and F using Gauss-quadrature rule. KFcalc.m calculate Kij and Fi for each integration point. I tried to write the routines as simple as possible so anyone could follow the code. If there is any question about the code... the problem is that when I try to solve the final equation set, [K]{U}={F}), MATLAB tells that [K] in badly scales or singular...
msalamih is offline   Reply With Quote

Old   May 26, 2014, 17:22
Default
  #4
New Member
 
Mahdi Salami
Join Date: Feb 2014
Posts: 6
Rep Power: 8
msalamih is on a distinguished road
Do anybody have any idea about this problem?
msalamih is offline   Reply With Quote

Old   May 26, 2014, 21:19
Default
  #5
Member
 
Join Date: Jul 2013
Posts: 53
Rep Power: 9
Alex C. is on a distinguished road
I will not debug your code, and from the information you gave, it can be various things, and no one will be able to tell you exactly what is wrong.

Here's a few idea :

- Is you're mesh connectivity correct?
- Are every boundary conditions properly defined?
- Do you use a sufficient number of integration points?
- Are the element matrix (K) and vector (F) ok?
- Is the global assembly properly done?
Alex C. is offline   Reply With Quote

Reply

Tags
fem, incompressible flow, matlab

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex problem: Open Channel Flow lett FLUENT 18 November 10, 2018 19:30
transient, impregnating flow problem fgommer FLUENT 0 February 29, 2012 17:10
High Reynolds Number Incompressible Flow Nick Lavery Main CFD Forum 3 February 19, 2002 16:47
fluid flow fundas ram Main CFD Forum 5 June 17, 2000 22:31
How good is CFD? kai Main CFD Forum 39 April 7, 2000 13:48


All times are GMT -4. The time now is 10:46.