mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy2/OpenFOAM/OpenFOAM-dev/
This commit is contained in:
@ -1,27 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.0 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
// Rcomponents tool definition
|
||||
|
||||
description "Reynolds stress components";
|
||||
|
||||
RcomponentsDict
|
||||
{
|
||||
type dictionary;
|
||||
description "Rcomponents control dictionary";
|
||||
dictionaryPath "system";
|
||||
|
||||
entries
|
||||
{
|
||||
arguments
|
||||
{
|
||||
type rootCaseTimeArguments;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,3 +0,0 @@
|
||||
Rcomponents.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/Rcomponents
|
||||
@ -1,5 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume
|
||||
@ -1,108 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
Rcomponents
|
||||
|
||||
Description
|
||||
Calculates and writes the scalar fields of the six components of the
|
||||
Reynolds stress R for each time.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "addTimeOptions.H"
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
|
||||
// set startTime and endTime depending on -time and -latestTime options
|
||||
# include "checkTimeOptions.H"
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
|
||||
# include "createMesh.H"
|
||||
|
||||
for (label i=startTime; i<endTime; i++)
|
||||
{
|
||||
runTime.setTime(Times[i], i);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
IOobject Rheader
|
||||
(
|
||||
"R",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
// Check R exists
|
||||
if (Rheader.headerOk())
|
||||
{
|
||||
mesh.readUpdate();
|
||||
|
||||
Info<< " Reading R" << endl;
|
||||
volSymmTensorField R(Rheader, mesh);
|
||||
|
||||
for (direction i=0; i<tensor::nComponents; i++)
|
||||
{
|
||||
Info<< " Calculating R" << tensor::componentNames[i] << endl;
|
||||
|
||||
volScalarField Ri
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"R" + word(tensor::componentNames[i]),
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
R.component(i)
|
||||
);
|
||||
Ri.write();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " No R" << endl;
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1 +0,0 @@
|
||||
EXE_LIBS =
|
||||
@ -1,27 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.0 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
// magGradU tool definition
|
||||
|
||||
description "Magnitude of grad(U) calculation";
|
||||
|
||||
magGradUDict
|
||||
{
|
||||
type dictionary;
|
||||
description "magGradU control dictionary";
|
||||
dictionaryPath "system";
|
||||
|
||||
entries
|
||||
{
|
||||
arguments
|
||||
{
|
||||
type rootCaseTimeArguments;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,3 +0,0 @@
|
||||
magGradU.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/magGradU
|
||||
@ -1,6 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
|
||||
@ -1,103 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
magGradU
|
||||
|
||||
Description
|
||||
Calculates and writes the scalar magnitude of velocity field U at each time
|
||||
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "addTimeOptions.H"
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
|
||||
// set startTime and endTime depending on -time and -latestTime options
|
||||
# include "checkTimeOptions.H"
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
|
||||
# include "createMesh.H"
|
||||
|
||||
for (label i=startTime; i<endTime; i++)
|
||||
{
|
||||
runTime.setTime(Times[i], i);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
IOobject Uheader
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
// Check U exists
|
||||
if (Uheader.headerOk())
|
||||
{
|
||||
mesh.readUpdate();
|
||||
|
||||
Info<< " Reading U" << endl;
|
||||
volVectorField U(Uheader, mesh);
|
||||
|
||||
Info<< " Calculating magGradU" << endl;
|
||||
volScalarField magGradU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"magGradU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
mag(fvc::grad(U))
|
||||
);
|
||||
magGradU.write();
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " No U" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
0
applications/utilities/preProcessing/molConfig/correctVelocities.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/correctVelocities.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/createMolecules.C
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/createMolecules.C
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/createPositions.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/createPositions.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/createVelocities.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/createVelocities.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/genMolConfig.C
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/genMolConfig.C
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/latticeStructures/BCC.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/latticeStructures/BCC.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/latticeStructures/FCC.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/latticeStructures/FCC.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/latticeStructures/SC.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/latticeStructures/SC.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/molConfig.C
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/molConfig.C
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/molConfig.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/molConfig.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/molConfigI.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/molConfigI.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/origin.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/origin.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/readZoneSubDict.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/readZoneSubDict.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/startingPoint.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/startingPoint.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/velocityDistributions/maxwellian.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/velocityDistributions/maxwellian.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/velocityDistributions/uniform.H
Executable file → Normal file
0
applications/utilities/preProcessing/molConfig/velocityDistributions/uniform.H
Executable file → Normal file
@ -1,156 +1,75 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# buildParaView
|
||||
#
|
||||
# Description
|
||||
# Build and install ParaView
|
||||
# - run from folder above source folder
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
set -x
|
||||
|
||||
# ParaView 3.x build script
|
||||
# - run from folder above source folder
|
||||
. $WM_PROJECT_DIR/bin/buildParaViewFunctions
|
||||
|
||||
PARAVIEW_SRC="ParaView3.3-cvs"
|
||||
PARAVIEW_MAJOR_VERSION="3.2"
|
||||
|
||||
VERBOSE="OFF"
|
||||
INCLUDE_MPI="ON"
|
||||
MPI_MAX_PROCS=32
|
||||
INCLUDE_PYTHON="ON"
|
||||
#PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0"
|
||||
PYTHON_LIBRARY=""
|
||||
INCLUDE_MESA="OFF"
|
||||
|
||||
# initialisation
|
||||
CMAKE_VARIABLES=""
|
||||
PWD=`pwd`
|
||||
OBJ_ADD=""
|
||||
|
||||
# set general options
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DBUILD_SHARED_LIBS:BOOL=ON"
|
||||
|
||||
if [ "$VERBOSE" = "ON" ]; then
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DCMAKE_VERBOSE_MAKEFILE=TRUE"
|
||||
fi
|
||||
initialiseVariables
|
||||
|
||||
# set MPI specific options
|
||||
if [ "$INCLUDE_MPI" = "ON" ]; then
|
||||
OBJ_ADD="$OBJ_ADD-mpi"
|
||||
|
||||
if [ "$WM_MPLIB" = "OPENMPI" ]; then
|
||||
MPI_INCLUDE_PATH=$OPENMPI_ARCH_PATH/include
|
||||
MPI_LIBRARY=$OPENMPI_ARCH_PATH/lib/libmpi.so
|
||||
MPI_RUN=$OPENMPI_ARCH_PATH/bin/mpirun
|
||||
elif [ "$WM_MPLIB" = "LAM" ]; then
|
||||
MPI_INCLUDE_PATH=$LAM_ARCH_PATH/include
|
||||
MPI_LIBRARY=$LAM_ARCH_PATH/lib/libmpi.so
|
||||
MPI_RUN=$LAM_ARCH_PATH/bin/mpirun
|
||||
elif [ "$WM_MPLIB" = "MPICH" ]; then
|
||||
MPI_INCLUDE_PATH=$MPICH_ARCH_PATH/include
|
||||
MPI_LIBRARY=$MPICH_ARCH_PATH/lib/libmpich.so
|
||||
MPI_RUN=$MPICH_ARCH_PATH/bin/mpirun
|
||||
fi
|
||||
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_USE_MPI=ON"
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DPARAVIEW_USE_MPI=ON"
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DMPI_INCLUDE_PATH=$MPI_INCLUDE_PATH"
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DMPI_LIBRARY=$MPI_LIBRARY"
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_MPIRUN_EXE=$MPI_RUN"
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
|
||||
addMpiSupport
|
||||
fi
|
||||
|
||||
# set python specific options
|
||||
if [ "$INCLUDE_PYTHON" = "ON" ]; then
|
||||
WHICH_PYTHON=`which python`
|
||||
if [ "$WHICH_PYTHON" != "" ]; then
|
||||
OBJ_ADD="$OBJ_ADD-py"
|
||||
|
||||
PYTHON_LIBRARY=`ldd $WHICH_PYTHON | grep libpython | \
|
||||
sed 's/.* => \(.*\) (.*/\1/'`
|
||||
PYTHON_MAJOR_VERSION=`echo $PYTHON_LIBRARY | \
|
||||
sed 's/.*libpython\(.*\).so.*/\1/'`
|
||||
PYTHON_INCLUDE_DIR=/usr/include/python$PYTHON_MAJOR_VERSION
|
||||
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DPARAVIEW_ENABLE_PYTHON=ON"
|
||||
CMAKE_VARIABLES= \
|
||||
"$CMAKE_VARIABLES -DPYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_DIR"
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DPYTHON_LIBRARY=$PYTHON_LIBRARY"
|
||||
else
|
||||
echo "*** Warning: Unable to determine python libray"
|
||||
echo "*** De-activating python support"
|
||||
INCLUDE_PYTHON="OFF"
|
||||
fi
|
||||
addPythonSupport
|
||||
fi
|
||||
|
||||
# set MESA specific options
|
||||
if [ "$INCLUDE_MESA" = "ON" ]; then
|
||||
OBJ_ADD="$OBJ_ADD-mesa"
|
||||
|
||||
MESA_INCLUDE_DIR=/usr/include/GL
|
||||
MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so
|
||||
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DVTK_OPENGL_HAS_OSMESA=ON"
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DOSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR"
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -DOSMESA_LIBRARY=$MESA_LIBRARY"
|
||||
addMesaSupport
|
||||
fi
|
||||
|
||||
# set paraview environment
|
||||
PARAVIEW_SRC_DIR=$PWD/$PARAVIEW_SRC
|
||||
#PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD
|
||||
PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS
|
||||
buildParaView
|
||||
|
||||
# remove existing build folder if present
|
||||
if [ -e "$PARAVIEW_OBJ_DIR" ]; then
|
||||
rm -rf $PARAVIEW_OBJ_DIR
|
||||
fi
|
||||
|
||||
# create paraview build folder
|
||||
mkdir -p $PARAVIEW_OBJ_DIR
|
||||
cd $PARAVIEW_OBJ_DIR
|
||||
|
||||
echo "Building $PARAVIEW_SRC"
|
||||
echo " MPI support : $INCLUDE_MPI"
|
||||
echo " Python support : $INCLUDE_PYTHON"
|
||||
echo " MESA support : $INCLUDE_MESA"
|
||||
echo " Source : $PARAVIEW_SRC_DIR"
|
||||
echo " Target : $PARAVIEW_OBJ_DIR"
|
||||
|
||||
# make paraview
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \
|
||||
$CMAKE_VARIABLES \
|
||||
$PARAVIEW_SRC_DIR
|
||||
|
||||
if [ -r /proc/cpuinfo ]; then
|
||||
WM_NCOMPPROCS=`egrep "^processor" /proc/cpuinfo | wc -l`
|
||||
|
||||
if [ $WM_NCOMPPROCS -gt 8 ]; then
|
||||
WM_NCOMPPROCS=8
|
||||
fi
|
||||
|
||||
make -j $WM_NCOMPPROCS
|
||||
else
|
||||
make
|
||||
fi
|
||||
|
||||
if [ -e "$PARAVIEW_OBJ_DIR/bin/paraview" ]; then
|
||||
echo " Build complete"
|
||||
|
||||
# replace local links with ParaView_INST_DIR environment variables
|
||||
echo " Replacing path hard links"
|
||||
find . -iname \*.cmake -execdir sed -i \
|
||||
"s,$PARAVIEW_SRC_DIR,\$ENV{ParaView_INST_DIR},g" {} ';' \
|
||||
-print
|
||||
|
||||
# create a softlink to the $PARAVIEW_OBJ_DIR/bin folder
|
||||
echo " Creating paraview 3.2 soft link to /bin"
|
||||
( mkdir lib && cd lib && ln -s ../bin paraview-3.2 )
|
||||
|
||||
# info on symlinks to screen
|
||||
echo ""
|
||||
echo " ---"
|
||||
echo " Installation complete"
|
||||
echo " Set environment variables:"
|
||||
echo " - ParaView_INST_DIR to $PARAVIEW_SRC_DIR"
|
||||
echo " - ParaView_DIR to $PARAVIEW_OBJ_DIR"
|
||||
echo " - PV_PLUGIN_PATH to $FOAM_LIBBIN"
|
||||
echo " Add $PARAVIEW_OBJ_DIR/bin to PATH"
|
||||
#echo " Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH"
|
||||
echo " ---"
|
||||
echo "done."
|
||||
fi
|
||||
installParaView
|
||||
|
||||
# finalisation
|
||||
cd $PWD
|
||||
|
||||
echo "done."
|
||||
|
||||
|
||||
221
bin/buildParaViewFunctions
Normal file
221
bin/buildParaViewFunctions
Normal file
@ -0,0 +1,221 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# buildParaViewFunctions
|
||||
#
|
||||
# Description
|
||||
# ParaView build/install helper functions
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
initialiseVariables ()
|
||||
{
|
||||
CMAKE_VARIABLES=""
|
||||
PWD=`pwd`
|
||||
OBJ_ADD=""
|
||||
|
||||
if [ "$VERBOSE" = "ON" ]; then
|
||||
addCMakeVariable "CMAKE_VERBOSE_MAKEFILE=TRUE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
addCMakeVariable ()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
echo "*** Error: addCMakeVariable()"
|
||||
echo " No variable to add"
|
||||
fi
|
||||
|
||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
|
||||
}
|
||||
|
||||
|
||||
addMpiSupport ()
|
||||
{
|
||||
OBJ_ADD="$OBJ_ADD-mpi"
|
||||
|
||||
# using OpenFOAM variables to identify location of MPI libraries
|
||||
if [ "$WM_MPLIB" = "OPENMPI" ]; then
|
||||
MPI_INCLUDE_PATH=$OPENMPI_ARCH_PATH/include
|
||||
MPI_LIBRARY=$OPENMPI_ARCH_PATH/lib/libmpi.so
|
||||
MPI_RUN=$OPENMPI_ARCH_PATH/bin/mpirun
|
||||
elif [ "$WM_MPLIB" = "LAM" ]; then
|
||||
MPI_INCLUDE_PATH=$LAM_ARCH_PATH/include
|
||||
MPI_LIBRARY=$LAM_ARCH_PATH/lib/libmpi.so
|
||||
MPI_RUN=$LAM_ARCH_PATH/bin/mpirun
|
||||
elif [ "$WM_MPLIB" = "MPICH" ]; then
|
||||
MPI_INCLUDE_PATH=$MPICH_ARCH_PATH/include
|
||||
MPI_LIBRARY=$MPICH_ARCH_PATH/lib/libmpich.so
|
||||
MPI_RUN=$MPICH_ARCH_PATH/bin/mpirun
|
||||
fi
|
||||
|
||||
addCMakeVariable "VTK_USE_MPI=ON"
|
||||
addCMakeVariable "PARAVIEW_USE_MPI=ON"
|
||||
addCMakeVariable "MPI_INCLUDE_PATH=$MPI_INCLUDE_PATH"
|
||||
addCMakeVariable "MPI_LIBRARY=$MPI_LIBRARY"
|
||||
addCMakeVariable "VTK_MPIRUN_EXE=$MPI_RUN"
|
||||
addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
|
||||
}
|
||||
|
||||
|
||||
addPythonSupport ()
|
||||
{
|
||||
WHICH_PYTHON=`which python`
|
||||
if [ -n "$WHICH_PYTHON" ]; then
|
||||
OBJ_ADD="$OBJ_ADD-py"
|
||||
|
||||
if [ -n "$PYTHON_LIBRARY" ]; then
|
||||
# check $PYTHON_LIBRARY if it has been set
|
||||
if [ ! -e "$PYTHON_LIBRARY" ]; then
|
||||
echo "*** Error: libpython not found at location specified " \
|
||||
"by PYTHON_LIBRARY: $PYTHON_LIBRARY"
|
||||
echo " Please set the variable PYTHON_LIBRARY to the full"
|
||||
echo " path to (and including) libpython, or deactivate"
|
||||
echo " python support by setting INCLUDE_PYTHON=OFF"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Try to obtain $PYTHON_LIBRARY if not set
|
||||
# - assumes dynamically linked
|
||||
PYTHON_LIBRARY=`ldd $WHICH_PYTHON | grep libpython | \
|
||||
sed 's/.* => \(.*\) (.*/\1/'`
|
||||
fi
|
||||
|
||||
if [ ! -n "$PYTHON_LIBRARY" ]; then
|
||||
echo "*** Error: Unable to determine path to python library."
|
||||
echo " Please set the variable PYTHON_LIBRARY to the full"
|
||||
echo " path to (and including) libpython, or deactivate"
|
||||
echo " python support by setting INCLUDE_PYTHON=OFF"
|
||||
exit 1
|
||||
fi
|
||||
PYTHON_MAJOR_VERSION=`echo $PYTHON_LIBRARY | \
|
||||
sed 's/.*libpython\(.*\).so.*/\1/'`
|
||||
PYTHON_INCLUDE_DIR=/usr/include/python$PYTHON_MAJOR_VERSION
|
||||
|
||||
addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON"
|
||||
addCMakeVariable "PYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_DIR"
|
||||
addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY"
|
||||
else
|
||||
echo "*** Error: python not installed"
|
||||
echo "*** De-activate python support by setting " \
|
||||
"INCLUDE_PYTHON=OFF"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
addMesaSupport ()
|
||||
{
|
||||
OBJ_ADD="$OBJ_ADD-mesa"
|
||||
|
||||
MESA_INCLUDE_DIR=/usr/include/GL
|
||||
MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so
|
||||
|
||||
addCMakeVariable "VTK_OPENGL_HAS_OSMESA=ON"
|
||||
addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR"
|
||||
addCMakeVariable "OSMESA_LIBRARY=$MESA_LIBRARY"
|
||||
}
|
||||
|
||||
|
||||
buildParaView ()
|
||||
{
|
||||
# set general options
|
||||
addCmakeVariable "DBUILD_SHARED_LIBS:BOOL=ON"
|
||||
|
||||
# set paraview environment
|
||||
PARAVIEW_SRC_DIR=$PWD/$PARAVIEW_SRC
|
||||
#PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD
|
||||
PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS
|
||||
|
||||
# remove existing build folder if present
|
||||
if [ -e "$PARAVIEW_OBJ_DIR" ]; then
|
||||
rm -rf $PARAVIEW_OBJ_DIR
|
||||
fi
|
||||
|
||||
# create paraview build folder
|
||||
mkdir -p $PARAVIEW_OBJ_DIR
|
||||
cd $PARAVIEW_OBJ_DIR
|
||||
|
||||
echo "Building $PARAVIEW_SRC"
|
||||
echo " MPI support : $INCLUDE_MPI"
|
||||
echo " Python support : $INCLUDE_PYTHON"
|
||||
echo " MESA support : $INCLUDE_MESA"
|
||||
echo " Source : $PARAVIEW_SRC_DIR"
|
||||
echo " Target : $PARAVIEW_OBJ_DIR"
|
||||
|
||||
# make paraview
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \
|
||||
$CMAKE_VARIABLES \
|
||||
$PARAVIEW_SRC_DIR
|
||||
|
||||
if [ -r /proc/cpuinfo ]; then
|
||||
WM_NCOMPPROCS=`egrep "^processor" /proc/cpuinfo | wc -l`
|
||||
|
||||
if [ $WM_NCOMPPROCS -gt 8 ]; then
|
||||
WM_NCOMPPROCS=8
|
||||
fi
|
||||
|
||||
make -j $WM_NCOMPPROCS
|
||||
else
|
||||
make
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
installParaView ()
|
||||
{
|
||||
if [ -e "$PARAVIEW_OBJ_DIR/bin/paraview" ]; then
|
||||
echo " Build complete"
|
||||
|
||||
cd $PARAVIEW_OBJ_DIR
|
||||
|
||||
# replace local links with ParaView_INST_DIR environment variables
|
||||
echo " Replacing path hard links"
|
||||
find . -iname \*.cmake -execdir sed -i \
|
||||
"s,$PARAVIEW_SRC_DIR,\$ENV{ParaView_INST_DIR},g" {} ';' \
|
||||
-print
|
||||
|
||||
# create a softlink to the $PARAVIEW_OBJ_DIR/bin folder
|
||||
# - work-around for chosen install location
|
||||
echo " Creating paraview $PARAVIEW_MAJOR_VERSION soft link to /bin"
|
||||
( mkdir lib && cd lib && ln -s ../bin \
|
||||
paraview-$PARAVIEW_MAJOR_VERSION )
|
||||
|
||||
# info on symlinks to screen
|
||||
echo ""
|
||||
echo " ---"
|
||||
echo " Installation complete"
|
||||
echo " Set environment variables:"
|
||||
echo " - ParaView_INST_DIR to $PARAVIEW_SRC_DIR"
|
||||
echo " - ParaView_DIR to $PARAVIEW_OBJ_DIR"
|
||||
echo " - PV_PLUGIN_PATH to $FOAM_LIBBIN"
|
||||
echo " Add $PARAVIEW_OBJ_DIR/bin to PATH"
|
||||
#echo " Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH"
|
||||
echo " ---"
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user