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

CFD by anderson, chp 10.... supersonic flow over flat plate

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

Like Tree4Likes
  • 3 Post By Bajji
  • 1 Post By Bajji

Reply
 
LinkBack Thread Tools Display Modes
Old   March 25, 2010, 08:22
Thumbs down CFD by anderson, chp 10.... supersonic flow over flat plate
  #1
Member
 
varun
Join Date: Apr 2009
Posts: 35
Rep Power: 7
varunjain89 is on a distinguished road
hi all

i'm trying to write C code for supersonic flow over flat plate. i'm reffereing CFD by JD anderson chp 10. i have a few doubts hope u can help.

firstly when i'm calculating vector E at plate surface and vector F at inflow, what should be the values of txy, txx, tyy, qx and qy, should i consider. should i take all of them to be zero...???

and after prdictor step, when calculating txy, then in one of the terms we need to calculate central difference, so our expression is something like....
U(i+1,j)-U(i-1,j) but we dont have values for U(i+1,j) at time step t+dt, right...??? so am i suppose to use the values calculated at previous time step.... coz that is the only way... jz needed to confirm..

thanks once again

varun
varunjain89 is offline   Reply With Quote

Old   December 20, 2011, 05:30
Smile Full code
  #2
New Member
 
Balaji Sankar
Join Date: Nov 2011
Posts: 19
Rep Power: 5
Bajji is on a distinguished road
Hi,

Sorry for the late reply.

I am posting the full code in the attachment, in C. All functions are named as in Anderson. Takes 70 seconds. No input files. All parameters are defined in preprocessor part..

Has been verified using the temperature profile at the trailing edge. Hope this helps.

Enjoy.
Bajji is offline   Reply With Quote

Old   December 20, 2011, 05:33
Default
  #3
New Member
 
Balaji Sankar
Join Date: Nov 2011
Posts: 19
Rep Power: 5
Bajji is on a distinguished road
Ooops. Didn't upload.
Here should be the code.
Attached Files
File Type: c main.c (41.1 KB, 182 views)
Far, Mariusz and aerosjc like this.
Bajji is offline   Reply With Quote

Old   February 16, 2012, 11:39
Default
  #4
New Member
 
Join Date: Feb 2012
Posts: 11
Rep Power: 4
ivan_CFD is on a distinguished road
Thanks for the code
ivan_CFD is offline   Reply With Quote

Old   March 29, 2013, 09:26
Default
  #5
Senior Member
 
Cean
Join Date: Feb 2010
Posts: 126
Rep Power: 6
shirazbj is on a distinguished road
thanks for c code.
shirazbj is offline   Reply With Quote

Old   April 3, 2013, 09:39
Default
  #6
Senior Member
 
Cean
Join Date: Feb 2010
Posts: 126
Rep Power: 6
shirazbj is on a distinguished road
Quote:
Originally Posted by Bajji View Post
Ooops. Didn't upload.
Here should be the code.
there is one little error in the code, see attached pic.

The second Redx should be Redy.
Attached Images
File Type: png redy.PNG (6.4 KB, 61 views)
shirazbj is offline   Reply With Quote

Old   April 29, 2013, 01:20
Default Thank you
  #7
New Member
 
Balaji Sankar
Join Date: Nov 2011
Posts: 19
Rep Power: 5
Bajji is on a distinguished road
Hi Cean,
Thanks for pointing out the error! I don know how the plots came out fine after the mess up . Thanks again
Bajji is offline   Reply With Quote

Old   May 3, 2013, 04:49
Default
  #8
New Member
 
Thanh
Join Date: May 2013
Posts: 1
Rep Power: 0
tienthanh_bk2901 is on a distinguished road
thank you so much
tienthanh_bk2901 is offline   Reply With Quote

Old   August 14, 2013, 13:37
Default would you please send me a copy?
  #9
New Member
 
soroosh alahdin
Join Date: Aug 2013
Posts: 3
Rep Power: 3
soroosh.alahdin@gmail.com is on a distinguished road
my email address is my username, if you decided to help, ofcourse.
soroosh.alahdin@gmail.com is offline   Reply With Quote

