Showing posts with label SALOME. Show all posts
Showing posts with label SALOME. Show all posts

Sunday, 4 March 2012

README first

News - From June 2010, I started to spend money on Google AdWords to maximise my effort to share experiences by writing this blog.

Welcome to my blog on CFD, numerical modelling and parallel programming. Though relevant things are included, the CFD part of this blog focuses on the packages SALOME, Code_Saturne and ParaView etc. The complete content can be directed by the Labels list on the right side.


All the posts here are kept updated. Following or subscribing a blog is a good idea if it really helps. Up to March 2012, as reported by Google, there are 90 friends who are following or subscribing my posts using Google.

The most popular posts are summarised as follows

1. Installation of SALOME on Ubuntu

The latest SALOME version is 6.3.1. However I haven't tried this version; I am still using the 5.1.x.

For 5.1.x the latest version is 5.1.6. The complete instruction, "Installation of SALOME 5.1.3 on Ubuntu 10.04 (64 bit)", should help when install SALOME 5.1.x onto Ubuntu; at least according to feedbacks, this works up to 5.1.4 onto Ubuntu 10.04 (32/64 bit). The tips also suit Ubuntu 9.10, if all packages are updated in the system.

For Ubuntu 9.10, an older post is "Installation of SALOME 5.1.2 on (K)Ubuntu 9.10 64 bit". The notes might be slightly outdated.

If preferring Ubuntu 9.04, it is also easy to install SALOME by only following "Installation of SALOME 5.1.1 on Ubuntu 9.04". The post actually helps up to the latest version 5.1.3.

For those who still use the old 4.* versions of SALOME, "Polishing GUI of older SALOME versions" is recommended to read.

2. SALOME tutorials

"CFD tutorial: laminar flow along a 2D channel - Part I" is a brief tutorial on using SALOME to do the geometry modelling and meshing.

More examples are still on the way.

3. Installation of Code_Saturne on Ubuntu

The latest Code_Saturne 2.1.0 is much easier to compile and install than ever. An instruction on this version is on the way. By the way I also successfully ported this version onto Windows 7.

Since version 2.0 Code_Saturne started to adopt the typical source build and install procedure on Linux. By following "Installation of Code_Saturne 2.0-rc1 on Ubuntu 10.04 (64 bit)" I am confident it would be an easy job for you. In the meantime, if you are also a SALOME user, I strongly recommend you to read "Compile Code_Saturne with SALOME binary libraries" in order to reuse the binary libraries already shipped with SALOME.

Two slightly outdated but helpful posts are "Installation of Code_Saturne 2.0.0 on Ubuntu 9.04" and "Installation of Code_Saturne 2.0-rc1 on Ubuntu 9.10".

You can also try to test installing Code_Saturne with apt-get. Please read "apt-get, the ideal way to install the software onto Ubuntu".

The instruction on installation of the last stable version, 1.3.3, was written in "Installation of Code_Saturne 1.3.3 on Ubuntu 9.04". On the other hand, for the version 1.4.0 the installation procedure is quite similar to that of 1.3.3, except 1.4.0 turned to use PyQt4 and Qt4. Please check "Installation of Code_Saturne 1.4.0 on Ubuntu 9.04" to see how to use (Py)Qt4 instead of the python-tk and tix.

4. Code_Saturne tutorials

"CFD tutorial: laminar flow along a 2D channel - Part II" gives a brief tutorial on how to apply Code_Saturne to solve a CFD problem.

More examples are still on the way.

5. Installation and usage of ParaView

Installation of ParaView is relatively easier and please read "Installation of ParaView 3.6.1 on Ubuntu 9.04". The usage of ParaView is briefly illustrated by an example in the article "Post-processing with ParaView".

For the latest version of ParaView, please refer to its official site.

6. GPGPU acceleration with CUDA techniques

A basic idea of using NVIDIA CUDA and the template library thrust is shown in "A simple test on the efficiency of thrust". An example to use CUDA practically is "Apply CUDA to solve a 1D heat transfer problem".

Last but not least, any comments are sincerely welcome and your support is always my motivation. The visitors here are from all over the world. See the visits map overlay below, which is provided by Google Analytics for the half-a-year period from January 2010.

Tuesday, 20 December 2011

SALOME version 6.4.0 is released

CEA/DEN, EDF R&D and OPEN CASCADE are pleased to announce SALOME version 6.4.0. Please visit news for more details.

This is a public minor release that contains improvements and bug fixes against SALOME version 6.3.1 released in July 2011.

Proceed to the download page to get this release for a go. Note that the Windows version 32bit is also available to download at the same page.

Saturday, 5 November 2011

Code_Saturne 2.1.0 has been released

On 31 Oct, 2011, Code_Saturne 2.1.0 (intermediate version) has been released and is available for downloading. The details of the new features are described on the corresponding news page.

The selective major features include:
  • Packaging: Code_Saturne is now provided as a single package, grouping all existing libraries (BFT, FVM, MEI, libsyrcs). It also includes preliminary source code for SALOME plugin (CFDSTUDY module and Code_Aster coupling).
  • Code coupling: Code_Saturne 2.1 can be coupled with SYRTHES 4.0.0-10 (at least). SYRTHES 4.0 is a complete rewrite of SYRTHES 3.4 with many new features and should shortly be released. Code_Saturne 2.1 also contains preliminary code for Code_Aster coupling (more to come on this topic in next versions).
  • User interface: both the script user interface and the graphical user interface have been simplified and completed to enhance user experience. Just give a try to the new runcase script (and its Python overloading) and to the new features of the graphical interface (more to come also on this topic in next versions).
  • New mesh readers: Code_Saturne pre- and post- processing has been updated to support CGNS 3.1 and MED 3.0 format. MED 3.0 is compatible with SALOME 6.3.
  • Documentation: the user manual has been slightly improve and a Doxygen documentation of the sources is now available. An installation manual is now provided too.
  • Configuration: a configuration file can be completed, either globally or by user, to setup some runtime options like the scratch directory, an optional mesh database or SYRTHES 4.0 version to be used.
  • Automatic V&V: a tool for automatic run of Code_Saturne has been developped, enabling the user to automatically run simulations, plot graphs and receive a PDF report by e-mail. It can be very useful for automatic Verification & Validation, though it is still in the very early stage of development.

Thursday, 29 September 2011

Release of SALOME version 5.1.6 and ParaView 3.12.0 RC-2

SALOME version 5.1.6 is a public maintenance release for series 5.x of SALOME platform. The version provides several major and minor bug fixes against SALOME version 5.1.5 released in December 2010.

SALOME 5.1.6 can be downloaded from the official page http://www.salome-platform.org/downloads/salome-v5.1.6.

On the other hand ParaView 3.12.0 Release Candidate 2 binaries are already available for download on the official page http://paraview.org/paraview/resources/software.html.

ps, Firefox 7.0 has also been released yesterday and it becomes really faster than the previous versions :)

Thursday, 25 August 2011

I am looking for a job

News - I greatly appreciate your comments below and surprisingly plenty of information and valuable advices came to me during the last one year. Thanks to all your concern, I finally accepted a thermal expert position in ABB USA (www.abb.com) and am sitting in North Carolina.

I particularly thank the three companies in England, France and America that I personally consulted for and their encouraging recommendations. I cherish the experiences I have obtained from the part-time working with them.

Within my PhD study, I have published eight research papers. Four of them are in leading journals and their links are as follows:

I am graduating in September 2011 with a PhD degree from School of Electrical and Electronic Engineering, University of Manchester. I am looking for a numerical modelling job.

I spent the past more than three years on the CFD simulations which are coupling between electric, thermal and fluid dynamic fields, from which I have accumulated rich experiences on modelling packages such as SALOME, Code_Saturne, Elmer, ParaView and COMSOL etc. I share experiences in this blog, which has also gained worldwide popularity.

