Field Operations¶
Field Interpolation¶
fdtdx.fdtd.curl.interpolate_fields(E_field, H_field)
¶
Interpolates E and H fields onto E_z in a FDTD grid with PEC boundary conditions.
Performs spatial interpolation of the electric and magnetic fields to align them onto the same grid points as E_z. This is necessary because E and H fields are naturally staggered in the Yee grid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
E_field
|
Array
|
4D tensor representing the electric field. Dimensions are (width, depth, height, direction). |
required |
H_field
|
Array
|
4D tensor representing the magnetic field. Dimensions are (width, depth, height, direction). |
required |
Returns:
Type | Description |
---|---|
tuple[Array, Array]
|
tuple[jax.Array, jax.Array]: A tuple (E_interp, H_interp) containing: - E_interp: Interpolated electric field as 4D tensor - H_interp: Interpolated magnetic field as 4D tensor |
Note
Uses PEC (Perfect Electric Conductor) boundary conditions where fields at boundaries are set to zero.
Source code in src/fdtdx/fdtd/curl.py
Curl Operations¶
fdtdx.fdtd.curl.curl_E(E)
¶
Transforms an E-type field into an H-type field by performing a curl operation.
Computes the discrete curl of the electric field to obtain the corresponding magnetic field components. The input E-field is defined on the edges of the Yee grid cells (integer grid points), while the output H-field is defined on the faces (half-integer grid points).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
E
|
Array
|
Electric field to take the curl of. A 4D tensor representing the E-type field located on the edges of the grid cell (integer gridpoints). Shape is (3, nx, ny, nz) for the 3 field components. |
required |
Returns:
Type | Description |
---|---|
Array
|
jax.Array: The curl of E - an H-type field located on the faces of the grid (half-integer grid points). Has same shape as input (3, nx, ny, nz). |
Note
Uses edge padding and roll operations to compute centered differences for the curl.
Source code in src/fdtdx/fdtd/curl.py
fdtdx.fdtd.curl.curl_H(H)
¶
Transforms an H-type field into an E-type field by performing a curl operation.
Computes the discrete curl of the magnetic field to obtain the corresponding electric field components. The input H-field is defined on the faces of the Yee grid cells (half-integer grid points), while the output E-field is defined on the edges (integer grid points).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
H
|
Array
|
Magnetic field to take the curl of. A 4D tensor representing the H-type field located on the faces of the grid (half-integer grid points). Shape is (3, nx, ny, nz) for the 3 field components. |
required |
Returns:
Type | Description |
---|---|
Array
|
jax.Array: The curl of H - an E-type field located on the edges of the grid (integer grid points). Has same shape as input (3, nx, ny, nz). |
Note
Uses edge padding and roll operations to compute centered differences for the curl. The operation is complementary to curl_E(), allowing field updates in both directions.