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

Question about CFD software design

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 6, 2013, 06:52
Default Question about CFD software design
  #1
New Member
 
Oleg Zhyan
Join Date: Mar 2013
Posts: 4
Rep Power: 13
Zhyan is on a distinguished road
Hello everyone,

I am going to develop a software dedicated to perform calculations based on FVM. But before starting to write a programming code I have to think over the design of the future software. This is not an easy task, the design should be robust, extensible and etc.

Can you recommend some books, articles or manuals related to development of CFD programs? And what other open source projects should I look at?
Zhyan is offline   Reply With Quote

Old   March 6, 2013, 09:01
Default
  #2
Senior Member
 
andy
Join Date: May 2009
Posts: 308
Rep Power: 18
andy_ is on a distinguished road
Quote:
Originally Posted by Zhyan View Post
I am going to develop a software dedicated to perform calculations based on FVM. But before starting to write a programming code I have to think over the design of the future software. This is not an easy task, the design should be robust, extensible and etc.

Can you recommend some books, articles or manuals related to development of CFD programs? And what other open source projects should I look at?
You do not say for what purpose you are developing the CFD program. A research program and a commercial program will generally be different.

In my experience there is a major split between engineers and computer scientists when it comes to developing CFD programs. The engineers tend to understand the physics and details and the computer scientists do not which leads them to place value elsewhere on such things as management structure.

In a research environment organising the software as a libraries controlled by scripts works well. Of course this approach assumes the users are competent at programming and require the software to be flexible. For examples look to most large research organisations and the software coming out of such organisation which tends to have extensive scripting support.

In a production environment the needs are different. The software needs to change a lot less and the users are often weak at programming. The user interface requires a lot more effort and the CFD methods can often be quite simple.

There is nothing special about CFD program development and so any good book on software development should be fine. Open source projects are a different matter though and what causes them to fail (most) or succeed (a few) is not particularly clear at least to me. OpenFOAM is the most obvious CFD example and yet it does things that are clearly daft from a technical viewpoint if not necessarily from a business viewpoint.
andy_ is offline   Reply With Quote

Old   March 7, 2013, 02:31
Default
  #3
New Member
 
Oleg Zhyan
Join Date: Mar 2013
Posts: 4
Rep Power: 13
Zhyan is on a distinguished road
Andy, thank you for your reply.

I assume that it will be more a research program. But the program should be user friendly enough, because it will be used by students without much programing skills.

Libraries + controlling scripts is a good approach, but I have to reject it, because most of the time the program will run in parallel using MPI. Some scripting languages support MPI, however I am not sure if the cluster environment has required packages.

I think the program will be written in C++ and controlled by a configuration file. In the far future some GUI program for generation of this file might be written.

My difficulties concern the implementation of the computational side of the program: how to represent meshes and geometrical objects (points, edges, faces, volumes), how to implement support of the 1D, 2D and 3D geometries without much code repetition, how to efficiently implement vectors, how computational solvers should operate on different kinds of meshes and etc.
Zhyan is offline   Reply With Quote

Old   March 7, 2013, 08:00
Default
  #4
Senior Member
 
andy
Join Date: May 2009
Posts: 308
Rep Power: 18
andy_ is on a distinguished road
If your students cannot work with scripts it would seem rather odd to be exposing them to the practical side of CFD without using one of the main commercial CFD packages. Whatever its academic value, experience with the main commercial CFD packages is valuable to students when seeking a job. If you are genuinely integrating a commercial CFD package with your teaching (not research) then the suppliers can usually be persuaded to make the software available with limited support so long as you keep this fact confidential. Sometimes they want a nominal amount so that you have "bought" it. Unfortunately if other departments in the institution are/have paid academic prices for the particular software you will have problems obtaining the software without parting with substantial sums.

If you are at the level of teaching CFD methods rather than a short course on how to use CFD programs it would be unusual if the students cannot write scripts. Recently one of the course objectives was to make no use of matlab for both the simulation and experimental parts. This was to force the students to become more aware of the alternatives.

The comment about scripts and MPI seems odd. MPI is a library called by the routines in other libraries that perform the assembly, solving and such. Scripts run at the top controlling level not the lower levels. Writing the lower levels in scripting languages is unlikely to be wise for areas like CFD although it is increasingly popular in less computationally intensive areas.

C++ can be used to write projects that are flexible and useful but it requires a discipline that is not normally present in students who quite reasonably will want to learn and use everything. OpenFOAM is a typical example of what tends to happen. Qt in the first 10 years of its life is an example of a project that used C++ in more useful disciplined manner.

Programming languages themselves don't really matter much compared to making the top user/controlling level work well. Using C++ for a GUI component is often the only sensible choice because of the libraries to be used. Writing linear solver routines in C++ is rarely wise not only because of the aliasing issues but issues with working with other code. It tends to push everything towards C++ and to follow the particular way of doing things built on top of C++ that emerged as things grew.

CFD data is large in size but simple in organisation. Conversion from one specific format to another is normally a quick and simple task. There are exceptions like handling STEP geometry but I doubt that is on your current list of things to do.
andy_ is offline   Reply With Quote

Old   March 7, 2013, 18:52
Default
  #5
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 231
Rep Power: 18
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
Hi,

It is a very interesting project and discussion.

