Following Tutorial-VacuumMaxwell_formulation_Cartesian and Tutorial-Start_to_Finish-Solving_Maxwells_Equations_in_Vacuum-Cartesian notebook, the user will note that solving the system of equations seems computationally wasteful. The toroidal dipole field initial data as implemented in this tutorial are axisymmetric, so one hardly needs to sample the numerical solution in the ϕ direction. Thus, the numerical solution requires sampling in the r and θ directions. Therefore, evolving these initial data in Cartesian coordinates is wasteful, as we do not take advantages of the symmetry of the problem. To do so, we must evolve the system in spherical or cylindrical like coordinate systems, or curvilinear coordinate systems. However, we must then reformulate Maxwell's equations into a covariant form.
As is standard in NRPy+,
Our current formulation of Maxwell's equations remains non-covariant, i.e. the forms of the equations will be altered if we move to curvilinear coordinates. To address this issue, and thus allow us to write the equations down in any arbitrary coordinate system, we must rewrite the equations to be manifestly covariant.
We begin this process by employing the so-called "comma goes to semi-colon rule," replacing all partial derivatives, which do not transform as tensorial quantities, with covariant derivatives, which do. Rewriting Maxwell's equations with only tensorial quantities will yield a covariant formulation of the equations. So, starting with System II in this tutorial,
∂tAi=−Ei−∂iφ→−Ei−ˆ∇iφ=−Ei−ˆgijˆ∇jφ,∂tEi=∂iΓ−∂j∂jAi→ˆ∇iΓ−ˆ∇jˆ∇jAi=ˆgijˆ∇jΓ−ˆgjkˆ∇jˆ∇kAi,∂tΓ=−∂i∂iφ→−ˆ∇iˆ∇iφ=−ˆgijˆ∇iˆ∇jφ,∂tφ=−Γ,where ˆ∇i is the covariant derivative associated with the reference metric ˆgij which describes a flat space background, in an arbitrary coordinate system. Expanding the above equations using the standard covariant derivative definitions, we arrive at
∂tAi=−Ei−ˆgij∂jφ,∂tEi=ˆgij∂jΓ−ˆgjkˆ∇jˆ∇kAi,∂tΓ=−ˆgij(∂i∂jφ−ˆΓkji∂kφ),∂tφ=−Γ,and subject to constraints
G≡Γ−∂iAi−ˆΓijiAj=0,C≡∂iEi+ˆΓijiEj=0,where ˆΓijk is the metric connection associated with ˆgij.
In the cell below we expand the covariant laplacian within the evolution equation for Ei.
Based on the definition of the covariant derivative, we have ˆ∇kAi=Ai,k+ˆΓimkAm
Since ˆ∇kAi is a tensor, the covariant derivative of this will have the same indexing as a tensor Tik:
ˆ∇jTik=Tik,j+ˆΓidjTdk−ˆΓdkjTid.Therefore, ˆ∇j(ˆ∇kAi)=(Ai,k+ˆΓimkAm),j+ˆΓidj(Ad,k+ˆΓdmkAm)−ˆΓdkj(Ai,d+ˆΓimdAm)=Ai,kj+ˆΓimk,jAm+ˆΓimkAm,j+ˆΓidjAd,k+ˆΓidjˆΓdmkAm−ˆΓdkjAi,d−ˆΓdkjˆΓimdAm=Ai,kj⏟Term 1+ˆΓimk,jAm+ˆΓimkAm,j+ˆΓidjAd,k−ˆΓdkjAi,d⏟Term 2+ˆΓidjˆΓdmkAm−ˆΓdkjˆΓimdAm⏟Term 3,
resulting in
∂tEi=ˆgij∂jΓ−ˆgjkˆ∇j(ˆ∇kAi)=ˆgij∂jΓ−ˆgjk(Term 1+Term 2+Term 3)Consider an arbitrary vector Λi, with smooth (continous) Cartesian components Λx, Λy, and Λz. Transforming Λi to, e.g. spherical coordinates, introduces terms that spoil the smoothness of Λi;
Λϕ=1rsinθ×[smooth part].Evolving Λϕ will introduce instabilities along the z-axis. To avoid this, we instead evolve the rescaled quantity λi, defined by
ˉΛi=λiscalefactor[i].where we use the Hadamard product of matrices, and no sums are implied by the repeated indices.
Thus, we evolve the smoothed variable λi, via
λi=ˉΛiscalefactor[i].Within Nrpy+, ReU[i] = 1/scalefactor[i], giving
λi=ˉΛiReU[i].We now define the rescaled quantities ai and ei and rewrite our formulation of Maxwell's equations in curvilinear coordinates;
ai=AiReU[i],ei=EiReU[i],Taking a time derivative on both sides,
∂tai=∂tAiReU[i]=−Ei−ˆgij∂jφReU[i]=−ei−ˆgij∂jφReU[i],∂tei=∂tEiReU[i]=ˆgij∂jΓ−ˆgjkˆ∇j(ˆ∇kAi)ReU[i]=ˆgij∂jΓReU[i]−ˆgjkˆ∇j(ˆ∇kaiReU[i])ReU[i],Given that
∂tEi=ˆgij∂jΓ⏟Term 1−ˆγjk(Ai,kj⏟Term 2+ˆΓimk,jAm+ˆΓimkAm,j+ˆΓidjAd,k−ˆΓdkjAi,d⏟Term 3+ˆΓidjˆΓdmkAm−ˆΓdkjˆΓimdAm⏟Term 4).we can make the following replacements within the above, in terms of NRPy+ code;
Ai=AU[i]→aU[i] * rfm.ReU[i]∂jAi=AUdD[i][j]→aU_dD[i][j] * rfm.ReU[i]+aU[i] * rfm.ReUdD[i][j]∂k∂jAi=AUdDD[i][j][k]→aU_dDD[i][j][k] * rfm.ReU[i]+aU_dDD[i][j] * rfm.ReUdD[i][k]+aU_dD[i][k] * rfm.ReUdD[i][j]+aU[i] * rfm.ReUdDD[i][j][k]The remainder of Maxwell's equations are unchanged;
∂tΓ=−ˆgij(∂i∂jφ−ˆΓkji∂kφ),subject to constraints
G≡Γ−∂iAi−ˆΓijiAj=0,C≡∂iEi+ˆΓijiEj=0.These equations are implemement in this tutorial, and evolved in time in this tutorial.
The following code cell converts this Jupyter notebook into a proper, clickable LATEX-formatted PDF file. After the cell is successfully run, the generated PDF may be found in the root NRPy+ tutorial directory, with filename Tutorial-VacuumMaxwell_formulation_Curvilinear.pdf (Note that clicking on this link may not work; you may need to open the PDF file through another means.)
import cmdline_helper as cmd # NRPy+: Multi-platform Python command-line interface
cmd.output_Jupyter_notebook_to_LaTeXed_PDF("Tutorial-VacuumMaxwell_formulation_Curvilinear")
Created Tutorial-VacuumMaxwell_formulation_Curvilinear.tex, and compiled LaTeX file to PDF file Tutorial- VacuumMaxwell_formulation_Curvilinear.pdf