Skip to content

*.lin (link files)

Purpose

The link line of file.cio names two optional files that connect objects outside the routing set up by the connectivity files:

  • chan-surf.lin lists, for a SWAT+ channel, the HRUs or routing units on its floodplain. On days with overbank flow, the wetlands of those HRUs are filled from the channel.
  • aqu_cha.lin lists, for an aquifer, the channels that receive its return flow. The flow is shared among the channels by channel length and drainage area.

The line gives the two names in this order. The defaults, chan-surf.lin and aqu_cha.lin, apply only when file.cio ends before the line (see the master file). Projects that do not use the files give null for both, as the reference datasets in the SWAT+ repository do. Earlier documentation called the first file chan_surf.lin.

Neither file has column names that SWAT+ checks. Both readers skip the header line and take the values by position, so the column names on this page are descriptive.

chan-surf.lin

Free format, whitespace-separated. Line 1 is a title and is skipped. Line 2 is a single whole number, the number of channel rows; SWAT+ also counts the rows itself, and the count only sets a minimum size for the table. Line 3 is a column header and is skipped. Each later line links one channel to its floodplain objects:

# Column Units Description
1 id - Number of the SWAT+ channel, as numbered in chandeg.con.
2 name - Name of the floodplain. Not used in calculations.
3 num_obj count Number of floodplain objects that follow. A row with 0 gives the channel no floodplain links.
4 obj_typ - Type of the first floodplain object: hru or ru (routing unit).
5 obj_id - Number of the first floodplain object, as numbered in hru.con or rout_unit.con.
6, 7, ... obj_typ, obj_id - One further pair for each remaining object, num_obj pairs in all.

Object types other than hru and ru are read and then ignored. For an ru object, SWAT+ takes the element numbers that rout_unit.def lists for that routing unit and uses each one as an HRU number. This selects the routing unit's HRUs only when each element number in rout_unit.ele equals the number of the HRU it refers to.

The links apply to channels routed with the SWAT+ channel method (chandeg.con). Legacy channels (channel.con) make no use of them.

Overbank flow to floodplain wetlands

Overbank flow happens on days when the channel's peak flow rate is above the bankfull threshold described under floodplain deposition. The overbank volume \(V_{ob}\) is the floodplain volume of the channel's rating curve at the peak flow rate. After floodplain deposition, SWAT+ goes through the floodplain HRUs in the order listed (a routing unit contributes its HRUs in the order of its elements). For each HRU it takes the room left in the HRU's wetland,

\[V_{fill} = V_{emr} - V_{wet}\]

where \(V_{emr}\) is the wetland's emergency volume and \(V_{wet}\) its current storage (m³), and subtracts it from the overbank volume still available. When the overbank volume runs out, \(V_{fill}\) is cut to what was left. The wetland then receives the fraction

\[r = \min\!\left(1,\; \frac{V_{fill}}{Q_{in}}\right)\]

of the channel's inflow \(Q_{in}\) for the day (m³), with the same fraction of its sediment, nutrients and other constituents, and the channel inflow is reduced by that fraction.

Only HRUs with surface storage, a surf_stor entry in hru-data.hru that names a record in wetland.wet, receive water. Other HRUs in the list take nothing from the channel. The water each wetland receives is reported in the overbank column (mm) of the HRU water balance output. See also overbank flow and floodplain deposition in the model theory, and the wetland inputs for the emergency volume.

Missing file and repeated read

SWAT+ reads chan-surf.lin while it sets up the SWAT+ channels, whether or not the model has any.

  • If the slot is null, the file is skipped and no channel has floodplain links.
  • If the slot gives a name and no file of that name exists, SWAT+ opens it anyway. This creates an empty file of that name in the run folder, nothing is read from it, and no channel has floodplain links.
  • When object.cnt counts legacy channels (cha above 0), SWAT+ reads the file a second time, earlier in the setup, before the SWAT+ channels exist. If the file exists, the second read tries to set up the same table again and the run stops with an error.

aqu_cha.lin

Free format, whitespace-separated. Line 1 is a title and line 2 a column header; both are skipped. Each later line links one aquifer to a set of channels:

# Column Units Description
1 id - Number of the aquifer, as numbered in aquifer.con.
2 name - Name of the link. Not used in calculations.
3 num_elem count Number of values in the channel list that follows. A row with 0 links no channels.
4, 5, ... elements - Channel numbers, as numbered in chandeg.con. A negative value marks a range: 1 -4 means channels 1 to 4.

The aquifer numbers must lie between 1 and the number of aquifers. SWAT+ reads as many rows as the largest aquifer number in the first column, so each aquifer should appear on one row only. Earlier documentation described the file as a replacement for aquifer.con. In 62.0.1 aquifer.con is still required, see overlap with aquifer outflows.

