0
$\begingroup$

EDIT:

I need to solve the following PDE:

$\nabla^2\vec{A}=-\mu_{0}\vec{j}$ where $\vec{j}=\sigma\vec{E}$ and $\sigma=1*10^{10}$

which basically boils down to three different PDE's;

$\frac{\partial^2 A_x}{\partial x^2}+\frac{\partial^2 A_x}{\partial y^2}+\frac{\partial^2 A_x}{\partial z^2}=-\mu_0 j_x$
$\frac{\partial^2 A_y}{\partial x^2}+\frac{\partial^2 A_y}{\partial y^2}+\frac{\partial^2 A_y}{\partial z^2}=-\mu_0 j_y$
$\frac{\partial^2 A_z}{\partial x^2}+\frac{\partial^2 A_z}{\partial y^2}+\frac{\partial^2 A_z}{\partial z^2}=-\mu_0 j_z$

In the code $\vec{j}$ is called CurrentDensity and each above equation is subject to Dirichlet boundary conditions.

I have tried a different approach to the original one (using the original code as well), as follows:

DC2x = {
        DirichletCondition[
        Ax[x, y, z] == 0,
        ContactPad1
      ],
        DirichletCondition[
        Ax[x, y, z] == 5,
        ContactPad2
      ]
     }

DC2y = {
        DirichletCondition[
        Ay[x, y, z] == 0,
        ContactPad1
      ],
        DirichletCondition[
        Ay[x, y, z] == 5,
        ContactPad2
      ]
     }

DC2z = {
        DirichletCondition[
        Az[x, y, z] == 0,
        ContactPad1
      ],
        DirichletCondition[
        Az[x, y, z] == 5,
        ContactPad2
      ]
     }

Magneticpotentialx = 
 NDSolveValue[{Laplacian[Ax[x, y, z], {x, y, z}] ==
-mu*CurrentDensity[[1]], DC2x}, Ax, {x, y, z} \[Element] R1]

Magneticpotentialy = 
 NDSolveValue[{Laplacian[Ay[x, y, z], {x, y, z}] == 
 -mu*CurrentDensity[[2]], DC2y}, Ay, {x, y, z} \[Element] R1]

Magneticpotentialz = 
 NDSolveValue[{Laplacian[Az[x, y, z], {x, y, z}] == 
 -mu*CurrentDensity[[3]], DC2z}, Az, {x, y, z} \[Element] R1]

Clear["Magneticpotential"]

Magneticpotential = {Magneticpotentialx, Magneticpotentialy,  Magneticpotentialz}

But when i try to plot it nothing comes up (not to mention the NDsolveValue parts take a long time to compute);

Show[ 
 VectorPlot3D[
  Magneticpotential, {x, -a, a}, {y, -b, b}, {z, -t/2, t/2}, 
  WorkingPrecision -> 60, VectorPoints -> {8, 8, 5}, 
  VectorScale -> {Automatic, Automatic, None}],
 RegionPlot3D[R1, PlotStyle -> Opacity[0.3], Boxed -> False],
 RegionPlot3D[
  ImplicitRegion[
   ContactPad2, {{x, -a, a}, {y, -b, b}, {z, -t/2, t/2}}], 
  Axes -> True, PlotStyle -> Opacity[0.9]], 
 RegionPlot3D[
  ImplicitRegion[
   ContactPad1, {{x, -a, a}, {y, -b, b}, {z, -t/2, t/2}}], 
  Axes -> True, PlotStyle -> Opacity[0.9]]
 ]

ORIGINAL POST:

I keep receiving an error when trying to solve a 3-D partial vector differential equation. The error states that the equations has inconsistent dimensions. Another problem I am experiencing is sometimes, for no apparent reason, all the variable assignments I have set earlier are reset (e.g a, b, t, DC1, etc.). The following is the code I have so far:

a =  2*10^(-6); b = 1*10^(-6); t =  30*10^(-9);

R1 = ImplicitRegion[
   ((x/(a))^2 + (y/(b))^2 <= 1) \[And] (Abs[z] <= t/2),
   {{x, -a,  a}, {y, -b, b}, {z, -t/2, t/2}}
   ];

ContactPad1 = ((x/a)^2 + (y/b)^2 <= 1) \[And] 
   14.5*10^(-9) <= z <= 15*10^(-9) \[And] (x <= -1.6*10^(-6));

ContactPad2 = ((x/a)^2 + (y/b)^2 <= 1) \[And] 
14.5*10^(-9) <= z <= 15*10^(-9) \[And] (x >= 1.6*10^(-6));

DC1 = { 
DirichletCondition[
u[x, y, z] == 0, 
ContactPad1
 ], 
DirichletCondition[
    u[x, y, z] == 5,  
ContactPad2
]
}

DC2 = {
DirichletCondition[
A[x, y, z] == {0,0,0},
ContactPad1
],
DirichletCondition[
A[x, y, z] == {5,5,5},
ContactPad2
]
}

pot = NDSolveValue[
{
Laplacian[u[x, y, z], {x, y, z}] == 0,
DC1
},
u,
Element[{x, y, z}, R1]
];

Efield = -Grad[pot[x, y, z],{x, y, z}];

mu = Subscript[\[Mu], 0] = 4 Pi*10^(-7);

CurrentDensityMagnitude = 1*10^(10);

CurrentDensity = CurrentDensityMagnitude*Efield;

Magneticpotential = 
NDSolveValue[{Laplacian[A[x, y, z], {x, y, z}] == -mu*CurrentDensity,
DC2}, A, {x, y, z} \[Element] R1
];

NDSolveValue::femper: PDE parsing error of {{A$6013+<<4>>,<<1>>,<<1>>}}. Inconsistent equation dimensions.

Bfield = Curl[Magneticpotential,{x,y,z}];
$\endgroup$
  • $\begingroup$ Highly doubt it you didn't notice people editing your previous questions -- please, go to the help centre and educate yourself on the topics of code formatting, properly copying content from Mathematica itself, etc $\endgroup$ – Sektor Jul 27 '15 at 8:16
  • $\begingroup$ It looks like your boundary conditions do not properly intersect the region R1. Try z <= ... in place of z==... $\endgroup$ – user21 Jul 27 '15 at 8:55
  • $\begingroup$ Also, there is not need for the options to NDSolve $\endgroup$ – user21 Jul 27 '15 at 8:55
  • $\begingroup$ I have amended ContactPad1 and ContactPad2 so that they properly intersect R1. I have also removed the options from NDSolveValue. I think part of the problem is DC2, since I set A[x,y,z] == 0 but it should be A[x,y,z]=={0,0,0} since its a vector? I have changed DC2 but i get the same (well, similar) error: PDE parsing error of {{<<1>>}}. Inconsistent equation dimensions. Thank you for the formatting Sektor. I will try to make it look nicer myself next time. $\endgroup$ – Michael ponds Jul 27 '15 at 9:07
  • $\begingroup$ I will update the code in my original post. $\endgroup$ – Michael ponds Jul 27 '15 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.