Input grids¶
INPGRID and READINP: input grids for bottom, water level, currents, friction, wind and other fields, and the constant WIND and ICE forcing.
Input grid for SWAN.
INPGRID
pydantic-model
¶
INPGRID(**data: Any)
Bases: BaseComponent, ABC
SWAN input grid.
INPGRID [grid_type] ->REGULAR|CURVILINEAR|UNSTRUCTURED (EXCEPTION [excval]) &
(NONSTATIONARY [tbeginp] [deltinp] ->SEC|MIN|HR|DAY [tendinp])
This is the base class for all input grids. It is not meant to be used directly.
Fields:
-
model_type(Literal['inpgrid', 'INPGRID']) -
grid_type(GridOptions) -
excval(Optional[float]) -
nonstationary(Optional[NONSTATIONARY]) -
readinp(READINP)
Validators:
model_type
pydantic-field
¶
model_type: Literal['inpgrid', 'INPGRID'] = 'inpgrid'
Model type discriminator
grid_type
pydantic-field
¶
grid_type: GridOptions
Type of the swan input grid, e.g, 'bottom', 'wind', etc
excval
pydantic-field
¶
Exception value to allow identifying and ignoring certain point inside the given grid during the computation. If fac != 1, excval must be given as fac times the exception value
nonstationary
pydantic-field
¶
nonstationary: Optional[NONSTATIONARY] = None
Nonstationary time specification
set_nonstat_suffix
pydantic-validator
¶
set_nonstat_suffix() -> INPGRID
Set the nonstationary suffix.
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.
render
¶
REGULAR
pydantic-model
¶
REGULAR(**data: Any)
Bases: INPGRID
SWAN regular input grid.
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¶
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())
INPGRID BOTTOM REGULAR xpinp=172.0 ypinp=-41.0 alpinp=0.0 mxinp=99 myinp=99 dxinp=0.005 dyinp=0.005 EXCEPTION excval=-99.0
READINP BOTTOM fac=1.0 fname1='bottom.txt' idla=1 nhedf=0 nhedt=0 nhedvec=0 FREE
INPGRID WIND REGULAR xpinp=172.0 ypinp=-41.0 alpinp=0.0 mxinp=99 myinp=99 dxinp=0.005 dyinp=0.005 EXCEPTION excval=-99.0 NONSTATIONARY tbeginp=20190101.000000 deltinp=1.0 HR &
tendinp=20190107.000000
READINP WIND fac=1.0 fname1='wind.txt' idla=1 nhedf=0 nhedt=0 nhedvec=0 FREE
TODO: Use grid object, requires different grid parameters to be allowed.
Fields:
-
grid_type(GridOptions) -
excval(Optional[float]) -
nonstationary(Optional[NONSTATIONARY]) -
readinp(READINP) -
model_type(Literal['regular', 'REGULAR']) -
xpinp(float) -
ypinp(float) -
alpinp(Optional[float]) -
mxinp(int) -
myinp(int) -
dxinp(float) -
dyinp(float)
Validators:
model_type
pydantic-field
¶
model_type: Literal['regular', 'REGULAR'] = 'regular'
Model type discriminator
xpinp
pydantic-field
¶
xpinp: float
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
pydantic-field
¶
ypinp: float
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
pydantic-field
¶
Direction of the positive x-axis of the input grid (in degrees, Cartesian convention)
mxinp
pydantic-field
¶
mxinp: int
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
pydantic-field
¶
myinp: int
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
pydantic-field
¶
dxinp: float
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
pydantic-field
¶
dyinp: float
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
grid_type
pydantic-field
¶
grid_type: GridOptions
Type of the swan input grid, e.g, 'bottom', 'wind', etc
excval
pydantic-field
¶
Exception value to allow identifying and ignoring certain point inside the given grid during the computation. If fac != 1, excval must be given as fac times the exception value
nonstationary
pydantic-field
¶
nonstationary: Optional[NONSTATIONARY] = None
Nonstationary 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.
render
¶
CURVILINEAR
pydantic-model
¶
CURVILINEAR(**data: Any)
Bases: INPGRID
SWAN curvilinear input grid.
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¶
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())
INPGRID WIND CURVILINEAR stagrx=0.0 stagry=0.0 mxinp=199 myinp=199 EXCEPTION excval=-99.0 NONSTATIONARY tbeginp=20190101.000000 deltinp=1.0 HR tendinp=20190107.000000
READINP WIND fac=1.0 fname1='wind.txt' idla=1 nhedf=0 nhedt=0 nhedvec=0 FREE
TODO: Handle (or not) setting default values for mxinp and myinp from cgrid.
Fields:
-
grid_type(GridOptions) -
excval(Optional[float]) -
nonstationary(Optional[NONSTATIONARY]) -
readinp(READINP) -
model_type(Literal['curvilinear', 'CURVILINEAR']) -
stagrx(float) -
stagry(float) -
mxinp(int) -
myinp(int)
Validators:
model_type
pydantic-field
¶
model_type: Literal["curvilinear", "CURVILINEAR"] = (
"curvilinear"
)
Model type discriminator
stagrx
pydantic-field
¶
stagrx: float = 0.0
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
pydantic-field
¶
stagry: float = 0.0
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
pydantic-field
¶
mxinp: int
Number of meshes in ξ-direction of the input grid (this number is one less than the number of grid points in this direction)
myinp
pydantic-field
¶
myinp: int
Number of meshes in η-direction of the input grid (this number is one less than the number of grid points in this direction)
grid_type
pydantic-field
¶
grid_type: GridOptions
Type of the swan input grid, e.g, 'bottom', 'wind', etc
excval
pydantic-field
¶
Exception value to allow identifying and ignoring certain point inside the given grid during the computation. If fac != 1, excval must be given as fac times the exception value
nonstationary
pydantic-field
¶
nonstationary: Optional[NONSTATIONARY] = None
Nonstationary 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.
render
¶
UNSTRUCTURED
pydantic-model
¶
UNSTRUCTURED(**data: Any)
Bases: INPGRID
SWAN unstructured input grid.
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¶
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())
INPGRID BOTTOM UNSTRUCTURED EXCEPTION excval=-99.0 NONSTATIONARY tbeginp=20190101.000000 deltinp=1.0 HR tendinp=20190107.000000
READINP BOTTOM fac=1.0 fname1='bottom.txt' idla=1 nhedf=0 nhedt=0 nhedvec=0 FREE
Fields:
-
grid_type(GridOptions) -
excval(Optional[float]) -
nonstationary(Optional[NONSTATIONARY]) -
readinp(READINP) -
model_type(Literal['unstructured', 'UNSTRUCTURED'])
Validators:
model_type
pydantic-field
¶
model_type: Literal["unstructured", "UNSTRUCTURED"] = (
"unstructured"
)
Model type discriminator
grid_type
pydantic-field
¶
grid_type: GridOptions
Type of the swan input grid, e.g, 'bottom', 'wind', etc
excval
pydantic-field
¶
Exception value to allow identifying and ignoring certain point inside the given grid during the computation. If fac != 1, excval must be given as fac times the exception value
nonstationary
pydantic-field
¶
nonstationary: Optional[NONSTATIONARY] = None
Nonstationary 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.
render
¶
WIND
pydantic-model
¶
WIND(**data: Any)
Bases: BaseComponent
Constant wind input field.
With this optional command, the user indicates that the wind field is constant.
Examples¶
from rompy_swan.components.inpgrid import WIND
wind = WIND(vel=10.0, dir=270.0)
print(wind.render())
Fields:
ICE
pydantic-model
¶
ICE(**data: Any)
Bases: BaseComponent
Constant wind input field.
With this optional command, the user indicates that one or more ice fields are constant.
Examples¶
Fields: