---
title: "Near-field profile under gaussian-beam illumination"
date: "`r format(Sys.time(), '%d %B, %Y')`"
author: "baptiste Auguié"
output:
  rmarkdown::html_vignette:
    toc: true
    toc_depth: 2
    fig_width: 7
    fig_height: 4
    fig_caption: true
vignette: >
  %\VignetteIndexEntry{gaussian beam}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

```{r demo, message=FALSE, echo=FALSE}
knitr::read_demo("gaussian_beam", package="planar")
```

Using the angular spectrum decomposition of a gaussian beam in a bundle of plane waves, the near-field profile is calculated on the transmitted side of a thin metal film illuminated under total internal reflection.

```{r load, echo=FALSE,results='hide'}
```

```{r setup, results='hide', echo=FALSE}
```

First, we model the structure with plane-wave illumination, and find the angle corresponding to maximum field enhancement (coupling to SPPs in the Kretschmann configuration).

```{r pw}
```

## Depth profile

```{r depth}
```

We observe that the field decays exponentially away from the gold/dielectric interface ($z>50$nm) with the same characteristic distance across the beam profile. The discontinuity at $z=100$nm occurs because of the transition between two dielectrics with slightly different refractive index (1.1 and 1.0, respectively).

## Coupling to SPPs

The detrimental effect of the beam size on the field enhancement can be quite dramatic, as soon as the spread of incident angles causes the coupling to SPPs to deteriorate. Here we simulate the LFIEF for silver, with a beam waist varying from 1mm down to 2 microns.

```{r waist}
```

## 2D map

We can calculate the field at a grid of points in 2D or 3D. Here is the result for a slice at $z=51$nm, for a beam waist of 2 microns (poor coupling).

```{r map}
```




