Computational grid
SWAN computational grid commands
REGULAR
Bases: CGRID
SWAN regular computational grid.
.. code-block:: text
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
.. ipython:: python :okwarning:
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())
Source code in rompy_swan/components/cgrid.py
Attributes
model_type
class-attribute
instance-attribute
model_type: Literal['regular', 'REGULAR'] = Field(default='regular', description='Model type discriminator')
grid
class-attribute
instance-attribute
grid: GRIDREGULAR = Field(description='Computational grid definition')
Functions
CURVILINEAR
Bases: CGRID
SWAN curvilinear computational grid.
.. code-block:: text
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
.. ipython:: python :okwarning:
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())
Source code in rompy_swan/components/cgrid.py
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 | |
Attributes
model_type
class-attribute
instance-attribute
model_type: Literal['curvilinear', 'CURVILINEAR'] = Field(default='curvilinear', description='Model type discriminator')
mxc
class-attribute
instance-attribute
mxc: int = Field(description='Number of meshes in computational grid in ξ-direction (this number is one less than the number of grid points in this domain).')
myc
class-attribute
instance-attribute
myc: int = Field(description='Number of meshes in computational grid in η-direction (this number is one less than the number of grid points in this domain).')
xexc
class-attribute
instance-attribute
xexc: Optional[float] = Field(default=None, description='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
class-attribute
instance-attribute
yexc: Optional[float] = Field(default=None, description='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).')
readcoord
class-attribute
instance-attribute
readcoord: READCOORD = Field(description='Grid coordinates reader.')
Functions
xexc_and_yexc_or_neither
xexc_and_yexc_or_neither() -> CURVILINEAR
cmd
UNSTRUCTURED
Bases: CGRID
SWAN unstructured computational grid.
.. code-block:: text
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
.. ipython:: python :okwarning:
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())
Source code in rompy_swan/components/cgrid.py
Attributes
model_type
class-attribute
instance-attribute
model_type: Literal['unstructured'] = Field(default='unstructured', description='Model type discriminator')
grid_type
class-attribute
instance-attribute
grid_type: Literal['adcirc', 'triangle', 'easymesh'] = Field(default='adcirc', description='Unstructured grid type')
fname
class-attribute
instance-attribute
fname: Optional[str] = Field(default=None, description='Name of the file containing the unstructured grid', max_length=36)
Functions
check_fname_required
check_fname_required() -> UNSTRUCTURED
Check that fname needs to be provided.