forked from christianstassen/greb-official
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.greb.decon_mean_climate.csh
executable file
·109 lines (92 loc) · 2.85 KB
/
run.greb.decon_mean_climate.csh
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
#!/bin/csh
#
# run script for deconstruct mean climate experiments with the Globally Resolved Energy Balance (GREB) Model
#
# author: Tobias Bayr and Dietmar Dommenget
# create work directory if does not already exist
if (! -d work ) mkdir work
# else clean up work directory
if (-d work ) rm -f work/*
#####################
# BEGIN USER INPUT! #
#####################
# switches to turn on (1) or off (0) the different processes
# see mscm.dkrz.de => deconstruct 2xco2 response for details
set LOG_ICE = 1 # ice
set LOG_CLOUD = 1 # clouds
set LOG_OCEAN = 1 # ocean
set LOG_ATMOS = 1 # atmosphere
set LOG_HDIF = 1 # heat diffusion
set LOG_HADV = 1 # heat advection
set LOG_CO2 = 1 # CO2
set LOG_HYDRO = 1 # hydrology
set LOG_VDIF = 1 # vapour diffusion
set LOG_VADV = 1 # vapour advection
set LOG_QFLUX = 1 # model correction
### compile GREB model (uncomment one of these three options)
### gfortran compiler (Linux (e.g. Ubuntu), Unix or MacBook Air)
#gfortran -fopenmp -march=native -O3 -ffast-math -funroll-loops greb.model.mscm.f90 greb.shell.mscm.f90 -o greb.x
gfortran -Ofast -ffast-math -funroll-loops -fopenmp greb.model.mscm.f90 greb.shell.mscm.f90 -o greb.x
### ifortran compiler (Mac)
# ifort -assume byterecl -O3 -xhost -align all -fno-alias greb.model.mscm.f90 greb.shell.mscm.f90 -o greb.x
### g95 compiler (other Linux)
# g95 greb.model.mscm.f90 greb.shell.mscm.f90 -o greb.x
###################
# END USER INPUT! #
###################
setenv OMP_NUM_THREADS 2
setenv KMP_AFFINITY verbose,none
set SCENARIO='greb.mean.decon.exp-'
set NUMBER=${LOG_QFLUX}${LOG_ICE}${LOG_CLOUD}${LOG_VADV}${LOG_VDIF}${LOG_HYDRO}${LOG_OCEAN}${LOG_CO2}${LOG_HADV}${LOG_HDIF}${LOG_ATMOS}
set FILENAME=${SCENARIO}${NUMBER}
echo 'EXPERIMENT: '${FILENAME}
# move complied files to work directory
mv greb.x work/.
mv *.mod work/.
# change to work directory
cd work
# generate namelist
cat >namelist <<EOF
&NUMERICS
time_flux = 3 ! length of flux corrections run [yrs]
time_ctrl = 50 ! length of control run [yrs]
/
&PHYSICS
log_exp = 1 ! deconstruct mean state
log_cloud_dmc = $LOG_CLOUD
log_ocean_dmc = $LOG_OCEAN
log_atmos_dmc = $LOG_ATMOS
log_co2_dmc = $LOG_CO2
log_hydro_dmc = $LOG_HYDRO
log_qflux_dmc = $LOG_QFLUX
log_ice = $LOG_ICE
log_hdif = $LOG_HDIF
log_hadv = $LOG_HADV
log_vdif = $LOG_VDIF
log_vadv = $LOG_VADV
/
EOF
# run model
./greb.x
# postprocessing
# create output directory if does not already exist
if (! -d ../output ) mkdir ../output
# rename control run output and move it to output folder
mv control.bin ../output/${FILENAME}.bin
# create description file
cat >../output/${FILENAME}.ctl <<EOF
dset ^${FILENAME}.bin
undef 9.e27
xdef 96 linear 0 3.75
ydef 48 linear -88.125 3.75
zdef 1 linear 1 1
tdef 12 linear 15jan0 1mo
vars 5
tsurf 1 0 data 1
tatmos 1 0 data 1
tocean 1 0 data 1
vapor 1 0 data 1
ice 1 0 data 1
endvars
EOF
exit