Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
1e77abbe
Commit
1e77abbe
authored
May 12, 2011
by
andy
Browse files
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
parents
b9cd469c
10373183
Changes
29
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
1e77abbe
...
...
@@ -60,6 +60,8 @@ doc/[Dd]oxygen/man
# untracked configuration files
/etc/prefs.csh
/etc/prefs.sh
/etc/config/*.csh
/etc/config/*.sh
# source packages - anywhere
*.tar.bz2
...
...
applications/utilities/miscellaneous/expandDictionary/expandDictionary.C
View file @
1e77abbe
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 200
4
-201
0
OpenCFD Ltd.
\\ / A nd | Copyright (C) 200
8
-201
1
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -28,12 +28,33 @@ Description
Read the dictionary provided as an argument, expand the macros etc. and
write the resulting dictionary to standard output.
Usage
- expandDictionary inputDict [OPTION]
\param -list \n
Report the #include/#includeIfPresent to stdout only.
Note
The \c -list option can be useful when determining which files
are actually included by a directory. It can also be used to
determine which files may need to be copied when transferring
simulation to another environment. The following code snippet
could be a useful basis for such cases:
\verbatim
for i in . 0 constant system
do
find $i -maxdepth 1 -type f -exec expandDictionary -list '{}' \;
done | sed -ne '/^"\//!{ s/^"//; s/"$//; p }' | sort | uniq
\endverbatim
\*---------------------------------------------------------------------------*/
#include
"argList.H"
#include
"IFstream.H"
#include
"IOobject.H"
#include
"dictionary.H"
#include
"includeEntry.H"
using
namespace
Foam
;
...
...
@@ -48,6 +69,12 @@ int main(int argc, char *argv[])
"the resulting dictionary to standard output."
);
argList
::
addBoolOption
(
"list"
,
"Report the #include/#includeIfPresent to stdout only"
);
argList
::
noBanner
();
argList
::
noParallel
();
argList
::
validArgs
.
append
(
"inputDict"
);
...
...
@@ -55,12 +82,22 @@ int main(int argc, char *argv[])
const
string
dictName
=
args
[
1
];
IOobject
::
writeBanner
(
Info
)
<<
"//
\n
// "
<<
dictName
<<
"
\n
//
\n
"
;
const
bool
listOpt
=
args
.
optionFound
(
"list"
);
if
(
listOpt
)
{
Foam
::
functionEntries
::
includeEntry
::
report
=
true
;
}
dictionary
(
IFstream
(
dictName
)(),
true
)
.
write
(
Info
,
false
)
;
dictionary
dict
(
IFstream
(
dictName
)(),
true
);
IOobject
::
writeDivider
(
Info
);
if
(
!
listOpt
)
{
IOobject
::
writeBanner
(
Info
)
<<
"//
\n
// "
<<
dictName
<<
"
\n
//
\n
"
;
dict
.
write
(
Info
,
false
);
IOobject
::
writeDivider
(
Info
);
}
return
0
;
}
...
...
applications/utilities/surface/surfaceMeshInfo/Make/files
0 → 100644
View file @
1e77abbe
surfaceMeshInfo.C
EXE = $(FOAM_APPBIN)/surfaceMeshInfo
applications/utilities/surface/surfaceMeshInfo/Make/options
0 → 100644
View file @
1e77abbe
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude
EXE_LIBS = -lmeshTools -lsurfMesh
applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
0 → 100644
View file @
1e77abbe
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
surfaceMeshInfo
Description
Miscellaneous information about surface meshes
Usage
- surfaceMeshInfo surfaceFile [OPTION]
\param -areas \n
Report area for each face.
\param -scale \<scale\> \n
Specify a scaling factor when reading files.
\param -xml \n
Write output in XML format.
Note
The filename extensions are used to determine the file format type.
The XML-like output can be useful for extraction with other tools,
but either output format can be easily extracted with a simple sed
command:
\verbatim
surfaceMeshInfo surfaceFile -areas | \
sed -ne '/areas/,/:/{ /:/!p }'
surfaceMeshInfo surfaceFile -areas -xml | \
sed -ne '/<areas/,/</{ /</!p }'
\endverbatim
\*---------------------------------------------------------------------------*/
#include
"argList.H"
#include
"timeSelector.H"
#include
"Time.H"
#include
"UnsortedMeshedSurfaces.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"information about surface meshes"
);
argList
::
noBanner
();
argList
::
noParallel
();
argList
::
validArgs
.
append
(
"surfaceFile"
);
argList
::
addOption
(
"scale"
,
"factor"
,
"geometry scaling factor - default is 1"
);
argList
::
addBoolOption
(
"areas"
,
"display area of each face"
);
argList
::
addBoolOption
(
"xml"
,
"write output in XML format"
);
argList
args
(
argc
,
argv
);
Time
runTime
(
args
.
rootPath
(),
args
.
caseName
());
const
fileName
importName
=
args
[
1
];
// check that reading is supported
if
(
!
UnsortedMeshedSurface
<
face
>::
canRead
(
importName
,
true
))
{
return
1
;
}
const
bool
writeXML
=
args
.
optionFound
(
"xml"
);
const
bool
writeAreas
=
args
.
optionFound
(
"areas"
);
// use UnsortedMeshedSurface, not MeshedSurface to maintain ordering
UnsortedMeshedSurface
<
face
>
surf
(
importName
);
scalar
scaling
=
0
;
if
(
args
.
optionReadIfPresent
(
"scale"
,
scaling
)
&&
scaling
>
0
)
{
Info
<<
" -scale "
<<
scaling
<<
endl
;
surf
.
scalePoints
(
scaling
);
}
scalar
areaTotal
=
0
;
if
(
writeXML
)
{
Info
<<
"<?xml version='1.0' encoding='utf-8'?>"
<<
nl
<<
"<surfaceMeshInfo>"
<<
nl
<<
"<npoints>"
<<
surf
.
nPoints
()
<<
"</npoints>"
<<
nl
<<
"<nfaces>"
<<
surf
.
size
()
<<
"</nfaces>"
<<
nl
;
if
(
writeAreas
)
{
Info
<<
"<areas size='"
<<
surf
.
size
()
<<
"'>"
<<
nl
;
}
}
else
{
Info
<<
"nPoints : "
<<
surf
.
nPoints
()
<<
nl
<<
"nFaces : "
<<
surf
.
size
()
<<
nl
;
if
(
writeAreas
)
{
Info
<<
"areas : "
<<
nl
;
}
}
forAll
(
surf
,
faceI
)
{
const
scalar
fArea
(
surf
[
faceI
].
mag
(
surf
.
points
()));
areaTotal
+=
fArea
;
if
(
writeAreas
)
{
Info
<<
fArea
<<
nl
;
}
}
if
(
writeXML
)
{
if
(
writeAreas
)
{
Info
<<
"</areas>"
<<
nl
;
}
Info
<<
"<area>"
<<
areaTotal
<<
"</area>"
<<
nl
<<
"</surfaceMeshInfo>"
<<
nl
;
}
else
{
Info
<<
"area : "
<<
areaTotal
<<
nl
;
}
return
0
;
}
// ************************************************************************* //
bin/foamEtcFile
View file @
1e77abbe
...
...
@@ -38,9 +38,13 @@
# && _foamSource $foamPrefs
# \endcode
#
# Note
# This script must exist in <foamInstall>/OpenFOAM-<VERSION>/bin/
# or <foamInstall>/openfoam<VERSION>/bin/ (for the debian version)
#
#-------------------------------------------------------------------------------
usage
()
{
[
"
$quietOpt
"
=
true
]
&&
exit
1
[
"
$
{
quietOpt
:-
$silentOpt
}
"
=
true
]
&&
exit
1
exec
1>&2
while
[
"$#"
-ge
1
]
;
do
echo
"
$1
"
;
shift
;
done
...
...
@@ -53,6 +57,7 @@ options:
-mode <mode> any combination of u(user), g(group), o(other)
-prefix <dir> specify an alternative installation prefix
-quiet suppress all normal output
-silent suppress all stderr output
-version <ver> specify an alternative OpenFOAM version
in the form Maj.Min.Rev (eg, 1.7.0)
-help print the usage
...
...
@@ -72,13 +77,9 @@ USAGE
exit
1
}
#
# This script must exist in <foamInstall>/OpenFOAM-<VERSION>/bin/
# or <foamInstall>/openfoam<VERSION>/bin/ (for the debian version)
#
#-------------------------------------------------------------------------------
# the bindir:
# the bin
dir:
binDir
=
"
${
0
%/*
}
"
# the project dir:
...
...
@@ -128,7 +129,7 @@ esac
# default mode is 'ugo'
mode
=
ugo
unset
listOpt quietOpt
unset
listOpt quietOpt
silentOpt
# parse options
while
[
"$#"
-gt
0
]
...
...
@@ -162,6 +163,9 @@ do
-q
|
-quiet
)
quietOpt
=
true
;;
-s
|
-silent
)
silentOpt
=
true
;;
-v
|
-version
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
version
=
"
$2
"
...
...
@@ -241,7 +245,7 @@ then
# list directories, or potential file locations
[
"
$nArgs
"
-le
1
]
||
usage
# a silly combination, but -quiet
has
precedence
# a silly combination, but -quiet
does have
precedence
[
"
$quietOpt
"
=
true
]
&&
exit
0
for
dir
...
...
bin/foamExec
View file @
1e77abbe
...
...
@@ -31,12 +31,21 @@
# Runs the <foamVersion> version of executable <foamCommand>
# with the rest of the arguments.
#
# Can also be used for parallel runs e.g.
# mpirun -np <nProcs> \
# foamExec -v <foamVersion> <foamCommand> ... -parallel
# Can also be used for parallel runs. For example,
# \code
# mpirun -np <nProcs> \
# foamExec -version <foamVersion> <foamCommand> ... -parallel
# \endcode
#
# Note
# This script must exist in <foamInstall>/OpenFOAM-<VERSION>/bin/
# or <foamInstall>/openfoam<VERSION>/bin/ (for the debian version)
#
# foamEtcFile must be found in the same directory as this script
#
# SeeAlso
# foamEtcFile
#
#------------------------------------------------------------------------------
usage
()
{
exec
1>&2
...
...
@@ -46,9 +55,11 @@ usage() {
Usage:
${
0
##*/
}
[OPTION] <application> ...
options:
-prefix <dir> specify an alternative installation prefix
pass through to foamEtcFile and set as FOAM_INST_DIR
-version <ver> specify an alternative OpenFOAM version
pass through to foamEtcFile
-help
this
usage
-help
print the
usage
* run a particular OpenFOAM version of <application>
...
...
@@ -56,13 +67,21 @@ USAGE
exit
1
}
#
# This script must exist in <foamInstall>/OpenFOAM-<VERSION>/bin/
# or <foamInstall>/openfoam<VERSION>/bin/ (for the debian version)
#
# foamEtcFile must be found in the same directory as this script
#-------------------------------------------------------------------------------
# the bin dir:
binDir
=
"
${
0
%/*
}
"
# the project dir:
projectDir
=
"
${
binDir
%/bin
}
"
# the prefix dir (same as foamInstall):
prefixDir
=
"
${
projectDir
%/*
}
"
# # the name used for the project directory
# projectDirName="${projectDir##*/}"
unset
etcOpts version
# parse options
while
[
"$#"
-gt
0
]
...
...
@@ -71,15 +90,21 @@ do
-h
|
-help
)
usage
;;
-v
|
-version
)
-m
|
-mode
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
etcOpts
=
"
$etcOpts
$1
$2
"
# pass-thru to foamEtcFile
shift
;;
-p
|
-prefix
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
version
=
"
$2
"
etcOpts
=
"
$etcOpts
$1
$2
"
# pass-thru to foamEtcFile
prefixDir
=
"
$2
"
shift
;;
-
m
|
-
mode
|
-p
|
-prefix
)
-
v
|
-
version
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
etcOpts
=
"
$etcOpts
$1
$2
"
# pass-thru to foamEtcFile
version
=
"
$2
"
shift
;;
--
)
...
...
@@ -96,22 +121,21 @@ do
shift
done
#
# Find and source OpenFOAM settings (bashrc)
# placed in function to preserve command-line arguments
#
sourceRc
()
{
# default is the current version
:
${
version
:
=
${
WM_PROJECT_VERSION
:-
unknown
}}
foamDotFile
=
"
$(
${
0
%/*
}
/foamEtcFile
$etcOpts
bashrc
)
"
||
{
echo
"Error : bashrc file could not be found for OpenFOAM-
$version
"
1>&2
foamDotFile
=
"
$(
$binDir
/foamEtcFile
$etcOpts
bashrc
)
"
||
{
echo
"Error : bashrc file could not be found for OpenFOAM-
${
version
:-${
WM_PROJECT_VERSION
:-
???
}}
"
1>&2
exit
1
}
.
$foamDotFile
# set to consistent value before sourcing the bashrc
export
FOAM_INST_DIR
=
"
$prefixDir
"
.
$foamDotFile
$FOAM_SETTINGS
}
...
...
bin/foamJob
View file @
1e77abbe
...
...
@@ -26,6 +26,8 @@
# foamJob
#
# Description
# Run an OpenFOAM job in background.
# Redirects the output to 'log' in the case directory.
#
#------------------------------------------------------------------------------
usage
()
{
...
...
@@ -36,9 +38,9 @@ usage() {
Usage:
${
0
##*/
}
[OPTION] <application> ...
options:
-case <dir> specify alternative case directory, default is the cwd
-p
parallel run of processors
-s
also sends output to screen
-v
<ver> specify
OpenFOAM version
-p
arallel
parallel run of processors
-s
creen
also sends output to screen
-v
ersion <ver> specify an alternative
OpenFOAM version
-help print the usage
* run an OpenFOAM job in background.
...
...
@@ -95,23 +97,22 @@ do
usage
;;
-case
)
[
"$#"
-ge
2
]
||
usage
"'
-case
' option requires an argument"
c
aseDir
=
$2
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
c
d
"
$2
"
2>/dev/null
||
usage
"directory does not exist: '
$2
'"
shift
2
cd
"
$caseDir
"
2>/dev/null
||
usage
"directory does not exist: '
$caseDir
'"
;;
-p
)
-p
|
-parallel
)
parallelOpt
=
true
shift
;;
-s
)
-s
|
-screen
)
screenOpt
=
true
shift
;;
-v
)
shift
version
=
$1
shift
-v
|
-version
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
version
=
"
$2
"
shift
2
;;
--
)
shift
...
...
@@ -126,29 +127,32 @@ do
esac
done
if
[
"$#"
-lt
1
]
then
usage
"No application specified"
fi
[
"$#"
-ge
1
]
||
usage
"No application specified"
# use foamExec for a specified version and for remote (parallel) runs
# use foamExec for a specified version
# also need foamExec for remote (parallel) runs
if
[
-n
"
$version
"
-o
"
$parallelOpt
"
=
true
]
then
APPLICATION
=
`
findExec foamExec
`
if
[
$?
-ne
0
]
# when possible, determine if application even exists
if
[
-z
"
$version
"
]
then
usage
"'foamExec
' not found"
findExec
$1
>
/dev/null
||
usage
"Application '
$1
' not found"
fi
if
[
-n
"
$version
"
]
# use foamExec for dispatching
APPLICATION
=
`
findExec foamExec
`
||
usage
"'foamExec' not found"
[
-n
"
$version
"
]
&&
APPLICATION
=
"
$APPLICATION
-version
$version
"
# attempt to preserve the installation directory 'FOAM_INST_DIR'
if
[
-d
"
$FOAM_INST_DIR
"
]
then
APPLICATION
=
"
$APPLICATION
-
v
$version
"
APPLICATION
=
"
$APPLICATION
-
prefix
$FOAM_INST_DIR
"
fi
else
APPLICATION
=
`
findExec
$1
`
if
[
$?
-ne
0
]
then
usage
"Application '
$1
' executable not found"
fi
APPLICATION
=
`
findExec
$1
`
||
usage
"Application '
$1
' not found"
echo
"Application :
$1
"
shift
fi
...
...
@@ -182,11 +186,7 @@ then
#
# locate mpirun
#
mpirun
=
`
findExec mpirun
`
if
[
$?
-ne
0
]
then
usage
"'mpirun' not found"
fi
mpirun
=
`
findExec mpirun
`
||
usage
"'mpirun' not found"
mpiopts
=
"-np
$NPROCS
"
#
...
...
@@ -217,10 +217,10 @@ then
#
if
[
"
$screenOpt
"
=
true
]
then
echo
"Executing: mpirun
$mpiopts
$APPLICATION
$@
-parallel | tee log"
$mpirun
$mpiopts
$APPLICATION
$@
-parallel
|
tee
log
echo
"Executing:
$
mpirun
$mpiopts
$APPLICATION
$@
-parallel | tee log"
$mpirun
$mpiopts
$APPLICATION
$@
-parallel
|
tee
log
else
echo
"Executing: mpirun
$mpiopts
$APPLICATION
$@
-parallel > log 2>&1"
echo
"Executing:
$
mpirun
$mpiopts
$APPLICATION
$@
-parallel > log 2>&1"
$mpirun
$mpiopts
$APPLICATION
$@
-parallel
>
log 2>&1 &
fi
...
...
doc/changes/inotify.txt
View file @
1e77abbe
...
...
@@ -55,15 +55,25 @@ timestamps as before or the (linux-specific) 'inotify' system framework
- the slave processor directories have no system directory and the
constant directory only contains the mesh.
- start the job in distributed mode by specifying the slave roots
(so one
less
than the number of processors) with
the -roots command
line option:
(so one
fewer
than the number of processors) with
the -roots command
-
line option:
mpirun -np
2
icoFoam -roots '("/tmp")' -parallel
mpirun -np
4
icoFoam -roots '("/tmp"
"/tmp" "/tmp"
)' -parallel
- the alternative to the -roots option is to have a
cavity/system/decomposeParDict on the master with
distributed yes;
roots ("/tmp");
roots ("/tmp" "/tmp" "/tmp");
- as a convenience for cases when the slave roots are identical,
a single root entry is interpreted as being the same for all slaves.
With the -roots command-line option, this can take one of two forms:
mpirun -np 4 icoFoam -roots '("/tmp")' -parallel
or simply
mpirun -np 4 icoFoam -roots '"/tmp"' -parallel
Details:
...
...
etc/apps/paraview3/bashrc
View file @
1e77abbe
...
...
@@ -56,16 +56,22 @@ export ParaView_MAJOR=detect
# Evaluate command-line parameters for ParaView
while
[
$#
-gt
0
]
do
case
"
$1
"
in
ParaView
*
=
*
)