Forcing file fun

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
lolhsson
Posts: 23
Joined: Wed Jun 02, 2010 9:07 pm
Location: UC Berkeley

Forcing file fun

#1 Unread post by lolhsson »

I discovered that my forcing files were missing the 'coordinates = "lon lat"' attribute. I added it manually with NCO... I /think/ correctly, with, for example,

ncatted -a coordinates,'lwrad_down',c,c,"lon lat" lwrad_down.ORG.2000.nc


but something really weird pops up in the subsequent run's logfile:
NETCDF_INQ_VAR - requested variable: lat^@
not found in input file: Uair.ORG.2000.nc
call from: get_varcoords.F

GET_2DFLD - error while reading variable: Uwind at TIME index = 9
The ^@ is greyed out while everything else in the logfile is black.

Any idea what that's about?

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Forcing file fun

#2 Unread post by kate »

Yup, it's about the C language adding a null character that Fortran doesn't know to ignore. I hacked in something recently for the time attribute that you could copy from inquire.F.

lolhsson
Posts: 23
Joined: Wed Jun 02, 2010 9:07 pm
Location: UC Berkeley

Re: Forcing file fun

#3 Unread post by lolhsson »

Gotcha, thanks. I fixed it by creating the coordinates attribute directly inside NCL before writing it to a .nc file.

Now I've finally got a model that runs... until it blows up on first timestep it tries to advance. :(

The heart of the problem in the logfile is definitely:

STEP Day HH:MM:SS KINETIC_ENRG POTEN_ENRG TOTAL_ENRG NET_VOLUME
C => (i,j,k) Cu Cv Cw Max Speed

