Computational grid¶
CGRID: the computational grid (regular, curvilinear or unstructured) and its spectral resolution.
Computational grid for SWAN.
CGRID
pydantic-model
¶
CGRID(**data: Any)
Bases: BaseComponent, ABC
SWAN computational grid abstract component.
This class should not be used directly.
Fields:
-
model_type(Literal['cgrid', 'CGRID']) -
spectrum(SPECTRUM)
REGULAR
pydantic-model
¶
REGULAR(**data: Any)
Bases: CGRID
SWAN regular computational grid.
CGRID REGULAR [xpc] [ypc] [alpc] [xlenc] [ylenc] [mxc] [myc] &
->CIRCLE|SECTOR [mdc] [flow] [fhigh] [msc]
This is a group component that includes a CGRID and a READGRID component.
Note
In 1D-mode, alpc should be equal to the direction alpinp.
Examples:
from rompy_swan.components.cgrid import REGULAR
cgrid = REGULAR(
grid=dict(xp=0, yp=0, alp=0, xlen=2000, ylen=1300, mx=100, my=100),
spectrum=dict(mdc=36, flow=0.04, fhigh=1.0),
)
print(cgrid.render())
CGRID REGULAR xpc=0.0 ypc=0.0 alpc=0.0 xlenc=2000.0 ylenc=1300.0 mxc=100 myc=100 CIRCLE mdc=36 flow=0.04 fhigh=1.0
Fields:
-
spectrum(SPECTRUM) -
model_type(Literal['regular', 'REGULAR']) -
grid(GRIDREGULAR)
Validators:
CURVILINEAR
pydantic-model
¶
CURVILINEAR(**data: Any)
Bases: CGRID
SWAN curvilinear computational grid.
CGRID CURVILINEAR [mxc] [myc] (EXCEPTION [xexc] [yexc])
->CIRCLE|SECTOR [mdc] [flow] [fhigh] [msc]
READGRID COORDINATES [fac] 'fname' [idla] [nhedf] [nhedvec] &
FREE|FORMAT ('form'|[idfm])
This is a group component that includes a CGRID and a READGRID component.
Examples¶
from rompy_swan.components.cgrid import CURVILINEAR
cgrid = CURVILINEAR(
mxc=199,
myc=199,
readcoord=dict(fname="./coords.txt"),
spectrum=dict(mdc=36, flow=0.04, fhigh=1.0),
)
print(cgrid.render())
CGRID CURVILINEAR mxc=199 myc=199 CIRCLE mdc=36 flow=0.04 fhigh=1.0
READGRID COORDINATES fac=1.0 fname='./coords.txt' idla=1 nhedf=0 nhedvec=0 FREE
Fields:
-
spectrum(SPECTRUM) -
model_type(Literal['curvilinear', 'CURVILINEAR']) -
mxc(int) -
myc(int) -
xexc(Optional[float]) -
yexc(Optional[float]) -
readcoord(READCOORD)
Validators:
model_type
pydantic-field
¶
model_type: Literal["curvilinear", "CURVILINEAR"] = (
"curvilinear"
)
Model type discriminator
mxc
pydantic-field
¶
mxc: int
Number of meshes in computational grid in ξ-direction (this number is one less than the number of grid points in this domain).
myc
pydantic-field
¶
myc: int
Number of meshes in computational grid in η-direction (this number is one less than the number of grid points in this domain).
xexc
pydantic-field
¶
the value which the user uses to indicate that a grid point is to be ignored in the computations (this value is provided by the user at the location of the x-coordinate considered in the file of the x-coordinates, see command READGRID COOR).
yexc
pydantic-field
¶
the value which the user uses to indicate that a grid point is to be ignored in the computations (this value is provided by the user at the location of the y-coordinate considered in the file of the y-coordinates, see command READGRID COOR).
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: CGRID
SWAN unstructured computational grid.
CGRID UNSTRUCTURED CIRCLE|SECTOR [mdc] [flow] [fhigh] [msc]
READGRID UNSTRUCTURED [grid_type] ('fname')
This is a group component that includes a CGRID and a READGRID component.
Examples¶
from rompy_swan.components.cgrid import UNSTRUCTURED
cgrid = UNSTRUCTURED(
grid_type="adcirc",
spectrum=dict(mdc=36, flow=0.04, fhigh=1.0),
)
print(cgrid.render())
Fields:
-
spectrum(SPECTRUM) -
model_type(Literal['unstructured']) -
grid_type(Literal['adcirc', 'triangle', 'easymesh']) -
fname(Optional[str])
Validators:
model_type
pydantic-field
¶
model_type: Literal['unstructured'] = 'unstructured'
Model type discriminator
grid_type
pydantic-field
¶
grid_type: Literal["adcirc", "triangle", "easymesh"] = (
"adcirc"
)
Unstructured grid type
fname
pydantic-field
¶
Name of the file containing the unstructured grid
check_fname_required
pydantic-validator
¶
check_fname_required() -> UNSTRUCTURED
Check that fname needs to be provided.
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.