Difference between revisions of "Atmospheric forcing"

From ccrmwiki
Jump to: navigation, search
(A few details)
Line 1: Line 1:
 
==Theory==
 
==Theory==
  
[http://ccrm.vims.edu/yinglong/wiki_files/HeatExchange-Theory.pdf Here] is some info about the heat exchange module inside SELFE, based on Dr. Mike Zuluaf's slides.  
+
[http://ccrm.vims.edu/yinglong/wiki_files/HeatExchange-Theory.pdf Here] is some info about the heat exchange module inside SCHISM, based on Dr. Mike Zuluaf's slides.  
  
 
==Summary of inputs==
 
==Summary of inputs==
Line 23: Line 23:
  
 
==File description==
 
==File description==
In SELFE, atmoserpic forcings include wind, air pressure and temperature, precipitation, humidity and longwave and shortwave fluxes. These are specified in the netcdf files inside sflux/ dir, and conform to the [http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.0/cf-conventions.html NetCDF Climate and Forecast (CF) Metadata Convention 1.0].
+
In SCHISM, atmoserpic forcings include wind, air pressure and temperature, precipitation, humidity and longwave and shortwave fluxes. These are specified in the netcdf files inside sflux/ dir, and conform to the [http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.0/cf-conventions.html NetCDF Climate and Forecast (CF) Metadata Convention 1.0].
  
 
There are 4 types of files in sflux/dir; see [http://www.stccmop.org/CORIE/modeling/selfe/NARR/narr.html this site] for sample files.
 
There are 4 types of files in sflux/dir; see [http://www.stccmop.org/CORIE/modeling/selfe/NARR/narr.html this site] for sample files.
Line 47: Line 47:
 
Using air as an example, it is assumed that the file sflux_air_2.001.nc is more resolved or accurate than sflux_air_1.001.nc. The two will be blended in the model in a way that favors the _2 file. This blending of the fields is only adjustable in the fortran as described in notes below. The default in sflux_9c.F90 is a 99:1 blend of the _2_ file to the _1_ file.  
 
Using air as an example, it is assumed that the file sflux_air_2.001.nc is more resolved or accurate than sflux_air_1.001.nc. The two will be blended in the model in a way that favors the _2 file. This blending of the fields is only adjustable in the fortran as described in notes below. The default in sflux_9c.F90 is a 99:1 blend of the _2_ file to the _1_ file.  
  
As was remarked above, the files are arranged temporally in a stack of files starting with ".001". Given the sequence of forecasting and analysis, it is common for atmospheric files to overlap. A file might begin with a brief period of data assimilation plus a few days of forecast. SELFE assumes that a new file indicates the injection of information, so when it encounters overlap, it advances to the later file.
+
As was remarked above, the files are arranged temporally in a stack of files starting with ".001". Given the sequence of forecasting and analysis, it is common for atmospheric files to overlap. A file might begin with a brief period of data assimilation plus a few days of forecast. SCHISM assumes that a new file indicates the injection of information, so when it encounters overlap, it advances to the later file.
  
 
==Using NARR files for your simulation (North America only)==
 
==Using NARR files for your simulation (North America only)==
Line 61: Line 61:
 
sflux_air_1.012.nc --> narr_air.2004_06_21.nc (extra day to account for time zone difference)<br/>
 
sflux_air_1.012.nc --> narr_air.2004_06_21.nc (extra day to account for time zone difference)<br/>
  
Similarly for sflux_rad_*.nc and sflux_prc_*.nc. As described above, the number "1" after "air_" denotes the first data set used, with the second set taking priority; you can use up to 2 sets in SELFE (which combines them with some given weights set in sflux_subs.F90); here you only use 1 set.
+
Similarly for sflux_rad_*.nc and sflux_prc_*.nc. As described above, the number "1" after "air_" denotes the first data set used, with the second set taking priority; you can use up to 2 sets in SCHISM (which combines them with some given weights set in sflux_subs.F90); here you only use 1 set.
  
 
Don't forget to update sflux_inputs.txt also.
 
Don't forget to update sflux_inputs.txt also.
Line 79: Line 79:
 
i.e. lat/lon
 
i.e. lat/lon
  
'''watertype.gr3:''' 6 is clear water, 7 is muddiest. Search in selfe_init.F90 for watertype.
+
'''watertype.gr3:''' 6 is clear water, 7 is muddiest. Search in schism_init.F90 for watertype.
  
 
==A few details==
 
==A few details==

Revision as of 12:34, 18 December 2014

Theory

Here is some info about the heat exchange module inside SCHISM, based on Dr. Mike Zuluaf's slides.

Summary of inputs

Production modeling is generally done using netcdf formatted inputs as described below. However there are facilities for producing sample wind fields for test problems as well. The choice of atmospheric formats is controlled by the parameter nws in file param.in:

nws=0 
no forcing
nws=1 
wind.th for wind
nws=2 
NetCDF forcing (wind, pressure and heat module)
nws=4 
ascii wind and pressure (only documented in source code)

There are several other parameters associated with these choices. For instance for nws=1 it is possible to scale the wind spatially using a gr3 file.

One parameter that you should treat with some care is wtiminc, which is the time step for atmospheric forcing. This parameter originally provided the time step for an older version of wind.th that was a little different from others in that it had no time column. The parameter is also used as a sampling interval for the NetCDF files. In this case, odd behavior will result unless wtiminc comfortably oversamples the data in the file. The safest value to use is the model time step.

File description

In SCHISM, atmoserpic forcings include wind, air pressure and temperature, precipitation, humidity and longwave and shortwave fluxes. These are specified in the netcdf files inside sflux/ dir, and conform to the NetCDF Climate and Forecast (CF) Metadata Convention 1.0.

There are 4 types of files in sflux/dir; see this site for sample files.

  1. sflux_inputs.txt:
    $cat sflux_inputs.txt
    &sflux_inputs  ! file name
    start_year = 1998, ! start year
    start_month = 09, ! start month
    start_day = 01, ! start day
    start_hour = 0.0, ! start hour
    utc_start = 0.0, ! offset from UTC in hours, with positive numbers for western hemishpere
    /
  2. sflux_air_1.0*.nc: netcdf files that have time, wind speed, air temperature and pressure and specific humidity;
  3. sflux_prc_1.0*.nc: netcdf files that have precipitation data;
  4. sflux_rad_1.0*.nc: netcdf files that have downward long and short (solar) wave radiation fluxes.

Two sources of data are allowed, and the relative priority is fixed by the file name. For instance 1_air.003.nc is might be blended with a file called 2_air.003.nc. The ".003" component of the name represents the order of the file within the stack of provided input files. For instance, there might be a new file (001,002,003) produced every 12 hours in a forecast cycle.

Interpolation and prioritization

Using air as an example, it is assumed that the file sflux_air_2.001.nc is more resolved or accurate than sflux_air_1.001.nc. The two will be blended in the model in a way that favors the _2 file. This blending of the fields is only adjustable in the fortran as described in notes below. The default in sflux_9c.F90 is a 99:1 blend of the _2_ file to the _1_ file.

As was remarked above, the files are arranged temporally in a stack of files starting with ".001". Given the sequence of forecasting and analysis, it is common for atmospheric files to overlap. A file might begin with a brief period of data assimilation plus a few days of forecast. SCHISM assumes that a new file indicates the injection of information, so when it encounters overlap, it advances to the later file.

Using NARR files for your simulation (North America only)

First, make sure the NARR grid covers your hgrid.ll.

In your run directory, mkdir sflux and inside it, create symbolic links to the NARR files. e.g., if you run starts from June 10, 2004 and ends June 20, 2004, then

sflux_air_1.001.nc --> narr_air.2004_06_10.nc
sflux_air_1.002.nc --> narr_air.2004_06_11.nc
...
sflux_air_1.011.nc --> narr_air.2004_06_20.nc
sflux_air_1.012.nc --> narr_air.2004_06_21.nc (extra day to account for time zone difference)

Similarly for sflux_rad_*.nc and sflux_prc_*.nc. As described above, the number "1" after "air_" denotes the first data set used, with the second set taking priority; you can use up to 2 sets in SCHISM (which combines them with some given weights set in sflux_subs.F90); here you only use 1 set.

Don't forget to update sflux_inputs.txt also.



Preparing your own sflux inputs

After familiarize yourself with the NARR files and their format, you may embark on creating your own nc files. The best way is to modify existing matlab scripts (src/Utility/Sflux_nc/readnc*.m) included in the source code bundle, which have extensively in-line comments to guide you along the way.

Conventions for .nc-files in sflux directory and additional files needed for sflux run:

wind: u-component is eastward, v-comp. is northward (normal math convention, not compass convention)

windrot_geo2proj.gr3: rotates winds in case they do not align with coordinate axes, i.e. lat/lon

watertype.gr3: 6 is clear water, 7 is muddiest. Search in schism_init.F90 for watertype.

A few details

Below are some details from sflux_9c.F90, near the beginning of the code.

  • Of all attributes in nc file, only 'base_date' is required;
  • The grids for air, rad and prc can be different (but must be the same within each type and each source). Additional requirements for the structured grid in .nc: [lon,lat](nx,ny) give x,y coord., nx is # of pts in x. Suppose a node in the grid is given by (i,j) (1<=i<=nx), then the quad (i,j), (i+1,j), (i+1,j+1,i,j+1) must be along counter-clockwise direction;
  • Search for "relative_weight" (inside netcdf_io) to change relative weights of the 2 sources for air, rad and prc if needed. All weights must > 0!
  • in case of 2 sources/grids for a variable, use "1" as larger grid (i.e. encompassing hgrid.ll) and "2" as smaller grid. The code will calculate weights associated with the 2 grids, and if some nodes in hgrid.ll fall outside grid "2" the interpolation will be done on grid "1" only (see combine_sflux_data, in particular, bad_node_ based on area coordinates outside [0,1]). Both grids must start from stack 1 and have same # of stacks for each variable. However, within each nc file # of time steps can vary;
  • air_1_max_window_hours (etc) are set in netcdf_io to define the max. time stamp (offset from start time in each) within each nc file. Besides those in netcdf_io, max_file_times (max. # of time records in each nc file) in routine get_times_etc () may need to be adjusted as well.

air-files (header displayed using the ncdump utility)

netcdf sflux_air_1.001 {
dimensions:
        nx_grid = 349 ;
        ny_grid = 277 ;
        time = UNLIMITED ; // (8 currently)
variables:
        float time(time) ;
                time:long_name = "Time" ;
                time:standard_name = "time" ;
                time:units = "days since 2001-01-01" ;
                time:base_date = 2001, 1, 1, 0 ;
        float lon(ny_grid, nx_grid) ;
                lon:long_name = "Longitude" ;
                lon:standard_name = "longitude" ;
                lon:units = "degrees_east" ;
        float lat(ny_grid, nx_grid) ;
                lat:long_name = "Latitude" ;
                lat:standard_name = "latitude" ;
                lat:units = "degrees_north" ;
        float uwind(time, ny_grid, nx_grid) ;
                uwind:long_name = "Surface Eastward Air Velocity (10m AGL)" ;
                uwind:standard_name = "eastward_wind" ;
                uwind:units = "m/s" ;
        float vwind(time, ny_grid, nx_grid) ;
                vwind:long_name = "Surface Northward Air Velocity (10m AGL)" ;
                vwind:standard_name = "northward_wind" ;
                vwind:units = "m/s" ;
        float prmsl(time, ny_grid, nx_grid) ;
                prmsl:long_name = "Pressure reduced to MSL" ;
                prmsl:standard_name = "air_pressure_at_sea_level" ;
                prmsl:units = "Pa" ;
        float stmp(time, ny_grid, nx_grid) ;
                stmp:long_name = "Surface Air Temperature (2m AGL)" ;
                stmp:standard_name = "air_temperature" ;
                stmp:units = "K" ;
        float spfh(time, ny_grid, nx_grid) ;
                spfh:long_name = "Surface Specific Humidity (2m AGL)" ;
                spfh:standard_name = "specific_humidity" ;
                spfh:units = "1" ;

// global attributes:
                :Conventions = "CF-1.0" ;
}

rad-files (header displayed using the ncdump utility)

netcdf sflux_rad_1.001 {
dimensions:
        nx_grid = 349 ;
        ny_grid = 277 ;
        time = UNLIMITED ; // (8 currently)
variables:
        float time(time) ;
                time:long_name = "Time" ;
                time:standard_name = "time" ;
                time:units = "days since 2001-01-01" ;
                time:base_date = 2001, 1, 1, 0 ;
        float lon(ny_grid, nx_grid) ;
                lon:long_name = "Longitude" ;
                lon:standard_name = "longitude" ;
                lon:units = "degrees_east" ;
        float lat(ny_grid, nx_grid) ;
                lat:long_name = "Latitude" ;
                lat:standard_name = "latitude" ;
                lat:units = "degrees_north" ;
        float dlwrf(time, ny_grid, nx_grid) ;
                dlwrf:long_name = "Downward Long Wave Radiation Flux" ;
                dlwrf:standard_name = "surface_downwelling_longwave_flux_in_air" ;
                dlwrf:units = "W/m^2" ;
        float dswrf(time, ny_grid, nx_grid) ;
                dswrf:long_name = "Downward Short Wave Radiation Flux" ;
                dswrf:standard_name = "surface_downwelling_shortwave_flux_in_air" ;
                dswrf:units = "W/m^2" ;

// global attributes:
                :Conventions = "CF-1.0" ;
}

prc-files (header displayed using the ncdump utility)

netcdf sflux_prc_1.001 {
dimensions:
        nx_grid = 349 ;
        ny_grid = 277 ;
        time = UNLIMITED ; // (8 currently)
variables:
        float time(time) ;
                time:long_name = "Time" ;
                time:standard_name = "time" ;
                time:units = "days since 2001-01-01" ;
                time:base_date = 2001, 1, 1, 0 ;
        float lon(ny_grid, nx_grid) ;
                lon:long_name = "Longitude" ;
                lon:standard_name = "longitude" ;
                lon:units = "degrees_east" ;
        float lat(ny_grid, nx_grid) ;
                lat:long_name = "Latitude" ;
                lat:standard_name = "latitude" ;
                lat:units = "degrees_north" ;
        float prate(time, ny_grid, nx_grid) ;
                prate:long_name = "Surface Precipitation Rate" ;
                prate:standard_name = "precipitation_flux" ;
                prate:units = "kg/m^2/s" ;

// global attributes:
                :Conventions = "CF-1.0" ;
}