Old   August 14, 2013, 17:34
Default
  #10
Member
 
sud
Join Date: May 2013
Posts: 64
Rep Power: 3
archeoptyrx is on a distinguished road
Quote:
Originally Posted by Bajji View Post
Ooops. Didn't upload.
Here should be the code.
Mr.Balaji ,

I tried compiling the code u gave without making any change in it .

I just gave me errors . if possible take a look at this

Code:
main.c: In function ‘main’:
main.c:145:13: warning: passing argument 4 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 5 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 6 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 7 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 8 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 9 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 10 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 11 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 12 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c: At top level:
main.c:443:6: warning: conflicting types for ‘verbose_mac’ [enabled by default]
main.c:140:13: note: previous implicit declaration of ‘verbose_mac’ was here
main.c:1175:6: warning: conflicting types for ‘u2fp’ [enabled by default]
main.c:318:5: note: previous implicit declaration of ‘u2fp’ was here
/tmp/ccbyCj1V.o: In function `mac':
main.c:(.text+0xbe8): undefined reference to `pow'
main.c:(.text+0xe9c): undefined reference to `sqrt'
main.c:(.text+0xf68): undefined reference to `sqrt'
/tmp/ccbyCj1V.o: In function `verbose_mac':
main.c:(.text+0x19d2): undefined reference to `pow'
main.c:(.text+0x1aca): undefined reference to `sqrt'
main.c:(.text+0x1b96): undefined reference to `sqrt'
/tmp/ccbyCj1V.o: In function `fp2u':
main.c:(.text+0x2b45): undefined reference to `pow'
main.c:(.text+0x2b86): undefined reference to `pow'
/tmp/ccbyCj1V.o: In function `fp2e':
main.c:(.text+0x2cc9): undefined reference to `pow'
main.c:(.text+0x2e9a): undefined reference to `pow'
main.c:(.text+0x2ee1): undefined reference to `pow'
/tmp/ccbyCj1V.o:main.c:(.text+0x31eb): more undefined references to `pow' follow
collect2: error: ld returned 1 exit status
sudharsan@ubuntu:~/Desktop$ gcc -lm main.c
main.c: In function ‘main’:
main.c:145:13: warning: passing argument 4 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 5 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 6 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 7 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 8 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 9 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 10 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 11 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c:145:13: warning: passing argument 12 of ‘mac’ from incompatible pointer type [enabled by default]
main.c:69:6: note: expected ‘float *’ but argument is of type ‘float (*)[70][70]’
main.c: At top level:
main.c:443:6: warning: conflicting types for ‘verbose_mac’ [enabled by default]
main.c:140:13: note: previous implicit declaration of ‘verbose_mac’ was here
main.c:1175:6: warning: conflicting types for ‘u2fp’ [enabled by default]
main.c:318:5: note: previous implicit declaration of ‘u2fp’ was here
/tmp/ccnpPswn.o: In function `mac':
main.c:(.text+0xbe8): undefined reference to `pow'
main.c:(.text+0xe9c): undefined reference to `sqrt'
main.c:(.text+0xf68): undefined reference to `sqrt'
/tmp/ccnpPswn.o: In function `verbose_mac':
main.c:(.text+0x19d2): undefined reference to `pow'
main.c:(.text+0x1aca): undefined reference to `sqrt'
main.c:(.text+0x1b96): undefined reference to `sqrt'
/tmp/ccnpPswn.o: In function `fp2u':
main.c:(.text+0x2b45): undefined reference to `pow'
main.c:(.text+0x2b86): undefined reference to `pow'
/tmp/ccnpPswn.o: In function `fp2e':
main.c:(.text+0x2cc9): undefined reference to `pow'
main.c:(.text+0x2e9a): undefined reference to `pow'
main.c:(.text+0x2ee1): undefined reference to `pow'
/tmp/ccnpPswn.o:main.c:(.text+0x31eb): more undefined references to `pow' follow
collect2: error: ld returned 1 exit status
archeoptyrx is offline   Reply With Quote

