
[Sponsors] 
May 22, 2005, 00:00 
From 2D compressible code to 3D code

#1 
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 multiprocessor 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 

May 22, 2005, 11:58 
Re: From 2D compressible code to 3D code

#2 
Guest
Posts: n/a

I have been able to learn (from scratch) and (successfully) use MPI in about one month. For a postdoc like you, I am assuming you have some programming experience, it should not be hard at all.


May 22, 2005, 11:59 
Re: From 2D compressible code to 3D code

#3 
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.


May 22, 2005, 14:30 
Re: From 2D compressible code to 3D code

#4 
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.


May 23, 2005, 03:28 
Re: From 2D compressible code to 3D code

#5 
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.


May 23, 2005, 08:29 
Re: From 2D compressible code to 3D code

#6 
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 23 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. 

May 23, 2005, 09:52 
Re: From 2D compressible code to 3D code

#7 
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 multiblock 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.


May 23, 2005, 09:52 
Re: From 2D compressible code to 3D code

#8 
Guest
Posts: n/a

Hi! It took me about a year to modify a code from 2d to 3d (it was SIMPLElike 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.


May 23, 2005, 13:37 
Re: From 2D compressible code to 3D code

#9 
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 BaldwinLomax 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 CFDprogramming. Otherwise, you might have problems to express how it is timeconsuming to modify and validate a given code. Good luck... 

May 23, 2005, 21:44 
Re: From 2D compressible code to 3D code

#10 
Guest
Posts: n/a

Thanks Larry for indroduce your experience. David


May 23, 2005, 22:34 
Re: From 2D compressible code to 3D code

#11 
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 

May 24, 2005, 03:14 
Re: From 2D compressible code to 3D code

#12 
Guest
Posts: n/a

i do have a threed 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. 

May 24, 2005, 11:48 
Re: From 2D compressible code to 3D code

#13 
Guest
Posts: n/a

Personal experience
Code 1 (phd) from scratch, not much exprience 1D 23 months 2D 4 months 2D parallel 23 months 3D 56 months 3D parallel 2 months keep finding anoying mistakes Code 2 Implementing a model (different set equations) in a existing 3D code 68 months Parallelize it 34 months Obviosuly as you get experienc you work faster, reuse 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. 

May 25, 2005, 06:17 
Re: From 2D compressible code to 3D code

#14 
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 

May 26, 2005, 19:55 
Re: From 2D compressible code to 3D code

#15 
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 datastructure to implement it in an existing code. The new features were: complete matrix solver FASMultigrid 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 2D 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 ifcommands, ... . 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 (doloops, 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. 

May 26, 2005, 23:40 
Re: From 2D compressible code to 3D code

#16 
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 23 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 45 months. 

May 27, 2005, 00:12 
Re: From 2D compressible code to 3D code

#17 
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). 

May 27, 2005, 00:16 
Re: From 2D compressible code to 3D code

#18 
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. 

May 27, 2005, 00:26 
Re: From 2D compressible code to 3D code

#19 
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 

June 17, 2005, 00:38 
I need 3d Euler solver for supersonic

#20 
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 Email: tsivamurugan@yahoo.com 

Thread Tools  
Display Modes  


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 