I have been programming in C/C++, C#, VB.NET and Matlab since 2002. I also have experiences in Python (the script widely used for automation of modelling and the software such as SALOME and ParaView etc) and Fortran (the user routine definition for Code_Saturne) etc. Meanwhile, probably as a bonus, I am a fan of open-source software, Linux and Mac OS X. I even wrote device drivers for Linux and ported the MySQL client tool running on desktops onto embedded Linux platforms.

I bear high interests in numerical modelling and would like to pursue a career in this field. If you have relevant opportunities, please drop me an email (salad00 at gmail dot com). I really appreciate your help very much.

Friday, 22 July 2011

SALOME version 6.3.1 is released

The maintenance version SALOME 6.3.1 has been released, which contains planned bug fixes against the version 6.3.0 released in June 2011. SALOME 6.3.1 does not include any improvements or new features comparing to the version 6.3.0.

Please download from the official page to have a go.

Saturday, 11 June 2011

SALOME version 6.3.0 is released

In the good news, CEA/DEN, EDF R&D and OPEN CASCADE are pleased to announce SALOME version 6.3.0. It is a public release that contains the results of planned major and minor improvements and bug fixes against SALOME version 5.1.5 released in December 2010.

SALOME version 6.3.0 provides the results of the porting of SALOME to the newer versions of 3rd party pre-requisite products.

In addition, SALOME 6.3.0 includes several new modules:

  • PARAVIS (new post-processing module based on Kitware’s ParaView application)
  • HEXABLOCK (hexahedral meshing by creating of a model of the blocks)
  • HOMARD (the adaptation of the mesh generated by the Homard solver for the SALOME platform)
  • New sample modules and tutorials

This new release of SALOME introduces new features and improvements:

  • New Geometry operations
    • Create edge by length
    • Create vertex by length
    • Improved "Sub-shapes selection" dialog box
    • Analytical curve definition
    • Glue edges
    • Projection
    • Unpublish objects
  • New Mesh operations
    • Copy mesh
    • Convert to/from quadratic on sub-meshes
  • New Mesh controls
    • Over-constrained faces / volumes
    • Bare border faces / volumes
    • Element diameter 2D / 3D
  • New Mesh hypotheses and algorithms
    • Viscous layers
    • Advanced size maps in BLSurf
    • Enforced meshes with Ghs3D
    • Use existing 1D / 2D elements
  • Controls Distribution operations in Mesh module: plot in 2D viewer, show histogram in 3D viewer, dump to the file
  • Improved behavior of clipping planes in Mesh module
  • Mesh measurements: Minimum distance, Bounding box
  • Preview on most of Geometry and Mesh operations
  • Visibility icons in the Object browser
  • New view operations
    • Rotate view 90° clockwise / counterclockwise
    • Zoom at point
  • Dump study to the single Python script file
  • And more ... see SALOME 6.3.0 Release Notes for details

The latest installation packages can be retrieved from the official download page, and pre-compiled binaries are also available.

For Ubuntu users it is recommended to download the latest package for Debian 6.0 Squeeze; although there is only a 64 bit version, why not take the chance to upgrade to 64 bit? For other Ubuntu distributions, in detail David suggested downloading packages for

  • Ubuntu 9.04: Debian 4.0 Etch or 5.0 Lenny
  • Ubuntu 9.10: Debian 4.0 Etch or 5.0 Lenny
  • Ubuntu 10.04: Debian 5.0 Lenny or 6.0 Squeeze
  • Ubuntu 10.10: Debian 5.0 Lenny or 6.0 Squeeze
  • Ubuntu 11.04: Debian 6.0 Squeeze

Sunday, 24 April 2011

Next SALOME version 6.3.0 due in May 2011

According to David's message on the SALOME forum, the next major release of SALOME will be SALOME v6.3.0 and the planned release date is May 2011. [1]

Part of the improvements and features this new version will bring to us can be referred from [2], listed as
  • Automatic meshing of boundary layers
  • SMESH: Histogram of the quality controls
  • Option Single/Multi file dump
  • "RemoveFromStudy" Function
  • Hide/Show Icon (as in paraview)
  • GEOM: Performance enhanced when manipulating large models
  • SMESH: Mesh common borders
  • SMESH: detection of over-constrained elements
  • SMESH: create a new mesh from a selected group or from selected elements
  • SMESH: Create a clipping plane on several groups
Additionally the MED library version will be 3.0. This is a major change since the API is not compatible with the previous version. This version will read MED files of both format 2.2 and 3.0 and will write format 3.0.

In version 6.3.0 it will be possible to define viscous layer (inflation layers in ANSYS) [3]. It will be defined as an additional hypothesis for the 3D algorithms Netgen, GHS3D and Hexahedron, and the parameters will include:
  • Total thickness
  • Number of layers
  • Stretch factor
The example of viscous layers defined on tetra and hexa meshes, David posted on the SALOME forum, is


Certainly there will also be lots of bug fixes. We are absolutely enthusiastic with the new version and looking forward to its release.

Sunday, 13 March 2011

Share some helpful articles

1. Installation of Code_Saturne on Mandriva

A very helpful wiki page on how to compile and install Code_Saturne onto Mandriva has been contributed as follows

http://wiki.mandriva.com/fr/index.php?title=Code_Saturne

Since it is a French instruction, I also paste the Google translated English version here, as

The Google translated English version

2. A practical Code_Saturne study example

It is interesting to read a CFD example which combines the usage of SALOME, Code_Saturne and ParaView.

http://www.caelinux.org/wiki/index.php/Contrib:Claws/Real_world_study_CodeSaturne

3. Installing OpenFOAM 1.7.x on openSUSE 11.4

For those who want to install OpenFOAM onto openSUSE, probably this article is interesting.

Installing OpenFOAM 1.7.x on openSUSE 11.4

4. Compiling OpenFOAM 1.7.x on Mac OS X Snow Leopard

For those who want to use OpenFOAM on Mac OS X, the article could be helpful.

Compiling OpenFOAM 1.7.x for OS X 10.6

I hope these articles help you.

Wednesday, 8 December 2010

SALOME version 5.1.5 is released

Please read the piece of news.

CEA/DEN, EDF R&D and OPEN CASCADE are pleased to announce SALOME 5.1.5. It is a public maintenance release that contains the results of planned major and minor improvements and bug fixes against SALOME version 5.1.4 released in July 2010.

This new release of SALOME includes the following important new features and improvements:
  • New operations in Geometry module: Automatic coordinate vectors and other.
  • Export CAD models to VTK native format in Geometry module.
  • New operations in Mesh module: Split hexahedrons to 24 tetrahedrons, Remove orphan nodes, Create boundary elements, Duplicate nodes / elements.
  • Improved Quadrangle mapping meshing algorithm: new Reduced (layers) type of meshing.
  • New filters in Mesh module: Coplanar faces.
  • Graduated axes trihedron in the OCC viewer.
  • Customizable shortcuts for some most frequently used operations.
  • New features in YACS module.
  • New TUI functions.
  • Multi-language support (plus French resources).
  • And more … see SALOME 5.1.5 Release Notes for details

SALOME 5.1.5 supports Debian 4.0 Etch 32bit and 64bit; both are Ubuntu compatible. The latest installation wizard packages can be retrieved from the download page of the official site. I expect the tutorial "Installation of SALOME 5.1.3 on Ubuntu 10.04 (64 bit)" would still be helpful when install the latest SALOME 5.1.5 onto Ubuntu 10.10. I also look forward to receiving your testing feedback on this.

Monday, 28 June 2010

SALOME version 5.1.4 is released

