Boundary conditions (bctides)
The bctide tool writes the SCHISM bctides.in file from a YAML
description of the open boundaries. The YAML names each boundary and states,
variable by variable, where its forcing comes from. The tool maps each choice
onto the integer type codes SCHISM expects, writes the accompanying parameters
(constants, tidal amplitudes and phases, nudging and relaxation factors) and
logs the resulting assignment for every boundary.
The keywords and checks below were verified against src/Hydro/schism_init.F90
and src/Hydro/schism_step.F90 in SCHISM.
Running the tool
The preprocessor (prepare_schism) calls the same machinery when its main
YAML contains a bctides section.
Main YAML
The main YAML names the mesh and lists one entry per bctides file. Entries
are usually kept in separate files and pulled in with include:
mesh:
mesh_inputfile: ./hgrid.gr3
open_boundaries: !include open_boundary.yaml # optional
bctides:
include:
- bctides.in.2d.yaml
- bctides.in.3d.yaml
When mesh.open_boundaries is given, its linestrings replace the open
boundaries stored in hgrid.gr3. The linestrings must have the same number
and names as the open_boundaries of each bctides entry.
Boundary names in the YAML must match the names in the hgrid.gr3 boundary
comments (! Open boundary "name"). Entries are reordered to hgrid order, so
the YAML order does not matter.
bctides entry
Key |
Meaning |
|---|---|
|
Output file name, e.g. |
|
Start date written on the first line. Optional; defaults to 2020-01-01. |
|
Required. |
|
Required when |
|
Tracer modules, each |
|
Tidal potential: |
|
Tidal forcing frequencies: |
|
List of open boundaries, described next. |
Open boundaries
Each open boundary has a name, a required flow_direction and a list of
variables. Each item in variables is a single variable:
open_boundaries:
- name: ocean
flow_direction: bidirection
variables:
- elevation:
source: th_nc
- velocity:
source: th_nc
- temperature:
source: initial_profile
nudge: 0.01
- salinity:
source: initial_profile
nudge: 0.01
- name: sjr
flow_direction: inflow
variables:
- velocity:
source: th_text
- temperature:
source: th_text
nudge: 1.0
- salinity:
source: 0.074318
nudge: 1.0
flow_direction is inflow, outflow or bidirection:
outflowboundaries may not specify temperature, salinity or tracers.inflowandbidirectionboundaries inbaroclinicmode must specify temperature and salinity, and tracers whenmodulesis present. Inbarotropicmode the requirement followstemperature_salinity_computation; tracers are not allowed.
A variable that is left out gets SCHISM type code 0 (not specified).
Source keywords
The source of a variable is either a number, meaning a constant (code 2),
or one of the keywords below. Keywords contain no spaces and there are no
alternative spellings. th_text means the ASCII time history file and
th_nc the netCDF time history file; the file name is fixed by SCHISM for
the variable, as listed.
Elevation (iettype)
|
Code |
Meaning |
|---|---|---|
|
1 |
Time history from |
number |
2 |
Constant elevation. |
|
3 |
Tidal harmonics given in |
|
4 |
Time and space varying history from |
|
5 |
|
Velocity (ifltype)
|
Code |
Meaning |
|---|---|---|
|
1 |
Discharge history from |
number |
2 |
Constant discharge (negative is inflow). |
|
3 |
Tidal u, v harmonics given in |
|
4 |
Velocity history from |
|
5 |
|
|
-4 |
Model velocity relaxed toward |
|
-5 |
As |
|
-1 |
Flather radiation condition. Requires |
|
-2 |
Outgoing discharge from the polynomial
\(Q = \sum_{j=1}^{4} c_j \eta^j\). Requires |
SCHISM’s own manual does not list codes -5 and -2; they are read and applied by the SCHISM source.
Temperature, salinity and tracers (itetype, isatype, itrtype)
|
Code |
Meaning |
|---|---|---|
|
1 |
Time history from |
number or list |
2 |
Constant value. Tracers take a list with one value per tracer in the
module (a single number is accepted when |
|
3 |
Relax to the initial condition. |
|
4 |
Time and space varying history from |
Every temperature, salinity and tracer entry requires nudge, a factor in
[0, 1] with 1 the strongest nudging. SCHISM applies these values on inflow.
Tracers are listed per module:
- tracers:
- module: SED
source: [0.007, 0.008, 0.0]
nudge: 0.01
- module: GEN
source: th_text
nudge: 1.0
A module that is left out of a boundary’s list gets code 0 on that boundary.
Additional keys by velocity type
tidal,tidal_th_nc,tidal_th_nc_relaxed(and elevationtidal,tidal_th_nc)constituents: one entry perboundary_forcing_tidesconstituent, in the same order. Elevation entries giveamplitudeandphase; velocity entries giveu_amplitude,u_phase,v_amplitudeandv_phase. Each value is a scalar (uniform) or a list with one value per boundary node.- elevation: source: tidal constituents: - O1: - amplitude: 0.26 - phase: 123.0
th_nc_relaxed,tidal_th_nc_relaxedinflow_relaxandoutflow_relax: relaxation factors in [0, 1] for incoming and outgoing flow (1 imposesuv3D.th.ncfully).- elevation: source: th_nc - velocity: source: th_nc_relaxed inflow_relax: 0.8 outflow_relax: 0.1
flather_1eta_m0: mean elevation, one value per boundary node.vnormal_nodes: mean normal velocity, one list per boundary node with a value per vertical level.discharge_relationcoefficients: the four polynomial coefficients \(c_1 \ldots c_4\).
Checks
In addition to the keyword and flow_direction rules above, bctide
raises ValueError before writing anything SCHISM would reject at start-up:
flather_1anddischarge_relationwith an elevation boundary;th_nc_relaxedandtidal_th_nc_relaxedwithout an elevation boundary;nudge,inflow_relaxoroutflow_relaxmissing or outside [0, 1];discharge_relationwithout exactly fourcoefficients;flather_1per-node lists whose length differs from the boundary;tidal sources without
constituents;a constant tracer list whose length differs from
num_tracers;a tracer module not declared in
modules, or listed twice;a
variablesitem that is not a single variable (often an indentation error that leaves a variable empty).
Logging
Each boundary’s assignment is logged at INFO level, for example:
Boundary 'ocean' (bidirection): elevation=th_nc(4), velocity=th_nc(4),
temperature=initial_profile(3) nudge=0.01, salinity=initial_profile(3) nudge=0.01
Use --logdir to keep the log alongside the run.