-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_balanced_cases.py
executable file
·91 lines (69 loc) · 3.1 KB
/
run_balanced_cases.py
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
#!/bin/env python2.7
import os
import argparse
import itertools
import numpy as np
preamble = '''#!/bin/bash
### Set the job name
#PBS -N shelfstrat
### Declare myprogram non-rerunable
#PBS -r n
### Set the queue to "default"
#PBS -q default
### Run on
#PBS -l nodes=1:ppn=8
### You can override the default 1 hour real-world time limit.
#PBS -l walltime=72:00:00
echo Working directory is $PBS_O_WORKDIR
cd $PBS_O_WORKDIR
echo HOSTNAME: $HOSTNAME
'''
def get_suffix(**kwargs):
keys = kwargs.keys()
keys.sort()
suffix=''
for key in keys:
suffix += '_%s_%4.2e' % (str(key), kwargs[key])
return suffix
def qsub_case(f, M2, N2):
suffix = get_suffix(f=f, M2=M2, N2=N2)
rootdir = './simulations_z0_0.0001/shelfstrat%s' % suffix
Ri = N2 * f**2 / M2**2
phi = M2 * 1e-3 * np.sqrt(Ri) / f**2
print 'M2 = %4.2e; N2 = %4.2e; f = %4.2e; Ri=%4.2f; phi=%4.2f' % (M2, N2, f, Ri, phi)
qfile = open('shelfstrat%s.sh' % suffix, 'w')
qfile.writelines(preamble)
qfile.write('/anaconda/bin/python2.7 ./run_case.py --rootdir %s --M2 %4.2e --N2 %4.2e --f %f \n' % (rootdir, M2, N2, f))
qfile.write('/usr/mpi/gcc/openmpi-1.4.3/bin/mpiexec -np 8 ./project/coawstM %s/ocean_shelfstrat.in > %s/ocean_shelfstrat.out\n' % (rootdir, rootdir))
qfile.close()
os.system('qsub shelfstrat%s.sh' % suffix)
# ### Vary Richardson number alone, keep S constant.
# qsub_case(M2= 1.00e-07, N2= 1.00e-04, f= 1.00e-04)
# qsub_case(M2= 2.00e-07, N2= 1.00e-04, f= 1.00e-04)
# qsub_case(M2= 5.00e-07, N2= 1.00e-04, f= 1.00e-04)
# # qsub_case(M2= 1.00e-06, N2= 1.00e-04, f= 1.00e-04) # base case
# qsub_case(M2= 1.00e-06, N2= 1.00e-04, f= 1.00e-04)
# qsub_case(M2= 2.00e-06, N2= 1.00e-04, f= 1.00e-04)
# qsub_case(M2= 5.00e-06, N2= 1.00e-04, f= 1.00e-04)
### Keep delta constant, Same Richardson number
qsub_case(M2= 0.30e-06, N2= 0.30e-04, f= np.sqrt(0.30e-08))
qsub_case(M2= 0.50e-06, N2= 0.50e-04, f= np.sqrt(0.50e-08))
# qsub_case(M2= 1.00e-06, N2= 1.00e-04, f= 1.00e-04) # base case
qsub_case(M2= 3.00e-06, N2= 3.00e-04, f= np.sqrt(3.00e-08))
qsub_case(M2= 5.00e-06, N2= 5.00e-04, f= np.sqrt(5.00e-08))
# qsub_case(M2=1.00e-06, N2=1.00e-04 / 5.0, f=1.00e-04 * 5.0)
# qsub_case(M2=5.00e-07, N2=1.00e-04 / 5.0, f=5.00e-05 * 5.0)
# qsub_case(M2=2.00e-07, N2=1.00e-04 / 5.0, f=2.00e-05 * 5.0)
# qsub_case(M2=1.00e-07, N2=1.00e-04 / 5.0, f=1.00e-05 * 5.0)
# qsub_case(M2=7.07e-07, N2=1.00e-04 / 5.0, f=1.00e-04 * 5.0)
# qsub_case(M2=3.54e-07, N2=1.00e-04 / 5.0, f=5.00e-05 * 5.0)
# qsub_case(M2=1.41e-07, N2=1.00e-04 / 5.0, f=2.00e-05 * 5.0)
# qsub_case(M2=7.07e-08, N2=1.00e-04 / 5.0, f=1.00e-05 * 5.0)
# qsub_case(M2=4.47e-07, N2=1.00e-04 / 5.0, f=1.00e-04 * 5.0)
# qsub_case(M2=2.24e-07, N2=1.00e-04 / 5.0, f=5.00e-05 * 5.0)
# qsub_case(M2=8.94e-08, N2=1.00e-04 / 5.0, f=2.00e-05 * 5.0)
# qsub_case(M2=4.47e-08, N2=1.00e-04 / 5.0, f=1.00e-05 * 5.0)
# qsub_case(M2=3.16e-07, N2=1.00e-04 / 5.0, f=1.00e-04 * 5.0)
# qsub_case(M2=1.58e-07, N2=1.00e-04 / 5.0, f=5.00e-05 * 5.0)
# qsub_case(M2=6.32e-08, N2=1.00e-04 / 5.0, f=2.00e-05 * 5.0)
# qsub_case(M2=3.16e-08, N2=1.00e-04 / 5.0, f=1.00e-05 * 5.0)