QPMS
Electromagnetic multiple scattering library and toolkit.
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
layersys.h File Reference

Planarly layered background media (M1 of the layered-media plan). More...

#include <stddef.h>
#include "qpms_types.h"
#include "materials.h"
Include dependency graph for layersys.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  qpms_layersys_t
 Layer system description (static part, frequency-independent). More...
 
struct  qpms_layersys_at_omega_t
 Frequency snapshot of a layer system. More...
 

Typedefs

typedef struct qpms_layersys_t qpms_layersys_t
 Layer system description (static part, frequency-independent).
 
typedef struct qpms_layersys_at_omega_t qpms_layersys_at_omega_t
 Frequency snapshot of a layer system.
 

Functions

qpms_layersys_t * qpms_layersys_create (size_t n, qpms_epsmu_generator_t **materials, const double *thicknesses)
 Create a layer system (copies the input arrays; the generators are borrowed).
 
void qpms_layersys_free (qpms_layersys_t *ls)
 Frees a layer system created by qpms_layersys_create() (not the generators).
 
size_t qpms_layersys_layer_number (const qpms_layersys_t *ls, double z)
 Index of the layer containing z; an interface selects the upper layer.
 
double qpms_layersys_lower_zlimit (const qpms_layersys_t *ls, size_t i)
 Lower z limit of layer i (−INFINITY for layer 0).
 
double qpms_layersys_upper_zlimit (const qpms_layersys_t *ls, size_t i)
 Upper z limit of layer i (+INFINITY for layer n−1).
 
double qpms_layersys_reference_z (const qpms_layersys_t *ls, size_t i)
 
qpms_errno_t qpms_layersys_op_layer_map (const qpms_layersys_t *ls, qpms_irot3_t rot, cart3_t t, double ztol, ptrdiff_t *layer_map)
 Image of the layer stack under an affine operation {rot | t}.
 
_Complex double qpms_layersys_kz (_Complex double kappa, _Complex double k)
 Out-of-plane wavenumber kz = sqrt(k² − κ²) with the branch Im kz ≥ 0.
 
qpms_layersys_at_omega_t * qpms_layersys_at_omega_create (const qpms_layersys_t *ls, double omega)
 Evaluate the layer materials at ω.
 
void qpms_layersys_at_omega_free (qpms_layersys_at_omega_t *lswo)
 
qpms_errno_t qpms_layersys_response_matrix (_Complex double *L, int pol, const qpms_layersys_at_omega_t *lswo, _Complex double kappa, size_t from, size_t to)
 Layer-system response matrix for one (polarisation, κ).
 
static _Complex double qpms_layersys_response_element (int pol, const qpms_layersys_at_omega_t *lswo, _Complex double kappa, size_t from, size_t to, int row, int col)
 

Detailed Description

Planarly layered background media (M1 of the layered-media plan).

Implements the scattering-matrix formalism for a stack of planar layers with (generally complex) refractive indices, in the same conventions as SMUTHI so that the layer-mediated coupling kernels of qpms/pwe.h apply directly: e^{−iωt}, spatial e^{ik·r}, loss = Im n > 0, kz branch Im kz ≥ 0, layers numbered 0..N−1 bottom-to-top with the first interface at z = 0 and semi-infinite bottom (layer 0) / top (layer N−1) half-spaces.

See ai_notes/07_layered_media.md (§2.2 and Appendix A).

Typedef Documentation

◆ qpms_layersys_t

Layer system description (static part, frequency-independent).

The layer materials are epsmu generators so that dispersive layers are supported; they are evaluated at ω by qpms_layersys_at_omega().

Function Documentation

◆ qpms_layersys_create()

qpms_layersys_t * qpms_layersys_create ( size_t  n,
qpms_epsmu_generator_t **  materials,
const double *  thicknesses 
)

Create a layer system (copies the input arrays; the generators are borrowed).

thicknesses may be NULL, in which case the first and last layers are taken as semi-infinite and the rest as zero-thickness if n == 2; explicit thickness arrays must have the first and last element equal to zero.

◆ qpms_layersys_kz()

_Complex double qpms_layersys_kz ( _Complex double  kappa,
_Complex double  k 
)

Out-of-plane wavenumber kz = sqrt(k² − κ²) with the branch Im kz ≥ 0.

Both k and kappa may be complex (κ is generally complex on the Sommerfeld contour, which dips below the real axis to avoid the branch points at the layer light lines κ = |k_i|).

◆ qpms_layersys_layer_number()

size_t qpms_layersys_layer_number ( const qpms_layersys_t *  ls,
double  z 
)

Index of the layer containing z; an interface selects the upper layer.

Layers are numbered 0 (bottom half-space) to n−1 (top half-space); the interface between layer i and i+1 is at z = Σ_{j≤i} thicknesses[j] (so the first interface is at z = 0). Points on an interface belong to the upper layer (same convention as SMUTHI layers.py:layer_number).

◆ qpms_layersys_op_layer_map()

qpms_errno_t qpms_layersys_op_layer_map ( const qpms_layersys_t *  ls,
qpms_irot3_t  rot,
cart3_t  t,
double  ztol,
ptrdiff_t *  layer_map 
)

Image of the layer stack under an affine operation {rot | t}.

The operation must be compatible with a stack of xy-invariant layers: the point part must map e_z onto ±e_z. For R e_z = +e_z the translation must carry no z component (t_z == 0 within ztol) and every layer maps onto itself. For R e_z = −e_z (horizontal mirror composed with a lateral operation) the stack must be mirror-symmetric about the plane z = t_z/2: every layer span must coincide with some (generally different) layer's span. On success (QPMS_SUCCESS) layer_map (if non-NULL, n entries) receives the index of the image layer of every layer; the caller is responsible for the material match along the map (geometry only here). Returns QPMS_ERROR if the operation does not map the stack onto itself.

◆ qpms_layersys_reference_z()

double qpms_layersys_reference_z ( const qpms_layersys_t *  ls,
size_t  i 
)

The "reference z" of layer i: the plane from which the coupling phases and the PWE/SWE reference points are measured (upper limit for layer 0, lower limit for the others; SMUTHI convention).

◆ qpms_layersys_response_element()

static _Complex double qpms_layersys_response_element ( int  pol,
const qpms_layersys_at_omega_t *  lswo,
_Complex double  kappa,
size_t  from,
size_t  to,
int  row,
int  col 
)
inlinestatic

Convenience: single response amplitude, e.g. the reflection coefficient of the downgoing excitation (L[0] + 1*L[3] element index 2·row+col). row, col ∈ {0,1}; see qpms_layersys_response_matrix().

◆ qpms_layersys_response_matrix()

qpms_errno_t qpms_layersys_response_matrix ( _Complex double *  L,
int  pol,
const qpms_layersys_at_omega_t *  lswo,
_Complex double  kappa,
size_t  from,
size_t  to 
)

Layer-system response matrix for one (polarisation, κ).

Writes a 2×2 matrix L (row-major, [upgoing, downgoing] × [upgoing, downgoing]) such that (up_response, down_response)ᵀ = L·(up_excitation, down_excitation)ᵀ for waves excited in layer from evaluated as they appear in layer to (both indices relative to the layer reference planes). TE = 0, TM = 1.