Startup
SWAN startup commands
PROJECT
Bases: BaseComponent
SWAN Project.
.. code-block:: text
PROJECT 'name' 'nr' 'title' 'title2 'title3'
With this required command the user defines a number of strings to identify the SWAN run (project name e.g., an engineering project) in the print and plot file.
Examples
.. ipython:: python :okwarning:
from rompy_swan.components.startup import PROJECT
proj = PROJECT(nr="01")
print(proj.render())
proj = PROJECT(
name="waus",
nr="001",
title1="Western Australia",
title2="Perth Nest"
)
print(proj.render())
Source code in rompy_swan/components/startup.py
Attributes
model_type
class-attribute
instance-attribute
model_type: Literal['project', 'PROJECT'] = Field(default='project', description='Model type discriminator')
name
class-attribute
instance-attribute
name: Optional[str] = Field(default=None, description='Is the name of the project, at most 16 characters long', max_length=16)
nr
class-attribute
instance-attribute
nr: str = Field(description='Is the run identification (to be provided as a character string; e.g. the run number) to distinguish this run among other runs for the same project; it is at most 4 characters long. It is the only required information in this command.', max_length=4)
title1
class-attribute
instance-attribute
title1: Optional[str] = Field(default=None, description="A string of at most 72 characters provided by the user to appear in the output of the program for the user's convenience (SWAN default: blanks)", max_length=72)
title2
class-attribute
instance-attribute
title3
class-attribute
instance-attribute
Functions
cmd
Source code in rompy_swan/components/startup.py
SET
Bases: BaseComponent
SWAN setting commands.
.. code-block:: text
SET [level] [nor] [depmin] [maxmes] [maxerr] [grav] [rho] [cdcap] &
[inrhog] [hsrerr] NAUTICAL|->CARTESIAN [pwtail] [froudmax] [icewind]
With this optional command the user assigns values to various general parameters.
Notes
The error level maxerr is coded as follows:
- 1: warnings
- 2: errors (possibly automatically repaired or repairable by SWAN)
- 3: severe errors
Default values for pwtail depend on formulations of physics:
- command GEN1:
pwtail = 5 - command GEN2:
pwtail = 5 - command GEN3 KOMEN:
pwtail = 4 - command GEN3 WESTH:
pwtail = 4 - command GEN3 JANSSEN:
pwtail = 5
Examples
.. ipython:: python :okwarning:
from rompy_swan.components.startup import SET
set = SET(level=0.5, direction_convention="nautical")
print(set.render())
set = SET(
level=-1.0,
nor=90,
depmin=0.01,
maxerr=3,
grav=9.81,
rho=1025,
cdcap=2.5e-3,
inrhog=0,
hsrerr=0.1,
direction_convention="nautical",
)
print(set.render())
Source code in rompy_swan/components/startup.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
Attributes
model_type
class-attribute
instance-attribute
level
class-attribute
instance-attribute
level: Optional[float] = Field(default=None, description='Increase in water level that is constant in space and time can be given with this option, `level` is the value of this increase (in m). For a variable water level reference is made to the commands INPGRID and READINP (SWAN default: 0)', examples=[0])
nor
class-attribute
instance-attribute
nor: Optional[float] = Field(default=None, description='Direction of North with respect to the x-axis (measured counterclockwise); default `nor = 90`, i.e. x-axis of the problem coordinate system points East. When spherical coordinates are used (see command COORD) the value of `nor` may not be modified', ge=-360.0, le=360.0)
depmin
class-attribute
instance-attribute
depmin: Optional[float] = Field(default=None, description='Threshold depth (in m). In the computation any positive depth smaller than `depmin` is made equal to `depmin` (SWAN default: 0.05)', ge=0.0)
maxmes
class-attribute
instance-attribute
maxmes: Optional[int] = Field(default=None, description='Maximum number of error messages during the computation at which the computation is terminated. During the computational process messages are written to the print file (SWAN default: 200)', ge=0)
maxerr
class-attribute
instance-attribute
maxerr: Optional[Literal[1, 2, 3]] = Field(default=None, description='During pre-processing SWAN checks input data. Depending on the severity of the errors encountered during this pre-processing, SWAN does not start computations. The user can influence the error level above which SWAN will not start computations (at the level indicated the computations will continue) (SWAN default: 1)')
grav
class-attribute
instance-attribute
grav: Optional[float] = Field(default=None, description='The gravitational acceleration (in m/s2) (SWAN default: 9.81)', ge=0.0)
rho
class-attribute
instance-attribute
rho: Optional[float] = Field(default=None, description='The water density (in kg/m3) (SWAN default: 1025)', ge=0.0)
cdcap
class-attribute
instance-attribute
cdcap: Optional[float] = Field(default=None, description='The maximum value for the wind drag coefficient. A value of 99999 meansno cutting off the drag coefficient. A suggestion for this parameter is `cdcap = 2.5x 10-3` (SWAN default: 99999) ', ge=0.0)
inrhog
class-attribute
instance-attribute
inrhog: Optional[Literal[0, 1]] = Field(default=None, description='To indicate whether the user requires output based on variance or based on true energy (see Section 2.5). `inrhog` = 0: output based on variance, `inrhog` = 1: output based on true energy (SWAN default: 0)')
hsrerr
class-attribute
instance-attribute
hsrerr: Optional[float] = Field(default=None, description='The relative difference between the user imposed significant wave height and the significant wave height computed by SWAN (anywhere along the computational grid boundary) above which a warning will be given. This relative difference is the difference normalized with the user provided significant wave height. This warning will be given for each boundary grid point where the problem occurs (with its x- and y-index number of the computational grid). The cause of the difference is explained in Section 2.6.3. To suppress these warnings (in particular for nonstationary computations), set `hsrerr` at a very high value or use command OFF BNDCHK (SWAN default: 0.10) (ONLY MEANT FOR STRUCTURED GRIDS)', ge=0.0)
direction_convention
class-attribute
instance-attribute
direction_convention: Literal['nautical', 'cartesian'] = Field(description='Direction convention: `nautical` indicates that the Nautical convention for wind and wave direction (SWAN input and output) will be used, `cartesian` indicates that the Cartesian convention for wind and wave direction will be used. For definition, see Section 2.5 or Appendix A (SWAN default: `cartesian`)')
pwtail
class-attribute
instance-attribute
pwtail: Optional[int] = Field(default=None, description='Power of high frequency tail; defines the shape of the spectral tail above the highest prognostic frequency `fhigh` (see command CGRID). The energy density is assumed to be proportional to frequency to the power `pwtail`. If the user wishes to use another value, then this SET command should be located in the command file after GEN1, GEN2 or GEN3 command (these will override the SET command with respect to `pwtail`)', ge=0)
froudmax
class-attribute
instance-attribute
froudmax: Optional[float] = Field(default=None, description='Is the maximum Froude number (`U/√gd` with `U` the current and `d` the water depth). The currents taken from a circulation model may mismatch with given water depth `d` in the sense that the Froude number becomes larger than 1. For this, the current velocities will be maximized by Froude number times `sqrt(gh)` (SWAN default: 0.8)', ge=0.0)
icewind
class-attribute
instance-attribute
icewind: Optional[Literal[0, 1]] = Field(default=None, description='Controls the scaling of wind input by open water fraction. Default value of zero corresponds to the case where wind input is scaled by the open water fraction. If `icewind = 1` then sea ice does not affect wind input directly. (Though there is still indirect effect via the sea ice sink term; see command SICE) (SWAN default: 0)')
Functions
pwtail_after_gen
classmethod
cmd
Source code in rompy_swan/components/startup.py
MODE
Bases: BaseComponent
SWAN Mode.
.. code-block:: text
MODE ->STATIONARY|NONSTATIONARY ->TWODIMENSIONAL|ONEDIMENSIONAL
With this optional command the user indicates that the run will be either stationary or nonstationary and one-dimensional (1D-mode) or two-dimensional (2D-mode). Nonstationary means either (see command COMPUTE):
- (a) one nonstationary computations or
- (b) a sequence of stationary computations or
- (c) a mix of (a) and (b)
Examples
.. ipython:: python :okwarning:
from rompy_swan.components.startup import MODE
mode = MODE()
print(mode.render())
mode = MODE(kind="nonstationary", dim="twodimensional")
print(mode.render())
Source code in rompy_swan/components/startup.py
Attributes
model_type
class-attribute
instance-attribute
model_type: Literal['mode', 'MODE'] = Field(default='mode', description='Model type discriminator.')
kind
class-attribute
instance-attribute
kind: Literal['stationary', 'nonstationary'] = Field(default='stationary', description='Indicates if run will be stationary or nonstationary')
dim
class-attribute
instance-attribute
dim: Literal['onedimensional', 'twodimensional'] = Field(default='twodimensional', description='Indicates that the run will be either one-dimensional (1D-mode) or two-dimensional (2D-mode)')
Functions
COORDINATES
Bases: BaseComponent
SWAN Coordinates.
.. code-block:: text
COORDINATES ->CARTESIAN|SPHERICAL REPEATING
Command to choose between Cartesian and spherical coordinates (see Section 2.5). A nested SWAN run must use the same coordinate system as the coarse grid SWAN run.
Examples
.. ipython:: python :okwarning:
from rompy_swan.components.startup import COORDINATES
coords = COORDINATES()
print(coords.render())
coords = COORDINATES(
kind=dict(model_type="spherical", projection="ccm"),
reapeating=True,
)
print(coords.render())
Source code in rompy_swan/components/startup.py
Attributes
model_type
class-attribute
instance-attribute
model_type: Literal['coordinates', 'COORDINATES'] = Field(default='coordinates', description='Model type discriminator')
kind
class-attribute
instance-attribute
reapeating
class-attribute
instance-attribute
reapeating: bool = Field(default=False, description='This option is only for academic cases. It means that wave energy leaving at one end of the domain (in computational x-direction) enter at the other side; it is as if the wave field repeats itself in x-direction with the length of the domain in x-direction. This option cannot be used in combination with computation of set-up (see command SETUP). This option is available only with regular grids')