In the good piece of news, CEA/DEN, EDF R&D and OPEN CASCADE are pleased to announce SALOME 5.1.4. It is a public maintenance release that contains the results of planned major and minor improvements and bug fixes against SALOME version 5.1.3 released in December 2009.

This new release of SALOME includes the following important new features and improvements:
  • Improved Filling algorithm in Geometry module.
  • Mesh scaling operation.
  • Split all 3d mesh elements (volumes) to the tetrahedrons.
  • Change sub-meshing order for the concurrent sub-meshes.
  • Find mesh element closest to the specified point.
  • Modify point markers in Mesh and Post-Pro modules.
  • Sort table data (Post-Pro module).
  • Using of two vertical axes in the Plot2d viewer.
  • Keyboard free interaction style in OCC viewer.
  • New features in YACS module.
  • And more … see SALOME 5.1.4 Release Notes for details

SALOME 5.1.4 supports Debian 4.0 Etch 32bit and 64bit; both are Ubuntu compatible. The latest installation wizard packages can be retrieved from the download page of the official site. As feedback from users, the tutorial "Installation of SALOME 5.1.3 on Ubuntu 10.04 (64 bit)" also works with SALOME 5.1.4 on Ubuntu 10.04.

We also look forward to the corresponding Windows version.

SALOME 5.1.4 for tests on windows available

As announced by Adam on 2nd July, 2010, SALOME version 5.1.4 for tests on windows is already available. Please refer to the download page and the how-to-compile page for more details.

Monday, 24 May 2010

apt-get, the ideal way to install the software onto Ubuntu

Code_Saturne

In the past two years, since I started to use Code_Saturne, I compiled the packages over and over whenever I need to use it. I wrote posts and share my experiences in order to save others' precious time from solving all the compilation problems one might meet with. At the same time, I was also thinking, if we could use the standard apt-get to install Code_Saturne, it would be perfect.

salad@ubuntu:~$ sudo apt-get install code-saturne
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package code-saturne is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package code-saturne has no installation candidate

