From 92804e8c3ec8280a8c4de9aacfc47995ec6961b3 Mon Sep 17 00:00:00 2001 From: MiniUFO Date: Thu, 8 Dec 2022 11:19:12 +0800 Subject: [PATCH] minor fix of math --- notebooks/01. Introduction to xinvert.ipynb | 49 --------------------- 1 file changed, 49 deletions(-) diff --git a/notebooks/01. Introduction to xinvert.ipynb b/notebooks/01. Introduction to xinvert.ipynb index 19b978a..9dbaaf6 100644 --- a/notebooks/01. Introduction to xinvert.ipynb +++ b/notebooks/01. Introduction to xinvert.ipynb @@ -14,13 +14,7 @@ "\n", "## 1. Introduction\n", "Researches on meteorology and oceanography usually encounter [inversion problems](https://doi.org/10.1017/CBO9780511629570) that need to be solved numerically. One of the classical inversion problem is to solve for a streamfunction $\\psi$ given the vertical component of vorticity $\\zeta$ and proper boundary conditions:\n", -<<<<<<< HEAD ">$$\\nabla^2 \\psi = \\frac{\\partial^2 \\psi}{\\partial y^2} +\\frac{\\partial^2 \\psi}{\\partial x^2} =\\zeta$$\n", -======= - ">$$\n", - ">\\nabla^2 \\psi = \\frac{\\partial^2 \\psi}{\\partial y^2} +\\frac{\\partial^2 \\psi}{\\partial x^2} =\\zeta\n", - ">$$\n", ->>>>>>> 7c5b44e27a409c7fffcedbdd4e9592817fc68279 "\n", "Nowadays [`xarray`](http://xarray.pydata.org/en/stable/) becomes a popular data structure commonly used in [Big Data Geoscience](https://pangeo.io/). Since the whole 4D data, as well as the coordinate information, are all combined into [`xarray`](http://xarray.pydata.org/en/stable/), solving the inversion problem become quite straightforward and the only input would be just one [`xarray.DataArray`](http://xarray.pydata.org/en/stable/) of $\\zeta$. Inversion on the spherical earth, like some meteorological problems, could utilize the spherical harmonics like [windspharm](https://github.com/ajdawson/windspharm), which would be more efficient using FFT than SOR used here. However, in the case of ocean, SOR method is definitely a better choice in the presence of land/sea mask.\n", "\n", @@ -31,7 +25,6 @@ "---\n", "## 2. Mathematical background\n", "This package, `xinvert`, is designed to solve the following abstract equation:\n", -<<<<<<< HEAD ">$$L\\left(\\psi \\right) = F \\tag{1}$$\n", "\n", "where $L$ is a second-order partial differential operator, $\\psi$ is the unknown to be inverted for, and $F$ a prescribed forcing function. There could be also some parameters in the definition of $L$, which should be specified before inverting $\\psi$.\n", @@ -51,48 +44,6 @@ "\n", "or in **fourth-order** case (Munk model):\n", ">$$\\begin{align}L\\left(\\psi\\right) &\\equiv A\\frac{\\partial^4 \\psi}{\\partial y^4}+B\\frac{\\partial^4 \\psi}{\\partial y^2 \\partial x^2}+C\\frac{\\partial^4 \\psi}{\\partial x^4}\\notag\\\\&+D\\frac{\\partial^2 \\psi}{\\partial y^2}+E\\frac{\\partial^2 \\psi}{\\partial y \\partial x}+F\\frac{\\partial^2 \\psi}{\\partial x^2}+G\\frac{\\partial \\psi}{\\partial y}+H\\frac{\\partial \\psi}{\\partial x}+I\\psi = J \\tag{5}\\end{align}$$\n", -======= - ">$$\n", - ">\\begin{align}\n", - ">L\\left(\\psi \\right) = F \\label{Eq1}\\tag{1}\n", - ">\\end{align}\n", - ">$$\n", - "\n", - "where $L$ is a second-order partial differential operator, $\\psi$ is the unknown to be inverted for, and $F$ a prescribed forcing function. There could be also some parameters in the definition of $L$, which should be specified before inverting $\\psi$.\n", - "\n", - "For the **2D case**, the **general form** of Eq. ($\\ref{Eq1}$) is:\n", - ">$$\n", - ">\\begin{align}\n", - ">L\\left(\\psi\\right) \\equiv A\\frac{\\partial^2 \\psi}{\\partial y^2}+B\\frac{\\partial^2 \\psi}{\\partial y \\partial x}+C\\frac{\\partial^2 \\psi}{\\partial x^2}+D\\frac{\\partial \\psi}{\\partial y}+E\\frac{\\partial \\psi}{\\partial x}+F\\psi = G \\label{Eq2} \\tag{2}\n", - ">\\end{align}\n", - ">$$\n", - "\n", - "where coefficients $A-G$ are all known variables. When the condition $4AC-B^2>0$ is met everywhere in the domain, the above equation is an elliptic-type equation. In this case, one can invert $\\psi$ using the [SOR](https://mathworld.wolfram.com/SuccessiveOverrelaxationMethod.html) iteration method. When $4AC-B^2=0$ or $4AC-B^2<0$, it is a parabolic or hyperbolic equation. In either case, SOR would fail to converge to the solution.\n", - "\n", - "Sometimes the **general form** of Eq. ($\\ref{Eq2}$) can be transformed into the **standard form** (i.e., standarization):\n", - ">$$\n", - ">\\begin{align}\n", - ">L\\left(\\psi\\right) \\equiv \\frac{\\partial}{\\partial y}\\left(A\\frac{\\partial \\psi}{\\partial y}+B\\frac{\\partial \\psi}{\\partial x}\\right) +\\frac{\\partial}{\\partial x}\\left(C\\frac{\\partial \\psi}{\\partial y}+D\\frac{\\partial \\psi}{\\partial x}\\right) + E\\psi =F \\label{Eq3} \\tag{3}\n", - ">\\end{align}\n", - ">$$\n", - "\n", - "In this case, $AD-BC>0$ should be met to insure its ellipticity. The elliptic condition has its own physical meaning in the problems of interest. That is, the system is in steady states that are stable to any small perturbation.\n", - "\n", - "Many problems in meteorology and oceanography can be cast into the forms of either Eq. ($\\ref{Eq2}$) or Eq. ($\\ref{Eq3}$). However, some of them are formulated in **3D case** (like the QG omega equation):\n", - ">$$\n", - ">\\begin{align}\n", - ">L\\left(\\psi\\right) \\equiv \\frac{\\partial}{\\partial z}\\left(A\\frac{\\partial \\psi}{\\partial z}\\right) +\\frac{\\partial}{\\partial y}\\left(B\\frac{\\partial \\psi}{\\partial y}\\right) +\\frac{\\partial}{\\partial x}\\left(C\\frac{\\partial \\psi}{\\partial x}\\right) =F \\label{Eq4} \\tag{4}\n", - ">\\end{align}\n", - ">$$\n", - "\n", - "or in **fourth-order** case (Munk model):\n", - ">$$\n", - ">\\begin{align}\n", - ">L\\left(\\psi\\right) &\\equiv A\\frac{\\partial^4 \\psi}{\\partial y^4}+B\\frac{\\partial^4 \\psi}{\\partial y^2 \\partial x^2}+C\\frac{\\partial^4 \\psi}{\\partial x^4}\\notag\\\\\n", - ">&+D\\frac{\\partial^2 \\psi}{\\partial y^2}+E\\frac{\\partial^2 \\psi}{\\partial y \\partial x}+F\\frac{\\partial^2 \\psi}{\\partial x^2}+G\\frac{\\partial \\psi}{\\partial y}+H\\frac{\\partial \\psi}{\\partial x}+I\\psi = J \\label{Eq5} \\tag{5}\n", - ">\\end{align}\n", - ">$$\n", ->>>>>>> 7c5b44e27a409c7fffcedbdd4e9592817fc68279 "\n", "So we implements four basic solvers to take into account the above four Eqs. (2-5) or cases. If a problem do not fit into one of these four types, we are going to add one solver for this type of problem. We hope **NOT** so because we want to **keep the solvers as minimum and general as possible**.\n", "\n",