Subcomponents¶
Parts of commands shared by several components, such as spectral shapes, time specifications and source term options.
rompy_swan.subcomponents.startup¶
SWAN startup subcomponents.
CARTESIAN
pydantic-model
¶
CARTESIAN(**data: Any)
Bases: BaseSubComponent
Cartesian coordinates.
All locations and distances are in m. Coordinates are given with respect to x- and y-axes chosen by the user in the various commands.
Examples¶
Config:
extra:forbid
Fields:
-
model_type(Literal['cartesian', 'CARTESIAN'])
SPHERICAL
pydantic-model
¶
SPHERICAL(**data: Any)
Bases: BaseSubComponent
Spherical coordinates.
Notes¶
projection options:
- CCM: central conformal Mercator. The horizontal and vertical scales are uniform in terms of cm/degree over the area shown. In the centre of the scale is identical to that of the conventional Mercator projection (but only at that centre). The area in the projection centre is therefore exactly conformal.
- QC: the projection method is quasi-cartesian, i.e. the horizontal and vertical scales are equal to one another in terms of cm/degree.
All coordinates of locations and geographical grid sizes are given in degrees;x
is longitude with x = 0 being the Greenwich meridian and x > 0 is East of this
meridian; y is latitude with y > 0 being the Northern hemisphere. Input and
output grids have to be oriented with their x-axis to the East; mesh sizes are in
degrees. All other distances are in meters.
Note that spherical coordinates can also be used for relatively small areas, say 10
or 20 km horizontal dimension. This may be useful if one obtains the boundary
conditions by nesting in an oceanic model which is naturally formulated in
spherical coordinates. Note that in case of spherical coordinates regular grids
must always be oriented E-W, N-S, i.e. alpc=0, alpinp=0, alpfr=0
(see commands CGRID, INPUT GRID and FRAME, respectively).
Examples¶
from rompy_swan.components.startup import SPHERICAL
coords = SPHERICAL()
print(coords.render())
coords = SPHERICAL(projection="qc")
print(coords.render())
Fields:
-
model_type(Literal['spherical', 'SPHERICAL']) -
projection(Literal['ccm', 'qc'])
model_type
pydantic-field
¶
model_type: Literal['spherical', 'SPHERICAL'] = 'spherical'
Model type discriminator
projection
pydantic-field
¶
projection: Literal['ccm', 'qc'] = 'ccm'
Defines the projection method in case of spherical coordinates, ccm Central Conformal Mercator, qc means Quasi-cartesian
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
rompy_swan.subcomponents.spectrum¶
Spectrum subcomponents.
SPECTRUM
pydantic-model
¶
SPECTRUM(**data: Any)
Bases: BaseSubComponent
SWAN spectrum specification.
Notes¶
Directions in the spectra are defined either as a CIRCLE or as a SECTOR. In the
case of a SECTOR, both dir1 and dir2 must be specified. In the case of a
CIRCLE, neither dir1 nor dir2 should be specified.
At least two of flow, fhigh and msc must be specified in which case the
third parameter will be calculated by SWAN such that the frequency resolution
df/f = 0.1 (10% increments).
Examples¶
from rompy_swan.subcomponents.spectrum import SPECTRUM
spec = SPECTRUM(mdc=36, flow=0.04, fhigh=1.0)
print(spec.render())
spec = SPECTRUM(mdc=36, dir1=0, dir2=180, flow=0.04, msc=31)
print(spec.render())
Fields:
-
model_type(Literal['spectrum', 'SPECTRUM']) -
mdc(int) -
flow(Optional[float]) -
fhigh(Optional[float]) -
msc(Optional[int]) -
dir1(Optional[float]) -
dir2(Optional[float])
Validators:
model_type
pydantic-field
¶
model_type: Literal['spectrum', 'SPECTRUM'] = 'spectrum'
Model type discriminator
mdc
pydantic-field
¶
mdc: int
Number of meshes in theta-space. In the case of CIRCLE, this is the number of subdivisions of the 360 degrees of a circle so dtheta = [360]/[mdc] is the spectral directional resolution. In the case of SECTOR, dtheta = ([dir2] - [dir1])/[mdc]. The minimum number of directional bins is 3 per directional quadrant.
flow
pydantic-field
¶
Lowest discrete frequency that is used in the calculation (in Hz).
fhigh
pydantic-field
¶
Highest discrete frequency that is used in the calculation (in Hz).
msc
pydantic-field
¶
One less than the number of frequencies. This defines the grid resolution in frequency-space between the lowest discrete frequency flow and the highest discrete frequency fhigh. This resolution is not constant, since the frequencies are distributed logarithmical: fi+1 = yfi where y is a constant. The minimum number of frequencies is 4
dir1
pydantic-field
¶
The direction of the right-hand boundary of the sector when looking outward from the sector (required for option SECTOR) in degrees.
dir2
pydantic-field
¶
The direction of the left-hand boundary of the sector when looking outward from the sector (required for option SECTOR) in degrees.
check_direction_definition
pydantic-validator
¶
Check that dir1 and dir2 are specified together.
check_frequency_definition
pydantic-validator
¶
check_frequency_definition() -> SPECTRUM
Check spectral frequencies are prescribed correctly.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
JONSWAP
pydantic-model
¶
JONSWAP(**data: Any)
Bases: BaseSubComponent
Jonswap spectral shape.
Examples¶
from rompy_swan.subcomponents.spectrum import JONSWAP
shape = JONSWAP(gamma=3.3)
print(shape.render())
Fields:
-
model_type(Literal['jonswap', 'JONSWAP']) -
gamma(float)
TMA
pydantic-model
¶
TMA(**data: Any)
Bases: JONSWAP
TMA spectral shape.
Examples¶
from rompy_swan.subcomponents.spectrum import TMA
shape = TMA(gamma=2.0, d=18)
print(shape.render())
Fields:
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
GAUSS
pydantic-model
¶
GAUSS(**data: Any)
Bases: BaseSubComponent
Gaussian spectral shape.
Examples¶
Fields:
-
model_type(Literal['gauss', 'GAUSS']) -
sigfr(float)
model_type
pydantic-field
¶
model_type: Literal['gauss', 'GAUSS'] = 'gauss'
Model type discriminator
sigfr
pydantic-field
¶
sigfr: float
Width of the Gaussian frequency spectrum expressed as a standard deviation in Hz.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
PM
pydantic-model
¶
PM(**data: Any)
Bases: BaseSubComponent
Pearson-Moskowitz spectral shape.
Examples¶
Fields:
-
model_type(Literal['pm', 'PM'])
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
BIN
pydantic-model
¶
BIN(**data: Any)
Bases: BaseSubComponent
Single frequency bin spectral shape.
Examples¶
Fields:
-
model_type(Literal['bin', 'BIN'])
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
SHAPESPEC
pydantic-model
¶
SHAPESPEC(**data: Any)
Bases: BaseSubComponent
Spectral shape specification.
This command BOUND SHAPESPEC defines the shape of the spectra (both in frequency and direction) at the boundary of the computational grid in case of parametric spectral input.
Notes¶
While technically a component BOUND SHAPESPEC, this is only intended to be used
as a subcomponent of the BOUNDSPEC component.
Examples¶
from rompy_swan.subcomponents.spectrum import SHAPESPEC
shapespec = SHAPESPEC()
print(shapespec.render())
shapespec = SHAPESPEC(
shape=dict(model_type="tma", gamma=3.1, d=12),
per_type="mean",
dspr_type="degrees",
)
print(shapespec.render())
BOUND SHAPESPEC JONSWAP gamma=3.3 PEAK DSPR POWER
BOUND SHAPESPEC TMA gamma=3.1 d=12.0 MEAN DSPR DEGREES
Fields:
-
model_type(Literal['shapespec', 'SHAPESPEC']) -
shape(JONSWAP | PM | GAUSS | BIN | TMA) -
per_type(Literal['peak', 'mean']) -
dspr_type(Literal['power', 'degrees'])
model_type
pydantic-field
¶
model_type: Literal['shapespec', 'SHAPESPEC'] = 'shapespec'
Model type discriminator
per_type
pydantic-field
¶
per_type: Literal['peak', 'mean'] = 'peak'
The type of characteristic wave period
dspr_type
pydantic-field
¶
dspr_type: Literal['power', 'degrees'] = 'power'
The type of directional spreading
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
rompy_swan.subcomponents.time¶
SWAN Time Subcomponents
This module contains subcomponents for handling time specifications in SWAN, including time ranges, intervals, and time format conversions.
TIME_FORMAT
module-attribute
¶
TIME_FORMAT = {
1: "%Y%m%d.%H%M%S",
2: "'%d-%b-%y %H:%M:%S'",
3: "%m/%d/%y.%H:%M:%S",
4: "%H:%M:%S",
5: "%y/%m/%d %H:%M:%S'",
6: "%y%m%d%H%M",
}
Time
pydantic-model
¶
Time(**data: Any)
Bases: BaseSubComponent
Time specification in SWAN.
Time is rendered in one of the following formats:
- 1: ISO-notation 19870530.153000
- 2: (as in HP compiler) '30-May-87 15:30:00'
- 3: (as in Lahey compiler) 05/30/87.15:30:00
- 4: 15:30:00
- 5: 87/05/30 15:30:00'
- 6: as in WAM 8705301530
Note
The time field can be specified as:
- existing datetime object
- int or float, assumed as Unix time, i.e. seconds (if >= -2e10 or <= 2e10) or milliseconds (if < -2e10 or > 2e10) since 1 January 1970.
- ISO 8601 time string.
Examples:
from rompy_swan.subcomponents.time import Time
from datetime import datetime
time = Time(time=datetime(1990, 1, 1))
print(time.render())
time = Time(time="2012-01-01T00:00:00", tfmt=2)
print(time.render())
Fields:
-
model_type(Literal['time', 'Time', 'TIME']) -
time(datetime) -
tfmt(Union[Literal[1, 2, 3, 4, 5, 6], str])
Validators:
model_type
pydantic-field
¶
model_type: Literal['time', 'Time', 'TIME'] = 'time'
Model type discriminator
tfmt
pydantic-field
¶
Format to render time specification
set_time_format
pydantic-validator
¶
Set the time format to render.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
Delt
pydantic-model
¶
Delt(**data: Any)
Bases: BaseSubComponent
Time interval specification in SWAN.
Note
The tdelta field can be specified as:
- existing timedelta object
- int or float, assumed as seconds
-
ISO 8601 duration string, following formats work:
-
[-][DD ][HH:MM]SS[.ffffff] [±]P[DD]DT[HH]H[MM]M[SS]S(ISO 8601 format for timedelta)
Examples:
from rompy_swan.subcomponents.time import Delt
from datetime import timedelta
delt = Delt(delt=timedelta(minutes=30))
print(delt.render())
delt = Delt(delt="PT1H", dfmt="hr")
print(delt.render())
Fields:
TimeRangeOpen
pydantic-model
¶
TimeRangeOpen(**data: Any)
Bases: BaseSubComponent
Regular times with an open boundary.
Time is rendered in one of the following formats:
- 1: ISO-notation 19870530.153000
- 2: (as in HP compiler) '30-May-87 15:30:00'
- 3: (as in Lahey compiler) 05/30/87.15:30:00
- 4: 15:30:00
- 5: 87/05/30 15:30:00'
- 6: as in WAM 8705301530
Note
The tbeg field can be specified as:
- existing datetime object
- int or float, assumed as Unix time, i.e. seconds (if >= -2e10 or <= 2e10) or milliseconds (if < -2e10 or > 2e10) since 1 January 1970.
- ISO 8601 time string.
Note
The tdelta field can be specified as:
- existing timedelta object
- int or float, assumed as seconds
-
ISO 8601 duration string, following formats work:
[-][DD ][HH:MM]SS[.ffffff][±]P[DD]DT[HH]H[MM]M[SS]S(ISO 8601 format for timedelta)
Note
Default values for the time specification fields are provided for the case where the user wants to set times dynamically after instantiating this subcomponent.
Examples:
from rompy_swan.subcomponents.time import TimeRangeOpen
from datetime import datetime, timedelta
times = TimeRangeOpen(
tbeg=datetime(1990, 1, 1), delt=timedelta(minutes=30), dfmt="min"
)
print(times.render())
times = TimeRangeOpen(
tbeg="2012-01-01T00:00:00", delt="PT1H", tfmt=2, dfmt="hr", suffix="blk"
)
print(times.render())
Fields:
-
model_type(Literal['open', 'OPEN']) -
tbeg(datetime) -
delt(timedelta) -
tfmt(Union[Literal[1, 2, 3, 4, 5, 6], str]) -
dfmt(Literal['sec', 'min', 'hr', 'day']) -
suffix(str)
tfmt
pydantic-field
¶
Format to render time specification
dfmt
pydantic-field
¶
dfmt: Literal['sec', 'min', 'hr', 'day'] = 'sec'
Format to render time interval specification
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
TimeRangeClosed
pydantic-model
¶
TimeRangeClosed(**data: Any)
Bases: TimeRangeOpen
Regular times with a closed boundary.
Note
Default values for the time specification fields are provided for the case where the user wants to set times dynamically after instantiating this subcomponent.
Examples:
from rompy_swan.subcomponents.time import TimeRangeClosed
from datetime import datetime, timedelta
times = TimeRangeClosed(
tbeg=datetime(1990, 1, 1),
tend=datetime(1990, 1, 7),
delt=timedelta(minutes=30),
dfmt="min",
)
print(times.render())
times = TimeRangeClosed(
tbeg="2012-01-01T00:00:00",
tend="2012-02-01T00:00:00",
delt="PT1H",
tfmt=2,
dfmt="hr",
suffix="blk",
)
print(times.render())
tbeg=19900101.000000 delt=30.0 MIN tend=19900107.000000
tbegblk='01-Jan-12 00:00:00' deltblk=1.0 HR tendblk='01-Feb-12 00:00:00'
Fields:
-
tbeg(datetime) -
delt(timedelta) -
tfmt(Union[Literal[1, 2, 3, 4, 5, 6], str]) -
dfmt(Literal['sec', 'min', 'hr', 'day']) -
suffix(str) -
model_type(Literal['closed', 'CLOSED']) -
tend(datetime)
model_type
pydantic-field
¶
model_type: Literal['closed', 'CLOSED'] = 'closed'
Model type discriminator
tfmt
pydantic-field
¶
Format to render time specification
dfmt
pydantic-field
¶
dfmt: Literal['sec', 'min', 'hr', 'day'] = 'sec'
Format to render time interval specification
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
NONSTATIONARY
pydantic-model
¶
NONSTATIONARY(**data: Any)
Bases: TimeRangeClosed
Nonstationary time specification.
Note
Default values for the time specification fields are provided for the case where the user wants to set times dynamically after instantiating this subcomponent.
Examples:
from rompy_swan.subcomponents.time import NONSTATIONARY
nonstat = NONSTATIONARY(
tbeg="2012-01-01T00:00:00",
tend="2012-02-01T00:00:00",
delt="PT1H",
dfmt="hr",
)
print(nonstat.render())
from datetime import datetime, timedelta
nonstat = NONSTATIONARY(
tbeg=datetime(1990, 1, 1),
tend=datetime(1990, 1, 7),
delt=timedelta(minutes=30),
tfmt=1,
dfmt="min",
suffix="tbl",
)
print(nonstat.render())
NONSTATIONARY tbeg=20120101.000000 delt=1.0 HR tend=20120201.000000
NONSTATIONARY tbegtbl=19900101.000000 delttbl=30.0 MIN tendtbl=19900107.000000
Fields:
-
tfmt(Union[Literal[1, 2, 3, 4, 5, 6], str]) -
dfmt(Literal['sec', 'min', 'hr', 'day']) -
suffix(str) -
model_type(Literal['nonstationary', 'NONSTATIONARY']) -
tbeg(datetime) -
tend(datetime) -
delt(timedelta)
model_type
pydantic-field
¶
model_type: Literal["nonstationary", "NONSTATIONARY"] = (
"nonstationary"
)
Model type discriminator
tfmt
pydantic-field
¶
Format to render time specification
dfmt
pydantic-field
¶
dfmt: Literal['sec', 'min', 'hr', 'day'] = 'sec'
Format to render time interval specification
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
STATIONARY
pydantic-model
¶
STATIONARY(**data: Any)
Bases: BaseSubComponent
Stationary time specification.
Note
The field time is optional to allow for the case where the user wants to set the
time dynamically after instantiating this component.
Examples:
from rompy_swan.subcomponents.time import STATIONARY
stat = STATIONARY(time="2012-01-01T00:00:00")
print(stat.render())
Fields:
-
model_type(Literal['stationary', 'STATIONARY']) -
time(datetime) -
tfmt(Union[Literal[1, 2, 3, 4, 5, 6], str])
model_type
pydantic-field
¶
model_type: Literal["stationary", "STATIONARY"] = (
"stationary"
)
Model type discriminator
tfmt
pydantic-field
¶
Format to render time specification
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
rompy_swan.subcomponents.readgrid¶
SWAN Read Grid Subcomponents
This module contains subcomponents for reading grid data in SWAN, including regular grids and various input formats.
GRIDREGULAR
pydantic-model
¶
GRIDREGULAR(**data: Any)
Bases: BaseSubComponent
SWAN Regular Grid subcomponent.
Note
The direction of the x-axis alp must be 0 in case of spherical coordinates
Note
All coordinates and distances should be given in m when Cartesian coordinates are used or degrees when Spherical coordinates are used (see command COORD).
Examples:
from rompy_swan.subcomponents.readgrid import GRIDREGULAR
kwargs = dict(xp=173, yp=-40, alp=0, xlen=2, ylen=2, mx=199, my=199)
grid = GRIDREGULAR(suffix="c", **kwargs)
print(grid.render())
grid = GRIDREGULAR(suffix="inp", **kwargs)
print(grid.render())
xpc=173.0 ypc=-40.0 alpc=0.0 xlenc=2.0 ylenc=2.0 mxc=199 myc=199
xpinp=173.0 ypinp=-40.0 alpinp=0.0 xleninp=2.0 yleninp=2.0 mxinp=199 myinp=199
Fields:
-
model_type(Literal['gridregular', 'GRIDREGULAR']) -
xp(float) -
yp(float) -
alp(Optional[float]) -
xlen(float) -
ylen(float) -
mx(int) -
my(int) -
suffix(Optional[str])
model_type
pydantic-field
¶
model_type: Literal["gridregular", "GRIDREGULAR"] = (
"gridregular"
)
Model type discriminator
mx
pydantic-field
¶
mx: int
Number of meshes in computational grid in x-direction (this number is one less than the number of grid points in this domain)
my
pydantic-field
¶
my: int
Number of meshes in computational grid in y-direction (this number is one less than the number of grid points in this domain)
suffix
pydantic-field
¶
Suffix for rendering with each output grid parameter.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
READGRID
pydantic-model
¶
READGRID(**data: Any)
Bases: BaseSubComponent, ABC
SWAN grid reader abstract class.
READGRID [grid_type] [fac] 'fname1' [idla] [nhedf] ([nhedt]) ([nhedvec]) &
->FREE|FORMAT|UNFORMATTED ('form'|[idfm])
This is the base class for all input grids. It is not meant to be used directly.
Note
File format identifier:
- 1: Format according to BODKAR convention (a standard of the Ministry of Transport and Public Works in the Netherlands). Format string: (10X,12F5.0)
- 5: Format (16F5.0), an input line consists of 16 fields of 5 places each
- 6: Format (12F6.0), an input line consists of 12 fields of 6 places each
- 8: Format (10F8.0), an input line consists of 10 fields of 8 places each
Fields:
-
model_type(Literal['readgrid', 'READGRID']) -
grid_type(Union[GridOptions, Literal['coordinates']]) -
fac(float) -
idla(IDLA) -
nhedf(int) -
nhedvec(int) -
format(Literal['free', 'fixed', 'unformatted']) -
form(Optional[str]) -
idfm(Optional[Literal[1, 5, 6, 8]])
Validators:
model_type
pydantic-field
¶
model_type: Literal['readgrid', 'READGRID'] = 'readgrid'
Model type discriminator
grid_type
pydantic-field
¶
grid_type: Union[GridOptions, Literal['coordinates']]
Type of the SWAN grid file
fac
pydantic-field
¶
fac: float = 1.0
SWAN multiplies all values that are read from file by fac. For instance if the values are given in unit decimeter, one should make fac=0.1 to obtain values in m. To change sign use a negative fac
idla
pydantic-field
¶
Prescribes the order in which the values of bottom levels and other fields should be given in the file
nhedf
pydantic-field
¶
nhedf: int = 0
The number of header lines at the start of the file. The text in the header lines is reproduced in the print file created by SWAN . The file may start with more header lines than nhedf because the start of the file is often also the start of a time step and possibly also of a vector variable (each having header lines, see nhedt and nhedvec)
nhedvec
pydantic-field
¶
nhedvec: int = 0
For each vector variable: number of header lines in the file at the start of each component (e.g., x- or y-component)
format
pydantic-field
¶
format: Literal['free', 'fixed', 'unformatted'] = 'free'
File format, one of 'free', 'fixed' or 'unformatted'. If 'free', the file is assumed to use the FREE FORTRAN format. If 'fixed', the file is assumed to use a fixed format that must be specified by (only) one of 'form' or 'idfm' arguments. Use 'unformatted' to read unformatted (binary) files (not recommended for ordinary use)
form
pydantic-field
¶
A user-specified format string in Fortran convention, e.g., '(10X,12F5.0)'.Only used if format='fixed', do not use it if idfm is specified
idfm
pydantic-field
¶
File format identifier, only used if format='fixed'
fac_not_zero
pydantic-validator
¶
SWAN multiplies the values by fac, so it must not be zero.
check_format_definition
pydantic-validator
¶
check_format_definition() -> READGRID
Check the arguments specifying the file format are specified correctly.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
READCOORD
pydantic-model
¶
READCOORD(**data: Any)
Bases: READGRID
SWAN coordinates reader.
Examples¶
from rompy_swan.subcomponents.readgrid import READCOORD
readcoord = READCOORD(
fac=1.0,
fname="coords.txt",
idla=3,
format="free",
)
print(readcoord.render())
Fields:
-
fac(float) -
idla(IDLA) -
nhedf(int) -
nhedvec(int) -
format(Literal['free', 'fixed', 'unformatted']) -
form(Optional[str]) -
idfm(Optional[Literal[1, 5, 6, 8]]) -
model_type(Literal['readcoord', 'READCOORD']) -
grid_type(Literal['coordinates']) -
fname(str)
Validators:
model_type
pydantic-field
¶
model_type: Literal['readcoord', 'READCOORD'] = 'readcoord'
Model type discriminator
grid_type
pydantic-field
¶
grid_type: Literal['coordinates'] = 'coordinates'
Type of the SWAN grid file
fac
pydantic-field
¶
fac: float = 1.0
SWAN multiplies all values that are read from file by fac. For instance if the values are given in unit decimeter, one should make fac=0.1 to obtain values in m. To change sign use a negative fac
idla
pydantic-field
¶
Prescribes the order in which the values of bottom levels and other fields should be given in the file
nhedf
pydantic-field
¶
nhedf: int = 0
The number of header lines at the start of the file. The text in the header lines is reproduced in the print file created by SWAN . The file may start with more header lines than nhedf because the start of the file is often also the start of a time step and possibly also of a vector variable (each having header lines, see nhedt and nhedvec)
nhedvec
pydantic-field
¶
nhedvec: int = 0
For each vector variable: number of header lines in the file at the start of each component (e.g., x- or y-component)
format
pydantic-field
¶
format: Literal['free', 'fixed', 'unformatted'] = 'free'
File format, one of 'free', 'fixed' or 'unformatted'. If 'free', the file is assumed to use the FREE FORTRAN format. If 'fixed', the file is assumed to use a fixed format that must be specified by (only) one of 'form' or 'idfm' arguments. Use 'unformatted' to read unformatted (binary) files (not recommended for ordinary use)
form
pydantic-field
¶
A user-specified format string in Fortran convention, e.g., '(10X,12F5.0)'.Only used if format='fixed', do not use it if idfm is specified
idfm
pydantic-field
¶
File format identifier, only used if format='fixed'
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
fac_not_zero
pydantic-validator
¶
SWAN multiplies the values by fac, so it must not be zero.
READINP
pydantic-model
¶
READINP(**data: Any)
Bases: READGRID
SWAN input grid reader.
READINP GRID_TYPE [fac] ('fname1' | SERIES 'fname2') [idla] [nhedf] &
([nhedt]) [nhedvec] FREE|FORMAT ('form'|idfm)|UNFORMATTED`
Examples¶
from rompy_swan.subcomponents.readgrid import READINP
readinp = READINP(
grid_type="wind",
fname1="wind.txt",
fac=1.0,
idla=3,
format="free",
)
print(readinp.render())
Fields:
-
fac(float) -
idla(IDLA) -
nhedf(int) -
nhedvec(int) -
format(Literal['free', 'fixed', 'unformatted']) -
form(Optional[str]) -
idfm(Optional[Literal[1, 5, 6, 8]]) -
model_type(Literal['readinp', 'READINP']) -
grid_type(Optional[GridOptions]) -
fname1(str) -
fname2(Optional[str]) -
nhedt(int)
Validators:
model_type
pydantic-field
¶
model_type: Literal['readinp', 'READINP'] = 'readinp'
Model type discriminator
fname2
pydantic-field
¶
Name of file that contains the names of the files where the variables are given when the SERIES option is used. These names are to be given in proper time sequence. SWAN reads the next file when the previous file end has been encountered. In these files the input should be given in the same format as in the above file 'fname1' (that implies that a file should start with the start of an input time step)
nhedt
pydantic-field
¶
nhedt: int = 0
Only if variable is time dependent: number of header lines in the file at the start of each time level. A time step may start with more header lines than nhedt because the variable may be a vector variable which has its own header lines (see nhedvec)
fac
pydantic-field
¶
fac: float = 1.0
SWAN multiplies all values that are read from file by fac. For instance if the values are given in unit decimeter, one should make fac=0.1 to obtain values in m. To change sign use a negative fac
idla
pydantic-field
¶
Prescribes the order in which the values of bottom levels and other fields should be given in the file
nhedf
pydantic-field
¶
nhedf: int = 0
The number of header lines at the start of the file. The text in the header lines is reproduced in the print file created by SWAN . The file may start with more header lines than nhedf because the start of the file is often also the start of a time step and possibly also of a vector variable (each having header lines, see nhedt and nhedvec)
nhedvec
pydantic-field
¶
nhedvec: int = 0
For each vector variable: number of header lines in the file at the start of each component (e.g., x- or y-component)
format
pydantic-field
¶
format: Literal['free', 'fixed', 'unformatted'] = 'free'
File format, one of 'free', 'fixed' or 'unformatted'. If 'free', the file is assumed to use the FREE FORTRAN format. If 'fixed', the file is assumed to use a fixed format that must be specified by (only) one of 'form' or 'idfm' arguments. Use 'unformatted' to read unformatted (binary) files (not recommended for ordinary use)
form
pydantic-field
¶
A user-specified format string in Fortran convention, e.g., '(10X,12F5.0)'.Only used if format='fixed', do not use it if idfm is specified
idfm
pydantic-field
¶
File format identifier, only used if format='fixed'
set_undefined
pydantic-validator
¶
Allow for undefined value so it can be redefined in INPGRID components.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
fac_not_zero
pydantic-validator
¶
SWAN multiplies the values by fac, so it must not be zero.
rompy_swan.subcomponents.boundary¶
SWAN Boundary Subcomponents
This module contains subcomponents for defining boundary conditions in SWAN, including boundary segments, spectral parameters, and initial conditions.
SIDE
pydantic-model
¶
SIDE(**data: Any)
Bases: BaseSubComponent
Boundary over one side of computational domain.
The boundary is one full side of the computational grid (in 1D cases either of the two ends of the 1D-grid).
Note
Should not be used in case of CURVILINEAR grids.
Examples:
from rompy_swan.subcomponents.boundary import SIDE
side = SIDE(side="west", direction="ccw")
print(side.render())
Fields:
-
model_type(Literal['side', 'SIDE']) -
side(Literal['north', 'nw', 'west', 'sw', 'south', 'se', 'east', 'ne']) -
direction(Literal['ccw', 'clockwise'])
side
pydantic-field
¶
side: Literal[
"north", "nw", "west", "sw", "south", "se", "east", "ne"
]
The side of the grid to apply the boundary to
direction
pydantic-field
¶
direction: Literal['ccw', 'clockwise'] = 'ccw'
The direction to apply the boundary in
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
SIDES
pydantic-model
¶
SIDES(**data: Any)
Bases: BaseSubComponent
Boundary over multiple side of computational domain.
SIDE NORTH|NW|WEST|SW|SOUTH|SE|E|NE CCW|CLOCKWISE
SIDE NORTH|NW|WEST|SW|SOUTH|SE|E|NE CCW|CLOCKWISE
...
Note
Should not be used in case of CURVILINEAR grids.
Examples:
from rompy_swan.subcomponents.boundary import SIDE, SIDES
side1 = SIDE(side="west", direction="ccw")
side2 = SIDE(side="north", direction="ccw")
sides = SIDES(sides=[side1, side2])
print(sides.render())
['S', 'I', 'D', 'E', ' ', 'W', 'E', 'S', 'T', ' ', 'C', 'C', 'W', ' ', 'S', 'I', 'D', 'E', ' ', 'N', 'O', 'R', 'T', 'H', ' ', 'C', 'C', 'W', ' ']
Fields:
-
model_type(Literal['sides', 'SIDES']) -
sides(list[SIDE])
SEGMENT
pydantic-model
¶
SEGMENT(**data: Any)
Bases: BaseSubComponent
Boundary over a segment defined from points.
The segment is defined either by means of a series of points in terms of problem
coordinates (XY) or by means of a series of points in terms of grid indices
(IJ). The points do not have to include all or coincide with actual grid points.
Examples¶
from rompy_swan.subcomponents.boundary import SEGMENT
seg = SEGMENT(
points=dict(
model_type="xy",
x=[172, 172, 172, 172.5, 173],
y=[-41, -40.5, -40, -40, -40],
fmt="0.2f",
),
)
print(seg.render())
seg = SEGMENT(
points=dict(
model_type="ij",
i=[0, 0, 5],
j=[0, 19, 19],
),
)
print(seg.render())
SEGMENT XY
172.00 -41.00
172.00 -40.50
172.00 -40.00
172.50 -40.00
173.00 -40.00
SEGMENT IJ
i=0 j=0
i=0 j=19
i=5 j=19
Fields:
PAR
pydantic-model
¶
PAR(**data: Any)
Bases: BaseSubComponent
Spectral parameters.
Examples¶
from rompy_swan.subcomponents.boundary import PAR
par = PAR(hs=1.5, per=8.1, dir=225)
print(par.render())
Fields:
per
pydantic-field
¶
per: float
The characteristic period (s) of the energy spectrum (relative frequency; which is equal to absolute frequency in the absence of currents); per is the value of the peak period if option PEAK is chosen in command BOUND SHAPE or per is the value of the mean period, if option MEAN was chosen in command BOUND SHAPE.
dir
pydantic-field
¶
dir: float
The peak wave direction thetapeak (degree), constant over frequencies
dd
pydantic-field
¶
Coefficient of directional spreading; a cos^m(θ) distribution is assumed. dd is interpreted as the directional standard deviation in degrees, if the option DEGREES is chosen in the command BOUND SHAPE (SWAN default: 30). dd is interpreted as the power m, if the option POWER is chosen in the command BOUND SHAPE (SWAN default: 2)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
CONSTANTPAR
pydantic-model
¶
CONSTANTPAR(**data: Any)
Bases: PAR
Constant spectral parameters.
Examples¶
from rompy_swan.subcomponents.boundary import CONSTANTPAR
par = CONSTANTPAR(hs=1.5, per=8.1, dir=225)
print(par.render())
Fields:
-
hs(float) -
per(float) -
dir(float) -
dd(Optional[float]) -
model_type(Literal['constantpar', 'CONSTANTPAR'])
model_type
pydantic-field
¶
model_type: Literal["constantpar", "CONSTANTPAR"] = (
"constantpar"
)
Model type discriminator
per
pydantic-field
¶
per: float
The characteristic period (s) of the energy spectrum (relative frequency; which is equal to absolute frequency in the absence of currents); per is the value of the peak period if option PEAK is chosen in command BOUND SHAPE or per is the value of the mean period, if option MEAN was chosen in command BOUND SHAPE.
dir
pydantic-field
¶
dir: float
The peak wave direction thetapeak (degree), constant over frequencies
dd
pydantic-field
¶
Coefficient of directional spreading; a cos^m(θ) distribution is assumed. dd is interpreted as the directional standard deviation in degrees, if the option DEGREES is chosen in the command BOUND SHAPE (SWAN default: 30). dd is interpreted as the power m, if the option POWER is chosen in the command BOUND SHAPE (SWAN default: 2)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
VARIABLEPAR
pydantic-model
¶
VARIABLEPAR(**data: Any)
Bases: BaseSubComponent
Variable spectral parameter.
Examples¶
from rompy_swan.subcomponents.boundary import VARIABLEPAR
par = VARIABLEPAR(
hs=[1.5, 1.4, 1.1],
per=[8.1, 8.0, 8.1],
dir=[225, 226, 228],
dd=[25, 22, 23],
len=[0, 0.5, 1.0],
)
print(par.render())
VARIABLE PAR &
len=0.0 hs=1.5 per=8.1 dir=225.0 dd=25.0 &
len=0.5 hs=1.4 per=8.0 dir=226.0 dd=22.0 &
len=1.0 hs=1.1 per=8.1 dir=228.0 dd=23.0
Fields:
-
model_type(Literal['variablepar', 'VARIABLEPAR']) -
hs(list[Annotated[float, Field(ge=0.0)]]) -
per(list[Annotated[float, Field(ge=0.0)]]) -
dir(list[Annotated[float, Field(ge=-360.0, le=360.0)]]) -
dd(list[Annotated[float, Field(ge=0.0, le=360.0)]]) -
dist(list[Annotated[float, Field(ge=0)]])
Validators:
model_type
pydantic-field
¶
model_type: Literal["variablepar", "VARIABLEPAR"] = (
"variablepar"
)
Model type discriminator
per
pydantic-field
¶
The characteristic period (s) of the energy spectrum (relative frequency; which is equal to absolute frequency in the absence of currents); per is the value of the peak period if option PEAK is chosen in command BOUND SHAPE or per is the value of the mean period, if option MEAN was chosen in command BOUND SHAPE
dir
pydantic-field
¶
The peak wave direction thetapeak (degrees), constant over frequencies
dd
pydantic-field
¶
Coefficient of directional spreading; a $cos^m(θ)$ distribution is assumed. dd is interpreted as the directional standard deviation in degrees, if the option DEGREES is chosen in the command BOUND SHAPE (SWAN default: 30). dd is interpreted as the power m, if the option POWER is chosen in the command BOUND SHAPE (SWAN default: 2)
dist
pydantic-field
¶
Is the distance from the first point of the side or segment to the point along the side or segment for which the incident wave spectrum is prescribed. Note: these points do no have to coincide with grid points of the computational grid. len is the distance in m or degrees in the case of spherical coordinates, not in grid steps. The values of len should be given in ascending order. The length along a SIDE is measured in clockwise or counterclockwise direction, depending on the options CCW or CLOCKWISE (see above). The option CCW is default. In case of a SEGMENT the length is measured from the indicated begin point of the segment
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
CONSTANTFILE
pydantic-model
¶
CONSTANTFILE(**data: Any)
Bases: BaseSubComponent
Constant file specification.
There are three types of files:
- TPAR files containing nonstationary wave parameters
- files containing stationary or nonstationary 1D spectra (usually from measurements)
- files containing stationary or nonstationary 2D spectra (from other computer programs or other SWAN runs)
A TPAR file is for only one location; it has the string TPAR on the first line of the file and a number of lines which each contain 5 numbers, i.e.: Time (ISO-notation), Hs, Period (average or peak period depending on the choice given in command BOUND SHAPE), Peak Direction (Nautical or Cartesian, depending on command SET), Directional spread (in degrees or as power of cos depending on the choice given in command BOUND SHAPE).
Note
Example of a TPAR file:
Examples:
from rompy_swan.subcomponents.boundary import CONSTANTFILE
par = CONSTANTFILE(fname="tpar.txt")
print(par.render())
Fields:
model_type
pydantic-field
¶
model_type: Literal["constantfile", "CONSTANTFILE"] = (
"constantfile"
)
Model type discriminator
seq
pydantic-field
¶
sequence number of geographic location in the file (see Appendix D); useful for files which contain spectra for more than one location. Note: a TPAR file always contains only one location so in this case seq must always be 1
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
VARIABLEFILE
pydantic-model
¶
VARIABLEFILE(**data: Any)
Bases: BaseSubComponent
Variable file specification.
There are three types of files:
- TPAR files containing nonstationary wave parameters
- files containing stationary or nonstationary 1D spectra (usually from measurements)
- files containing stationary or nonstationary 2D spectra (from other computer programs or other SWAN runs)
A TPAR file is for only one location; it has the string TPAR on the first line of the file and a number of lines which each contain 5 numbers, i.e.: Time (ISO-notation), Hs, Period (average or peak period depending on the choice given in command BOUND SHAPE), Peak Direction (Nautical or Cartesian, depending on command SET), Directional spread (in degrees or as power of cos depending on the choice given in command BOUND SHAPE).
Note
Example of a TPAR file:
Examples:
from rompy_swan.subcomponents.boundary import VARIABLEFILE
par = VARIABLEFILE(
fname=["tpar1.txt", "tpar2.txt", "tpar3.txt"],
len=[0.0, 0.5, 1.0],
)
print(par.render())
VARIABLE FILE &
len=0.0 fname='tpar1.txt' seq=1 &
len=0.5 fname='tpar2.txt' seq=1 &
len=1.0 fname='tpar3.txt' seq=1
Fields:
-
model_type(Literal['variablefile', 'VARIABLEFILE']) -
fname(list[Annotated[str, Field(max_length=36)]]) -
seq(Optional[list[Annotated[int, Field(ge=1)]]]) -
dist(list[Annotated[float, Field(ge=0)]])
Validators:
model_type
pydantic-field
¶
model_type: Literal["variablefile", "VARIABLEFILE"] = (
"variablefile"
)
Model type discriminator
fname
pydantic-field
¶
Names of the files containing the boundary condition
seq
pydantic-field
¶
sequence number of geographic location in the file (see Appendix D); useful for files which contain spectra for more than one location. Note: a TPAR file always contains only one location so in this case [seq] must always be 1.
dist
pydantic-field
¶
Is the distance from the first point of the side or segment to the point along the side or segment for which the incident wave spectrum is prescribed. Note: these points do no have to coincide with grid points of the computational grid. [len] is the distance in m or degrees in the case of spherical coordinates, not in grid steps. The values of len should be given in ascending order. The length along a SIDE is measured in clockwise or counterclockwise direction, depending on the options CCW or CLOCKWISE (see above). The option CCW is default. In case of a SEGMENT the length is measured from the indicated begin point of the segment.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
DEFAULT
pydantic-model
¶
DEFAULT(**data: Any)
Bases: BaseSubComponent
Default initial conditions.
The initial spectra are computed from the local wind velocities, using the deep-water growth curve of Kahma and Calkoen (1992), cut off at values of significant wave height and peak frequency from Pierson and Moskowitz (1964). The average (over the model area) spatial step size is used as fetch with local wind. The shape of the spectrum is default JONSWAP with a cos2-directional distribution (options are available: see command BOUND SHAPE).
Examples¶
Fields:
-
model_type(Literal['default', 'DEFAULT'])
ZERO
pydantic-model
¶
ZERO(**data: Any)
Bases: BaseSubComponent
Zero initial conditions.
The initial spectral densities are all 0; note that if waves are generated in the model only by wind, waves can become non-zero only by the presence of the ”A” term in the growth model; see the keyword AGROW in command GEN3.
Examples¶
Fields:
-
model_type(Literal['zero', 'ZERO'])
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
HOTSINGLE
pydantic-model
¶
HOTSINGLE(**data: Any)
Bases: BaseSubComponent
Hotstart single initial conditions.
Initial wave field is read from file; this file was generated in a previous SWAN run by means of the HOTFILE command. If the previous run was nonstationary, the time found on the file will be assumed to be the initial time of computation. It can also be used for stationary computation as first guess. The computational grid (both in geographical space and in spectral space) must be identical to the one in the run in which the initial wave field was computed
Input will be read from a single (concatenated) hotfile. In the case of a previous parallel MPI run, the concatenated hotfile can be created from a set of multiple hotfiles using the program hcat.exe, see Implementation Manual.
Examples¶
from rompy_swan.subcomponents.boundary import HOTSINGLE
init = HOTSINGLE(fname="hotstart.swn", format="free")
print(init.render())
Fields:
model_type
pydantic-field
¶
model_type: Literal['hotsingle', 'HOTSINGLE'] = 'hotsingle'
Model type discriminator
format
pydantic-field
¶
format: Literal['free', 'unformatted'] = 'free'
Format of the file containing the initial wave field. FREE: free format, UNFORMATTED: binary format
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
HOTMULTIPLE
pydantic-model
¶
HOTMULTIPLE(**data: Any)
Bases: BaseSubComponent
Hotstart multiple initial conditions.
Initial wave field is read from file; this file was generated in a previous SWAN run by means of the HOTFILE command. If the previous run was nonstationary, the time found on the file will be assumed to be the initial time of computation. It can also be used for stationary computation as first guess. The computational grid (both in geographical space and in spectral space) must be identical to the one in the run in which the initial wave field was computed
Input will be read from multiple hotfiles obtained from a previous parallel MPI run. The number of files equals the number of processors. Hence, for the present run the same number of processors must be chosen.
Examples¶
from rompy_swan.subcomponents.boundary import HOTMULTIPLE
init = HOTMULTIPLE(fname="hotstart.swn", format="free")
print(init.render())
Fields:
-
model_type(Literal['hotmultiple', 'HOTMULTIPLE']) -
fname(str) -
format(Literal['free', 'unformatted'])
model_type
pydantic-field
¶
model_type: Literal["hotmultiple", "HOTMULTIPLE"] = (
"hotmultiple"
)
Model type discriminator
format
pydantic-field
¶
format: Literal['free', 'unformatted'] = 'free'
Format of the file containing the initial wave field. FREE: free format, UNFORMATTED: binary format
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
rompy_swan.subcomponents.physics¶
SWAN physics subcomponents.
SourceTerms
pydantic-model
¶
SourceTerms(**data: Any)
Bases: BaseSubComponent, ABC
Source term subcomponent base class.
Fields:
-
model_type(Literal['subcomponent']) -
wind_drag(Literal['wu', 'fit']) -
agrow(bool) -
a(Optional[float])
wind_drag
pydantic-field
¶
wind_drag: Literal['wu', 'fit'] = 'wu'
Indicates the wind drag formulation
agrow
pydantic-field
¶
agrow: bool = False
Activate the Cavaleri and Malanotte (1981) wave growth term
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
JANSSEN
pydantic-model
¶
JANSSEN(**data: Any)
Bases: SourceTerms
Janssen source terms subcomponent.
References¶
Janssen, P.A., 1989. Wave-induced stress and the drag of air flow over sea waves. Journal of Physical Oceanography, 19(6), pp.745-754.
Janssen, P.A.E.M., Lionello, P. and Zambresky, L., 1989. On the interaction of wind and waves. Philosophical transactions of the royal society of London. Series A, Mathematical and Physical Sciences, 329(1604), pp.289-301.
Janssen, P.A., 1991. Quasi-linear theory of wind-wave generation applied to wave forecasting. Journal of physical oceanography, 21(11), pp.1631-1642.
Examples¶
from rompy_swan.subcomponents.physics import JANSSEN
janssen = JANSSEN()
print(janssen.render())
janssen = JANSSEN(cds1=4.5, delta=0.5, agrow=True)
print(janssen.render())
Fields:
-
wind_drag(Literal['wu', 'fit']) -
agrow(bool) -
a(Optional[float]) -
model_type(Literal['janssen', 'JANSSEN']) -
cds1(Optional[float]) -
delta(Optional[float])
model_type
pydantic-field
¶
model_type: Literal['janssen', 'JANSSEN'] = 'janssen'
Model type discriminator
cds1
pydantic-field
¶
Coefficient for determining the rate of whitecapping dissipation ($Cds / s^4_{PM}$) (SWAN default: 4.5)
delta
pydantic-field
¶
Coefficient which determines the dependency of the whitecapping on wave number (mix with Komen et al. formulation) (SWAN default: 0.5)
wind_drag
pydantic-field
¶
wind_drag: Literal['wu', 'fit'] = 'wu'
Indicates the wind drag formulation
agrow
pydantic-field
¶
agrow: bool = False
Activate the Cavaleri and Malanotte (1981) wave growth term
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
KOMEN
pydantic-model
¶
KOMEN(**data: Any)
Bases: SourceTerms
Komen source terms subcomponent.
References¶
Komen, G.J., Hasselmann, S. and Hasselmann, K., 1984. On the existence of a fully developed wind-sea spectrum. Journal of physical oceanography, 14(8), pp.1271-1285.
Examples¶
from rompy_swan.subcomponents.physics import KOMEN
komen = KOMEN()
print(komen.render())
komen = KOMEN(cds2=2.36e-5, stpm=3.02e-3, agrow=True, a=0.0015)
print(komen.render())
Fields:
-
wind_drag(Literal['wu', 'fit']) -
agrow(bool) -
a(Optional[float]) -
model_type(Literal['komen', 'KOMEN']) -
cds2(Optional[float]) -
stpm(Optional[float])
model_type
pydantic-field
¶
model_type: Literal['komen', 'KOMEN'] = 'komen'
Model type discriminator
cds2
pydantic-field
¶
Coefficient for determining the rate of whitecapping dissipation (Cds) (SWAN default: 2.36e-5)
stpm
pydantic-field
¶
Value of the wave steepness for a Pierson-Moskowitz spectrum (s^2_PM) (SWAN default: 3.02e-3)
wind_drag
pydantic-field
¶
wind_drag: Literal['wu', 'fit'] = 'wu'
Indicates the wind drag formulation
agrow
pydantic-field
¶
agrow: bool = False
Activate the Cavaleri and Malanotte (1981) wave growth term
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
WESTHUYSEN
pydantic-model
¶
WESTHUYSEN(**data: Any)
Bases: SourceTerms
Westhuysen source terms subcomponent.
Nonlinear saturation-based whitecapping combined with wind input of Yan (1987).
Notes¶
The two arguments are specified in the Appendix C of the User manual but not in the command description for WESTH in Section 4.5.4. They are also options in the WCAPPING command. It is not entirely clear if they should/could be specified here.
References¶
van der Westhuysen, A.J., Zijlema, M. and Battjes, J.A., 2007. Nonlinear saturation-based whitecapping dissipation in SWAN for deep and shallow water. Coastal Engineering, 54(2), pp.151-170.
Examples¶
from rompy_swan.subcomponents.physics import WESTHUYSEN
westhuysen = WESTHUYSEN()
print(westhuysen.render())
westhuysen = WESTHUYSEN(cds2=5.0e-5, br=1.75e-3)
print(westhuysen.render())
Fields:
-
wind_drag(Literal['wu', 'fit']) -
agrow(bool) -
a(Optional[float]) -
model_type(Literal['westhuysen', 'WESTHUYSEN']) -
cds2(Optional[float]) -
br(Optional[float])
model_type
pydantic-field
¶
model_type: Literal["westhuysen", "WESTHUYSEN"] = (
"westhuysen"
)
Model type discriminator
cds2
pydantic-field
¶
proportionality coefficient due to Alves and Banner (2003) (SWAN default: 5.0e-5).
wind_drag
pydantic-field
¶
wind_drag: Literal['wu', 'fit'] = 'wu'
Indicates the wind drag formulation
agrow
pydantic-field
¶
agrow: bool = False
Activate the Cavaleri and Malanotte (1981) wave growth term
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
ST6
pydantic-model
¶
ST6(**data: Any)
Bases: SourceTerms
St6 source terms subcomponent.
ST6 [a1sds] [a2sds] [p1sds] [p2sds] UP|DOWN HWANG|FAN|ECMWF VECTAU|SCATAU &
TRUE10|U10PROXY [windscaling] DEBIAS [cdfac] (AGROW [a])
wind input and whitecapping from Rogers et al. (2012) (RBW12).
Notes¶
The two arguments are specified in the Appendix C of the User manual but not in the command description for WESTH in Section 4.5.4. They are also options in the WCAPPING command. It is not entirely clear if they should/could be specified here.
References¶
Fan, Y., Lin, S.J., Held, I.M., Yu, Z. and Tolman, H.L., 2012. Global ocean surface wave simulation using a coupled atmosphere–wave model. Journal of Climate, 25(18), pp.6233-6252.
Rogers, W.E., Babanin, A.V. and Wang, D.W., 2012. Observation-consistent input and whitecapping dissipation in a model for wind-generated surface waves: Description and simple calculations. Journal of Atmospheric and Oceanic Technology, 29(9), pp.1329-1346.
Examples¶
from rompy_swan.subcomponents.physics import ST6
st6 = ST6(a1sds=4.7e-7, a2sds=6.6e-6)
print(st6.render())
kwargs = dict(
a1sds=2.8e-6,
a2sds=3.5e-5,
normalization="up",
wind_drag="hwang",
tau="vectau",
u10="u10proxy",
windscaling=32.0,
cdfac=0.89,
agrow=True,
a=0.0015,
)
st6 = ST6(**kwargs)
print(st6.render())
ST6 a1sds=4.7e-07 a2sds=6.6e-06 UP HWANG VECTAU U10PROXY windscaling=32.0
ST6 a1sds=2.8e-06 a2sds=3.5e-05 UP HWANG VECTAU U10PROXY windscaling=32.0 DEBIAS cdfac=0.89 AGROW a=0.0015
Fields:
-
agrow(bool) -
a(Optional[float]) -
model_type(Literal['st6']) -
a1sds(float) -
a2sds(float) -
p1sds(Optional[float]) -
p2sds(Optional[float]) -
normalization(Literal['up', 'down']) -
wind_drag(Literal['hwang', 'fan', 'ecmwf']) -
tau(Literal['vectau', 'scatau']) -
u10(Literal['u10proxy', 'true10']) -
windscaling(Optional[float]) -
cdfac(Optional[float])
Validators:
p1sds
pydantic-field
¶
Power coefficient controlling strength of dissipation term T1 (L in RBW12, SWAN default: 4)
p2sds
pydantic-field
¶
Power coefficient controlling strength of dissipation term T2 (M in RBW12, SWAN default: 4)
normalization
pydantic-field
¶
normalization: Literal['up', 'down'] = 'up'
Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended
wind_drag
pydantic-field
¶
wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'
Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology
tau
pydantic-field
¶
tau: Literal['vectau', 'scatau'] = 'vectau'
Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended
windscaling
pydantic-field
¶
Factor to scale U10 with U* when using U10PROXY
cdfac
pydantic-field
¶
Counter bias in the input wind fields by providing a multiplier on the drag coefficient
agrow
pydantic-field
¶
agrow: bool = False
Activate the Cavaleri and Malanotte (1981) wave growth term
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
ST6C1
pydantic-model
¶
ST6C1(**data: Any)
Bases: ST6
First ST6 calibration in the SWAN user manual.
Examples¶
Fields:
-
wind_drag(Literal['hwang', 'fan', 'ecmwf']) -
a(Optional[float]) -
normalization(Literal['up', 'down']) -
tau(Literal['vectau', 'scatau']) -
u10(Literal['u10proxy', 'true10']) -
cdfac(Optional[float]) -
model_type(Literal['st6c1']) -
a1sds(Literal[4.7e-07]) -
a2sds(Literal[6.6e-06]) -
p1sds(Literal[4.0]) -
p2sds(Literal[4.0]) -
windscaling(Literal[28.0]) -
agrow(Literal[True])
Validators:
wind_drag
pydantic-field
¶
wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'
Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
normalization
pydantic-field
¶
normalization: Literal['up', 'down'] = 'up'
Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended
tau
pydantic-field
¶
tau: Literal['vectau', 'scatau'] = 'vectau'
Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended
cdfac
pydantic-field
¶
Counter bias in the input wind fields by providing a multiplier on the drag coefficient
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
ST6C2
pydantic-model
¶
ST6C2(**data: Any)
Bases: ST6C1
Second ST6 calibration in the SWAN user manual.
Examples¶
TODO: Ensure validator is reused here so fan and debias are not used together.
Fields:
-
agrow(Literal[True]) -
a(Optional[float]) -
a1sds(Literal[4.7e-07]) -
a2sds(Literal[6.6e-06]) -
p1sds(Literal[4.0]) -
p2sds(Literal[4.0]) -
normalization(Literal['up', 'down']) -
tau(Literal['vectau', 'scatau']) -
u10(Literal['u10proxy', 'true10']) -
windscaling(Literal[28.0]) -
cdfac(Optional[float]) -
model_type(Literal['st6c2']) -
wind_drag(Literal['fan'])
Validators:
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
normalization
pydantic-field
¶
normalization: Literal['up', 'down'] = 'up'
Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended
tau
pydantic-field
¶
tau: Literal['vectau', 'scatau'] = 'vectau'
Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended
cdfac
pydantic-field
¶
Counter bias in the input wind fields by providing a multiplier on the drag coefficient
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
ST6C3
pydantic-model
¶
ST6C3(**data: Any)
Bases: ST6C1
Third ST6 calibration in the SWAN user manual.
Examples¶
Fields:
-
wind_drag(Literal['hwang', 'fan', 'ecmwf']) -
agrow(Literal[True]) -
a(Optional[float]) -
p1sds(Literal[4.0]) -
p2sds(Literal[4.0]) -
normalization(Literal['up', 'down']) -
tau(Literal['vectau', 'scatau']) -
u10(Literal['u10proxy', 'true10']) -
cdfac(Optional[float]) -
model_type(Literal['st6c3']) -
a1sds(Literal[2.8e-06]) -
a2sds(Literal[3.5e-05]) -
windscaling(Literal[32.0])
Validators:
wind_drag
pydantic-field
¶
wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'
Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
normalization
pydantic-field
¶
normalization: Literal['up', 'down'] = 'up'
Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended
tau
pydantic-field
¶
tau: Literal['vectau', 'scatau'] = 'vectau'
Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended
cdfac
pydantic-field
¶
Counter bias in the input wind fields by providing a multiplier on the drag coefficient
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
ST6C4
pydantic-model
¶
ST6C4(**data: Any)
Bases: ST6C3
Fourth ST6 calibration in the SWAN user manual.
Examples¶
ST6 a1sds=2.8e-06 a2sds=3.5e-05 p1sds=4.0 p2sds=4.0 UP HWANG VECTAU U10PROXY windscaling=32.0 DEBIAS cdfac=0.89 AGROW
Fields:
-
wind_drag(Literal['hwang', 'fan', 'ecmwf']) -
agrow(Literal[True]) -
a(Optional[float]) -
a1sds(Literal[2.8e-06]) -
a2sds(Literal[3.5e-05]) -
p1sds(Literal[4.0]) -
p2sds(Literal[4.0]) -
normalization(Literal['up', 'down']) -
tau(Literal['vectau', 'scatau']) -
u10(Literal['u10proxy', 'true10']) -
windscaling(Literal[32.0]) -
model_type(Literal['st6c4']) -
cdfac(Literal[0.89])
Validators:
wind_drag
pydantic-field
¶
wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'
Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
normalization
pydantic-field
¶
normalization: Literal['up', 'down'] = 'up'
Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended
tau
pydantic-field
¶
tau: Literal['vectau', 'scatau'] = 'vectau'
Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
ST6C5
pydantic-model
¶
ST6C5(**data: Any)
Bases: ST6C1
Fifth ST6 calibration in the SWAN user manual.
Examples¶
ST6 a1sds=6.5e-06 a2sds=8.5e-05 p1sds=4.0 p2sds=4.0 UP HWANG VECTAU U10PROXY windscaling=35.0 DEBIAS cdfac=0.89 AGROW
Fields:
-
wind_drag(Literal['hwang', 'fan', 'ecmwf']) -
agrow(Literal[True]) -
a(Optional[float]) -
p1sds(Literal[4.0]) -
p2sds(Literal[4.0]) -
normalization(Literal['up', 'down']) -
tau(Literal['vectau', 'scatau']) -
u10(Literal['u10proxy', 'true10']) -
model_type(Literal['st6c5']) -
cdfac(Literal[0.89]) -
a1sds(Literal[6.5e-06]) -
a2sds(Literal[8.5e-05]) -
windscaling(Literal[35.0])
Validators:
wind_drag
pydantic-field
¶
wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'
Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology
a
pydantic-field
¶
Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)
normalization
pydantic-field
¶
normalization: Literal['up', 'down'] = 'up'
Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended
tau
pydantic-field
¶
tau: Literal['vectau', 'scatau'] = 'vectau'
Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
ELDEBERKY
pydantic-model
¶
ELDEBERKY(**data: Any)
Bases: BaseSubComponent
Biphase of Eldeberky (1999).
Biphase parameterisation as a funtion of the Ursell number of Eldeberky (1999).
References¶
Eldeberky, Y., Polnikov, V. and Battjes, J.A., 1996. A statistical approach for modeling triad interactions in dispersive waves. In Coastal Engineering 1996 (pp. 1088-1101).
Eldeberky, Y. and Madsen, P.A., 1999. Deterministic and stochastic evolution equations for fully dispersive and weakly nonlinear waves. Coastal Engineering, 38(1), pp.1-24.
Doering, J.C. and Bowen, A.J., 1995. Parametrization of orbital velocity asymmetries of shoaling and breaking waves using bispectral analysis. Coastal engineering, 26(1-2), pp.15-33.
Examples¶
from rompy_swan.subcomponents.physics import ELDEBERKY
biphase = ELDEBERKY()
print(biphase.render())
biphase = ELDEBERKY(urcrit=0.63)
print(biphase.render())
Fields:
-
model_type(Literal['eldeberky']) -
urcrit(Optional[float])
urcrit
pydantic-field
¶
The critical Ursell number appearing in the parametrization. Note: the value of urcrit is setted by Eldeberky (1996) at 0.2 based on a laboratory experiment, whereas Doering and Bowen (1995) employed the value of 0.63 based on the field experiment data (SWAN default: 0.63)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
DEWIT
pydantic-model
¶
DEWIT(**data: Any)
Bases: BaseSubComponent
Biphase of De Wit (2022).
Biphase parameterization based on bed slope and peak period of De Wit (2022).
References¶
De Wit, F.P., 2022. Wave shape prediction in complex coastal systems (Doctoral dissertation, PhD. thesis. Delft University of Technology. https://repository. tudelft. nl/islandora/object/uuid% 3A0fb850a4-4294-4181-9d74-857de21265c2).
Examples¶
from rompy_swan.subcomponents.physics import DEWIT
biphase = DEWIT()
print(biphase.render())
biphase = DEWIT(lpar=0.0)
print(biphase.render())
Fields:
-
model_type(Literal['dewit']) -
lpar(Optional[float])
lpar
pydantic-field
¶
Scales spatial averaging of the De Wit's biphase in terms of a multiple of peak wave length of the incident wave field. Note: lpar = 0` means no averaging (SWAN default: 0)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
TRANSM
pydantic-model
¶
TRANSM(**data: Any)
Bases: BaseSubComponent
Constant transmission coefficient.
Examples¶
from rompy_swan.subcomponents.physics import TRANSM
transm = TRANSM()
print(transm.render())
transm = TRANSM(trcoef=0.5)
print(transm.render())
Fields:
-
model_type(Literal['transm', 'TRANSM']) -
trcoef(Optional[float])
model_type
pydantic-field
¶
model_type: Literal['transm', 'TRANSM'] = 'transm'
Model type discriminator
trcoef
pydantic-field
¶
Constant transmission coefficient (ratio of transmitted over incoming significant wave height) (SWAN default: 0.0) (no transmission = complete blockage)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
TRANS1D
pydantic-model
¶
TRANS1D(**data: Any)
Bases: BaseSubComponent
Frequency dependent transmission.
Examples¶
from rompy_swan.subcomponents.physics import TRANS1D
transm = TRANS1D(trcoef=[0.0, 0.0, 0.2, 0.5, 0.2, 0.0, 0.0])
print(transm.render())
Fields:
model_type
pydantic-field
¶
model_type: Literal['trans1d', 'TRANS1D'] = 'trans1d'
Model type discriminator
trcoef
pydantic-field
¶
Transmission coefficient (ratio of transmitted over incoming significant wave height) per frequency. The number of these transmission values must be equal to the number of frequencies, i.e. msc + 1
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
TRANS2D
pydantic-model
¶
TRANS2D(**data: Any)
Bases: BaseSubComponent
Frequency-direction dependent transmission.
Examples¶
import numpy as np
from rompy_swan.subcomponents.physics import TRANS2D
trcoef = np.array([[0.0, 0.0], [0.1, 0.1], [0.2, 0.2]])
transm = TRANS2D(trcoef=trcoef)
print(transm.render())
Fields:
-
model_type(Literal['trans2d', 'TRANS2D']) -
trcoef(Np2DArray)
Validators:
model_type
pydantic-field
¶
model_type: Literal['trans2d', 'TRANS2D'] = 'trans2d'
Model type discriminator
trcoef
pydantic-field
¶
Transmission coefficient (ratio of transmitted over incoming significant wave height) per frequency and direction, rows represent directions and columns represent frequencies
constrained_0_1
pydantic-validator
¶
Ensure all directions have the same number of frequencies.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
GODA
pydantic-model
¶
GODA(**data: Any)
Bases: BaseSubComponent
DAM transmission of Goda/Seelig (1979).
This option specified transmission coefficients dependent on the incident wave conditions at the obstacle and on the obstacle height (which may be submerged).
References¶
Goda, Y. and Suzuki, Y., 1976. Estimation of incident and reflected waves in random wave experiments. In Coastal Engineering 1976 (pp. 828-845).
Seelig, W.N., 1979. Effects of breakwaters on waves: Laboratory test of wave transmission by overtopping. In Proc. Conf. Coastal Structures, 1979 (Vol. 79, No. 2, pp. 941-961).
Examples¶
from rompy_swan.subcomponents.physics import GODA
transm = GODA(hgt=3.0)
print(transm.render())
transm = GODA(hgt=3.0, alpha=2.6, beta=0.15)
print(transm.render())
Fields:
hgt
pydantic-field
¶
hgt: float
The elevation of the top of the obstacle above reference level (same reference level as for bottom etc.); use a negative value if the top is below that reference level
alpha
pydantic-field
¶
coefficient determining the transmission coefficient for Goda's transmission formula (SWAN default: 2.6)
beta
pydantic-field
¶
Another coefficient determining the transmission coefficient for Goda's transmission formula (SWAN default: 0.15)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
DANGREMOND
pydantic-model
¶
DANGREMOND(**data: Any)
Bases: BaseSubComponent
DAM transmission of d'Angremond et al. (1996).
This option specifies transmission coefficients dependent on the incident wave conditions at the obstacle and on the obstacle height (which may be submerged).
References¶
d'Angremond, K., Van Der Meer, J.W. and De Jong, R.J., 1996. Wave transmission at low-crested structures. In Coastal Engineering 1996 (pp. 2418-2427).
Examples¶
from rompy_swan.subcomponents.physics import DANGREMOND
transm = DANGREMOND(hgt=3.0, slope=60, Bk=10.0)
print(transm.render())
Fields:
model_type
pydantic-field
¶
model_type: Literal["dangremond", "DANGREMOND"] = (
"dangremond"
)
Model type discriminator
hgt
pydantic-field
¶
hgt: float
The elevation of the top of the obstacle above reference level (same reference level as for bottom etc.); use a negative value if the top is below that reference level
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
REFL
pydantic-model
¶
REFL(**data: Any)
Bases: BaseSubComponent
Obstacle reflections.
Examples¶
from rompy_swan.subcomponents.physics import REFL
refl = REFL()
print(refl.render())
refl = REFL(reflc=0.5)
print(refl.render())
Fields:
-
model_type(Literal['refl', 'REFL']) -
reflc(Optional[float])
RSPEC
pydantic-model
¶
RSPEC(**data: Any)
Bases: BaseSubComponent
Specular reflection.
Examples¶
Fields:
-
model_type(Literal['rspec', 'RSPEC'])
RDIFF
pydantic-model
¶
RDIFF(**data: Any)
Bases: BaseSubComponent
Diffuse reflection.
Specular reflection where incident waves are scattered over reflected direction.
Examples¶
from rompy_swan.subcomponents.physics import RDIFF
refl = RDIFF()
print(refl.render())
refl = RDIFF(pown=1.0)
print(refl.render())
Fields:
-
model_type(Literal['rdiff', 'RDIFF']) -
pown(Optional[float])
model_type
pydantic-field
¶
model_type: Literal['rdiff', 'RDIFF'] = 'rdiff'
Model type discriminator
pown
pydantic-field
¶
Each incoming direction θ is scattered over reflected direction θ_refl according to cos^pown(θ-θ_refl). The parameter pown indicates the widthof the redistribution function (SWAN default: 1.0)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
FREEBOARD
pydantic-model
¶
FREEBOARD(**data: Any)
Bases: BaseSubComponent
Freeboard dependent transmission and reflection.
With this option the user indicates that the fixed transmission trcoef and
reflection reflc coefficients are freeboard dependent. The freeboard dependency
has no effect on the transmission coefficient as computed using the DAM option.
Notes¶
See the Scientific/Technical documentation for background information on the
gammat and gammar shape parameters.
Examples¶
from rompy_swan.subcomponents.physics import FREEBOARD
freeboard = FREEBOARD(hgt=2.0)
print(freeboard.render())
freeboard = FREEBOARD(hgt=2.0, gammat=1.0, gammar=1.0, quay=True)
print(freeboard.render())
Fields:
-
model_type(Literal['freeboard', 'FREEBOARD']) -
hgt(float) -
gammat(Optional[float]) -
gammar(Optional[float]) -
quay(bool)
model_type
pydantic-field
¶
model_type: Literal['freeboard', 'FREEBOARD'] = 'freeboard'
Model type discriminator
hgt
pydantic-field
¶
hgt: float
The elevation of the top of the obstacle or height of the quay above the reference level (same reference level as for the bottom). Use a negative value if the top is below that reference level. In case hgt is also specified in the DAM option, both values of hgt should be equal for consistency
gammat
pydantic-field
¶
Shape parameter of relative freeboard dependency of transmission coefficient. This parameter should be higher than zero (SWAN default 1.0)
gammar
pydantic-field
¶
Shape parameter of relative freeboard dependency of reflection coefficient. This parameter should be higher than zero (SWAN default 1.0)
quay
pydantic-field
¶
quay: bool = False
With this option the user indicates that the freeboard dependency of the transmission and reflection coefficients also depends on the relative position of an obstacle-linked grid point with respect to the position of the obstacle line representing the edge of a quay. In case the active grid point is on the deeper side of the obstacle, then the correction factors are applied using the parameters hgt, gammat and gammar.In case the active grid point is on the shallower side of the obstacle, the reflection coefficient is set to 0 and the transmission coefficient to 1.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
LINE
pydantic-model
¶
LINE(**data: Any)
Bases: BaseSubComponent
Line of points to define obstacle location.
With this option the user indicates that the fixed transmission trcoef and
reflection reflc coefficients are freeboard dependent. The freeboard dependency
has no effect on the transmission coefficient as computed using the DAM option.
Notes¶
Points coordinates should be provided in m If Cartesian coordinates are used or in
degrees if spherical coordinates are used (see command COORD). At least two
corner points must be provided.
Examples¶
from rompy_swan.subcomponents.physics import LINE
line = LINE(xp=[174.1, 174.2, 174.3], yp=[-39.1, -39.1, -39.1])
print(line.render())
Fields:
Validators:
rompy_swan.subcomponents.numerics¶
SWAN numerics subcomponents.
BSBT
pydantic-model
¶
BSBT(**data: Any)
Bases: BaseSubComponent
BSBT first order propagation scheme.
Examples¶
Fields:
-
model_type(Literal['bsbt', 'BSBT'])
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
GSE
pydantic-model
¶
GSE(**data: Any)
Bases: BaseSubComponent
Garden-sprinkler effect.
Garden-sprinkler effect is to be counteracted in the S&L propagation scheme (default for nonstationary regular grid computations) or in the propagation scheme for unstructured grids by adding a diffusion term to the basic equation. This may affect the numerical stability of SWAN.
Examples¶
from rompy_swan.subcomponents.numerics import GSE
scheme = GSE(waveage=dict(delt=86400, dfmt="day"))
print(scheme.render())
Fields:
-
model_type(Literal['gse', 'GSE']) -
waveage(Optional[Delt])
waveage
pydantic-field
¶
The time interval used to determine the diffusion which counteracts the so-called garden-sprinkler effect. The default value of waveage is zero, i.e. no added diffusion. The value of waveage should correspond to the travel time of the waves over the computational region.
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
STAT
pydantic-model
¶
STAT(**data: Any)
Bases: BaseSubComponent
Computation parameters in stationary computation.
Fields:
mxitst
pydantic-field
¶
The maximum number of iterations for stationary computations. The computation stops when this number is exceeded (SWAN default: 50)
alfa
pydantic-field
¶
Proportionality constant used in the frequency-dependent under-relaxation technique. Based on experiences, a suggestion for this parameter is alfa = 0.01. In case of diffraction computations, the use of this parameter is recommended (SWAN default: 0.00)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
NONSTAT
pydantic-model
¶
NONSTAT(**data: Any)
Bases: BaseSubComponent
Computation parameters in nonstationary computation.
Fields:
-
model_type(Literal['nonstat', 'NONSTAT']) -
mxitns(Optional[int])
model_type
pydantic-field
¶
model_type: Literal['nonstat', 'NONSTAT'] = 'nonstat'
Model type discriminator
mxitns
pydantic-field
¶
The maximum number of iterations per time step for nonstationary computations. The computation moves to the next time step when this number is exceeded (SWAN default: mxitns = 1
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
STOPC
pydantic-model
¶
STOPC(**data: Any)
Bases: BaseSubComponent
Stopping criteria of Zijlema and Van der Westhuysen (2005).
With this option the user can influence the criterion for terminating the iterative
procedure in the SWAN computations (both stationary and nonstationary). The
criterion makes use of the second derivative, or curvature, of the iteration curve
of the significant wave height. As the solution of a simulation approaches full
convergence, the curvature of the iteration curve will tend to zero. SWAN stops the
process if the relative change in Hs from one iteration to the next is less than
drel and the curvature of the iteration curve of Hs normalized with Hs is less
than curvat or the absolute change in Hs from one iteration to the next is less
than dabs. Both conditions need to be fulfilled in more than fraction npnts
percent of all wet grid points.
With respect to the QC modelling, another stopping criteria will be employed.
Namely, SWAN stops the iteration process if the absolute change in Hs from one
iterate to another is less than dabs * Hinc, where Hinc is the representative
incident wave height, or the relative change in Hs from one to the next iteration
is less than drel. These criteria must be fulfilled in more than npnts
percent of all active, well-defined points.
References¶
- Zijlema, M. and Van der Westhuysen, A. (2005). On convergence behaviour and numerical accuracy in stationary SWAN simulations of nearshore wind wave spectra, Coastal Engineering, 52(3), p. 337-256.
Examples¶
from rompy_swan.subcomponents.numerics import STOPC
stop = STOPC()
print(stop.render())
stop = STOPC(
dabs=0.005,
drel=0.01,
curvat=0.005,
npnts=99.5,
mode=dict(model_type="nonstat", mxitns=1),
limiter=0.1,
)
print(stop.render())
Fields:
-
model_type(Literal['stopc', 'STOPC']) -
dabs(Optional[float]) -
drel(Optional[float]) -
curvat(Optional[float]) -
npnts(Optional[float]) -
mode(Optional[Union[STAT, NONSTAT]]) -
limiter(Optional[float])
model_type
pydantic-field
¶
model_type: Literal['stopc', 'STOPC'] = 'stopc'
Model type discriminator
dabs
pydantic-field
¶
Maximum absolute change in Hs from one iteration to the next (SWAN default: 0.005 [m] or 0.05 [-] in case of QC model)
drel
pydantic-field
¶
Maximum relative change in Hs from one iteration to the next (SWAN default: 0.01 [-])
curvat
pydantic-field
¶
Maximum curvature of the iteration curve of Hs normalised with Hs (SWAN default: 0.005 [-] (not used in the QC model))
npnts
pydantic-field
¶
Percentage of points in the computational grid above which the stopping criteria needs to be satisfied (SWAN default: 99.5 [-])
mode
pydantic-field
¶
Termination criteria for stationary or nonstationary runs
limiter
pydantic-field
¶
Determines the maximum change per iteration of the energy density per spectral-bin given in terms of a fraction of the omni-directional Phillips level (SWAN default: 0.1)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
ACCUR
pydantic-model
¶
ACCUR(**data: Any)
Bases: BaseSubComponent
Stop the iterative procedure.
With this option the user can influence the criterion for terminating the iterative procedure in the SWAN computations (both stationary and non-stationary modes). SWAN stops the iterations if (a), (b) and (c) are all satisfied:
a) The change in the local significant wave height Hs from one iteration to the
next is less than (1) fraction drel of that height or (2) fraction dhoval
of the average Hs over all grid points.
b) The change in the local mean wave period Tm01 from one iteration to the next is
less than (1) fraction drel of that period or (2) fraction dtoval of the
average mean wave period over all wet grid points.
c) Conditions (a) and (b) are fulfilled in more than fraction npnts% of all wet
grid points.
Note
This command has become obsolete in SWAN 41.01. The command STOPC should be used.
Examples:
from rompy_swan.subcomponents.numerics import ACCUR
accur = ACCUR()
print(accur.render())
accur = ACCUR(
drel=0.01,
dhoval=0.02,
dtoval=0.02,
npnts=98.0,
mode=dict(model_type="nonstat", mxitns=1),
limiter=0.1,
)
print(accur.render())
Fields:
-
model_type(Literal['accur', 'ACCUR']) -
drel(Optional[float]) -
dhoval(Optional[float]) -
dtoval(Optional[float]) -
npnts(Optional[float]) -
mode(Optional[Union[STAT, NONSTAT]]) -
limiter(Optional[float])
model_type
pydantic-field
¶
model_type: Literal['accur', 'ACCUR'] = 'accur'
Model type discriminator
drel
pydantic-field
¶
Maximum relative change in Hs or Tm01 from one iteration to the next (SWAN default: 0.02)
dhoval
pydantic-field
¶
Fraction of the average Hs over all wet grid points below which the the stopping criteria needs to be satisfied (SWAN default: 0.02)
dtoval
pydantic-field
¶
Fraction of the average Tm01 over all wet grid points below which the the stopping criteria needs to be satisfied (SWAN default: 0.02)
npnts
pydantic-field
¶
Percentage of points in the computational grid above which the stopping criteria needs to be satisfied (SWAN default: 98)
mode
pydantic-field
¶
Termination criteria for stationary or nonstationary runs
limiter
pydantic-field
¶
Determines the maximum change per iteration of the energy density per spectral-bin given in terms of a fraction of the omni-directional Phillips level (SWAN default: 0.1)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
DIRIMPL
pydantic-model
¶
DIRIMPL(**data: Any)
Bases: BaseSubComponent
Numerical scheme for refraction.
Examples¶
from rompy_swan.subcomponents.numerics import DIRIMPL
dirimpl = DIRIMPL()
print(dirimpl.render())
dirimpl = DIRIMPL(cdd=0.5)
print(dirimpl.render())
Fields:
-
model_type(Literal['dirimpl', 'DIRIMPL']) -
cdd(Optional[float])
model_type
pydantic-field
¶
model_type: Literal['dirimpl', 'DIRIMPL'] = 'dirimpl'
Model type discriminator
cdd
pydantic-field
¶
A value of cdd=0 corresponds to a central scheme and has the largest accuracy (diffusion ≈ 0) but the computation may more easily generatespurious fluctuations. A value of cdd=1 corresponds to a first orderupwind scheme and it is more diffusive and therefore preferable if (strong) gradients in depth or current are present (SWAN default: 0.5)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
SIGIMPL
pydantic-model
¶
SIGIMPL(**data: Any)
Bases: BaseSubComponent
Frequency shifting accuracy.
Controls the accuracy of computing the frequency shifting and the stopping criterion and amount of output for the SIP solver (used in the computations in the presence of currents or time varying depth)
Examples¶
from rompy_swan.subcomponents.numerics import SIGIMPL
sigimpl = SIGIMPL()
print(sigimpl.render())
sigimpl = SIGIMPL(css=0.5, eps2=1e-4, outp=0, niter=20)
print(sigimpl.render())
Fields:
-
model_type(Literal['sigimpl', 'SIGIMPL']) -
css(Optional[float]) -
eps2(Optional[float]) -
outp(Optional[Literal[0, 1, 2, 3]]) -
niter(Optional[int])
model_type
pydantic-field
¶
model_type: Literal['sigimpl', 'SIGIMPL'] = 'sigimpl'
Model type discriminator
css
pydantic-field
¶
A value of css=0 corresponds to a central scheme and has the largest accuracy (diffusion ≈ 0) but the computation may more easily generate spurious fluctuations. A value of css=1 corresponds to a first order upwind scheme and it is more diffusive and therefore preferable if (strong) gradients in depth or current are present (SWAN default: 0.5)
eps2
pydantic-field
¶
Relative stopping criterion to terminate the linear solver (SIP or SOR). (SWAN default: 1.e-4 in case of SIP and 1.e-6 in case of SOR)
outp
pydantic-field
¶
Output for the iterative solver:
- 0 = no output
- 1 = additional information about the iteration process is written to the PRINT file
- 2 = gives a maximal amount of output concerning the iteration process
- 3 = summary of the iteration process
(SWAN default: 0)
niter
pydantic-field
¶
Maximum number of iterations for the linear solver (SWAN default: 20 in case of SIP and 1000 in case of SOR)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
CTHETA
pydantic-model
¶
CTHETA(**data: Any)
Bases: BaseSubComponent
Prevents excessive directional turning.
This option prevents an excessive directional turning at a single grid point or vertex due to a very coarse bathymetry or current locally. This option limits the directional turning rate cθ based on the CFL restriction. (See Eq. 3.41 of Scientific/Technical documentation). See also the final remark in Section 2.6.3. Note that if this command is not specified, then the limiter is not activated.
Examples¶
from rompy_swan.subcomponents.numerics import CTHETA
ctheta = CTHETA()
print(ctheta.render())
ctheta = CTHETA(cfl=0.9)
print(ctheta.render())
Fields:
-
model_type(Literal['ctheta', 'CTHETA']) -
cfl(Optional[float])
model_type
pydantic-field
¶
model_type: Literal['ctheta', 'CTHETA'] = 'ctheta'
Model type discriminator
cfl
pydantic-field
¶
Upper limit for the CFL restriction for ctheta. A suggestion for this parameter is cfl = 0.9 (SWAN default: 0.9 when CTHETA is activated)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
CSIGMA
pydantic-model
¶
CSIGMA(**data: Any)
Bases: BaseSubComponent
Prevents excessive directional turning.
This option prevents an excessive frequency shifting at a single grid point or vertex due to a very coarse bathymetry or current locally. This option limits the frequency shifting rate csigma based on the CFL restriction. See also the final remark in Section 2.6.3. Note that if this command is not specified, then the limiter is not activated.
Examples¶
from rompy_swan.subcomponents.numerics import CSIGMA
csigma = CSIGMA()
print(csigma.render())
csigma = CSIGMA(cfl=0.9)
print(csigma.render())
Fields:
-
model_type(Literal['csigma', 'CSIGMA']) -
cfl(Optional[float])
model_type
pydantic-field
¶
model_type: Literal['csigma', 'CSIGMA'] = 'csigma'
Model type discriminator
cfl
pydantic-field
¶
Upper limit for the CFL restriction for csigma. A suggestion for this parameter is cfl = 0.9 (SWAN default: 0.9 when CSIGMA is activated)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
SETUP
pydantic-model
¶
SETUP(**data: Any)
Bases: BaseSubComponent
Stop criteria in the computation of wave setup.
Controls the stopping criterion and amount of output for the SOR solver in the computation of the wave-induced set-up.
Examples¶
from rompy_swan.subcomponents.numerics import SETUP
setup = SETUP()
print(setup.render())
setup = SETUP(eps2=1e-4, outp=0, niter=20)
print(setup.render())
Fields:
-
model_type(Literal['setup', 'SETUP']) -
eps2(Optional[float]) -
outp(Optional[Literal[0, 1, 2, 3]]) -
niter(Optional[int])
model_type
pydantic-field
¶
model_type: Literal['setup', 'SETUP'] = 'setup'
Model type discriminator
eps2
pydantic-field
¶
Relative stopping criterion to terminate the linear solver (SIP or SOR). (SWAN default: 1.e-4 in case of SIP and 1.e-6 in case of SOR)
outp
pydantic-field
¶
Output for the iterative solver:
- 0 = no output
- 1 = additional information about the iteration process is written to the PRINT file
- 2 = gives a maximal amount of output concerning the iteration process
- 3 = summary of the iteration process
(SWAN default: 0)
niter
pydantic-field
¶
Maximum number of iterations for the linear solver (SWAN default: 20 in case of SIP and 1000 in case of SOR)
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
rompy_swan.subcomponents.output¶
SWAN Output Subcomponents
This module contains subcomponents for defining output specifications in SWAN, including spectral output types and frequency representations.
SPEC1D
pydantic-model
¶
SPEC1D(**data: Any)
Bases: BaseSubComponent
Frequency 1D spectra.
Examples¶
Fields:
-
model_type(Literal['spec1d', 'SPEC1D'])
SPEC2D
pydantic-model
¶
SPEC2D(**data: Any)
Bases: BaseSubComponent
Frequency-direction 2D spectra.
Examples¶
Fields:
-
model_type(Literal['spec2d', 'SPEC2D'])
ABS
pydantic-model
¶
ABS(**data: Any)
Bases: BaseSubComponent
Absolute frequency spectra.
Spectra are computed as a function of absolute frequency, i.e., the frequency as measured in a fixed point.
Examples¶
Fields:
-
model_type(Literal['abs', 'ABS'])
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.
REL
pydantic-model
¶
REL(**data: Any)
Bases: BaseSubComponent
Relative frequency spectra.
Spectra are computed as a function of relative frequency, i.e., the frequency as measured when moving with current.
Examples¶
Fields:
-
model_type(Literal['rel', 'REL'])
check_for_typos
classmethod
¶
Suggest the closest field name for an unknown input key.
A field can be given by its name or, like in pydantic, by its alias.