mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
217 lines
7.9 KiB
Bash
Executable File
217 lines
7.9 KiB
Bash
Executable File
#----------------------------------*-sh-*--------------------------------------
|
|
# CFDEMcoupling
|
|
# Christoph Goniva
|
|
# June 2012
|
|
#------------------------------------------------------------------------------
|
|
#
|
|
# Script
|
|
# etc/bashrc
|
|
#
|
|
# Description
|
|
# Startup file for cfdem exporting environment variables
|
|
# Sourced ~/.bashrc
|
|
#
|
|
#- adapt this and add to ./bashrc
|
|
#- you can test the correctness using cfdemSystemTest.sh
|
|
|
|
##================================================#
|
|
##- source cfdem env vars
|
|
#export CFDEM_VERSION=PUBLIC
|
|
#export CFDEM_PROJECT_DIR=$HOME/CFDEM/CFDEMcoupling-$CFDEM_VERSION-$WM_PROJECT_VERSION
|
|
#export CFDEM_SRC_DIR=$CFDEM_PROJECT_DIR/src
|
|
#export CFDEM_SOLVER_DIR=$CFDEM_PROJECT_DIR/applications/solvers
|
|
#export CFDEM_DOC_DIR=$CFDEM_PROJECT_DIR/doc
|
|
#export CFDEM_UT_DIR=$CFDEM_PROJECT_DIR/applications/utilities
|
|
#export CFDEM_TUT_DIR=$CFDEM_PROJECT_DIR/tutorials
|
|
#export CFDEM_PROJECT_USER_DIR=$HOME/CFDEM/$LOGNAME-$CFDEM_VERSION-$WM_PROJECT_VERSION
|
|
#export CFDEM_bashrc=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/bashrc
|
|
#export CFDEM_LIGGGHTS_SRC_DIR=$HOME/LIGGGHTS/LIGGGHTS-PUBLIC/src
|
|
#export CFDEM_LIGGGHTS_BIN_DIR=$HOME/LIGGGHTS/LIGGGHTS-PUBLIC/src-build
|
|
#export CFDEM_LIGGGHTS_MAKEFILE_NAME=fedora_fpic # obsolete with CMake
|
|
#export CFDEM_LPP_DIR=$HOME/LIGGGHTS/mylpp/src
|
|
#export CFDEM_PIZZA_DIR=$HOME/LIGGGHTS/PIZZA/gran_pizza_17Aug10/src
|
|
#. $CFDEM_bashrc
|
|
#================================================#
|
|
#------------------------------------------------------------------------------
|
|
|
|
#------------------------------------------------------------------------------
|
|
#- export environment variables (adapt to your paths)
|
|
#------------------------------------------------------------------------------
|
|
|
|
#check if default lammps lib path should be used
|
|
if [[ $CFDEM_LAMMPS_LIB_DIR == "" ]]; then
|
|
export CFDEM_LAMMPS_LIB_DIR=$CFDEM_LIGGGHTS_SRC_DIR/../lib/
|
|
else
|
|
echo "using CFDEM_LAMMPS_LIB_DIR=$CFDEM_LAMMPS_LIB_DIR defined by user."
|
|
fi
|
|
|
|
#- LIGGGHTS lib name
|
|
export CFDEM_LIGGGHTS_LIB_NAME=lmp_$CFDEM_LIGGGHTS_MAKEFILE_NAME
|
|
|
|
#- CFDEM lib name
|
|
export CFDEM_LIB_NAME=lagrangianCFDEM-$CFDEM_VERSION-$WM_PROJECT_VERSION
|
|
|
|
#- CFDEM compressible lib name
|
|
export CFDEM_LIB_COMP_NAME=lagrangianCFDEMcomp-$CFDEM_VERSION-$WM_PROJECT_VERSION
|
|
|
|
#check if additional libraries should be compiled together with solvers
|
|
if [[ $CFDEM_ADD_LIBS_DIR == "" ]]; then
|
|
export CFDEM_ADD_LIBS_DIR=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc
|
|
else
|
|
echo "using CFDEM_ADD_LIBS_DIR=$CFDEM_ADD_LIBS_DIR defined by user."
|
|
fi
|
|
|
|
#-----------------------------------------------------
|
|
# additional libraries
|
|
|
|
#- LMP Many2Many lib path and makefile
|
|
export CFDEM_Many2ManyLIB_PATH=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayMany2Many/library
|
|
export CFDEM_Many2ManyLIB_MAKEFILENAME=$CFDEM_LIGGGHTS_MAKEFILE_NAME
|
|
|
|
#- LMP M2M lib path and makefile
|
|
export CFDEM_M2MLIB_PATH=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/library
|
|
export CFDEM_M2MLIB_MAKEFILENAME=$CFDEM_LIGGGHTS_MAKEFILE_NAME
|
|
|
|
#- LMP POEMS lib path and makefile
|
|
export CFDEM_POEMSLIB_PATH=$CFDEM_LAMMPS_LIB_DIR/poems
|
|
export CFDEM_POEMSLIB_MAKEFILENAME=g++
|
|
|
|
#- LMP ASPHERE lib path and makefile
|
|
export CFDEM_ASPHERELIB_PATH=$CFDEM_LAMMPS_LIB_DIR/poems
|
|
export CFDEM_ASPHERELIB_MAKEFILENAME=g++
|
|
|
|
#-C3PO library
|
|
export C3PO_SRC_DIR=$CFDEM_SRC_DIR/c3po
|
|
#-----------------------------------------------------
|
|
|
|
#- path to test harness
|
|
export CFDEM_TEST_HARNESS_PATH=$CFDEM_PROJECT_USER_DIR/log/logFilesCFDEM-$CFDEM_VERSION-$WM_PROJECT_VERSION
|
|
|
|
#- path to libraries
|
|
export CFDEM_LIB_DIR=$FOAM_USER_LIBBIN
|
|
|
|
#- path to apps
|
|
export CFDEM_APP_DIR=$FOAM_USER_APPBIN
|
|
|
|
#- path to OF version flag file
|
|
export CFDEM_OFVERSION_DIR=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/OFversion
|
|
#------------------------------------------------------------------------------
|
|
#- settings for lpp postproc tool
|
|
#------------------------------------------------------------------------------
|
|
|
|
#- nr of procs for lpp tool
|
|
export CFDEM_LPP_NPROCS=4
|
|
|
|
#- nr of procs for lpp tool
|
|
export CFDEM_LPP_CHUNKSIZE=1
|
|
|
|
#- shortcut to run lpp
|
|
alias lpp='python -i $CFDEM_LPP_DIR/lpp.py --cpunum $CFDEM_LPP_NPROCS --chunksize $CFDEM_LPP_CHUNKSIZE'
|
|
|
|
#------------------------------------------------------------------------------
|
|
#- aliases for easy navigation (no changes necessary)
|
|
#------------------------------------------------------------------------------
|
|
#- shortcut to cfdem path
|
|
alias cfdem='cd $CFDEM_PROJECT_DIR'
|
|
|
|
#- shortcut to src path
|
|
alias cfdemSrc='cd $CFDEM_SRC_DIR'
|
|
|
|
#- shortcut to tutorial path
|
|
alias cfdemTut='cd $CFDEM_TUT_DIR'
|
|
|
|
#- shortcut to solver path
|
|
alias cfdemSol='cd $CFDEM_SOLVER_DIR'
|
|
|
|
#- shortcut to utilities path
|
|
alias cfdemUt='cd $CFDEM_UT_DIR'
|
|
|
|
#- shortcut to run path
|
|
alias cfdemRun='cd $CFDEM_PROJECT_USER_DIR/run'
|
|
|
|
#- shortcut to user solver path
|
|
alias cfdemUsrSol='cd $CFDEM_PROJECT_USER_DIR/applications/solvers'
|
|
|
|
#- shortcut to documentation path
|
|
alias cfdemDoc='cd $CFDEM_DOC_DIR'
|
|
|
|
#- shortcut to open the doxygen with firefox
|
|
alias cfdemDox='firefox $CFDEM_DOC_DIR/doxygen/html/index.html'
|
|
|
|
#- shortcut to LIGGGHTS path
|
|
alias cfdemLIG='cd $CFDEM_LIGGGHTS_SRC_DIR'
|
|
|
|
#- shortcut to system test
|
|
alias cfdemSysTest='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/cfdemSystemTest.sh'
|
|
|
|
#- shortcut to pull LIGGGHTS
|
|
alias cfdemPullLIG='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/pullLIGGGHTS.sh'
|
|
|
|
#- shortcut to pull CFDEMcoupling
|
|
alias cfdemPullCFDEMcoupling='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/pullCFDEMcoupling.sh'
|
|
|
|
#- shortcut to clean CFDEM
|
|
alias cfdemCleanCFDEM='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/cleanCFDEMcoupling.sh'
|
|
|
|
#- shortcut to compile LIGGGHTS + sublibraries
|
|
alias cfdemCompLIG='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileLIGGGHTS.sh'
|
|
|
|
#- shortcut to compile CFDEMcoupling +LIGGGHTS
|
|
alias cfdemCompCFDEMall='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_all.sh'
|
|
|
|
#- shortcut to compile CFDEMcoupling (src+solvers)
|
|
alias cfdemCompCFDEM='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling.sh'
|
|
|
|
#- shortcut to compile CFDEMcoupling src
|
|
alias cfdemCompCFDEMsrc='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh'
|
|
|
|
#- shortcut to compile CFDEMcoupling solvers
|
|
alias cfdemCompCFDEMsol='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_sol.sh'
|
|
|
|
#- shortcut to compile CFDEMcoupling utilities
|
|
alias cfdemCompCFDEMuti='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh'
|
|
|
|
#- shortcut to test basic tutorials
|
|
alias cfdemTestTUT='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/testTutorials.sh'
|
|
|
|
#- shortcut to visualize the clock model data
|
|
alias vizClock='python $CFDEM_UT_DIR/vizClock/matPlot.py'
|
|
|
|
#- recursive touch of current directory
|
|
alias touchRec='find ./* -exec touch {} \;'
|
|
|
|
#- shortcut to run liggghts in serial
|
|
cfdemLiggghts() { $CFDEM_LIGGGHTS_SRC_DIR/lmp_$CFDEM_LIGGGHTS_MAKEFILE_NAME < $1; }
|
|
export -f cfdemLiggghts
|
|
|
|
#- shortcut to run liggghts in parallel
|
|
cfdemLiggghtsPar() { mpirun -np $2 $CFDEM_LIGGGHTS_SRC_DIR/lmp_$CFDEM_LIGGGHTS_MAKEFILE_NAME < $1; }
|
|
export -f cfdemLiggghtsPar
|
|
|
|
#- shortcut to open files including a pattern
|
|
cfdemGrep() { grep -rl "$1" ./* | xargs gedit; }
|
|
export -f cfdemGrep
|
|
|
|
#- shortcut lo list files in a directory
|
|
#cfdemListFiles() { find $1 | sed s:""$1"":: > listOfFiles.txt; } #leave out the dir iteslf in list
|
|
cfdemListFiles() { find $1 > listOfFiles.txt; } #keep the dir in list
|
|
export -f cfdemListFiles
|
|
|
|
# check if the run directory exists
|
|
if [ -d "$CFDEM_PROJECT_USER_DIR" ]; then
|
|
:
|
|
else
|
|
echo "make new dirs $CFDEM_PROJECT_USER_DIR ? (y/n)"
|
|
read YN
|
|
if [ $YN == "y" ]; then
|
|
mkdir -p $CFDEM_PROJECT_USER_DIR
|
|
cd $CFDEM_PROJECT_USER_DIR
|
|
mkdir run
|
|
mkdir -p log/logFilesCFDEM-$CFDEM_VERSION-$WM_PROJECT_VERSION
|
|
mkdir -p applications/solvers
|
|
else
|
|
echo "aborted by user."
|
|
#exit
|
|
fi
|
|
fi
|