run_probe_computation.sh (2066B)
1 #!/bin/sh 2 3 # Copyright (C) 2021, 2022, 2026 |Meso|Star> (contact@meso-star.com) 4 # 5 # This program is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation, either version 3 of the License, or 8 # (at your option) any later version. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 set -e 19 20 ### USER PARAMETERS SECTION 21 NREAL=10000 22 TIME="10 50 100 200 300 400" 23 FILE="stardis_result_N${NREAL}.txt" 24 ### END USER PARAMETERS SECTION 25 26 #erase FILE result if exists 27 rm -f "${FILE}" 28 29 #check stardis installation 30 if ! command -v stardis > /dev/null ; then 31 >&2 printf '>>> stardis command not found !\n' 32 >&2 printf '>>> To register stardis in the current shell you must type :\n' 33 >&2 printf '>>> . ~/Stardis-XXX-GNU-Linux64/etc/stardis.profile\n' 34 >&2 printf '>>> where ~/Stardis-XXX-GNU-Linux64 is the stardis directory installation\n' 35 exit 1 36 fi 37 38 #launch Stardis for each defined TIME 39 printf '#time Temperature errorbar N_failures N_Realizations\n' >> "${FILE}" 40 for i in ${TIME}; do 41 printf '%s ' "${i}" >> "${FILE}" 42 stardis -V 3 -M model.txt -p 0.5,0.5,0.5,"${i}" -n "${NREAL}" >> "${FILE}" 43 done 44 45 printf '\n' 46 printf '>>> Stardis simulation done\n' 47 printf '>>> Results are writte in %s \n' "${FILE}" 48 printf '\n' 49 50 #plot result with gnuplot 51 if command -v gnuplot > /dev/null 52 then 53 { 54 printf 'plot '\''analytical_T.txt'\'' w l title '\''Analytical'\''\n' 55 printf 'replot '\''%s'\'' u 1:2:3 w yerrorbar title '\''Stardis'\''\n' "${FILE}" 56 printf 'pause -1\n' 57 } > plot.gp 58 gnuplot plot.gp 59 else 60 >&2 printf 'gnuplot is not install on your system. You can install gnuplot or view the simulation results in other tool.\n' 61 fi