This file is indexed.

/usr/share/code_saturne/runcase_syrthes is in code-saturne-data 2.1.0-4ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
#!/bin/sh

#-------------------------------------------------------------------------------

# This file is part of Code_Saturne, a general-purpose CFD tool.
#
# Copyright (C) 1998-2011 EDF S.A.
#
# This program 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.
#
# This program 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
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA.

#-------------------------------------------------------------------------------

#===============================================================================
# Handle SYRTHES files when coupled: compile, copy data, or copy results
#
# Command-line arguments are described by the usage message below.
#===============================================================================

# Indicate usage

if [ "$1" = "" -o "$1" = "-h" -o "$1" = "--help" ] ; then
  echo "Usage:"
  echo
  echo "  $0 -compile -cs-bindir=<dir> [-src-syr=<dir>] [-copy-dir=<dir>]"
  echo "              [-log-dir=<dir>] [-exec-dir=<dir>]"
  echo
  echo "   Indicate where to find Code_Saturne main user script:"
  echo "     -cs-bindir: directory where is installed Code_Saturne binaries."
  echo
  echo "   Compile and link SYRTHES, with the following optional arguments:"
  echo "     -src-syr:   source code directory; if none, link only."
  echo "     -src-copy:  directory in which sources are copied."
  echo "     -log:       file to which the compilation/link log is copied."
  echo "     -exec-dir:  SYRTHES execution diretory."
  echo
  echo "or:"
  echo
  echo "  $0 -copy-data -syrthes-env=<dir> [-exec-dir=<dir>]"
  echo
  echo "   Copy data to execution directory based on syrthes.env file:"
  echo "     -syrthes-env: full pathname for syrthes.env file."
  echo "     -exec-dir: SYRTHES execution directory."
  echo
  echo "or:"
  echo
  echo "  $0 -copy-results -result-dir=<dir> [-exec-dir=<dir>]"
  echo
  echo "   Copy results to result directory:"
  echo "     -result-dir:  directory in which results are saved."
  echo "     -exec-dir: SYRTHES execution directory."
  echo
  exit 0
fi

# Parse secondary arguments

unset CS_BINDIR
unset SRC_SYR
unset EXEC_DIR
unset RESULT_DIR
unset SYRTHES_ENV

for arg in $*
do

  is_cs_bindir=`echo $arg | grep -e "-cs-bindir="`
  if [ "$is_cs_bindir" != "" ] ; then
    CS_BINDIR=`echo $arg | sed -e "s/-cs-bindir=//"`
  fi

  is_exec_dir=`echo $arg | grep -e "-exec-dir="`
  if [ "$is_exec_dir" != "" ] ; then
    EXEC_DIR=`echo $arg | sed -e "s/-exec-dir=//"`
  fi

  is_src_syr=`echo $arg | grep -e "-src-syr="`
  if [ "$is_src_syr" != "" ] ; then
    SRC_SYR=`echo $arg | sed -e "s/-src-syr=//"`
  fi

  is_log=`echo $arg | grep -e "-log="`
  if [ "$is_log" != "" ] ; then
    LOG_COPY=`echo $arg | sed -e "s/-log=//"`
  fi

  is_src_copy=`echo $arg | grep -e "-src-copy="`
  if [ "$is_src_copy" != "" ] ; then
    SRC_COPY=`echo $arg | sed -e "s/-src-copy=//"`
  fi

  is_syrthes_env=`echo $arg | grep -e "-syrthes-env="`
  if [ "$is_syrthes_env" != "" ] ; then
    SYRTHES_ENV=`echo $arg | sed -e "s/-syrthes-env=//"`
  fi

  is_result_dir=`echo $arg | grep -e "-result-dir="`
  if [ "$is_result_dir" != "" ] ; then
    RESULT_DIR=`echo $arg | sed -e "s/-result-dir=//"`
  fi

done

if [ "${EXEC_DIR}" = "" ]
then
  EXEC_DIR="."
fi

########################################################################

