3. functional
torchfsm.functional.biharmonic
¤
biharmonic(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the biharmonic operator.
For details, see torchfsm.operator.Biharmonic
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the biharmonic operator to the input field. |
Source code in torchfsm/functional.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
torchfsm.functional.conservative_convection
¤
conservative_convection(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the conservative convection operator.
For details, see torchfsm.operator.ConservativeConvection
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the conservative convection operator to the input field. |
Source code in torchfsm/functional.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
torchfsm.functional.convection
¤
convection(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the convection operator.
For details, see torchfsm.operator.Convection
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the convection operator to the input field. |
Source code in torchfsm/functional.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
torchfsm.functional.curl
¤
curl(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the curl operator.
For details, see torchfsm.operator.Curl
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the curl operator to the input field. |
Source code in torchfsm/functional.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
torchfsm.functional.div
¤
div(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the divergence operator.
For details, see torchfsm.operator.Div
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the divergence operator to the input field. |
Source code in torchfsm/functional.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
torchfsm.functional.dispersion
¤
dispersion(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the dispersion operator.
For details, see torchfsm.operator.Dispersion
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the dispersion operator to the input field. |
Source code in torchfsm/functional.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
torchfsm.functional.grad
¤
grad(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the gradient operator.
For details, see torchfsm.operator.Grad
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the gradient operator to the input field. |
Source code in torchfsm/functional.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
torchfsm.functional.hyper_diffusion
¤
hyper_diffusion(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the hyper diffusion operator.
For details, see torchfsm.operator.HyperDiffusion
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the hyper diffusion operator to the input field. |
Source code in torchfsm/functional.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
torchfsm.functional.laplacian
¤
laplacian(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the Laplacian operator.
For details, see torchfsm.operator.Laplacian
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the Laplacian operator to the input field. |
Source code in torchfsm/functional.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
torchfsm.functional.spatial_derivative
¤
spatial_derivative(
dim_index: int,
order: int,
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the spatial derivative operator.
For details, see torchfsm.operator.SpatialDerivative
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dim_index
|
int
|
The index of the dimension to take the derivative along. |
required |
order
|
int
|
The order of the derivative. |
required |
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the spatial derivative operator to the input field. |
Source code in torchfsm/functional.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
torchfsm.functional.ks_convection
¤
ks_convection(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
remove_mean: bool = True,
) -> SpatialTensor["B C H ..."]
Function form for the Kuramoto-Sivashinsky convection operator.
For details, see torchfsm.operator.KSConvection
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
remove_mean
|
bool
|
If True, the mean of the input field will be removed before applying the operator. |
True
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the Kuramoto-Sivashinsky convection operator to the input field. |
Source code in torchfsm/functional.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
torchfsm.functional.vorticity_convection
¤
vorticity_convection(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the vorticity convection operator.
For details, see torchfsm.operator.VorticityConvection
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the vorticity convection operator to the input field. |
Source code in torchfsm/functional.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
|
torchfsm.functional.vorticity2velocity
¤
vorticity2velocity(
vorticity: Optional[Tensor] = None,
vorticity_fft: Optional[Tensor] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the vorticity to velocity operator.
For details, see torchfsm.operator.Vorticity2Velocity
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vorticity
|
Optional[Tensor]
|
The input vorticity field. |
None
|
vorticity_fft
|
Optional[Tensor]
|
The Fourier-transformed vorticity field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the vorticity to velocity operator to the input field. |
Source code in torchfsm/functional.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
torchfsm.functional.vorticity2pressure
¤
vorticity2pressure(
vorticity: Optional[Tensor] = None,
vorticity_fft: Optional[Tensor] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
external_force: Optional[OperatorLike] = None,
) -> SpatialTensor["B C H ..."]
Function form for the vorticity to pressure operator.
For details, see torchfsm.operator.Vorticity2Pressure
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vorticity
|
Optional[Tensor]
|
The input vorticity field. |
None
|
vorticity_fft
|
Optional[Tensor]
|
The Fourier-transformed vorticity field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
external_force
|
Optional[OperatorLike]
|
An optional external force to be applied. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the vorticity to pressure operator to the input field. |
Source code in torchfsm/functional.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
|
torchfsm.functional.velocity2pressure
¤
velocity2pressure(
velocity: Optional[Tensor] = None,
velocity_fft: Optional[Tensor] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
external_force: Optional[OperatorLike] = None,
) -> SpatialTensor["B C H ..."]
Function form for the velocity to pressure operator.
For details, see torchfsm.operator.Velocity2Pressure
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
velocity
|
Optional[Tensor]
|
The input velocity field. |
None
|
velocity_fft
|
Optional[Tensor]
|
The Fourier-transformed velocity field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
external_force
|
Optional[OperatorLike]
|
An optional external force to be applied. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the velocity to pressure operator to the input field. |
Source code in torchfsm/functional.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
|
torchfsm.functional.leray
¤
leray(
u: Optional[SpatialTensor["B C H ..."]] = None,
u_fft: Optional[FourierTensor["B C H ..."]] = None,
mesh: Optional[
Union[
Sequence[tuple[float, float, int]],
MeshGrid,
FourierMesh,
]
] = None,
) -> SpatialTensor["B C H ..."]
Function form for the Leray operator.
For details, see torchfsm.operator.Leray
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Optional[SpatialTensor['B C H ...']]
|
The input field. |
None
|
u_fft
|
Optional[FourierTensor['B C H ...']]
|
The Fourier-transformed input field. |
None
|
mesh
|
Optional[Union[Sequence[tuple[float, float, int]], MeshGrid, FourierMesh]]
|
The mesh for the field. |
None
|
Returns:
Type | Description |
---|---|
SpatialTensor['B C H ...']
|
SpatialTensor["B C H ..."]: The result of applying the Leray operator to the input field. |
Source code in torchfsm/functional.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|