0

I would like to solve numerically a modified Laplace PDE (with source terms) and which have a second-order mixed partial derivative,

enter image description here

and is limited to the following region

enter image description here

and periodic boundary conditions.

The code used is

m=1;
A2=-1.*10^-23;
A3=-1.*10^-28;
A4=1.*10^-14;
eq = m Sin[\[Theta]] + 
   A2 Sin[\[Theta]] Cos[\[Theta]] D[
     F[\[Theta], \[Phi]], {\[Theta], 1}] + 
   A2 Sin[\[Theta]]^2 D[F[\[Theta], \[Phi]], {\[Theta], 2}] + 
   A3 D[F[\[Theta], \[Phi]], {\[Phi], 2}] + 
   A4 D[F[\[Theta], \[Phi]], {\[Theta], 1}, {\[Phi], 1}];


sol = NDSolveValue[{eq == 0, F[0, \[Phi]] == F[2 \[Pi], \[Phi]], 
    F[\[Theta], 0] == F[\[Theta], \[Pi]] == 0}, 
   F, {\[Theta], 0, 2 \[Pi]}, {\[Phi], 0, \[Pi]}];

However, the following note appears.

NDSolveValue::ivone: Boundary values may only be specified for one independent variable. Initial values may only be specified at one value of the other independent variable. >>

can anybody help me?

user21
  • 39,710
  • 8
  • 110
  • 167
SAC
  • 1,335
  • 8
  • 17
  • What is the reason to use so small coefficients A2, A3, A4? – Alex Trounev May 09 '20 at 19:45
  • @AlexTrounev The parameters Ai (i=2,3,4) are related to the speed of light and frequency of radiation – SAC May 09 '20 at 20:34
  • Why not normalize the problem so you do not have to use such very small numbers? it is not practical to work with numbers like 10^-28 in the code. – Nasser May 09 '20 at 20:36
  • @TimLaska I edited the equations because I had forgotten to insert A4 – SAC May 09 '20 at 20:43
  • @AlexTrounev yes, I will do that. – SAC May 09 '20 at 20:44
  • Is it possible you dropped a factor of 2 on your second term? Your 2nd and 3rd term almost look like a product rule $A2\frac{{{\partial ^2}{{\sin }^2}\left( \theta \right)F\left( {\theta ,\phi } \right)}}{{\partial {\theta ^2}}} = A2{\sin ^2}\left( \theta \right)\frac{{{\partial ^2}F\left( {\theta ,\phi } \right)}}{{\partial {\theta ^2}}} + 2A2\sin \left( \theta \right)\cos \left( \theta \right)\frac{{\partial F\left( {\theta ,\phi } \right)}}{{\partial \theta }}$, but it is missing a factor of 2. Also, showing how your parameters $m,A2,A3,A4$ are derived with units would help. – Tim Laska May 10 '20 at 02:22
  • @TimLaska, The parameters take the following form $$ A2=\frac{\frac{\alpha,\epsilon^{2},\omega^2}{c^2}}{\frac{\epsilon^2,\omega^2}{c^2}-\alpha^2}, ,,,A3=\frac{\frac{\epsilon^{2},\omega^2}{c^2}}{\frac{\epsilon^2,\omega^2}{c^2}-\alpha^2},,,, A4=1+\frac{\alpha^2}{\frac{\epsilon^2,\omega^2}{c^2}-\alpha^2}-\frac{\epsilon,\omega}{c}\frac{\alpha}{\frac{\epsilon^{2},\omega^{2}}{c^2}-\alpha^{2}}\ ~\ ~\ \alpha=10^{7}, ,,,,c=10^{10}, ,,,,\epsilon=100, ,,,,\omega=10^{10}, ,,,, m=1 $$ – SAC May 10 '20 at 15:43
  • @TimLaska and the term refered in the PDE is $$ A2,sin(\theta),\partial_{\theta},(sin(\theta),\partial_{\theta}F(\theta,\phi))$$ – SAC May 10 '20 at 15:48
  • @SAC When I evaluate what you give in the comment, I obtain {A2, A3, A4} = {-0.001, -1.0*^-10, 1.0*^-5}, which is not close to what you give in the question. The reason I asked about the product rule, is that we could probably use FEM with Dirichlet and PeriodicBoundaryConditions as it would easily map into the coefficient form of the PDE. – Tim Laska May 10 '20 at 17:50

1 Answers1

5

This is not an answer, but a suggestion to investigate whether your system can be reformulated so that it can be solved by the Finite Element Method, FEM. Your boundary conditions appear to be a DirichletCondition on the top and bottom boundaries and a PeriodicBoundaryCondition on the left and right boundaries.

To use the FEM method it is good to cast your equations into coefficient form as shown FEM Tutorial.

$$\frac{{{\partial ^2}}}{{\partial {t^2}}}u + d\frac{\partial }{{\partial t}}u + \nabla \cdot\left( { - c\nabla u - \alpha u + \gamma } \right) + \beta \cdot\nabla u + au - f = 0$$

Many physical phenomena map naturally into this form. For example, let's consider a steady-state heat transfer example of a region with a volumetric energy source and a heat flux vector, $\mathbf{q}$. The balance equation is simply the divergence of the heat flux equals the volumetric heat source, or:

$$\nabla \cdot {\mathbf{q}} - \frac{{source}}{{volume}} = 0$$

Now, this is not in coefficient form yet. Often in physics, a flux can be related to the negative gradient of a scalar potential. In diffusive heat transfer, the heat flux, $\mathbf{q}$ can be related to the Temperature potential through Fourier's Law of Conduction.

