keyword kappa is undefined
When I try to paraFoam
a OpenFOAM case that simulated the phase change heat transfer problem, the software crashed and a error message throw out:
keyword kappa is undefined in dictionary "/home/tree/workspace/tut/sphere-shell/D40mm/0/PCM/T.boundaryField.PCM_to_wall"
I used the word lambda
as the thermal conductivity instead of the word kappa
, that may be the problem. But I don't want to change my solver code. I search the internet and can't find a solution.
Then I try other version paraview
, and finally locate the problem.
It is the swak4foam
causes the problem, which was used in the case that shown in my controlDict
file:
libs (
"libgroovyBC.so"
"libsimpleSwakFunctionObjects.so"
"libsimpleFunctionObjects.so"
);
If the swak4foam
was uninstall. When paraFoam
running, some warning instead of fatal errors printed out.
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libgroovyBC.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libgroovyBC.so"
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libsimpleSwakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libsimpleSwakFunctionObjects.so"
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libsimpleFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libsimpleFunctionObjects.so"
Solution:
Remove the swak4foam
.
Axis symmetry problem
I use a tool makeAxisMesh
to convert a 2D plane mesh (I use gambit to create mesh and convert to foam format by fluentMeshToFoam
) to a wedge mesh. However, when I use a high version OF (newer than 2.3), run a application such as checkMesh
, it complains a lot:
...
--> FOAM Warning :
From function wedgePolyPatch::calcGeometry(PstreamBuffers&)
in file meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C at line 72
Wedge patch 'frontAndBackPlanes_pos' is not planar.
At local face at (-0.0124615 0.000142764 6.2273e-06) the normal (3.09651e-16 -0.0435781 0.99905) differs from the average normal (-1.05076e-10 -0.043578 0.99905) by 2.01716e-14
Either correct the patch or split it into planar parts
--> FOAM Warning :
From function wedgePolyPatch::calcGeometry(PstreamBuffers&)
...
Even I try compile the makeAxisMesh
with the high version OpenFOAM, and make mesh with it, fatal error still arose:
--> FOAM FATAL ERROR:
Symmetry plane 'symmetry2' is not planar.
At local face at (0 -0.0497 0) the normal (1 0 0) differs from the average normal (0.561644 0 0) by 0.192156
Either split the patch into planar parts or use the symmetry patch type
From function symmetryPlanePolyPatch::n()
in file meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C at line 64.
FOAM exiting
I don't understand the difference between (1 0 0)
and (0.561644 0 0)
, they actually in same direction.
Solution:
At last, I solve the problem by setting the write format to binary
in the controlDict
and running fluentMeshToFoam
and makeAxisMesh
from the start(in OF2.1.1), and the mesh was accepted by OF2.4.
OpenFOAM multi-region postprocessing
- Of course,
paraview
is a good choice, which can do nearly all the jobs except exporting a vector image. Although it says thatparaview
could export vector format images (1, 2), I never made it. Tecplot
is a very handy CFD postprocessing tool, it can read the OpenFOAM data directly (Tecplot 360 ex 2013) and export high quality vector images. So I try read a multi-region case and find the contours displaying uncorrectly.- At last, I write a python script to do the job. It make a tecplot directory inside the case, and link the data separately in multi-directory corresponding the multi-region. Run the script then load the two cases in
Tecplot
, everything ok.
Solution:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from optparse import OptionParser
from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory
def splitRegions(cwd):
# get the solutiondirectory and it will be used
# to get the regions and time directories
sol = SolutionDirectory(cwd)
if not sol.isValid():
print("Case dir specified is: {},".format(cwd))
print("however, this is not a valid OpenFOAM case directory, CHECK!")
return(1)
# get regions and times directory
regions = sol.getRegions()
if len(regions) is 0:
print("Case dir specified is: {},".format(cwd))
print("however, this is not a multi-region OpenFOAM case, CHECK!")
return(2)
times = sol.getTimes()
print('Three are {} regions and {} times dirs.'.
format(len(regions), len(times)))
print('Regions:')
print(regions)
# make tecplot dir and make links
for region in regions:
# make regions directory in tecplot
regionp = os.path.join(cwd, 'tecplot', region)
if not os.path.exists(regionp):
os.makedirs(regionp)
else:
# if there is old data, remove all and repeat
os.system('rm -r {}'.format(regionp))
os.makedirs(regionp)
# symlink the constant directory
os.symlink(os.path.join(cwd, 'constant', region),
os.path.join(cwd, 'tecplot', region, 'constant'))
# symlink the system direcory
os.symlink(os.path.join(cwd, 'system'),
os.path.join(cwd, 'tecplot', region, 'system'))
# symlink all time directorys
for tdata in times:
os.symlink(os.path.join(cwd, tdata, region),
os.path.join(cwd, 'tecplot', region, tdata))
print('All done!')
def main():
usage = "usage: %prog [options]"
parser = OptionParser(usage)
parser.add_option("-c", "--case",
dest="case",
help="process the OpenFOAM case from CASE")
(options, args) = parser.parse_args()
if options.case is None:
print("Use the current working directory as case directory")
case = os.getcwd()
else:
case = options.case
splitRegions(cwd=case)
if __name__ == "__main__":
main()
Some advice to run OpenFOAM
There are some advice online introducing how to improve the performance of OpenFOAM. I try some of them and record the results here.
The test case is: tutorials/incomprssible/pimpleFoam/TJunctionFan
Configuration | clock time |
---|---|
default (run pimpleFoam ) | 90s |
runTimeModifiable no; | 90s |
writeFormat binary; | 85s |
pimpleFoam > /dev/null | 80s |
./Allrun ( redirect the stdio to log file: > log.pimple) | 83s |