Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

tslist output: uneven timestep

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

SIGSEV

New member
Hello,
I'm using tslist-output for a number of locations in a real-case LES with two domains. Domain01 uses dt = 0.75 and domain02 dt=0.25 (see namelist at the end).
If I check the tslist-files (profiles and surface data) the model time does not show an even time interval:

Example for *.d01.TS out put for one location
Code:
 1     0.000208   32  265  450     277.56879       0.00574       2.60221       0.90008   94992.50000     260.70294       0.00000      -3.23995      -1.39826     275.29211     281.32925       0.00000       0.00000       0.00000
 1     0.000417   32  265  450     277.93857       0.00573       2.60161       0.87962   94993.53906     260.70294       0.00000      -4.51155      -2.61352     275.91455     281.32910       0.00000       0.00000       0.00000
 1     0.000625   32  265  450     278.07477       0.00563       2.61742       0.86015   94994.24219     260.70294       0.00000      -5.74947      -4.53307     276.12033     281.32895       0.00000       0.00000       0.00000
 1     0.000833   32  265  450     278.12759       0.00561       2.55011       0.85244   94994.35156     260.70294       0.00000      -6.08232      -5.20531     276.18582     281.32880       0.00000       0.00000       0.00000
 1     0.001042   32  265  450     278.13120       0.00560       2.51159       0.84462   94993.61719     260.70294       0.00000      -6.14400      -5.42474     276.20383     281.32864       0.00000       0.00000       0.00000
 1     0.001250   32  265  450     278.11572       0.00561       2.53964       0.86496   94992.34375     260.70294       0.00000      -6.35755      -5.64165     276.23126     281.32849       0.00000       0.00000       0.00000
 1     0.001458   32  265  450     278.13266       0.00562       2.59335       0.83730   94991.87500     260.70294       0.00000      -6.69142      -5.89738     276.26947     281.32834       0.00000       0.00000       0.00000
 1     0.001667   32  265  450     278.15601       0.00562       2.60356       0.83658   94991.83594     260.70294       0.00000      -6.91213      -6.10059     276.29709     281.32819       0.00000       0.00000       0.00000
 1     0.001875   32  265  450     278.17093       0.00563       2.58838       0.89314   94992.52344     260.70294       0.00000      -7.05004      -6.23873     276.31503     281.32803       0.00000       0.00000       0.00000
 1     0.002083   32  265  450     278.19791       0.00563       2.60055       0.90838   94993.21094     260.70294       0.00000      -7.22269      -6.33768     276.33282     281.32788       0.00000       0.00000       0.00000
You can see that the time interval (based on the forecast time in hours in the second column) between two entries does change between 2.09E-4 and 2.08E-4, which corresponds to 0.7524 seconds and 0.7488 seconds, while dt was set to 0.75 for that domain in the namelist.

Example for *.d01.TS out put for one location
Code:
 2     0.000069   32  676 1205     277.53430       0.00567       2.64453       0.80220   95020.10938     259.52454       0.00000      -3.32353      -1.43522     275.24390     281.34613       0.00000       0.00000       0.00000
 2     0.000139   32  676 1205     277.92667       0.00567       2.64115       0.79859   95020.48438     259.52454       0.00000      -4.61778      -2.48920     275.85529     281.34607       0.00000       0.00000       0.00000
 2     0.000208   32  676 1205     278.03983       0.00558       2.65008       0.79194   95020.87500     259.52454       0.00000      -5.84423      -4.34998     276.05612     281.34601       0.00000       0.00000       0.00000
 2     0.000278   32  676 1205     278.09448       0.00556       2.64575       0.78846   95021.03125     259.52454       0.00000      -6.46406      -5.14481     276.14807     281.34595       0.00000       0.00000       0.00000
 2     0.000347   32  676 1205     278.12674       0.00557       2.64752       0.78458   95021.03125     259.52454       0.00000      -6.84580      -5.56417     276.20013     281.34589       0.00000       0.00000       0.00000
 2     0.000417   32  676 1205     278.14780       0.00557       2.64965       0.77850   95021.04688     259.52454       0.00000      -7.07939      -5.80907     276.23129     281.34583       0.00000       0.00000       0.00000
 2     0.000486   32  676 1205     278.16440       0.00557       2.64435       0.77147   95021.28125     259.52454       0.00000      -7.18535      -5.92969     276.24612     281.34576       0.00000       0.00000       0.00000
 2     0.000556   32  676 1205     278.17169       0.00556       2.63495       0.76151   95021.47656     259.52454       0.00000      -7.18959      -5.96330     276.24863     281.34570       0.00000       0.00000       0.00000
 2     0.000625   32  676 1205     278.17288       0.00556       2.62212       0.75703   95021.42188     259.52454       0.00000      -7.13020      -5.93634     276.24304     281.34564       0.00000       0.00000       0.00000
 2     0.000694   32  676 1205     278.16937       0.00555       2.60510       0.74373   95021.24219     259.52454       0.00000      -7.00477      -5.85771     276.22977     281.34558       0.00000       0.00000       0.00000