$$\nabla \cdot {\mathbf{q}} = \nabla \cdot ( - \mathop {\mathbf{k}}\limits_ = \cdot \nabla T)$$

$$\nabla \cdot ( - \mathop {\mathbf{k}}\limits_ = \cdot \nabla T) - \frac{{source}}{{volume}} = 0$$

$$\nabla \cdot ( - \mathop {\mathbf{k}}\limits_ = \cdot \nabla T) - \frac{{source}}{{volume}} = 0$$ $$\nabla \cdot \left( { - \left( {\begin{array}{*{20}{c}} {{k_{11}}}&{{k_{12}}} \\ {{k_{21}}}&{{k_{22}}} \end{array}} \right) \cdot \nabla T} \right) - \frac{{source}}{{volume}} = 0$$

Now, we are consistent with the FEM coefficient form. The presence of off diagonal terms in the $\mathop {\mathbf{k}}\limits_ = $ matrix will lead to mixed partials. In my brief experimentation, it did not like the off diagonal terms to be larger in magnitude than the diagonal terms.

There is a discrepancy about the parameters described in the OP and the definitions given by the OP comments. It will be unlikely that numerical analysis will work if your terms vary over 20 orders of magnitude. If you could reformulate your problem into coefficient form and resolve the discrepancy of the parameters, then you could try a workflow based on the documentation for PeriodicBoundaryCondition like the following:

Needs["NDSolve`FEM`"]
Ω = Rectangle[{0, 0}, {2 Pi, Pi}];
mesh = ToElementMesh[Ω, 
   "MeshElementType" -> TriangleElement, MaxCellMeasure -> .01];
f = TranslationTransform[{2 Pi, 0}];
Show[RegionPlot[Ω], 
 Graphics[{Thickness[0.015], #}] & /@ {{Darker[Green], 
      TransformedRegion[#, f]}, {Darker[Blue], #}} &[
  Line[{{0, 0}, {0, Pi}}]], AspectRatio -> Automatic]
op = ((Inactive[
       Div][(-{{1/2 + Sin[θ]^2, 1/2}, {1/2, 1/1}}.Inactive[Grad][
          F[θ, ϕ], {θ, ϕ}]), {θ, \
ϕ}]) - Sin[θ]);
pde = op == 0;
dc = DirichletCondition[
   F[θ, ϕ] == 0, (ϕ <= 0 || ϕ >= Pi) && 
    0 < θ <= 2 Pi];
pbc = PeriodicBoundaryCondition[F[θ, ϕ], θ == 0, f];
ufun = NDSolveValue[{pde, pbc, dc}, 
   F, {θ, ϕ} ∈ mesh];
cp = ContourPlot[
  ufun[θ, ϕ], {θ, ϕ} ∈ 
   ufun["ElementMesh"], ColorFunction -> "TemperatureMap", 
  AspectRatio -> Automatic, PlotPoints -> All, PlotRange -> All]
Show[MapAt[Translate[#, {2 Pi, 0}] &, cp, 1], cp, 
 MapAt[Translate[#, {-2 Pi, 0}] &, cp, 1], PlotRange -> All]
Plot3D[ufun[θ, ϕ], {θ, ϕ} ∈ mesh, 
 ColorFunction -> "TemperatureMap", AspectRatio -> Automatic, 
 PlotPoints -> All, PlotRange -> All]

Results

Update to Include Forward and Reverse PBC

Based on the discussion to this MSE question, there is an implied NeumannValue on the source boundary. A potential workaround is to apply a forward and reverse PeriodicBoundaryCondition. I have not validated this work around, but I include it for completeness.

Ω = Rectangle[{0, 0}, {2 Pi, Pi}];
(* Add some refinement to reduce spike in corner *)
mrf = Function[{vertices, area}, 
   Block[{x, y}, {x, y} = Mean[vertices]; 
    If[Sin[x]^2 < 0.001, area > 0.0005, area > 0.0025]]];
mesh = ToElementMesh[Ω, 
   "MeshElementType" -> TriangleElement, MaxCellMeasure -> .01, 
   MeshRefinementFunction -> mrf];
f = TranslationTransform[{2 Pi, 0}];
rev = TranslationTransform[{-2 Pi, 0}];
dc = DirichletCondition[
   F[θ, ϕ] == 0, (ϕ < 0 || ϕ > Pi) && 
    0 < θ <= 2 Pi];
pbcf = PeriodicBoundaryCondition[F[θ, ϕ], θ <= 0, 
   f];
pbcr = PeriodicBoundaryCondition[
   F[θ, ϕ], θ >= 2 Pi, rev];
ufun = NDSolveValue[{pde, pbcf, pbcr, dc}, 
   F, {θ, ϕ} ∈ mesh];
cp = ContourPlot[
  ufun[θ, ϕ], {θ, ϕ} ∈ 
   ufun["ElementMesh"], ColorFunction -> "TemperatureMap", 
  AspectRatio -> Automatic, PlotPoints -> All, PlotRange -> All]
Show[MapAt[Translate[#, {2 Pi, 0}] &, cp, 1], cp, 
 MapAt[Translate[#, {-2 Pi, 0}] &, cp, 1], PlotRange -> All]
Plot3D[ufun[θ, ϕ], {θ, ϕ} ∈ mesh, 
 ColorFunction -> "TemperatureMap", AspectRatio -> Automatic, 
 PlotPoints -> All, PlotRange -> All]

Forward and Reverse PBC

Tim Laska
  • 16,346
  • 1
  • 34
  • 58