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

From 2D compressible code to 3D code

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 22, 2005, 00:00
Default From 2D compressible code to 3D code
  #1
David Liu
Guest
 
Posts: n/a
I just join one research group in a university as a postdoctoral fellow.

My new supervisor gave me a 2D aerodynamics CFD code for compressible NS equations with subsonic,transonic, and supersonic flows (Catesian coordinates). This code uses the high orderTVD and other time marching schemes.

My task is (1)Based on this code, develop a 3D code for the same flows. Using the developed code, compute some benchmark problem, and validate the developed code. Before, I never touch this code which was write by someone.

Can anybody comment me how long this First task will take?

(2) Then, Parallelize the developed 3D code with Domain Decomposition method for multi-processor computing with the MPI software. The simulation results should be same as the original serial code. Now, I have soome knowledge of PVM and do not know MPI.

Can anybody comment me how long this Second task will take?

Thanks a lot in advance,

David
  Reply With Quote

Old   May 22, 2005, 11:58
Default Re: From 2D compressible code to 3D code
  #2
noName
Guest
 
Posts: n/a
I have been able to learn (from scratch) and (successfully) use MPI in about one month. For a post-doc like you, I am assuming you have some programming experience, it should not be hard at all.
  Reply With Quote

Old   May 22, 2005, 11:59
Default Re: From 2D compressible code to 3D code
  #3
Larry Clark
Guest
 