3506880 7306 00:00:00 2.463986E-05 1.561260E+04 1.561260E+04 6.819257E+14
(38,60,34) 1.208802E-03 1.115459E-03 0.000000E+00 9.091617E-02
DEF_HIS - creating history file: /clusterfs/hadley/scratch/lolhsson/romsdata/2000/10kmtestjeff/ocean_his.nc
WRT_HIS - wrote history fields (Index=1,1) into time record = 0000001
DEF_AVG - creating average file: /clusterfs/hadley/scratch/lolhsson/romsdata/2000/10kmtestjeff/ocean_avg.nc
DEF_DIAGS - creating diagnostics file: /clusterfs/hadley/scratch/lolhsson/romsdata/2000/10kmtestjeff/ocean_dia.nc
3506881 7306 00:03:00 NaN NaN NaN NaN
(00,00,00) 0.000000E+00 0.000000E+00 0.000000E+00 NaN
At which point it blows up and terminates the run. ocean_his.nc has some curious blanks in it -- here's an example using the salinity variable:
salt =
34.68959, 34.68957, 34.68929, 34.68946, 34.68965, 34.68941, 34.68938,
34.68933, 34.68946, 34.68914, 34.68912, 34.68919, 34.68952, 34.68944,
34.6896, 34.68973, 34.68959, 34.68953, 34.68924, 34.68925, 34.6891,
34.6891, 34.68893, 34.68876, 34.6875, 34.68576, 34.68401, 34.68181,
34.68149, 34.67818, 34.67315, 34.66937, 34.67243, 34.6736, 34.67095,
34.67165, 34.67375, 34.67209, 34.65737, 34.55767, 34.39218, 34.24286,
34.23102, 34.27528, _, _, _, _,
34.68961, 34.68907, 34.68938, 34.68927, 34.68902, 34.68898, 34.6892,
34.68934, 34.68933, 34.68903, 34.68906, 34.6891, 34.68905, 34.68927,
34.6894, 34.68948, 34.68951, 34.6895, 34.6892, 34.68909, 34.68918,
34.68882, 34.6888, 34.68749, 34.68723, 34.68463, 34.68245, 34.68055,
34.67537, 34.67245, 34.66874, 34.66304, 34.67017, 34.66871, 34.66631,
34.66676, 34.67122, 34.66978, 34.6405, 34.52271, 34.32935, 34.24317,
34.22745, 34.27244, _, _, _, _,
34.6893, 34.68891, 34.68892, 34.68904, 34.68877, 34.68895, 34.68898,
34.68906, 34.68892, 34.68887, 34.6893, 34.68928, 34.68946, 34.68966,
34.68951, 34.6894, 34.68941, 34.68937, 34.68931, 34.68901, 34.68892,
34.68886, 34.68864, 34.68743, 34.68685, 34.68436, 34.68369, 34.68206,
34.67812, 34.67355, 34.66936, 34.66442, 34.66629, 34.66426, 34.65956,
34.66161, 34.66745, 34.64983, 34.59159, 34.49519, 34.3504, 34.24347,
34.22545, _, _, _, _, _,
34.68919, 34.68913, 34.68871, 34.68878, 34.68873, 34.68872, 34.6888,
34.68881, 34.68879, 34.68895, 34.68901, 34.68912, 34.68926, 34.68949,
34.68951, 34.68948, 34.68938, 34.68924, 34.68909, 34.689, 34.68885,
34.6888, 34.68828, 34.68887, 34.68657, 34.68494, 34.68335, 34.68248,
34.68238, 34.6775, 34.67273, 34.66313, 34.66486, 34.65793, 34.6562,
34.66156, 34.65554, 34.62033, 34.55744, 34.47065, 34.34348, 34.25002,
34.22956, _, _, _, _, _,
34.68909, 34.68901, 34.68885, 34.68878, 34.6888, 34.68891, 34.68869,
34.68871, 34.6889, 34.68913, 34.68888, 34.68911, 34.68918, 34.68933,
34.68949, 34.68938, 34.68931, 34.68919, 34.68909, 34.68893, 34.68877,
34.68865, 34.68858, 34.68715, 34.68618, 34.68453, 34.68351, 34.68254,
34.68124, 34.6778, 34.6721, 34.6666, 34.66131, 34.66072, 34.65619,
34.65362, 34.64966, 34.61499, 34.5616, 34.47442, 34.35144, 34.25496,
34.22524, _, _, _, _, _,
34.6895, 34.68932, 34.6893, 34.68892, 34.68882, 34.68921, 34.68892,
34.68879, 34.68915, 34.68914, 34.68907, 34.68884, 34.6891, 34.68924,
34.68931, 34.68921, 34.68926, 34.68922, 34.68904, 34.68899, 34.68878,
34.68863, 34.68801, 34.68579, 34.68612, 34.68433, 34.68378, 34.68218,
34.68137, 34.67871, 34.67516, 34.67161, 34.66607, 34.65724, 34.65378,
34.63417, 34.60339, 34.59902, 34.60001, 34.5077, 34.37504, 34.25841,
34.22023, _, _, _, _, _,
34.68951, 34.68973, 34.68956, 34.68944, 34.68927, 34.68932, 34.68913,
34.68881, 34.68922, 34.68903, 34.6891, 34.68884, 34.68901, 34.68885,
34.68897, 34.68914, 34.68919, 34.689, 34.68885, 34.68876, 34.68865,
34.68843, 34.68841, 34.68606, 34.6843, 34.68343, 34.68253, 34.68172,
34.67913, 34.67711, 34.67249, 34.66605, 34.6571, 34.64689, 34.64745,
34.64311, 34.60998, 34.5623, 34.57174, 34.51093, 34.3715, 34.25227,
34.21811, _, _, _, _, _,
34.68967, 34.68967, 34.68958, 34.68958, 34.68877, 34.68966, 34.68929,
34.6884, 34.68909, 34.68921, 34.68922, 34.689, 34.68879, 34.68897,
34.68904, 34.68918, 34.68915, 34.68889, 34.68866, 34.68848, 34.6886,
34.68826, 34.6883, 34.68694, 34.68306, 34.68212, 34.68042, 34.67833,
34.67659, 34.67588, 34.67207, 34.6652, 34.65406, 34.61832, 34.58306,
34.58138, 34.58829, 34.60596, 34.60027, 34.5105, 34.34222, 34.23452,
34.22602, _, _, _, _, _,
34.68959, 34.68958, 34.68957, 34.68956, 34.68953, 34.68337, 34.68811,
34.68914, 34.68906, 34.68923, 34.68925, 34.68909, 34.68889, 34.68912,
34.68943, 34.68914, 34.68892, 34.68888, 34.68887, 34.68838, 34.68831,
34.68793, 34.68829, 34.68697, 34.68059, 34.68045, 34.67756, 34.67554,
34.67339, 34.67159, 34.66845, 34.65503, 34.61591, 34.58094, 34.53777,
34.52233, 34.52606, 34.56593, 34.53921, 34.43222, 34.2845, 34.21125,
34.24231, _, _, _, _, _,
34.68945, 34.68949, 34.68945, 34.68943, 34.68943, 34.68944, 34.68922,
34.68915, 34.68911, 34.6894, 34.68931, 34.6892, 34.68914, 34.68924,
34.68905, 34.68908, 34.68877, 34.68885, 34.68881, 34.68842, 34.6884,
34.6879, 34.68802, 34.68763, 34.68092, 34.68093, 34.68036, 34.6775,
34.67336, 34.6632, 34.65567, 34.63618, 34.62225, 34.56763, 34.51639,
34.49173, 34.48788, 34.5481, 34.46722, 34.34509, 34.2218, 34.20448, _, _,
_, _, _, _,
34.68941, 34.68936, 34.68932, 34.68932, 34.6893, 34.68929, 34.6892,
34.68909, 34.68927, 34.68922, 34.68916, 34.68891, 34.68911, 34.68898,
34.68904, 34.68884, 34.68879, 34.68876, 34.68874, 34.6885, 34.68839,
34.68813, 34.68803, 34.68717, 34.68214, 34.68233, 34.67995, 34.67618,
34.67073, 34.65077, 34.62623, 34.60034, 34.55086, 34.53221, 34.49446,
34.45528, 34.43586, 34.43716, 34.43646, 34.26166, 34.20138, _, _, _, _,
_, _, _,
34.68933, 34.68931, 34.68932, 34.68919, 34.68922, 34.68916, 34.68919,
34.68918, 34.68916, 34.68911, 34.68916, 34.68916, 34.68904, 34.68894,
34.68893, 34.68875, 34.68878, 34.68864, 34.68855, 34.6884, 34.68819,
34.68809, 34.68761, 34.6873, 34.68381, 34.68283, 34.67754, 34.67266,
34.66279, 34.62197, 34.59358, 34.55758, 34.51126, 34.49483, 34.45336,
34.41607, 34.37473, 34.32235, 34.23733, 34.19921, 34.23457, _, _, _, _,
_, _, _,
34.68909, 34.68909, 34.68907, 34.68913, 34.68914, 34.68914, 34.68914,
34.68912, 34.68911, 34.6891, 34.68908, 34.68904, 34.689, 34.68869,
34.68862, 34.68859, 34.68865, 34.68855, 34.68843, 34.68832, 34.68821,
34.68774, 34.68736, 34.68649, 34.68459, 34.68167, 34.66454, 34.66348,
34.65742, 34.62685, 34.57777, 34.53349, 34.47802, 34.43647, 34.39706,
34.35888, 34.29511, 34.21438, 34.19933, _, _, _, _, _, _, _, _, _,
34.68804, 34.6879, 34.68892, 34.68885, 34.68788, 34.68761, 34.68826,
34.68884, 34.68841, 34.68805, 34.68727, 34.68718, 34.68456, 34.68591,
34.68698, 34.68713, 34.6884, 34.68863, 34.68865, 34.68849, 34.68817,
34.68775, 34.68706, 34.68584, 34.68315, 34.67702, 34.65754, 34.63284,
34.62212, 34.6004, 34.55323, 34.50597, 34.46774, 34.4051, 34.2609,
34.19395, 34.28531, 34.18823, _, _, _, _, _, _, _, _, _, _,
34.63367, 34.65352, 34.64625, 34.63405, 34.63353, 34.63346, 34.62284,
34.60324, 34.55354, 34.52745, 34.58596, 34.59379, 34.52922, 34.52628,
34.54966, 34.60926, 34.6229, 34.64553, 34.64495, 34.64218, 34.64288,
34.64414, 34.652, 34.65873, 34.66006, 34.65052, 34.62603, 34.59209,
34.55157, 34.57809, 34.56358, 34.58074, 34.58493, 34.60033, 34.58833,
34.51393, 34.32708, 34.18441, _, _, _, _, _, _, _, _, _, _,
34.66873, 34.66882, 34.66854, 34.66883, 34.66828, 34.66798, 34.668,
34.66798, 34.66226, 34.66636, 34.6665, 34.66656, 34.66801, 34.66928,
34.66985, 34.66896, 34.66852, 34.6682, 34.66827, 34.66784, 34.66352,
34.65754, 34.65818, 34.66286, 34.66326, 34.66219, 34.66031, 34.6573,
34.65461, 34.6523, 34.64858, 34.64373, 34.63956, 34.6407, 34.63221,
34.51714, 34.36147, 34.17806, _, _, _, _, _, _, _, _, _, _,
34.66753, 34.66809, 34.66507, 34.66716, 34.6702, 34.66846, 34.6672,
34.66302, 34.66493, 34.66797, 34.66824, 34.65371, 34.66935, 34.6701,
34.66965, 34.66721, 34.66442, 34.66637, 34.66568, 34.66604, 34.66619,
34.665, 34.665, 34.66502, 34.66413, 34.66228, 34.66107, 34.65912,
34.6577, 34.65585, 34.65423, 34.65077, 34.64925, 34.64625, 34.63318,
34.50885, 34.3571, 34.18542, _, _, _, _, _, _, _, _, _, _,
34.66975, 34.67014, 34.66085, 34.65967, 34.66617, 34.66836, 34.66856,
34.66863, 34.66813, 34.66726, 34.66603, 34.6583, 34.67051, 34.67002,
34.66699, 34.66386, 34.66139, 34.66616, 34.66689, 34.6658, 34.66625,
34.66525, 34.66544, 34.66516, 34.66505, 34.66375, 34.66341, 34.66262,
34.65789, 34.6568, 34.65662, 34.65414, 34.64934, 34.64449, 34.63931,
34.50135, 34.32468, 34.18411, 34.18809, _, _, _, _, _, _, _, _, _,
34.66512, 34.66647, 34.64202, 34.65528, 34.66846, 34.65862, 34.66825,
34.65629, 34.66741, 34.65773, 34.65781, 34.6606, 34.6705, 34.6692,
34.65997, 34.65989, 34.66309, 34.66533, 34.66418, 34.66533, 34.66653,
34.66529, 34.66491, 34.66519, 34.66502, 34.6648, 34.66388, 34.66314,
34.66135, 34.65916, 34.65735, 34.65542, 34.64798, 34.64559, 34.61631,
34.44025, 34.29192, 34.17913, 34.18063, 34.22137, _, _, _, _, _, _, _, _,
34.66674, 34.66837, 34.65889, 34.66861, 34.66488, 34.66338, 34.66739,
34.65156, 34.65471, 34.64564, 34.65221, 34.66896, 34.67102, 34.64653,
34.64795, 34.64921, 34.66237, 34.66609, 34.66486, 34.66522, 34.66472,
34.66565, 34.66503, 34.66536, 34.66507, 34.66491, 34.66452, 34.66395,
34.66222, 34.66093, 34.65842, 34.6591, 34.65889, 34.658, 34.61998,
34.42043, 34.26434, 34.16882, 34.1786, 34.21635, 34.02689, _, _, _, _, _,
_, _,
34.55636, 34.6554, 34.66856, 34.66737, 34.66788, 34.66295, 34.6697,
34.67002, 34.66328, 34.63746, 34.63584, 34.64537, 34.67225, 34.64152,
34.63361, 34.6594, 34.64709, 34.66349, 34.66481, 34.66577, 34.66486,
34.66525, 34.66502, 34.66581, 34.66558, 34.66522, 34.66483, 34.66528,
34.66319, 34.66244, 34.66167, 34.66225, 34.66234, 34.66085, 34.59233,
34.30733, 34.24223, 34.16765, 34.1764, 34.21425, _, _, _, _, _, _, _, _,
34.66991, 34.66761, 34.66903, 34.6665, 34.66904, 34.66907, 34.66439,
34.66908, 34.66749, 34.62263, 34.61268, 34.65742, 34.67201, 34.6236,
34.61916, 34.62676, 34.66223, 34.66608, 34.66233, 34.66381, 34.66206,
34.66185, 34.66353, 34.66523, 34.66497, 34.66553, 34.66536, 34.66463,
34.66399, 34.66382, 34.66361, 34.66337, 34.6623, 34.65876, 34.50644,
34.34204, 34.28394, 34.19044, 34.17086, 34.21539, _, _, _, _, _, _, _, _,
That's not all of it (the grid is , but it's interesting how the number of blanks seems to be increasing as it goes along. Could be the coastline mask, I'm not sure. For the record, my grid's dimensions are:
netcdf ocean_grd {
dimensions:
xi_psi = 47 ;
xi_rho = 48 ;
xi_u = 47 ;
xi_v = 48 ;
eta_psi = 65 ;
eta_rho = 66 ;
eta_u = 66 ;
eta_v = 65 ;
two = 2 ;
bath = UNLIMITED ; // (0 currently)

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Forcing file fun

#4 Unread post by kate »

It's blowing up when writing the diag file. Does it run without the diagnostic output?

The blanks are indeed your coastline mask, values set to the _fillValue in the netCDF file.

lolhsson
Posts: 23
Joined: Wed Jun 02, 2010 9:07 pm
Location: UC Berkeley

Re: Forcing file fun

#5 Unread post by lolhsson »

I turned off the diagnostic flags in my .h file and recompiled, then ran. Same blow-up at the second timestep (bear in mind that 3506880, on day 7306 since 01/01/1980, which is 01/02/2000, is the initial time):
STEP Day HH:MM:SS KINETIC_ENRG POTEN_ENRG TOTAL_ENRG NET_VOLUME
C => (i,j,k) Cu Cv Cw Max Speed

3506880 7306 00:00:00 2.463986E-05 1.561260E+04 1.561260E+04 6.819257E+14
(38,60,34) 1.208802E-03 1.115459E-03 0.000000E+00 9.091617E-02
DEF_HIS - creating history file: /clusterfs/hadley/scratch/lolhsson/romsdata/2000/10kmtestjeff/ocean_his.nc
WRT_HIS - wrote history fields (Index=1,1) into time record = 0000001
DEF_AVG - creating average file: /clusterfs/hadley/scratch/lolhsson/romsdata/2000/10kmtestjeff/ocean_avg.nc
3506881 7306 00:03:00 NaN NaN NaN NaN
(00,00,00) 0.000000E+00 0.000000E+00 0.000000E+00 NaN

Blowing-up: Saving latest model state into RESTART file
Mysterious! To me, anyway.

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Forcing file fun

#6 Unread post by kate »

What are your Courant numbers? What is your timestep? Have you tried others? If it goes that bad in the first timestep, it could be bad forcing or it could be trouble in the barotropic timesteps. I recently had a case where negative initial ice thickness caused exponential growth of shortwave radiation. You just have to explore to see what your trouble is.

lolhsson
Posts: 23
Joined: Wed Jun 02, 2010 9:07 pm
Location: UC Berkeley

Re: Forcing file fun

#7 Unread post by lolhsson »

I am reasonably confident in my forcing -- is there a way to tell whether ROMS is successfully interpolating from a coarser forcing grid onto the ROMS grid?

As for CFL numbers, this is with the original 180s timestep. If I remember correctly, they need to be less than 0.5 or perhaps 0.25 depending on the numerical scheme used.

Minimum barotropic Courant Number = 1.35189090E-02
Maximum barotropic Courant Number = 1.75678750E-01
Maximum Coriolis Courant Number = 1.85432748E-02

for dimensions of

Minimum X-grid spacing, DXmin = 9.50790407E+00 km
Maximum X-grid spacing, DXmax = 1.04347482E+01 km
Minimum Y-grid spacing, DYmin = 9.63724741E+00 km
Maximum Y-grid spacing, DYmax = 1.05767007E+01 km
Minimum Z-grid spacing, DZmin = 0.00000000E+00 m
Maximum Z-grid spacing, DZmax = 2.32568909E+02 m

That minimum z-grid spacing of 0 makes me squint a little... does that mean there are two depth levels right on top of each other? To sate my curiosity about timestepping, I took the timestep all the way down to 1s, and it still crashed.

I'm curious about the consequence of the second value in this sequence not being exactly 1...

Centers of gravity and integrals (values must be 1, 1, approx 1/2, 1, 1):

1.000000000000 1.047601458608 0.523800729304 1.000000000000 1.000000000000

What's that about?

Thanks,
Liz

User avatar
arango
Site Admin
Posts: 1347
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: Forcing file fun

#8 Unread post by arango »

Yes, that's your problem. The level thickness (Hz) is a positive number and never can be zero. The NaN that you are getting is because in the code we divided by Hz=0. This implies that the model bathymetry (h) is incorrect. We cannot have h=0 anywhere in a ROMS application. You need to smooth and process your bathymetry accordingly. When doing so, we choose a finite value (hmin) for the smallest depth to represent the coastline. The value of hmin depends on the application and resolution. It may range from 1 to 100m. This implies that the coast is a vertical wall in ROMS.

Processing the bathymetry for a ROMS application is the first very basic step. Many users ignore this step. Users need to check application configuration before running. Selecting the coordinates stretching parameters are next step. We have talked about this a lot in this forum :!: There are Matlab scripts to select such vertical stretching parameters ...

lolhsson
Posts: 23
Joined: Wed Jun 02, 2010 9:07 pm
Location: UC Berkeley

Re: Forcing file fun

#9 Unread post by lolhsson »

Actually, I did it with some care, using your matlab scripts and the instructions on the wiki. But obviously, not carefully enough!

Thanks for the insight,
Liz

lolhsson
Posts: 23
Joined: Wed Jun 02, 2010 9:07 pm
Location: UC Berkeley

Re: Forcing file fun

#10 Unread post by lolhsson »

Investigating the bathymetry, the 0s were clearly set by the mask, possibly when processed by seagrid, which I used to generate my grid. I used these instructions, here, to make my bathymetry: (https://www.myroms.org/wiki/index.php/seagrid) and then afterwards used your smooth_bath.m to modify the output 'h' in my grid, and finally set_depth.m (with values decided on after using scoord.m a bit to check out my options) to figure out the 3D grid I needed to initialize.

Do you think it is sufficient to just set all those masking 0s in my smoothed grid netCDF file to some very small positive value, recalculate my depths with set_depth.m and regenerate my 3d initial conditions from there? (I'll find out, learning is doing, but!)

Thanks,
Liz

Post Reply