#!/bin/bash # 14-08-19 20:02:41 # this script launches a batch of gencase runs that draw floating objects # and reads out the moments of inertia out of the inertia tensor # (diagonal elements); it does not inspect inertia products off the diagonal # Usage note: before starting select the paths, ids and data sets in the section user-defined parts # 23-08-19 19:54:02 # Extended so that you can also run the flow solver and some postprocessing (surface and floating information) # 23-08-19 19:56:28 # This script forked from inertiaconvergence.sh; simplified so that it does not do large for loops # 1 USER-DEFINED PARTS ## functions fail () { echo Execution aborted. # read -n1 -r -p "Press any key to continue..." key exit 1 } function version { # return name and version of $1 # makes some assumption on how binary files are named echo lookfor=$(basename "$1" | sed -e "s/[\._].*//" ) echo version $(basename $1): $( "$1" -h | grep ${lookfor} | grep "[[:digit:]]\.[[:digit:]]" ) } ## functions to extract a single diagonal element of inertia tensor from xml file Ixx() { cat ${diroutgencase}/${name}.xml | grep "&1 | tee -a $0-${mkbound}.out echo #### second object mkbound=${mkbound2} a2=$(Ixx) b2=$(Iyy) c2=$(Izz) # Ixx && Iyy && Izz echo $dx $a2 $b2 $c2 2>&1 | tee -a $0-${mkbound}.out echo #### third object mkbound=${mkbound3} a3=$(Ixx) b3=$(Iyy) c3=$(Izz) # Ixx && Iyy && Izz echo $dx $a3 $b3 $c3 2>&1 | tee -a $0-${mkbound}.out echo sleep 0.5 ### if so requested... if true; then #### starts dualsphysics ${runcpu} -name ${diroutgencase}/${name} -dirout ${dirout} -dirdataout data -stable -svres -sv:vtk,binx # ${runcpu} -name ${diroutgencase}/${name} -dirout ${dirout} -dirdataout data -stable -svres -sv:vtk,binx -gpu:0 if [ $? -ne 0 ] ; then fail; fi #### surfaces (mkbound=10) ${boundaryvtk} -loadvtk ${diroutgencase}/${name}_10_Dp.vtk -filexml ${diroutgencase}/${name}.xml -motiondata ${diroutdata} -savevtkdata ${diroutsurfaces}/Surfaces -onlymk:31,51,52 if [ $? -ne 0 ] ; then fail; fi # motion information (mkbound=10) ${floatinginfo} -dirin ${diroutdata} -onlymk:31,51,52 -savedata ${diroutfloat}/PrismInfo if [ $? -ne 0 ] ; then fail; fi fi done ## shows software versions and close version ${runcpu} version ${rungpu} version ${floatinginfo} version ${gencase} version ${boundaryvtk} echo echo "End of script $0"