stardis-spk

Scripts and datasets for running Stardis simulations
git clone git://git.meso-star.fr/stardis-spk.git
Log | Files | Refs | README | LICENSE

run_green_evaluation.sh (2426B)


      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 X=0.5
     23 Y=0.5
     24 Z=0.5
     25 SOURCES_AND_BOUNDARIES="CUBE.VP=12  LTEMP.T=290   RTEMP.T=310   ADIA.F=5.2"
     26 GREEN_FILE="probe_X${X}-Y${Y}-Z${Z}_N${NREAL}.green"
     27 SETTINGS_FILE=settings.txt
     28 ### END USER PARAMETERS SECTION
     29 
     30 #check stardis installation
     31 if ! command -v stardis > /dev/null ; then
     32   >&2 printf '>>> stardis command not found !'
     33   >&2 printf '>>> To register stardis in the current shell you must type :'
     34   >&2 printf '>>> . ~/Stardis-XXX-GNU-Linux64/etc/stardis.profile'
     35   >&2 printf '>>> where ~/Stardis-XXX-GNU-Linux64 is the stardis directory installation'
     36   exit 1
     37 fi
     38 
     39 if [ -f "${GREEN_FILE}" ]; then
     40   printf '\n'
     41   printf '>>> %s exists.\n' "${GREEN_FILE}"
     42   printf '>>> Compute probe temperature by applying new source and boundary to the Green function.\n'
     43   printf '\n'
     44   printf '%s\n' "${SOURCES_AND_BOUNDARIES}" > "${SETTINGS_FILE}"
     45   sgreen -g "${GREEN_FILE}" -a "${SETTINGS_FILE}" -e
     46   printf '\n'
     47 
     48 else
     49   printf '\n'
     50   printf '>>> %s does not exist.\n' "${GREEN_FILE}"
     51   printf '>>> Need to compute the Green function with stardis.\n'
     52   printf '\n'
     53 
     54   #launch stardis to produce the Green function for the probe X,Y,Z at steady state
     55   stardis -V3 -M model.txt -p "${X},${Y},${Z}" -n "${NREAL}" -G "${GREEN_FILE}"
     56 
     57   printf '\n'
     58   printf '>>> Now, compute probe temperature by applying new source and boundary to the Green function.\n'
     59   printf '\n'
     60   printf '%s\n' "${SOURCES_AND_BOUNDARIES}" > "${SETTINGS_FILE}"
     61   sgreen -g "${GREEN_FILE}" -a "${SETTINGS_FILE}" -e
     62   sgreen -g "${GREEN_FILE}" -s "${GREEN_FILE}.html"
     63   printf '\n'
     64   printf '>>> A html report (%s.html) was also produced about the Green function.\n' "${GREEN_FILE}"
     65   printf '\n'
     66 fi