meanas/api/fdtd/index.html
2026-04-20 17:38:01 -07:00

4293 lines
No EOL
166 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Electromagnetic simulation tools">
<link rel="canonical" href="https://mpxd.net/docs/meanas/api/fdtd/">
<link rel="prev" href="../waveguides/">
<link rel="next" href="../fdmath/">
<link rel="icon" href="../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.6">
<title>fdtd - meanas</title>
<link rel="stylesheet" href="../../assets/stylesheets/main.484c7ddc.min.css">
<link rel="stylesheet" href="../../assets/stylesheets/palette.ab4e12ef.min.css">
<link rel="stylesheet" href="../../css/print-site.css">
<link rel="stylesheet" href="../../css/print-site-material.css">
<link rel="stylesheet" href="../../assets/_mkdocstrings.css">
<link rel="stylesheet" href="../../stylesheets/extra.css">
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="slate" data-md-color-primary="blue-grey" data-md-color-accent="cyan">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#fdtd" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="../.." title="meanas" class="md-header__button md-logo" aria-label="meanas" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
meanas
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
fdtd
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="blue-grey" data-md-color-accent="cyan" aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_0">
<label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 7a5 5 0 0 1 5 5 5 5 0 0 1-5 5 5 5 0 0 1-5-5 5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0-7 2.39 3.42C13.65 5.15 12.84 5 12 5s-1.65.15-2.39.42zM3.34 7l4.16-.35A7.2 7.2 0 0 0 5.94 8.5c-.44.74-.69 1.5-.83 2.29zm.02 10 1.76-3.77a7.131 7.131 0 0 0 2.38 4.14zM20.65 7l-1.77 3.79a7.02 7.02 0 0 0-2.38-4.15zm-.01 10-4.14.36c.59-.51 1.12-1.14 1.54-1.86.42-.73.69-1.5.83-2.29zM12 22l-2.41-3.44c.74.27 1.55.44 2.41.44.82 0 1.63-.17 2.37-.44z"/></svg>
</label>
<input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="teal" data-md-color-accent="indigo" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_1">
<label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_0" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m17.75 4.09-2.53 1.94.91 3.06-2.63-1.81-2.63 1.81.91-3.06-2.53-1.94L12.44 4l1.06-3 1.06 3zm3.5 6.91-1.64 1.25.59 1.98-1.7-1.17-1.7 1.17.59-1.98L15.75 11l2.06-.05L18.5 9l.69 1.95zm-2.28 4.95c.83-.08 1.72 1.1 1.19 1.85-.32.45-.66.87-1.08 1.27C15.17 23 8.84 23 4.94 19.07c-3.91-3.9-3.91-10.24 0-14.14.4-.4.82-.76 1.27-1.08.75-.53 1.93.36 1.85 1.19-.27 2.86.69 5.83 2.89 8.02a9.96 9.96 0 0 0 8.02 2.89m-1.64 2.02a12.08 12.08 0 0 1-7.8-3.47c-2.17-2.19-3.33-5-3.49-7.82-2.81 3.14-2.7 7.96.31 10.98 3.02 3.01 7.84 3.12 10.98.31"/></svg>
</label>
</form>
<script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://mpxd.net/code/jan/meanas" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--><path d="M439.6 236.1 244 40.5c-5.4-5.5-12.8-8.5-20.4-8.5s-15 3-20.4 8.4L162.5 81l51.5 51.5c27.1-9.1 52.7 16.8 43.4 43.7l49.7 49.7c34.2-11.8 61.2 31 35.5 56.7-26.5 26.5-70.2-2.9-56-37.3L240.3 199v121.9c25.3 12.5 22.3 41.8 9.1 55-6.4 6.4-15.2 10.1-24.3 10.1s-17.8-3.6-24.3-10.1c-17.6-17.6-11.1-46.9 11.2-56v-123c-20.8-8.5-24.6-30.7-18.6-45L142.6 101 8.5 235.1C3 240.6 0 247.9 0 255.5s3 15 8.5 20.4l195.6 195.7c5.4 5.4 12.7 8.4 20.4 8.4s15-3 20.4-8.4l194.7-194.7c5.4-5.4 8.4-12.8 8.4-20.4s-3-15-8.4-20.4"/></svg>
</div>
<div class="md-source__repository">
meanas
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../.." title="meanas" class="md-nav__button md-logo" aria-label="meanas" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
meanas
</label>
<div class="md-nav__source">
<a href="https://mpxd.net/code/jan/meanas" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--><path d="M439.6 236.1 244 40.5c-5.4-5.5-12.8-8.5-20.4-8.5s-15 3-20.4 8.4L162.5 81l51.5 51.5c27.1-9.1 52.7 16.8 43.4 43.7l49.7 49.7c34.2-11.8 61.2 31 35.5 56.7-26.5 26.5-70.2-2.9-56-37.3L240.3 199v121.9c25.3 12.5 22.3 41.8 9.1 55-6.4 6.4-15.2 10.1-24.3 10.1s-17.8-3.6-24.3-10.1c-17.6-17.6-11.1-46.9 11.2-56v-123c-20.8-8.5-24.6-30.7-18.6-45L142.6 101 8.5 235.1C3 240.6 0 247.9 0 255.5s3 15 8.5 20.4l195.6 195.7c5.4 5.4 12.7 8.4 20.4 8.4s15-3 20.4-8.4l194.7-194.7c5.4-5.4 8.4-12.8 8.4-20.4s-3-15-8.4-20.4"/></svg>
</div>
<div class="md-source__repository">
meanas
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../.." class="md-nav__link">
<span class="md-ellipsis">
Home
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_2" checked>
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<span class="md-ellipsis">
API
</span>
</a>
<label class="md-nav__link " for="__nav_2" id="__nav_2_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_2_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_2">
<span class="md-nav__icon md-icon"></span>
API
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../meanas/" class="md-nav__link">
<span class="md-ellipsis">
meanas
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../eigensolvers/" class="md-nav__link">
<span class="md-ellipsis">
eigensolvers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../fdfd/" class="md-nav__link">
<span class="md-ellipsis">
fdfd
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../waveguides/" class="md-nav__link">
<span class="md-ellipsis">
waveguides
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
fdtd
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
fdtd
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#meanas.fdtd" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;fdtd
</span>
</a>
<nav class="md-nav" aria-label=" fdtd">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd--timestep" class="md-nav__link">
<span class="md-ellipsis">
Timestep
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd--poynting-vector-and-energy-conservation" class="md-nav__link">
<span class="md-ellipsis">
Poynting Vector and Energy Conservation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd--sources" class="md-nav__link">
<span class="md-ellipsis">
Sources
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd--boundary-conditions" class="md-nav__link">
<span class="md-ellipsis">
Boundary conditions
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core-update-and-analysis-helpers" class="md-nav__link">
<span class="md-ellipsis">
Core update and analysis helpers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.base" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;base
</span>
</a>
<nav class="md-nav" aria-label=" base">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.base.maxwell_e" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;maxwell_e
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.base.maxwell_h" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;maxwell_h
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.pml" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;pml
</span>
</a>
<nav class="md-nav" aria-label=" pml">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.pml.cpml_params" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;cpml_params
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.pml.updates_with_cpml" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;updates_with_cpml
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.boundaries" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;boundaries
</span>
</a>
<nav class="md-nav" aria-label=" boundaries">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.boundaries--todo-conducting-boundary-documentation" class="md-nav__link">
<span class="md-ellipsis">
TODO conducting boundary documentation
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;energy
</span>
</a>
<nav class="md-nav" aria-label=" energy">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.poynting" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;poynting
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.poynting_divergence" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;poynting_divergence
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.energy_hstep" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;energy_hstep
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.energy_estep" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;energy_estep
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.delta_energy_h2e" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;delta_energy_h2e
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.delta_energy_e2h" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;delta_energy_e2h
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.delta_energy_j" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;delta_energy_j
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.dxmul" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;dxmul
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;phasor
</span>
</a>
<nav class="md-nav" aria-label=" phasor">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.accumulate_phasor" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;accumulate_phasor
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.temporal_phasor" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;temporal_phasor
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.temporal_phasor_scale" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;temporal_phasor_scale
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.real_injection_scale" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;real_injection_scale
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.reconstruct_real" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;reconstruct_real
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.accumulate_phasor_e" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;accumulate_phasor_e
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.accumulate_phasor_h" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;accumulate_phasor_h
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.accumulate_phasor_j" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;accumulate_phasor_j
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.reconstruct_real_e" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;reconstruct_real_e
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.reconstruct_real_h" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;reconstruct_real_h
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.reconstruct_real_j" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;reconstruct_real_j
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../fdmath/" class="md-nav__link">
<span class="md-ellipsis">
fdmath
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#meanas.fdtd" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;fdtd
</span>
</a>
<nav class="md-nav" aria-label=" fdtd">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd--timestep" class="md-nav__link">
<span class="md-ellipsis">
Timestep
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd--poynting-vector-and-energy-conservation" class="md-nav__link">
<span class="md-ellipsis">
Poynting Vector and Energy Conservation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd--sources" class="md-nav__link">
<span class="md-ellipsis">
Sources
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd--boundary-conditions" class="md-nav__link">
<span class="md-ellipsis">
Boundary conditions
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core-update-and-analysis-helpers" class="md-nav__link">
<span class="md-ellipsis">
Core update and analysis helpers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.base" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;base
</span>
</a>
<nav class="md-nav" aria-label=" base">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.base.maxwell_e" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;maxwell_e
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.base.maxwell_h" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;maxwell_h
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.pml" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;pml
</span>
</a>
<nav class="md-nav" aria-label=" pml">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.pml.cpml_params" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;cpml_params
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.pml.updates_with_cpml" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;updates_with_cpml
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.boundaries" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;boundaries
</span>
</a>
<nav class="md-nav" aria-label=" boundaries">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.boundaries--todo-conducting-boundary-documentation" class="md-nav__link">
<span class="md-ellipsis">
TODO conducting boundary documentation
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;energy
</span>
</a>
<nav class="md-nav" aria-label=" energy">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.poynting" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;poynting
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.poynting_divergence" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;poynting_divergence
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.energy_hstep" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;energy_hstep
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.energy_estep" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;energy_estep
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.delta_energy_h2e" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;delta_energy_h2e
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.delta_energy_e2h" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;delta_energy_e2h
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.delta_energy_j" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;delta_energy_j
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.energy.dxmul" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;dxmul
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;phasor
</span>
</a>
<nav class="md-nav" aria-label=" phasor">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.accumulate_phasor" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;accumulate_phasor
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.temporal_phasor" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;temporal_phasor
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.temporal_phasor_scale" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;temporal_phasor_scale
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.real_injection_scale" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;real_injection_scale
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.reconstruct_real" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;reconstruct_real
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.accumulate_phasor_e" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;accumulate_phasor_e
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.accumulate_phasor_h" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;accumulate_phasor_h
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.accumulate_phasor_j" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;accumulate_phasor_j
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.reconstruct_real_e" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;reconstruct_real_e
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.reconstruct_real_h" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;reconstruct_real_h
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdtd.phasor.reconstruct_real_j" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;reconstruct_real_j
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="fdtd">fdtd<a class="headerlink" href="#fdtd" title="Permanent link">&para;</a></h1>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdtd" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">meanas.fdtd</span>
<a href="#meanas.fdtd" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Utilities for running finite-difference time-domain (FDTD) simulations</p>
<p>See the discussion of <code>Maxwell's Equations</code> in <code>meanas.fdmath</code> for basic
mathematical background.</p>
<h3 id="meanas.fdtd--timestep">Timestep<a class="headerlink" href="#meanas.fdtd--timestep" title="Permanent link">&para;</a></h3>
<p>From the discussion of "Plane waves and the Dispersion relation" in <code>meanas.fdmath</code>,
we have</p>
<div class="arithmatex">\[ c^2 \Delta_t^2 = \frac{\Delta_t^2}{\mu \epsilon} < 1/(\frac{1}{\Delta_x^2} + \frac{1}{\Delta_y^2} + \frac{1}{\Delta_z^2}) \]</div>
<p>or, if <span class="arithmatex">\(\Delta_x = \Delta_y = \Delta_z\)</span>, then <span class="arithmatex">\(c \Delta_t &lt; \frac{\Delta_x}{\sqrt{3}}\)</span>.</p>
<p>Based on this, we can set</p>
<div class="highlight"><pre><span></span><code>dt = sqrt(mu.min() * epsilon.min()) / sqrt(1/dx_min**2 + 1/dy_min**2 + 1/dz_min**2)
</code></pre></div>
<p>The <code>dx_min</code>, <code>dy_min</code>, <code>dz_min</code> should be the minimum value across both the base and derived grids.</p>
<h3 id="meanas.fdtd--poynting-vector-and-energy-conservation">Poynting Vector and Energy Conservation<a class="headerlink" href="#meanas.fdtd--poynting-vector-and-energy-conservation" title="Permanent link">&para;</a></h3>
<p>Let</p>
<div class="arithmatex">\[
\begin{aligned}
\tilde{S}_{l, l', \vec{r}} &=& &\tilde{E}_{l, \vec{r}} \otimes \hat{H}_{l', \vec{r} + \frac{1}{2}} \\
&=& &\vec{x} (\tilde{E}^y_{l,m+1,n,p} \hat{H}^z_{l',\vec{r} + \frac{1}{2}} - \tilde{E}^z_{l,m+1,n,p} \hat{H}^y_{l', \vec{r} + \frac{1}{2}}) \\
& &+ &\vec{y} (\tilde{E}^z_{l,m,n+1,p} \hat{H}^x_{l',\vec{r} + \frac{1}{2}} - \tilde{E}^x_{l,m,n+1,p} \hat{H}^z_{l', \vec{r} + \frac{1}{2}}) \\
& &+ &\vec{z} (\tilde{E}^x_{l,m,n,p+1} \hat{H}^y_{l',\vec{r} + \frac{1}{2}} - \tilde{E}^y_{l,m,n,p+1} \hat{H}^z_{l', \vec{r} + \frac{1}{2}})
\end{aligned}
\]</div>
<p>where <span class="arithmatex">\(\vec{r} = (m, n, p)\)</span> and <span class="arithmatex">\(\otimes\)</span> is a modified cross product
in which the <span class="arithmatex">\(\tilde{E}\)</span> terms are shifted as indicated.</p>
<p>By taking the divergence and rearranging terms, we can show that</p>
<div class="arithmatex">\[
\begin{aligned}
\hat{\nabla} \cdot \tilde{S}_{l, l', \vec{r}}
&= \hat{\nabla} \cdot (\tilde{E}_{l, \vec{r}} \otimes \hat{H}_{l', \vec{r} + \frac{1}{2}}) \\
&= \hat{H}_{l', \vec{r} + \frac{1}{2}} \cdot \tilde{\nabla} \times \tilde{E}_{l, \vec{r}} -
\tilde{E}_{l, \vec{r}} \cdot \hat{\nabla} \times \hat{H}_{l', \vec{r} + \frac{1}{2}} \\
&= \hat{H}_{l', \vec{r} + \frac{1}{2}} \cdot
(-\tilde{\partial}_t \mu_{\vec{r} + \frac{1}{2}} \hat{H}_{l - \frac{1}{2}, \vec{r} + \frac{1}{2}} -
\hat{M}_{l, \vec{r} + \frac{1}{2}}) -
\tilde{E}_{l, \vec{r}} \cdot (\hat{\partial}_t \tilde{\epsilon}_{\vec{r}} \tilde{E}_{l'+\frac{1}{2}, \vec{r}} +
\tilde{J}_{l', \vec{r}}) \\
&= \hat{H}_{l'} \cdot (-\mu / \Delta_t)(\hat{H}_{l + \frac{1}{2}} - \hat{H}_{l - \frac{1}{2}}) -
\tilde{E}_l \cdot (\epsilon / \Delta_t )(\tilde{E}_{l'+\frac{1}{2}} - \tilde{E}_{l'-\frac{1}{2}})
- \hat{H}_{l'} \cdot \hat{M}_{l} - \tilde{E}_l \cdot \tilde{J}_{l'} \\
\end{aligned}
\]</div>
<p>where in the last line the spatial subscripts have been dropped to emphasize
the time subscripts <span class="arithmatex">\(l, l'\)</span>, i.e.</p>
<div class="arithmatex">\[
\begin{aligned}
\tilde{E}_l &= \tilde{E}_{l, \vec{r}} \\
\hat{H}_l &= \tilde{H}_{l, \vec{r} + \frac{1}{2}} \\
\tilde{\epsilon} &= \tilde{\epsilon}_{\vec{r}} \\
\end{aligned}
\]</div>
<p>etc.
For <span class="arithmatex">\(l' = l + \frac{1}{2}\)</span> we get</p>
<div class="arithmatex">\[
\begin{aligned}
\hat{\nabla} \cdot \tilde{S}_{l, l + \frac{1}{2}}
&= \hat{H}_{l + \frac{1}{2}} \cdot
(-\mu / \Delta_t)(\hat{H}_{l + \frac{1}{2}} - \hat{H}_{l - \frac{1}{2}}) -
\tilde{E}_l \cdot (\epsilon / \Delta_t)(\tilde{E}_{l+1} - \tilde{E}_l)
- \hat{H}_{l'} \cdot \hat{M}_l - \tilde{E}_l \cdot \tilde{J}_{l + \frac{1}{2}} \\
&= (-\mu / \Delta_t)(\hat{H}^2_{l + \frac{1}{2}} - \hat{H}_{l + \frac{1}{2}} \cdot \hat{H}_{l - \frac{1}{2}}) -
(\epsilon / \Delta_t)(\tilde{E}_{l+1} \cdot \tilde{E}_l - \tilde{E}^2_l)
- \hat{H}_{l'} \cdot \hat{M}_l - \tilde{E}_l \cdot \tilde{J}_{l + \frac{1}{2}} \\
&= -(\mu \hat{H}^2_{l + \frac{1}{2}}
+\epsilon \tilde{E}_{l+1} \cdot \tilde{E}_l) / \Delta_t \\
+(\mu \hat{H}_{l + \frac{1}{2}} \cdot \hat{H}_{l - \frac{1}{2}}
+\epsilon \tilde{E}^2_l) / \Delta_t \\
- \hat{H}_{l+\frac{1}{2}} \cdot \hat{M}_l \\
- \tilde{E}_l \cdot \tilde{J}_{l+\frac{1}{2}} \\
\end{aligned}
\]</div>
<p>and for <span class="arithmatex">\(l' = l - \frac{1}{2}\)</span>,</p>
<div class="arithmatex">\[
\begin{aligned}
\hat{\nabla} \cdot \tilde{S}_{l, l - \frac{1}{2}}
&= (\mu \hat{H}^2_{l - \frac{1}{2}}
+\epsilon \tilde{E}_{l-1} \cdot \tilde{E}_l) / \Delta_t \\
-(\mu \hat{H}_{l + \frac{1}{2}} \cdot \hat{H}_{l - \frac{1}{2}}
+\epsilon \tilde{E}^2_l) / \Delta_t \\
- \hat{H}_{l-\frac{1}{2}} \cdot \hat{M}_l \\
- \tilde{E}_l \cdot \tilde{J}_{l-\frac{1}{2}} \\
\end{aligned}
\]</div>
<p>These two results form the discrete time-domain analogue to Poynting's theorem.
They hint at the expressions for the energy, which can be calculated at the same
time-index as either the E or H field:</p>
<div class="arithmatex">\[
\begin{aligned}
U_l &= \epsilon \tilde{E}^2_l + \mu \hat{H}_{l + \frac{1}{2}} \cdot \hat{H}_{l - \frac{1}{2}} \\
U_{l + \frac{1}{2}} &= \epsilon \tilde{E}_l \cdot \tilde{E}_{l + 1} + \mu \hat{H}^2_{l + \frac{1}{2}} \\
\end{aligned}
\]</div>
<p>Rewriting the Poynting theorem in terms of the energy expressions,</p>
<div class="arithmatex">\[
\begin{aligned}
(U_{l+\frac{1}{2}} - U_l) / \Delta_t
&= -\hat{\nabla} \cdot \tilde{S}_{l, l + \frac{1}{2}} \\
- \hat{H}_{l+\frac{1}{2}} \cdot \hat{M}_l \\
- \tilde{E}_l \cdot \tilde{J}_{l+\frac{1}{2}} \\
(U_l - U_{l-\frac{1}{2}}) / \Delta_t
&= -\hat{\nabla} \cdot \tilde{S}_{l, l - \frac{1}{2}} \\
- \hat{H}_{l-\frac{1}{2}} \cdot \hat{M}_l \\
- \tilde{E}_l \cdot \tilde{J}_{l-\frac{1}{2}} \\
\end{aligned}
\]</div>
<p>This result is exact and should practically hold to within numerical precision. No time-
or spatial-averaging is necessary.</p>
<p>Note that each value of <span class="arithmatex">\(J\)</span> contributes to the energy twice (i.e. once per field update)
despite only causing the value of <span class="arithmatex">\(E\)</span> to change once (same for <span class="arithmatex">\(M\)</span> and <span class="arithmatex">\(H\)</span>).</p>
<h3 id="meanas.fdtd--sources">Sources<a class="headerlink" href="#meanas.fdtd--sources" title="Permanent link">&para;</a></h3>
<p>It is often useful to excite the simulation with an arbitrary broadband pulse and then
extract the frequency-domain response by performing an on-the-fly Fourier transform
of the time-domain fields.</p>
<p><code>accumulate_phasor</code> in <code>meanas.fdtd.phasor</code> performs the phase accumulation for one
or more target frequencies, while leaving source normalization and simulation-loop
policy to the caller. <code>temporal_phasor(...)</code> and <code>temporal_phasor_scale(...)</code>
apply the same Fourier sum to a scalar waveform, which is useful when a pulsed
source envelope must be normalized before being applied to a point source or
mode source. <code>real_injection_scale(...)</code> is the corresponding helper for the
common real-valued injection pattern <code>numpy.real(scale * waveform)</code>. Convenience
wrappers <code>accumulate_phasor_e</code>, <code>accumulate_phasor_h</code>, and <code>accumulate_phasor_j</code>
apply the usual Yee time offsets. <code>reconstruct_real(...)</code> and the corresponding
<code>reconstruct_real_e/h/j(...)</code> wrappers perform the inverse operation, converting
phasors back into real-valued field snapshots at explicit Yee-aligned times.
For scalar <code>omega</code>, the reconstruction helpers accept either a plain field
phasor or the batched <code>(1, *sample_shape)</code> form used by the accumulator helpers.
The helpers accumulate</p>
<div class="arithmatex">\[ \Delta_t \sum_l w_l e^{-i \omega t_l} f_l \]</div>
<p>with caller-provided sample times and weights. In this codebase the matching
electric-current convention is typically <code>E -= dt * J / epsilon</code> in FDTD and
<code>-i \omega J</code> on the right-hand side of the FDFD wave equation.</p>
<p>For FDTD/FDFD equivalence, this phasor path is the primary comparison workflow.
It isolates the guided <code>+\omega</code> response that the frequency-domain solver
targets directly, regardless of whether the underlying FDTD run used real- or
complex-valued fields.</p>
<p>For exact pulsed FDTD/FDFD equivalence it is often simplest to keep the
injected source, fields, and CPML auxiliary state complex-valued. The
<code>real_injection_scale(...)</code> helper is instead for the more ordinary one-run
real-valued source path, where the intended positive-frequency waveform is
injected through <code>numpy.real(scale * waveform)</code> and any remaining negative-
frequency leakage is controlled by the pulse bandwidth and run length.</p>
<p><code>reconstruct_real(...)</code> is for a different question: given a phasor, what late
real-valued field snapshot should it produce? That raw-snapshot comparison is
stricter and noisier because a monitor plane generally contains both the guided
field and the remaining orthogonal content,</p>
<div class="arithmatex">\[ E_{\text{monitor}} = E_{\text{guided}} + E_{\text{residual}} . \]</div>
<p>Phasor/modal comparisons mostly validate the guided <code>+\omega</code> term. Raw
real-field comparisons expose both terms at once, so they should be treated as
secondary diagnostics rather than the main solver-equivalence benchmark.</p>
<p>The Ricker wavelet (normalized second derivative of a Gaussian) is commonly used for the pulse
shape. It can be written</p>
<div class="arithmatex">\[ f_r(t) = (1 - \frac{1}{2} (\omega (t - \tau))^2) e^{-(\frac{\omega (t - \tau)}{2})^2} \]</div>
<p>with <span class="arithmatex">\(\tau &gt; \frac{2 * \pi}{\omega}\)</span> as a minimum delay to avoid a discontinuity at
t=0 (assuming the source is off for t&lt;0 this gives <span class="arithmatex">\(\sim 10^{-3}\)</span> error at t=0).</p>
<h3 id="meanas.fdtd--boundary-conditions">Boundary conditions<a class="headerlink" href="#meanas.fdtd--boundary-conditions" title="Permanent link">&para;</a></h3>
<p><code>meanas.fdtd</code> exposes two boundary-related building blocks:</p>
<ul>
<li><code>conducting_boundary(...)</code> for simple perfect-electric-conductor style field
clamping at one face of the domain.</li>
<li><code>cpml_params(...)</code> and <code>updates_with_cpml(...)</code> for convolutional perfectly
matched layers (CPMLs) attached to one or more faces of the Yee grid.</li>
</ul>
<p><code>updates_with_cpml(...)</code> accepts a three-by-two table of CPML parameter blocks:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>cpml_params[axis][polarity_index]
</code></pre></div>
<p>where <code>axis</code> is <code>0</code>, <code>1</code>, or <code>2</code> and <code>polarity_index</code> corresponds to <code>(-1, +1)</code>.
Passing <code>None</code> for one entry disables CPML on that face while leaving the other
directions unchanged. This is how mixed boundary setups such as "absorbing in x,
periodic in y/z" are expressed.</p>
<p>When comparing an FDTD run against an FDFD solve, use the same stretched
coordinate system in both places:</p>
<ol>
<li>Build the FDTD update with the desired CPML parameters.</li>
<li>Stretch the FDFD <code>dxes</code> with the matching SCPML transform.</li>
<li>Compare the extracted phasor against the FDFD field or residual on those
stretched <code>dxes</code>.</li>
</ol>
<p>The electric-current sign convention used throughout the examples and tests is</p>
<div class="arithmatex">\[
E \leftarrow E - \Delta_t J / \epsilon
\]</div>
<p>which matches the FDFD right-hand side</p>
<div class="arithmatex">\[
-i \omega J.
\]</div>
<div class="doc doc-children">
</div>
</div>
</div><h2 id="core-update-and-analysis-helpers">Core update and analysis helpers<a class="headerlink" href="#core-update-and-analysis-helpers" title="Permanent link">&para;</a></h2>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdtd.base" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">meanas.fdtd.base</span>
<a href="#meanas.fdtd.base" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Basic FDTD field updates</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.base.maxwell_e" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">maxwell_e</span>
<a href="#meanas.fdtd.base.maxwell_e" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">maxwell_e</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_updater_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Build a function which performs a portion the time-domain E-field update,</p>
<div class="highlight"><pre><span></span><code>E += curl_back(H[t]) / epsilon
</code></pre></div>
<p>The full update should be</p>
<div class="highlight"><pre><span></span><code>E += (curl_back(H[t]) + J) / epsilon
</code></pre></div>
<p>which requires an additional step of <code>E += J / epsilon</code> which is not performed
by the generated function.</p>
<p>See <code>meanas.fdmath</code> for descriptions of</p>
<ul>
<li>This update step: "Maxwell's equations" section</li>
<li><code>dxes</code>: "Datastructure: dx_lists_t" section</li>
<li><code>epsilon</code>: "Permittivity and Permeability" section</li>
</ul>
<p>Also see the "Timestep" section of <code>meanas.fdtd</code> for a discussion of
the <code>dt</code> parameter.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>dt</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Timestep. See <code>meanas.fdtd</code> for details.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Grid description; see <code>meanas.fdmath</code>.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield_updater_t
module-attribute
(meanas.fdmath.fdfield_updater_t)" href="../fdmath/#meanas.fdmath.types.fdfield_updater_t">fdfield_updater_t</a></code>
</td>
<td>
<div class="doc-md-description">
<p>Function <code>f(E_old, H_old, epsilon) -&gt; E_new</code>.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.base.maxwell_h" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">maxwell_h</span>
<a href="#meanas.fdtd.base.maxwell_h" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">maxwell_h</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_updater_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Build a function which performs part of the time-domain H-field update,</p>
<div class="highlight"><pre><span></span><code>H -= curl_forward(E[t]) / mu
</code></pre></div>
<p>The full update should be</p>
<div class="highlight"><pre><span></span><code>H -= (curl_forward(E[t]) + M) / mu
</code></pre></div>
<p>which requires an additional step of <code>H -= M / mu</code> which is not performed
by the generated function; this step can be omitted if there is no magnetic
current <code>M</code>.</p>
<p>See <code>meanas.fdmath</code> for descriptions of</p>
<ul>
<li>This update step: "Maxwell's equations" section</li>
<li><code>dxes</code>: "Datastructure: dx_lists_t" section</li>
<li><code>mu</code>: "Permittivity and Permeability" section</li>
</ul>
<p>Also see the "Timestep" section of <code>meanas.fdtd</code> for a discussion of
the <code>dt</code> parameter.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>dt</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Timestep. See <code>meanas.fdtd</code> for details.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Grid description; see <code>meanas.fdmath</code>.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield_updater_t
module-attribute
(meanas.fdmath.fdfield_updater_t)" href="../fdmath/#meanas.fdmath.types.fdfield_updater_t">fdfield_updater_t</a></code>
</td>
<td>
<div class="doc-md-description">
<p>Function <code>f(E_old, H_old, epsilon) -&gt; E_new</code>.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdtd.pml" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">meanas.fdtd.pml</span>
<a href="#meanas.fdtd.pml" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Convolutional perfectly matched layer (CPML) support for FDTD updates.</p>
<p>The helpers in this module construct per-face CPML parameters and then wrap the
standard Yee updates with the additional auxiliary <code>psi</code> fields needed by the
CPML recurrence.</p>
<p>The intended call pattern is:</p>
<ol>
<li>Build a <code>cpml_params[axis][polarity_index]</code> table with <code>cpml_params(...)</code>.</li>
<li>Pass that table into <code>updates_with_cpml(...)</code> together with <code>dt</code>, <code>dxes</code>, and
<code>epsilon</code>.</li>
<li>Advance the returned <code>update_E</code> / <code>update_H</code> closures in the simulation loop.</li>
</ol>
<p>Each face can be enabled or disabled independently by replacing one table entry
with <code>None</code>.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.pml.cpml_params" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">cpml_params</span>
<a href="#meanas.fdtd.pml.cpml_params" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">cpml_params</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">axis</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">polarity</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">thickness</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">8</span><span class="p">,</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="n">ln_R_per_layer</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="o">-</span><span class="mf">1.6</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">epsilon_eff</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">mu_eff</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">m</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">3.5</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="n">ma</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="n">cfs_alpha</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Construct the parameter block for one CPML face.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>axis</code>
</td>
<td>
<code><span title="int">int</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Which Cartesian axis the CPML is normal to (<code>0</code>, <code>1</code>, or <code>2</code>).</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>polarity</code>
</td>
<td>
<code><span title="int">int</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Which face along that axis (<code>-1</code> for the low-index face,
<code>+1</code> for the high-index face).</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dt</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Timestep used by the Yee update.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>thickness</code>
</td>
<td>
<code><span title="int">int</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Number of Yee cells occupied by the CPML region.</p>
</div>
</td>
<td>
<code>8</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>ln_R_per_layer</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Logarithmic attenuation target per layer.</p>
</div>
</td>
<td>
<code>-1.6</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>epsilon_eff</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Effective permittivity used when choosing the CPML scaling.</p>
</div>
</td>
<td>
<code>1</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>mu_eff</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Effective permeability used when choosing the CPML scaling.</p>
</div>
</td>
<td>
<code>1</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>m</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Polynomial grading exponent for <code>sigma</code> and <code>kappa</code>.</p>
</div>
</td>
<td>
<code>3.5</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>ma</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Polynomial grading exponent for the complex-frequency shift <code>alpha</code>.</p>
</div>
</td>
<td>
<code>1</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>cfs_alpha</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Maximum complex-frequency shift parameter.</p>
</div>
</td>
<td>
<code>0</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="dict">dict</span>[<span title="str">str</span>, <span title="typing.Any">Any</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>Dictionary with:</p>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="dict">dict</span>[<span title="str">str</span>, <span title="typing.Any">Any</span>]</code>
</td>
<td>
<div class="doc-md-description">
<ul>
<li><code>param_e</code>: <code>(p0, p1, p2)</code> arrays for the E update</li>
</ul>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="dict">dict</span>[<span title="str">str</span>, <span title="typing.Any">Any</span>]</code>
</td>
<td>
<div class="doc-md-description">
<ul>
<li><code>param_h</code>: <code>(p0, p1, p2)</code> arrays for the H update</li>
</ul>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="dict">dict</span>[<span title="str">str</span>, <span title="typing.Any">Any</span>]</code>
</td>
<td>
<div class="doc-md-description">
<ul>
<li><code>region</code>: slice tuple selecting the CPML cells on that face</li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.pml.updates_with_cpml" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">updates_with_cpml</span>
<a href="#meanas.fdtd.pml.updates_with_cpml" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">updates_with_cpml</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">cpml_params</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">Sequence</span><span class="p">[</span><span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]</span> <span class="o">|</span> <span class="kc">None</span><span class="p">]],</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span><span class="p">,</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">epsilon</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dtype</span><span class="p">:</span> <span class="n">DTypeLike</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">float32</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">tuple</span><span class="p">[</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">Callable</span><span class="p">[[</span><span class="n">fdfield_t</span><span class="p">,</span> <span class="n">fdfield_t</span><span class="p">,</span> <span class="n">fdfield_t</span><span class="p">],</span> <span class="kc">None</span><span class="p">],</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="n">Callable</span><span class="p">[[</span><span class="n">fdfield_t</span><span class="p">,</span> <span class="n">fdfield_t</span><span class="p">,</span> <span class="n">fdfield_t</span><span class="p">],</span> <span class="kc">None</span><span class="p">],</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Build Yee-step update closures augmented with CPML terms.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>cpml_params</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="collections.abc.Sequence">Sequence</span>[<span title="dict">dict</span>[<span title="str">str</span>, <span title="typing.Any">Any</span>] | None]]</code>
</td>
<td>
<div class="doc-md-description">
<p>Three-by-two sequence indexed as <code>[axis][polarity_index]</code>.
Entries are the dictionaries returned by <code>cpml_params(...)</code>; use
<code>None</code> to disable CPML on one face.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dt</code>
</td>
<td>
<code><span title="float">float</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Timestep.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a></code>
</td>
<td>
<div class="doc-md-description">
<p>Yee-grid spacing lists <code>[dx_e, dx_h]</code>.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>epsilon</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>Electric material distribution used by the E update.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dtype</code>
</td>
<td>
<code><span title="numpy.typing.DTypeLike">DTypeLike</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Storage dtype for the auxiliary CPML state arrays.</p>
</div>
</td>
<td>
<code><span title="numpy.float32">float32</span></code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>], None]</code>
</td>
<td>
<div class="doc-md-description">
<p><code>(update_E, update_H)</code> closures with the same call shape as the basic</p>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>], None]</code>
</td>
<td>
<div class="doc-md-description">
<p>Yee updates:</p>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="tuple">tuple</span>[<span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>], None], <span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>], None]]</code>
</td>
<td>
<div class="doc-md-description">
<ul>
<li><code>update_E(e, h, epsilon)</code></li>
</ul>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="tuple">tuple</span>[<span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>], None], <span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>], None]]</code>
</td>
<td>
<div class="doc-md-description">
<ul>
<li><code>update_H(e, h, mu)</code></li>
</ul>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="tuple">tuple</span>[<span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>], None], <span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>, <span title="meanas.fdmath.fdfield_t">fdfield_t</span>], None]]</code>
</td>
<td>
<div class="doc-md-description">
<p>The closures retain the CPML auxiliary state internally.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdtd.boundaries" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">meanas.fdtd.boundaries</span>
<a href="#meanas.fdtd.boundaries" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Boundary conditions</p>
<h3 id="meanas.fdtd.boundaries--todo-conducting-boundary-documentation">TODO conducting boundary documentation<a class="headerlink" href="#meanas.fdtd.boundaries--todo-conducting-boundary-documentation" title="Permanent link">&para;</a></h3>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdtd.energy" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">meanas.fdtd.energy</span>
<a href="#meanas.fdtd.energy" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.energy.poynting" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">poynting</span>
<a href="#meanas.fdtd.energy.poynting" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">poynting</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">e</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span> <span class="n">h</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Calculate the poynting vector <code>S</code> (<span class="arithmatex">\(S\)</span>).</p>
<p>This is the energy transfer rate (amount of energy <code>U</code> per <code>dt</code> transferred
between adjacent cells) in each direction that happens during the half-step
bounded by the two provided fields.</p>
<p>The returned vector field <code>S</code> is the energy flow across +x, +y, and +z
boundaries of the corresponding <code>U</code> cell. For example,</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a> mx = numpy.roll(mask, -1, axis=0)
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> my = numpy.roll(mask, -1, axis=1)
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> mz = numpy.roll(mask, -1, axis=2)
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> u_hstep = fdtd.energy_hstep(e0=es[ii - 1], h1=hs[ii], e2=es[ii], **args)
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> u_estep = fdtd.energy_estep(h0=hs[ii], e1=es[ii], h2=hs[ii + 1], **args)
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> delta_j_B = fdtd.delta_energy_j(j0=js[ii], e1=es[ii], dxes=dxes)
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> du_half_h2e = u_estep - u_hstep - delta_j_B
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> s_h2e = -fdtd.poynting(e=es[ii], h=hs[ii], dxes=dxes) * dt
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> planes = [s_h2e[0, mask].sum(), -s_h2e[0, mx].sum(),
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a> s_h2e[1, mask].sum(), -s_h2e[1, my].sum(),
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a> s_h2e[2, mask].sum(), -s_h2e[2, mz].sum()]
<a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a>
<a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a> assert_close(sum(planes), du_half_h2e[mask])
</code></pre></div>
<p>(see <code>meanas.tests.test_fdtd.test_poynting_planes</code>)</p>
<p>The full relationship is</p>
<div class="arithmatex">\[
\begin{aligned}
(U_{l+\frac{1}{2}} - U_l) / \Delta_t
&= -\hat{\nabla} \cdot \tilde{S}_{l, l + \frac{1}{2}} \\
- \hat{H}_{l+\frac{1}{2}} \cdot \hat{M}_l \\
- \tilde{E}_l \cdot \tilde{J}_{l+\frac{1}{2}} \\
(U_l - U_{l-\frac{1}{2}}) / \Delta_t
&= -\hat{\nabla} \cdot \tilde{S}_{l, l - \frac{1}{2}} \\
- \hat{H}_{l-\frac{1}{2}} \cdot \hat{M}_l \\
- \tilde{E}_l \cdot \tilde{J}_{l-\frac{1}{2}} \\
\end{aligned}
\]</div>
<p>These equalities are exact and should practically hold to within numerical precision.
No time- or spatial-averaging is necessary. (See <code>meanas.fdtd</code> docs for derivation.)</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>e</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>E-field</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>h</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>H-field (one half-timestep before or after <code>e</code>)</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Grid description; see <code>meanas.fdmath</code>.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Name</th> <th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td><code>s</code></td> <td>
<code><span title="meanas.fdmath.fdfield_t">fdfield_t</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Vector field. Components indicate the energy transfer rate from the
corresponding energy cell into its +x, +y, and +z neighbors during
the half-step from the time of the earlier input field until the
time of later input field.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.energy.poynting_divergence" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">poynting_divergence</span>
<a href="#meanas.fdtd.energy.poynting_divergence" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">poynting_divergence</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">s</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">e</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">h</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Calculate the divergence of the poynting vector.</p>
<p>This is the net energy flow for each cell, i.e. the change in energy <code>U</code>
per <code>dt</code> caused by transfer of energy to nearby cells (rather than
absorption/emission by currents <code>J</code> or <code>M</code>).</p>
<p>See <code>poynting</code> and <code>meanas.fdtd</code> for more details.
Args:
s: Poynting vector, as calculated with <code>poynting</code>. Optional; caller
can provide <code>e</code> and <code>h</code> instead.
e: E-field (optional; need either <code>s</code> or both <code>e</code> and <code>h</code>)
h: H-field (optional; need either <code>s</code> or both <code>e</code> and <code>h</code>)
dxes: Grid description; see <code>meanas.fdmath</code>.</p>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Name</th> <th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td><code>ds</code></td> <td>
<code><span title="meanas.fdmath.fdfield_t">fdfield_t</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Divergence of the poynting vector.
Entries indicate the net energy flow out of the corresponding
energy cell.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.energy.energy_hstep" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">energy_hstep</span>
<a href="#meanas.fdtd.energy.energy_hstep" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">energy_hstep</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">e0</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">h1</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">e2</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">epsilon</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="n">mu</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Calculate energy <code>U</code> at the time of the provided H-field <code>h1</code>.</p>
<p>TODO: Figure out what this means spatially.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>e0</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>E-field one half-timestep before the energy.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>h1</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>H-field (at the same timestep as the energy).</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>e2</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>E-field one half-timestep after the energy.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>epsilon</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Dielectric constant distribution.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>mu</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Magnetic permeability distribution.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Grid description; see <code>meanas.fdmath</code>.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="meanas.fdmath.fdfield_t">fdfield_t</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Energy, at the time of the H-field <code>h1</code>.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.energy.energy_estep" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">energy_estep</span>
<a href="#meanas.fdtd.energy.energy_estep" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">energy_estep</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">h0</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">e1</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">h2</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">epsilon</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="n">mu</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Calculate energy <code>U</code> at the time of the provided E-field <code>e1</code>.</p>
<p>TODO: Figure out what this means spatially.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>h0</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>H-field one half-timestep before the energy.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>e1</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>E-field (at the same timestep as the energy).</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>h2</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>H-field one half-timestep after the energy.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>epsilon</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Dielectric constant distribution.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>mu</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Magnetic permeability distribution.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Grid description; see <code>meanas.fdmath</code>.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="meanas.fdmath.fdfield_t">fdfield_t</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Energy, at the time of the E-field <code>e1</code>.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.energy.delta_energy_h2e" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">delta_energy_h2e</span>
<a href="#meanas.fdtd.energy.delta_energy_h2e" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">delta_energy_h2e</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">e0</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">h1</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">e2</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="n">h3</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">epsilon</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">mu</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Change in energy during the half-step from <code>h1</code> to <code>e2</code>.</p>
<p>This is just from (e2 * e2 + h3 * h1) - (h1 * h1 + e0 * e2)</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>e0</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>E-field one half-timestep before the start of the energy delta.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>h1</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>H-field at the start of the energy delta.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>e2</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>E-field at the end of the energy delta (one half-timestep after <code>h1</code>).</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>h3</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>H-field one half-timestep after the end of the energy delta.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>epsilon</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Dielectric constant distribution.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>mu</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Magnetic permeability distribution.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Grid description; see <code>meanas.fdmath</code>.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="meanas.fdmath.fdfield_t">fdfield_t</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Change in energy from the time of <code>h1</code> to the time of <code>e2</code>.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.energy.delta_energy_e2h" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">delta_energy_e2h</span>
<a href="#meanas.fdtd.energy.delta_energy_e2h" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">delta_energy_e2h</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">h0</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">e1</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">h2</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="n">e3</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">epsilon</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">mu</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Change in energy during the half-step from <code>e1</code> to <code>h2</code>.</p>
<p>This is just from (h2 * h2 + e3 * e1) - (e1 * e1 + h0 * h2)</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>h0</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>E-field one half-timestep before the start of the energy delta.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>e1</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>H-field at the start of the energy delta.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>h2</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>E-field at the end of the energy delta (one half-timestep after <code>e1</code>).</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>e3</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>H-field one half-timestep after the end of the energy delta.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>epsilon</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Dielectric constant distribution.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>mu</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Magnetic permeability distribution.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Grid description; see <code>meanas.fdmath</code>.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="meanas.fdmath.fdfield_t">fdfield_t</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Change in energy from the time of <code>e1</code> to the time of <code>h2</code>.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.energy.delta_energy_j" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">delta_energy_j</span>
<a href="#meanas.fdtd.energy.delta_energy_j" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">delta_energy_j</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">j0</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span> <span class="n">e1</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Calculate the electric-current work term <span class="arithmatex">\(J \cdot E\)</span> on the Yee grid.</p>
<p>This is the source contribution that appears beside the flux divergence in
the discrete Poynting identities documented in <code>meanas.fdtd</code>.</p>
<p>Note that each value of <code>J</code> contributes twice in a full Yee cycle (once per
half-step energy balance) even though it directly changes <code>E</code> only once.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>j0</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>Electric-current density sampled at the same half-step as the
current work term.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>e1</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>Electric field sampled at the matching integer timestep.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Grid description; defaults to unit spacing.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="meanas.fdmath.fdfield_t">fdfield_t</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Per-cell source-work contribution with the scalar field shape.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.energy.dxmul" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">dxmul</span>
<a href="#meanas.fdtd.energy.dxmul" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">dxmul</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">ee</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">hh</span><span class="p">:</span> <span class="n">fdfield</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">epsilon</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="nb">float</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">mu</span><span class="p">:</span> <span class="n">fdfield</span> <span class="o">|</span> <span class="nb">float</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="n">dxes</span><span class="p">:</span> <span class="n">dx_lists_t</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">fdfield_t</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Multiply E- and H-like field products by material weights and cell volumes.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>ee</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>Three-component electric-field product, such as <code>e0 * e2</code>.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>hh</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>Three-component magnetic-field product, such as <code>h1 * h1</code>.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>epsilon</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | <span title="float">float</span> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Electric material weight; defaults to <code>1</code>.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>mu</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" fdfield (meanas.fdmath.fdfield)" href="../fdmath/#meanas.fdmath.types.fdfield">fdfield</a> | <span title="float">float</span> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Magnetic material weight; defaults to <code>1</code>.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>dxes</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" dx_lists_t
module-attribute
(meanas.fdmath.dx_lists_t)" href="../fdmath/#meanas.fdmath.types.dx_lists_t">dx_lists_t</a> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Grid description; defaults to unit spacing.</p>
</div>
</td>
<td>
<code>None</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="meanas.fdmath.fdfield_t">fdfield_t</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Scalar field containing the weighted electric plus magnetic contribution</p>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="meanas.fdmath.fdfield_t">fdfield_t</span></code>
</td>
<td>
<div class="doc-md-description">
<p>for each Yee cell.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdtd.phasor" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-module"></code> <span class="doc doc-object-name doc-module-name">meanas.fdtd.phasor</span>
<a href="#meanas.fdtd.phasor" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Helpers for extracting single- or multi-frequency phasors from FDTD samples.</p>
<p>These helpers are intentionally low-level: callers own the accumulator arrays and
the sampling policy. The accumulated quantity is</p>
<div class="highlight"><pre><span></span><code>dt * sum(weight * exp(-1j * omega * t_step) * sample_step)
</code></pre></div>
<p>where <code>t_step = (step + offset_steps) * dt</code>.</p>
<p>The usual Yee offsets are:</p>
<ul>
<li><code>accumulate_phasor_e(..., step=l)</code> for <code>E_l</code></li>
<li><code>accumulate_phasor_h(..., step=l)</code> for <code>H_{l + 1/2}</code></li>
<li><code>accumulate_phasor_j(..., step=l)</code> for <code>J_{l + 1/2}</code></li>
</ul>
<p><code>temporal_phasor(...)</code> and <code>temporal_phasor_scale(...)</code> apply the same Fourier
sum to a 1D scalar waveform. They are useful for normalizing a pulsed source
before that scalar waveform is applied to a point source or spatial mode source.
<code>real_injection_scale(...)</code> is a companion helper for the common real-valued
injection pattern <code>numpy.real(scale * waveform)</code>, where <code>waveform</code> is the
analytic positive-frequency signal and the injected real current should still
produce a desired phasor response.
<code>reconstruct_real(...)</code> and its <code>E/H/J</code> wrappers perform the inverse operation:
they turn one or more phasors back into real-valued field snapshots at explicit
Yee-aligned sample times. For a scalar target frequency they accept either a
plain field phasor or the batched <code>(1, *sample_shape)</code> form used elsewhere in
this module.</p>
<p>These helpers do not choose warmup/accumulation windows or pulse-envelope
normalization. They also do not impose a current sign convention. In this
codebase, electric-current injection normally appears as <code>E -= dt * J / epsilon</code>,
which matches the FDFD right-hand side <code>-1j * omega * J</code>.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.accumulate_phasor" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">accumulate_phasor</span>
<a href="#meanas.fdtd.phasor.accumulate_phasor" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">accumulate_phasor</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">accumulator</span><span class="p">:</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">],</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">sample</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">step</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="n">offset_steps</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">,</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a> <span class="n">weight</span><span class="p">:</span> <span class="n">ArrayLike</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Add one time-domain sample into a phasor accumulator.</p>
<p>The added quantity is</p>
<div class="highlight"><pre><span></span><code>dt * weight * exp(-1j * omega * t_step) * sample
</code></pre></div>
<p>where <code>t_step = (step + offset_steps) * dt</code>.</p>
<details class="note" open>
<summary>Note</summary>
<p>This helper already multiplies by <code>dt</code>. If the caller's normalization
factor was derived from a discrete sum that already includes <code>dt</code>, pass
<code>weight / dt</code> here.</p>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.temporal_phasor" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">temporal_phasor</span>
<a href="#meanas.fdtd.phasor.temporal_phasor" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">temporal_phasor</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">samples</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">start_step</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="n">offset_steps</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">,</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Fourier-project a 1D temporal waveform onto one or more angular frequencies.</p>
<p>The returned quantity is</p>
<div class="highlight"><pre><span></span><code>dt * sum(exp(-1j * omega * t_step) * samples[step_index])
</code></pre></div>
<p>where <code>t_step = (start_step + step_index + offset_steps) * dt</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.temporal_phasor_scale" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">temporal_phasor_scale</span>
<a href="#meanas.fdtd.phasor.temporal_phasor_scale" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">temporal_phasor_scale</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">samples</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">start_step</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="n">offset_steps</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">,</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="n">target</span><span class="p">:</span> <span class="n">ArrayLike</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Return the scalar multiplier that gives a desired temporal phasor response.</p>
<p>The returned scale satisfies</p>
<div class="highlight"><pre><span></span><code>temporal_phasor(scale * samples, omegas, dt, ...) == target
</code></pre></div>
<p>for each target frequency. The result keeps a leading frequency axis even
when <code>omegas</code> is scalar.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.real_injection_scale" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">real_injection_scale</span>
<a href="#meanas.fdtd.phasor.real_injection_scale" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">real_injection_scale</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">samples</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">start_step</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="n">offset_steps</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">,</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="n">target</span><span class="p">:</span> <span class="n">ArrayLike</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Return the scale for a real-valued injection built from an analytic waveform.</p>
<p>If the time-domain source is applied as</p>
<div class="highlight"><pre><span></span><code>numpy.real(scale * samples[step])
</code></pre></div>
<p>then the desired positive-frequency phasor is obtained by compensating for
the 1/2 factor between the real-valued source and its analytic component:</p>
<div class="highlight"><pre><span></span><code>scale = 2 * target / temporal_phasor(samples, ...)
</code></pre></div>
<p>This helper normalizes only the intended positive-frequency component. Any
residual negative-frequency leakage is controlled by the waveform design and
the accumulation window.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.reconstruct_real" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">reconstruct_real</span>
<a href="#meanas.fdtd.phasor.reconstruct_real" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">reconstruct_real</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">phasors</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">step</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="n">offset_steps</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">,</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Reconstruct a real-valued field snapshot from one or more phasors.</p>
<p>The returned quantity is</p>
<div class="highlight"><pre><span></span><code>real(phasor * exp(1j * omega * t_step))
</code></pre></div>
<p>where <code>t_step = (step + offset_steps) * dt</code>.</p>
<p>For multi-frequency inputs, the leading frequency axis is preserved. For a
scalar <code>omega</code>, callers may pass either <code>(1, *sample_shape)</code> or
<code>sample_shape</code>; the return shape matches that choice.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.accumulate_phasor_e" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">accumulate_phasor_e</span>
<a href="#meanas.fdtd.phasor.accumulate_phasor_e" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">accumulate_phasor_e</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">accumulator</span><span class="p">:</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">],</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">sample</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">step</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="n">weight</span><span class="p">:</span> <span class="n">ArrayLike</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Accumulate an E-field sample taken at integer timestep <code>step</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.accumulate_phasor_h" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">accumulate_phasor_h</span>
<a href="#meanas.fdtd.phasor.accumulate_phasor_h" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">accumulate_phasor_h</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">accumulator</span><span class="p">:</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">],</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">sample</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">step</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="n">weight</span><span class="p">:</span> <span class="n">ArrayLike</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Accumulate an H-field sample corresponding to <code>H_{step + 1/2}</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.accumulate_phasor_j" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">accumulate_phasor_j</span>
<a href="#meanas.fdtd.phasor.accumulate_phasor_j" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">accumulate_phasor_j</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">accumulator</span><span class="p">:</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">],</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">sample</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">step</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="o">*</span><span class="p">,</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="n">weight</span><span class="p">:</span> <span class="n">ArrayLike</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Accumulate a current sample corresponding to <code>J_{step + 1/2}</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.reconstruct_real_e" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">reconstruct_real_e</span>
<a href="#meanas.fdtd.phasor.reconstruct_real_e" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">reconstruct_real_e</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">phasors</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">step</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Reconstruct a real E-field snapshot taken at integer timestep <code>step</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.reconstruct_real_h" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">reconstruct_real_h</span>
<a href="#meanas.fdtd.phasor.reconstruct_real_h" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">reconstruct_real_h</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">phasors</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">step</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Reconstruct a real H-field snapshot corresponding to <code>H_{step + 1/2}</code>.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdtd.phasor.reconstruct_real_j" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">reconstruct_real_j</span>
<a href="#meanas.fdtd.phasor.reconstruct_real_j" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">reconstruct_real_j</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">phasors</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">omegas</span><span class="p">:</span> <span class="nb">float</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="nb">complex</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">float</span> <span class="o">|</span> <span class="nb">complex</span><span class="p">]</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">NDArray</span><span class="p">,</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">dt</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">step</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Reconstruct a real current snapshot corresponding to <code>J_{step + 1/2}</code>.</p>
</div>
</div>
</div>
</div>
</div>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
<button type="button" class="md-top md-icon" data-md-component="top" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg>
Back to top
</button>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["navigation.indexes", "navigation.sections", "navigation.top", "content.code.copy", "toc.follow"], "search": "../../assets/javascripts/workers/search.2c215733.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
<script src="../../assets/javascripts/bundle.79ae519e.min.js"></script>
<script src="../../js/print-site.js"></script>
<script src="../../javascripts/mathjax.js"></script>
<script src="../../assets/vendor/mathjax/startup.js"></script>
</body>
</html>