David said the code-saturne package is only available in Debian testing. Therefore, I add two lines into my source configuration /etc/apt/sources.list: (Please select a corresponding source which is fast in your area; you can refer to http://www.debian.org/mirror/list)

deb http://mirror.ox.ac.uk/debian/ testing main
deb-src http://mirror.ox.ac.uk/debian/ testing main

Then retrieve the list of packages and apt-get install code-saturne

:/$ sudo apt-get update
:/$ sudo apt-get install code-saturne

Gladly, this time I get positive information saying the packages can be installed.

salad@ubuntu:~$ sudo apt-get install code-saturne
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  qt4-doc libswscale0 libavutil49 libpthread-stubs0 libgl1-mesa-dev
  x11proto-kb-dev libqt4-opengl libavcodec52 mesa-common-dev xtrans-dev
  x11proto-input-dev libglu1-mesa-dev libdrm-dev libqt4-multimedia qt4-qmake
  libgsm1 libxau-dev libschroedinger-1.0-0 libavformat52 libx11-dev
  libdirac-encoder0 libxcb1-dev mpi-default-bin libopenjpeg2 x11proto-core-dev
  libxdmcp-dev libpthread-stubs0-dev qt4-designer libfaad2
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  code-saturne-bin code-saturne-data code-saturne-include ecs libaudio2
  libavcodec52 libavformat52 libavutil49 libbft1 libcgns2 libdb4.5
  libdirac-encoder0 libdrm-dev libdrm-intel1 libdrm-nouveau1 libdrm-radeon1
  libdrm2 libfaad2 libfvm0 libgl1-mesa-dev libglu1-mesa-dev libgsm1
  libhdf5-openmpi-1.8.4 libmedc1 libmei0 libmng1 libmysqlclient16 libncursesw5
  libopenjpeg2 libpthread-stubs0 libpthread-stubs0-dev libqt4-assistant
  libqt4-dbus libqt4-designer libqt4-help libqt4-multimedia libqt4-network
  libqt4-opengl libqt4-phonon libqt4-qt3support libqt4-script
  libqt4-scripttools libqt4-sql libqt4-sql-mysql libqt4-sql-sqlite libqt4-svg
  libqt4-test libqt4-webkit libqt4-xml libqt4-xmlpatterns libqtcore4 libqtgui4
  libschroedinger-1.0-0 libsqlite3-0 libssl0.9.8 libswscale0 libx11-6
  libx11-dev libxau-dev libxau6 libxcb1 libxcb1-dev libxdmcp-dev libxdmcp6
  mesa-common-dev mpi-default-bin mysql-common python-qt4 python-sip python2.5
  python2.5-minimal qt4-designer qt4-doc qt4-qmake qt4-qtconfig syrthes
  x11proto-core-dev x11proto-input-dev x11proto-kb-dev xtrans-dev
Suggested packages:
  nas libmed-tools libmed-doc libqt4-dev python-qt4-dbg python2.5-doc
  python-profiler qt4-dev-tools
Recommended packages:
  paraview
The following NEW packages will be installed
  code-saturne code-saturne-bin code-saturne-data code-saturne-include ecs
  libaudio2 libavcodec52 libavformat52 libavutil49 libbft1 libcgns2 libdb4.5
  libdirac-encoder0 libdrm-dev libfaad2 libfvm0 libgl1-mesa-dev
  libglu1-mesa-dev libgsm1 libhdf5-openmpi-1.8.4 libmedc1 libmei0 libmng1
  libmysqlclient16 libopenjpeg2 libpthread-stubs0 libpthread-stubs0-dev
  libqt4-assistant libqt4-dbus libqt4-designer libqt4-help libqt4-multimedia
  libqt4-network libqt4-opengl libqt4-phonon libqt4-qt3support libqt4-script
  libqt4-scripttools libqt4-sql libqt4-sql-mysql libqt4-sql-sqlite libqt4-svg
  libqt4-test libqt4-webkit libqt4-xml libqt4-xmlpatterns libqtcore4 libqtgui4
  libschroedinger-1.0-0 libswscale0 libx11-dev libxau-dev libxcb1-dev
  libxdmcp-dev mesa-common-dev mpi-default-bin mysql-common python-qt4
  python-sip python2.5 python2.5-minimal qt4-designer qt4-doc qt4-qmake
  qt4-qtconfig syrthes x11proto-core-dev x11proto-input-dev x11proto-kb-dev
  xtrans-dev
The following packages will be upgraded:
  libdrm-intel1 libdrm-nouveau1 libdrm-radeon1 libdrm2 libncursesw5
  libsqlite3-0 libssl0.9.8 libx11-6 libxau6 libxcb1 libxdmcp6
11 upgraded, 70 newly installed, 0 to remove and 655 not upgraded.
Need to get 131MB of archives.
After this operation, 245MB of additional disk space will be used.
Do you want to continue [Y/n]?

Accept it and all the related packages will be downloaded and installed. To see if it is really there, type

salad@ubuntu:~$ type code_saturne
code_saturne is hashed (/usr/bin/code_saturne)
salad@ubuntu:~$ code_saturne config
Directories:
  dirs.prefix = /usr
  dirs.exec_prefix = /usr
  dirs.bindir = /usr/bin
  dirs.includedir = /usr/include
  dirs.libdir = /usr/lib
  dirs.datarootdir = /usr/share
  dirs.datadir = /usr/share
  dirs.pkgdatadir = /usr/share/ncs
  dirs.docdir = /usr/share/doc/ncs
  dirs.pdfdir = /usr/share/doc/ncs

Auxiliary information:
  dirs.ecs_bindir = /usr/bin
  dirs.syrthes_prefix = /usr/lib/syrthes/3.4.2

MPI library information:
  mpi_lib.type =
  mpi_lib.bindir =
  mpi_lib.libdir =

Compilers and associated options:
  cc = cc
  fc = gfortran
  cppflags = -D_POSIX_SOURCE -DNDEBUG -I/usr/include/libxml2
  cflags = -std=c99 -funsigned-char -pedantic -W -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wunused -Wfloat-equal -g -O2 -g -Wall -O2 -funroll-loops -O2 -Wuninitialized
  fcflags = -x f95-cpp-input -Wall -Wno-unused -D_CS_FC_HAVE_FLUSH -O
  ldflags = -Wl,-export-dynamic -O
  libs = -lfvm -lm -lcgns -lmedC -lhdf5 -lmei -lbft -lz -lxml2 -lblas -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. -lgfortranbegin -lgfortran -lm -ldl
  rpath = -Wl,-rpath -Wl,

Compilers and associated options for SYRTHES build:
  cc = /usr/bin/gcc
  fc = /usr/bin/gfortran
  cppflags = -I/usr/lib/syrthes/3.4.2/include
  cflags = -O2 -D_FILE_OFFSET_BITS=64 -DHAVE_C_IO
  fcflags = -O2 -DHAVE_C_IO -D_FILE_OFFSET_BITS=64
  ldflags = -L/usr/lib/syrthes/3.4.2/lib/Linux
  libs = -lbft -lz -lsatsyrthes3.4.2_Linux -lsyrthes3.4.2_Linux -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. -lgfortranbegin -lgfortran -lm
salad@ubuntu:~$ code_saturne create -s STUDY -c CASE
Code_Saturne 2.0.0-rc1 study/case generation
  o Creating study 'STUDY'...
  o Creating case 'CASE'...

We see the MPI library information is blank, as the package currently miss MPI support (this will hopefully be corrected before final release).

SALOME

Ledru said SALOME has just been uploaded into Debian. (see the first comment of "Installation of SALOME 5.1.3 on Ubuntu 10.04 (64 bit)") That is right; there is a package salome but there is no source containing it. Let's hope for it.

salad@ubuntu:~$ sudo apt-get install salome
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package salome is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package salome has no installation candidate

ParaView

apt-get install paraview can install paraview 3.4.0 at the moment. Although the latest version is already 3.8.0, a not-quite-old 3.4.0 is pretty enough if want to enjoy the ease of apt-get.

salad@ubuntu:~$ type paraview
paraview is hashed (/usr/bin/paraview)
salad@ubuntu:~$ paraview --version
ParaView3.4

Sunday, 2 May 2010

Installation of SALOME 5.1.3 on Ubuntu 10.04 (64 bit)

NEW - According to your feedback in the comment list and my own experience, the present tutorial works with SALOME 5.1.5 on Ubuntu 10.10, Kubuntu 10.10 and the latest Ubuntu 11.04.

NEW - As the feedback from vaina, the present tutorial also works with the latest SALOME 5.1.4 on Ubuntu 10.04.

On 23 April 2010, I received the SALOME Newsletter and surprisingly read that they are advising my blog "Free your CFD" for my introduction on SALOME on different platforms. I feel pretty glad and deeply honored because this is definitely the first time I obtain acknowledgement from the SALOME official after my effort during the past more than one years. The part below is from the newsletter.

salome logo Welcome to the April 2010 SALOME Newsletter
...

Solvers' corner

...

"Free your CFD"

Have you bookmarked this blog. It provides useful information and tutorials on Code_Saturne and SALOME.
...
Salome platform logo

To thank you for your support and to celebrate the recent release of the latest Ubuntu 10.04 LTS, I summarise the two previous posts "Installation of SALOME 5.1.1 on Ubuntu 9.04" and "Installation of SALOME 5.1.2 on (K)Ubuntu 9.10 64 bit", test the installation procedure of SALOME version 5.1.3 on Ubuntu 10.04 (64 bit), hereby share my experience and hope it truly helps.

1. Preparation. Although a "Universal binaries for Linux" was released, I still suggest to use the install wizard version to install SALOME, because both of the source code and the corresponding pre-compiled binaries of the necessities are all shipped with the package, and thus it is even possible to share these libraries with Code_Saturne (see "Compile Code_Saturne with SALOME binary libraries").

Install the g++ compiler as SWIG has to be built from source.

:/$ sudo apt-get install build-essential

Replace the executable "sh" with "bash" to avoid some trivial errors.

:/$ sudo rm /bin/sh
:/$ sudo ln -s /bin/bash /bin/sh

Additionally, if it is for a 64 bit Linux, because the install wizard was written for 32 bit, a package ia32-libs is also necessary. It is of course not needed if the Linux environment is 32 bit version.

:/$ sudo apt-get install ia32-libs

Otherwise an error could be encounterred on the console when trying to launch the install wizard.

sh: ./bin/SALOME_InstallWizard: No such file or directory

2. Install. Download the install wizard package and extract it. Ship into the extracted directory and then execute runInstall.

:/$ ./runInstall

Sequentially, the wizard contained 8 steps, for which the screenshots below illustrate. Step 7 is for install progress. After it is started, during the install procedure, there will a warning dialog, shown below as well, poped out, complaining two compulsory libraries, libg2c and libgfortran, haven't been found. Click "OK", ignore the warning and procede until finish the last step of the wizard.




















3. Post-install. SALOME has been installed into the $HOME directory; run salome_appli_5.1.3/runAppli to launch the software. However, before the first launch, remember to create a directory USERS under the salome_appli_5.1.3 to avoid an error.

:/$ mkdir salome_appli_5.1.3/USERS
:/$ salome_appli_5.1.3/runAppli &

Up to now, launch SALOME and try to enable the MESH module, an error, shown below, is seen. This is because libg2c and libgfortran are still missing in the system.


To add libgfortran, sequentially execute (note that for Ubuntu 11.04, the libgfortran is in /usr/lib/x86_64-linux-gnu instead of /usr/lib)

:/$ sudo apt-get install gfortran
:/$ sudo ln -s /usr/lib/libgfortran.so.3 /usr/lib/libgfortran.so.1
:/$ sudo ldconfig
:/$ sudo updatedb

To add libg2c, download the packages libg2c0 and gcc-3.4-base (the latter actually provides a dependency for the former one) which suit the system, i386 or amd64, and then install both by dpkg command. For instance, on my Ubuntu 64 bit, execute

:/$ sudo dpkg -i gcc-3.4-base_3.4.6-8ubuntu2_amd64.deb libg2c0_3.4.6-8ubuntu2_amd64.deb

Finally SALOME is supposed to work well.

Monday, 22 March 2010

Gambit example: model a 2D channel

"CFD example: laminar flow along a 2D channel" applied SALOME to model and mesh a 2D channel geometry for Code_Saturne to perform the simulation. However, someone likes to use Gambit, a product from ANSYS Fluent, and of course, the same example can also be made with the help of Gambit. Furthermore, similar to SALOME using Python for automatisation, Gambit has Journal file to automatise the manual procedure. The present post aims to translate the previous example into Gambit Journal file in order to show an illustration for beginners.

Basic instructions

1. comments. A comment line in Gambit Journal is headed with a forward slash, /.

/ This line is commented.

2. variables. One is able to define a variable with a name beginning with $. The variable represents a float point value.

$length = 0.1

3. arrays. Array names are also begun with $. In Gambit Journal, array is indexed by a 1 based number, which is quoted by a pair of square parenthesis, []. The index range of an array should be given at the definition declaration of the array itself.

declare $points[1 : 3]
$points[1] = 1.0
$points[2] = 0.0
$points[3] = 0.0

4. For the construction method of points, edges and faces, it is quite concise as well. Please refer to the simple example given in the next section.

The example

Once again, according to the philosophy of executing commands on terminals, Gambit Journal scripts are used to illustrate the example.

///////////////////////////////////////////////////////////////////////
/ Geometry construction and meshing creation for a typical
/ 2d channel flow between two infinite parallel plates.
/
/ Written by: salad
/ Manchester, UK
/ 06/12/2009
///////////////////////////////////////////////////////////////////////
/
/ L = 0.1 m, D = 0.005 m
/
/     C  --------- B
/       |         |
/ -->   |         |
/     O  --------- A
/
/ V_in = 0.05 m/s
/ t    = 50 degree C
///////////////////////////////////////////////////////////////////////

Define the variables and points, and then construct edges and faces accordingly.

/ Variable Definition
$length = 0.1
$height = 0.005

/ points
vertex create "O" coordinates 0
vertex create "A" coordinates $length
vertex create "B" coordinates $length $height
vertex create "C" coordinates 0 $height

/ edges
edge create "OA" straight "O" "A"
edge create "AB" straight "A" "B"
edge create "BC" straight "B" "C"
edge create "CO" straight "C" "O"

/ faces
face create "DUCT" wireframe "OA" "AB" "BC" "CO"

After the geometry is constructed, build the mesh, define the boundaries, and then create a zone corresponding to the 2D face "DUCT". Note that, differing from the SALOME example, here the 2D model is not extruded along the z axis, because originally, I wrote the script for Fluent to use at that moment.

/ mesh
edge mesh "CO" intervals 50
edge mesh "OA" intervals 250
face mesh "DUCT"

/ boundary
physics create "inlet" btype "VELOCITY_INLET" edge "CO"
physics create "bottom" btype "WALL" edge "OA"
physics create "top" btype "WALL" edge "BC"
physics create "outlet" btype "PRESSURE_OUTLET" edge "AB"

/ zones
physics create "duct_v" ctype "FLUID" face "DUCT"

Finally, export the mesh file for future use.

/ export
export uns "2d_duct_flow.msh"

Monday, 15 February 2010

Post-processing using SALOME and MED

MED file format supports storage of both mesh and simulation results data. SALOME can export its mesh into MED format, and also read result files which are in MED format to perform post-processing operations. Fortunately, Code_Saturne can use MED as its post-processing format. I borrow the figure from a previous post "CFD example: laminar flow along a 2D channel - Part II" to show this. Select the option 'Post-processing format' to 'MED' and then the output result for this case will be in MED.



SALOME's post-processing module can read the Code_Saturne produced MED files, provides many types of operations to show the simulated data, and automatic executive scipt can also be written in Python to control the data presentation styles. The procedure is actually straightforward and it is therefore not the objective of this post. This post aims at revealing another way, which should be more flexible, to access a MED file.

We have compiled MED file library when we try to compile Code_Saturne (please see "Installation of Code_Saturne 2.0.0 on Ubuntu 9.04" for example). The source code of this library is actually shipped with the SALOME installation package (for example, InstallWizard_5.1.3_Debian_4.0_64bit.tar.gz/InstallWizard_5.1.3_Debian_4.0_64bit/Products/SOURCES/med-2.3.6.tar.gz), and the corresponding binary is also included (for example, InstallWizard_5.1.3_Debian_4.0_64bit.tar.gz/InstallWizard_5.1.3_Debian_4.0_64bit/Products/BINARIES/Debian_4.0_64bit/med-2.3.6.tar.gz). Using this library we can write small pieces of code to flexibly access the result data stored in a MED file.

A user guide of MED library can be found from the SALOME install directory DOCUMENTATION_SRC_5.1.3/MEDMEM_UG.pdf. Python scripts to use MED library can be obtained from MED_V5_1_3/bin/salome, for example, the sample file med_test1.py. Following the examples Python code can be written to read a MED file, obtain all the data from it and do whatever operations onto these data, as the flexibility Python provides.

Note that the prepared Python code can only be executed by the Python interpreter shipped with SALOME, which is '$HOME/salome_5.1.3/Python-2.4.4/bin/python'.

It is also possible to write C/C++ code instead of Python if you prefer. For example,

// FIELDuse.cxx
// Written by salad @ Manchester, UK
// 17-08-2009

#include
#include

#include "MEDMEM_Med.hxx"
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_Field.hxx"

#include "MEDMEM_MedMedDriver.hxx"
#include "MEDMEM_MedMeshDriver.hxx"

using namespace std;
using namespace MEDMEM;

int main(int argc, char ** argv) {
    ...
}

In order to compile the code, firstly, import all the necessary environment variables by executing

:/$ source $HOME/salome_5.1.3/env_products.sh

and Makefile could then be prepared as

# Makefile
# Written by salad @ Manchester, UK
# 17-08-2009

LIB_DIRS = -L${MED_ROOT_DIR}/lib/salome \
    -L${MED2HOME}/lib -L${HDF5HOME}/lib
INCLUDE_DIRS = \
    -I${KERNEL_ROOT_DIR}/include/salome \
    -I${MED_ROOT_DIR}/include/salome \
    -I${MED2HOME}/include -I${HDF5HOME}/include

CFLAGS   = -O -Wno-deprecated -DPCLINUX
MED_LIBS = -lmed -lmedmem -lhdf5 -lz -lgfortran
MODULE   = FIELDuse
SRC      = $(MODULE).cxx
OBJECTS  = $(MODULE).o

all: $(MODULE)

$(OBJECTS): $(SRC)
    g++ -c $(CFLAGS) $(INCLUDE_DIRS) $(SRC)
$(MODULE): $(OBJECTS)
    g++ -o $(MODULE) $(LIB_DIRS) $(OBJECTS) $(MED_LIBS) -pthread

Okay, the last problem is a possibly encountered link error. When linking the code an error says

$HOME/salome_5.1.3/med-2.3.5/lib/libmed.so: undefined reference to `_gfortran_copy_string'

When I was using Ubuntu 9.04 I encountered this problem. I solved it by manually installing gfortran-4.1, which contains the missing functions. Download two packages from "https://launchpad.net/ubuntu/hardy/i386/gcc-4.1-base/4.1.2-21ubuntu1" and "https://launchpad.net/ubuntu/intrepid/i386/libgfortran1/4.1.2-21ubuntu1", and then install them with commands 'sudo dpkg -i'. The error disappeared and a warning left, saying

/usr/bin/ld: warning: libgfortran.so.1, needed by $HOME/salome_5.1.3/med-2.3.5/lib/libmed.so, may conflict with libgfortran.so.3

Ignore it.

Saturday, 6 February 2010

CFD tutorial: laminar flow along a 2D channel - Part II

Geometry and mesh using SALOME

Please read Part I of this article.

CFD solving with Code_Saturne

After the mesh file is produced from SALOME, Code_Saturne can be used for a CFD calculation. Note that I take Code_Saturne 2.0.0 as an example in this post; if you are still using Code_Saturne 1.x, remember some commands and directory names are different.

1. Create a study with a case.

Command 'cs create' is for this. Use option '--help' to get its help message, '-s' and '-c' to specify a study name and a case name, respectively. Note that from 2.0-rc1 version, the script name cs is changed to code_saturne; please use code_saturne instead if you are using Code_Saturne 2.0-rc1. (Within Code_Saturne 1.x, command 'cree_sat -etude' has to be used instead; for clarity, this post doesn't include the content related to version 1.x.)

:/$ cs create --help
:/$ cs create -s DUCT -c 2D

With the command executed, a study directory named 'DUCT' and a case called '2D' are created. In the directory 'DUCT', there are three sub-directories:

*. 2D: The case directory. A study can have several cases; for example, different boundary conditions can be organised as different cases.
*. MESH: Code_Saturne will read mesh files from this directory, and as such we need to copy mesh files into it;
*. POST: This is an empty directory designed to contain post-processing macros (xmgrace, experimental etc).

Copy the mesh file 'mesh_d.med' into the directory 'MESH'. Then we look at the case directory '2D', in which there are four sub-directories:

*. DATA: Contains the script to launch the GUI SaturneGUI.
*. RESU: Directory where the results will be exported once the calculation has finished.
*. SCRIPTS: The launching scripts are copied here. The CFD calculation is actually started by executing the launching script 'runcase' here.
*. SRC: The user subroutines are saved here. During the compilation stage, the code will re-compile all the subroutines that are in this directory. In the 'REFERENCE' directory all the user-defined subroutines are stored. For a specific case you will only need a few of them depending on the changes that you want to implement on the code. The 'base' directory contains the basic flow solver subroutines, and the other directories contain the subroutines needed by other modules.

2. Use GUI to input parameters. Ship into the directory 'DUCT/2D/DATA' and then execute 'SaturneGUI' to launch the GUI.

:/$ ./SaturneGUI &

The parameters set with the GUI can actually be saved into a XML file, and as such for a second time to launch the GUI, option '-f' can be used to load the XML file directly.

:/$ ./SaturneGUI -f 2d_duct_flow.xml &

The first glance at the GUI is like this. It lists the structure of directories. With the help of the navigator at the left panel, we can go to different pages to modify various parameters.



Go to 'Calculation environment > Meshes selection' and add the mesh file 'mesh_d.med'. It can recognise mesh files from the directory 'MESH'.



Go to 'Thermophysical models > Calculation features' and enable two features, 'steady flow' and 'single Phase Flow'.



Go to 'Thermophysical models > Turbulence models' and select 'No model (i.e. laminar flow), since we ignore turbulence and only consider a laminar approximation. Besides, select the 'Thermal scalar' to be 'Temperature (Celsius)' on the page 'Thermal model' and select 'No radiative transfers' on the page 'Radiative transfers' as we ignore radiation.



Go to 'Physical properties > Fluid properties' and set the four fluid properties: density, viscosity, specific heat and thermal conductivity. As shown in the following figure, we set specific heat and thermal conductivity as constant values, and leave density and viscosity to the user subroutine 'usphyv'. Therefore, the reference values set for density and viscosity do not matter.

In 'usphyv' the parameters could be controlled as temperature dependent. It will be discussed in the next section.



Go to 'Volume conditions > Initialization' and set initial values for velocity and temperature. Here I set the x component of the velocity as the inlet velocity value, and set the temperature as the inlet temperature value.



Go to 'Additional scalars > Definition and initialization' and set the scalar limitation for temperature, including its minimal and maximal values.



Next step is about boundary conditions. Firstly, boundaries have to be defined. Since we used SALOME to generate the mesh, according to the defined mesh groups, inlet, outlet, bottom, top and sym, corresponding boundaries can be defined. For more details about the mesh groups, please see Part I of this article.



Secondly, go to 'Boundary conditions > Boundary conditions' and set values for the boundaries. I set the inlet velocity and temperature, and set minus heat flux values at the two walls. Negative heat flux means the heat is into the channel. Additionally, the walls are set as smooth walls.



Leave 'Numerical parameters' with the default values, and go to 'Calculation control > Output control'. Then set 'Output listing at each time step', set output 'Post-processing' 'Only at the end of calculation' since we are concerning a steady state calculation result.

With respect to the 'Post-processing format', either 'Ensight Gold' or 'MED' can be specified. If you prefer to use ParaView, select 'Ensight Gold'. If you want to use SALOME to do post-processing, change the option to 'MED'.



Then go to the second tab page. This page lists the 'Monitoring points coordinates'. When the calculation is being performed, the quantity values at these coordinates will be recorded for each iteration step (each time step if it is a transient process).



Once the calculation is started, we can go to Saturne's temporary directory to check the history data at these monitored points. For example, to check the x component of velocity, use 'xmgrace'

~/tmp_Saturne/DUCT.2D.02061151$ xmgrace -nxy probes_VelocitU.dat

The result could be like this figure below, from which we can see all the values are already stable after 70 iteration steps. It implies a criterion to stop the calculation after a number of steps.


Actually cs plot_probes command instead of xmgrace -nxy could be used to draw the graph of the values at the probes; it's a wrapper around xmgrace with a couple of file manipulation.

3. Apply FORTRAN user routines.

As mentioned the fluid density and viscosity could be configured as temperature dependent by modifying user routines in 'usphyv.f90'. Adopting FORTRAN code to control the calculation details brings enough flexibility to Code_Saturne.

All user routines/FORTRAN files are put in the directory 'SRC'. Look up the sub-directory 'REFERENCE' and see all the routines you can modify. For fluid properties, copy the file SRC/REFERENCE/base/usphyv.f90 into SRC and then modify the copied file in SRC.

For density, search the corresponding piece of code in the file and then modify the part as the following code list, which defines the density expression



T is temperature. Actually 0.00065 is the fluid expansion coefficient due to temperature.

iutile = 1
! ...

! --- Coefficients des lois choisis et imposes par l'utilisateur
!     Les valeurs donnees ici sont fictives

vara = 895
varb = 0.00065
varc = 20

! Masse volumique au centre des cellules
! ---------------------------------------
! loi  RHO = A / (1 + B * (T - C))
! soit PROPCE(IEL,IPCROM) = VARA / (1 + VARB * (XRTP - VARC))

do iel = 1, ncel
  xrtp = rtp(iel, ivart)
  propce(iel, ipcrom) = vara / (1 + varb * (xrtp - varc))
enddo

Note that the first line set the variable 'iutile' to 1, otherwise the code implementing the equation will not take effect.

For viscosity, find the code piece, assign 'iutile' 1 and modify the following code as whatever viscosity equation you would try. With the density code example, it is not supposed to be difficult.

!===============================================================================
!  EXEMPLE 2 : VISCOSITE VARIABLE EN FONCTION DE LA TEMPERATURE
! ===========
! ...

iutile = 1
! ...

4. Solve.

After configured all the necessary aspects and modified the user routines, go to 'Calculation management > Prepare batch calculation' and we are able to start the CFD calculation right now. Firstly, 'Select the batch script file', i.e. click the button to browser a launch script file. As default, the file is named 'runcase'.



Then select the 'Number of processors', and click the button 'Code_Saturne batch running'. A console window will pop out and Code_Saturne will produce code to do the calculation. I assume that you are using more than one processor cores to calculate, and then you might be asked for your Linux system user password by openmpi before the calculation.

Leave the calculation console for minutes and then, if lucky enough, you will see the calculation finished normally. If so, the next step is to see the results and do post-processing.

Post-processing with ParaView

Please read Part III of this article.

CFD tutorial: laminar flow along a 2D channel - Part I

When fluid flows along a 2D channel, which is between two infinite parallel plates, with a relatively low velocity (laminar flow), a hydraulic stable status can be achieved after a certain distance (entrance length). This stable flow status is named as hydraulically fully developed flow. Furthermore, if there is heat flux at the duct surfaces, the fluid near the wall will be warmed up, and a thermal boundary layer is then formed.

For a flow along a channel without heated, after it is fully developed, the velocity pattern at a cross area is parabolic. However, if the flow is also heated, the parabolic velocity pattern will be twisted because of the viscosity dependency of the fluid (this is true for many types of liquid). This phenomenon is pictorially shown as the figure below, in which (a) is the parabolic velocity profile, and (b) is the distorted profile in a heated duct due to the temperature dependency of the fluid viscosity.


Denote the duct height as H, duct length as L, fluid density as , and the average velocity in the duct region as U. Then the pressure drop between the two ends of the duct can be expressed as



in which is defined as friction coefficient. Actually this equation says the active pressure force has to balance the friction force due to shear stress, which is finally related to the fluid viscosity.

Anyway, I select this example to show a simple CFD calculation, because its simple geometry. Using SALOME we can very quickly build up a geometry and then mesh it. Probably an expected structured mesh of the channel can be like this. It is better to have dense mesh near the inlet and the walls of the duct.



Geometry and mesh using SALOME

According to the philosophy of executing commands on terminals, I'll use python scripts to re-perform the procedure of modelling in SALOME.

#######################################################################
# Geometry construction and meshing creation for a typical
# 2d channel flow between two infinite parallel plates.
#
# Written by: salad
# Manchester, UK
# 06/02/2010
#######################################################################

How to execute these scripts? New a blank study in SALOME and then a 'Python Console' can be seen at the bottom of the window. Input or copy scripts into the console and press Enter to execute them. Scripts can also be saved in a .py file, and with the menu item 'File >> Load Script...' a dialog 'Load python script' can help load script files and execute them as a batch. 'Ctrl+T' is the shortcut to call the dialog.

Ok, let's start. 1. Import the necessary libraries and define the related dimensions. We are going to build a duct with height 5 mm and length 100 mm.

import os
import sys
import salome
from math import *
from geompy import *
import copy

# basic unit
unit = 0.001
# extrusion length
extru = unit

duct_height = unit * 5
duct_length = unit * 100

'extru' is the extrusion length along the z axis. This length will be meshed with only one cell. Actually Code_Saturne only handles 3D meshes with FVM. Therefore, to simulate a 2D mesh, it is a good practice to extrude the 2D mesh with a 1 cell layer thickness.

2. Build the basic coordinate.

#
# basic coordinate
#
p0 = MakeVertex(0, 0, 0)
dx = MakeVectorDXDYDZ(unit, 0, 0)
dy = MakeVectorDXDYDZ(0, unit, 0)
dz = MakeVectorDXDYDZ(0, 0, unit)
addToStudy(p0, "p0")
addToStudy(dx, "dx")
addToStudy(dy, "dy")
addToStudy(dz, "dz")

print "basic coordinate built..."

3. Construct the channel geometry. The geometry modelling procedure can be briefly expressed as: points => edges => faces => extrusion. Points are constructed with coordinates, edges are defined by linking points, and faces are then defined by specifying its edges. Finally extrusion helps convert the 2D geometry to 3D.

#
# geometry construction
#

# points
p1 = MakeVertex(duct_length, 0, 0)
p2 = MakeVertex(0, duct_height, 0)
p3 = MakeVertex(duct_length, duct_height, 0)

# build edges
e0 = MakeEdge(p0, p1)
e1 = MakeEdge(p2, p3)
e2 = MakeEdge(p0, p2)
e3 = MakeEdge(p1, p3)

# build face
f_duct = MakeFaceWires([e0, e1, e2, e3], 1)

# extrude along the z axis
v_duct = MakePrismVecH(f_duct, dz, extru)
addToStudy(v_duct, "v_duct")

print "channel geometry constructed..."

4. Define the groups. Groups are necessary because they correspond to the boundaries used during CFD calculations. Here we define the geometry groups and these groups will then be encapsulated into mesh groups later. Mesh groups will be used to define boundary conditions when using Code_Saturne.

Firstly, define the face groups. Functions used in the python script can be looked up in the SALOME document.

# FACE groups definition:
# 1. inlet
# 2. outlet
# 3. bottom
# 4. top
# 5. sym

# sym is declared and filled
sub_faces = SubShapeAllSorted(v_duct, ShapeType["FACE"])
g_sym = CreateGroup(v_duct, ShapeType["FACE"])
UnionList(g_sym, sub_faces)

# inlet
sub_faces = GetShapesOnPlane(v_duct, ShapeType["FACE"], dx, GEOM.ST_ON)

g_inlet = CreateGroup(v_duct, ShapeType["FACE"])
UnionList(g_inlet, sub_faces)
DifferenceList(g_sym, sub_faces)

addToStudyInFather(v_duct, g_inlet, "inlet")

# outlet
sub_faces = GetShapesOnPlaneWithLocation(v_duct, ShapeType["FACE"], dx, p1, GEOM.ST_ON)

g_outlet = CreateGroup(v_duct, ShapeType["FACE"])
UnionList(g_outlet, sub_faces)
DifferenceList(g_sym, sub_faces)

addToStudyInFather(v_duct, g_outlet, "outlet")

# bottom
sub_faces = GetShapesOnPlane(v_duct, ShapeType["FACE"], dy, GEOM.ST_ON)

g_bottom = CreateGroup(v_duct, ShapeType["FACE"])
UnionList(g_bottom, sub_faces)
DifferenceList(g_sym, sub_faces)

addToStudyInFather(v_duct, g_bottom, "bottom")

# top
sub_faces = GetShapesOnPlaneWithLocation(v_duct, ShapeType["FACE"], dy, p2, GEOM.ST_ON)

g_top = CreateGroup(v_duct, ShapeType["FACE"])
UnionList(g_top, sub_faces)
DifferenceList(g_sym, sub_faces)

addToStudyInFather(v_duct, g_top, "top")

# sym is finally obtained
addToStudyInFather(v_duct, g_sym, "sym")

print "FACE groups defined..."

Then define the edge groups.

# EDGE groups definition:
# 1. let (inlet & outlet of the channel)
# 2. tb (top & bottom of the channel)
# 3. extru (the extrusion length)

# let
g_let = GetEdgesByLength(v_duct, duct_height, duct_height, 1, 1)
addToStudyInFather(v_duct, g_let, "let")

# tb
g_tb = GetEdgesByLength(v_duct, duct_length, duct_length, 1, 1)
addToStudyInFather(v_duct, g_tb, "tb")

# extru
g_extru = GetEdgesByLength(v_duct, extru, extru, 1, 1)
addToStudyInFather(v_duct, g_extru, "extru")

print "EDGE groups defined..."

5. Mesh. Till now the geometry is already produced. Meshing can be performed with the script below. Note that the expressions, which define the corresponding mesh density profiles, can be edited to any others if necessary.

#
# meshing
#
import smesh
import StdMeshers

mesh_d = smesh.Mesh(v_duct, "mesh_d")

print "prepare for meshing..."

# construction of mesh

# as default, a 1D edge is meshed with only 1 cell
# it is for the extrusion length
algo1d = mesh_d.Segment()
algo1d.NumberOfSegments(1)

# structured rectangular mesh is preferred for 2D faces
algo2d = mesh_d.Quadrangle()
algo2d.QuadranglePreference()

algo3d = mesh_d.Hexahedron()

# submesh

# for inlet & outlet, use parabolic mesh density profile
algo1d_let = mesh_d.Segment(g_let)
seg = algo1d_let.NumberOfSegments(50)
seg.SetDistrType(3)
seg.SetConversionMode(1)
seg.SetExpressionFunction('(t-0.5)^2+0.1')

# for top & bottom, use a decreasing profile from the inlet to the outlet
algo1d_tb = mesh_d.Segment(g_tb)
seg = algo1d_tb.NumberOfSegments(250)
seg.SetDistrType(3)
seg.SetConversionMode(0)
seg.SetExpressionFunction('(t-1)^4+0.1')

status = mesh_d.Compute()

print "mesh computed..."

The same with the geometry modelling, groups of mesh are also defined accordingly.

#
# mesh groups
#

mesh_d.GroupOnGeom(g_inlet, "inlet")
mesh_d.GroupOnGeom(g_outlet, "outlet")
mesh_d.GroupOnGeom(g_bottom, "bottom")
mesh_d.GroupOnGeom(g_top, "top")
mesh_d.GroupOnGeom(g_sym, "sym")

print "mesh groups defined..."

Arriving at this, you should be able to update the SALOME GUI to see the mesh generated, and also judge whether it is what you want.

# update
salome.sg.updateObjBrowser(1)

6. Output. After the mesh is produced, it has to be saved into a file before using it with Code_Saturne. In SALOME, right-click the object 'mesh_d' and from the context menu we can see that SALOME supports exporting to MED and UNV file formats. If your Code_Saturne was compiled with MED support, I recommend to use MED because of its smaller file size; or UNV can be used.


Finally a file 'mesh_d.med' (or 'mesh_d.unv') is obtained. This is the mesh file we will move to Code_Saturne's MESH directory.

CFD solving with Code_Saturne

Please read Part II of this article.

Post-processing with ParaView

Please read Part III of this article.

Monday, 4 January 2010

Compile Code_Saturne with SALOME binary libraries

As instructed in "Installation of Code_Saturne 2.0.0 on Ubuntu 9.04", Code_Saturne needs libraries openmpi and metis to support parallel computing, and needs libraries hdf and med to support the MED file format. In the previous post, openmpi was installed by apt-get, however for the other three, metis, hdf and med, the libraries were built from the source code.

If, incidentally, you are also a SALOME user, it is possible to build Code_Saturne with the libraries shipped in the SALOME package. The advantage of doing this is saving time to download the latest source packages and compile them manually. Therefore, briefly, this post introduces the new compilation procedure of CS 2.0.0 with SALOME libraries.

1. install necessary packages using apt-get

:/$ sudo apt-get install build-essential gfortran libxml2 libxml2-dev libatlas-headers libatlas-base-dev openmpi-bin openmpi-dev libibverbs-dev openssh-server python-qt4 pyqt4-dev-tools

2. install SALOME. I assume you install SALOME 5.1.3, the latest version currently

Posts on SALOME installation can be referred and help on this step.

3. compile the four parts, bft, fvm, ecs and ncs. I assume you installed SALOME into "/home/salad/salome_5.1.3/", in which "salad" is my user name, and you have to use yours instead.

# ship into bft-1.1.1
:/$ ./configure
:/$ make
:/$ sudo make install
# ship into fvm-0.14.0
:/$ ./configure --with-hdf5=/home/salad/salome_5.1.3/hdf5-1.6.9 --with-med=/home/salad/salome_5.1.3/med-2.3.6 --with-mpi=/usr/lib/openmpi
:/$ make
:/$ sudo make install
# ship into ecs-2.0.0-beta2
:/$ ./configure --with-hdf5=/home/salad/salome_5.1.3/hdf5-1.6.9 --with-med=/home/salad/salome_5.1.3/med-2.3.6 --with-metis-include=/home/salad/salome_5.1.3/metis-4.0/Lib --with-metis-lib=/home/salad/salome_5.1.3/metis-4.0
:/$ make
:/$ sudo make install
# ship into ncs-2.0.0-beta2
:/$ ./configure --with-mpi=/usr/lib/openmpi --with-prepro=/usr/local LIBS=-lm
:/$ make
:/$ sudo make install

Monday, 7 December 2009

SALOME, on the way to cross-platform

SALOME running on Mac OS X

Unfortunately, I don't have a Mac machine and thus I didn't get any experience on a Mac, because of its big price :(. However, I do suggest you read here if you want to use SALOME on Mac OS X. There is also a nice picture which might bring some hope if you are facing problems.



SALOME version 5.1.2 for Windows platform

Although I knew SALOME was ported onto Windows platform, I didn't try, because regarding such a huge and complicated software package, I don't expect more. However, I also admit that if the Windows version can run well, it is significantly helpful to those who are not familiar with Linux enough. Then I tried this Windows version and, surprisingly, found it works like a charm. Python, C/C++, QT and all of the cross-platform languages and libraries do give us an option to create programs which is compatible with both Linux and Windows simultaneously. It is totally awesome.

Ok, let's look at this SALOME for Windows. From

http://files.salome-platform.org/cea/adam/salomewindows/download/

the zip package (and a patch file) can be downloaded. Unpack the package to wherever you like, run the bat file release\salome.bat, and SALOME will be launched. Its appearance is exactly the same as in Linux. I tried to load a python script I previously wrote. It worked very well.

The patch file salome_utils.py should be copied to the directory release\modules\KERNEL_INSTALL\bin\salome.

Do you want a go?

SALOME version 5.1.3 for tests on Windows

SALOME version 5.1.3 is recently released by CEA/DEN, EDF R&D and OPEN CASCADE on 14th Dec. 2009. As mentioned, it is a public maintenance release that contains planned major and minor improvements plus bug fixes against SALOME version 5.1.2. Read the news for more details and the download page is here.

According to the message published on the SALOME forum, A SALOME 5.1.3 for tests on Windows came to be available on 18th Dec. 2009. The download address is still at http://files.salome-platform.org/cea/adam/salomewindows/download/. The previous version 5.1.2 was moved to the directory "old". Addtionally, a list of known problems can be found at http://sites.google.com/site/wikisalomeplatform/Home/salome-windows/salome-windows-errata.

Probably, for those who are looking forward to using SALOME on Windows, screenshots could bring more pleasant surprises. The screenshots below were taken from Windows 7.



You can also compile SALOME on windows if you like. See a howto at http://sites.google.com/site/wikisalomeplatform/Home/salome-windows/5-1-3/howto-compile.

Saturday, 5 December 2009

Installation of SALOME 5.1.2 on (K)Ubuntu 9.10 64 bit

NEW - A post "Installation of SALOME 5.1.3 on Ubuntu 10.04 (64 bit)" was recently published and recommended if you have already updated to Ubuntu 10.04.

I recently upgraded my Ubuntu 9.04 to the latest 9.10 x86_64 version. In this post I use Kubuntu 9.10 64 bit platform for example to share ideas on some problems you might also encounter when trying to install SALOME 5.1.2. These solutions are compatible with SALOME 5.1.3 and Ubuntu 9.10 as well.

You are recommended to read the basic instructions on how to install SALOME on Ubuntu from "Installation of SALOME 5.1.1 on Ubuntu 9.04", because this post follows that one and only involves the newly fixed problems on 9.10.

1. Error when installing SWIG-1.3.31

This time I didn't compile Code_Saturne before installing SALOME, and I therefore encountered errors complaining the system lacks g++ compiler, since it is impossible to install SWIG from binaries and it has to be built from sources.

The solution is simply installing the compilers:

:/$ sudo apt-get install build-essential

When compiling Code_Saturne, don't need to install the package again.

2. Error when installing HXX2SALOME_5.1.2

The error also occurred when installing SALOME, saying

gzip: stdout: Broken pipe

The reason for this error is because the tar (version 1.22-1) in Ubuntu 9.10 includes a regression. This problem has already been corrected in versions 1.22-1.1 and later, which however are currently not part of Ubuntu 9.10.

In order to solve this, the newer version deb package for proper architecture can be downloaded from Launchpad and installed. For example, I installed tar_1.22-2_amd64.deb and fixed the error.

3. Error related to libg2c.so.0

After fixed the last two errors, although the installation was completed, a warning dialog popped out, saying a mandatory library "libg2c.so.0" was not found. Actually this library file is essential to the mesh module, and if it is absent, the successfully installed mesh module cannot even be initialised.



libg2c is a Fortran/C library. Within previous versions of (K)Ubuntu, it could simply be installed via apt-get (apt-get install libg2c0), but 9.10 does not have this package anymore (or at the moment).

By searching the package, libg2c0 can be found and downloaded. It is worth noting that the package depends on gcc-3.4-base, which is, of course, outdated. Then ignore the dependency, in another word, force to install the package libg2c0.

:/$ sudo dpkg --force-depends -i libg2c0_3.4.6-8ubuntu2_amd64.deb

Now the mesh module could then function.