While for domain d02 the time interval between two entries does change between 7E-5 and 6.9E-5, which corresponds to 0.252 seconds and 0.2484 seconds, while dt was set to 0.25 in the namelist.

This is not a big problem if one calculates, e.g. 10-min mean averages based on the tslist-output - However, I want to calculate power spectra of wind components and, therefore, need to know the sampling rate of my time series.

Is this slight deviation of the "tslist-dt" from the "namelist-specified dt" caused by either truncation or some issues with floating point representation or is it "real", i.e. does the WRF change the time-step internally in some way so that it is slightly off the namelist-specififed value?

Any thoughts and information on this issue will be really helpful!


namelist.input:
Code:
 &time_control
 run_days                            = 0,
 run_hours                           = 16,
 run_minutes                         = 30,
 run_seconds                         = 0,
 start_year                          = 2017,   2017,
 start_month                         = 11,       11,
 start_day                           = 04,       04,
 start_hour                          = 01,       01,
 start_minute                        = 30,       30,
 start_second                        = 00,       00,
 end_year                            = 2017,   2017,
 end_month                           = 11,       11,
 end_day                             = 04,       04,
 end_hour                            = 18,       18,
 end_minute                          = 00,       00,
 end_second                          = 00,       00,
 interval_seconds                    = 1200,
 input_from_file                     = .true., .true.,
 fine_input_stream                   = 0,  2,
 history_interval                    = 15, 15,
 frames_per_outfile                  = 1,   1,
 restart                             = .true.,
 restart_interval                    = 15,
 io_form_history                     = 11,
 io_form_restart                     = 102,
 io_form_input                       = 2,
 io_form_boundary                    = 2,
 io_form_auxinput2                   = 2,
/

&domains
 time_step                           = 0,
 time_step_fract_num                 = 3,
 time_step_fract_den                 = 4,
 max_dom                             = 2,
 e_we                                = 556,  1551,
 e_sn                                = 836,  1701,
 e_vert                              = 81, 81,
 p_top_requested = 4000.
 eta_levels      = 1.0000, 0.9974, 0.9949, 0.9924, 0.9898,
                   0.9871, 0.9843, 0.9814, 0.9784, 0.9752,
                   0.9718, 0.9681, 0.9642, 0.9600, 0.9555,
                   0.9507, 0.9455, 0.9399, 0.9339, 0.9274,
                   0.9206, 0.9132, 0.9053, 0.8970, 0.8881,
                   0.8786, 0.8686, 0.8580, 0.8468, 0.8350,
                   0.8226, 0.8096, 0.7960, 0.7818, 0.7670,
                   0.7515, 0.7355, 0.7189, 0.7017, 0.6840,
                   0.6658, 0.6470, 0.6278, 0.6081, 0.5880,
                   0.5676, 0.5467, 0.5256, 0.5043, 0.4827,
                   0.4610, 0.4392, 0.4173, 0.3954, 0.3736,
                   0.3519, 0.3304, 0.3091, 0.2881, 0.2674,
                   0.2472, 0.2274, 0.2081, 0.1904, 0.1811,
                   0.1717, 0.1540, 0.1373, 0.1215, 0.1066,
                   0.0927, 0.0798, 0.0677, 0.0565, 0.0461,
                   0.0366, 0.0278, 0.0198, 0.0125, 0.0059,
                   0.0,
 num_metgrid_levels                  = 138,
 num_metgrid_soil_levels             = 4,
 dx                                  = 200,  40,
 dy                                  = 200,  40,
 grid_id                             = 1,     2,
 parent_id                           = 0,     1,
 i_parent_start                      = 1,   130,
 j_parent_start                      = 1,   210,
 parent_grid_ratio                   = 1,     5,
 parent_time_step_ratio              = 1,     3,
 feedback                            = 0,
 smooth_option                       = 0,
 max_ts_locs                         = 200,
 max_ts_level                        = 50,
 interp_theta                        = .true.,
 interp_type                         = 2,
 extrap_type                         = 2,
 t_extrap_type                       = 3,
 use_surface                         = .true.,
 smooth_cg_topo                      = .true.,