Posts: n/a
Give yuourself at least three months to get familiar with the code before you write a single line(unless it is a trivial cartesian code which won't solve practical problems anyway). If it is cleanly written you might have a chance to extend it to 3D; but my guess is it will take nearly as much time to extend the code as to just write one from scratch. I have tried to fix old spagetti codes many times and have been greatly frustrated with the task every time. Programs are very personal and reflect the personality and experience of the writer. Best of luck to you in this effort.
  Reply With Quote

Old   May 22, 2005, 14:30
Default Re: From 2D compressible code to 3D code
  #4
scicomex
Guest
 
Posts: n/a
I agree with Larry. Unless the code is extremely well documented and well designed (clear software arquitecture), I would advice you to start a new code from scratch and just use the old one as a reference.
  Reply With Quote

Old   May 23, 2005, 03:28
Default Re: From 2D compressible code to 3D code
  #5
dalton
Guest
 
Posts: n/a
If your supervisor can help you a little bit, it is worth to do it. Otherwise, you will spend much effort. In the university, some supervisors usually only want to get some cheap labours to do much work for themselves. They are really selfish.
  Reply With Quote

Old   May 23, 2005, 08:29
Default Re: From 2D compressible code to 3D code
  #6
David Liu
Guest
 
Posts: n/a
Thank you for your and all the frinds'response. Yes, you are true. The boss need urgently the results and report.

I have to write a time schedule as requested by the boss. I faces much pressure.

One colleages said that develop a 3D code and computing 2-3 problems will lead to a PhD thesis if you make some renovations. He assesses that if both the developed 3D code and the parallized 3D code work well, it needs at leat two years.

I am not sure.

Welcome friends further comments.

Thanks again.
  Reply With Quote

Old   May 23, 2005, 09:52
Default Re: From 2D compressible code to 3D code
  #7
Larry Clark
Guest
 
Posts: n/a
David, I think it will take at least 2 years; if you are very smart and very lucky. It is the endless details of writing a 3D code that just wear you down. contrary to the belief (by people who have never written a 3D program) that 3D is just a simple extension of a 2D code, this is simply not true. The 3D is much more difficult. It is not the algorithm itself that is the proplem it is all the details of boundary conditions and how to handle the edges and corners, etc, etc, etc; especially if you are writing a multi-block code. It took me 18 months to write such a program and then another 5 years to, I think, capture all the little errors, a type here and a typo there. Be sure to develop a very clear pattern for everything to make error spotting as easy as possible.
  Reply With Quote

Old   May 23, 2005, 09:52
Default Re: From 2D compressible code to 3D code
  #8
Nick
Guest
 
Posts: n/a
Hi! It took me about a year to modify a code from 2d to 3d (it was SIMPLE-like algorithm with turbulence model) and verify it, and 2 month to write a fully operational 3D LES for incompressible fluid with verifications (still on the way).Those were made in Visual CPP for PC platform. Unfortunately i don't have parallel computing experience.
  Reply With Quote

Old   May 23, 2005, 13:37
Default Re: From 2D compressible code to 3D code
  #9
CFD Student
Guest
 
Posts: n/a
For me, It took 3 months to cover the given 2D Euler code (density based, finite volume, central averaging). 1 month to modify and validate for lanimar flows. 1 month to add and validate Baldwin-Lomax model. 5 weeks to implement low mach number preconditioning. 1,5 months to add Spalart Allmaras turbulence model...

Be sure that your supervisor has a background in CFD-programming. Otherwise, you might have problems to express how it is time-consuming to modify and validate a given code. Good luck...
  Reply With Quote

Old   May 23, 2005, 21:44
Default Re: From 2D compressible code to 3D code
  #10
David Liu
Guest
 
Posts: n/a
Thanks Larry for indroduce your experience. David
  Reply With Quote

Old   May 23, 2005, 22:34
Default Re: From 2D compressible code to 3D code
  #11
David Liu
Guest
 
Posts: n/a
Hi,Friend! Thank you and Nick for the helpful information. Any related information for the experience in this field will help me to make a correct judgement.

Regards David
  Reply With Quote

Old   May 24, 2005, 03:14
Default Re: From 2D compressible code to 3D code
  #12
zxaar
Guest
 
Posts: n/a
i do have a three-d compressible code, that can work with unstructured grids, but since the code is developed by students like you for their phd the code could be understood as property of that univ. this means that if i wish to show you the code, you can just try to understand that and try to write your own code based on that, you can not use that for calculations, though the code is not documented, (even i am not able to understand that , and i almost never tried to do so also), it will be difficult to understand it, (biggest prob is the person who wrote that died in an accedent, so we can't ask anybody).

but i guess this will be better than nothing, so why domp you drop me an email. i will try to send you the code.
  Reply With Quote

Old   May 24, 2005, 11:48
Default Re: From 2D compressible code to 3D code
  #13
Salvador
Guest
 
Posts: n/a
Personal experience

Code 1 (phd) from scratch, not much exprience

1D 2-3 months 2D 4 months 2D parallel 2-3 months 3D 5-6 months 3D parallel 2 months keep finding anoying mistakes

Code 2

Implementing a model (different set equations) in a existing 3D code 6-8 months Parallelize it 3-4 months

Obviosuly as you get experienc you work faster, re-use code (handy parallel subroutines). If yu are lucky and the code is well written (and works !!!, be sure of that) you can reduce the time considerely.

  Reply With Quote

Old   May 25, 2005, 06:17
Default Re: From 2D compressible code to 3D code
  #14
David Liu
Guest
 
Posts: n/a
Thanks for your comments. I understand that your comment is for a simple compressible flow solver with the TVD or other schemes.

In my case, after the general 3D code is implemented, I am asked to put more complicated models (e.g. combustion and chemical reachtion models, etc.).

Regards,

David
  Reply With Quote

Old   May 26, 2005, 19:55
Default Re: From 2D compressible code to 3D code
  #15
Hubert Janocha
Guest
 
Posts: n/a
All the others here are very right. My opinion is that you can do this job (try to get as much time as possible) when you are a numeric and a programmer maniac. I mean you can do this if you really realy realy want it. Otherwise, if you are in doubt, let it be. You will become very sad, and you looses much time oppertunities and nerves.

My diploma theses was to write a complete new 3d data-structure to implement it in an existing code. The new features were: complete matrix solver FAS-Multigrid with ADI and STONE, unstructured but hex cells, parallel with MPICH, adaptiv local refinements, tree structured cell organization. That took 8 month of my life, and that was only simple numeric (except multigrid). After this I tried to expand a 2-D multigrid (structured) code from Miroslav Peric to 3D, just for fun, to implement his ideas in my code. I had to give up, because there are so many do loops with if-commands, ... . At first I tried to made a detailed discribtion of the 2d code. Olthough I knew the numeric structures (and you have to know this) of e.g. multigrid and SIMPLE and turbulence modell and so on, it was to hard for me, and my spare time was to short. If you don't know the structure how to programm the numeric models (do-loops, if ... ), you never would have a chance to do this job. Take a look at the code and try to find out hwo things happen in this code. When you are not able to do this, you will have no chance to correct your own programming errors.

So my advice: look at the features of this 2d code and write a new one in 3d (well documented of course), and implement this features and ideas in your own code.
  Reply With Quote

Old   May 26, 2005, 23:40
Default Re: From 2D compressible code to 3D code
  #16
David Liu
Guest
 
Posts: n/a
Thanks for your comments and advices with yourself experience. Yes, it is difficult to read the code written by others since each person has differnt thread to implement his/her idea. From last year, My another colleague (postdoc) has spent half year to study this existing 2D code and reproduce the results (this person is requested to do 2D studies only with this code). I assess that I have to take at least 2-3 months to be familiar with the code, and understand every line. Then, I can begin to develop the 3D code.

So According to my owen experience for writing code of incompressible flow and the comments from the CFD friends like you and those in above discussions, It will need at least one year to develop this code. Firstly, It will need half year to develop a 3D Euler code. Of course, this code will be expected to be further tested and improved if I have time. Then, It will need at least another half year to implement the complex models.

After one year, this 3D code would be finished and would work for some benchmark problem. But I can not be sure that this code can work for general problems. It will need more time to be completeness, i.e., at least two years according to Larry Clark's comments who should be an experienced programmer.

If I want to implement in MPI, I have to spent more time for it. According to comments from Salvador, Implement 2D MPI needs 3 months, implement 3D MPI at least another two months. Directly implement 3D MPI may need at least 4-5 months.

  Reply With Quote

Old   May 27, 2005, 00:12
Default Re: From 2D compressible code to 3D code
  #17
zxaar
Guest
 
Posts: n/a
i completely agree with what you said, and writing a code has more to it, the biggest problem is how to find exactly how to do some particular thing, for example imagine i have to write bicgstab solver, i need to write preconditioner ILU, now the prob is in the books or papers you will read about bicgstab, they will mention the algorithm but all they assume that you will calculate ILU and no where the algo for ILU is mentioned. so in nutshell you can't do it. linking to same thing is this aspect that when you read a book, for the writer there are lot of things which may be just basic or trivial and hence he assumes reader will know this much, but for reader (who just started) its not enough and usually confuses more than what it teaches. for example i want to implement multigrids, eventhough i can make data structure for multigrid (both FAS and AMG), till i do not know exactly how things will go on step by step i can't really write the code, its after two months of search i could find a thesis that explains properly what was going on, i think now very soon the multigrid portion of my code will be over.

and i agree that writing a fully working code takes lot of planning, for one month i just din't write a single line of code, i kept planning it for future features, its because of planning i could finsh the basic solver (with out multigrid) in four months (not more that 2 hours in a day, since i work on my code after my job hours, if i get time).

  Reply With Quote

Old   May 27, 2005, 00:16
Default Re: From 2D compressible code to 3D code
  #18
zxaar
Guest
 
Posts: n/a
one thing i would say, if you get chance please have a look at this book:

Riemann solvers and numerical methods for fluid dynamics

-E F Toro

i think if you spend time with this book for first few months the code writing will be very easy, i have this book on my desk and haven't got time to read it, but by looking at the book , i can say its good book to build base on writing compressible type solvers.
  Reply With Quote

Old   May 27, 2005, 00:26
Default Re: From 2D compressible code to 3D code
  #19
David Liu
Guest
 
Posts: n/a
Thanks for your kind comment and information. I will try to find this book. Before, I have experience of code for incompressible flow with pressure correction method (elliptic equation solution), and have no experience for comressible flow and shock wave capture (hyperbolic equation solution).

David
  Reply With Quote

Old   June 17, 2005, 00:38
Default I need 3d Euler solver for supersonic
  #20
Sivamurugan
Guest
 
Posts: n/a
Hai, I am doing Ph.D in IIT, Madras, if you give 3D Euler solver for Supersonic flow, it can be useful for my PH.D

my E-mail: tsivamurugan@yahoo.com
  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
What is the Better Way to Do CFD? John C. Chien Main CFD Forum 54 April 23, 2001 08:10
compressible code Linda Main CFD Forum 2 September 22, 2000 22:10
Compressible vs. Incompressible formulations Fernando Velasco Hurtado Main CFD Forum 3 January 7, 2000 17:51
Compressible Viscous Code vaidation test cases? Mohammad Kermani Main CFD Forum 2 November 11, 1999 15:22
State of the art in CFD technology Juan Carlos GARCIA SALAS Main CFD Forum 39 November 1, 1999 15:34


All times are GMT -4. The time now is 21:49.