hftga2foam

SourceForge.net Logo

convert 24bit height field .tga files to blockmesh dictionaries
for the computational fluid dynamics toolbox OpenFOAM

written in 2006 by J. Voss
license: GPL (see file COPYING in source or binary packages)


Contents

Installation

Examples


Installation

From source:
1. unpack source tarball
2. run make
3. run make install, if you want to install the program hftga2foam and its documentation in the corresponding subdirectories of /usr/local
or:
1. install source rpm
2. run rpmbuild -bb hftga2foam.spec to create a binary rpm installation package for your system

From precompiled binary packages:
rpm -i hftga2foam-version-release-arch.rpm for linux
• unzip archive with binary for Win32


Examples

24bit .tga height fields can be generated with, e.g. POV-Ray or hf-lab

With hf-lab, height fields can be converted to .tga from other file formats.
You can also generate fractal height fields. By entering the following commands in hlx, a 64x64 height field fractal.tga is generated:

gforge 64
save "fractal.tga"

Given an OpenFOAM case directory test, this height field is converted by (parameters are suggestions):
hftga2foam fractal.tga test/constant/polyMesh/blockMeshDict 1 0.5 5 2 0.01 1 1 1
where the numbers mean:
1m unit,
• height scaled from [0:1] to [0:0.5]
5 cells in height direction
• grading of 2 in height direction
• below 0.01 height field set to zero
• dimensions of the system 1x1x1

In order to view the mesh in paraFOAM (i.e. ParaView), a directory test/system containing the files controlDict, fvSchemes, and fvSolutions has to be created (for a first test you can simply copy a set of these files from an OpenFOAM tutorial case).
The mesh is generated from the dictionary with:

blockMesh . test
The mesh can then be viewed with (see screenshot below):
paraFoam . test




The following POV-Ray example code will generate a .tga height field of a half sphere (see screenshot below):

#include "colors.inc"

global_settings {hf_gray_16 on}

camera{orthographic location <0,0,5> look_at <0,0,0> up 3.0*y right 3.0*x}

sphere{<0,0,0> 1.0
    texture{
        pigment{
            gradient z
            color_map{
                [0.0 color Black]
                [1.000001 color White]
            }
        }
        finish{ambient 1.0}
    }
}



Last changed: 09/20/2006, 12:30:35