Return flow shares

For each linked aquifer, SWAT+ sorts the linked channels by drainage area, smallest first. The drainage area is the area column of chandeg.con and the channel length \(L_i\) is the len column of hyd-sed-lte.cha (km). With \(L_{tot}\) the total length of the linked channels, the length left when channel \(i\) and all smaller channels have stopped receiving flow is

\[L_{left,i} = L_{tot} - \sum_{j \le i} L_j\]

Each day the contributing channel length grows with the aquifer's return flow \(Q\) (mm):

\[L_c = L_{tot}\,\frac{Q}{\mathrm{bf\_max}}\]

where bf_max is given in aquifer.aqu (mm; see aquifer files). The first contributing channel \(k\) is the smallest channel with \(L_c \ge L_{left,k}\), and each channel from \(k\) upward receives the share

\[f_i = \frac{L_i}{L_{left,k} + L_k}, \qquad i \ge k\]

while the smaller channels receive nothing. The shares of the contributing channels add up to 1, so the whole return flow of the aquifer is passed on. When \(Q\) is at or above bf_max, every linked channel receives flow in proportion to its length. As \(Q\) falls, the channels with the smallest drainage areas stop receiving flow first. See baseflow in the model theory.

Each linked channel adds its share of the aquifer's return flow hydrograph, with its nitrate, phosphorus, salts and constituents, to its inflow. This happens when the channel is routed: on the same day if the aquifer comes before the channel in the routing order, otherwise on the next day. The water appears in the geo_bf column (m³/s) of the channel output.

Channel order, lengths and bf_max

  • The shares are computed in drainage-area order. Each channel looks up its share by its position in the aqu_cha.lin list. A channel receives its intended share only when the list for each aquifer is already in order of increasing drainage area. In any other order, channels receive each other's shares; the total for the aquifer does not change.
  • The channel length is taken from the row of hyd-sed-lte.cha whose position equals the channel's record number in channel-lte.cha. This gives the right length when both files list the channels in the same order.
  • Once the file is read, the calculation divides by bf_max for every aquifer, including aquifers the file does not list. With bf_max = 0 the division fails, and builds that stop on floating-point errors (the Intel builds, for example) stop the run. Give every aquifer a bf_max above zero when aqu_cha.lin is used.

Overlap with aquifer outflows

aqu_cha.lin is read only when object.cnt counts aquifers, right after aquifer.con. The aquifer still routes its return flow through the outflows listed in aquifer.con, and SWAT+ also passes the shares above to the linked channels. A model that lists the same channels as outflows in aquifer.con and in aqu_cha.lin sends the return flow to them twice.

When gwflow is active, SWAT+ sets the aquifer count to 0 and aqu_cha.lin is not read.

Missing or short file

  • If the slot is null or the file does not exist, the file is skipped and no aquifer is linked to channels.
  • If the file exists but has fewer than two lines, the run stops with an end-of-file error.

Example

No dataset in the SWAT+ repository uses either file. The two files below are illustrative.

chan-surf.lin: illustrative example
2
id  name    num_obj  obj_typ  obj_id  obj_typ  obj_id
1   fp001   2        hru      4       hru      5
3   fp003   1        ru       2

Channel 1 is linked to HRUs 4 and 5, and channel 3 to the HRUs of routing unit 2. On a day with overbank flow in channel 1, the wetland of HRU 4 is filled first, then that of HRU 5, as long as overbank volume remains. An HRU without surface storage receives nothing.

aqu_cha.lin: illustrative example
id  name    num_elem  elements
1   aqu01   2         1  -4
2   aqu02   3         5  7  9

Aquifer 1 shares its return flow among channels 1 to 4, and aquifer 2 among channels 5, 7 and 9. For the shares to reach the intended channels, channels 1 to 4 must have increasing drainage areas in that order, and so must channels 5, 7 and 9. Neither aquifer should also route its return flow to these channels in aquifer.con.

Sources
File Column Fortran variable
chan-surf.lin line 2 count mcha_sp
chan-surf.lin id index i of sd_ch
chan-surf.lin name sd_ch%fp%name
chan-surf.lin num_obj nspu, sd_ch%fp%obj_tot
chan-surf.lin obj_typ sd_ch%fp%obtyp
chan-surf.lin obj_id sd_ch%fp%obtypno
aqu_cha.lin id index iaq of aq_ch
aqu_cha.lin name aq_ch%name
aqu_cha.lin num_elem nspu
aqu_cha.lin elements elem_cnt, expanded to aq_ch%num
aquifer.aqu bf_max aqudb%bf_max
hyd-sed-lte.cha len sd_chd%chl
chandeg.con area ob%area_ha