/

 &physics
 mp_physics                          = 2,     2,
 ra_lw_physics                       = 4,     4,
 ra_sw_physics                       = 4,     4,
 radt                                = 5,     5,
 sf_sfclay_physics                   = 1,     1,
 sf_surface_physics                  = 2,     2,
 bl_pbl_physics                      = 0,     0,
 bldt                                = 0,     0,
 cu_physics                          = 0,     0,
 cudt                                = 0,
 shcu_physics                        = 0,     0,
 isfflx                              = 1,
 ifsnow                              = 1,
 icloud                              = 1,
 surface_input_source                = 3,
 num_soil_layers                     = 4,
 num_land_cat                        = 33,
 sf_urban_physics                    = 0,
 slope_rad                           = 1,
 topo_shading                        = 1,     1,
 /
 
 &dynamics
 w_damping                           = 1,
 diff_opt                            = 2,     2,
 km_opt                              = 2,     2, 
 diff_6th_opt                        = 0,     0, 
 diff_6th_factor                     = 0.12,  0.12,
 base_temp                           = 290.
 damp_opt                            = 3,
 zdamp                               = 8000.,
 dampcoef                            = 0.2,
 khdif                               = 0,     0,
 kvdif                               = 0,     0,
 non_hydrostatic                     = .true., .true.,
 moist_adv_opt                       = 1,     1,
 scalar_adv_opt                      = 1,     1,
 use_theta_m                         = 1,
 time_step_sound                     = 6,
 m_opt                               = 1,     1,
 epssm                               = 0.9,   0.9,
 smdiv                               = 0.1,   0.2,
 emdiv                               = 0.01,  0.02,
 sfs_opt                             = 0,     0,
 use_input_w                         = .true.,
 c_k                                 = 0.08,
 do_avgflx_em                        = 1,     1,
 mix_isotropic                       = 1,     1,
/

 &bdy_control
 spec_bdy_width                      = 20,
 spec_zone                           = 1,
 relax_zone                          = 19,
 specified                           = .true., .false.,
 nested                              = .false., .true.,
 /

 &grib2
 /

 &namelist_quilt
 nio_tasks_per_group = 0,
 nio_groups = 0,
 /
 
Hi,
I just want to let you know that I have been able to repeat this problem. We are looking into it and hope to have some code modification suggestions soon. Thank you for your patience.

Kelly
 
The WRF model should be taking a consistent 0.75 s timestep for domain 1, and a 0.25 s timestep for domain 2 (unless the adaptive timestep option were being used). To a small degree, the deviations in the timeseries output are due to numerical round-off, but more importantly, the format that the timeseries code is using when writing out the values may be to blame. For a simple demonstration of the issue, you can try the following C code, which can be compiled with, e.g., "gcc timestep.c" to produce an "a.out" executable:
Code:
#include <stdio.h>

int main(void)
{
        int itimestep;
        float time;

        /*
         * Print integration time using fixed-point format
         */
        time = 0.75;
        for (itimestep=0; itimestep<10; itimestep++) {
                printf("%13.6f\n", (time / 3600.0));
                time += 0.75;
        }
        printf("\n");

        /*
         * Print integration time using exponent notation
         */
        time = 0.75;
        for (itimestep=0; itimestep<10; itimestep++) {
                printf("%13e\n", (time / 3600.0));
                time += 0.75;
        }

        return 0;
}
An easy solution may be to just modify the format that is being used when writing the "ts_hour" variable to the timeseries files. You can find this format string in the "wrf_timeseries.F" code here: https://github.com/wrf-model/WRF/blob/v4.0/share/wrf_timeseries.F#L570 . For example, rather than a format for "ts_hour" of "f13.6", you could try "f13.9". If you'd like, you could even just output the time in minutes rather than hours by modifying the computation of "ts_hour" here: https://github.com/wrf-model/WRF/blob/v4.0/share/wrf_timeseries.F#L376 .
 
Top