CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   CFD toolkit or from scratch? (https://www.cfd-online.com/Forums/main/102956-cfd-toolkit-scratch.html)

serviet June 7, 2012 04:53

CFD toolkit or from scratch?
 
Hello everyone,

i have to start writting a new cfd code and i really wonder what is the drawback of CFD toolkits (openfoam or freefem) again rewritting everything for a really specific use case?
As i can tell, by beginning from scratch, you're able to choose between all numerical schemes and technical stuff (parallel, kinds of meshes...) you want depending on your needs between precision and performance. But regarding the poor programming skills of physicists in front of the custom solution designed by the opensource community...
Someone can make a good case for it?

Thx for your answers.

cfdnewbie June 7, 2012 12:01

It all depends on what you are trying to to. If you are interested in solving a flow problem for an established code exists, then go ahead and use that. Writing a CFD code that runs in parallel efficiently and solves complicated physics is very time consuming.

However, if there's no code out there that does what you need or if you are interested in actual code development, then, by all means, go and write your own code.... you will learn a lot and have fun doing it, but it will take some of your time.

JBeilke June 7, 2012 13:27

It depends on what you want to do with the code later.

Search the web for "gpl commercial use".

andreasp June 12, 2012 14:39

I would always recommend to go at least with an existing framework, if you really want to produce a code usable on realistic applications.

Even if there is no software out there which can solve your specific problem out of the box, I believe it is much more efficient to extend some given "back bone" code rather than starting your own project from scratch. Just think of such basic challenges like mesh handling, memory management, etc. before you can actually start programming your *equations* -- the heart of your code. There are many open source frameworks available which readily provide this infrastructure (e.g. DUNE, OF). It might be cumbersome to understand their structure/philosophy, but I think in the end it pays off.

However, I also agree with the previous answers: If you want to gain knowledge in mathematics, numerical methods and/or basic FV/FEM code development (preferably with only a 1D or 2D code), then go for it! :)

Fenris9469 June 12, 2012 20:56

I have been writing my own FEM code for several years. I have to say while there will be many stumbling blocks you will learn a lot from the experience. that being said it is by no means a quick process (Assuming you are trying to go for a general purpose do lots of neat stuff bells and whistles) even with good programming skills. I would counsel you to ask what your goals are for the code? if you are looking for the knowledge of how it works and are one of those people who needs to reinvent the wheel before you accept something else, I say go for it. I would start simple work in 1-D and then 2-D then 3-D. Bear in mind each method has pros and cons and once you commit and are deep into one method you probably won't want to turn back and are stuck with the required work around of that method (of which there are many for all methods).

Hope this Helps,

Seth

serviet June 13, 2012 06:48

Thank you all,

I've already wrote several codes (FEM,FV, spectral and in fortran,c++...) so i begin to be familiar with the different numerical schemes :) The problem is indeed more about software engeneering : as andreasp and fenris said, I don't need to reinvent the wheel especially for technical improvments like multigrid mesh handling or parralel computing. OS solution exists and are maintained by community. I don't know DUNE or OF, but as far as i saw openFOAM let you choose between a lot of solution for numerical schemes, boundary conditions or linear solver. However, I don't really know about the future of my code and so, maybe will it be sold one day :)
No joke, what's the best OS framework on your mind to deal with CFD?

Fenris9469 June 13, 2012 08:12

That depends on the goal of the code. If you want it to be general purpose and you want to sell it. Then it needs to be stable on all platforms. Not to mention as easy to use as possible.

SergeAS June 13, 2012 09:03

I think when you write your own CFD/FEM code, the most valuable is not the code itself but the experience that you get. It costs more than any code.

cfdnewbie June 13, 2012 17:30

Quote:

Originally Posted by Fenris9469 (Post 366228)
That depends on the goal of the code. If you want it to be general purpose and you want to sell it. Then it needs to be stable on all platforms. Not to mention as easy to use as possible.

as well as very stable in terms of sensitivity to input parameters by the user.... you don't want your hotline to be flooded by complaints that the code blows up all the time... but you pay for stability the price of accuracy...

serviet June 13, 2012 20:16

:) don't worry, sadly I really don't think it has any chance to be sold... This is just for analyse purposes, so I wonder if it could be of great utility to let us easily switch between different numerical solutions with the help of kind-of factory-classes by exemple...
If I don't really need to gain more knowledge, but if I prefer an easily maintable code, which use well structured and optimized code for simple operations (3D derivatives) or whatever...? Which are the other good points beginning from scratch??
Thanks again !


All times are GMT -4. The time now is 15:23.