meanas/api/fdmath/index.html
2026-04-21 21:20:52 -07:00

4688 lines
No EOL
176 KiB
HTML
Raw Permalink 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/fdmath/">
<link rel="prev" href="../fdtd/">
<link rel="icon" href="../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.6">
<title>fdmath - 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="#fdmath" 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">
fdmath
</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">
<a href="../fdtd/" class="md-nav__link">
<span class="md-ellipsis">
fdtd
</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">
fdmath
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
fdmath
</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.fdmath" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;fdmath
</span>
</a>
<nav class="md-nav" aria-label=" fdmath">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath--fields-functions-and-operators" class="md-nav__link">
<span class="md-ellipsis">
Fields, Functions, and Operators
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--discrete-calculus" class="md-nav__link">
<span class="md-ellipsis">
Discrete calculus
</span>
</a>
<nav class="md-nav" aria-label="Discrete calculus">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath--scalar-derivatives-and-cell-shifts" class="md-nav__link">
<span class="md-ellipsis">
Scalar derivatives and cell shifts
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--gradients-and-fore-vectors" class="md-nav__link">
<span class="md-ellipsis">
Gradients and fore-vectors
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--divergences" class="md-nav__link">
<span class="md-ellipsis">
Divergences
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--curls" class="md-nav__link">
<span class="md-ellipsis">
Curls
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--maxwells-equations" class="md-nav__link">
<span class="md-ellipsis">
Maxwell's Equations
</span>
</a>
<nav class="md-nav" aria-label="Maxwell&#39;s Equations">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath--wave-equation" class="md-nav__link">
<span class="md-ellipsis">
Wave equation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--frequency-domain" class="md-nav__link">
<span class="md-ellipsis">
Frequency domain
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--plane-waves-and-dispersion-relation" class="md-nav__link">
<span class="md-ellipsis">
Plane waves and Dispersion relation
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--grid-description" class="md-nav__link">
<span class="md-ellipsis">
Grid description
</span>
</a>
<nav class="md-nav" aria-label="Grid description">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath--datastructure-dx_lists_t" class="md-nav__link">
<span class="md-ellipsis">
Datastructure: dx_lists_t
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--permittivity-and-permeability" class="md-nav__link">
<span class="md-ellipsis">
Permittivity and Permeability
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#functional-and-sparse-operators" class="md-nav__link">
<span class="md-ellipsis">
Functional and sparse operators
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.functional" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;functional
</span>
</a>
<nav class="md-nav" aria-label=" functional">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath.functional.deriv_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;deriv_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.functional.deriv_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;deriv_back
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.functional.curl_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;curl_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.functional.curl_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;curl_back
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;operators
</span>
</a>
<nav class="md-nav" aria-label=" operators">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.shift_circ" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;shift_circ
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.shift_with_mirror" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;shift_with_mirror
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.deriv_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;deriv_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.deriv_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;deriv_back
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.cross" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;cross
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.vec_cross" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;vec_cross
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.avg_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;avg_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.avg_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;avg_back
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.curl_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;curl_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.curl_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;curl_back
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.vectorization" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;vectorization
</span>
</a>
<nav class="md-nav" aria-label=" vectorization">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath.vectorization.vec" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;vec
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.vectorization.unvec" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;unvec
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;types
</span>
</a>
<nav class="md-nav" aria-label=" types">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath.types.dx_lists_t" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;dx_lists_t
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.dx_lists2_t" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;dx_lists2_t
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.dx_lists_mut" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;dx_lists_mut
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.dx_lists2_mut" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;dx_lists2_mut
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.fdfield_updater_t" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;fdfield_updater_t
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.cfdfield_updater_t" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;cfdfield_updater_t
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.fdfield" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;fdfield
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vfdfield" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vfdfield
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.cfdfield" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;cfdfield
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vcfdfield" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vcfdfield
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.fdslice" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;fdslice
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vfdslice" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vfdslice
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.cfdslice" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;cfdslice
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vcfdslice" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vcfdslice
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.fdfield2" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;fdfield2
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vfdfield2" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vfdfield2
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.cfdfield2" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;cfdfield2
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vcfdfield2" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vcfdfield2
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</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.fdmath" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;fdmath
</span>
</a>
<nav class="md-nav" aria-label=" fdmath">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath--fields-functions-and-operators" class="md-nav__link">
<span class="md-ellipsis">
Fields, Functions, and Operators
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--discrete-calculus" class="md-nav__link">
<span class="md-ellipsis">
Discrete calculus
</span>
</a>
<nav class="md-nav" aria-label="Discrete calculus">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath--scalar-derivatives-and-cell-shifts" class="md-nav__link">
<span class="md-ellipsis">
Scalar derivatives and cell shifts
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--gradients-and-fore-vectors" class="md-nav__link">
<span class="md-ellipsis">
Gradients and fore-vectors
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--divergences" class="md-nav__link">
<span class="md-ellipsis">
Divergences
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--curls" class="md-nav__link">
<span class="md-ellipsis">
Curls
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--maxwells-equations" class="md-nav__link">
<span class="md-ellipsis">
Maxwell's Equations
</span>
</a>
<nav class="md-nav" aria-label="Maxwell&#39;s Equations">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath--wave-equation" class="md-nav__link">
<span class="md-ellipsis">
Wave equation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--frequency-domain" class="md-nav__link">
<span class="md-ellipsis">
Frequency domain
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--plane-waves-and-dispersion-relation" class="md-nav__link">
<span class="md-ellipsis">
Plane waves and Dispersion relation
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--grid-description" class="md-nav__link">
<span class="md-ellipsis">
Grid description
</span>
</a>
<nav class="md-nav" aria-label="Grid description">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath--datastructure-dx_lists_t" class="md-nav__link">
<span class="md-ellipsis">
Datastructure: dx_lists_t
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath--permittivity-and-permeability" class="md-nav__link">
<span class="md-ellipsis">
Permittivity and Permeability
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#functional-and-sparse-operators" class="md-nav__link">
<span class="md-ellipsis">
Functional and sparse operators
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.functional" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;functional
</span>
</a>
<nav class="md-nav" aria-label=" functional">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath.functional.deriv_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;deriv_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.functional.deriv_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;deriv_back
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.functional.curl_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;curl_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.functional.curl_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;curl_back
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;operators
</span>
</a>
<nav class="md-nav" aria-label=" operators">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.shift_circ" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;shift_circ
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.shift_with_mirror" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;shift_with_mirror
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.deriv_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;deriv_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.deriv_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;deriv_back
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.cross" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;cross
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.vec_cross" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;vec_cross
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.avg_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;avg_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.avg_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;avg_back
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.curl_forward" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;curl_forward
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.operators.curl_back" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;curl_back
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.vectorization" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;vectorization
</span>
</a>
<nav class="md-nav" aria-label=" vectorization">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath.vectorization.vec" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;vec
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.vectorization.unvec" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-function"></code>&nbsp;unvec
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;types
</span>
</a>
<nav class="md-nav" aria-label=" types">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#meanas.fdmath.types.dx_lists_t" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;dx_lists_t
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.dx_lists2_t" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;dx_lists2_t
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.dx_lists_mut" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;dx_lists_mut
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.dx_lists2_mut" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;dx_lists2_mut
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.fdfield_updater_t" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;fdfield_updater_t
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.cfdfield_updater_t" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;cfdfield_updater_t
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.fdfield" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;fdfield
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vfdfield" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vfdfield
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.cfdfield" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;cfdfield
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vcfdfield" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vcfdfield
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.fdslice" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;fdslice
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vfdslice" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vfdslice
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.cfdslice" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;cfdslice
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vcfdslice" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vcfdslice
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.fdfield2" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;fdfield2
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vfdfield2" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vfdfield2
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.cfdfield2" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;cfdfield2
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#meanas.fdmath.types.vcfdfield2" class="md-nav__link">
<span class="md-ellipsis">
<code class="doc-symbol doc-symbol-toc doc-symbol-type_alias"></code>&nbsp;vcfdfield2
</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="fdmath">fdmath<a class="headerlink" href="#fdmath" title="Permanent link">&para;</a></h1>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdmath" 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.fdmath</span>
<a href="#meanas.fdmath" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Basic discrete calculus for finite difference (fd) simulations.</p>
<h3 id="meanas.fdmath--fields-functions-and-operators">Fields, Functions, and Operators<a class="headerlink" href="#meanas.fdmath--fields-functions-and-operators" title="Permanent link">&para;</a></h3>
<p>Discrete fields are stored in one of two forms:</p>
<ul>
<li>The <code>fdfield_t</code> form is a multidimensional <code>numpy.NDArray</code><ul>
<li>For a scalar field, this is just <code>U[m, n, p]</code>, where <code>m</code>, <code>n</code>, and <code>p</code> are
discrete indices referring to positions on the x, y, and z axes respectively.</li>
<li>For a vector field, the first index specifies which vector component is accessed:
<code>E[:, m, n, p] = [Ex[m, n, p], Ey[m, n, p], Ez[m, n, p]]</code>.</li>
</ul>
</li>
<li>The <code>vfdfield_t</code> form is simply a vectorzied (i.e. 1D) version of the <code>fdfield_t</code>,
as obtained by <code>meanas.fdmath.vectorization.vec</code> (effectively just <code>numpy.ravel</code>)</li>
</ul>
<details class="operators-which-act-on-fields-also-come-in-two-forms" open>
<summary>Operators which act on fields also come in two forms</summary>
<ul>
<li>Python functions, created by the functions in <code>meanas.fdmath.functional</code>.
The generated functions act on fields in the <code>fdfield_t</code> form.</li>
<li>Linear operators, usually 2D sparse matrices using <code>scipy.sparse</code>, created
by <code>meanas.fdmath.operators</code>. These operators act on vectorized fields in the
<code>vfdfield_t</code> form.</li>
</ul>
</details> <p>The operations performed should be equivalent: <code>functional.op(*args)(E)</code> should be
equivalent to <code>unvec(operators.op(*args) @ vec(E), E.shape[1:])</code>.</p>
<p>Generally speaking the <code>field_t</code> form is easier to work with, but can be harder or less
efficient to compose (e.g. it is easy to generate a single matrix by multiplying a
series of other matrices).</p>
<h3 id="meanas.fdmath--discrete-calculus">Discrete calculus<a class="headerlink" href="#meanas.fdmath--discrete-calculus" title="Permanent link">&para;</a></h3>
<p>This documentation and approach is roughly based on W.C. Chew's excellent
"Electromagnetic Theory on a Lattice" (doi:10.1063/1.355770),
which covers a superset of this material with similar notation and more detail.</p>
<h4 id="meanas.fdmath--scalar-derivatives-and-cell-shifts">Scalar derivatives and cell shifts<a class="headerlink" href="#meanas.fdmath--scalar-derivatives-and-cell-shifts" title="Permanent link">&para;</a></h4>
<p>Define the discrete forward derivative as
<div class="arithmatex">\[ [\tilde{\partial}_x f]_{m + \frac{1}{2}} = \frac{1}{\Delta_{x, m}} (f_{m + 1} - f_m) \]</div></p>
<p>where <span class="arithmatex">\(f\)</span> is a function defined at discrete locations on the x-axis (labeled using <span class="arithmatex">\(m\)</span>).
The value at <span class="arithmatex">\(m\)</span> occupies a length <span class="arithmatex">\(\Delta_{x, m}\)</span> along the x-axis. Note that <span class="arithmatex">\(m\)</span>
is an index along the x-axis, <em>not</em> necessarily an x-coordinate, since each length
<span class="arithmatex">\(\Delta_{x, m}, \Delta_{x, m+1}, ...\)</span> is independently chosen.</p>
<p>If we treat <code>f</code> as a 1D array of values, with the <code>i</code>-th value <code>f[i]</code> taking up a length <code>dx[i]</code>
along the x-axis, the forward derivative is</p>
<div class="highlight"><pre><span></span><code>deriv_forward(f)[i] = (f[i + 1] - f[i]) / dx[i]
</code></pre></div>
<p>Likewise, discrete reverse derivative is
<div class="arithmatex">\[ [\hat{\partial}_x f ]_{m - \frac{1}{2}} = \frac{1}{\Delta_{x, m}} (f_{m} - f_{m - 1}) \]</div></p>
<p>or</p>
<div class="highlight"><pre><span></span><code>deriv_back(f)[i] = (f[i] - f[i - 1]) / dx[i]
</code></pre></div>
<p>The derivatives' values are shifted by a half-cell relative to the original function, and
will have different cell widths if all the <code>dx[i]</code> ( <span class="arithmatex">\(\Delta_{x, m}\)</span> ) are not
identical:</p>
<div class="highlight"><pre><span></span><code>[figure: derivatives and cell sizes]
dx0 dx1 dx2 dx3 cell sizes for function
----- ----- ----------- -----
______________________________
| | | |
f0 | f1 | f2 | f3 | function
_____|_____|___________|_____|
| | | |
| Df0 | Df1 | Df2 | Df3 forward derivative (periodic boundary)
__|_____|________|________|___
dx&#39;3] dx&#39;0 dx&#39;1 dx&#39;2 [dx&#39;3 cell sizes for forward derivative
-- ----- -------- -------- ---
dx&#39;0] dx&#39;1 dx&#39;2 dx&#39;3 [dx&#39;0 cell sizes for reverse derivative
______________________________
| | | |
| df1 | df2 | df3 | df0 reverse derivative (periodic boundary)
__|_____|________|________|___
Periodic boundaries are used here and elsewhere unless otherwise noted.
</code></pre></div>
<p>In the above figure,
<code>f0 =</code> <span class="arithmatex">\(f_0\)</span>, <code>f1 =</code> <span class="arithmatex">\(f_1\)</span>
<code>Df0 =</code> <span class="arithmatex">\([\tilde{\partial}f]_{0 + \frac{1}{2}}\)</span>
<code>Df1 =</code> <span class="arithmatex">\([\tilde{\partial}f]_{1 + \frac{1}{2}}\)</span>
<code>df0 =</code> <span class="arithmatex">\([\hat{\partial}f]_{0 - \frac{1}{2}}\)</span>
etc.</p>
<p>The fractional subscript <span class="arithmatex">\(m + \frac{1}{2}\)</span> is used to indicate values defined
at shifted locations relative to the original <span class="arithmatex">\(m\)</span>, with corresponding lengths
<div class="arithmatex">\[ \Delta_{x, m + \frac{1}{2}} = \frac{1}{2} * (\Delta_{x, m} + \Delta_{x, m + 1}) \]</div>
</p>
<p>Just as <span class="arithmatex">\(m\)</span> is not itself an x-coordinate, neither is <span class="arithmatex">\(m + \frac{1}{2}\)</span>;
carefully note the positions of the various cells in the above figure vs their labels.
If the positions labeled with <span class="arithmatex">\(m\)</span> are considered the "base" or "original" grid,
the positions labeled with <span class="arithmatex">\(m + \frac{1}{2}\)</span> are said to lie on a "dual" or
"derived" grid.</p>
<p>For the remainder of the <code>Discrete calculus</code> section, all figures will show
constant-length cells in order to focus on the vector derivatives themselves.
See the <code>Grid description</code> section below for additional information on this topic
and generalization to three dimensions.</p>
<h4 id="meanas.fdmath--gradients-and-fore-vectors">Gradients and fore-vectors<a class="headerlink" href="#meanas.fdmath--gradients-and-fore-vectors" title="Permanent link">&para;</a></h4>
<p>Expanding to three dimensions, we can define two gradients
<br />
<div class="arithmatex">\[
[\tilde{\nabla} f]_{m,n,p} = \vec{x} [\tilde{\partial}_x f]_{m + \frac{1}{2},n,p} +
\vec{y} [\tilde{\partial}_y f]_{m,n + \frac{1}{2},p} +
\vec{z} [\tilde{\partial}_z f]_{m,n,p + \frac{1}{2}}
\]</div></p>
<div class="arithmatex">\[
[\hat{\nabla} f]_{m,n,p} = \vec{x} [\hat{\partial}_x f]_{m + \frac{1}{2},n,p} +
\vec{y} [\hat{\partial}_y f]_{m,n + \frac{1}{2},p} +
\vec{z} [\hat{\partial}_z f]_{m,n,p + \frac{1}{2}}
\]</div>
<p>or</p>
<div class="highlight"><pre><span></span><code>[code: gradients]
grad_forward(f)[i,j,k] = [Dx_forward(f)[i, j, k],
Dy_forward(f)[i, j, k],
Dz_forward(f)[i, j, k]]
= [(f[i + 1, j, k] - f[i, j, k]) / dx[i],
(f[i, j + 1, k] - f[i, j, k]) / dy[i],
(f[i, j, k + 1] - f[i, j, k]) / dz[i]]
grad_back(f)[i,j,k] = [Dx_back(f)[i, j, k],
Dy_back(f)[i, j, k],
Dz_back(f)[i, j, k]]
= [(f[i, j, k] - f[i - 1, j, k]) / dx[i],
(f[i, j, k] - f[i, j - 1, k]) / dy[i],
(f[i, j, k] - f[i, j, k - 1]) / dz[i]]
</code></pre></div>
<p>The three derivatives in the gradient cause shifts in different
directions, so the x/y/z components of the resulting "vector" are defined
at different points: the x-component is shifted in the x-direction,
y in y, and z in z.</p>
<p>We call the resulting object a "fore-vector" or "back-vector", depending
on the direction of the shift. We write it as
<br />
<div class="arithmatex">\[
\tilde{g}_{m,n,p} = \vec{x} g^x_{m + \frac{1}{2},n,p} +
\vec{y} g^y_{m,n + \frac{1}{2},p} +
\vec{z} g^z_{m,n,p + \frac{1}{2}}
\]</div></p>
<div class="arithmatex">\[
\hat{g}_{m,n,p} = \vec{x} g^x_{m - \frac{1}{2},n,p} +
\vec{y} g^y_{m,n - \frac{1}{2},p} +
\vec{z} g^z_{m,n,p - \frac{1}{2}}
\]</div>
<div class="highlight"><pre><span></span><code>[figure: gradient / fore-vector]
(m, n+1, p+1) ______________ (m+1, n+1, p+1)
/: /|
/ : / |
/ : / |
(m, n, p+1)/_____________/ | The forward derivatives are defined
| : | | at the Dx, Dy, Dz points,
| :.........|...| but the forward-gradient fore-vector
z y Dz / | / is the set of all three
|/_x | Dy | / and is said to be &quot;located&quot; at (m,n,p)
|/ |/
(m, n, p)|_____Dx______| (m+1, n, p)
</code></pre></div>
<h4 id="meanas.fdmath--divergences">Divergences<a class="headerlink" href="#meanas.fdmath--divergences" title="Permanent link">&para;</a></h4>
<p>There are also two divergences,</p>
<div class="arithmatex">\[
d_{n,m,p} = [\tilde{\nabla} \cdot \hat{g}]_{n,m,p}
= [\tilde{\partial}_x g^x]_{m,n,p} +
[\tilde{\partial}_y g^y]_{m,n,p} +
[\tilde{\partial}_z g^z]_{m,n,p}
\]</div>
<div class="arithmatex">\[
d_{n,m,p} = [\hat{\nabla} \cdot \tilde{g}]_{n,m,p}
= [\hat{\partial}_x g^x]_{m,n,p} +
[\hat{\partial}_y g^y]_{m,n,p} +
[\hat{\partial}_z g^z]_{m,n,p}
\]</div>
<p>or</p>
<div class="highlight"><pre><span></span><code>[code: divergences]
div_forward(g)[i,j,k] = Dx_forward(gx)[i, j, k] +
Dy_forward(gy)[i, j, k] +
Dz_forward(gz)[i, j, k]
= (gx[i + 1, j, k] - gx[i, j, k]) / dx[i] +
(gy[i, j + 1, k] - gy[i, j, k]) / dy[i] +
(gz[i, j, k + 1] - gz[i, j, k]) / dz[i]
div_back(g)[i,j,k] = Dx_back(gx)[i, j, k] +
Dy_back(gy)[i, j, k] +
Dz_back(gz)[i, j, k]
= (gx[i, j, k] - gx[i - 1, j, k]) / dx[i] +
(gy[i, j, k] - gy[i, j - 1, k]) / dy[i] +
(gz[i, j, k] - gz[i, j, k - 1]) / dz[i]
</code></pre></div>
<p>where <code>g = [gx, gy, gz]</code> is a fore- or back-vector field.</p>
<p>Since we applied the forward divergence to the back-vector (and vice-versa), the resulting scalar value
is defined at the back-vector's (fore-vector's) location <span class="arithmatex">\((m,n,p)\)</span> and not at the locations of its components
<span class="arithmatex">\((m \pm \frac{1}{2},n,p)\)</span> etc.</p>
<div class="highlight"><pre><span></span><code>[figure: divergence]
^^
(m-1/2, n+1/2, p+1/2) _____||_______ (m+1/2, n+1/2, p+1/2)
/: || ,, /|
/ : || // / | The divergence at (m, n, p) (the center
/ : // / | of this cube) of a fore-vector field
(m-1/2, n-1/2, p+1/2)/_____________/ | is the sum of the outward-pointing
| : | | fore-vector components, which are
z y &lt;==|== :.........|.====&gt; located at the face centers.
|/_x | / | /
| / // | / Note that in a nonuniform grid, each
|/ // || |/ dimension is normalized by the cell width.
(m-1/2, n-1/2, p-1/2)|____//_______| (m+1/2, n-1/2, p-1/2)
&#39;&#39; ||
VV
</code></pre></div>
<h4 id="meanas.fdmath--curls">Curls<a class="headerlink" href="#meanas.fdmath--curls" title="Permanent link">&para;</a></h4>
<p>The two curls are then</p>
<div class="arithmatex">\[
\begin{aligned}
\hat{h}_{m + \frac{1}{2}, n + \frac{1}{2}, p + \frac{1}{2}} &= \\
[\tilde{\nabla} \times \tilde{g}]_{m + \frac{1}{2}, n + \frac{1}{2}, p + \frac{1}{2}} &=
\vec{x} (\tilde{\partial}_y g^z_{m,n,p + \frac{1}{2}} - \tilde{\partial}_z g^y_{m,n + \frac{1}{2},p}) \\
&+ \vec{y} (\tilde{\partial}_z g^x_{m + \frac{1}{2},n,p} - \tilde{\partial}_x g^z_{m,n,p + \frac{1}{2}}) \\
&+ \vec{z} (\tilde{\partial}_x g^y_{m,n + \frac{1}{2},p} - \tilde{\partial}_y g^z_{m + \frac{1}{2},n,p})
\end{aligned}
\]</div>
<p>and</p>
<div class="arithmatex">\[
\tilde{h}_{m - \frac{1}{2}, n - \frac{1}{2}, p - \frac{1}{2}} =
[\hat{\nabla} \times \hat{g}]_{m - \frac{1}{2}, n - \frac{1}{2}, p - \frac{1}{2}}
\]</div>
<p>where <span class="arithmatex">\(\hat{g}\)</span> and <span class="arithmatex">\(\tilde{g}\)</span> are located at <span class="arithmatex">\((m,n,p)\)</span>
with components at <span class="arithmatex">\((m \pm \frac{1}{2},n,p)\)</span> etc.,
while <span class="arithmatex">\(\hat{h}\)</span> and <span class="arithmatex">\(\tilde{h}\)</span> are located at <span class="arithmatex">\((m \pm \frac{1}{2}, n \pm \frac{1}{2}, p \pm \frac{1}{2})\)</span>
with components at <span class="arithmatex">\((m, n \pm \frac{1}{2}, p \pm \frac{1}{2})\)</span> etc.</p>
<div class="highlight"><pre><span></span><code>[code: curls]
curl_forward(g)[i,j,k] = [Dy_forward(gz)[i, j, k] - Dz_forward(gy)[i, j, k],
Dz_forward(gx)[i, j, k] - Dx_forward(gz)[i, j, k],
Dx_forward(gy)[i, j, k] - Dy_forward(gx)[i, j, k]]
curl_back(g)[i,j,k] = [Dy_back(gz)[i, j, k] - Dz_back(gy)[i, j, k],
Dz_back(gx)[i, j, k] - Dx_back(gz)[i, j, k],
Dx_back(gy)[i, j, k] - Dy_back(gx)[i, j, k]]
</code></pre></div>
<p>For example, consider the forward curl, at (m, n, p), of a back-vector field <code>g</code>, defined
on a grid containing (m + 1/2, n + 1/2, p + 1/2).
The curl will be a fore-vector, so its z-component will be defined at (m, n, p + 1/2).
Take the nearest x- and y-components of <code>g</code> in the xy plane where the curl's z-component
is located; these are</p>
<div class="highlight"><pre><span></span><code>[curl components]
(m, n + 1/2, p + 1/2) : x-component of back-vector at (m + 1/2, n + 1/2, p + 1/2)
(m + 1, n + 1/2, p + 1/2) : x-component of back-vector at (m + 3/2, n + 1/2, p + 1/2)
(m + 1/2, n , p + 1/2) : y-component of back-vector at (m + 1/2, n + 1/2, p + 1/2)
(m + 1/2, n + 1 , p + 1/2) : y-component of back-vector at (m + 1/2, n + 3/2, p + 1/2)
</code></pre></div>
<p>These four xy-components can be used to form a loop around the curl's z-component; its magnitude and sign
is set by their loop-oriented sum (i.e. two have their signs flipped to complete the loop).</p>
<div class="highlight"><pre><span></span><code>[figure: z-component of curl]
: |
z y : ^^ |
|/_x :....||.&lt;.....| (m+1, n+1, p+1/2)
/ || /
| v || | ^
|/ |/
(m, n, p+1/2) |_____&gt;______| (m+1, n, p+1/2)
</code></pre></div>
<h3 id="meanas.fdmath--maxwells-equations">Maxwell's Equations<a class="headerlink" href="#meanas.fdmath--maxwells-equations" title="Permanent link">&para;</a></h3>
<p>If we discretize both space (m,n,p) and time (l), Maxwell's equations become</p>
<div class="arithmatex">\[
\begin{aligned}
\tilde{\nabla} \times \tilde{E}_{l,\vec{r}} &= -\tilde{\partial}_t \hat{B}_{l-\frac{1}{2}, \vec{r} + \frac{1}{2}}
- \hat{M}_{l, \vec{r} + \frac{1}{2}} \\
\hat{\nabla} \times \hat{H}_{l-\frac{1}{2},\vec{r} + \frac{1}{2}} &= \hat{\partial}_t \tilde{D}_{l, \vec{r}}
+ \tilde{J}_{l-\frac{1}{2},\vec{r}} \\
\tilde{\nabla} \cdot \hat{B}_{l-\frac{1}{2}, \vec{r} + \frac{1}{2}} &= 0 \\
\hat{\nabla} \cdot \tilde{D}_{l,\vec{r}} &= \rho_{l,\vec{r}}
\end{aligned}
\]</div>
<p>with</p>
<div class="arithmatex">\[
\begin{aligned}
\hat{B}_{\vec{r}} &= \mu_{\vec{r} + \frac{1}{2}} \cdot \hat{H}_{\vec{r} + \frac{1}{2}} \\
\tilde{D}_{\vec{r}} &= \epsilon_{\vec{r}} \cdot \tilde{E}_{\vec{r}}
\end{aligned}
\]</div>
<p>where the spatial subscripts are abbreviated as <span class="arithmatex">\(\vec{r} = (m, n, p)\)</span> and
<span class="arithmatex">\(\vec{r} + \frac{1}{2} = (m + \frac{1}{2}, n + \frac{1}{2}, p + \frac{1}{2})\)</span>,
<span class="arithmatex">\(\tilde{E}\)</span> and <span class="arithmatex">\(\hat{H}\)</span> are the electric and magnetic fields,
<span class="arithmatex">\(\tilde{J}\)</span> and <span class="arithmatex">\(\hat{M}\)</span> are the electric and magnetic current distributions,
and <span class="arithmatex">\(\epsilon\)</span> and <span class="arithmatex">\(\mu\)</span> are the dielectric permittivity and magnetic permeability.</p>
<p>The above is Yee's algorithm, written in a form analogous to Maxwell's equations.
The time derivatives can be expanded to form the update equations:</p>
<div class="highlight"><pre><span></span><code>[code: Maxwell&#39;s equations updates]
H[i, j, k] -= dt * (curl_forward(E)[i, j, k] + M[t, i, j, k]) / mu[i, j, k]
E[i, j, k] += dt * (curl_back( H)[i, j, k] + J[t, i, j, k]) / epsilon[i, j, k]
</code></pre></div>
<p>Note that the E-field fore-vector and H-field back-vector are offset by a half-cell, resulting
in distinct locations for all six E- and H-field components:</p>
<div class="highlight"><pre><span></span><code>[figure: Field components]
(m - 1/2,=&gt; ____________Hx__________[H] &lt;= r + 1/2 = (m + 1/2,
n + 1/2, /: /: /| n + 1/2,
z y p + 1/2) / : / : / | p + 1/2)
|/_x / : / : / |
/ : Ez__________Hy | Locations of the E- and
/ : : : /| | H-field components for the
(m - 1/2, / : : Ey...../.|..Hz [E] fore-vector at r = (m,n,p)
n - 1/2, =&gt;/________________________/ | /| (the large cube&#39;s center)
p + 1/2) | : : / | | / | and [H] back-vector at r + 1/2
| : :/ | |/ | (the top right corner)
| : [E].......|.Ex |
| :.................|......| &lt;= (m + 1/2, n + 1/2, p + 1/2)
| / | /
| / | /
| / | / This is the Yee discretization
| / | / scheme (&quot;Yee cell&quot;).
r - 1/2 = | / | /
(m - 1/2, |/ |/
n - 1/2,=&gt; |________________________| &lt;= (m + 1/2, n - 1/2, p - 1/2)
p - 1/2)
</code></pre></div>
<p>Each component forms its own grid, offset from the others:</p>
<div class="highlight"><pre><span></span><code>[figure: E-fields for adjacent cells]
H1__________Hx0_________H0
z y /: /|
|/_x / : / | This figure shows H back-vector locations
/ : / | H0, H1, etc. and their associated components
Hy1 : Hy0 | H0 = (Hx0, Hy0, Hz0) etc.
/ : / |
/ Hz1 / Hz0
H2___________Hx3_________H3 | The equivalent drawing for E would have
| : | | fore-vectors located at the cube&#39;s
| : | | center (and the centers of adjacent cubes),
| : | | with components on the cube&#39;s faces.
| H5..........Hx4...|......H4
| / | /
Hz2 / Hz2 /
| / | /
| Hy6 | Hy4
| / | /
|/ |/
H6__________Hx7__________H7
</code></pre></div>
<p>The divergence equations can be derived by taking the divergence of the curl equations
and combining them with charge continuity,
<div class="arithmatex">\[ \hat{\nabla} \cdot \tilde{J} + \hat{\partial}_t \rho = 0 \]</div></p>
<p>implying that the discrete Maxwell's equations do not produce spurious charges.</p>
<h4 id="meanas.fdmath--wave-equation">Wave equation<a class="headerlink" href="#meanas.fdmath--wave-equation" title="Permanent link">&para;</a></h4>
<p>Taking the backward curl of the <span class="arithmatex">\(\tilde{\nabla} \times \tilde{E}\)</span> equation and
replacing the resulting <span class="arithmatex">\(\hat{\nabla} \times \hat{H}\)</span> term using its respective equation,
and setting <span class="arithmatex">\(\hat{M}\)</span> to zero, we can form the discrete wave equation:</p>
<div class="arithmatex">\[
\begin{aligned}
\tilde{\nabla} \times \tilde{E}_{l,\vec{r}} &=
-\tilde{\partial}_t \hat{B}_{l-\frac{1}{2}, \vec{r} + \frac{1}{2}}
- \hat{M}_{l-1, \vec{r} + \frac{1}{2}} \\
\mu^{-1}_{\vec{r} + \frac{1}{2}} \cdot \tilde{\nabla} \times \tilde{E}_{l,\vec{r}} &=
-\tilde{\partial}_t \hat{H}_{l-\frac{1}{2}, \vec{r} + \frac{1}{2}} \\
\hat{\nabla} \times (\mu^{-1}_{\vec{r} + \frac{1}{2}} \cdot \tilde{\nabla} \times \tilde{E}_{l,\vec{r}}) &=
\hat{\nabla} \times (-\tilde{\partial}_t \hat{H}_{l-\frac{1}{2}, \vec{r} + \frac{1}{2}}) \\
\hat{\nabla} \times (\mu^{-1}_{\vec{r} + \frac{1}{2}} \cdot \tilde{\nabla} \times \tilde{E}_{l,\vec{r}}) &=
-\tilde{\partial}_t \hat{\nabla} \times \hat{H}_{l-\frac{1}{2}, \vec{r} + \frac{1}{2}} \\
\hat{\nabla} \times (\mu^{-1}_{\vec{r} + \frac{1}{2}} \cdot \tilde{\nabla} \times \tilde{E}_{l,\vec{r}}) &=
-\tilde{\partial}_t \hat{\partial}_t \epsilon_{\vec{r}} \tilde{E}_{l, \vec{r}} + \hat{\partial}_t \tilde{J}_{l-\frac{1}{2},\vec{r}} \\
\hat{\nabla} \times (\mu^{-1}_{\vec{r} + \frac{1}{2}} \cdot \tilde{\nabla} \times \tilde{E}_{l,\vec{r}})
+ \tilde{\partial}_t \hat{\partial}_t \epsilon_{\vec{r}} \cdot \tilde{E}_{l, \vec{r}}
&= \tilde{\partial}_t \tilde{J}_{l - \frac{1}{2}, \vec{r}}
\end{aligned}
\]</div>
<h4 id="meanas.fdmath--frequency-domain">Frequency domain<a class="headerlink" href="#meanas.fdmath--frequency-domain" title="Permanent link">&para;</a></h4>
<p>We can substitute in a time-harmonic fields</p>
<div class="arithmatex">\[
\begin{aligned}
\tilde{E}_{l, \vec{r}} &= \tilde{E}_{\vec{r}} e^{-\imath \omega l \Delta_t} \\
\tilde{J}_{l, \vec{r}} &= \tilde{J}_{\vec{r}} e^{-\imath \omega (l - \frac{1}{2}) \Delta_t}
\end{aligned}
\]</div>
<p>resulting in</p>
<div class="arithmatex">\[
\begin{aligned}
\tilde{\partial}_t &\Rightarrow (e^{ \imath \omega \Delta_t} - 1) / \Delta_t = \frac{-2 \imath}{\Delta_t} \sin(\omega \Delta_t / 2) e^{-\imath \omega \Delta_t / 2} = -\imath \Omega e^{-\imath \omega \Delta_t / 2}\\
\hat{\partial}_t &\Rightarrow (1 - e^{-\imath \omega \Delta_t}) / \Delta_t = \frac{-2 \imath}{\Delta_t} \sin(\omega \Delta_t / 2) e^{ \imath \omega \Delta_t / 2} = -\imath \Omega e^{ \imath \omega \Delta_t / 2}\\
\Omega &= 2 \sin(\omega \Delta_t / 2) / \Delta_t
\end{aligned}
\]</div>
<p>This gives the frequency-domain wave equation,</p>
<div class="arithmatex">\[
\hat{\nabla} \times (\mu^{-1}_{\vec{r} + \frac{1}{2}} \cdot \tilde{\nabla} \times \tilde{E}_{\vec{r}})
-\Omega^2 \epsilon_{\vec{r}} \cdot \tilde{E}_{\vec{r}} = -\imath \Omega \tilde{J}_{\vec{r}} e^{\imath \omega \Delta_t / 2} \\
\]</div>
<h4 id="meanas.fdmath--plane-waves-and-dispersion-relation">Plane waves and Dispersion relation<a class="headerlink" href="#meanas.fdmath--plane-waves-and-dispersion-relation" title="Permanent link">&para;</a></h4>
<p>With uniform material distribution and no sources</p>
<div class="arithmatex">\[
\begin{aligned}
\mu_{\vec{r} + \frac{1}{2}} &= \mu \\
\epsilon_{\vec{r}} &= \epsilon \\
\tilde{J}_{\vec{r}} &= 0 \\
\end{aligned}
\]</div>
<p>the frequency domain wave equation simplifies to</p>
<div class="arithmatex">\[ \hat{\nabla} \times \tilde{\nabla} \times \tilde{E}_{\vec{r}} - \Omega^2 \epsilon \mu \tilde{E}_{\vec{r}} = 0 \]</div>
<p>Since <span class="arithmatex">\(\hat{\nabla} \cdot \tilde{E}_{\vec{r}} = 0\)</span>, we can simplify</p>
<div class="arithmatex">\[
\begin{aligned}
\hat{\nabla} \times \tilde{\nabla} \times \tilde{E}_{\vec{r}}
&= \tilde{\nabla}(\hat{\nabla} \cdot \tilde{E}_{\vec{r}}) - \hat{\nabla} \cdot \tilde{\nabla} \tilde{E}_{\vec{r}} \\
&= - \hat{\nabla} \cdot \tilde{\nabla} \tilde{E}_{\vec{r}} \\
&= - \tilde{\nabla}^2 \tilde{E}_{\vec{r}}
\end{aligned}
\]</div>
<p>and we get</p>
<div class="arithmatex">\[ \tilde{\nabla}^2 \tilde{E}_{\vec{r}} + \Omega^2 \epsilon \mu \tilde{E}_{\vec{r}} = 0 \]</div>
<p>We can convert this to three scalar-wave equations of the form</p>
<div class="arithmatex">\[ (\tilde{\nabla}^2 + K^2) \phi_{\vec{r}} = 0 \]</div>
<p>with <span class="arithmatex">\(K^2 = \Omega^2 \mu \epsilon\)</span>. Now we let</p>
<div class="arithmatex">\[ \phi_{\vec{r}} = A e^{\imath (k_x m \Delta_x + k_y n \Delta_y + k_z p \Delta_z)} \]</div>
<p>resulting in</p>
<div class="arithmatex">\[
\begin{aligned}
\tilde{\partial}_x &\Rightarrow (e^{ \imath k_x \Delta_x} - 1) / \Delta_t = \frac{-2 \imath}{\Delta_x} \sin(k_x \Delta_x / 2) e^{ \imath k_x \Delta_x / 2} = \imath K_x e^{ \imath k_x \Delta_x / 2}\\
\hat{\partial}_x &\Rightarrow (1 - e^{-\imath k_x \Delta_x}) / \Delta_t = \frac{-2 \imath}{\Delta_x} \sin(k_x \Delta_x / 2) e^{-\imath k_x \Delta_x / 2} = \imath K_x e^{-\imath k_x \Delta_x / 2}\\
K_x &= 2 \sin(k_x \Delta_x / 2) / \Delta_x \\
\end{aligned}
\]</div>
<p>with similar expressions for the y and z dimnsions (and <span class="arithmatex">\(K_y, K_z\)</span>).</p>
<p>This implies</p>
<div class="arithmatex">\[
\tilde{\nabla}^2 = -(K_x^2 + K_y^2 + K_z^2) \phi_{\vec{r}} \\
K_x^2 + K_y^2 + K_z^2 = \Omega^2 \mu \epsilon = \Omega^2 / c^2
\]</div>
<p>where <span class="arithmatex">\(c = \sqrt{\mu \epsilon}\)</span>.</p>
<p>Assuming real <span class="arithmatex">\((k_x, k_y, k_z), \omega\)</span> will be real only if</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>If <span class="arithmatex">\(\Delta_x = \Delta_y = \Delta_z\)</span>, this simplifies to <span class="arithmatex">\(c \Delta_t &lt; \Delta_x / \sqrt{3}\)</span>.
This last form can be interpreted as enforcing causality; the distance that light
travels in one timestep (i.e., <span class="arithmatex">\(c \Delta_t\)</span>) must be less than the diagonal
of the smallest cell ( <span class="arithmatex">\(\Delta_x / \sqrt{3}\)</span> when on a uniform cubic grid).</p>
<h3 id="meanas.fdmath--grid-description">Grid description<a class="headerlink" href="#meanas.fdmath--grid-description" title="Permanent link">&para;</a></h3>
<p>As described in the section on scalar discrete derivatives above, cell widths
(<code>dx[i]</code>, <code>dy[j]</code>, <code>dz[k]</code>) along each axis can be arbitrary and independently
defined. Moreover, all field components are actually defined at "derived" or "dual"
positions, in-between the "base" grid points on one or more axes.</p>
<p>To get a better sense of how this works, let's start by drawing a grid with uniform
<code>dy</code> and <code>dz</code> and nonuniform <code>dx</code>. We will only draw one cell in the y and z dimensions
to make the illustration simpler; we need at least two cells in the x dimension to
demonstrate how nonuniform <code>dx</code> affects the various components.</p>
<p>Place the E fore-vectors at integer indices <span class="arithmatex">\(r = (m, n, p)\)</span> and the H back-vectors
at fractional indices <span class="arithmatex">\(r + \frac{1}{2} = (m + \frac{1}{2}, n + \frac{1}{2},
p + \frac{1}{2})\)</span>. Remember that these are indices and not coordinates; they can
correspond to arbitrary (monotonically increasing) coordinates depending on the cell widths.</p>
<p>Draw lines to denote the planes on which the H components and back-vectors are defined.
For simplicity, don't draw the equivalent planes for the E components and fore-vectors,
except as necessary to show their locations -- it's easiest to just connect them to their
associated H-equivalents.</p>
<p>The result looks something like this:</p>
<div class="highlight"><pre><span></span><code>[figure: Component centers]
p=
[H]__________Hx___________[H]_____Hx______[H] __ +1/2
z y /: /: /: /: /| | |
|/_x / : / : / : / : / | | |
/ : / : / : / : / | | |
Hy : Ez...........Hy : Ez......Hy | | |
/: : : : /: : : : /| | | |
/ : Hz : Ey....../.:..Hz : Ey./.|..Hz __ 0 | dz[0]
/ : /: : / / : /: : / / | /| | |
/_________________________/_______________/ | / | | |
| :/ : :/ | :/ : :/ | |/ | | |
| Ex : [E].......|..Ex : [E]..|..Ex | | |
| : | : | | | |
| [H]..........Hx....|......[H].....H|x.....[H] __ --------- (n=+1/2, p=-1/2)
| / | / | / / /
Hz / Hz / Hz / / /
| / | / | / / /
| Hy | Hy | Hy __ 0 / dy[0]
| / | / | / / /
| / | / | / / /
|/ |/ |/ / /
[H]__________Hx___________[H]_____Hx______[H] __ -1/2 /
=n
|------------|------------|-------|-------|
-1/2 0 +1/2 +1 +3/2 = m
------------------------- ----------------
dx[0] dx[1]
Part of a nonuniform &quot;base grid&quot;, with labels specifying
positions of the various field components. [E] fore-vectors
are at the cell centers, and [H] back-vectors are at the
vertices. H components along the near (-y) top (+z) edge
have been omitted to make the insides of the cubes easier
to visualize.
</code></pre></div>
<p>The above figure shows where all the components are located; however, it is also useful to show
what volumes those components correspond to. Consider the Ex component at <code>m = +1/2</code>: it is
shifted in the x-direction by a half-cell from the E fore-vector at <code>m = 0</code> (labeled <code>[E]</code>
in the figure). It corresponds to a volume between <code>m = 0</code> and <code>m = +1</code> (the other
dimensions are not shifted, i.e. they are still bounded by <code>n, p = +-1/2</code>). (See figure
below). Since <code>m</code> is an index and not an x-coordinate, the Ex component is not necessarily
at the center of the volume it represents, and the x-length of its volume is the derived
quantity <code>dx'[0] = (dx[0] + dx[1]) / 2</code> rather than the base <code>dx</code>.
(See also <code>Scalar derivatives and cell shifts</code>).</p>
<div class="highlight"><pre><span></span><code>[figure: Ex volumes]
p=
&lt;_________________________________________&gt; __ +1/2
z y &lt;&lt; /: / /: &gt;&gt; | |
|/_x &lt; &lt; / : / / : &gt; &gt; | |
&lt; &lt; / : / / : &gt; &gt; | |
&lt; &lt; / : / / : &gt; &gt; | |
&lt;: &lt; / : : / : &gt;: &gt; | |
&lt; : &lt; / : : / : &gt; : &gt; __ 0 | dz[0]
&lt; : &lt; / : : / :&gt; : &gt; | |
&lt;____________/____________________/_______&gt; : &gt; | |
&lt; : &lt; | : : | &gt; : &gt; | |
&lt; Ex &lt; | : Ex | &gt; Ex &gt; | |
&lt; : &lt; | : : | &gt; : &gt; | |
&lt; : &lt;....|.......:........:...|.......&gt;...:...&gt; __ --------- (n=+1/2, p=-1/2)
&lt; : &lt; | / : /| /&gt; : &gt; / /
&lt; : &lt; | / : / | / &gt; : &gt; / /
&lt; :&lt; | / :/ | / &gt; :&gt; / /
&lt; &lt; | / : | / &gt; &gt; _ 0 / dy[0]
&lt; &lt; | / | / &gt; &gt; / /
&lt; &lt; | / | / &gt; &gt; / /
&lt;&lt; |/ |/ &gt;&gt; / /
&lt;____________|____________________|_______&gt; __ -1/2 /
=n
|------------|------------|-------|-------|
-1/2 0 +1/2 +1 +3/2 = m
~------------ -------------------- -------~
dx&#39;[-1] dx&#39;[0] dx&#39;[1]
The Ex values are positioned on the x-faces of the base
grid. They represent the Ex field in volumes shifted by
a half-cell in the x-dimension, as shown here. Only the
center cell (with width dx&#39;[0]) is fully shown; the
other two are truncated (shown using &gt;&lt; markers).
Note that the Ex positions are the in the same positions
as the previous figure; only the cell boundaries have moved.
Also note that the points at which Ex is defined are not
necessarily centered in the volumes they represent; non-
uniform cell sizes result in off-center volumes like the
center cell here.
</code></pre></div>
<p>The next figure shows the volumes corresponding to the Hy components, which
are shifted in two dimensions (x and z) compared to the base grid.</p>
<div class="highlight"><pre><span></span><code>[figure: Hy volumes]
p=
z y mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm __ +1/2 s
|/_x &lt;&lt; m: m: &gt;&gt; | |
&lt; &lt; m : m : &gt; &gt; | | dz&#39;[1]
&lt; &lt; m : m : &gt; &gt; | |
Hy........... m........Hy...........m......Hy &gt; | |
&lt; &lt; m : m : &gt; &gt; | |
&lt; ______ m_____:_______________m_____:_&gt;______ __ 0
&lt; &lt; m /: m / &gt; &gt; | |
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm &gt; | |
&lt; &lt; | / : | / &gt; &gt; | | dz&#39;[0]
&lt; &lt; | / : | / &gt; &gt; | |
&lt; &lt; | / : | / &gt; &gt; | |
&lt; wwwww|w/wwwwwwwwwwwwwwwwwww|w/wwwww&gt;wwwwwwww __ s
&lt; &lt; |/ w |/ w&gt; &gt; / /
_____________|_____________________|________ &gt; / /
&lt; &lt; | w | w &gt; &gt; / /
&lt; Hy........|...w........Hy.......|...w...&gt;..Hy _ 0 / dy[0]
&lt; &lt; | w | w &gt; &gt; / /
&lt;&lt; | w | w &gt; &gt; / /
&lt; |w |w &gt;&gt; / /
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww __ -1/2 /
|------------|------------|--------|-------|
-1/2 0 +1/2 +1 +3/2 = m
~------------ --------------------- -------~
dx&#39;[-1] dx&#39;[0] dx&#39;[1]
The Hy values are positioned on the y-edges of the base
grid. Again here, the &#39;Hy&#39; labels represent the same points
as in the basic grid figure above; the edges have shifted
by a half-cell along the x- and z-axes.
The grid lines _|:/ are edges of the area represented by
each Hy value, and the lines drawn using &lt;m&gt;.w represent
edges where a cell&#39;s faces extend beyond the drawn area
(i.e. where the drawing is truncated in the x- or z-
directions).
</code></pre></div>
<h4 id="meanas.fdmath--datastructure-dx_lists_t">Datastructure: dx_lists_t<a class="headerlink" href="#meanas.fdmath--datastructure-dx_lists_t" title="Permanent link">&para;</a></h4>
<p>In this documentation, the E fore-vectors are placed on the base grid. An
equivalent formulation could place the H back-vectors on the base grid instead.
However, in the case of a non-uniform grid, the operation to get from the "base"
cell widths to "derived" ones is not its own inverse.</p>
<p>The base grid's cell sizes could be fully described by a list of three 1D arrays,
specifying the cell widths along all three axes:</p>
<div class="highlight"><pre><span></span><code>[dx, dy, dz] = [[dx[0], dx[1], ...], [dy[0], ...], [dz[0], ...]]
</code></pre></div>
<p>Note that this is a list-of-arrays rather than a 2D array, as the simulation domain
may have a different number of cells along each axis.</p>
<p>Knowing the base grid's cell widths and the boundary conditions (periodic unless
otherwise noted) is enough information to calculate the cell widths <code>dx'</code>, <code>dy'</code>,
and <code>dz'</code> for the derived grids.</p>
<p>However, since most operations are trivially generalized to allow either E or H
to be defined on the base grid, they are written to take the a full set of base
and derived cell widths, distinguished by which field they apply to rather than
their "base" or "derived" status. This removes the need for each function to
generate the derived widths, and makes the "base" vs "derived" distinction
unnecessary in the code.</p>
<p>The resulting data structure containing all the cell widths takes the form of a
list-of-lists-of-arrays. The first list-of-arrays provides the cell widths for
the E-field fore-vectors, while the second list-of-arrays does the same for the
H-field back-vectors:</p>
<div class="highlight"><pre><span></span><code> [[[dx_e[0], dx_e[1], ...], [dy_e[0], ...], [dz_e[0], ...]],
[[dx_h[0], dx_h[1], ...], [dy_h[0], ...], [dz_h[0], ...]]]
</code></pre></div>
<p>where <code>dx_e[0]</code> is the x-width of the <code>m=0</code> cells, as used when calculating dE/dx,
and <code>dy_h[0]</code> is the y-width of the <code>n=0</code> cells, as used when calculating dH/dy, etc.</p>
<h3 id="meanas.fdmath--permittivity-and-permeability">Permittivity and Permeability<a class="headerlink" href="#meanas.fdmath--permittivity-and-permeability" title="Permanent link">&para;</a></h3>
<p>Since each vector component of E and H is defined in a different location and represents
a different volume, the value of the spatially-discrete <code>epsilon</code> and <code>mu</code> can also be
different for all three field components, even when representing a simple planar interface
between two isotropic materials.</p>
<p>As a result, <code>epsilon</code> and <code>mu</code> are taken to have the same dimensions as the field, and
composed of the three diagonal tensor components:</p>
<div class="highlight"><pre><span></span><code>[equations: epsilon_and_mu]
epsilon = [epsilon_xx, epsilon_yy, epsilon_zz]
mu = [mu_xx, mu_yy, mu_zz]
</code></pre></div>
<p>or</p>
<div class="arithmatex">\[
\epsilon = \begin{bmatrix} \epsilon_{xx} & 0 & 0 \\
0 & \epsilon_{yy} & 0 \\
0 & 0 & \epsilon_{zz} \end{bmatrix}
\]</div>
<div class="arithmatex">\[
\mu = \begin{bmatrix} \mu_{xx} & 0 & 0 \\
0 & \mu_{yy} & 0 \\
0 & 0 & \mu_{zz} \end{bmatrix}
\]</div>
<p>where the off-diagonal terms (e.g. <code>epsilon_xy</code>) are assumed to be zero.</p>
<p>High-accuracy volumetric integration of shapes on multiple grids can be performed
by the <a href="https://mpxd.net/code/jan/gridlock">gridlock</a> module.</p>
<p>The values of the vacuum permittivity and permability effectively become scaling
factors that appear in several locations (e.g. between the E and H fields). In
order to limit floating-point inaccuracy and simplify calculations, they are often
set to 1 and relative permittivities and permeabilities are used in their places;
the true values can be multiplied back in after the simulation is complete if non-
normalized results are needed.</p>
<div class="doc doc-children">
</div>
</div>
</div><h2 id="functional-and-sparse-operators">Functional and sparse operators<a class="headerlink" href="#functional-and-sparse-operators" title="Permanent link">&para;</a></h2>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdmath.functional" 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.fdmath.functional</span>
<a href="#meanas.fdmath.functional" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Math functions for finite difference simulations</p>
<p>Basic discrete calculus etc.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.functional.deriv_forward" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">deriv_forward</span>
<a href="#meanas.fdmath.functional.deriv_forward" 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">deriv_forward</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dx_e</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">tuple</span><span class="p">[</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">fdfield_updater_t</span><span class="p">,</span> <span class="n">fdfield_updater_t</span><span class="p">,</span> <span class="n">fdfield_updater_t</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Utility operators for taking discretized derivatives (backward variant).</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>dx_e</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="numpy.typing.NDArray">NDArray</span>[<span title="numpy.floating">floating</span> | <span title="numpy.complexfloating">complexfloating</span>]] | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Lists of cell sizes for all axes
<code>[[dx_0, dx_1, ...], [dy_0, dy_1, ...], ...]</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="tuple">tuple</span>[<a class="autorefs autorefs-internal" title=" fdfield_updater_t
module-attribute
(meanas.fdmath.types.fdfield_updater_t)" href="#meanas.fdmath.types.fdfield_updater_t">fdfield_updater_t</a>, <a class="autorefs autorefs-internal" title=" fdfield_updater_t
module-attribute
(meanas.fdmath.types.fdfield_updater_t)" href="#meanas.fdmath.types.fdfield_updater_t">fdfield_updater_t</a>, <a class="autorefs autorefs-internal" title=" fdfield_updater_t
module-attribute
(meanas.fdmath.types.fdfield_updater_t)" href="#meanas.fdmath.types.fdfield_updater_t">fdfield_updater_t</a>]</code>
</td>
<td>
<div class="doc-md-description">
<p>List of functions for taking forward derivatives along each axis.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.functional.deriv_back" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">deriv_back</span>
<a href="#meanas.fdmath.functional.deriv_back" 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">deriv_back</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dx_h</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">tuple</span><span class="p">[</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">fdfield_updater_t</span><span class="p">,</span> <span class="n">fdfield_updater_t</span><span class="p">,</span> <span class="n">fdfield_updater_t</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Utility operators for taking discretized derivatives (forward variant).</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>dx_h</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="numpy.typing.NDArray">NDArray</span>[<span title="numpy.floating">floating</span> | <span title="numpy.complexfloating">complexfloating</span>]] | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Lists of cell sizes for all axes
<code>[[dx_0, dx_1, ...], [dy_0, dy_1, ...], ...]</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="tuple">tuple</span>[<a class="autorefs autorefs-internal" title=" fdfield_updater_t
module-attribute
(meanas.fdmath.types.fdfield_updater_t)" href="#meanas.fdmath.types.fdfield_updater_t">fdfield_updater_t</a>, <a class="autorefs autorefs-internal" title=" fdfield_updater_t
module-attribute
(meanas.fdmath.types.fdfield_updater_t)" href="#meanas.fdmath.types.fdfield_updater_t">fdfield_updater_t</a>, <a class="autorefs autorefs-internal" title=" fdfield_updater_t
module-attribute
(meanas.fdmath.types.fdfield_updater_t)" href="#meanas.fdmath.types.fdfield_updater_t">fdfield_updater_t</a>]</code>
</td>
<td>
<div class="doc-md-description">
<p>List of functions for taking forward derivatives along each axis.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.functional.curl_forward" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">curl_forward</span>
<a href="#meanas.fdmath.functional.curl_forward" 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">curl_forward</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dx_e</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Callable</span><span class="p">[[</span><span class="n">TT</span><span class="p">],</span> <span class="n">TT</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Curl operator for use with the E field.</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>dx_e</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="numpy.typing.NDArray">NDArray</span>[<span title="numpy.floating">floating</span> | <span title="numpy.complexfloating">complexfloating</span>]] | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Lists of cell sizes for all axes
<code>[[dx_0, dx_1, ...], [dy_0, dy_1, ...], ...]</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="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.functional.TT">TT</span>], <span title="meanas.fdmath.functional.TT">TT</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>Function <code>f</code> for taking the discrete forward curl of a field,</p>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.functional.TT">TT</span>], <span title="meanas.fdmath.functional.TT">TT</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p><code>f(E)</code> -&gt; curlE <span class="arithmatex">\(= \nabla_f \times E\)</span></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.functional.curl_back" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">curl_back</span>
<a href="#meanas.fdmath.functional.curl_back" 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">curl_back</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dx_h</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Callable</span><span class="p">[[</span><span class="n">TT</span><span class="p">],</span> <span class="n">TT</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Create a function which takes the backward curl of a field.</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>dx_h</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="numpy.typing.NDArray">NDArray</span>[<span title="numpy.floating">floating</span> | <span title="numpy.complexfloating">complexfloating</span>]] | None</code>
</td>
<td>
<div class="doc-md-description">
<p>Lists of cell sizes for all axes
<code>[[dx_0, dx_1, ...], [dy_0, dy_1, ...], ...]</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="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.functional.TT">TT</span>], <span title="meanas.fdmath.functional.TT">TT</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>Function <code>f</code> for taking the discrete backward curl of a field,</p>
</div>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code><span title="collections.abc.Callable">Callable</span>[[<span title="meanas.fdmath.functional.TT">TT</span>], <span title="meanas.fdmath.functional.TT">TT</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p><code>f(H)</code> -&gt; curlH <span class="arithmatex">\(= \nabla_b \times H\)</span></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdmath.operators" 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.fdmath.operators</span>
<a href="#meanas.fdmath.operators" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Matrix operators for finite difference simulations</p>
<p>Basic discrete calculus etc.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.shift_circ" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">shift_circ</span>
<a href="#meanas.fdmath.operators.shift_circ" 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">shift_circ</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> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">shift_distance</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</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">sparse</span><span class="o">.</span><span class="n">sparray</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Utility operator for performing a circular shift along a specified axis by a
specified number of elements.</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>Axis to shift along. x=0, y=1, z=2</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>shape</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="int">int</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>Shape of the grid being shifted</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>shift_distance</code>
</td>
<td>
<code><span title="int">int</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Number of cells to shift by. May be negative. Default 1.</p>
</div>
</td>
<td>
<code>1</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="scipy.sparse.sparray">sparray</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Sparse matrix for performing the circular shift.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.shift_with_mirror" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">shift_with_mirror</span>
<a href="#meanas.fdmath.operators.shift_with_mirror" 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">shift_with_mirror</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> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">shift_distance</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</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">sparse</span><span class="o">.</span><span class="n">sparray</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Utility operator for performing an n-element shift along a specified axis, with mirror
boundary conditions applied to the cells beyond the receding edge.</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>Axis to shift along. x=0, y=1, z=2</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>shape</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="int">int</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>Shape of the grid being shifted</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>shift_distance</code>
</td>
<td>
<code><span title="int">int</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Number of cells to shift by. May be negative. Default 1.</p>
</div>
</td>
<td>
<code>1</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="scipy.sparse.sparray">sparray</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Sparse matrix for performing the shift-with-mirror.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.deriv_forward" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">deriv_forward</span>
<a href="#meanas.fdmath.operators.deriv_forward" 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">deriv_forward</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dx_e</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="p">)</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">[</span><span class="n">sparse</span><span class="o">.</span><span class="n">sparray</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Utility operators for taking discretized derivatives (forward variant).</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>dx_e</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="numpy.typing.NDArray">NDArray</span>[<span title="numpy.floating">floating</span> | <span title="numpy.complexfloating">complexfloating</span>]]</code>
</td>
<td>
<div class="doc-md-description">
<p>Lists of cell sizes for all axes
<code>[[dx_0, dx_1, ...], [dy_0, dy_1, ...], ...]</code>.</p>
</div>
</td>
<td>
<em>required</em>
</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="list">list</span>[<span title="scipy.sparse.sparray">sparray</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>List of operators for taking forward derivatives along each axis.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.deriv_back" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">deriv_back</span>
<a href="#meanas.fdmath.operators.deriv_back" 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">deriv_back</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dx_h</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="p">)</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">[</span><span class="n">sparse</span><span class="o">.</span><span class="n">sparray</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Utility operators for taking discretized derivatives (backward variant).</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>dx_h</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="numpy.typing.NDArray">NDArray</span>[<span title="numpy.floating">floating</span> | <span title="numpy.complexfloating">complexfloating</span>]]</code>
</td>
<td>
<div class="doc-md-description">
<p>Lists of cell sizes for all axes
<code>[[dx_0, dx_1, ...], [dy_0, dy_1, ...], ...]</code>.</p>
</div>
</td>
<td>
<em>required</em>
</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="list">list</span>[<span title="scipy.sparse.sparray">sparray</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>List of operators for taking forward derivatives along each axis.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.cross" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">cross</span>
<a href="#meanas.fdmath.operators.cross" 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">cross</span><span class="p">(</span><span class="n">B</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">sparray</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="n">sparse</span><span class="o">.</span><span class="n">sparray</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Cross product operator</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>B</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="scipy.sparse.sparray">sparray</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>List <code>[Bx, By, Bz]</code> of sparse matrices corresponding to the x, y, z
portions of the operator on the left side of the cross product.</p>
</div>
</td>
<td>
<em>required</em>
</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="scipy.sparse.sparray">sparray</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Sparse matrix corresponding to (B x), where x is the cross product.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.vec_cross" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">vec_cross</span>
<a href="#meanas.fdmath.operators.vec_cross" 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">vec_cross</span><span class="p">(</span><span class="n">b</span><span class="p">:</span> <span class="n">vfdfield</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">sparse</span><span class="o">.</span><span class="n">sparray</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Vector cross product operator</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>b</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title=" vfdfield (meanas.fdmath.types.vfdfield)" href="#meanas.fdmath.types.vfdfield">vfdfield</a></code>
</td>
<td>
<div class="doc-md-description">
<p>Vector on the left side of the cross product.</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
</tbody>
</table>
<p>Returns:</p>
<div class="highlight"><pre><span></span><code>Sparse matrix corresponding to (b x), where x is the cross product.
</code></pre></div>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.avg_forward" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">avg_forward</span>
<a href="#meanas.fdmath.operators.avg_forward" 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">avg_forward</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> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</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="p">)</span> <span class="o">-&gt;</span> <span class="n">sparse</span><span class="o">.</span><span class="n">sparray</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Forward average operator <code>(x4 = (x4 + x5) / 2)</code></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>Axis to average along (x=0, y=1, z=2)</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>shape</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="int">int</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>Shape of the grid to average</p>
</div>
</td>
<td>
<em>required</em>
</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="scipy.sparse.sparray">sparray</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Sparse matrix for forward average operation.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.avg_back" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">avg_back</span>
<a href="#meanas.fdmath.operators.avg_back" 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">avg_back</span><span class="p">(</span><span class="n">axis</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="n">sparse</span><span class="o">.</span><span class="n">sparray</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Backward average operator <code>(x4 = (x4 + x3) / 2)</code></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>Axis to average along (x=0, y=1, z=2)</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>shape</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="int">int</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>Shape of the grid to average</p>
</div>
</td>
<td>
<em>required</em>
</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="scipy.sparse.sparray">sparray</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Sparse matrix for backward average operation.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.curl_forward" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">curl_forward</span>
<a href="#meanas.fdmath.operators.curl_forward" 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">curl_forward</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dx_e</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="p">)</span> <span class="o">-&gt;</span> <span class="n">sparse</span><span class="o">.</span><span class="n">sparray</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Curl operator for use with the E field.</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>dx_e</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="numpy.typing.NDArray">NDArray</span>[<span title="numpy.floating">floating</span> | <span title="numpy.complexfloating">complexfloating</span>]]</code>
</td>
<td>
<div class="doc-md-description">
<p>Lists of cell sizes for all axes
<code>[[dx_0, dx_1, ...], [dy_0, dy_1, ...], ...]</code>.</p>
</div>
</td>
<td>
<em>required</em>
</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="scipy.sparse.sparray">sparray</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Sparse matrix for taking the discretized curl of the E-field</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.operators.curl_back" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">curl_back</span>
<a href="#meanas.fdmath.operators.curl_back" 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">curl_back</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">dx_h</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="p">)</span> <span class="o">-&gt;</span> <span class="n">sparse</span><span class="o">.</span><span class="n">sparray</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Curl operator for use with the H field.</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>dx_h</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="numpy.typing.NDArray">NDArray</span>[<span title="numpy.floating">floating</span> | <span title="numpy.complexfloating">complexfloating</span>]]</code>
</td>
<td>
<div class="doc-md-description">
<p>Lists of cell sizes for all axes
<code>[[dx_0, dx_1, ...], [dy_0, dy_1, ...], ...]</code>.</p>
</div>
</td>
<td>
<em>required</em>
</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="scipy.sparse.sparray">sparray</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Sparse matrix for taking the discretized curl of the H-field</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdmath.vectorization" 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.fdmath.vectorization</span>
<a href="#meanas.fdmath.vectorization" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Functions for moving between a vector field (list of 3 ndarrays, <code>[f_x, f_y, f_z]</code>)
and a 1D array representation of that field <code>[f_x0, f_x1, f_x2,... f_y0,... f_z0,...]</code>.
Vectorized versions of the field use row-major (ie., C-style) ordering.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.vectorization.vec" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">vec</span>
<a href="#meanas.fdmath.vectorization.vec" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-overloads">
<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">vec</span><span class="p">(</span><span class="n">f</span><span class="p">:</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span>
</code></pre></div><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">vec</span><span class="p">(</span><span class="n">f</span><span class="p">:</span> <span class="n">fdfield_t</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">vfdfield_t</span>
</code></pre></div><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">vec</span><span class="p">(</span><span class="n">f</span><span class="p">:</span> <span class="n">cfdfield_t</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">vcfdfield_t</span>
</code></pre></div><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">vec</span><span class="p">(</span><span class="n">f</span><span class="p">:</span> <span class="n">fdfield2_t</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">vfdfield2_t</span>
</code></pre></div><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">vec</span><span class="p">(</span><span class="n">f</span><span class="p">:</span> <span class="n">cfdfield2_t</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">vcfdfield2_t</span>
</code></pre></div><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">vec</span><span class="p">(</span><span class="n">f</span><span class="p">:</span> <span class="n">fdslice_t</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">vfdslice_t</span>
</code></pre></div><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">vec</span><span class="p">(</span><span class="n">f</span><span class="p">:</span> <span class="n">cfdslice_t</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">vcfdslice_t</span>
</code></pre></div><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">vec</span><span class="p">(</span><span class="n">f</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">NDArray</span>
</code></pre></div> </div>
<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">vec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">f</span><span class="p">:</span> <span class="n">fdfield_t</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="o">|</span> <span class="n">cfdfield_t</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="n">fdfield2_t</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">cfdfield2_t</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">fdslice_t</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="o">|</span> <span class="n">cfdslice_t</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="o">|</span> <span class="n">ArrayLike</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <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="p">(</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="n">vfdfield_t</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a> <span class="o">|</span> <span class="n">vcfdfield_t</span>
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a> <span class="o">|</span> <span class="n">vfdfield2_t</span>
<a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a> <span class="o">|</span> <span class="n">vcfdfield2_t</span>
<a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a> <span class="o">|</span> <span class="n">vfdslice_t</span>
<a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a> <span class="o">|</span> <span class="n">vcfdslice_t</span>
<a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a> <span class="o">|</span> <span class="n">NDArray</span>
<a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a> <span class="o">|</span> <span class="kc">None</span>
<a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a><span class="p">)</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Create a 1D ndarray from a vector field which spans a 1-3D region.</p>
<p>Returns <code>None</code> if called with <code>f=None</code>.</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>f</code>
</td>
<td>
<code><span title="meanas.fdmath.types.fdfield_t">fdfield_t</span> | <span title="meanas.fdmath.types.cfdfield_t">cfdfield_t</span> | <span title="meanas.fdmath.types.fdfield2_t">fdfield2_t</span> | <span title="meanas.fdmath.types.cfdfield2_t">cfdfield2_t</span> | <span title="meanas.fdmath.types.fdslice_t">fdslice_t</span> | <span title="meanas.fdmath.types.cfdslice_t">cfdslice_t</span> | <span title="numpy.typing.ArrayLike">ArrayLike</span> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>A vector field, e.g. <code>[f_x, f_y, f_z]</code> where each <code>f_</code> component is a 1- to
3-D ndarray (<code>f_*</code> should all be the same size). Doesn't fail with <code>f=None</code>.</p>
</div>
</td>
<td>
<em>required</em>
</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.types.vfdfield_t">vfdfield_t</span> | <span title="meanas.fdmath.types.vcfdfield_t">vcfdfield_t</span> | <span title="meanas.fdmath.types.vfdfield2_t">vfdfield2_t</span> | <span title="meanas.fdmath.types.vcfdfield2_t">vcfdfield2_t</span> | <span title="meanas.fdmath.types.vfdslice_t">vfdslice_t</span> | <span title="meanas.fdmath.types.vcfdslice_t">vcfdslice_t</span> | <span title="numpy.typing.NDArray">NDArray</span> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>1D ndarray containing the linearized field (or <code>None</code>)</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="meanas.fdmath.vectorization.unvec" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">unvec</span>
<a href="#meanas.fdmath.vectorization.unvec" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc-overloads">
<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">unvec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">v</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">nvdim</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</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="kc">None</span>
</code></pre></div><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">unvec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">v</span><span class="p">:</span> <span class="n">vfdfield_t</span><span class="p">,</span> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">nvdim</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</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-signature highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nf">unvec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">v</span><span class="p">:</span> <span class="n">vcfdfield_t</span><span class="p">,</span> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">nvdim</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</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">cfdfield_t</span>
</code></pre></div><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">unvec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">v</span><span class="p">:</span> <span class="n">vfdfield2_t</span><span class="p">,</span> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">nvdim</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</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">fdfield2_t</span>
</code></pre></div><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">unvec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">v</span><span class="p">:</span> <span class="n">vcfdfield2_t</span><span class="p">,</span> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">nvdim</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</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">cfdfield2_t</span>
</code></pre></div><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">unvec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">v</span><span class="p">:</span> <span class="n">vfdslice_t</span><span class="p">,</span> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">nvdim</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</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">fdslice_t</span>
</code></pre></div><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">unvec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">v</span><span class="p">:</span> <span class="n">vcfdslice_t</span><span class="p">,</span> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">nvdim</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</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">cfdslice_t</span>
</code></pre></div><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">unvec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">v</span><span class="p">:</span> <span class="n">ArrayLike</span><span class="p">,</span> <span class="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">nvdim</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</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">NDArray</span>
</code></pre></div> </div>
<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">unvec</span><span class="p">(</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">v</span><span class="p">:</span> <span class="n">vfdfield_t</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="o">|</span> <span class="n">vcfdfield_t</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="o">|</span> <span class="n">vfdfield2_t</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="o">|</span> <span class="n">vcfdfield2_t</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="o">|</span> <span class="n">vfdslice_t</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="o">|</span> <span class="n">vcfdslice_t</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="o">|</span> <span class="n">ArrayLike</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <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="n">shape</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="n">nvdim</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</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="p">(</span>
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a> <span class="n">fdfield_t</span>
<a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a> <span class="o">|</span> <span class="n">cfdfield_t</span>
<a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a> <span class="o">|</span> <span class="n">fdfield2_t</span>
<a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a> <span class="o">|</span> <span class="n">cfdfield2_t</span>
<a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a> <span class="o">|</span> <span class="n">fdslice_t</span>
<a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a> <span class="o">|</span> <span class="n">cfdslice_t</span>
<a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a> <span class="o">|</span> <span class="n">NDArray</span>
<a id="__codelineno-0-20" name="__codelineno-0-20" href="#__codelineno-0-20"></a> <span class="o">|</span> <span class="kc">None</span>
<a id="__codelineno-0-21" name="__codelineno-0-21" href="#__codelineno-0-21"></a><span class="p">)</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Perform the inverse of vec(): take a 1D ndarray and output an <code>nvdim</code>-component field
of form e.g. <code>[f_x, f_y, f_z]</code> (<code>nvdim=3</code>) where each of <code>f_*</code> is a len(shape)-dimensional
ndarray.</p>
<p>Returns <code>None</code> if called with <code>v=None</code>.</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>v</code>
</td>
<td>
<code><span title="meanas.fdmath.types.vfdfield_t">vfdfield_t</span> | <span title="meanas.fdmath.types.vcfdfield_t">vcfdfield_t</span> | <span title="meanas.fdmath.types.vfdfield2_t">vfdfield2_t</span> | <span title="meanas.fdmath.types.vcfdfield2_t">vcfdfield2_t</span> | <span title="meanas.fdmath.types.vfdslice_t">vfdslice_t</span> | <span title="meanas.fdmath.types.vcfdslice_t">vcfdslice_t</span> | <span title="numpy.typing.ArrayLike">ArrayLike</span> | None</code>
</td>
<td>
<div class="doc-md-description">
<p>1D ndarray representing a vector field of shape shape (or None)</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>shape</code>
</td>
<td>
<code><span title="collections.abc.Sequence">Sequence</span>[<span title="int">int</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>shape of the vector field</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>nvdim</code>
</td>
<td>
<code><span title="int">int</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Number of components in each vector</p>
</div>
</td>
<td>
<code>3</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.types.fdfield_t">fdfield_t</span> | <span title="meanas.fdmath.types.cfdfield_t">cfdfield_t</span> | <span title="meanas.fdmath.types.fdfield2_t">fdfield2_t</span> | <span title="meanas.fdmath.types.cfdfield2_t">cfdfield2_t</span> | <span title="meanas.fdmath.types.fdslice_t">fdslice_t</span> | <span title="meanas.fdmath.types.cfdslice_t">cfdslice_t</span> | <span title="numpy.typing.NDArray">NDArray</span> | None</code>
</td>
<td>
<div class="doc-md-description">
<p><code>[f_x, f_y, f_z]</code> where each <code>f_</code> is a <code>len(shape)</code> dimensional ndarray (or <code>None</code>)</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-module">
<h2 id="meanas.fdmath.types" 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.fdmath.types</span>
<a href="#meanas.fdmath.types" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents first">
<p>Types shared across multiple submodules</p>
<div class="doc doc-children">
<div class="doc doc-object doc-attribute">
<h3 id="meanas.fdmath.types.dx_lists_t" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code> <span class="doc doc-object-name doc-attribute-name">dx_lists_t</span>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-module-attribute"><code>module-attribute</code></small>
</span>
<a href="#meanas.fdmath.types.dx_lists_t" 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="n">dx_lists_t</span> <span class="o">=</span> <span class="n">Sequence</span><span class="p">[</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>'dxes' datastructure which contains grid cell width information in the following format:</p>
<div class="highlight"><pre><span></span><code>[[[dx_e[0], dx_e[1], ...], [dy_e[0], ...], [dz_e[0], ...]],
[[dx_h[0], dx_h[1], ...], [dy_h[0], ...], [dz_h[0], ...]]]
</code></pre></div>
<p>where <code>dx_e[0]</code> is the x-width of the <code>x=0</code> cells, as used when calculating dE/dx,
and <code>dy_h[0]</code> is the y-width of the <code>y=0</code> cells, as used when calculating dH/dy, etc.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="meanas.fdmath.types.dx_lists2_t" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code> <span class="doc doc-object-name doc-attribute-name">dx_lists2_t</span>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-module-attribute"><code>module-attribute</code></small>
</span>
<a href="#meanas.fdmath.types.dx_lists2_t" 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="n">dx_lists2_t</span> <span class="o">=</span> <span class="n">Sequence</span><span class="p">[</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">Sequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>2D 'dxes' datastructure which contains grid cell width information in the following format:</p>
<div class="highlight"><pre><span></span><code>[[[dx_e[0], dx_e[1], ...], [dy_e[0], ...]],
[[dx_h[0], dx_h[1], ...], [dy_h[0], ...]]]
</code></pre></div>
<p>where <code>dx_e[0]</code> is the x-width of the <code>x=0</code> cells, as used when calculating dE/dx,
and <code>dy_h[0]</code> is the y-width of the <code>y=0</code> cells, as used when calculating dH/dy, etc.</p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="meanas.fdmath.types.dx_lists_mut" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code> <span class="doc doc-object-name doc-attribute-name">dx_lists_mut</span>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-module-attribute"><code>module-attribute</code></small>
</span>
<a href="#meanas.fdmath.types.dx_lists_mut" 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="n">dx_lists_mut</span> <span class="o">=</span> <span class="n">MutableSequence</span><span class="p">[</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">MutableSequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Mutable version of <code>dx_lists_t</code></p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="meanas.fdmath.types.dx_lists2_mut" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code> <span class="doc doc-object-name doc-attribute-name">dx_lists2_mut</span>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-module-attribute"><code>module-attribute</code></small>
</span>
<a href="#meanas.fdmath.types.dx_lists2_mut" 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="n">dx_lists2_mut</span> <span class="o">=</span> <span class="n">MutableSequence</span><span class="p">[</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">MutableSequence</span><span class="p">[</span><span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span> <span class="o">|</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="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Mutable version of <code>dx_lists2_t</code></p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="meanas.fdmath.types.fdfield_updater_t" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code> <span class="doc doc-object-name doc-attribute-name">fdfield_updater_t</span>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-module-attribute"><code>module-attribute</code></small>
</span>
<a href="#meanas.fdmath.types.fdfield_updater_t" 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="n">fdfield_updater_t</span> <span class="o">=</span> <span class="n">Callable</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="n">fdfield</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Convenience type for functions which take and return a real <code>fdfield</code></p>
</div>
</div>
<div class="doc doc-object doc-attribute">
<h3 id="meanas.fdmath.types.cfdfield_updater_t" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code> <span class="doc doc-object-name doc-attribute-name">cfdfield_updater_t</span>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-module-attribute"><code>module-attribute</code></small>
</span>
<a href="#meanas.fdmath.types.cfdfield_updater_t" 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="n">cfdfield_updater_t</span> <span class="o">=</span> <span class="n">Callable</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="n">cfdfield</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Convenience type for functions which take and return a complex <code>cfdfield</code></p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.fdfield" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">fdfield</span>
<a href="#meanas.fdmath.types.fdfield" 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="nc">fdfield</span> <span class="o">=</span> <span class="n">fdfield_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Vector field with shape (3, X, Y, Z) (e.g. <code>[E_x, E_y, E_z]</code>)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.vfdfield" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">vfdfield</span>
<a href="#meanas.fdmath.types.vfdfield" 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="nc">vfdfield</span> <span class="o">=</span> <span class="n">vfdfield_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Linearized vector field (single vector of length 3<em>X</em>Y*Z)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.cfdfield" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">cfdfield</span>
<a href="#meanas.fdmath.types.cfdfield" 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="nc">cfdfield</span> <span class="o">=</span> <span class="n">cfdfield_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Complex vector field with shape (3, X, Y, Z) (e.g. <code>[E_x, E_y, E_z]</code>)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.vcfdfield" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">vcfdfield</span>
<a href="#meanas.fdmath.types.vcfdfield" 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="nc">vcfdfield</span> <span class="o">=</span> <span class="n">vcfdfield_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Linearized complex vector field (single vector of length 3<em>X</em>Y*Z)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.fdslice" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">fdslice</span>
<a href="#meanas.fdmath.types.fdslice" 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="nc">fdslice</span> <span class="o">=</span> <span class="n">fdslice_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Vector field slice with shape (3, X, Y) (e.g. <code>[E_x, E_y, E_z]</code> at a single Z position)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.vfdslice" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">vfdslice</span>
<a href="#meanas.fdmath.types.vfdslice" 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="nc">vfdslice</span> <span class="o">=</span> <span class="n">vfdslice_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Linearized vector field slice (single vector of length 3<em>X</em>Y)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.cfdslice" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">cfdslice</span>
<a href="#meanas.fdmath.types.cfdslice" 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="nc">cfdslice</span> <span class="o">=</span> <span class="n">cfdslice_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Complex vector field slice with shape (3, X, Y) (e.g. <code>[E_x, E_y, E_z]</code> at a single Z position)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.vcfdslice" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">vcfdslice</span>
<a href="#meanas.fdmath.types.vcfdslice" 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="nc">vcfdslice</span> <span class="o">=</span> <span class="n">vcfdslice_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>Linearized complex vector field slice (single vector of length 3<em>X</em>Y)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.fdfield2" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">fdfield2</span>
<a href="#meanas.fdmath.types.fdfield2" 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="nc">fdfield2</span> <span class="o">=</span> <span class="n">fdfield2_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>2D Vector field with shape (2, X, Y) (e.g. <code>[E_x, E_y]</code>)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.vfdfield2" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">vfdfield2</span>
<a href="#meanas.fdmath.types.vfdfield2" 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="nc">vfdfield2</span> <span class="o">=</span> <span class="n">vfdfield2_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">floating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>2D Linearized vector field (single vector of length 2<em>X</em>Y)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.cfdfield2" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">cfdfield2</span>
<a href="#meanas.fdmath.types.cfdfield2" 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="nc">cfdfield2</span> <span class="o">=</span> <span class="n">cfdfield2_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>2D Complex vector field with shape (2, X, Y) (e.g. <code>[E_x, E_y]</code>)</p>
</div>
</div>
<div class="doc doc-object doc-type_alias">
<h3 id="meanas.fdmath.types.vcfdfield2" class="doc doc-heading">
<code class="doc-symbol doc-symbol-heading doc-symbol-type_alias"></code> <span class="doc doc-object-name doc-type_alias-name">vcfdfield2</span>
<a href="#meanas.fdmath.types.vcfdfield2" 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="nc">vcfdfield2</span> <span class="o">=</span> <span class="n">vcfdfield2_t</span> <span class="o">|</span> <span class="n">NDArray</span><span class="p">[</span><span class="n">complexfloating</span><span class="p">]</span>
</code></pre></div>
<div class="doc doc-contents ">
<p>2D Linearized complex vector field (single vector of length 2<em>X</em>Y)</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>