if [ "$1" = "-compile" ] ; then

  echo
  echo  "  **********************************************************"
  echo  "   Compilation of the user subroutines and link of SYRTHES"
  echo  "  **********************************************************"

  cur_dir=`pwd`
  user_files=no
  mkdir $EXEC_DIR/src_syrthes
  cd $EXEC_DIR/src_syrthes
  if [ "${SRC_SYR}" != "" ]
  then
    for f in $SRC_SYR/*.[F,c,h] ; do
      if [ -f $f ] ; then
        cp ${f} .
        user_files=yes
      fi
    done
  fi

  ${CS_BINDIR}/code_saturne compile --syrthes > ./compil.log 2>&1
  make_ret=$?

  if [ "${LOG_COPY}" != "" ] ; then
    cp ./compil.log ${LOG_COPY}
  fi

  if [ $user_files = yes -a "${SRC_COPY}" != "" ] ; then
    if [ ! -d ${SRC_COPY} ] ; then
      mkdir ${SRC_COPY}
    fi
    if [ -d ${SRC_COPY} ] ; then
      for f in *.[f,F,c,h] ; do
        if [ -f ${f} ] ; then
          cp -R ${f} ${SRC_COPY}/
          fbase=`basename ${f}`
          # chmod a-w $RESULT_DIR/${fbase}
        fi
      done
    fi
  fi

  if [ $make_ret -ne 0 ] ; then
    echo "SYRTHES compile or link error."
    exit 1
  fi

  mv syrthes $cur_dir/
  cd $cur_dir

fi

########################################################################

# Extract information from the syrthes.env file

if [ "$1" = "-copy-data" -o "$1" = "-copy-results" ] ; then

  if [ "$1" = "-copy-results" ] ; then
    SYRTHES_ENV="${EXEC_DIR}/syrthes.env.ref"
    if [ ! -f $SYRTHES_ENV ] ; then
      SYRTHES_ENV="${EXEC_DIR}/syrthes.env"
    fi
    if [ ! -f $SYRTHES_ENV ] ; then
      echo "No syrthes.env in ${EXEC_DIR}; no results copied."
      exit 1
    fi
  elif [ ! -f $SYRTHES_ENV ] ; then
    echo "No syrthes.env defined; no data copied."
    exit 1
  fi

  SYR_IN=`grep "AMONT :" $SYRTHES_ENV | sed -e "s/^.*: *//" -e "s/ //g"`
  SYR_OUT=` grep "AVAL :"  $SYRTHES_ENV | sed -e "s/^.*: *//" -e "s/ //g"`
  SYR_RESTART=`grep "SUITE :" $SYRTHES_ENV | sed -e "s/^.*: *//" -e "s/ //g"`
  SYRTHES_DATA=`grep "DONNEES DU CALCUL :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_GEOM=`grep "GEOMETRIE SOLIDE :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_SUIT=`grep "SUITE SOLIDE RESU :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_DATA_RAY=`grep "DONNEES POUR LE RAYONNEMENT :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_MAIL_RAY=`grep "MAILLAGE RAYONNEMENT :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_CORR=`grep "STOCKAGE DES CORRESPONDANTS :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_FFOR_RAY=`grep "FACTEURS DE FORME RAYONNEMENT :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_CORR_RAY=`grep "STOCKAGE DES CORRESPONDANTS RAYONNEMENT :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_OUT_RES1=`grep "RESU SYRTHES 1 :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_OUT_RES2=`grep "RESU SYRTHES 2 :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_OUT_CHR2=`grep "CHRONO SYRTHES 2 :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_OUT_HIST=`grep "HISTORIQUE SOLIDE RESULTAT :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_OUT_MAIL_PEAU_FLUIDE=`grep "MAILLAGE PEAU FLUIDE :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_OUT_RESU_PEAU_FLUIDE=`grep "RESULTATS PEAU FLUIDE :" $SYRTHES_ENV | sed -e "s/^.*: *//"`
  SYRTHES_OUT_CHR_PEAU_FLUIDE=`grep "CHRONO PEAU FLUIDE :" $SYRTHES_ENV | sed -e "s/^.*: *//"`

  # if empty, we use default names for results:
  if [ -z "$SYRTHES_CORR" ] ; then
    SYRTHES_CORR="corresp"
  fi
  if [ -z "$SYRTHES_CORR_RAY" ] ; then
    SYRTHES_CORR_RAY="corresp_ray"
  fi
  if [ -z "$SYRTHES_FFOR_RAY" ] ; then
    SYRTHES_FFOR_RAY="fdf_ray"
  fi
  if [ -z "$SYRTHES_OUT_RES1" ] ; then
    SYRTHES_OUT_RES1="geoms"
  fi
  if [ -z "$SYRTHES_OUT_RES2" ] ; then
    SYRTHES_OUT_RES2="resus"
  fi
  if [ -z "$SYRTHES_OUT_CHR2" ] ; then
    SYRTHES_OUT_CHR2="chronos"
  fi
  if [ -z "$SYRTHES_OUT_HIST" ] ; then
    SYRTHES_OUT_HIST="histos"
  fi
  if [ -z "$SYRTHES_OUT_MAIL_PEAU_FLUIDE" ] ; then
    SYRTHES_OUT_MAIL_PEAU_FLUIDE="geomf_ef"
  fi
  if [ -z "$SYRTHES_OUT_RESU_PEAU_FLUIDE" ] ; then
    SYRTHES_OUT_RESU_PEAU_FLUIDE="resuf_ef"
  fi
  if [ -z "$SYRTHES_OUT_CHR_PEAU_FLUIDE" ] ; then
    SYRTHES_OUT_CHR_PEAU_FLUIDE="chronof_ef"
  fi
  if [ -z "$SYRTHES_OUT_MAIL_RAY" ] ; then
    SYRTHES_OUT_MAIL_RAY="resu_ray.geom"
  fi
  if [ -z "$SYRTHES_OUT_RESU_RAY" ] ; then
    SYRTHES_OUT_RESU_RAY="resu_ray"
  fi
  if [ -z "$SYRTHES_OUT_CHR_RAY" ] ; then
    SYRTHES_OUT_CHR_RAY="chrono_ray"
  fi
  if [ -z "$SYRTHES_OUT_HIST_RAY" ] ; then
    SYRTHES_OUT_HIST_RAY="histor"
  fi

fi

########################################################################

# Build a local copy of the syrthes.env file in which all files are
# local. The initial file is backed-up so that it may be copied with
# results afterwards.

if [ "$1" = "-copy-data" ] ; then

  cp $SYRTHES_ENV  ${EXEC_DIR}/syrthes.env.ref

  sed -e "s/:.*\//: /" \
      -e "s/AMONT :.*/AMONT : .\//" \
      -e "s/AVAL :.*/AVAL : .\//" \
      -e "s/SUITE :.*/SUITE : .\//" \
    ${SYRTHES_ENV} > ${EXEC_DIR}/syrthes.env.tmp

  mv ${EXEC_DIR}/syrthes.env.tmp ${EXEC_DIR}/syrthes.env

  # Transfer SYRTHES files

  for var in $SYRTHES_DATA $SYRTHES_GEOM $SYRTHES_SUIT $SYRTHES_DATA_RAY $SYRTHES_MAIL_RAY ; do
    cp $SYR_IN/$var $EXEC_DIR/`echo $var | sed -e "s/.*\///"`
  done
  for var in $SYRTHES_CORR $SYRTHES_FFOR_RAY $SYRTHES_CORR_RAY ; do
    cp $SYR_RESTART/$var $EXEC_DIR/`echo $var | sed -e "s/.*\///"`
  done

fi

########################################################################

if [ "$1" = "-copy-results" ] ; then

  if [ "${RESULT_DIR}" = "" ] ; then
    echo "No result directory  defined; no results copied."
    exit 1
  elif [ "${RESULT_DIR}" = "${EXEC_DIR}" ] ; then
    exit 0
  fi

  if [ ! -d "${RESULT_DIR}" ] ; then
    mkdir $RESULT_DIR
    if [ $? -ne 0 ] ; then
      echo Failure creating ${RESULT_DIR}
      exit 1
    fi
  fi
  for var in $SYRTHES_ENV $SYRTHES_DATA $SYRTHES_DATA_RAY \
             $SYRTHES_CORR $SYRTHES_CORR_RAY $SYRTHES_FFOR_RAY \
             $SYRTHES_OUT_RES1 $SYRTHES_OUT_RES2 $SYRTHES_OUT_CHR2 \
             $SYRTHES_OUT_HIST \
             $SYRTHES_OUT_MAIL_PEAU_FLUIDE $SYRTHES_OUT_RESU_PEAU_FLUIDE \
             $SYRTHES_OUT_CHR_PEAU_FLUIDE \
             $SYRTHES_OUT_MAIL_RAY $SYRTHES_OUT_RESU_RAY \
             $SYRTHES_OUT_CHR_RAY \
             $SYRTHES_OUT_HIST_RAY ; do
    f=$EXEC_DIR/`basename $var`
    if [ -f $f ] ; then
      cp $f ${RESULT_DIR}/
    fi
  done

fi