Old   August 15, 2013, 10:49
Wink math library?
  #11
New Member
 
Balaji Sankar
Join Date: Nov 2011
Posts: 19
Rep Power: 5
Bajji is on a distinguished road
Hi,

Please google on "Linking math library while compiling c++ codes" .

You basically add -lm option to your compile line so that the GCC can find power and absolute functions that are used in the code.

PS: I had the same error few years ago

Hope it helps
Bajji is offline   Reply With Quote

Old   August 15, 2013, 10:51
Smile Code is there!
  #12
New Member
 
Balaji Sankar
Join Date: Nov 2011
Posts: 19
Rep Power: 5
Bajji is on a distinguished road
Hi,

The code is already posted here! Just run the main.c.

Quote:
Originally Posted by Bajji View Post
Ooops. Didn't upload.
Here should be the code.
Bajji is offline   Reply With Quote

Old   August 21, 2013, 00:02
Smile
  #13
Member
 
sud
Join Date: May 2013
Posts: 64
Rep Power: 3
archeoptyrx is on a distinguished road
Quote:
Originally Posted by Bajji View Post
Hi,

Please google on "Linking math library while compiling c++ codes" .

You basically add -lm option to your compile line so that the GCC can find power and absolute functions that are used in the code.

PS: I had the same error few years ago

Hope it helps

IT worked Mr.Balaji . How do i obtain the plots ? . Do i need to use any other software to plot ? .

Thanks in advance
archeoptyrx is offline   Reply With Quote

Old   August 21, 2013, 00:37
Thumbs up Plotting the output
  #14
New Member
 
Balaji Sankar
Join Date: Nov 2011
Posts: 19
Rep Power: 5
Bajji is on a distinguished road
Hi ,

Glad it helped you. You can use gnuplot for plotting results. A very small script will let you automate the plotting wonderfully. Its highly recommended for 2D plots.

Quick way to get things done is to copy the pressure and temperature matrices into Matlab and do surface plots. This is how I did it long back.

enjoy!
archeoptyrx likes this.
Bajji is offline   Reply With Quote

Old   August 21, 2013, 00:44
Default
  #15
Member
 
sud
Join Date: May 2013
Posts: 64
Rep Power: 3
archeoptyrx is on a distinguished road
Quote:
Originally Posted by Bajji View Post
Hi ,

Glad it helped you. You can use gnuplot for plotting results. A very small script will let you automate the plotting wonderfully. Its highly recommended for 2D plots.

Quick way to get things done is to copy the pressure and temperature matrices into Matlab and do surface plots. This is how I did it long back.

enjoy!

Thank you Mr.Balaji .

I got the u_profile via gnuplot . I myself tried writing the entire thing in matlab . it did gave me results after 15000 iterations . But the results are slightly over predicted . Can you help me with this ? I am not a good programmer .
archeoptyrx is offline   Reply With Quote

Old   August 21, 2013, 03:47
Default
  #16
Senior Member
 
Cean
Join Date: Feb 2010
Posts: 126
Rep Power: 6
shirazbj is on a distinguished road
Quote:
Originally Posted by archeoptyrx View Post
IT worked Mr.Balaji . How do i obtain the plots ? . Do i need to use any other software to plot ? .

Thanks in advance
Hi, I made one exe file under win7@32. It outputs some plots while simulating. You can press D,T,P,V,R key to switch between Desity,Temperature,Presssure, Vector and residual plot. At the end, it also outputs GMSH's pos files. You could view it with GMSH.

You could download it from here:
https://sites.google.com/site/gmsh2s...edirects=0&d=1

Enjoy.
shirazbj 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
Code for the book Nishu Main CFD Forum 13 January 1, 2014 04:43
Supersonic flow over flat plate Nikhil Main CFD Forum 6 May 20, 2013 13:48
supersonic flow past flat plate shuo Main CFD Forum 0 July 28, 2007 20:47
entrance of a flat plate mc Main CFD Forum 0 April 24, 2007 23:38
tricky flat plate laminar flow sarat FLUENT 4 September 9, 2005 19:35


All times are GMT -4. The time now is 13:47.