Construction of forcing file (stationary forcing)

Discussion of how to use ROMS on different regional and basin scale applications.

Moderators: arango, robertson

Post Reply
Message
Author
apaloczy
Posts: 17
Joined: Tue Jan 07, 2014 4:18 pm
Location: Scripps Institution of Oceanography
Contact:

Construction of forcing file (stationary forcing)

#1 Post by apaloczy » Thu Apr 03, 2014 12:41 am

Hello,

I am new to ROMS, and would like to know whether I am setting the time dimension of the forcing variables correctly. sustr and svstr are given at a single time, and I want them to be applied at every time step. It appears that the routine get_2dfld.F is reading the forcing file properly, but I found the "Index:" part of the text output (see below) suspicious. If sustr and svstr have shape (1,eta_u,xi_u) and (1,eta_v,xi_v), how can get_2dfld.F read two indices? I tried setting the "cycle_length" attribute in the sms_time variable to 0., but then I get the following error from routine get_cycle.F: GET_CYCLE - unable to get value for attribute: cycle_length in variable: sms_time This attribute value is expected to be of the same external type as the variable. What would be the best way to specify this stationary forcing?

#======================================
GET_2DFLD - surface v-momentum stress, t = 0 00:00:00
(Rec=0000001, Index=1, File: msc1_frc.nc)
(Tmin= 0.0000 Tmax= 0.0000)
(Min = -1.23370321E-05 Max = -5.10689844E-06)
297 1 00:45:00 3.560151E-02 1.359857E+04 1.359861E+04 2.012812E+14
(158,071,01) 8.525388E-02 9.717515E-02 1.090288E+01 3.073193E+00
GET_2DFLD - surface u-momentum stress, t = 0 00:00:00
(Rec=0000001, Index=2, File: msc1_frc.nc)
(Tmin= 0.0000 Tmax= 0.0000)
(Min = -1.99545517E-05 Max = -8.68067430E-06)
GET_2DFLD - surface v-momentum stress, t = 0 00:00:00
(Rec=0000001, Index=2, File: msc1_frc.nc)
(Tmin= 0.0000 Tmax= 0.0000)
(Min = -1.23370321E-05 Max = -5.10689844E-06)
298 1 00:50:00 3.566264E-02 1.359856E+04 1.359859E+04 2.012812E+14
(158,071,01) 8.391898E-02 9.654408E-02 1.073583E+01 3.160133E+00
GET_2DFLD - surface u-momentum stress, t = 0 00:00:00
(Rec=0000001, Index=1, File: msc1_frc.nc)
(Tmin= 0.0000 Tmax= 0.0000)
(Min = -1.99545517E-05 Max = -8.68067430E-06)

#======================================
Here is the output of ncdump -h from the forcing file:

dimensions:
xi_u = 160 ;
eta_u = 130 ;
xi_v = 161 ;
eta_v = 129 ;
sms_time = 1;
variables:
double sms_time(sms_time) ;
sms_time:field = "surface momentum stress time" ;
sms_time:units = "day" ;
sms_time:cycle_length = 1. ;
double sustr(sms_time, eta_u, xi_u) ;
sustr:field = "surface u-momentum stress, scalar, series" ;
sustr:units = "Newton meter-2" ;
sustr:time = "sms_time" ;
double svstr(sms_time, eta_v, xi_v) ;
svstr:field = "surface v-momentum stress, scalar, series" ;
svstr:units = "Newton meter-2" ;
svstr:time = "sms_time" ;

// global attributes:
:type = "ROMS forcing file" ;
:title = "First test, rectangular non-rotated grid." ;
:out_file = "msc1_frc.nc" ;
:grd_file = "msc1_grd.nc" ;
:history = "2014-04-02 17:28:03.206938" ;
}

Thank you for your time.

User avatar
jivica
Posts: 135
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

Re: Construction of forcing file (stationary forcing)

#2 Post by jivica » Thu Apr 10, 2014 7:14 am

If you have static field you can create forcing file with actually 2 time steps
sms_time 0 and 1000000 because ROMS is linearly interpolating to your model time.
Having those limits encompassing your model run period you are sure to have it correct within the model interval.
You can use ROMS CDL example found in $ROMS/Data/ROMS/CDL/frc_uvstress.cdl and then change appropriate for your grid dimensions and sms_time (you need only sms_time = 2; so remove UNLIMITED, it is easier to fill vars)
hit ncgen -v2 -x frc_uvstress.cdl -o stress.nc
fill the variables (i.e. matlab nc_varput) and that's it.
Another possibility is to use ana_smflux ($ROMS/User/Functionals/ana_smflux.h) if you can have it in analytical form.

Good luck
Ivica

apaloczy
Posts: 17
Joined: Tue Jan 07, 2014 4:18 pm
Location: Scripps Institution of Oceanography
Contact:

Re: Construction of forcing file (stationary forcing)

#3 Post by apaloczy » Thu Apr 10, 2014 11:53 am

Hi Ivica, thanks for your reply.

Your suggestion seems to be better than the "cycle_length" approach I was using. Now that I have made this change, GET_2DFLD is reading the forcing file only once, and not every time step as was happening before.

Thanks,

User avatar
jivica
Posts: 135
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

Re: Construction of forcing file (stationary forcing)

#4 Post by jivica » Thu Apr 10, 2014 11:59 am

glad it helped
the best option is to use ana_ if you can, it is then, during compilation, included directly into the code, so no reading at all.
Cheers,
Ivica

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

Re: Construction of forcing file (stationary forcing)

#5 Post by arango » Fri Apr 11, 2014 4:08 pm

The cycle_length attribute is for other purposes. There is even a better solution for perpetual forcing. You don't need two-time records and avoid all that unnecessary time interpolation at every time-step :!: You guys really need to read the information that I put in the ticket changes to the repository. Check following :arrow: ticket for more information.

We can manipulate the calendar attribute for the time variable. You just need to have one time record in the NetCDF with the calendar attribute set to none for perpetual time axis. This is CF compliant. You can have something like:

Code: Select all

netcdf roms_frc {

dimensions:
        time = 1 ;
variables:
        float time(time) ;
                time:calendar = "none" ;
That's all. It can be easier :idea: Notice that it will very easy to add the calendar attribute or change its value using the repository Matlab script nc_attadd.m:

Code: Select all

status = nc_attadd('roms_frc.nc', 'calendar', 'none', 'time')

apaloczy
Posts: 17
Joined: Tue Jan 07, 2014 4:18 pm
Location: Scripps Institution of Oceanography
Contact:

Re: Construction of forcing file (stationary forcing)

#6 Post by apaloczy » Tue Apr 15, 2014 10:57 am

Understood, Arango. It seems that ticket was just before I started learning ROMS. Thanks.

Post Reply