One of the aspect to consider early is the simulation workflows:
geometry/CAD -> Mesh -> Solver -> Post-processing

From your description, your project is focusing on the solver aspect. Are CAD/Mesh/Visualisation aspect of relevance to you? If so, what are you planning to use for geometry/CAD, mesh and post-processing? I think that it is important to consider these aspects early to avoid difficulties at a later stage.

Julien
__________________
---
Julien de Charentenay
julien.decharentenay is offline   Reply With Quote

Old   March 8, 2013, 06:44
Default
  #6
Senior Member
 
andy
Join Date: May 2009
Posts: 308
Rep Power: 18
andy_ is on a distinguished road
Quote:
Originally Posted by julien.decharentenay View Post
From your description, your project is focusing on the solver aspect. Are CAD/Mesh/Visualisation aspect of relevance to you? If so, what are you planning to use for geometry/CAD, mesh and post-processing? I think that it is important to consider these aspects early to avoid difficulties at a later stage.
Assuming the OP is focussing more on the academic side of CFD methodology and less on the practical side of using CFD software to simulate fluid flows (both valid things to be teaching but the latter is easier and better served with commercial CFD packages) then I found geometry/CAD to be not particularly important. The reason is that to teach effectively the students need to perform and compare a lot of simulations with parametric changes to grid density, grid orientation, bcs, Reynolds number, Mach number, solvers, differencing schemes, turbulence models, etc... and they need to do this on the PCs in the pool room during tutorials. This dictates the use of mainly 1D and 2D simulations because 3D simulations take too long to setup and turn round. The geometry and grid generation for 2D simulations is easy to setup via, for example, tagged lists of weighted control points for NURBS curves and it helps get across to the students how NURBS work.

Students typically need to get data out of the simulations to evaluate various integrated quantities, ffts, plot against experimental data,... and to include in reports. This tends to mean simple files of numbers for output works well if controlled by scripts for evaluating and plotting. Of course the knee jerk reaction of many students is to dump the numbers in spreadsheets and GUI endlessly.

Unless you wish to focus on teaching the practical side of things, getting a class of students to grind away at setting up and running a few 3D simulations in the way they would do in industry has little academic merit. Commercial codes already do this well and so investing a lot of time to create an inevitably poorer copy as a teaching code makes no sense. In my experience the commercial CFD codes can be a lot less effective at running lots of 2D simulations for teaching purposes. Recently I tried to use two of the main commercial codes to support aeroacoustics teaching based around a low Mach number experiment the students performed in the lab. One code produced acceptably accurate results but took roughly 100 times more CPU than expected making it unusable for tutorials. The other used the expected amount of CPU but produced inaccurate results in the typical manner of a high Mach number code run at modest Mach numbers. In this case either the approach to the course was changed or suitable teaching software was put together manually. In itself perhaps it is slightly unrepresentative example because accurate low Mach number simulation is difficult and with little industrial need but some sort of issue like this is quite common when trying to adapt commercial industrial CFD software for academic teaching purposes.

Last edited by andy_; March 8, 2013 at 07:20.
andy_ is offline   Reply With Quote

Old   March 8, 2013, 16:27
Default
  #7
New Member
 
Oleg Zhyan
Join Date: Mar 2013
Posts: 4
Rep Power: 13
Zhyan is on a distinguished road
Quote:
Originally Posted by andy_ View Post
If your students cannot work with scripts it would seem rather odd to be exposing them to the practical side of CFD without using one of the main commercial CFD packages.
Students will have to write scripts. But the structure of the package won't be scripts + libraries. I see it like scripts + main solver. A configuration file generated by scripts will be passed on the input of the solver.
Zhyan is offline   Reply With Quote

Old   March 8, 2013, 16:35
Default
  #8
New Member
 
Oleg Zhyan
Join Date: Mar 2013
Posts: 4
Rep Power: 13
Zhyan is on a distinguished road
Quote:
Originally Posted by julien.decharentenay View Post
From your description, your project is focusing on the solver aspect. Are CAD/Mesh/Visualisation aspect of relevance to you? If so, what are you planning to use for geometry/CAD, mesh and post-processing? I think that it is important to consider these aspects early to avoid difficulties at a later stage.
You are right, now I am more focused on the solver side of the package.

As for the other parts you mentioned, I plan to use simple Python scripts + GMSH package for the CAD/Mesh side of the package. Post-processing will be done again by Python scripts using numpy library. Having scripts converting output data to the VTK format one can use packages like ParaView for visualization. Also Matplotlib package seems to be very convenient for visualization of the 1D and 2D simulations.
Zhyan is offline   Reply With Quote

Reply


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
Please help me, I know nothing about CFD ben1793 Main CFD Forum 13 September 28, 2012 18:22
(Open-source) cfd software for design use pa-ma Main CFD Forum 0 January 31, 2010 13:36
ASME CFD Symposium - Call for Papers Chris Kleijn Main CFD Forum 0 September 25, 2001 11:17
CFD for fans & blower housings David Carroll Main CFD Forum 8 August 24, 2000 18:25
ASME CFD Symposium, Atlanta, 22-26 July 2001 Chris R. Kleijn Main CFD Forum 0 August 1, 2000 11:07


All times are GMT -4. The time now is 03:43.