Input Grids¶
Input grids (INPGRID) define the spatial grids for external forcing data such as bathymetry, wind, currents, water level, and friction. Each input grid can have different resolution and extent from the computational grid.
Input Grid Types
- BOTTOM — Bathymetry (water depth)
- WIND — Wind velocity components
- CURRENT — Current velocity components
- WLEVEL — Water level variations
- FRICTION — Spatially varying bottom friction
- ICE — Sea ice coverage
Grid Types¶
REGULAR ¶
Bases: INPGRID
SWAN regular input grid.
.. code-block:: text
INPGRID [grid_type] REGULAR [xpinp] [ypinp] [alpinp] [mxinp] [myinp] &
[dxinp] [dyinp] (EXCEPTION [excval]) &
(NONSTATIONARY [tbeginp] [deltinp] ->SEC|MIN|HR|DAY [tendinp])
READGRID [grid_type] [fac] 'fname1' [idla] [nhedf] ([nhedt]) ([nhedvec]) &
->FREE|FORMAT|UNFORMATTED ('form'|[idfm])
This is a group component that includes an INPGRID and a READGRID component.
Examples¶
.. ipython:: python :okwarning:
from rompy_swan.components.inpgrid import REGULAR
inpgrid = REGULAR(
grid_type="bottom",
excval=-99.0,
xpinp=172.0,
ypinp=-41.0,
alpinp=0.0,
mxinp=99,
myinp=99,
dxinp=0.005,
dyinp=0.005,
readinp=dict(fname1="bottom.txt"),
)
print(inpgrid.render())
inpgrid = REGULAR(
grid_type="wind",
excval=-99.0,
xpinp=172.0,
ypinp=-41.0,
alpinp=0.0,
mxinp=99,
myinp=99,
dxinp=0.005,
dyinp=0.005,
readinp=dict(fname1="wind.txt"),
nonstationary=dict(
tbeg="2019-01-01T00:00:00",
tend="2019-01-07 00:00:00",
delt=3600,
dfmt="hr",
),
)
print(inpgrid.render())
TODO: Use grid object, requires different grid parameters to be allowed.
Source code in src/rompy_swan/components/inpgrid.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 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 | |
Attributes¶
model_type
class-attribute
instance-attribute
¶
model_type: Literal['regular', 'REGULAR'] = Field(default='regular', description='Model type discriminator')
xpinp
class-attribute
instance-attribute
¶
xpinp: float = Field(description='Geographic location (x-coordinate) of the origin of the input grid in problem coordinates (in m) if Cartesian coordinates are used or in degrees if spherical coordinates are used. In case of spherical coordinates there is no default')
ypinp
class-attribute
instance-attribute
¶
ypinp: float = Field(description='Geographic location (y-coordinate) of the origin of the input grid in problem coordinates (in m) if Cartesian coordinates are used or in degrees if spherical coordinates are used. In case of spherical coordinates there is no default')
alpinp
class-attribute
instance-attribute
¶
alpinp: Optional[float] = Field(default=0.0, description='Direction of the positive x-axis of the input grid (in degrees, Cartesian convention)')
mxinp
class-attribute
instance-attribute
¶
mxinp: int = Field(description='Number of meshes in x-direction of the input grid (this number is one less than the number of grid points in this direction)')
myinp
class-attribute
instance-attribute
¶
myinp: int = Field(description='Number of meshes in y-direction of the input grid (this number is one less than the number of grid points in this direction). In 1D-mode, `myinp` should be 0')
dxinp
class-attribute
instance-attribute
¶
dxinp: float = Field(description='Mesh size in x-direction of the input grid, in m in case of Cartesian coordinates or in degrees if spherical coordinates are used')
dyinp
class-attribute
instance-attribute
¶
dyinp: float = Field(description='Mesh size in y-direction of the input grid, in m in case of Cartesian coordinates or in degrees if spherical coordinates are used. In 1D-mode, `dyinp` may have any value')
Functions¶
cmd ¶
Source code in src/rompy_swan/components/inpgrid.py
CURVILINEAR ¶
Bases: INPGRID
SWAN curvilinear input grid.
.. code-block:: text
INPGRID [grid_type] CURVILINEAR [stagrx] [stagry] [mxinp] [myinp] &
(EXCEPTION [excval]) &
(NONSTATIONARY [tbeginp] [deltinp] ->SEC|MIN|HR|DAY [tendinp])
READGRID [grid_type] [fac] 'fname1' [idla] [nhedf] ([nhedt]) ([nhedvec]) &
->FREE|FORMAT|UNFORMATTED ('form'|[idfm])
This is a group component that includes an INPGRID and a READGRID component.
Examples¶
.. ipython:: python :okwarning:
from rompy_swan.components.inpgrid import CURVILINEAR
inpgrid = CURVILINEAR(
grid_type="wind",
stagrx=0.0,
stagry=0.0,
mxinp=199,
myinp=199,
excval=-99.0,
readinp=dict(fname1="wind.txt"),
nonstationary=dict(
tbeg="2019-01-01T00:00:00",
tend="2019-01-07 00:00:00",
delt=3600,
dfmt="hr",
),
)
print(inpgrid.render())
TODO: Handle (or not) setting default values for mxinp and myinp from cgrid.
Source code in src/rompy_swan/components/inpgrid.py
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 | |
Attributes¶
model_type
class-attribute
instance-attribute
¶
model_type: Literal['curvilinear', 'CURVILINEAR'] = Field(default='curvilinear', description='Model type discriminator')
stagrx
class-attribute
instance-attribute
¶
stagrx: float = Field(default=0.0, description="Staggered x'-direction with respect to computational grid, e.g., `stagrx=0.5` means that the input grid points are shifted a half step in x'-direction; in many flow models x-velocities are defined in points shifted a half step in x'-direction")
stagry
class-attribute
instance-attribute
¶
stagry: float = Field(default=0.0, description="Staggered y'-direction with respect to computational grid, e.g., `stagry=0.5` means that the input grid points are shifted a half step in y'-direction; in many flow models y-velocities are defined in points shifted a half step in y'-direction")
mxinp
class-attribute
instance-attribute
¶
mxinp: int = Field(description='Number of meshes in ξ-direction of the input grid (this number is one less than the number of grid points in this direction)')
myinp
class-attribute
instance-attribute
¶
myinp: int = Field(description='Number of meshes in η-direction of the input grid (this number is one less than the number of grid points in this direction)')
Functions¶
cmd ¶
Source code in src/rompy_swan/components/inpgrid.py
UNSTRUCTURED ¶
Bases: INPGRID
SWAN unstructured input grid.
.. code-block:: text
INPGRID [grid_type] UNSTRUCTURED EXCEPTION [excval]) &
(NONSTATIONARY [tbeginp] [deltinp] ->SEC|MIN|HR|DAY [tendinp])
READGRID [grid_type] [fac] 'fname1' [idla] [nhedf] ([nhedt]) ([nhedvec]) &
->FREE|FORMAT|UNFORMATTED ('form'|[idfm])
This is a group component that includes an INPGRID and a READGRID component.
Examples¶
.. ipython:: python :okwarning:
from rompy_swan.components.inpgrid import UNSTRUCTURED
inpgrid = UNSTRUCTURED(
grid_type="bottom",
excval=-99.0,
readinp=dict(fname1="bottom.txt"),
nonstationary=dict(
tbeg="2019-01-01T00:00:00",
tend="2019-01-07 00:00:00",
delt=3600,
dfmt="hr",
),
)
print(inpgrid.render())
Source code in src/rompy_swan/components/inpgrid.py
Specialized Grids¶
WIND ¶
Bases: BaseComponent
Constant wind input field.
.. code-block:: text
WIND [vel] [dir]
With this optional command, the user indicates that the wind field is constant.
Examples¶
.. ipython:: python :okwarning:
from rompy_swan.components.inpgrid import WIND
wind = WIND(vel=10.0, dir=270.0)
print(wind.render())
Source code in src/rompy_swan/components/inpgrid.py
Attributes¶
model_type
class-attribute
instance-attribute
¶
vel
class-attribute
instance-attribute
¶
dir
class-attribute
instance-attribute
¶
dir: float = Field(description='Wind direction at 10 m elevation (in degrees, Cartesian or Nautical convention, see command SET)', ge=-180.0, le=360.0)
Functions¶
ICE ¶
Bases: BaseComponent
Constant wind input field.
.. code-block:: text
ICE [aice] [hice]
With this optional command, the user indicates that one or more ice fields are constant.
Examples¶
.. ipython:: python :okwarning:
from rompy_swan.components.inpgrid import ICE
ice = ICE(aice=0.1, hice=0.1)
print(ice.render())