From b7b937bf9c5f2325cccbb47122078c76241832e5 Mon Sep 17 00:00:00 2001 From: Paul Connolly Date: Wed, 18 Oct 2023 09:48:18 +0100 Subject: [PATCH] updated batch script --- batch_runs.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/batch_runs.sh b/batch_runs.sh index 835af72..b91083f 100755 --- a/batch_runs.sh +++ b/batch_runs.sh @@ -1,4 +1,5 @@ -#! /bin/bash +#!/bin/bash + ARRAY1=(5. 10. 20. 30. 40. 50. 60. 70. 80. 90. 100. 125. 150. 175. 200. 250. 300. 350.) # peak jet ARRAY2=(0. 0.1 0.2 1.) # cvis in Smagorinsky model @@ -6,16 +7,27 @@ ARRAY2=(0. 0.1 0.2 1.) # cvis in Smagorinsky model ELEMENTS1=${#ARRAY1[@]} # elements in first array ELEMENTS2=${#ARRAY2[@]} # elements in second array +mkdir /tmp/${USER} + for (( i=0;i<$ELEMENTS1;i++)); do for (( j=0;j<$ELEMENTS2;j++)); do # Runs with the hm process switched on: echo ${ARRAY1[${i}]} ${ARRAY2[${j}]} - sed -e "s/u_jet=50./u_jet=${ARRAY1[${i}]}/" namelist.in > /tmp/namelist.tmp - sed -e "s/cvis=0.2/cvis=${ARRAY2[${j}]}/" /tmp/namelist.tmp > namelist.run + sed -e "s|output.nc|${USER}/output_${i}_${j}.nc|" namelist.in > namelist.tmp + sed -e "s/u_jet=50./u_jet=${ARRAY1[${i}]}/" namelist.tmp > /tmp/namelist.tmp2 + sed -e "s/cvis=0.2/cvis=${ARRAY2[${j}]}/" /tmp/namelist.tmp2 > namelist.run + - #mpiexec -n 64 ./main.exe namelist.run > std.out - - #mv /tmp/output.nc /tmp/output_${i}_${j}.nc + + if [ -z "$1" ] + then + mpiexec -n 1 ./main.exe namelist.run > /tmp/${USER}/std.out + else + mpiexec -n $1 ./main.exe namelist.run > /tmp/${USER}/std.out + fi + rm namelist.tmp + rm namelist.tmp2 + done done