-
Notifications
You must be signed in to change notification settings - Fork 1
/
5) run_roms(standalone)
455 lines (364 loc) · 18.9 KB
/
5) run_roms(standalone)
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
1) Batimetri
a. BATNAS
batimetri lokal dari BIG, Resolusi spasial data BATNAS adalah 6arc-second dengan menggunakan datum MSL
dapat di download dimari >> https://tanahair.indonesia.go.id/demnas/#/batnas
b. GEBCO
global terrain model for ocean and land, providing elevation data, in meters, on a 15 arc-second interval grid.
dapat di download dimari >> https://download.gebco.net/
c. ETOPO
The ETOPO Global Relief Model integrates topography, bathymetry, and shoreline data from regional and global datasets
dapat di download dimari >> https://www.ncei.noaa.gov/maps/grid-extract/
data yang digunakan harus dalam format .nc ; jika tidak, harus dikonversi dulu ke format .nc
data batimetri dapat diakses:
/mnt-storage1/TRAINING/script/matlab/ROMS/1_batimetri
untuk unduh data dari server ke local
pada mobaxterm, buka terminal local, lalu pindah ke direktori untuk menyimpan data batimetri
$>>
cd /mnt/c/Arief/ROMS/Modul_COAWST/ROMS/1_batimetri
scp -P 2022 coawst@182.16.251.41:/mnt-storage1/TRAINING/script/matlab/ROMS/1_batimetri/* .
scp -r -P 2022 {username}@182.16.251.41:/mnt-storage1/TRAINING/script/matlab/ROMS/* .
$>>
2) Grid
a. GridBuilder
membuat grid domain roms dengan menggunakan GUI (based on MATLAB)
dapat di didownload dimari >> https://austides.com/wp-content/uploads/GridBuilder_toolbox.mltbx
b. generate_grid.m
membuat grid domain roms dengan script (By Haibo Zong, Fathom Science)
* untuk unduh data dari server ke local
cd /mnt/c/Arief/ROMS/Modul_COAWST/ROMS/2_grid/b_generate_grid_m
scp -P 2022 coawst@182.16.251.41:/mnt-storage1/TRAINING/script/matlab/ROMS/2_grid/b_generate_grid_m/* .
* buka matlab > generate_grid.m
%% ========= bagian yang diubah ========= (1)
% set range of lon and lat
% contoh case selat sunda
% domain 1 100.814 110.418 | -1.1108 -10.6522 > 101 110 | -1.5 -10
% domain 2 102.171 108.980 | -2.87296 -8.91458 > 102.5 108.5 | -3 -8.5
% domain 3 104.115 106.737 | -4.86671 -7.20458 > 104.5 106.5 | -5 -7
lonl = 101.; % west
lonr = 110.; % east
latd = -10.; % south
latu = -1.5; % north
%% =======================================
%% ========= bagian yang diubah ========= (2)
% resolusi model (dx=dy)
resolusi = 9; %(dalam km)
itv = resolusi/radius; %resolusi
%% =======================================
%% ========= bagian yang diubah ========= (3)
% input file batimetri
gebcofn = '../../1_batimetri/indonesia_gebco_15arc.nc';
%gebcofn = '../1_batimetri/indonesia_etopo_15arc.nc';
%% =======================================
%% ========= bagian yang diubah ========= (4)
h(h > 5000) = 5000; % 5000m cut-off depth (penentuan titik terdalam)
%% =======================================
%% ========= bagian yang diubah ========= (5)
ARVD.N=20; % jumlah layer kedalaman
%% =======================================
%% ========= bagian yang diubah ========= (6)
save sunda_9km_gebco_grid.mat rho
mat2roms_rps('sunda_9km_gebco_grid.mat','sunda_9km_gebco_grid.nc')
%% =======================================
3) ICBC
a. HYCOM
membuat file initial, boundary dan climatology untuk roms menggunakan data HYCOM
script yang digunakan >> roms_master_climatology_coawst_mw.m (by JC Warner)
source utamanya bisa download disini >> https://github.com/DOI-USGS/COAWST
Parameter:
nc{'tau'}.long_name = ncchar(''Tau'');
nc{'depth'}.long_name = ncchar(''Depth'');
nc{'surf_el'}.long_name = ncchar(''Water Surface Elevation'');
nc{'water_temp'}.long_name = ncchar(''Water Temperature'');
nc{'water_temp_bottom'}.long_name = ncchar(''Water Temperature'');
nc{'salinity'}.long_name = ncchar(''Salinity'');
nc{'salinity_bottom'}.long_name = ncchar(''Salinity'');
nc{'water_u'}.long_name = ncchar(''Eastward Water Velocity'');
nc{'water_u_bottom'}.long_name = ncchar(''Eastward Water Velocity'');
nc{'water_v'}.long_name = ncchar(''Northward Water Velocity'');
nc{'water_v_bottom'}.long_name = ncchar(''Northward Water Velocity'');
* data dan script dapat diakses:
cd /mnt-storage1/TRAINING/script/matlab/ROMS/3_ICBC/a_hycom
scp -P 2022 coawst@182.16.251.41:/mnt storage1/TRAINING/script/matlab/ROMS/3_ICBC/a_hycom/roms_master_climatology_coawst_mw_sip.m .
* buka matlab > roms_master_climatology_coawst_mw_sip.m
%% ========= bagian yang diubah ========= (1)
% (1) Enter start date (T1) and number of days to get climatology data
T1 = datenum(2023,09,9,12,0,0); %start date
%number of days and frequency to create climatology files for
numdays = 3;
dayFrequency = 1;
% (2) Enter URL of the HYCOM catalog for the requested time, T1
% see http://tds.hycom.org/thredds/catalog.html
url = 'https://tds.hycom.org/thredds/dodsC/GLBy0.08/expt_93.0';
% (4) Enter grid vertical coordinate parameters --These need to be consistent with the ROMS setup.
theta_s = 5.0;
theta_b = 0.4;
Tcline = 200.0;
N = 20;
Vtransform = 2;
Vstretching = 4;
%% =======================================
%% ========= bagian yang diubah ========= (2)
% buat direktori kerja
if ~exist('grid_9km', 'dir')
mkdir('grid_9km');
end
cd('C:\Arief\ROMS\Modul_COAWST\ROMS\3_ICBC\a_hycom\grid_9km');
wdr = pwd;
% (3) Enter path and name of the ROMS grid
modelgrid = '../../../2_grid/b_generate_grid_m/sunda_9km_gebco_grid.nc';
%% =======================================
b. Mercator
membuat file initial, boundary dan climatology untuk roms menggunakan data Mercator
4) Surface Forcing
a. ECMWF-ERA5
membuat file surface forcing dari dataset ECMWF-ERA5.
download data ERA5 hourly data on single levels from 1940 to present (harus register terlebih dahulu)
https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels?tab=form
script yang digunakan adalah >> era5_2_roms.m karya Hernan G. Arango & J. Wilkin; edited by by Haibo Zong
* data dan script dapat diakses:
cd /mnt-storage1/TRAINING/script/matlab/ROMS/4_surface_forcing/a_era5
scp -rP 2022 coawst@182.16.251.41:/mnt-storage1/TRAINING/script/matlab/ROMS/4_surface_forcing/a_era5/* .
* buka matlab > era5_2_roms_sip.m.m
%% ========= bagian yang diubah ========= (1)
% Base date for ROMS forcing files: "days since 2000-01-01 00:00:00".
% harus konsisten dengan ddate yang digunakan pada saat menghitung kompunen
% pasut dan saat mengedit file roms.in
mybasedate = datenum(1858,11,17,0,0,0);
%% =======================================
%% ========= bagian yang diubah ========= (2)
% Set field element in structure F to process.
doFields = [5 6 7 9 13 14 15 16]; % If the ROMS option BULK_FLUXES is ACTIVATED, process elements 5:16
% swrad Uwind Vwind lwrad_down rain Pair Tair Qair
%doFields = [1 2 3 4 5]; % If the ROMS option BULK_FLUXES is NOT activatived, process elements 1:5
% sustr svstr shflux swflux swrad
%% =======================================
%% ========= bagian yang diubah ========= (3)
% batas lan lot data era5 yang digunakan
spherical = true; % Spherical switch
LonMin = 89; % GOM left-bottom longitude
LonMax = 146; % GOM right-top longitude
LatMin = -16; % GOM left-bottom latitude
LatMax = 16; % GOM right-top latitude
FlipLat = true; % Flip data in ERA NetCDF files
%% =======================================
%% ========= bagian yang diubah ========= (4)
StrDay = datenum('01-Sep-2023'); % tanggal awal data era5
EndDay = datenum('13-Sep-2023'); % tanggal akhir data era5
%% =======================================
%% ========= bagian yang diubah ========= (5)
% nama file era5
InpFile = fullfile(Dir, 'sunda_era5_sept_2023.nc');
%% =======================================
b. GFS
membuat file surface forcing dari dataset GFS.
source bisa dilihat di website
https://www.ncei.noaa.gov/thredds/catalog.html >> GFS 0.5 deg data from NCEI NOAA
https://nomads.ncep.noaa.gov/ >> GFS 0.25 deg data from NOMADS NCEP
Parameter:
dlwrfsf % ** surface downward long-wave rad. flux [w/m^2]
ulwrfsfc % ** surface upward long-wave rad. flux [w/m^2]
dswrfsfc % ** surface downward short-wave radiation flux [w/m^2]
uswrfsfc % ** surface upward short-wave radiation flux [w/m^2]
prateavesfc % ** surface precipitation rate [kg/m^2/s]
tmp2m % ** 2 m above ground temperature [k]
prmslmsl % ** mean sea level pressure reduced to msl [pa]
rh2m % ** 2 m above ground relative humidity [%]
ugrd10m % ** 10 m above ground u-component of wind [m/s]
vgrd10m % ** 10 m above ground v-component of wind [m/s]
* data dan script dapat diakses:
cd /mnt-storage1/TRAINING/script/matlab/ROMS/4_surface_forcing/b_gfs
scp -P 2022 coawst@182.16.251.41:/mnt-storage1/TRAINING/script/matlab/ROMS/4_surface_forcing/b_gfs/* .
* buka matlab > ncei_2roms2_sip.m
%% ===================== bagian yang diubah ============================== (1)
% (3) Enter start and end dates
time_start = datenum('9-Sep-2023'); tst = datestr(time_start,'yyyymmdd');
time_end = datenum('12-Sep-2023'); ten = datestr(time_end,'yyyymmdd');
% pilih GFS analisis (1) atau GFS forecast (2)
GFS = 2;
% path grid roms (3)
model_grid = '../../2_grid/b_generate_grid_m/sunda_9km_gebco_grid.nc';
% =========================================================================
5) Tidal Forcing
a. TPX09
membuat file tidal forcing menggunakan dataset TPX09
script yang digunakan >> create_tidal_forcing_TPXO91 (created by Haibo Zong)
* data dan script dapat diakses:
cd /mnt-storage1/TRAINING/script/matlab/ROMS/5_tide/a_tpx09
scp -P 2022 coawst@182.16.251.41:/mnt-storage1/TRAINING/script/matlab/ROMS/5_tide/a_tpx09/* .
* buka matlab > create_tidal_forcing_TPXO91_sip.m
%% ========= bagian yang diubah ========= (1)
% nama file output yang diinginkan dalam format nc
tidefn = 'roms9km_tides.nc';
% path lokasi file grid roms
grdfn = '../../2_grid/b_generate_grid_m/sunda_9km_gebco_grid.nc';
% datenum(yyyy,mm,dd) - first day julian day tidak diubah harus konsisten dengan file/settingan lainnya
base_date = datenum(1858,11,17);
% datenum(yyyy,mm,dd) - the nodal corrections reference time (usually the midpoint of range of the prediction time or mid-month of the simulation time)
pred_date = datenum(2023,9,15);
%% =======================================
b. TPX08
membuat file tidal forcing menggunakan dataset TPX08
%% ========================================= ROMS Script ============================================ %%
6) Editing script: build_roms.sh / coawst.bash
* lokasi home directory, buat direktori baru untuk project sunda
/home/tr29/COAWST
cd Projects
mkdir sunda
cd sunda
* copy file bash dari root lalu edit
cp /home/tr29/COAWST/coawst.bash .
vi coawst.bash
:set number
++++++++++++++++++++++++++++++++++++++++++
124 export COAWST_APPLICATION=ROMS_SUNDA
132 export MY_ROOT_DIR=/home/tr29/COAWST
133 export MY_PROJECT_DIR=/home/tr29/COAWST/Projects/sunda
458 export MY_HEADER_DIR=${MY_PROJECT_DIR}
459 export MY_ANALYTICAL_DIR=${MY_PROJECT_DIR}
++++++++++++++++++++++++++++++++++++++++++
* copy file input roms dari /mnt-storage1/TRAINING/script/matlab/ROMS
cp /mnt-storage1/TRAINING/script/matlab/ROMS/2_grid/b_generate_grid_m/sunda_9km_gebco_grid.nc .
cp /mnt-storage1/TRAINING/script/matlab/ROMS/3_ICBC/a_hycom/grid_9km/roms_9km* .
cp /mnt-storage1/TRAINING/script/matlab/ROMS/4_surface_forcing/b_gfs/roms_GFS_sunda_20230909_anl.nc .
cp /mnt-storage1/TRAINING/script/matlab/ROMS/4_surface_forcing/a_era5/*092023.nc .
cp /mnt-storage1/TRAINING/script/matlab/ROMS/5_tide/a_tpx09/roms9km_tides.nc .
cp /mnt-storage1/TRAINING/script/matlab/ROMS/roms_sunda.h .
cp /mnt-storage1/TRAINING/script/matlab/ROMS/roms_sunda.in .
* edit file roms_sunda.in .
# chown coawst:training roms_sunda.in
vi roms_sunda.in
:set number
67 TITLE = ROMS STANDALONE - SUNDA
71 MyAppCPP = ROMS_SUNDA
76 VARNAME = /home/tr29/COAWST/ROMS/External/varinfo.dat
94 Lm == 111 ! Number of I-direction INTERIOR RHO-points xi_rho-2
95 Mm == 105 ! Number of J-direction INTERIOR RHO-points eta_rho-2
96 N == 20 ! Number of vertical levels
109 NtileI == 2 ! I-direction partition
110 NtileJ == 2 ! J-direction partition
224 NTIMES == 4320 ! ntimes = hari simulasi * 24 * 60 * 60 / dt
225 DT == 60.0d0
262 NHIS == 60 ! 3600 ! inteval data yang jadi output misal mau per jam maka 1jam/dt
263 NDEFHIS == 4320 ! 86400 ! jumllah file per nc tiap berapa waktu misal mau nc per hari nhis*24
399 Vtransform == 2 ! transformation equation
400 Vstretching == 4 ! stretching function
404 THETA_S == 5.0d0 ! surface stretching parameter
405 THETA_B == 0.4d0 ! bottom stretching parameter
406 TCLINE == 200.0d0 ! critical depth (m)
422 DSTART = 60196.5d0 ! days
423 TIDE_START = 60196.5d0 ! days
424 TIME_REF = 18581117.0d0 ! yyyymmdd.dd
963 GRDNAME == /home/tr29/COAWST/Projects/sunda/sunda_9km_gebco_grid.nc
964 ININAME == /home/tr29/COAWST/Projects/sunda/roms_9km_ini.nc
1006 BRYNAME == /home/tr29/COAWST/Projects/sunda/roms_9km_bdy.nc
1030 TIDENAME == /home/tr29/COAWST/Projects/sunda/roms9km_tides.nc
1052 FRCNAME == /home/tr29/COAWST/Projects/sunda/roms_GFS_sunda_20230909_anl.nc
1072 RSTNAME == roms_sunda_rst.nc
1073 HISNAME == roms_sunda_his.nc
1078 AVGNAME == roms_sunda_avg.nc
1080 DIANAME == roms_sunda_dia.nc
* compile coawst.bash
script build.log
./coawst.bash -j 10
>> akan menghasilkan coawstM di /home/tr29/COAWST
>> lalu copy file coawstM ke /home/tr29/COAWST/Projects/sunda
cp coawstM /home/tr29/COAWST/Projects/sunda
cp ../../coawstM .
* membuat run_roms
vi run_roms
1 #!/bin/bash
2
3 #SBATCH -J roms_only # Job name
4 #SBATCH -o roms_sunda.log # Name of stdout output file (%j expands to jobId)
5 #SBATCH -N 1 # Total number of nodes requested
6 #SBATCH -n 4 # Total number of mpi tasks requested
7 #SBATCH -t 24:00:00 # Run time (hh:mm:ss) - 1.5 hours
8 #SBATCH -p normal # Partition name
9
10 # Launch MPI-based executable
11 mpirun ./coawstM roms_sunda.in > roms_sunda.out
* submit job run_roms
sbatch run_roms
tail -f roms_sunda.out
%% ========================================= COAWST Script ============================================ %%
* buat direktori baru
mkdir sunda_couple
cd sunda_couple
* copy data roms dan swan
cp /mnt-storage1/TRAINING/script/matlab/ROMS/2_grid/b_generate_grid_m/sunda_9km_gebco_grid.nc .
cp /mnt-storage1/TRAINING/script/matlab/ROMS/3_ICBC/a_hycom/grid_9km/roms_9km* .
cp /mnt-storage1/TRAINING/script/matlab/ROMS/4_surface_forcing/b_gfs/roms_GFS_sunda_20230909_anl.nc .
cp /mnt-storage1/TRAINING/script/matlab/ROMS/5_tide/a_tpx09/roms9km_tides.nc .
cp -f /mnt-storage1/TRAINING/script/matlab/SWAN/swan* .
cp -f /mnt-storage1/TRAINING/script/matlab/WRF/* .
* buat file scrip_sunda_couple.in dan edit (/home/tr29/COAWST/Lib/SCRIP_COAWST)
cd /home/tr29/COAWST/Lib/SCRIP_COAWST
cp scrip_coawst_sandy.in scrip_sunda_couple.in
vi scrip_sunda_couple.in
11 OUTPUT_NCFILE='/home/tr29/COAWST/Projects/sunda_couple/scrip_sunda_static.nc'
16 NGRIDS_ROMS=1,
17 NGRIDS_SWAN=1,
18 NGRIDS_WW3=0,
19 NGRIDS_WRF=1,
20 NGRIDS_HYD=0,
24 ROMS_GRIDS(1)='/home/tr29/COAWST/Projects/sunda_couple/sunda_9km_gebco_grid.nc',
25 !ROMS_GRIDS(2)='../../Projects/Sandy/Sandy_roms_grid_ref3.nc',
33 SWAN_COORD(1)='/home/tr29/COAWST/Projects/sunda_couple/swan_9km.grd',
34 !SWAN_COORD(2)='../../Projects/Sandy/Sandy_swan_coord_ref3.grd',
35 SWAN_BATH(1)='/home/tr29/COAWST/Projects/sunda_couple/swan_9km.bot',
36 !SWAN_BATH(2)='../../Projects/Sandy/Sandy_swan_bathy_ref3.bot',
37 SWAN_NUMX(1)=113,
38 !SWAN_NUMX(2)=116,
39 SWAN_NUMY(1)=107,
40 !SWAN_NUMY(2)=86,
58 WRF_GRIDS(1)='/home/tr29/COAWST/Projects/sunda_couple/wrfinput_d01',
59 !WRF_GRIDS(2)='../../Projects/Sandy/wrfinput_d02',
* compile scrip_sunda_couple.in
./scrip_coawst scrip_sunda_couple.in
* link file WRF
cd ../../Projects/sunda_couple
ln -sf ../../WRF/run/RRTM* .
ln -sf ../../WRF/run/ozone* .
ln -sf ../../WRF/run/*.TBL .
* edit file coawst.bash
cp ../sunda/coawst.bash .
vi coawst.bash
* edit file coupling_sunda.in
cp /mnt-storage1/TRAINING/script/matlab/coupling_karimun.in coupling_sunda.in
vi coupling_sunda.in
* edit file edit file roms_sunda.in
cp ../roms_sunda.in .
vi roms_sunda.in
* edit file swan_sunda.in
cp -f /mnt-storage1/TRAINING/script/matlab/swan_karimun_ref9km.in swan_sunda.in
vi swan_sunda.in
* edit file coupling_sunda.h
cp -f /mnt-storage1/TRAINING/script/matlab/sunda.h coupling_sunda.h
vi coupling_sunda.h
* edit file run_coawst
vi run_coawst
* compile coawst.bash
export NETCDF=/opt/ohpc/pub/apps/netcdf-4.7.3
export WRF_EM_CORE=1
export NETCDF4=1
export HDF5=/opt/ohpc/pub/apps/hdf5-1.10.4
export jasper=/opt/ohpc/pub/apps/jasper-1.900.1
export JASPERLIB=/opt/ohpc/pub/apps/jasper-1.900.1/lib
export JASPERINC=/opt/ohpc/pub/apps/jasper-1.900.1/include
export WRF_DA_CORE=0
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
export MCT_INCDIR=${HOME}/COAWST/MCT-LIB/include
export MCT_LIBDIR=${HOME}/COAWST/MCT-LIB/lib
script build.log
./coawst.bash -j 10
Enter selection [1-75] : 34 [dmpar]
Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: 1
cp -f /mnt-storage1/TRAINING/script/matlab/WRF/wrflowinp_d01 .
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# error
REGRID - input gridded data does not contain model grid:
Gridded: LonMin = 108.0000 LonMax = 112.0000
LatMin = -11.5000 LatMax = -0.5000
Model: LonMin = 101.0000 LonMax = 110.0727
LatMin = -10.0000 LatMax = -1.4643
Found Error: 04 Line: 269 Source: ROMS/Utility/get_2dfld.F